- Palmwares and Miscellany -
開始行:
&tag(P_BLOG);
#contents
*負荷軽減 [#xb976343]
**Plug-in 読込み処理を1回だけに [#be0313e8]
include/func_base.inc.php
#geshi(PHP){{
function include_plugin($mode)
{
global $cd, $cfg, $plugin;
+ static $done;
+
+ if (isset($done)) return;
+
if ($handlerDir = @opendir($cd . '/include/user_inclu...
while ($filename = readdir($handlerDir)) {
if ($filename != '.' && $filename != '..' && ...
include_once $cd . '/include/user_include...
}
}
}
+
+ $done = true;
}
}}
**SQL へのアクセスを減らす [#e1b06084]
include/func_base.inc.php
#geshi(PHP){{
function db_connect()
{
global $dbname, $host, $user, $password;
+ static $link;
+
+ if (isset($link)) return $link;
+
$link = @mysql_connect($host, $user, $password);
if ($link && mysql_select_db($dbname)) {
return $link;
} else {
+ unset($link);
if (file_exists('./SETUP/')) {
$update_dir = '<p class="ref">Go to <a href="...
} else {
$update_dir = '<p>No SETUP directory found.</...
}
}}
#geshi(PHP){{
function init_config()
{
global $config_table, $cd;
+ static $cfg;
+
+ if (isset($cfg)) return $cfg;
+
$cfg = array();
$sql = 'SELECT * FROM `' . $config_table . '`';
$res = mysql_query($sql);
if ($res) {
while ($row = mysql_fetch_assoc($res)) {
$cfg[$row['config_key']] = $row['config_value...
}
} else {
+ unset($cfg);
if (file_exists('./SETUP/')) {
$update_dir = '<p class="ref">Go to <a href="...
} else {
$update_dir = '<p>No SETUP directory found.</...
}
}}
定量的な検証はしていないので、どの程度早くなるかは気持ち...
*「もっと読む」のリンク先を文書の続きに変更 [#hf0631aa]
include/func_logs.inc.php
#geshi(PHP){{
function display_article_box($row)
{
global $cfg, $lang, $cd, $session_status, $id, $admin...
// Permanent Link
if (empty($id)) {
$permalink = '<a href="'.$cd.'/article.php?id='.$...
$lang['permalink_title_1'] . htmlspe...
'" rel="Bookmark">Permalink</a> ';
- $read_more = '<p class="read-more"><a href="' . $...
+ $read_more = '<p class="read-more"><a href="' . $...
$row['comment'] = preg_replace('/<!-- ?more ?-->....
$row['comment'] = preg_replace('/<!-- ?more ?-->....
} else {
$permalink = '';
+ $read_more = '<span id="more"></span>';
+ $row['comment'] = preg_replace('/<!-- ?more ?-->/...
}
}}
files/include/func_files.inc.php
#geshi(PHP){{
function display_binary_box($row)
{
global $cfg, $lang, $cd, $session_status, $admin_dir,...
$bin_type = $row['bintype']; //Check file types
$bin_size = $row['binsize'] / 1024; // Convert "Byte"...
$bin_size = ceil($bin_size);
// Permanent Link
if (empty($_GET['id'])) {
$permalink = '<a href="' .$cd. '/files/article.p...
$lang['permalink_title_1'] . htmlsp...
'" rel="Bookmark" class="permalink"...
if (($_SERVER["SCRIPT_NAME"] != $cfg['root_path']...
($_SERVER["SCRIPT_NAME"] != $cfg['root_path']...
- $read_more = '<p class="read-more"><a href="'...
+ $read_more = '<p class="read-more"><a href="'...
$row['bincomment'] = preg_replace('/<!-- ?mor...
$row['bincomment'] = preg_replace('/<!-- ?mor...
}
} else {
$permalink = '';
+ $read_more = '<span id="more"></span>';
+ $row['bincomment'] = preg_replace('/<!-- ?more ?-...
}
}}
終了行:
&tag(P_BLOG);
#contents
*負荷軽減 [#xb976343]
**Plug-in 読込み処理を1回だけに [#be0313e8]
include/func_base.inc.php
#geshi(PHP){{
function include_plugin($mode)
{
global $cd, $cfg, $plugin;
+ static $done;
+
+ if (isset($done)) return;
+
if ($handlerDir = @opendir($cd . '/include/user_inclu...
while ($filename = readdir($handlerDir)) {
if ($filename != '.' && $filename != '..' && ...
include_once $cd . '/include/user_include...
}
}
}
+
+ $done = true;
}
}}
**SQL へのアクセスを減らす [#e1b06084]
include/func_base.inc.php
#geshi(PHP){{
function db_connect()
{
global $dbname, $host, $user, $password;
+ static $link;
+
+ if (isset($link)) return $link;
+
$link = @mysql_connect($host, $user, $password);
if ($link && mysql_select_db($dbname)) {
return $link;
} else {
+ unset($link);
if (file_exists('./SETUP/')) {
$update_dir = '<p class="ref">Go to <a href="...
} else {
$update_dir = '<p>No SETUP directory found.</...
}
}}
#geshi(PHP){{
function init_config()
{
global $config_table, $cd;
+ static $cfg;
+
+ if (isset($cfg)) return $cfg;
+
$cfg = array();
$sql = 'SELECT * FROM `' . $config_table . '`';
$res = mysql_query($sql);
if ($res) {
while ($row = mysql_fetch_assoc($res)) {
$cfg[$row['config_key']] = $row['config_value...
}
} else {
+ unset($cfg);
if (file_exists('./SETUP/')) {
$update_dir = '<p class="ref">Go to <a href="...
} else {
$update_dir = '<p>No SETUP directory found.</...
}
}}
定量的な検証はしていないので、どの程度早くなるかは気持ち...
*「もっと読む」のリンク先を文書の続きに変更 [#hf0631aa]
include/func_logs.inc.php
#geshi(PHP){{
function display_article_box($row)
{
global $cfg, $lang, $cd, $session_status, $id, $admin...
// Permanent Link
if (empty($id)) {
$permalink = '<a href="'.$cd.'/article.php?id='.$...
$lang['permalink_title_1'] . htmlspe...
'" rel="Bookmark">Permalink</a> ';
- $read_more = '<p class="read-more"><a href="' . $...
+ $read_more = '<p class="read-more"><a href="' . $...
$row['comment'] = preg_replace('/<!-- ?more ?-->....
$row['comment'] = preg_replace('/<!-- ?more ?-->....
} else {
$permalink = '';
+ $read_more = '<span id="more"></span>';
+ $row['comment'] = preg_replace('/<!-- ?more ?-->/...
}
}}
files/include/func_files.inc.php
#geshi(PHP){{
function display_binary_box($row)
{
global $cfg, $lang, $cd, $session_status, $admin_dir,...
$bin_type = $row['bintype']; //Check file types
$bin_size = $row['binsize'] / 1024; // Convert "Byte"...
$bin_size = ceil($bin_size);
// Permanent Link
if (empty($_GET['id'])) {
$permalink = '<a href="' .$cd. '/files/article.p...
$lang['permalink_title_1'] . htmlsp...
'" rel="Bookmark" class="permalink"...
if (($_SERVER["SCRIPT_NAME"] != $cfg['root_path']...
($_SERVER["SCRIPT_NAME"] != $cfg['root_path']...
- $read_more = '<p class="read-more"><a href="'...
+ $read_more = '<p class="read-more"><a href="'...
$row['bincomment'] = preg_replace('/<!-- ?mor...
$row['bincomment'] = preg_replace('/<!-- ?mor...
}
} else {
$permalink = '';
+ $read_more = '<span id="more"></span>';
+ $row['bincomment'] = preg_replace('/<!-- ?more ?-...
}
}}
ページ名:
コンテンツ
Home
Softwares
Wiki
Forum
Files
About
Feedback
PageTree
Top
(101)
Mac
(2)
P_BLOG
(5)
PalmTips
(5)
Palmware
(5)
Palmware開発メモ
(25)
PukiWiki
(23)
webOS
(2)
開発メモ
(25)
Wiki検索
AND
OR
最新の10件
2023-02-08
PukiWiki
2014-07-28
PukiWiki/FastCGI版PHP対応
2014-03-12
FrontPage
はじめての XREA+
Palmware開発メモ
2014-03-07
Palmware
2012-12-06
オンラインストレージ
2012-07-29
Vagrant
2012-07-25
Android/SH-03C/sdboot
2012-07-18
webOS/TouchPad
Tags
Android
Mac
P_BLOG
Palm
Palmware
Phone
Program
PukiWiki
TouchPad
Web
webOS
Recommend
高性能レンタルサーバー
ポイントお貯めるなら
Syndication
RSS 1.0
RSS 2.0
Extra
0 pageview