/** * Checks if $query is one of the available subplugins. * * @param string $query The string to search for * @return bool Returns true if found, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } $subplugins = core_component::get_plugin_list('tinymce'); foreach ($subplugins as $name => $dir) { if (stripos($name, $query) !== false) { return true; } $namestr = get_string('pluginname', 'tinymce_' . $name); if (strpos(core_text::strtolower($namestr), core_text::strtolower($query)) !== false) { return true; } } return false; }
/** * Checks if $query is one of the available log plugins. * * @param string $query The string to search for * @return bool Returns true if found, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } $query = core_text::strtolower($query); $plugins = \tool_log\log\manager::get_store_plugins(); foreach ($plugins as $plugin => $fulldir) { if (strpos(core_text::strtolower($plugin), $query) !== false) { return true; } $localised = get_string('pluginname', $plugin); if (strpos(core_text::strtolower($localised), $query) !== false) { return true; } } return false; }
/** * Checks if $query is one of the available dataformfield plugins. * * @param string $query The string to search for * @return bool Returns true if found, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } $query = \core_text::strtolower($query); $plugins = \core_component::get_plugin_list('dataformfield'); foreach ($plugins as $plugin => $fulldir) { if (strpos(\core_text::strtolower($plugin), $query) !== false) { return true; } $localised = get_string('pluginname', "dataformfield_{$plugin}"); if (strpos(\core_text::strtolower($localised), $query) !== false) { return true; } } return false; }
/** * Check if this is $query is related to a choice * * @param string $query * @return bool true if related, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } if (!$this->load_choices()) { return false; } foreach ($this->choices as $key => $value) { if (strpos(core_text::strtolower($key), $query) !== false) { return true; } if (strpos(core_text::strtolower($value), $query) !== false) { return true; } } return false; }
/** * Checks if $query is one of the available webservices * * @param string $query The string to search for * @return bool Returns true if found, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } $textlib = textlib_get_instance(); $protocols = get_plugin_list('webservice'); foreach ($protocols as $protocol => $location) { if (strpos($protocol, $query) !== false) { return true; } $protocolstr = get_string('pluginname', 'webservice_' . $protocol); if (strpos($textlib->strtolower($protocolstr), $query) !== false) { return true; } } return false; }
/** * Checks if $query is one of the available webservices * * @param string $query The string to search for * @return bool Returns true if found, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } $protocols = core_component::get_plugin_list('webservice'); foreach ($protocols as $protocol => $location) { if (strpos($protocol, $query) !== false) { return true; } $protocolstr = get_string('pluginname', 'webservice_' . $protocol); if (strpos(core_text::strtolower($protocolstr), $query) !== false) { return true; } } return false; }
function is_related($query) { if (parent::is_related($query)) { return true; } $textlib = textlib_get_instance(); $filterlocations = array('mod', 'filter'); foreach ($filterlocations as $filterlocation) { $plugins = get_list_of_plugins($filterlocation); foreach ($plugins as $plugin) { if (strpos($plugin, $query) !== false) { return true; } $name = get_string('filtername', $plugin); if (strpos($textlib->strtolower($name), $query) !== false) { return true; } } } return false; }
/** * Searches repository plugins for one that matches $query * * @param string $query The string to search for * @return bool true if found, false if not */ public function is_related($query) { if (parent::is_related($query)) { return true; } $textlib = textlib_get_instance(); $repositories = get_plugin_list('repository'); foreach ($repositories as $p => $dir) { if (strpos($p, $query) !== false) { return true; } } foreach (repository::get_types() as $instance) { $title = $instance->get_typename(); if (strpos($textlib->strtolower($title), $query) !== false) { return true; } } return false; }