本文整理汇总了PHP中gpPlugin::GetConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP gpPlugin::GetConfig方法的具体用法?PHP gpPlugin::GetConfig怎么用?PHP gpPlugin::GetConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpPlugin
的用法示例。
在下文中一共展示了gpPlugin::GetConfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HighlighterSettings
function HighlighterSettings()
{
$this->config = gpPlugin::GetConfig();
$this->config += array('theme' => 'default');
$this->themes = array('default' => 'Default', 'django' => 'Django', 'eclipse' => 'Eclipse', 'emacs' => 'Emacs', 'fadetogrey' => 'Fade to Grey', 'midnight' => 'Midnight', 'rdark' => 'RDark', 'none' => '[None]');
$this->themes = gpPlugin::Filter('syntaxhighlighter_themes', array($this->themes));
$cmd = common::GetCommand();
switch ($cmd) {
case 'save':
$this->Save();
break;
}
$this->ShowForm();
}
示例2: CheckContent
/**
* Add syntax highlighting to the page
* Check for <pre class="brush:jscript;">.. php...
* Add the appropriate js and css files
*
*/
static function CheckContent()
{
global $page, $addonRelativeCode;
$content = ob_get_contents();
$avail_brushes['css'] = 'shBrushCss.js';
$avail_brushes['diff'] = 'shBrushDiff.js';
$avail_brushes['ini'] = 'shBrushIni.js';
$avail_brushes['jscript'] = 'shBrushJScript.js';
$avail_brushes['php'] = 'shBrushPhp.js';
$avail_brushes['plain'] = 'shBrushPlain.js';
$avail_brushes['sql'] = 'shBrushSql.js';
$avail_brushes['xml'] = 'shBrushXml.js';
$brushes = array();
preg_match_all('#<pre[^<>]*>#', $content, $matches);
if (!count($matches)) {
return;
}
foreach ($matches[0] as $match) {
preg_match('#class=[\'"]([^\'"]+)[\'"]#', $match, $classes);
if (!isset($classes[1])) {
continue;
}
preg_match('#brush:([^;\'"]+)[;"\']?#', $match, $type);
if (!isset($type[1])) {
continue;
}
$type = strtolower(trim($type[1]));
if (!isset($avail_brushes[$type])) {
continue;
}
$brushes[] = $avail_brushes[$type];
}
if (!count($brushes)) {
return;
}
$config = gpPlugin::GetConfig();
$theme =& $config['theme'];
$page->head .= "\n\n";
$page->head .= '<link rel="stylesheet" type="text/css" href="' . $addonRelativeCode . '/syntaxhighlighter/styles/shCore.css" />' . "\n";
$css_file = 'shThemeDefault.css';
switch ($theme) {
case 'django':
$css_file = 'shThemeDjango.css';
break;
case 'eclipse':
$css_file = 'shThemeEclipse.css';
break;
case 'emacs':
$css_file = 'shThemeEmacs.css';
break;
case 'fadetogrey':
$css_file = 'shThemeFadeToGrey.css';
break;
case 'midnight':
$css_file = 'shThemeMidnight.css';
break;
case 'rdark':
$css_file = 'shThemeRDark.css';
break;
case 'none':
$css_file = false;
break;
}
if ($css_file) {
$page->head .= '<link rel="stylesheet" type="text/css" href="' . $addonRelativeCode . '/syntaxhighlighter/styles/' . $css_file . '" />' . "\n";
}
$page->head .= '<script language="javascript" type="text/javascript" src="' . $addonRelativeCode . '/syntaxhighlighter/scripts/shCore.js"></script>' . "\n";
foreach ($brushes as $brush) {
$page->head .= '<script language="javascript" type="text/javascript" src="' . $addonRelativeCode . '/syntaxhighlighter/scripts/' . $brush . '"></script>' . "\n";
}
$page->jQueryCode .= "\nSyntaxHighlighter.all();\n";
}