diff options
author | rvelices <rv-github@modusoptimus.com> | 2008-10-10 13:11:31 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2008-10-10 13:11:31 +0000 |
commit | 0e5f5a74b31c0df471304ccfdb57cba7a26b9925 (patch) | |
tree | af9378dfae9636f42e0f05d105af20f8f3bcaafc | |
parent | 11df0cb50241fa098d492ce27e6b01b179f95f6b (diff) |
- replace a preg_match with simple comparison (faster)
- try to get rid of some JS strict warnings in FF (hope it's fixed)
- template.class.php is included from functions.inc.php instead of common,upgrade,install (maybe later I will try to see the perf impact of compacting/compiling functions.inc.php together with the included files from itself)
git-svn-id: http://piwigo.org/svn/trunk@2700 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/common.inc.php | 1 | ||||
-rw-r--r-- | include/functions.inc.php | 12 | ||||
-rw-r--r-- | install.php | 1 | ||||
-rw-r--r-- | template-common/scripts.js | 2 | ||||
-rw-r--r-- | template/yoga/picture_nav_buttons.tpl | 36 | ||||
-rw-r--r-- | upgrade.php | 1 |
6 files changed, 22 insertions, 31 deletions
diff --git a/include/common.inc.php b/include/common.inc.php index fe0e5a542..cbe1d6d89 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -137,7 +137,6 @@ include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); include(PHPWG_ROOT_PATH . 'include/constants.php'); include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); -include(PHPWG_ROOT_PATH . 'include/template.class.php'); // Database connection @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or my_error( 'mysql_connect', true ); diff --git a/include/functions.inc.php b/include/functions.inc.php index f2c5511dd..a75df8c4f 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -30,6 +30,7 @@ include_once( PHPWG_ROOT_PATH .'include/functions_html.inc.php' ); include_once( PHPWG_ROOT_PATH .'include/functions_tag.inc.php' ); include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' ); include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' ); +include_once( PHPWG_ROOT_PATH .'include/template.class.php'); //----------------------------------------------------------- generic functions @@ -69,7 +70,7 @@ function get_enums($table, $field) function get_boolean( $string ) { $boolean = true; - if ( preg_match( '/^false$/i', $string ) ) + if ( 'false' == strtolower($string) ) { $boolean = false; } @@ -86,14 +87,7 @@ function boolean_to_string($var) { if (is_bool($var)) { - if ($var) - { - return 'true'; - } - else - { - return 'false'; - } + return $var ? 'true' : 'false'; } else { diff --git a/install.php b/install.php index c83035522..f629fb06e 100644 --- a/install.php +++ b/install.php @@ -186,7 +186,6 @@ include(PHPWG_ROOT_PATH . 'include/constants.php'); include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions.php'); include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); -include(PHPWG_ROOT_PATH . 'include/template.class.php'); if (isset($_GET['language'])) { diff --git a/template-common/scripts.js b/template-common/scripts.js index 4e5ef822f..519786ab7 100644 --- a/template-common/scripts.js +++ b/template-common/scripts.js @@ -79,7 +79,7 @@ Function.prototype.pwgBind = function() { return function() { return __method.apply(object, args); } } -PwgWS = function(urlRoot) +function PwgWS(urlRoot) { this.urlRoot = urlRoot; this.options = { diff --git a/template/yoga/picture_nav_buttons.tpl b/template/yoga/picture_nav_buttons.tpl index aca9b10bd..f5a8aa914 100644 --- a/template/yoga/picture_nav_buttons.tpl +++ b/template/yoga/picture_nav_buttons.tpl @@ -62,42 +62,42 @@ </div> -<script type="text/javascript"> +<script type="text/javascript">// <![CDATA[ {literal} function keyboardNavigation(e) { - if(!e) var e=window.event; - if (e.altKey) return true; - var target = e.target || e.srcElement; - if (target && target.type) return true; //an input editable element - var keyCode=e.keyCode || e.which; - var docElem = document.documentElement; - switch(keyCode) { + if(!e) e=window.event; + if (e.altKey) return true; + var target = e.target || e.srcElement; + if (target && target.type) return true; //an input editable element + var keyCode=e.keyCode || e.which; + var docElem = document.documentElement; + switch(keyCode) { {/literal} {if isset($next)} - case 63235: case 39: if (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth ){ldelim}window.location="{$next.U_IMG}".replace( "&", "&" ); return false; } break; + case 63235: case 39: if (e.ctrlKey || docElem.scrollLeft==docElem.scrollWidth-docElem.clientWidth ){ldelim}window.location="{$next.U_IMG}".replace( "&", "&" ); return false; } break; {/if} {if isset($previous)} - case 63234: case 37: if (e.ctrlKey || docElem.scrollLeft==0){ldelim}window.location="{$previous.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; + case 63234: case 37: if (e.ctrlKey || docElem.scrollLeft==0){ldelim}window.location="{$previous.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; {/if} {if isset($first)} - /*Home*/case 36: if (e.ctrlKey){ldelim}window.location="{$first.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; + /*Home*/case 36: if (e.ctrlKey){ldelim}window.location="{$first.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; {/if} {if isset($last)} - /*End*/case 35: if (e.ctrlKey){ldelim}window.location="{$last.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; + /*End*/case 35: if (e.ctrlKey){ldelim}window.location="{$last.U_IMG|@escape:jasvascript}".replace("&","&"); return false; } break; {/if} {if isset($U_UP) and !isset($slideshow)} - /*Up*/case 38: if (e.ctrlKey){ldelim}window.location="{$U_UP|@escape:jasvascript}".replace("&","&"); return false; } break; + /*Up*/case 38: if (e.ctrlKey){ldelim}window.location="{$U_UP|@escape:jasvascript}".replace("&","&"); return false; } break; {/if} {if isset($slideshow.U_START_PLAY)} - /*Pause*/case 32: {ldelim}window.location="{$slideshow.U_START_PLAY|@escape:jasvascript}".replace("&","&"); return false; } break; + /*Pause*/case 32: {ldelim}window.location="{$slideshow.U_START_PLAY|@escape:jasvascript}".replace("&","&"); return false; } break; {/if} {if isset($slideshow.U_STOP_PLAY)} - /*Play*/case 32: {ldelim}window.location="{$slideshow.U_STOP_PLAY|@escape:jasvascript}".replace("&","&"); return false; } break; + /*Play*/case 32: {ldelim}window.location="{$slideshow.U_STOP_PLAY|@escape:jasvascript}".replace("&","&"); return false; } break; {/if} - } - return true; + } + return true; } document.onkeydown=keyboardNavigation; -</script> +// ]]></script> diff --git a/upgrade.php b/upgrade.php index 67cfce745..bf726cc6e 100644 --- a/upgrade.php +++ b/upgrade.php @@ -26,7 +26,6 @@ define('PHPWG_ROOT_PATH', './'); include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); -include(PHPWG_ROOT_PATH.'include/template.class.php'); include(PHPWG_ROOT_PATH.'include/mysql.inc.php'); include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); |