Changeset 851:0993f64c4809 for inc/public/lib.tpl.context.php
- Timestamp:
- 07/31/12 13:52:11 (13 years ago)
- Branch:
- sexy
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/lib.tpl.context.php
r839 r851 162 162 } 163 163 164 public static function categoryPostParam(&$p)165 {166 $not = substr($p['cat_url'],0,1) == '!';167 if ($not) {168 $p['cat_url'] = substr($p['cat_url'],1);169 }170 171 $p['cat_url'] = preg_split('/\s*,\s*/',$p['cat_url'],-1,PREG_SPLIT_NO_EMPTY);172 173 foreach ($p['cat_url'] as &$v)174 {175 if ($not) {176 $v .= ' ?not';177 }178 if ($GLOBALS['_ctx']->exists('categories') && preg_match('/#self/',$v)) {179 $v = preg_replace('/#self/',$GLOBALS['_ctx']->categories->cat_url,$v);180 } elseif ($GLOBALS['_ctx']->exists('posts') && preg_match('/#self/',$v)) {181 $v = preg_replace('/#self/',$GLOBALS['_ctx']->posts->cat_url,$v);182 }183 }184 }185 186 164 # Static methods for pagination 187 165 public static function PaginationNbPages() … … 341 319 342 320 # First post image helpers 343 public static function EntryFirstImageHelper($size,$ with_category,$class="")321 public static function EntryFirstImageHelper($size,$class="") 344 322 { 345 323 global $core, $_ctx; … … 378 356 } 379 357 380 # No src, look in category description if available381 if (!$src && $with_category && $_ctx->categories)382 {383 if (preg_match_all($pattern,$_ctx->categories->cat_desc,$m) > 0)384 {385 foreach ($m[1] as $i => $img) {386 if (($src = self::ContentFirstImageLookup($p_root,$img,$size)) !== false) {387 $src = $p_url.(dirname($img) != '/' ? dirname($img) : '').'/'.$src;388 if (preg_match('/alt="([^"]+)"/',$m[0][$i],$malt)) {389 $alt = $malt[1];390 }391 break;392 }393 }394 };395 }396 397 358 if ($src) { 398 359 return '<img alt="'.$alt.'" src="'.$src.'" class="'.$class.'" />';
Note: See TracChangeset
for help on using the changeset viewer.