Changeset 2303
- Timestamp:
- 06/06/10 00:45:54 (13 years ago)
- Location:
- plugins/lastpostsExtend
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/lastpostsExtend/_define.php
r2143 r2303 17 17 /* Description*/ "Widget like lastposts with extended options", 18 18 /* Author */ "JC Denis", 19 /* Version */ '0. 8.2',19 /* Version */ '0.9', 20 20 /* Permissions */ 'admin' 21 21 ); 22 /* date */ #20100 32922 /* date */ #20100605 23 23 ?> -
plugins/lastpostsExtend/_widgets.php
r2143 r2303 20 20 { 21 21 global $core; 22 22 23 23 # Create widget 24 24 $w->create( … … 103 103 ); 104 104 # Tag 105 if ($core->plugins->moduleExists(' metadata'))105 if ($core->plugins->moduleExists('tags')) 106 106 { 107 107 $w->lastpostsextend->setting( … … 192 192 ); 193 193 } 194 194 195 195 public static function parseWidget($w) 196 196 { 197 197 global $core; 198 198 199 199 $params = array('sql' => '', 'columns' => array(), 'from' => ''); 200 200 201 201 # Home page only 202 202 if ($w->homeonly && $core->url->type != 'default') … … 268 268 } 269 269 # Tags 270 if ($core->plugins->moduleExists(' metadata') && $w->tag)270 if ($core->plugins->moduleExists('tags') && $w->tag) 271 271 { 272 272 $tags = explode(',',$w->tag); … … 277 277 $params['sql'] .= "AND META.meta_type = 'tag' "; 278 278 } 279 279 280 280 //$rs = self::getPosts($params); 281 281 $rs = $core->auth->sudo(array($core->blog,'getPosts'),$params,false); 282 282 283 283 # No result 284 284 if ($rs->isEmpty()) return; … … 293 293 '<'.($rs->post_status == 1 ? 'a href="'.$rs->getURL().'"' : 'span'). 294 294 ' title="'. 295 dt::dt2str($core->blog->settings-> date_format,$rs->post_upddt).', '.296 dt::dt2str($core->blog->settings-> time_format,$rs->post_upddt).'">'.295 dt::dt2str($core->blog->settings->system->date_format,$rs->post_upddt).', '. 296 dt::dt2str($core->blog->settings->system->time_format,$rs->post_upddt).'">'. 297 297 html::escapeHTML($rs->post_title). 298 298 '</'.($rs->post_status == 1 ? 'a' : 'span').'>'; … … 327 327 } 328 328 $res .= '</ul></div>'; 329 329 330 330 return $res; 331 331 } 332 332 333 333 private static function entryFirstImage($core,$type,$id,$size='s') 334 334 { 335 335 if (!in_array($type,array('post','page','galitem'))) return ''; 336 336 337 337 $rs = $core->auth->sudo(array($core->blog,'getPosts'),array('post_id'=>$id,'post_type'=>$type),false); 338 338 339 339 if ($rs->isEmpty()) return ''; 340 340 341 341 if (!preg_match('/^sq|t|s|m|o$/',$size)) 342 342 { 343 343 $size = 's'; 344 344 } 345 346 $p_url = $core->blog->settings-> public_url;345 346 $p_url = $core->blog->settings->system->public_url; 347 347 $p_site = preg_replace('#^(.+?//.+?)/(.*)$#','$1',$core->blog->url); 348 348 $p_root = $core->blog->public_path; 349 349 350 350 $pattern = '(?:'.preg_quote($p_site,'/').')?'.preg_quote($p_url,'/'); 351 351 $pattern = sprintf('/<img.+?src="%s(.*?\.(?:jpg|gif|png))"[^>]+/msu',$pattern); 352 352 353 353 $src = ''; 354 354 $alt = ''; 355 355 356 356 $subject = $rs->post_excerpt_xhtml.$rs->post_content_xhtml.$rs->cat_desc; 357 357 if (preg_match_all($pattern,$subject,$m) > 0) … … 371 371 } 372 372 if (!$src) return ''; 373 373 374 374 return 375 375 '<div class="img-box">'. … … 410 410 } 411 411 } 412 412 413 413 return $res ? $res : false; 414 414 } -
plugins/lastpostsExtend/release.txt
r2143 r2303 1 0.9 20100906 2 * Switched to DC 2.2 3 1 4 0.8.2 20100329 2 5 * Fixed getPosts by using sudo
Note: See TracChangeset
for help on using the changeset viewer.