本文整理汇总了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);
}
示例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'));
}
示例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
*/
示例4: array
<?php
Director::addRules(50, array(Payment_Controller::$URLSegment . '/$Action/$ID' => 'Payment_Controller'));
示例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
示例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');
示例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);
示例8:
<?php
Object::add_extension('SiteConfig', 'SLSiteConfig');
Director::addRules(100,
array(
'leg//$Action/$Query' => 'SLCongressController'
)
);
示例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
*/
示例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
));
}
}
示例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'));
示例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'));
示例13: array
<?php
Director::addRules(100, array('SlickMap/$Action/$ID/$OtherID' => 'SlickMap_Controller'));
SlickMap::$title = "Sitemap";
示例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');
}
示例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));
}
}