📄 createpotfile.php
字号:
<?phpdefined('WikyBlog') or die("Not an entry point...");global $page;if( $_SESSION['userlevel'] !== 4){ $page->contentA['Admin Only'] = 'You must be an administrator to access this page.'; return;}// an example pot file//http://svn.automattic.com/wordpress-i18n/pot/trunk/wordpress.potclass createPOTfile{ function createPOTfile(){ global $page,$dbObject,$pageOwner,$includeDir; $page->displayTitle = 'Create POT File'; $dbObject->links['POT File'] = $page->formAction = '/Admin/'.$pageOwner['username'].'/POTfile'; ob_start(); $this->go(); echo '<input type="submit" name="cmd" value="Refresh" />'; $page->contentA['POT File'] = wb::get_clean(); } function go(){ global $includeDir; $langDir = $includeDir.'/lang/en/'; $lang = array(); $dh = @opendir($langDir); if( !$dh ){ message('Could not open lang directory: '.$langDir); return false; } while (($file = readdir($dh)) !== false) { $pos = strpos($file,'.php'); if( $pos === false ){ continue; } if( $pos !== (strlen($file)-4) ){ continue; } $fullPath = $langDir.$file; require($fullPath); } $newLine = "\n"; echo '<textarea style="width:100%" rows="'.$_SESSION['textareaY'].'" >'; echo '# WikyBlog POT file.'; echo $newLine.'# This file is distributed under the same license as the WikyBlog package.'; $root = '$lang'; $this->echoLang($lang,$root); echo '</textarea>'; } function echoLang($lang,$root){ $newLine = "\n"; foreach($lang as $key => $value){ $newRoot = $root.'[\''.$key.'\']'; if( is_array($value) ){ $this->echoLang($value,$newRoot); continue; } echo $newLine.$newLine.'#: '.$newRoot; echo $newLine.'msgid "'.str_replace(array('\\','"'),array('\\\\','\"'),$value).'"'; echo $newLine.'msgstr ""'; } } }new createPOTfile();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -