Changeset 3120


Ignore:
Timestamp:
Feb 4, 2009, 3:30:48 AM (15 years ago)
Author:
rvelices
Message:

optimizations (php only)

  • removed unnecessary call to array_unique in get_image_ids_for_tags
  • put back in smarty exec time counting (debug mode) for each included template
  • prefix some smarty modifiers with @ in some templates
  • do not call format_date (still very slow due to mktime and date even after prev commit) from category_default.inc.php - if used in templates format_date can be used as a smarty modifier
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_default.inc.php

    r3049 r3120  
    107107  $tpl_var =
    108108    array(
    109       'ID'            => $row['id'],
    110       'TN_SRC'         => $thumbnail_url,
    111       'TN_ALT'     => $row['file'],
    112       'TN_TITLE'   => get_thumbnail_title($row),
    113       'ICON_TS'      => get_icon($row['date_available']),
    114       'URL'    => $url,
     109      'ID'        => $row['id'],
     110      'TN_SRC'    => $thumbnail_url,
     111      'TN_ALT'    => $row['file'],
     112      'TN_TITLE'  => get_thumbnail_title($row),
     113      'ICON_TS'   => get_icon($row['date_available']),
     114      'URL'       => $url,
    115115
    116116   /* Fields for template-extension usage */
    117117      'FILE_PATH' => $row['path'],
    118       'FILE_POSTED' => format_date($row['date_available'], 'mysql_datetime'),
    119       'FILE_CREATED' => (empty($row['date_creation'])) ?
    120         '-': format_date($row['date_creation'], 'mysql_date'),
    121       'FILE_DESC' => (empty($row['comment'])) ? '-' : $row['comment'],
    122       'FILE_AUTHOR' => (empty($row['author'])) ? '-' : $row['author'],
     118      'FILE_POSTED' => $row['date_available'],
     119      'FILE_CREATED' => $row['date_creation'],
     120      'FILE_DESC' => $row['comment'],
     121      'FILE_AUTHOR' => $row['author'],
    123122      'FILE_HIT' => $row['hit'],
    124       'FILE_SIZE' => (empty($row['filesize'])) ? '-' : $row['filesize'],
    125       'FILE_WIDTH' => (empty($row['width'])) ? '-' : $row['width'],
    126       'FILE_HEIGHT' => (empty($row['height'])) ? '-' : $row['height'],
    127       'FILE_METADATE' => (empty($row['date_metadata_update'])) ?
    128         '-': format_date($row['date_metadata_update'], 'mysql_date'),
    129       'FILE_RATE' => (empty($row['rate'])) ? '-' : $row['rate'],
    130       'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
     123      'FILE_SIZE' => $row['filesize'],
     124      'FILE_WIDTH' => $row['width'],
     125      'FILE_HEIGHT' => $row['height'],
     126      'FILE_METADATE' => $row['date_metadata_update'],
     127      'FILE_HAS_HD' => ($row['has_high'] and $user['enabled_high']=='true') ?
    131128                true:false, /* lack of include/functions_picture.inc.php */
    132129    );
  • trunk/include/functions_tag.inc.php

    r3049 r3120  
    190190        $items = array_intersect($items, $images);
    191191      }
    192 
    193       return array_unique($items);
     192      return $items;
    194193      break;
    195194    }
  • trunk/include/smarty/libs/Smarty.class.php

    r3000 r3120  
    2121 * For questions, help, comments, discussion, etc., please join the
    2222 * Smarty mailing list. Send a blank e-mail to
    23  * smarty-discussion-subscribe@googlegroups.com 
     23 * smarty-discussion-subscribe@googlegroups.com
    2424 *
    2525 * @link http://www.smarty.net/
     
    10581058            // var non-existant, return valid reference
    10591059            $_tmp = null;
    1060             return $_tmp;   
     1060            return $_tmp;
    10611061        }
    10621062    }
     
    11171117    {
    11181118        static $_cache_info = array();
    1119        
     1119
    11201120        $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
    11211121               ? $this->error_reporting : error_reporting() & ~E_NOTICE);
     
    13041304            return;
    13051305        } else {
     1306            if ($this->debugging) {
     1307                // capture time for debugging info
     1308                $_params = array();
     1309                require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
     1310                $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
     1311            }
    13061312            error_reporting($_smarty_old_error_level);
    13071313            if (isset($_smarty_results)) { return $_smarty_results; }
     
    19331939        return eval($code);
    19341940    }
    1935    
     1941
    19361942    /**
    19371943     * Extracts the filter name from the given callback
    1938      * 
     1944     *
    19391945     * @param callback $function
    19401946     * @return string
     
    19511957                }
    19521958        }
    1953    
     1959
    19541960    /**#@-*/
    19551961
  • trunk/template/yoga/header.tpl

    r3095 r3120  
    77{if isset($meta_ref) }
    88{if isset($INFO_AUTHOR)}
    9 <meta name="author" content="{$INFO_AUTHOR|replace:'"':' '}">
     9<meta name="author" content="{$INFO_AUTHOR|@replace:'"':' '}">
    1010{/if}
    1111{if isset($related_tags)}
     
    1313{/if}
    1414{if isset($COMMENT_IMG)}
    15 <meta name="description" content="{$COMMENT_IMG|strip_tags:false|replace:'"':' '}{if isset($INFO_FILE)} - {$INFO_FILE}{/if}">
     15<meta name="description" content="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}{if isset($INFO_FILE)} - {$INFO_FILE}{/if}">
    1616{else}
    1717<meta name="description" content="{$PAGE_TITLE}{if isset($INFO_FILE)} - {$INFO_FILE}{/if}">
  • trunk/template/yoga/mainpage_categories.tpl

    r3032 r3120  
    77                        <div class="illustration">
    88                        <a href="{$cat.URL}">
    9                                 <img src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" title="{$cat.NAME|replace:'"':' '} - {'hint_category'|@translate}">
     9                                <img src="{$cat.TN_SRC}" alt="{$cat.TN_ALT}" title="{$cat.NAME|@replace:'"':' '} - {'hint_category'|@translate}">
    1010                        </a>
    1111                        </div>
     
    1515                                        {$cat.ICON_TS}
    1616                                </h3>
    17         <div class="text">
    18                                 {if isset($cat.INFO_DATES) }
    19                                 <p class="dates">{$cat.INFO_DATES}</p>
    20                                 {/if}
    21                                 <p class="Nb_images">{$cat.CAPTION_NB_IMAGES}</p>
    22                                 {if not empty($cat.DESCRIPTION)}
    23                                 <p>{$cat.DESCRIPTION}</p>
    24                                 {/if}
    25         </div>
     17                <div class="text">
     18                                {if isset($cat.INFO_DATES) }
     19                                <p class="dates">{$cat.INFO_DATES}</p>
     20                                {/if}
     21                                <p class="Nb_images">{$cat.CAPTION_NB_IMAGES}</p>
     22                                {if not empty($cat.DESCRIPTION)}
     23                                <p>{$cat.DESCRIPTION}</p>
     24                                {/if}
     25                </div>
    2626                        </div>
    2727                </div>
  • trunk/template/yoga/picture_content.tpl

    r3041 r3120  
    55  <img src="{$SRC_IMG}" style="width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;" alt="{$ALT_IMG}"
    66        {if isset($COMMENT_IMG)}
    7                 title="{$COMMENT_IMG|strip_tags:false|replace:'"':' '}" {else} title="{$current.TITLE|replace:'"':' '} - {$ALT_IMG}"
     7                title="{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}" {else} title="{$current.TITLE|@replace:'"':' '} - {$ALT_IMG}"
    88        {/if}>
    99{if isset($high) }
Note: See TracChangeset for help on using the changeset viewer.