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


PHP LeftAndMain::curr方法代码示例

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


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

示例1: init

 public function init()
 {
     //setting the uploads directory to make sure images uploaded through the content
     //editor are saved the right place
     $curr = LeftAndMain::curr();
     if ($curr) {
         //Debug::dump(get_class($curr));
         //Debug::dump(ClassInfo::ancestry($curr));
         $currClass = null;
         foreach (ClassInfo::ancestry($curr) as $class) {
             foreach (self::$supported_classes as $supported_class) {
                 if ($class == $supported_class) {
                     $currClass = $class;
                 }
             }
         }
         //Debug::dump($currClass);
         //switch (get_class($curr)) {
         switch ($currClass) {
             //Page administration
             case 'CMSPagesController':
             case 'CMSPageEditController':
                 $page = $curr->currentPage();
                 if ($page && $page->hasExtension('AssetsFolderExtension')) {
                     Upload::config()->uploads_folder = $page->getAssetsFolderDirName();
                 }
                 //Debug::dump($page->Title);
                 break;
             case 'ModelAdmin':
                 //For ModelAdmin we're falling back to cookies that we believe to have
                 //been set when setting the cms fields, see AssetFolderExtension::updateCMSFields()
                 //...as it seems to be almost impossible to figure out the current object elsewise
                 //see below for tries
                 //pull requests to fix this welcome!!!
                 //Debug::dump($this->owner->getURLParams());
                 //Debug::dump($this->owner->request->param('ModelClass'));
                 //Debug::dump($this->owner->request->remaining());
                 //Debug::dump($this->owner->request->getVars());
                 //Debug::dump($this->owner->request->params());
                 //Debug::dump($curr->currentPageID());
                 Upload::config()->uploads_folder = Cookie::get('cms-uploaddirrules-uploads-folder');
                 break;
                 //Settings
             //Settings
             case 'CMSSettingsController':
                 if (Object::has_extension('SiteConfig', 'AssetsFolderExtension')) {
                     $sc = SiteConfig::current_site_config();
                     Upload::config()->uploads_folder = $sc->getAssetsFolderDirName();
                 }
             default:
         }
     }
 }
开发者ID:titledk,项目名称:silverstripe-uploaddirrules,代码行数:53,代码来源:AssetsFolderAdmin.php


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