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


PHP CMSMenu类代码示例

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


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

示例1: setUp

 function setUp()
 {
     parent::setUp();
     // @todo fix controller stack problems and re-activate
     //$this->autoFollowRedirection = false;
     CMSMenu::populate_menu();
 }
开发者ID:rodneyway,项目名称:silverstripe-cms,代码行数:7,代码来源:LeftAndMainTest.php

示例2: init

 public function init()
 {
     parent::init();
     Requirements::css($this->ModuleBase() . '/css/cms-tweaks.css');
     Requirements::javascript($this->ModuleBase() . '/javascript/cms-tweaks.js');
     /* Remove help link */
     CMSMenu::remove_menu_item('Help');
     /* Hide "Add new" page, page Settings tab */
     if (!Permission::check('SITETREE_REORGANISE')) {
         Requirements::javascript($this->ModuleBase() . '/javascript/sitetree-noedit.js');
     }
     /* Hide all error pages in SiteTree and Files (modeladmin) */
     if (!Permission::check('ADMIN')) {
         Requirements::javascript($this->ModuleBase() . '/javascript/hide-error-pages.js');
     }
     /* Add file timestamps for TinyMCE's content_css */
     $css = HtmlEditorConfig::get('cms')->getOption('content_css');
     if ($css) {
         $base_folder = Director::baseFolder();
         $timestamped_css = array();
         $regular_css = preg_split('/,/', $css, -1, PREG_SPLIT_NO_EMPTY);
         foreach ($regular_css as $file) {
             if (is_file($base_folder . '/' . $file)) {
                 array_push($timestamped_css, $file . '?m=' . filemtime($base_folder . '/' . $file));
             }
         }
         if (count($timestamped_css > 0)) {
             HtmlEditorConfig::get('cms')->setOption('content_css', implode(',', $timestamped_css));
         }
     }
 }
开发者ID:axllent,项目名称:silverstripe-cms-tweaks,代码行数:31,代码来源:LeftAndMainCMSTweaksExt.php

示例3: testAdvancedMenuHandling

	public function testAdvancedMenuHandling() {
	
		// Populate from CMS Classes, check for existance of SecurityAdmin
		CMSMenu::clear_menu();
		CMSMenu::populate_menu();
		$menuItem = CMSMenu::get_menu_item('SecurityAdmin');
		$this->assertType('CMSMenuItem', $menuItem, 'SecurityAdmin menu item exists');
		$this->assertEquals($menuItem->url, singleton('SecurityAdmin')->Link(), 'Menu item has the correct link');
		$this->assertEquals($menuItem->controller, 'SecurityAdmin', 'Menu item has the correct controller class');
		$this->assertEquals(
			$menuItem->priority, 
			singleton('SecurityAdmin')->stat('menu_priority'), 
			'Menu item has the correct priority'
		);		
		
		// Check that menu order is correct by priority
		// Note this will break if populate_menu includes normal links (ie, as not controller)
		$menuItems = CMSMenu::get_menu_items();
		$priority = 9999; // ok, *could* be set larger, but shouldn't need to be!
		foreach($menuItems as $menuItem) {
			$this->assertEquals(
				$menuItem->priority, 
				singleton($menuItem->controller)->stat('menu_priority'), 
				"Menu item $menuItem->title has the correct priority"
			);			
			$this->assertLessThanOrEqual($priority, $menuItem->priority, 'Menu item is of lower or equal priority');
		}
	}
开发者ID:redema,项目名称:sapphire,代码行数:28,代码来源:CMSMenuTest.php

示例4: init

 public function init()
 {
     /**
      * If the config is set, display the menu item in the LeftAndMain
      */
     if (!$this->owner->config()->enable_menu_item) {
         CMSMenu::remove_menu_item('CMSSiteDesignController');
     }
 }
开发者ID:helpfulrobot,项目名称:toastnz-silverstripe-site-designer,代码行数:9,代码来源:SiteDesignLeftAndMainExtension.php

示例5: init

 public function init()
 {
     parent::init();
     Requirements::css('silverstripe-upgrade-notification/css/custom.css');
     CMSMenu::remove_menu_item('UpgradeNotificationPage');
     $upgrade_notification_page = new UpgradeNotificationPage();
     if (!$upgrade_notification_page->isCurrentVersion() || $upgrade_notification_page->isCurrentVersion() && $upgrade_notification_page->config()->ShowMenuItemWhenCurrent) {
         CMSMenu::add_menu_item($upgrade_notification_page->getCode(), $upgrade_notification_page->getUpgradeMessage(), 'admin/upgrade/', null, 1000);
     }
 }
开发者ID:bluehousegroup,项目名称:silverstripe-upgrade-notification,代码行数:10,代码来源:UpgradeNotificationLeftAndMainExtension.php

示例6: rules

 /**
  * Gets a list of url_pattern => controller k/v pairs for each LeftAndMain derived controller
  */
 public static function rules()
 {
     if (self::$_rules === null) {
         self::$_rules = array();
         // Map over the array calling add_rule_for_controller on each
         $classes = CMSMenu::get_cms_classes(null, true, CMSMenu::URL_PRIORITY);
         array_map(array(__CLASS__, 'add_rule_for_controller'), $classes);
     }
     return self::$_rules;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:13,代码来源:AdminRootController.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     // @todo fix controller stack problems and re-activate
     //$this->autoFollowRedirection = false;
     CMSMenu::populate_menu();
     $this->backupCss = Config::inst()->get('LeftAndMain', 'extra_requirements_css');
     $this->backupJs = Config::inst()->get('LeftAndMain', 'extra_requirements_javascript');
     $this->backupCombined = Requirements::get_combined_files_enabled();
     Config::inst()->update('LeftAndMain', 'extra_requirements_css', array(FRAMEWORK_DIR . '/tests/assets/LeftAndMainTest.css'));
     Config::inst()->update('LeftAndMain', 'extra_requirements_javascript', array(FRAMEWORK_DIR . '/tests/assets/LeftAndMainTest.js'));
     Requirements::set_combined_files_enabled(false);
 }
开发者ID:nickbooties,项目名称:silverstripe-framework,代码行数:13,代码来源:LeftAndMainTest.php

示例8: init

 public function init()
 {
     /** =========================================
          * @var SiteConfig $config
         ===========================================*/
     $config = SiteConfig::current_site_config();
     /**
      * Remove the Reports menu item in the CMS
      */
     if (!$config->ShowAssetAdmin) {
         CMSMenu::remove_menu_item('AssetAdmin');
     }
     /**
      * Remove the Blog menu item in the CMS
      */
     if (!$config->ShowBlogAdmin) {
         CMSMenu::remove_menu_item('BlogPageModelAdmin');
     }
     /**
      * Remove the Help Link in the CMS
      */
     if (!$config->ShowHelpLink) {
         CMSMenu::remove_menu_item('Help');
     }
     /**
      * Remove the Messages menu item in the CMS
      */
     if (!$config->ShowMessagesAdmin) {
         CMSMenu::remove_menu_item('ContactMessageModelAdmin');
     }
     /**
      * Remove the Portfolio menu item in the CMS
      */
     if (!$config->ShowPortfolioAdmin) {
         CMSMenu::remove_menu_item('PortfolioPageModelAdmin');
     }
     /**
      * Remove the Reports menu item in the CMS
      */
     if (!$config->ShowReportAdmin) {
         CMSMenu::remove_menu_item('ReportAdmin');
     }
     /**
      * Remove the Security menu item in the CMS
      */
     if (!$config->ShowSecurityAdmin) {
         CMSMenu::remove_menu_item('SecurityAdmin');
     }
     /** Set the background colour of the cms sidebar menu. */
     Requirements::customCSS('.cms-menu {background: ' . $this->owner->stat('cms_menu_background') . ';}');
 }
开发者ID:stevie-mayhew,项目名称:silverstripe-boilerplate-installer,代码行数:51,代码来源:LeftAndMain.php

示例9: rules

 /**
  * Gets a list of url_pattern => controller k/v pairs for each LeftAndMain derived controller
  */
 public static function rules()
 {
     if (self::$_rules === null) {
         self::$_rules = array();
         // Build an array of class => url_priority k/v pairs
         $classes = array();
         foreach (CMSMenu::get_cms_classes() as $class) {
             $classes[$class] = Config::inst()->get($class, 'url_priority', Config::FIRST_SET);
         }
         // Sort them so highest priority item is first
         arsort($classes, SORT_NUMERIC);
         // Map over the array calling add_rule_for_controller on each
         array_map(array(__CLASS__, 'add_rule_for_controller'), array_keys($classes));
     }
     return self::$_rules;
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:19,代码来源:AdminRootController.php

示例10: init

 public function init()
 {
     $config = SiteConfig::current_site_config();
     if ($config->CustomApplicationLink) {
         Config::inst()->update('LeftAndMain', 'application_link', $config->CustomApplicationLink);
     }
     if ($config->CustomApplicationName) {
         Config::inst()->update('LeftAndMain', 'application_name', $config->CustomApplicationName);
     }
     if (!$config->ShowReportAdmin) {
         CMSMenu::remove_menu_item('ReportAdmin');
     }
     if (!$config->ShowHelpLink) {
         CMSMenu::remove_menu_item('Help');
     }
 }
开发者ID:helpfulrobot,项目名称:thisisbd-silverstripe-cms-branding,代码行数:16,代码来源:LeftAndMainExtension.php

示例11: init

 public function init()
 {
     /** @var SiteConfig $config */
     $config = SiteConfig::current_site_config();
     /**
      * Remove the Reports menu item in the CMS
      */
     if (!$config->ShowAssetAdmin) {
         CMSMenu::remove_menu_item('AssetAdmin');
     }
     /**
      * Remove the Blog menu item in the CMS
      */
     if (!$config->ShowBlogAdmin) {
         CMSMenu::remove_menu_item('BlogPageModelAdmin');
     }
     /**
      * Remove the Help Link in the CMS
      */
     if (!$config->ShowHelpLink) {
         CMSMenu::remove_menu_item('Help');
     }
     /**
      * Remove the Messages menu item in the CMS
      */
     if (!$config->ShowMessagesAdmin) {
         CMSMenu::remove_menu_item('ContactMessageModelAdmin');
     }
     /**
      * Remove the Portfolio menu item in the CMS
      */
     if (!$config->ShowPortfolioAdmin) {
         CMSMenu::remove_menu_item('PortfolioPageModelAdmin');
     }
     /**
      * Remove the Reports menu item in the CMS
      */
     if (!$config->ShowReportAdmin) {
         CMSMenu::remove_menu_item('ReportAdmin');
     }
     /**
      * Remove the Security menu item in the CMS
      */
     if (!$config->ShowSecurityAdmin) {
         CMSMenu::remove_menu_item('SecurityAdmin');
     }
 }
开发者ID:helpfulrobot,项目名称:toastnz-silverstripe-boilerplate-installer,代码行数:47,代码来源:ProjectLeftAndMainExtension.php

示例12: customise_data_objects

 /**
  *	Set JSON/XML data object exclusions/inclusions.
  *	NOTE: ALL data objects are included by default (excluding some core), unless disabled or inclusions have explicitly been defined.
  *
  *	@parameter <{FILTER_TYPE}> string
  *	@parameter <{DATA_OBJECT_NAMES}> array(string)
  */
 public static function customise_data_objects($type, $objects = null)
 {
     // Merge the exclusions/inclusions in case of multiple definitions.
     if (is_array($objects) && strtolower($type) === 'exclude') {
         self::$custom_exclusions = array_unique(array_merge(self::$custom_exclusions, $objects));
     } else {
         if (is_array($objects) && strtolower($type) === 'include') {
             self::$custom_inclusions = array_unique(array_merge(self::$custom_inclusions, $objects));
         } else {
             if (strtolower($type) === 'disabled') {
                 self::$disabled = true;
                 // The CMS interface will no longer be required.
                 CMSMenu::remove_menu_item('APIwesomeAdmin');
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:nglasl-silverstripe-apiwesome,代码行数:24,代码来源:DataObjectOutputConfiguration.php

示例13: init

 public function init()
 {
     parent::init();
     if (!Permission::check("VIEW_DEVTASKS")) {
         return;
     }
     $tasks = array('devbuild' => array('title' => 'Dev/Build', 'link' => 'dev/build', 'reset_time' => '5000', 'error_handler' => 'newtab', 'success_handler' => 'ignore'));
     $config_tasks = Config::inst()->get(__CLASS__, 'tasks');
     if (is_array($config_tasks)) {
         $tasks = array_merge($tasks, $config_tasks);
     }
     foreach ($tasks as $item => $values) {
         $attributes = array('class' => 'devbuild-trigger', 'data-title' => isset($values['title']) ? $values['title'] : $item, 'data-link' => isset($values['link']) ? $values['link'] : 'dev/build', 'data-reset-time' => isset($values['reset_time']) ? $values['reset_time'] : '5000', 'data-error-handler' => isset($values['error_handler']) ? $values['error_handler'] : 'newtab', 'data-success-handler' => isset($values['success_handler']) ? $values['success_handler'] : 'ignore');
         // priority controls the ordering of the link in the stack. The
         // lower the number, the lower in the list
         $priority = -90;
         CMSMenu::add_link($item, '', '#', $priority, $attributes);
     }
 }
开发者ID:gorriecoe,项目名称:silverstripe-fancy-devbuild,代码行数:19,代码来源:DevTasks.php

示例14: getAwesomeIconCSS

 /**
  * Answers a string containing the custom CSS for the CMS interface.
  *
  * @return string
  */
 public function getAwesomeIconCSS()
 {
     // Initialise Variables:
     $css = array();
     // Obtain Default ModelAdmin Icon:
     $dma_icon = Config::inst()->get('ModelAdmin', 'menu_icon', Config::FIRST_SET);
     // Obtain Viewable Menu Items:
     $menu_items = CMSMenu::get_viewable_menu_items();
     // Iterate Viewable Menu Items:
     foreach ($menu_items as $class => $item) {
         // Obtain Bitmap Icon:
         $bmp_icon = Config::inst()->get($class, 'menu_icon', Config::FIRST_SET);
         // Does this class have an awesome icon?
         if ($icon = Config::inst()->get($class, 'awesome_icon', Config::FIRST_SET)) {
             // Fix the prefix of the icon class name:
             $icon = $this->prefix($icon);
         } elseif ($class == 'Help') {
             // The icon for the Help menu item:
             $icon = 'fa-question-circle';
         } elseif ($bmp_icon == $dma_icon) {
             // Replace default ModelAdmin icon:
             $icon = 'fa-database';
         } else {
             // By default, fallback to the bitmap icon:
             $icon = false;
         }
         // Define CSS for this icon:
         if ($icon) {
             // Disable Bitmap Icon:
             $css[] = ".icon.icon-16.icon-" . strtolower($class) . " {";
             $css[] = "  background-image: none !important;";
             $css[] = "}";
             // Enable Awesome Icon:
             $css[] = ".icon.icon-16.icon-" . strtolower($class) . ":before {";
             $css[] = "  content: \"\\" . $this->getIconUnicode($icon) . "\";";
             $css[] = "}";
         }
     }
     // Answer CSS String:
     return implode("\n", $css);
 }
开发者ID:praxisnetau,项目名称:silverstripe-moderno-admin,代码行数:46,代码来源:AwesomeIconExtension.php

示例15: getAwesomeIconCSS

 /**
  * Answers a string containing the custom CSS for the CMS interface.
  *
  * @return string
  */
 public function getAwesomeIconCSS()
 {
     // Initialise Variables:
     $css = array();
     $menu_items = CMSMenu::get_viewable_menu_items();
     // Iterate Viewable Menu Items:
     foreach ($menu_items as $class => $item) {
         // Does this class have an awesome icon?
         if ($icon = Config::inst()->get($class, 'icon', Config::FIRST_SET)) {
             // Fix the prefix of the icon class name:
             $icon = $this->prefix($icon);
         } elseif ($class == 'Help') {
             // The icon for the Help menu item:
             $icon = 'help_outline';
         } else {
             // The default icon, for ModelAdmin menu items:
             $icon = 'content_copy';
         }
         // Define CSS for this icon:
         $css[] = ".icon.icon-16.icon-" . strtolower($class) . ":before { content: \"\\" . self::$icons[$icon] . "\"; }";
     }
     // Answer CSS String:
     return implode("\n", $css);
 }
开发者ID:toastnz,项目名称:flat-cms,代码行数:29,代码来源:FlatCMSLeftAndMainExtension.php


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