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


PHP GeSHi::getlanguagesuage_name_from_extension方法代码示例

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


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

示例1: execAction

    function execAction($dir, $item)
    {
        // show file contents
        echo '<div>
    <div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
    <div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
	<h3 style="margin-bottom:5px;">' . $GLOBALS["messages"]["actview"] . ": " . $item . '</h3>';
        echo '</div></div></div>
	    <div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
	</div><hr />';
        /*$index2_edit_link = str_replace('/index3.php', '/index2.php', make_link('edit', $dir, $item ));
        		echo '<a name="top" class="componentheading" href="javascript:window.close();">[ '._PROMPT_CLOSE.' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        		$abs_item = get_abs_item($dir, $item);
        		if( get_is_editable( $abs_item) && $GLOBALS['ext_File']->is_writable( $abs_item )) {
        			// Edit the file in the PopUp
        			echo '<a class="componentheading" href="'.make_link('edit', $dir, $item ).'&amp;return_to='.urlencode($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'] ).'">[ '.$GLOBALS["messages"]["editlink"].' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        			// Edit the file in the parent window
        			//echo '<a class="componentheading" href="javascript:opener.location=\''.$index2_edit_link.'\'; window.close();">[ '.$GLOBALS["messages"]["editlink"].' ]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        		}
        		echo '<a class="componentheading" href="#bottom">[ '._CMN_BOTTOM.' ]</a>';
        		
        		echo '<br /><br />';
        		*/
        if (@eregi($GLOBALS["images_ext"], $item)) {
            echo '<img src="' . make_link('get_image', $dir, rawurlencode($item)) . '" alt="' . $GLOBALS["messages"]["actview"] . ": " . $item . '" /><br /><br />';
        } else {
            $geshiFile = _EXT_PATH . '/libraries/geshi/geshi.php';
            if (file_exists($geshiFile)) {
                ext_RaiseMemoryLimit('32M');
                // GeSHi 1.0.7 is very memory-intensive
                include_once $geshiFile;
                // Create the GeSHi object that renders our source beautiful
                $geshi = new GeSHi('', '', dirname($geshiFile) . '/geshi');
                $file = get_abs_item($dir, $item);
                $pathinfo = pathinfo($file);
                if (ext_isFTPMode()) {
                    $file = ext_ftp_make_local_copy($file);
                }
                if (is_callable(array($geshi, 'load_from_file'))) {
                    $geshi->load_from_file($file);
                } else {
                    $geshi->set_source(file_get_contents($file));
                }
                if (is_callable(array($geshi, 'getlanguagesuage_name_from_extension'))) {
                    $lang = $geshi->getlanguagesuage_name_from_extension($pathinfo['extension']);
                } else {
                    $pathinfo = pathinfo($item);
                    $lang = $pathinfo['extension'];
                }
                $geshi->set_language($lang);
                $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
                $text = $geshi->parse_code();
                if (ext_isFTPMode()) {
                    unlink($file);
                }
                echo $text;
                echo '<hr /><div style="line-height:25px;vertical-align:middle;text-align:center;" class="small">Rendering Time: <strong>' . $geshi->get_time() . ' Sec.</strong></div>';
            } else {
                // When GeSHi is not available, just display the plain file contents
                echo '<div class="quote" style="text-align:left;">' . nl2br(htmlentities($GLOBALS['ext_File']->file_get_contents(get_abs_item($dir, $item)))) . '</div>';
            }
        }
        //echo '<a href="#top" name="bottom" class="componentheading">[ '._CMN_TOP.' ]</a><br /><br />';
    }
开发者ID:shamblett,项目名称:janitor,代码行数:64,代码来源:view.php


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