array( 'title_update' => 'キャッシュ更新', 'msg_adminpass' => '管理者パスワード', 'btn_submit' => '実行', 'msg_done' => 'キャッシュの更新が完了しました。', 'msg_usage' => ' * 処理内容 :文字実体参照にマッチする正規表現パターンのキャッシュを更新| PHPの持つテーブルおよびW3CのDTDをスキャンして、キャッシュに記録します。 * 処理対象 「COLOR(red){not found.}」と表示されたファイルは処理されません。 -%s * 実行 管理者パスワードを入力して、[実行]ボタンをクリックしてください。 ' )); set_plugin_messages($messages); } function plugin_update_entities_action() { global $vars; global $_entities_messages; $script = get_base_uri(); if (PKWK_READONLY) die_message('PKWK_READONLY prohibits this'); $msg = $body = ''; if (empty($vars['action']) || empty($vars['adminpass']) || ! pkwk_login($vars['adminpass'])) { $msg = & $_entities_messages['title_update']; $items = plugin_update_entities_create(); $body = convert_html(sprintf($_entities_messages['msg_usage'], join("\n" . '-', $items))); $body .= <<
EOD; } else if ($vars['action'] == 'update') { plugin_update_entities_create(TRUE); $msg = & $_entities_messages['title_update']; $body = & $_entities_messages['msg_done' ]; } else { $msg = & $_entities_messages['title_update']; $body = & $_entities_messages['err_invalid' ]; } return array('msg'=>$msg, 'body'=>$body); } // Remove & => amp function plugin_update_entities_strtr($entity){ return strtr($entity, array('&'=>'', ';'=>'')); } function plugin_update_entities_create($do = FALSE) { $files = array('xhtml-lat1.ent', 'xhtml-special.ent', 'xhtml-symbol.ent'); $entities = array_map('plugin_update_entities_strtr', array_values(get_html_translation_table(HTML_ENTITIES))); $items = array('php:html_translation_table'); $matches = array(); foreach ($files as $file) { $source = file(W3C_XHTML_DTD_LOCATION . $file); // or die_message('cannot receive ' . W3C_XHTML_DTD_LOCATION . $file . '.'); if (! is_array($source)) { $items[] = 'w3c:' . $file . ' COLOR(red):not found.'; continue; } $items[] = 'w3c:' . $file; if (preg_match_all('/' . "\n" . 'maybe permission is not writable or filename is too long'); fwrite($fp, $pattern); fclose($fp); return $items; }