Changeset 3120 for trunk/include


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/include
Files:
3 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
Note: See TracChangeset for help on using the changeset viewer.