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


PHP ClassInfo::implementorsOf方法代码示例

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


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

示例1: ShortcodeForm

 /**
  * Provides a GUI for the insert/edit shortcode popup
  * @return Form
  **/
 public function ShortcodeForm()
 {
     if (!Permission::check('CMS_ACCESS_CMSMain')) {
         return;
     }
     Config::inst()->update('SSViewer', 'theme_enabled', false);
     // create a list of shortcodable classes for the ShortcodeType dropdown
     $classList = ClassInfo::implementorsOf('Shortcodable');
     $classes = array();
     foreach ($classList as $class) {
         $classes[$class] = singleton($class)->singular_name();
     }
     // load from the currently selected ShortcodeType or Shortcode data
     $classname = false;
     $shortcodeData = false;
     if ($shortcode = $this->request->requestVar('Shortcode')) {
         $shortcode = str_replace("", '', $shortcode);
         //remove BOM inside string on cursor position...
         $shortcodeData = singleton('ShortcodableParser')->the_shortcodes(array(), $shortcode);
         if (isset($shortcodeData[0])) {
             $shortcodeData = $shortcodeData[0];
             $classname = $shortcodeData['name'];
         }
     } else {
         $classname = $this->request->requestVar('ShortcodeType');
     }
     if ($shortcodeData) {
         $headingText = _t('Shortcodable.EDITSHORTCODE', 'Edit Shortcode');
     } else {
         $headingText = _t('Shortcodable.INSERTSHORTCODE', 'Insert Shortcode');
     }
     // essential fields
     $fields = FieldList::create(array(CompositeField::create(LiteralField::create('Heading', sprintf('<h3 class="htmleditorfield-shortcodeform-heading insert">%s</h3>', $headingText)))->addExtraClass('CompositeField composite cms-content-header nolabel'), LiteralField::create('shortcodablefields', '<div class="ss-shortcodable content">'), DropdownField::create('ShortcodeType', 'ShortcodeType', $classes, $classname)->setHasEmptyDefault(true)->addExtraClass('shortcode-type')));
     // attribute and object id fields
     if ($classname) {
         if (class_exists($classname)) {
             $class = singleton($classname);
             if (is_subclass_of($class, 'DataObject')) {
                 if (singleton($classname)->hasMethod('get_shortcodable_records')) {
                     $dataObjectSource = $classname::get_shortcodable_records();
                 } else {
                     $dataObjectSource = $classname::get()->map()->toArray();
                 }
                 $fields->push(DropdownField::create('id', $class->singular_name(), $dataObjectSource)->setHasEmptyDefault(true));
             }
             if ($attrFields = $classname::shortcode_attribute_fields()) {
                 $fields->push(CompositeField::create($attrFields)->addExtraClass('attributes-composite'));
             }
         }
     }
     // actions
     $actions = FieldList::create(array(FormAction::create('insert', _t('Shortcodable.BUTTONINSERTSHORTCODE', 'Insert shortcode'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')->setUseButtonTag(true)));
     // form
     $form = Form::create($this, "ShortcodeForm", $fields, $actions)->loadDataFrom($this)->addExtraClass('htmleditorfield-form htmleditorfield-shortcodable cms-dialog-content');
     if ($shortcodeData) {
         $form->loadDataFrom($shortcodeData['atts']);
     }
     $this->extend('updateShortcodeForm', $form);
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-shortcodable,代码行数:64,代码来源:ShortcodableController.php

示例2: get_all

 /**
  * Returns an array of all implementors of the `IIndicator` interface.
  *
  * @return IIndicator[] list of all implementors
  */
 public static function get_all()
 {
     $indicators = \ClassInfo::implementorsOf(self::$interface_name);
     return array_map(function ($indicatorName) {
         return \Object::create($indicatorName);
     }, $indicators);
 }
开发者ID:helpfulrobot,项目名称:ntb-silverstripe-statistics,代码行数:12,代码来源:IndicatorFactory.php

示例3: Fetch

 public static function Fetch($echo = false)
 {
     if ($echo) {
         echo "Fetching updates from Twitter...<br />";
     }
     $twitter_updates = SocialMediaTwitter::Fetch($echo);
     /*if ($echo) echo "Fetching updates from Facebook...<br />";
     		$facebook_updates	= SocialMediaFacebook::Fetch();
     		if ($echo) echo "Fetching updates from LinkedIn...<br />";
     		$linkedin_updates	= SocialMediaLinkedIn::Fetch();*/
     $linkedin_updates = array();
     $facebook_updates = array();
     if (false === $twitter_updates) {
         $twitter_updates = array();
     }
     //If errors happen, don't let them
     if (false === $facebook_updates) {
         $facebook_updates = array();
     }
     //interrupt the array_merge operation.
     if (false === $linkedin_updates) {
         $linkedin_updates = array();
     }
     $updates = array_merge($twitter_updates, $facebook_updates, $linkedin_updates);
     if ($echo) {
         echo count($updates) > 0 ? "Writing " . count($updates) . " updates to the database...<br />" : 'No updates to write to the database.<br />';
     }
     /**
      * @var SocialMediaImporterInterface $importer
      */
     foreach (ClassInfo::implementorsOf('SocialMediaImporterInterface') as $importer) {
         $importer::ImportUpdates($updates);
     }
 }
开发者ID:Taitava,项目名称:silverstripe-socialmedia,代码行数:34,代码来源:SocialMedia.php

示例4: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->insertAfter(new ToggleCompositeField('AfterRegistrationContent', _t('EventRegistration.AFTER_REG_CONTENT', 'After Registration Content'), array(new TextField('AfterRegTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterRegContent', _t('EventRegistration.CONTENT', 'Content')))), 'Content');
     $fields->insertAfter(new ToggleCompositeField('AfterUnRegistrationContent', _t('EventRegistration.AFTER_UNREG_CONTENT', 'After Un-Registration Content'), array(new TextField('AfterUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterUnregContent', _t('EventRegistration.CONTENT', 'Content')))), 'AfterRegistrationContent');
     if ($this->RegEmailConfirm) {
         $fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterRegistrationConfirmation', _t('EventRegistration.AFTER_REG_CONFIRM_CONTENT', 'After Registration Confirmation Content'), array(new TextField('AfterConfirmTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfirmContent', _t('EventRegistration.CONTENT', 'Content')))));
     }
     if ($this->UnRegEmailConfirm) {
         $fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterUnRegistrationConfirmation', _t('EventRegistration.AFTER_UNREG_CONFIRM_CONTENT', 'After Un-Registration Confirmation Content'), array(new TextField('AfterConfUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfUnregContent', _t('EventRegistration.CONTENT', 'Content')))));
     }
     $fields->addFieldToTab('Root.Tickets', new GridField('Tickets', 'Ticket Types', $this->Tickets(), GridFieldConfig_RecordEditor::create()));
     $generators = ClassInfo::implementorsOf('EventRegistrationTicketGenerator');
     if ($generators) {
         foreach ($generators as $generator) {
             $instance = new $generator();
             $generators[$generator] = $instance->getGeneratorTitle();
         }
         $generator = new DropdownField('TicketGenerator', _t('EventRegistration.TICKET_GENERATOR', 'Ticket generator'), $generators);
         $generator->setEmptyString(_t('EventManagement.NONE', '(None)'));
         $generator->setDescription(_t('EventManagement.TICKET_GENERATOR_NOTE', 'The ticket generator is used to generate a ticket file for the user to download.'));
         $fields->addFieldToTab('Root.Tickets', $generator);
     }
     $regGridFieldConfig = GridFieldConfig_Base::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldDeleteAction')->addComponents(new GridFieldButtonRow('after'), new GridFieldPrintButton('buttons-after-left'), new GridFieldExportButton('buttons-after-left'));
     $fields->addFieldsToTab('Root.Registrations', array(new GridField('Registrations', _t('EventManagement.REGISTRATIONS', 'Registrations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Valid'), $regGridFieldConfig), new GridField('CanceledRegistrations', _t('EventManagement.CANCELLATIONS', 'Cancellations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Canceled'), $regGridFieldConfig)));
     if ($this->RegEmailConfirm) {
         $fields->addFieldToTab('Root.Registrations', new ToggleCompositeField('UnconfirmedRegistrations', _t('EventManagement.UNCONFIRMED_REGISTRATIONS', 'Unconfirmed Registrations'), array(new GridField('UnconfirmedRegistrations', '', $this->DateTimes()->relation('Registrations')->filter('Status', 'Unconfirmed')))));
     }
     $fields->addFieldToTab('Root.Invitations', new GridField('Invitations', _t('EventManagement.INVITATIONS', 'Invitations'), $this->Invitations(), GridFieldConfig_RecordViewer::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new EventSendInvitationsButton($this))));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-eventmanagement,代码行数:31,代码来源:RegistrableEvent.php

示例5: boxes

 /**
  * Returns all implementors of InfoBox (all checks / box info)
  * @return array $conf
  */
 private function boxes()
 {
     $conf = array();
     $disabled = Config::inst()->get('InfoBoxes', 'disabled') ?: array();
     $checks = ClassInfo::implementorsOf('InfoBox');
     foreach ($checks as $class) {
         $inst = Injector::inst()->get($class);
         $name = explode('_', $class);
         $origClass = $class;
         if ($name[1]) {
             $class = $name[1];
         }
         if ($inst->show() && !in_array($class, $disabled) && !in_array($origClass, $disabled)) {
             $conf[$class]['type'] = $inst->severity();
             $conf[$class]['message'] = $inst->message();
             $conf[$class]['link'] = $inst->link() ?: false;
         }
     }
     function orderBoxes($a, $b)
     {
         return $a['type'] - $b['type'];
     }
     uasort($conf, 'orderBoxes');
     return $conf;
 }
开发者ID:helpfulrobot,项目名称:stnvh-silverstripe-infoboxes,代码行数:29,代码来源:InfoBoxes.php

示例6: getCMSFields

 /**
  * @return FieldList 
  */
 public function getCMSFields()
 {
     // Get NotifiedOn implementors
     $types = ClassInfo::implementorsOf('NotifiedOn');
     $types = array_combine($types, $types);
     unset($types['NotifyOnThis']);
     if (!$types) {
         $types = array();
     }
     array_unshift($types, '');
     // Available keywords
     $keywords = $this->getKeywords();
     if (count($keywords)) {
         $availableKeywords = '<div class="field"><div class="middleColumn"><p><u>Available Keywords:</u> </p><ul><li>$' . implode('</li><li>$', $keywords) . '</li></ul></div></div>';
     } else {
         $availableKeywords = "Available keywords will be shown if you select a NotifyOnClass";
     }
     // Identifiers
     $identifiers = $this->config()->get('identifiers');
     if (count($identifiers)) {
         $identifiers = array_combine($identifiers, $identifiers);
     }
     $fields = FieldList::create();
     $relevantMsg = 'Relevant for (note: this notification will only be sent if the context of raising the notification is of this type)';
     $fields->push(TabSet::create('Root', Tab::create('Main', DropdownField::create('Identifier', _t('SystemNotification.IDENTIFIER', 'Identifier'), $identifiers), TextField::create('Title', _t('SystemNotification.TITLE', 'Title')), TextField::create('Description', _t('SystemNotification.DESCRIPTION', 'Description')), DropdownField::create('NotifyOnClass', _t('SystemNotification.NOTIFY_ON_CLASS', $relevantMsg), $types), TextField::create('CustomTemplate', _t('SystemNotification.TEMPLATE', 'Template (Optional)'))->setAttribute('placeholder', $this->config()->get('default_template')), LiteralField::create('AvailableKeywords', $availableKeywords))));
     if ($this->config()->html_notifications) {
         $fields->insertBefore(HTMLEditorField::create('NotificationHTML', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords');
     } else {
         $fields->insertBefore(TextareaField::create('NotificationText', _t('SystemNotification.TEXT', 'Text')), 'AvailableKeywords');
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:sheadawson-silverstripe-notifications,代码行数:35,代码来源:SystemNotification.php

示例7: run

 /**
  * Implement this method in the task subclass to
  * execute via the TaskRunner
  */
 public function run($request)
 {
     if (!($adminEmail = $this->config()->get('administrator_email'))) {
         $contenders = $this->extend('feedMeAdminEmail') ?: [];
         $adminEmail = reset($contenders);
     }
     if ($adminEmail) {
         SS_Log::add_writer(new SS_LogEmailWriter($adminEmail, SS_Log::INFO));
     }
     // anything like a warning or above
     SS_Log::add_writer(new SS_LogEmailWriter(Security::findAnAdministrator()->Email), SS_Log::WARN);
     $excludedFeedClasses = $this->config()->get('excluded_feed_class_names');
     // for each implementor of the FeedMeFeedInterface check if it's not excluded then for each
     // instance of that model call feedMeImport on it.
     $implementors = ClassInfo::implementorsOf('FeedMeFeedModelInterface');
     foreach ($implementors as $className) {
         // chance to disable a feed by setting config.excluded_feed_class_names
         if (!in_array($className, $excludedFeedClasses)) {
             /** @var FeedMeFeedModelExtension $feedModel */
             foreach ($className::get() as $feedModel) {
                 $feedModel->feedMeImport();
             }
         }
     }
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-feedme,代码行数:29,代码来源:FeedSyncTask.php

示例8: run

 function run($request)
 {
     $this->traversed = 0;
     $this->processed = array();
     $this->traversedPageType = array();
     $this->processedPageType = array();
     $this->implementors = array();
     /*
      * Implementors inizialization
      */
     $implementros = ClassInfo::implementorsOf('SiteTreeWalkListener');
     foreach ($implementros as $implementor) {
         $this->implementors[$implementor] = new $implementor();
         if ($this->implementors[$implementor]->isEnabled()) {
             $this->processed[$implementor] = 0;
             $this->processedPageType[$implementor] = array();
         } else {
             unset($this->implementors[$implementor]);
         }
     }
     echo "Following SiteTreeWalkListener Implementors will be executed: ";
     foreach ($this->implementors as $implementor => $controller) {
         echo "\n\t* {$implementor}";
     }
     echo "\n\nContinue? [y|n]";
     $confirmation = trim(fgets(STDIN));
     if ($confirmation !== 'y') {
         // The user did not say 'y'.
         exit(0);
     }
     echo "\n";
     $rootPages = DataObject::get('SiteTree', 'ParentID=0', 'Sort ASC');
     foreach ($rootPages as $rp) {
         /* var $rp SiteTree */
         $this->processChildren($rp);
     }
     echo "\n################################################\n";
     echo "Traversed Pages: {$this->traversed}";
     if ($this->verbose) {
         echo "\n\nTraversed Page Types: ";
         foreach ($this->traversedPageType as $class) {
             echo "\n\t* {$class}";
         }
     }
     echo "\n\nProcessed Pages: ";
     foreach ($this->processed as $implementor => $num) {
         echo "\n\t{$implementor}: {$num}";
     }
     if ($this->verbose) {
         echo "\n\nProcessed Page Types: ";
         foreach ($this->processedPageType as $implementor => $classes) {
             echo "\n\t{$implementor}:";
             foreach ($classes as $class) {
                 echo "\n\t\t* {$class}";
             }
         }
     }
     echo "\n################################################\n";
 }
开发者ID:helpfulrobot,项目名称:zirak-sitetree-walk,代码行数:59,代码来源:SiteTreeWalk.php

示例9: up

 /**
  * {@inheritdoc}
  */
 public function up()
 {
     $classes = ClassInfo::implementorsOf('MigratableObject');
     $this->message('Migrating legacy blog records');
     foreach ($classes as $class) {
         $this->upClass($class);
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-blog,代码行数:11,代码来源:BlogMigrationTask.php

示例10: getDataClasses

 public function getDataClasses()
 {
     $map = array();
     foreach (ClassInfo::implementorsOf('RegistryDataInterface') as $class) {
         $map[$class] = singleton($class)->singular_name();
     }
     return $map;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-registry,代码行数:8,代码来源:RegistryPage.php

示例11: collectHooks

 /**
  * Collect global hooks
  */
 public function collectHooks()
 {
     $implementors = ClassInfo::implementorsOf('TemplateHooks');
     if (!empty($implementors)) {
         foreach ($implementors as $implementor) {
             singleton($implementor)->initHooks();
         }
     }
 }
开发者ID:memdev,项目名称:silverstripe-templatehooks,代码行数:12,代码来源:TemplateHooks_Controller_Extension.php

示例12: get_serializer

 /**
  * @return ICacheSerializer
  * @throws Exception
  */
 public static function get_serializer()
 {
     $availableAuths = ClassInfo::implementorsOf('ICacheSerializer');
     $type = Config::inst()->get('CacheHelper', 'SerializerType');
     if (in_array($type, $availableAuths)) {
         return $type::create();
     }
     throw new Exception("Configured cache serializer type '{$type}' not supported", 404);
 }
开发者ID:helpfulrobot,项目名称:ntb-silverstripe-caching,代码行数:13,代码来源:CacheHelper.php

示例13: preRequest

 /**
  * @inheritdoc
  *
  * @param SS_HTTPRequest $request
  * @param Session $session
  * @param DataModel $model
  *
  * @return bool
  */
 public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
 {
     if (array_key_exists('flush', $request->getVars())) {
         foreach (ClassInfo::implementorsOf('Flushable') as $class) {
             $class::flush();
         }
     }
     return true;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:18,代码来源:FlushRequestFilter.php

示例14: createAuth

 /**
  * Returns a new instance of an authentication mechanism depending on the configured type.
  * @return IAuth an instance of an authentication mechanism
  * @throws RestSystemException
  */
 public static function createAuth()
 {
     $availableAuths = ClassInfo::implementorsOf('IAuth');
     $type = Config::inst()->get('AuthFactory', 'AuthType');
     if (in_array($type, $availableAuths)) {
         return $type::create();
     }
     throw new RestSystemException("Configured auth type '{$type}' not supported", 404);
 }
开发者ID:helpfulrobot,项目名称:ntb-silverstripe-rest-api,代码行数:14,代码来源:AuthFactory.php

示例15: testUpdater

 function testUpdater()
 {
     $mock = Phockito::mock('ArrayList');
     $this->assertContains(get_class($mock), ClassInfo::allClasses());
     $this->assertContains(get_class($mock), ClassInfo::subclassesFor('ViewableData'));
     $this->assertContains(get_class($mock), ClassInfo::implementorsOf('SS_List'));
     $mock = Phockito::mock('SS_List');
     $this->assertContains(get_class($mock), ClassInfo::allClasses());
     $this->assertContains(get_class($mock), ClassInfo::implementorsOf('SS_List'));
 }
开发者ID:helpfulrobot,项目名称:hafriedlander-silverstripe-phockito,代码行数:10,代码来源:PhockitoIntegrationTest.php


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