Changeset 2304 for plugins/efiMetadatas/_widgets.php
- Timestamp:
- 06/06/10 00:50:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/efiMetadatas/_widgets.php
r1989 r2304 3 3 # This file is part of efiMetadatas, a plugin for Dotclear 2. 4 4 # 5 # Copyright (c) 2009 JC Denis and contributors5 # Copyright (c) 2009-2010 JC Denis and contributors 6 6 # jcdenis@gdwd.com 7 7 # … … 20 20 { 21 21 global $core; 22 22 23 23 $categories_combo = array('-' => '', __('Uncategorized') => 'null'); 24 24 $categories = $core->blog->getCategories(); … … 28 28 $categories_combo[$cat_title] = $categories->cat_id; 29 29 } 30 30 31 31 $thumbnail_combo = array( 32 32 '-' => '', … … 36 36 __('medium') => 'm' 37 37 ); 38 38 39 39 $w->create('efim', 40 40 __('Entry first image metadatas'),array('efiMetadatasWidget','publicEFIM') … … 53 53 ); 54 54 } 55 55 56 56 public static function publicEFIM($w) 57 57 { 58 58 global $core, $_ctx; 59 59 60 60 # Not in post context 61 61 if (!$_ctx->exists('posts') || !$_ctx->posts->post_id) return; 62 62 63 63 # Not supported post type 64 64 if (!in_array($_ctx->posts->post_type,array('post','gal','galitem'))) return ''; 65 65 66 66 # Category limit 67 67 if ($w->category == 'null' && $_ctx->posts->cat_id !== null) return; 68 68 if ($w->category != 'null' && $w->category != '' && $w->category != $_ctx->posts->cat_id) return; 69 69 70 70 # Content lookup 71 71 $text = $_ctx->posts->post_excerpt_xhtml.$_ctx->posts->post_content_xhtml; 72 72 73 73 # Find source image 74 74 $img = efiMetadatas::imgSource($core,$text,$w->thumbsize); 75 75 76 76 # No image 77 77 if (!$img['source']) return; 78 78 79 79 # List metas 80 80 $metas = efiMetadatas::imgMeta($core,$img['source']); 81 81 82 82 $content = ''; 83 83 foreach($metas as $k => $v) … … 87 87 $content .= '<li class="efi-'.$k.'"><strong>'.$v[0].':</strong><br />'.$v[1].'</li>'; 88 88 } 89 89 90 90 # No meta 91 91 if (empty($content)) return; 92 92 93 93 # thumbnail 94 94 if ($img['thumb']) … … 101 101 "</div>\n"; 102 102 } 103 103 104 104 return 105 105 '<div class="entryFirstImageMetas">'.
Note: See TracChangeset
for help on using the changeset viewer.