本文整理汇总了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:
}
}
}