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


PHP core_component::normalize_componentname方法代码示例

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


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

示例1: create_missing_messageinbound_handlers_for_component

 /**
  * Update the database to contain a list of handlers for a component,
  * adding any handlers which do not exist in the database.
  *
  * @param string $componentname - The frankenstyle component name.
  */
 public static function create_missing_messageinbound_handlers_for_component($componentname)
 {
     global $DB;
     $componentname = \core_component::normalize_componentname($componentname);
     $expectedhandlers = self::load_default_handlers_for_component($componentname);
     foreach ($expectedhandlers as $handler) {
         $recordexists = $DB->record_exists('messageinbound_handlers', array('component' => $componentname, 'classname' => $handler->classname));
         if (!$recordexists) {
             $record = self::record_from_handler($handler);
             $record->component = $componentname;
             $DB->insert_record('messageinbound_handlers', $record);
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:20,代码来源:manager.php

示例2: test_normalize_componentname

 public function test_normalize_componentname()
 {
     // Moodle core.
     $this->assertSame('core', core_component::normalize_componentname('core'));
     $this->assertSame('core', core_component::normalize_componentname('moodle'));
     $this->assertSame('core', core_component::normalize_componentname(''));
     // Moodle core subsystems.
     $this->assertSame('core_admin', core_component::normalize_componentname('admin'));
     $this->assertSame('core_admin', core_component::normalize_componentname('core_admin'));
     $this->assertSame('core_admin', core_component::normalize_componentname('moodle_admin'));
     // Activity modules and their subplugins.
     $this->assertSame('mod_workshop', core_component::normalize_componentname('workshop'));
     $this->assertSame('mod_workshop', core_component::normalize_componentname('mod_workshop'));
     $this->assertSame('workshopform_accumulative', core_component::normalize_componentname('workshopform_accumulative'));
     $this->assertSame('mod_quiz', core_component::normalize_componentname('quiz'));
     $this->assertSame('quiz_grading', core_component::normalize_componentname('quiz_grading'));
     $this->assertSame('mod_data', core_component::normalize_componentname('data'));
     $this->assertSame('datafield_checkbox', core_component::normalize_componentname('datafield_checkbox'));
     // Other plugin types.
     $this->assertSame('auth_mnet', core_component::normalize_componentname('auth_mnet'));
     $this->assertSame('enrol_self', core_component::normalize_componentname('enrol_self'));
     $this->assertSame('block_html', core_component::normalize_componentname('block_html'));
     $this->assertSame('block_mnet_hosts', core_component::normalize_componentname('block_mnet_hosts'));
     $this->assertSame('local_amos', core_component::normalize_componentname('local_amos'));
     $this->assertSame('local_admin', core_component::normalize_componentname('local_admin'));
     // Unknown words without underscore are supposed to be activity modules.
     $this->assertSame('mod_whoonearthwouldcomewithsuchastupidnameofcomponent', core_component::normalize_componentname('whoonearthwouldcomewithsuchastupidnameofcomponent'));
     // Module names can not contain underscores, this must be a subplugin.
     $this->assertSame('whoonearth_wouldcomewithsuchastupidnameofcomponent', core_component::normalize_componentname('whoonearth_wouldcomewithsuchastupidnameofcomponent'));
     $this->assertSame('whoonearth_would_come_withsuchastupidnameofcomponent', core_component::normalize_componentname('whoonearth_would_come_withsuchastupidnameofcomponent'));
 }
开发者ID:alexandru-elisei,项目名称:moodle,代码行数:31,代码来源:component_test.php

示例3: getPluginMetadata

 public static function getPluginMetadata($courseformat = 'weeks')
 {
     global $CFG;
     $pluginmanager = \core_plugin_manager::instance();
     $meta = [];
     $plugintypes = \core_component::get_plugin_types();
     foreach ($plugintypes as $plugintype => $plugintypedir) {
         $plugins = \core_component::get_plugin_list($plugintype);
         foreach ($plugins as $pluginname => $plugindir) {
             $component = \core_component::normalize_componentname("{$plugintype}_{$pluginname}");
             $pluginfo = $pluginmanager->get_plugin_info($component);
             // format uses get_config() which we don't want to fake
             if ($plugintype == 'format') {
                 $can_uninstall = $pluginname != $courseformat;
             } else {
                 $can_uninstall = $pluginfo->is_uninstall_allowed();
             }
             $meta[$component] = ['type' => $plugintype, 'dir' => str_replace($CFG->dirroot, '', $plugindir), 'can_uninstall' => $can_uninstall, 'versioninfo' => (array) self::getVersionInfo($plugindir)];
         }
     }
     return $meta;
 }
开发者ID:micaherne,项目名称:minimoodle,代码行数:22,代码来源:PluginsRemoveCommand.php


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