本文整理汇总了PHP中filter_is_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_is_enabled函数的具体用法?PHP filter_is_enabled怎么用?PHP filter_is_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_is_enabled函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filter_plugin_enabled
/**
* Checks if the provided filter path is installed and enabled (check "Site Administration -> Plugins -> Filters" or
* "Site Administration -> Modules -> Filters" area to see if a filter is enabled) in the moodle platform. Uses the built-in
* function filter_is_enabled() for Moodle 2.x and raw checkups for Moodle 1.9.
*
* @param String $filterpath
* The filter path in the format "folder/plugin_name" to check for files
* @return boolean
* true if the filter is installed and enabled, false otherwise
*/
function filter_plugin_enabled($filterpath)
{
global $CFG;
// filter_is_enabled() function belongs to Moodle 2.x
if (function_exists('filter_is_enabled')) {
return filter_is_enabled($filterpath);
} else {
// get all the currently selected filters
if (!empty($CFG->textfilters)) {
$activefilters = explode(',', $CFG->textfilters);
} else {
$activefilters = array();
}
// check if filter plugin location is readable
$pluginpath = "{$CFG->dirroot}/{$filterpath}/filter.php";
return is_readable($pluginpath) && in_array($filterpath, $activefilters);
}
}
开发者ID:babeliumproject,项目名称:moodle-assignment_babelium,代码行数:28,代码来源:babelium_widget.php
示例2: process_config
public function process_config($data)
{
$data = (object) $data;
if (strpos($data->filter, 'filter/') === 0) {
$data->filter = substr($data->filter, 7);
} else {
if (strpos($data->filter, '/') !== false) {
// Unsupported old filter.
return;
}
}
if (!filter_is_enabled($data->filter)) {
// Not installed or not enabled, nothing to do
return;
}
filter_set_local_config($data->filter, $this->task->get_contextid(), $data->name, $data->value);
}
开发者ID:Jinelle,项目名称:moodle,代码行数:17,代码来源:restore_stepslib.php
示例3: process_config
public function process_config($data) {
$data = (object)$data;
if (!filter_is_enabled($data->filter)) { // Not installed or not enabled, nothing to do
return;
}
filter_set_local_config($data->filter, $this->task->get_contextid(), $data->name, $data->value);
}
开发者ID:nottmoo,项目名称:moodle,代码行数:9,代码来源:restore_stepslib.php
示例4: file_modify_html_header
/**
* add includes (js and css) into uploaded files
* before returning them, useful for themes and utf.js includes
*
* @global object
* @param string $text text to search and replace
* @return string text with added head includes
*/
function file_modify_html_header($text)
{
// first look for <head> tag
global $CFG;
$stylesheetshtml = '';
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}*/
$ufo = '';
if (filter_is_enabled('filter/mediaplugin')) {
// this script is needed by most media filter plugins.
$attributes = array('type' => 'text/javascript', 'src' => $CFG->httpswwwroot . '/lib/ufo.js');
$ufo = html_writer::tag('script', '', $attributes) . "\n";
}
preg_match('/\\<head\\>|\\<HEAD\\>/', $text, $matches);
if ($matches) {
$replacement = '<head>' . $ufo . $stylesheetshtml;
$text = preg_replace('/\\<head\\>|\\<HEAD\\>/', $replacement, $text, 1);
return $text;
}
// if not, look for <html> tag, and stick <head> right after
preg_match('/\\<html\\>|\\<HTML\\>/', $text, $matches);
if ($matches) {
// replace <html> tag with <html><head>includes</head>
$replacement = '<html>' . "\n" . '<head>' . $ufo . $stylesheetshtml . '</head>';
$text = preg_replace('/\\<html\\>|\\<HTML\\>/', $replacement, $text, 1);
return $text;
}
// if not, look for <body> tag, and stick <head> before body
preg_match('/\\<body\\>|\\<BODY\\>/', $text, $matches);
if ($matches) {
$replacement = '<head>' . $ufo . $stylesheetshtml . '</head>' . "\n" . '<body>';
$text = preg_replace('/\\<body\\>|\\<BODY\\>/', $replacement, $text, 1);
return $text;
}
// if not, just stick a <head> tag at the beginning
$text = '<head>' . $ufo . $stylesheetshtml . '</head>' . "\n" . $text;
return $text;
}
开发者ID:hatone,项目名称:moodle,代码行数:48,代码来源:filelib.php
示例5: define
<?php
// This function fetches math. images from the data directory
// If not, it obtains the corresponding TeX expression from the cache_tex db table
// and uses mimeTeX to create the image file
define('NO_MOODLE_COOKIES', true);
// Because it interferes with caching
require_once "../../config.php";
if (!filter_is_enabled('algebra')) {
print_error('filternotenabled');
}
require_once $CFG->libdir . '/filelib.php';
require_once $CFG->dirroot . '/filter/tex/lib.php';
require_login();
require_capability('moodle/site:config', context_system::instance());
$query = urldecode($_SERVER['QUERY_STRING']);
if ($query) {
$output = $query;
$splitpos = strpos($query, '&') - 8;
$algebra = substr($query, 8, $splitpos);
$md5 = md5($algebra);
if (strpos($query, 'ShowDB') || strpos($query, 'DeleteDB')) {
$texcache = $DB->get_record("cache_filters", array("filter" => "algebra", "md5key" => $md5));
}
if (strpos($query, 'ShowDB')) {
if ($texcache) {
$output = "DB cache_filters entry for {$algebra}\n";
$output .= "id = {$texcache->id}\n";
$output .= "filter = {$texcache->filter}\n";
$output .= "version = {$texcache->version}\n";
$output .= "md5key = {$texcache->md5key}\n";
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:algebradebug.php
示例6: array
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This function fetches math. images from the data directory
* If not, it obtains the corresponding TeX expression from the cache_tex db table
* and uses mimeTeX to create the image file
*
* @package filter
* @subpackage tex
* @copyright 2004 Zbigniew Fiedorowicz [email protected]
* Originally based on code provided by Bruno Vernier [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once "../../config.php";
if (!filter_is_enabled('filter/tex')) {
print_error('filternotenabled');
}
require_once $CFG->libdir . '/filelib.php';
require_once $CFG->dirroot . '/filter/tex/lib.php';
require_once $CFG->dirroot . '/filter/tex/latex.php';
$action = optional_param('action', '', PARAM_ALPHA);
$texexp = optional_param('tex', '', PARAM_RAW);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM), $USER->id);
/// Required cap to run this. MDL-18552
$output = '';
// look up in cache if required
if ($action == 'ShowDB' or $action == 'DeleteDB') {
$md5 = md5($texexp);
$texcache = $DB->get_record("cache_filters", array("filter" => "tex", "md5key" => $md5));
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:texdebug.php
示例7: define
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script displays tex source code, it is used also from the algebra filter.
*
* @package filter
* @subpackage tex
* @copyright 2004 Zbigniew Fiedorowicz [email protected]
* Originally based on code provided by Bruno Vernier [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_MOODLE_COOKIES', true);
// Because it interferes with caching
require '../../config.php';
if (!filter_is_enabled('tex') and !filter_is_enabled('algebra')) {
print_error('filternotenabled');
}
$texexp = optional_param('texexp', '', PARAM_RAW);
$title = get_string('source', 'filter_tex');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php
echo $title;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:displaytex.php
示例8: array
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This function fetches math. images from the data directory
* If not, it obtains the corresponding TeX expression from the cache_tex db table
* and uses mimeTeX to create the image file
*
* @package filter
* @subpackage tex
* @copyright 2004 Zbigniew Fiedorowicz [email protected]
* Originally based on code provided by Bruno Vernier [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once "../../config.php";
if (!filter_is_enabled('tex')) {
print_error('filternotenabled');
}
require_once $CFG->libdir . '/filelib.php';
require_once $CFG->dirroot . '/filter/tex/lib.php';
require_once $CFG->dirroot . '/filter/tex/latex.php';
$action = optional_param('action', '', PARAM_ALPHA);
$texexp = optional_param('tex', '', PARAM_RAW);
require_login();
require_capability('moodle/site:config', context_system::instance(), $USER->id);
/// Required cap to run this. MDL-18552
$output = '';
// look up in cache if required
if ($action == 'ShowDB' or $action == 'DeleteDB') {
$md5 = md5($texexp);
$texcache = $DB->get_record("cache_filters", array("filter" => "tex", "md5key" => $md5));
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:texdebug.php
示例9: updateConfiguration
public function updateConfiguration(&$configuration)
{
global $CFG;
// Cache folder.
$configuration['wiriscachedirectory'] = $CFG->dataroot . '/filter/wiris/cache';
if (!file_exists($configuration['wiriscachedirectory'])) {
@mkdir($configuration['wiriscachedirectory'], 0755, true);
}
// Formulas folder.
$configuration['wirisformuladirectory'] = $CFG->dataroot . '/filter/wiris/formulas';
if (!file_exists($configuration['wirisformuladirectory'])) {
@mkdir($configuration['wirisformuladirectory'], 0755, true);
}
$scriptName = explode('/', $_SERVER["SCRIPT_FILENAME"]);
$scriptName = array_pop($scriptName);
if ($scriptName == 'showimage.php') {
// Minimal conf showing images.
if (isset($_GET['refererquery'])) {
$refererquery = implode('&', explode('/', $_GET['refererquery']));
$configuration['wirisreferer'] = $CFG->wwwroot . $refererquery;
}
return;
}
// Enable LaTeX.
if ($this->getLatexStatus()) {
$configuration['wiriseditorparselatex'] = false;
}
// WIRIS editor.
$filter_enabled = filter_is_enabled('filter/wiris');
$this->was_editor_enabled = $this->evalParameter($configuration['wiriseditorenabled']);
if (isset($CFG->filter_wiris_editor_enable)) {
$configuration['wiriseditorenabled'] = $this->was_editor_enabled && $this->evalParameter($CFG->filter_wiris_editor_enable) && $filter_enabled;
} else {
$configuration['wiriseditorenabled'] = false;
}
// WIRIS cas.
$this->was_cas_enabled = $this->evalParameter($configuration['wiriscasenabled']);
if (isset($CFG->filter_wiris_cas_enable)) {
$configuration['wiriscasenabled'] = $this->was_cas_enabled && $this->evalParameter($CFG->filter_wiris_cas_enable) && $filter_enabled;
} else {
$configuration['wiriscasenabled'] = false;
}
// Where is the plugin.
$configuration['wiriscontextpath'] = $this->editor_plugin->url;
// Encoded XML
$configuration['wiriseditorsavemode'] = 'safeXml';
// Moodle version.
// if ($CFG->version >= 2012120300) { // Moodle 2.4 or superior
// $configuration['wirishostplatform'] = 'moodle2_4';
// } else {
// $configuration['wirishostplatform'] = 'moodle2';
// }
$configuration['wirishostplatform'] = isset($CFG->release) ? $CFG->release : $CFG->version;
// Referer.
global $COURSE;
$query = '';
if (isset($COURSE->id)) {
$query .= '?course=' . $COURSE->id;
}
if (isset($COURSE->category)) {
$query .= empty($query) ? '?' : '&';
$query .= 'category=' . $COURSE->category;
}
$configuration['wirisreferer'] = $CFG->wwwroot . $query;
$moodleproxyenabled = !empty($CFG->proxyhost);
$proxyportenabled = !empty($CFG->proxyport);
$proxyuserenabled = !empty($CFG->proxyuser);
$proxypassenabled = !empty($CFG->proxypassword);
if ($moodleproxyenabled) {
$configuration['wirisproxy'] = "true";
$configuration['wirisproxy_host'] = $CFG->proxyhost;
$configuration['wirisproxy_port'] = $proxyportenabled ? $CFG->proxyport : null;
$configuration['wirisproxy_user'] = $proxyuserenabled ? $CFG->proxyuser : null;
$configuration['wirisproxy_password'] = $proxypassenabled ? $CFG->proxypassword : null;
}
}
开发者ID:mads233,项目名称:moodle-filter_wiris,代码行数:76,代码来源:MoodleConfigurationUpdater.php
示例10: wrs_createTableRow
$report_text = '<span>' . $plugin->release . '</span>';
$condition = true;
} else {
$report_text = 'Impossible to find WIRIS plugin filter version file.';
$condition = false;
}
$solution_link = 'http://www.wiris.com/plugins/moodle/download';
echo wrs_createTableRow($test_name, $report_text, $solution_link, $condition);
?>
</tr>
<tr>
<?php
$test_name = 'WIRIS plugin filter';
$solution_link = 'http://www.wiris.com/plugins/docs/moodle/moodle-2.0';
$filter_enabled = filter_is_enabled('filter/wiris');
if ($filter_enabled) {
$report_text = 'ENABLED';
} else {
$report_text = 'DISABLED';
}
echo wrs_createTableRow($test_name, $report_text, $solution_link, $filter_enabled);
?>
</tr>
<tr>
<?php
$test_name = 'Looking for WIRIS plugin for ' . $wiris_plugin_base_string;
$report_text = 'WIRIS plugin for ' . $wiris_plugin_base_string . ' must be installed.';
$solution_link = 'http://www.wiris.com/plugins/moodle/download';
$wiris_plugin = $wiris_plugin_base . '/integration';
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:31,代码来源:info.php
示例11: file_modify_html_header
/**
* add includes (js and css) into uploaded files
* before returning them, useful for themes and utf.js includes
* @param string text - text to search and replace
* @return string - text with added head includes
*/
function file_modify_html_header($text)
{
// first look for <head> tag
global $CFG;
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
$stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n";
}
$ufo = '';
if (filter_is_enabled('filter/mediaplugin')) {
// this script is needed by most media filter plugins.
$ufo = get_require_js_code(array($CFG->wwwroot . '/lib/ufo.js'));
}
preg_match('/\\<head\\>|\\<HEAD\\>/', $text, $matches);
if ($matches) {
$replacement = '<head>' . $ufo . $stylesheetshtml;
$text = preg_replace('/\\<head\\>|\\<HEAD\\>/', $replacement, $text, 1);
return $text;
}
// if not, look for <html> tag, and stick <head> right after
preg_match('/\\<html\\>|\\<HTML\\>/', $text, $matches);
if ($matches) {
// replace <html> tag with <html><head>includes</head>
$replacement = '<html>' . "\n" . '<head>' . $ufo . $stylesheetshtml . '</head>';
$text = preg_replace('/\\<html\\>|\\<HTML\\>/', $replacement, $text, 1);
return $text;
}
// if not, look for <body> tag, and stick <head> before body
preg_match('/\\<body\\>|\\<BODY\\>/', $text, $matches);
if ($matches) {
$replacement = '<head>' . $ufo . $stylesheetshtml . '</head>' . "\n" . '<body>';
$text = preg_replace('/\\<body\\>|\\<BODY\\>/', $replacement, $text, 1);
return $text;
}
// if not, just stick a <head> tag at the beginning
$text = '<head>' . $ufo . $stylesheetshtml . '</head>' . "\n" . $text;
return $text;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:44,代码来源:filelib.php
示例12: is_enabled
function is_enabled()
{
return filter_is_enabled($this->plugin);
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:4,代码来源:pluginscontrolslib.php
注:本文中的filter_is_enabled函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论