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


PHP Director::addRules方法代码示例

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


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

示例1: add_controller

 /**
  * Add a LeftAndMain controller to the CMS menu.
  *
  * @param string $controllerClass The class name of the controller
  * @return The result of the operation
  * @todo A director rule is added when a controller link is added, but it won't be removed
  *			when the item is removed. Functionality needed in {@link Director}.
  */
 public static function add_controller($controllerClass)
 {
     // Get static bits
     $urlBase = eval("return {$controllerClass}::\$url_base;");
     $urlSegment = eval("return {$controllerClass}::\$url_segment;");
     $urlRule = eval("return {$controllerClass}::\$url_rule;");
     $urlPriority = eval("return {$controllerClass}::\$url_priority;");
     $menuPriority = eval("return {$controllerClass}::\$menu_priority;");
     // Don't add menu items defined the old way
     if ($urlSegment === null) {
         return;
     }
     $link = Controller::join_links($urlBase, $urlSegment) . '/';
     // Make director rule
     if ($urlRule[0] == '/') {
         $urlRule = substr($urlRule, 1);
     }
     $rule = $link . '/' . $urlRule;
     // the / will combine with the / on the end of $link to make a //
     Director::addRules($urlPriority, array($rule => $controllerClass));
     // doesn't work if called outside of a controller context (e.g. in _config.php)
     // as the locale won't be detected properly. Use {@link LeftAndMain->MainMenu()} to update
     // titles for existing menu entries
     $defaultTitle = LeftAndMain::menu_title_for_class($controllerClass);
     $menuTitle = _t("{$controllerClass}.MENUTITLE", $defaultTitle);
     // Add menu item
     return self::add_menu_item($controllerClass, $menuTitle, $link, $controllerClass, $menuPriority);
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:36,代码来源:CMSMenu.php

示例2: setUp

 function setUp()
 {
     parent::setUp();
     // Hold the original request URI once so it doesn't get overwritten
     if (!self::$originalRequestURI) {
         self::$originalRequestURI = $_SERVER['REQUEST_URI'];
     }
     Director::addRules(99, array('DirectorTestRule/$Action/$ID/$OtherID' => 'DirectorTestRequest_Controller'));
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:9,代码来源:DirectorTest.php

示例3: define

<?php

define('SIMPLEWIKI_DIR', dirname(__FILE__));
Director::addRules(100, array('ssimplewiki/$Action' => 'WikiPage_Controller'));
if (($SIMPLEWIKI_EDITING_MODULE = basename(dirname(__FILE__))) != 'simplewiki') {
    die("The SimpleWiki module MUST be in the /simplewiki directory, not {$SIMPLEWIKI_EDITING_MODULE}");
}
//HtmlEditorConfig::get('default')->enablePlugins(array('sslinks' => '../../../simplewiki/javascript/sslinks/editor_plugin_src.js'));
HtmlEditorConfig::get('default')->insertButtonsBefore('advcode', 'ss_simplelink', 'unlink', 'ss_simpleimage');
// PERMISSION CONSTANTS
// To use these permissions, you MUST grant your wiki editor group the ability
// to  View draft content as well as the edit wiki pages.
define('EDIT_WIKI', 'EDIT_WIKI');
define('MANAGE_WIKI_PAGES', 'MANAGE_WIKI_PAGES');
// Registration of wiki formatters
WikiPage::register_formatter(new MarkdownFormatter());
//WikiPage::register_formatter(new HTMLFormatter());
WikiPage::register_formatter(new WikiFormatter());
//WikiPage::register_formatter(new PlainFormatter());
// Example configuration options below
/*
WikiPage::$show_edit_button = true; // | false - whether public users get an edit link when viewing a wikipage
WikiPage::$auto_publish = true; // | false - whether pages are automatically published when saved/created
*/
开发者ID:helpfulrobot,项目名称:nyeholt-silverstripe-simplewiki,代码行数:24,代码来源:_config.php

示例4: array

<?php

Director::addRules(50, array(Payment_Controller::$URLSegment . '/$Action/$ID' => 'Payment_Controller'));
开发者ID:nimeso,项目名称:silverstripe-payment,代码行数:3,代码来源:_config.php

示例5: array

<?php

Director::addRules(50, array('createecommercevariations/$Action/$ProductID' => 'CreateEcommerceVariations', 'createecommercevariationsbatch/$Action' => 'CreateEcommerceVariations_Batch'));
Buyable::add_class("ProductVariation");
Object::add_extension("Product", "ProductWithVariationDecorator");
Object::add_extension("Product_Controller", "ProductWithVariationDecorator_Controller");
Object::add_extension("ProductBulkLoader", "ProductVariationBulkLoader");
Product_Controller::$allowed_actions[] = 'VariationForm';
Product_Controller::$allowed_actions[] = 'addvariation';
LeftAndMain::require_javascript(THIRDPARTY_DIR . "/jquery/jquery.js");
LeftAndMain::require_javascript(THIRDPARTY_DIR . "/jquery-livequery/jquery.livequery.js");
LeftAndMain::require_javascript("ecommerce_product_variation/javascript/CreateEcommerceVariationsField.js");
LeftAndMain::require_themed_css("CreateEcommerceVariationsField");
ProductsAndGroupsModelAdmin::$model_importers['ProductVariation'] = null;
//copy the lines between the START AND END line to your /mysite/_config.php file and choose the right settings
// __________________________________ START ECOMMERCE PRODUCT VARIATIONS MODULE CONFIG __________________________________
//____________HIGHLY RECOMMENDED
//ProductsAndGroupsModelAdmin::add_managed_model("ProductAttributeValue");
//ProductsAndGroupsModelAdmin::add_managed_model("ProductAttributeType");
//ProductsAndGroupsModelAdmin::add_managed_model("ProductVariation");
//____________ADD TO CART FORM INTERACTION
//ProductWithVariationDecorator_Controller::set_use_js_validation(false);
//ProductWithVariationDecorator_Controller::set_alternative_validator_class_name("MyValidatorClass");
//____________EASY SORTING - REQUIRES: http://sunny.svnrepository.com/svn/sunny-side-up-general/dataobjectsorter
//Object::add_extension('ProductAttributeValue', 'DataObjectSorterDOD');
//Object::add_extension('ProductAttributeType', 'DataObjectSorterDOD');
//DataObjectSorterDOD::set_also_update_sort_field(true);
//DataObjectSorterDOD::set_do_not_add_alternative_sort_field(true);
//____________CUSTOMISED CMS INTERACTION
//LeftAndMain::require_javascript("mysite/javascript/MyCreateEcommerceVariationsField.js");
//____________COLOUR OPTIONS
开发者ID:riddler7,项目名称:silverstripe-product-variations,代码行数:31,代码来源:_config.php

示例6: array

<?php

Director::addRules(50, array(WorldpayPayment_Handler::$URLSegment . '/$Action/$ID' => 'WorldpayPayment_Handler', PayPalPayment_Handler::$URLSegment . '/$Action/$ID' => 'PayPalPayment_Handler'));
Object::add_extension('Member', 'PayerHavingReceipt');
开发者ID:helpfulrobot,项目名称:silverstripe-payment,代码行数:4,代码来源:_config.php

示例7: array

<?php

global $project;
$project = 'mysite';
global $database;
$database = 'SS_ssnewdocstest';
require_once 'conf/ConfigureFromEnv.php';
MySQLDatabase::set_connection_charset('utf8');
// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.org/themes/
SSViewer::set_theme('docs');
// enable nested URLs for this site (e.g. page/sub-page/)
SiteTree::enable_nested_urls();
// render the user documentation first
Director::addRules(20, array('Security//$Action/$ID/$OtherID' => 'Security'));
DocumentationViewer::set_link_base('');
DocumentationViewer::$check_permission = false;
Director::addRules(10, array('$Action' => 'DocumentationViewer', '' => '->current/en/cms'));
DocumentationService::set_automatic_registration(false);
DocumentationService::register("cms", realpath("../../master/cms/docs/"), '2.4');
// We want this to be reviewed by the whole community
BasicAuth::protect_entire_site(false);
开发者ID:NARKOZ,项目名称:silverstripe-doc-restructuring,代码行数:22,代码来源:_config.php

示例8:

<?php

Object::add_extension('SiteConfig', 'SLSiteConfig');

Director::addRules(100,
	array(
		'leg//$Action/$Query' => 'SLCongressController'
	)
);
开发者ID:notioncollective,项目名称:silverstripe-congressapi,代码行数:9,代码来源:_config.php

示例9: array

 * Here you can make different settings for the Sapphire module (the core
 * module).
 *
 * For example you can register the authentication methods you wish to use
 * on your site, e.g. to register the OpenID authentication method type
 *
 * <code>
 * Authenticator::register_authenticator('OpenIDAuthenticator');
 * </code>
 *
 * @package sapphire
 * @subpackage core
 */
// Default director
Director::addRules(10, array('Security//$Action/$ID/$OtherID' => 'Security', 'db//$Action' => 'DatabaseAdmin', '$Controller//$Action/$ID/$OtherID' => '*', '' => 'RootURLController', 'api/v1/live' => 'VersionedRestfulServer', 'api/v1' => 'RestfulServer', 'soap/v1' => 'SOAPModelAccess', 'dev' => 'DevelopmentAdmin', 'interactive' => 'SapphireREPL'));
Director::addRules(1, array('$URLSegment//$Action/$ID/$OtherID' => 'ModelAsController'));
/**
 * Register the default internal shortcodes.
 */
ShortcodeParser::get('default')->register('sitetree_link', array('SiteTree', 'link_shortcode_handler'));
/**
 * PHP 5.2 introduced a conflict with the Datetime field type, which was renamed to SSDatetime. This was later renamed
 * to SS_Datetime to be consistent with other namespaced classes.
 *
 * Overload both of these to support legacy code.
 */
Object::useCustomClass('SSDatetime', 'SS_Datetime', true);
Object::useCustomClass('Datetime', 'SS_Datetime', true);
/**
 * The root directory of TinyMCE
 */
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:31,代码来源:_config.php

示例10: add_director_rule_for_controller

	/**
	 * Add the appropriate Director rules for the given controller.
	 */
	protected static function add_director_rule_for_controller($controllerClass) {
		$urlBase      = Config::inst()->get($controllerClass, 'url_base', Config::FIRST_SET);
		$urlSegment   = Config::inst()->get($controllerClass, 'url_segment', Config::FIRST_SET);
		$urlRule      = Config::inst()->get($controllerClass, 'url_rule', Config::FIRST_SET);
		$urlPriority  = Config::inst()->get($controllerClass, 'url_priority', Config::FIRST_SET);

		if($urlSegment || $controllerClass == 'CMSMain') {
			$link = Controller::join_links($urlBase, $urlSegment) . '/';
		
			// Make director rule
			if($urlRule[0] == '/') $urlRule = substr($urlRule,1);
			$rule = $link . '/' . $urlRule; // the / will combine with the / on the end of $link to make a //
			Director::addRules($urlPriority, array(
				$rule => $controllerClass
			));
		}
	}
开发者ID:redema,项目名称:sapphire,代码行数:20,代码来源:CMSMenu.php

示例11: array

<?php

/*
 * This file is needed to identify this as a SilverStripe module 
 */
// Extend the Member with e-commerce related fields.
DataObject::add_extension('Member', 'EcommerceRole');
// Extend Payment with e-commerce relationship.
DataObject::add_extension('Payment', 'EcommercePayment');
Director::addRules(50, array(ShoppingCart_Controller::$URLSegment . '/$Action/$ID' => 'ShoppingCart_Controller'));
开发者ID:nicolaas,项目名称:silverstripe-ecommerce,代码行数:10,代码来源:_config.php

示例12: array

<?php

// Example configuration:
/*
if(Director::isLive()){
	Email::setAdminEmail(<my_live_email>);
	DPSHostedPayment::set_px_pay_userid(<my_live_id>);
	DPSHostedPayment::set_px_pay_key(<my_live_key>);
}else{
	Email::setAdminEmail(<my_test_email>);
	DPSHostedPayment::set_px_pay_userid(<my_test_id>);
	DPSHostedPayment::set_px_pay_key(<my_test_key>);
}
*/
Director::addRules(100, array('DPSHostedPayment/$Action/$ID' => 'DPSHostedPayment_Controller'));
开发者ID:helpfulrobot,项目名称:silverstripe-payment-dpshosted,代码行数:15,代码来源:_config.php

示例13: array

<?php

Director::addRules(100, array('SlickMap/$Action/$ID/$OtherID' => 'SlickMap_Controller'));
SlickMap::$title = "Sitemap";
开发者ID:pstaender,项目名称:SlickMap,代码行数:4,代码来源:_config.php

示例14: array

<?php

Member::add_extension('FrameworkTestRole');
Member::add_extension('FileUploadRole');
SiteTree::add_extension('FrameworkTestSiteTreeExtension');
File::add_extension('FrameworkTestFileExtension');
if (class_exists('SiteTreeCMSWorkflow')) {
    SiteConfig::add_extension('CMSWorkflowSiteConfigDecorator');
    CMSWorkflowSiteConfigDecorator::apply_active_config();
}
Director::addRules(100, array('dev/regress/$Action/$ID' => 'FrameworktestRegressSessionAdmin'));
if (@$_GET['db']) {
    $enabletranslatable = @$_GET['enabletranslatable'];
} elseif (@$_SESSION['db']) {
    $enabletranslatable = @$_SESSION['enabletranslatable'];
} else {
    $enabletranslatable = null;
}
if ($enabletranslatable) {
    SiteTree::add_extension('Translatable');
    SiteConfig::add_extension('Translatable');
}
开发者ID:helpfulrobot,项目名称:silverstripe-frameworktest,代码行数:22,代码来源:_config.php

示例15: add_director_rule_for_controller

 /**
  * Add the appropriate Director rules for the given controller.
  */
 protected static function add_director_rule_for_controller($controllerClass)
 {
     $urlBase = Object::get_static($controllerClass, 'url_base');
     $urlSegment = Object::get_static($controllerClass, 'url_segment');
     $urlRule = Object::get_static($controllerClass, 'url_rule');
     $urlPriority = Object::get_static($controllerClass, 'url_priority');
     if ($urlSegment || $controllerClass == "CMSMain") {
         $link = Controller::join_links($urlBase, $urlSegment) . '/';
         // Make director rule
         if ($urlRule[0] == '/') {
             $urlRule = substr($urlRule, 1);
         }
         $rule = $link . '/' . $urlRule;
         // the / will combine with the / on the end of $link to make a //
         Director::addRules($urlPriority, array($rule => $controllerClass));
     }
 }
开发者ID:rixrix,项目名称:sapphire,代码行数:20,代码来源:CMSMenu.php


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