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


PHP Controller::has_curr方法代码示例

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


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

示例1: lostPassword

 /**
  * Method for allowing a user to reset their password
  * @param {stdClass} $data Data passed from ActionScript
  * @return {array} Returns a standard response array
  */
 public function lostPassword($data)
 {
     $response = CodeBank_ClientAPI::responseBase();
     $response['login'] = true;
     $SQL_email = Convert::raw2sql($data->user);
     $member = Member::get_one('Member', "\"Email\"='{$SQL_email}'");
     // Allow vetoing forgot password requests
     $sng = new MemberLoginForm(Controller::has_curr() ? Controller::curr() : singleton('Controller'), 'LoginForm');
     $results = $sng->extend('forgotPassword', $member);
     if ($results && is_array($results) && in_array(false, $results, true)) {
         $response['status'] = 'HELO';
         $response['message'] = _t('CodeBankAPI.PASSWORD_SENT_TEXT', "A reset link has been sent to '{email}', provided an account exists for this email address.", array('email' => $data['Email']));
     }
     if ($member) {
         $token = $member->generateAutologinTokenAndStoreHash();
         $e = Member_ForgotPasswordEmail::create();
         $e->populateTemplate($member);
         $e->populateTemplate(array('PasswordResetLink' => Security::getPasswordResetLink($member, $token)));
         $e->setTo($member->Email);
         $e->send();
         $response['status'] = 'HELO';
         $response['message'] = _t('CodeBankAPI.PASSWORD_SENT_TEXT', "A reset link has been sent to '{email}', provided an account exists for this email address.", array('email' => $data->user));
     } else {
         if (!empty($data->user)) {
             $response['status'] = 'HELO';
             $response['message'] = _t('CodeBankAPI.PASSWORD_SENT_TEXT', "A reset link has been sent to '{email}', provided an account exists for this email address.", array('email' => $data->user));
         } else {
             $response['status'] = 'EROR';
             $response['message'] = _t('Member.ENTEREMAIL', 'Please enter an email address to get a password reset link.');
         }
     }
     return $response;
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:38,代码来源:CodeBankSessionManager.php

示例2: allMethodNames

 public function allMethodNames($custom = false)
 {
     // A friendly hack to make hasMethod returns true
     if (Controller::has_curr()) {
         return array(Controller::curr()->getRequest()->param('Action'));
     }
 }
开发者ID:lekoala,项目名称:silverstripe-devtoolkit,代码行数:7,代码来源:TranslatableActionsControllerExtension.php

示例3: getCMSFields

 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $subsites = DataObject::get('Subsite');
     if (!$subsites) {
         $subsites = new DataObjectSet();
     }
     $subsites->push(new ArrayData(array('Title' => 'Main site', 'ID' => 0)));
     $subsiteSelectionField = new DropdownField("CopyContentFromID_SubsiteID", "Subsite", $subsites->toDropdownMap('ID', 'Title'), $this->CopyContentFromID ? $this->CopyContentFrom()->SubsiteID : Session::get('SubsiteID'));
     $fields->addFieldToTab('Root.Content.Main', $subsiteSelectionField, 'CopyContentFromID');
     // Setup the linking to the original page.
     $pageSelectionField = new SubsitesTreeDropdownField("CopyContentFromID", _t('VirtualPage.CHOOSE', "Choose a page to link to"), "SiteTree", "ID", "MenuTitle");
     $pageSelectionField->setFilterFunction(create_function('$item', 'return !($item instanceof VirtualPage);'));
     if (Controller::has_curr() && Controller::curr()->getRequest()) {
         $subsiteID = Controller::curr()->getRequest()->getVar('CopyContentFromID_SubsiteID');
         $pageSelectionField->setSubsiteID($subsiteID);
     }
     $fields->replaceField('CopyContentFromID', $pageSelectionField);
     // Create links back to the original object in the CMS
     if ($this->CopyContentFromID) {
         $editLink = "admin/show/{$this->CopyContentFromID}/?SubsiteID=" . $this->CopyContentFrom()->SubsiteID;
         $linkToContent = "\n\t\t\t\t<a class=\"cmsEditlink\" href=\"{$editLink}\">" . _t('VirtualPage.EDITCONTENT', 'Click here to edit the content') . "</a>";
         $fields->removeByName("VirtualPageContentLinkLabel");
         $fields->addFieldToTab("Root.Content.Main", $linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent), 'Title');
         $linkToContentLabelField->setAllowHTML(true);
     }
     $fields->addFieldToTab('Root.Content.Metadata', new TextField('CustomMetaTitle', 'Title (overrides inherited value from the source)'), 'MetaTitle');
     $fields->addFieldToTab('Root.Content.Metadata', new TextareaField('CustomMetaKeywords', 'Keywords (overrides inherited value from the source)'), 'MetaKeywords');
     $fields->addFieldToTab('Root.Content.Metadata', new TextareaField('CustomMetaDescription', 'Description (overrides inherited value from the source)'), 'MetaDescription');
     $fields->addFieldToTab('Root.Content.Metadata', new TextField('CustomExtraMeta', 'Custom Meta Tags (overrides inherited value from the source)'), 'ExtraMeta');
     return $fields;
 }
开发者ID:hafriedlander,项目名称:silverstripe-config-experiment,代码行数:32,代码来源:SubsitesVirtualPage.php

示例4: onBeforeDelete

 public function onBeforeDelete()
 {
     $current_id = $this->owner->ID;
     // stored a track of deleted users ...
     $deleted = MemberDeleted::create();
     $deleted->OriginalID = $current_id;
     $deleted->FirstName = $this->owner->FirstName;
     $deleted->Surname = $this->owner->Surname;
     $deleted->Email = $this->owner->Email;
     if (Controller::has_curr()) {
         $deleted->FromUrl = Controller::curr()->getRequest()->getURL(true);
     }
     $deleted->write();
     if ($this->owner->Speaker()->exists()) {
         $this->owner->Speaker()->delete();
     }
     if ($this->owner->Photo()->exists()) {
         $this->owner->Photo()->delete();
     }
     foreach ($this->owner->LegalAgreements() as $e) {
         $e->delete();
     }
     foreach ($this->owner->Affiliations() as $e) {
         $e->delete();
     }
     $this->owner->ManagedCompanies()->removeAll();
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:27,代码来源:OpenStackMember.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $subsites = DataObject::get('Subsite');
     if (!$subsites) {
         $subsites = new ArrayList();
     } else {
         $subsites = ArrayList::create($subsites->toArray());
     }
     $subsites->push(new ArrayData(array('Title' => 'Main site', 'ID' => 0)));
     $fields->addFieldToTab('Root.Main', DropdownField::create("CopyContentFromID_SubsiteID", _t('SubsitesVirtualPage.SubsiteField', "Subsite"), $subsites->map('ID', 'Title'))->addExtraClass('subsitestreedropdownfield-chooser no-change-track'), 'CopyContentFromID');
     // Setup the linking to the original page.
     $pageSelectionField = new SubsitesTreeDropdownField("CopyContentFromID", _t('VirtualPage.CHOOSE', "Choose a page to link to"), "SiteTree", "ID", "MenuTitle");
     if (Controller::has_curr() && Controller::curr()->getRequest()) {
         $subsiteID = Controller::curr()->getRequest()->requestVar('CopyContentFromID_SubsiteID');
         $pageSelectionField->setSubsiteID($subsiteID);
     }
     $fields->replaceField('CopyContentFromID', $pageSelectionField);
     // Create links back to the original object in the CMS
     if ($this->CopyContentFromID) {
         $editLink = "admin/pages/edit/show/{$this->CopyContentFromID}/?SubsiteID=" . $this->CopyContentFrom()->SubsiteID;
         $linkToContent = "\n\t\t\t\t<a class=\"cmsEditlink\" href=\"{$editLink}\">" . _t('VirtualPage.EDITCONTENT', 'Click here to edit the content') . "</a>";
         $fields->removeByName("VirtualPageContentLinkLabel");
         $fields->addFieldToTab("Root.Main", $linkToContentLabelField = new LabelField('VirtualPageContentLinkLabel', $linkToContent), 'Title');
         $linkToContentLabelField->setAllowHTML(true);
     }
     $fields->addFieldToTab('Root.Main', TextField::create('CustomMetaTitle', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), 'MetaTitle');
     $fields->addFieldToTab('Root.Main', TextareaField::create('CustomMetaKeywords', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'MetaKeywords');
     $fields->addFieldToTab('Root.Main', TextareaField::create('CustomMetaDescription', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'MetaDescription');
     $fields->addFieldToTab('Root.Main', TextField::create('CustomExtraMeta', $this->fieldLabel('CustomMetaTitle'))->setDescription(_t('SubsitesVirtualPage.OverrideNote')), 'ExtraMeta');
     return $fields;
 }
开发者ID:hamaka,项目名称:silverstripe-subsites,代码行数:32,代码来源:SubsitesVirtualPage.php

示例6: Content

 /**
  * Hide content on the login pages as the warning message is hard coded in
  * the form.
  */
 public function Content()
 {
     if (Controller::has_curr() && Controller::curr() instanceof Security) {
         return false;
     }
     return $this->dbObject('Content');
 }
开发者ID:mateusz,项目名称:demo.silverstripe.org,代码行数:11,代码来源:Page.php

示例7: augmentSQL

 /**
  * Update any requests to limit the results to the current site
  */
 public function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null)
 {
     $ctrl = null;
     if (Controller::has_curr()) {
         $ctrl = Controller::curr();
     }
     if (Subsite::$disable_subsite_filter) {
         return;
     }
     if ($dataQuery->getQueryParam('Subsite.filter') === false) {
         return;
     }
     if ($ctrl && get_class(Controller::curr()) == 'Security') {
         return;
     }
     // Don't run on delete queries, since they are always tied to
     // a specific ID.
     if ($query->getDelete()) {
         return;
     }
     // If you're querying by ID, ignore the sub-site - this is a bit ugly...
     // if(!$query->where || (strpos($query->where[0], ".\"ID\" = ") === false && strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false && strpos($query->where[0], "ID = ") !== 0)) {
     if (!$query->filtersOnID()) {
         if (Subsite::$force_subsite) {
             $subsiteID = Subsite::$force_subsite;
         } else {
             $subsiteID = (int) Subsite::currentSubsiteID();
         }
         $froms = $query->getFrom();
         $froms = array_keys($froms);
         $tableName = array_shift($froms);
         $query->addWhere("\"{$tableName}\".\"SubsiteID\" IN ({$subsiteID})");
     }
 }
开发者ID:zarocknz,项目名称:silverstripe-mandrill,代码行数:37,代码来源:EmailTemplateSubsiteExtension.php

示例8: updateCMSFields

 /**
  * Add subsites-specific fields to the folder editor.
  */
 public function updateCMSFields(FieldList $fields)
 {
     $ctrl = null;
     if (Controller::has_curr()) {
         $ctrl = Controller::curr();
     }
     if (!$ctrl) {
         return;
     }
     // This fixes fields showing up for no reason in the list view (not moved to Details tab)
     if ($ctrl->getAction() !== 'EditForm') {
         return;
     }
     if ($this->owner instanceof Folder) {
         // Allow to move folders from one site to another
         $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
         $values = array();
         $values[0] = _t('FileSubsites.AllSitesDropdownOpt', 'All sites');
         foreach ($sites as $site) {
             $values[$site->ID] = $site->Title;
         }
         ksort($values);
         if ($sites) {
             //Dropdown needed to move folders between subsites
             $dropdown = new DropdownField('SubsiteID', _t('FileSubsites.SubsiteFieldLabel', 'Subsite'), $values);
             $dropdown->addExtraClass('subsites-move-dropdown');
             $fields->push($dropdown);
         }
         // On main site, allow showing this folder in subsite
         if ($this->owner->SubsiteID == 0 && !Subsite::currentSubsiteID()) {
             $fields->push(new CheckboxField('ShowInSubsites', _t('SubsiteFileExtension.ShowInSubsites', 'Show in subsites')));
         }
     }
 }
开发者ID:lekoala,项目名称:silverstripe-subsites-extras,代码行数:37,代码来源:SubsiteFileExtension.php

示例9: IsActive

 public function IsActive()
 {
     if (Controller::has_curr()) {
         $controller = Controller::curr();
         if (is_a($controller, 'NewsIndex_Controller') && $controller->IsCategory()) {
             return $controller->getRequest()->param('ID') == $this->ID;
         }
     }
     return false;
 }
开发者ID:silverstripers,项目名称:silverstripe-news,代码行数:10,代码来源:NewsCategory.php

示例10: updateCMSFields

 function updateCMSFields(FieldSet &$fields)
 {
     if ($this->owner->ID && $this->owner->Code == strtolower(self::$main_group)) {
         $newMerchants = new ComplexTableField(Controller::has_curr() ? Controller::curr() : new Controller(), 'NewMembers', 'Member');
         $newMerchants->setCustomSourceItems(self::get_new_merchants());
         $fields->addFieldToTab('Root', new Tab(_t('MerchantGroupDOD.NEWMERCHANTS', 'New Merchants'), $newMerchants), 'Members');
         $fields->findOrMakeTab('Root.Members')->setTitle(_t('MerchantGroupDOD.ALLMERCHANTS', 'All Merchants'));
         $fields->removeByName('Title');
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-merchants,代码行数:10,代码来源:MerchantGroupDOD.php

示例11: activateState

 function activateState($state)
 {
     if (Controller::has_curr()) {
         Subsite::changeSubsite($state);
     } else {
         // TODO: This is a nasty hack - calling Subsite::changeSubsite after request ends
         // throws error because no current controller to access session on
         $_REQUEST['SubsiteID'] = $state;
     }
 }
开发者ID:peavers,项目名称:silverstripe-fulltextsearch,代码行数:10,代码来源:SearchVariantSiteTreeSubsitesPolyhome.php

示例12: __destruct

 public function __destruct()
 {
     // Shift off anything else that's on the stack.  This can happen if something throws
     // an exception that causes a premature TestSession::__destruct() call
     while (Controller::has_curr() && Controller::curr() !== $this->controller) {
         Controller::curr()->popCurrent();
     }
     if (Controller::has_curr()) {
         $this->controller->popCurrent();
     }
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:11,代码来源:TestSession.php

示例13: MetaTags

 function MetaTags(&$tags)
 {
     $config = SiteConfig::current_site_config();
     // Ensure a canonical link is placed, for semantic correctness and SEO
     if (Controller::has_curr() && Controller::curr()->hasMethod("onMobileDomain") && Controller::curr()->onMobileDomain() && $config->MobileSiteType == 'RedirectToDomain') {
         $oldBaseURL = Director::baseURL();
         Director::setbaseURL($config->FullSiteDomain);
         $tags .= sprintf('<link rel="canonical" href="%s" />', $this->owner->AbsoluteLink()) . "\n";
         Director::setbaseURL($oldBaseURL);
     }
 }
开发者ID:nzjoel,项目名称:silverstripe-mobile,代码行数:11,代码来源:MobileSiteTreeExtension.php

示例14: setTooltip

 public function setTooltip($tooltip)
 {
     $this->tooltip = $tooltip;
     $t = $this->owner->Title();
     if (Controller::has_curr() && Controller::curr() instanceof LeftAndMain) {
         $t .= ' <span title="' . $tooltip . '" class="ui-icon ui-icon-info" style="display:inline-block;"></span>';
     } else {
         $t .= ' <i class="' . Config::inst()->get(__CLASS__, 'icon') . ' tooltip" title="' . $tooltip . '"></i>';
     }
     $this->owner->setTitle($t);
     return $this->owner;
 }
开发者ID:lekoala,项目名称:silverstripe-form-extras,代码行数:12,代码来源:TooltipFieldExtension.php

示例15: getCacheKey

 /**
  * Determines the key to use for saving the current rate
  * 
  * @param string $itemkey Input key
  * @return string Result key
  */
 protected function getCacheKey($itemkey)
 {
     $key = self::CACHE_PREFIX;
     // Add global identifier
     if (\Config::inst()->get(get_class(), 'lock_bypage')) {
         $key .= '_' . md5($itemkey);
     }
     // Add user-specific identifier
     if (\Config::inst()->get(get_class(), 'lock_byuserip') && \Controller::has_curr()) {
         $ip = \Controller::curr()->getRequest()->getIP();
         $key .= '_' . md5($ip);
     }
     return $key;
 }
开发者ID:mandrew,项目名称:silverstripe-versionfeed,代码行数:20,代码来源:RateLimitFilter.php


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