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


PHP GeSHi::get_supported_languages方法代码示例

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


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

示例1: execute

 public function execute()
 {
     if (false === Common::isFile(GWF_GESHI_PATH)) {
         return '';
         // FIXME: {gizmore} log it? GESHI_PATH is may not readable
     }
     require_once GWF_GESHI_PATH;
     $geshi = new GeSHi();
     $langs = $geshi->get_supported_languages(false);
     $key = htmlspecialchars(Common::getGetString('key', ''), ENT_QUOTES);
     sort($langs);
     //		$this->niceArray($langs, false, '-------')
     $this->niceArray($langs, 'python', 'Python');
     $this->niceArray($langs, 'perl', 'Perl');
     $this->niceArray($langs, 'cpp', 'CPP');
     $this->niceArray($langs, 'php', 'PHP');
     $back = $this->module->lang('th_lang') . ':' . PHP_EOL;
     $back .= '<select id="bb_code_lang_sel_' . $key . '">' . PHP_EOL;
     $back .= '<option value="0">' . $this->module->lang('th_lang') . '</option>' . PHP_EOL;
     foreach ($langs as $lang) {
         $back .= sprintf('<option value="%s">%s</option>', $lang, $lang) . PHP_EOL;
     }
     $back .= '</select>' . PHP_EOL;
     $back .= $this->module->lang('th_title') . ': <input type="text" id="bb_code_title_' . $key . '" size="20" value="" />' . PHP_EOL;
     $back .= '<input type="submit" value="' . $this->module->lang('btn_code') . '" onclick="return bbInsertCodeNow(\'' . $key . '\');" />' . PHP_EOL;
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:27,代码来源:CodeLangs.php

示例2: onExtra

 function onExtra($name)
 {
     $output = NULL;
     if ($name == "header") {
         if (!$this->yellow->config->get("highlightStylesheetDefault")) {
             $locationStylesheet = $this->yellow->config->get("serverBase") . $this->yellow->config->get("pluginLocation") . "highlight.css";
             $fileNameStylesheet = $this->yellow->config->get("pluginDir") . "highlight.css";
             if (is_file($fileNameStylesheet)) {
                 $output = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"{$locationStylesheet}\" />\n";
             }
         } else {
             $geshi = new GeSHi();
             $geshi->set_language_path($this->yellow->config->get("pluginDir") . "/highlight/");
             foreach ($geshi->get_supported_languages() as $language) {
                 if ($language == "geshi") {
                     continue;
                 }
                 $geshi->set_language($language);
                 $output .= $geshi->get_stylesheet(false);
             }
             $output = "<style type=\"text/css\">\n{$output}</style>";
         }
     }
     return $output;
 }
开发者ID:nogginfuel,项目名称:yellow-extensions,代码行数:25,代码来源:highlight.php

示例3: execute

 public function execute()
 {
     global $IP;
     $geshi = new GeSHi();
     $header = '// Generated by ' . basename(__FILE__) . ' on ' . date(DATE_RFC2822) . "\n";
     $langs = array_values(array_filter($geshi->get_supported_languages(false), 'ctype_alnum'));
     sort($langs);
     $replace = array('[' => "array(\n\t", ']' => "\n);\n", '",' => "\",\n\t");
     $code = "<?php\n" . $header . "global \$wgGeSHiSupportedLanguages;\n" . '$wgGeSHiSupportedLanguages = ' . strtr(json_encode($langs), $replace);
     file_put_contents(__DIR__ . '/../SyntaxHighlight_GeSHi.langs.php', $code);
     $this->output("Updated language list written to SyntaxHighlight_GeSHi.langs.php\n");
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:12,代码来源:updateLanguageList.php

示例4: setFormDef_ViewHelper

 public function setFormDef_ViewHelper()
 {
     require_once 'geshi/geshi.php';
     $geshi = new GeSHi();
     $supported = $geshi->get_supported_languages();
     $option = array();
     foreach ($supported as $sl) {
         $option[$sl] = ucfirst($sl);
     }
     $sl = asort($option);
     $ct = $this->getDef('content_type');
     $ct['option'] = array('text' => 'Text', 'php' => 'PHP', 'diff' => 'Diff', '-' => '------') + $option;
     $this->setDef('content_type', $ct);
 }
开发者ID:riaf,项目名称:pastit,代码行数:14,代码来源:Do.php

示例5: execute

 public function execute(GWF_Module $module)
 {
     require_once GWF_GESHI_PATH;
     $geshi = new GeSHi();
     $langs = $geshi->get_supported_languages(false);
     sort($langs);
     //		$this->niceArray($langs, false, '-------')
     $this->niceArray($langs, 'python', 'Python');
     $this->niceArray($langs, 'perl', 'Perl');
     $this->niceArray($langs, 'cpp', 'CPP');
     $this->niceArray($langs, 'php', 'PHP');
     $back = $module->lang('th_lang') . ':' . PHP_EOL;
     $back .= '<select id="bb_code_lang_sel">' . PHP_EOL;
     $back .= '<option value="0">' . $module->lang('th_lang') . '</option>' . PHP_EOL;
     foreach ($langs as $lang) {
         $back .= sprintf('<option value="%s">%s</option>', $lang, $lang) . PHP_EOL;
     }
     $back .= '</select>' . PHP_EOL;
     $back .= $module->lang('th_title') . ': <input type="text" name="bb_code_title" id="bb_code_title" size="20" value="" />' . PHP_EOL;
     $back .= '<input type="submit" name="bb_code_insert" value="' . $module->lang('btn_code') . '" onclick="return bbInsertCodeNow();" />' . PHP_EOL;
     return $back;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:22,代码来源:CodeLangs.php

示例6: dirname

 /**
  * Returns a list of valid languages from GeSHi
  * @return DatObjectSet
  */
 static function get_valid_languages()
 {
     require_once dirname(__DIR__) . '/thirdparty/geshi/geshi.php';
     $g = new GeSHi();
     $languages = new DataObjectSet();
     foreach ($g->get_supported_languages(false) as $language) {
         $languages->push(new ArrayData(array('ID' => $language, 'Name' => $language)));
     }
     $languages->sort('Name');
     return $languages;
 }
开发者ID:hamishcampbell,项目名称:silverstripe-pastie,代码行数:15,代码来源:PastieSnippet.php

示例7: DoCode

	function DoCode($bbcode, $action, $name, $default, $params, $content) {
		static $enabled = false;
		static $languages = array();

		if ($action == BBCODE_CHECK)
			return true;

		$type = isset ( $params ["type"] ) ? $params ["type"] : "php";
		if ($type == 'js') {
			$type = 'javascript';
		} elseif ($type == 'html') {
			$type = 'html4strict';
		}
		if ($enabled === false && KunenaFactory::getConfig ()->highlightcode) {
			$enabled = true;
			if (version_compare(JVERSION, '1.6','>')) {
				// Joomla 1.6+
				// TODO: use the content plugin instead
				require_once JPATH_ROOT.'/plugins/content/geshi/geshi/geshi.php';
			} else {
				// Joomla 1.5
				jimport ( 'geshi.geshi' );
			}
			$languages = GeSHi::get_supported_languages();
		}
		if ($enabled && in_array ( $type, $languages )) {
			$geshi = new GeSHi ( $bbcode->UnHTMLEncode($content), $type );
			$geshi->enable_keyword_links ( false );
			$code = $geshi->parse_code ();
		} else {
			$type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type);
			$code = '<pre xml:'.$type.'>'.$content.'</pre>';
		}
		return '<div class="highlight">'.$code.'</div>';
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:35,代码来源:bbcode.php


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