当前位置: 首页>>代码示例>>PHP>>正文


PHP MenuItem::RemoveForType方法代码示例

本文整理汇总了PHP中MenuItem::RemoveForType方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::RemoveForType方法的具体用法?PHP MenuItem::RemoveForType怎么用?PHP MenuItem::RemoveForType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MenuItem的用法示例。


在下文中一共展示了MenuItem::RemoveForType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post

 /**
  * @method POST
  */
 function post()
 {
     // get token
     $token = Utilities::ValidateJWTToken();
     // check if token is not null
     if ($token != NULL) {
         parse_str($this->request->data, $request);
         // parse request
         $menuTypeId = $request['menuTypeId'];
         $menuType = MenuType::GetByMenuTypeId($menuTypeId);
         // remove items for type
         MenuItem::RemoveForType($menuType['FriendlyId'], $token->SiteId);
         // remove type
         MenuType::Remove($menuTypeId);
         return new Tonic\Response(Tonic\Response::OK);
     } else {
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
开发者ID:bladep911,项目名称:respond,代码行数:22,代码来源:menuType.php

示例2: PublishDefaultContent

 public static function PublishDefaultContent($site, $theme, $userId)
 {
     // read the defaults file
     $default_json_file = APP_LOCATION . THEMES_FOLDER . '/' . $theme . '/default.json';
     // set $siteId
     $siteId = $site['SiteId'];
     // check to make sure the defaults.json exists
     if (file_exists($default_json_file)) {
         // get json from the file
         $json_text = file_get_contents($default_json_file);
         // decode json
         $json = json_decode($json_text, true);
         // pagetypes
         $pagetypes = array();
         // menu counts
         $primaryMenuCount = 0;
         $footerMenuCount = 0;
         // clear default types
         MenuItem::RemoveForType('primary', $siteId);
         MenuItem::RemoveForType('footer', $siteId);
         // walk through defaults array
         foreach ($json as &$value) {
             // get values from array
             $url = $value['url'];
             $source = $value['source'];
             $name = $value['name'];
             $description = $value['description'];
             $layout = $value['layout'];
             $stylesheet = $value['stylesheet'];
             $primaryMenu = $value['primaryMenu'];
             $footerMenu = $value['footerMenu'];
             $includeOnly = 0;
             // set includeOnly (if specified in default)
             if (isset($value['includeOnly'])) {
                 if ($value['includeOnly'] == true) {
                     $includeOnly = 1;
                 }
             }
             // initialize PT
             $pageType = NULL;
             if (strpos($url, '/') !== false) {
                 // the url has a pagetype
                 $arr = explode('/', $url);
                 // get friendly ids from $url
                 $pageTypeFriendlyId = $arr[0];
                 $pageFriendlyId = $arr[1];
                 $pageTypeId = -1;
                 $pageType = PageType::GetByFriendlyId($pageTypeFriendlyId, $siteId);
                 // create a new pagetype
                 if ($pageType == NULL) {
                     $pageType = PageType::Add($pageTypeFriendlyId, $layout, $stylesheet, 0, $siteId, $userId);
                 }
                 // get newly minted page type
                 $pageTypeId = $pageType['PageTypeId'];
             } else {
                 // root, no pagetype
                 $pageFriendlyId = $url;
                 $pageTypeId = -1;
             }
             // determine if page is unique
             $isUnique = Page::IsFriendlyIdUnique($pageFriendlyId, $pageTypeId, $site['SiteId']);
             // initialize page
             $page = NULL;
             // if page has not been created, create a page
             if ($isUnique == true) {
                 // create a page
                 $page = Page::Add($pageFriendlyId, $name, $description, $layout, $stylesheet, $pageTypeId, $site['SiteId'], $userId);
             } else {
                 // get the page
                 $page = Page::GetByFriendlyId($pageFriendlyId, $pageTypeId, $site['SiteId']);
             }
             // quick check
             if ($page != NULL) {
                 // set the page to active
                 Page::SetIsActive($page['PageId'], 1);
                 // set include only
                 Page::SetIncludeOnly($page['PageId'], $includeOnly);
                 // build the content file
                 $filename = APP_LOCATION . THEMES_FOLDER . '/' . $theme . '/' . $source;
                 $content = '';
                 // get the content for the page
                 if (file_exists($filename)) {
                     $content = file_get_contents($filename);
                     // fix images
                     $content = str_replace('{{site-dir}}', $site['Domain'], $content);
                 }
                 // edit the page content
                 Page::EditContent($page['PageId'], $content, $userId);
                 // build the primary menu
                 if ($primaryMenu == true) {
                     MenuItem::Add($name, '', 'primary', $url, $page['PageId'], $primaryMenuCount, $site['SiteId'], $userId);
                     $primaryMenuCount++;
                 }
                 // build the footer menu
                 if ($footerMenu == true) {
                     MenuItem::Add($name, '', 'footer', $url, $page['PageId'], $footerMenuCount, $site['SiteId'], $userId);
                     $footerMenuCount++;
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:bladep911,项目名称:respond,代码行数:101,代码来源:Publish.php


注:本文中的MenuItem::RemoveForType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。