Dotclear


Ignore:
Timestamp:
06/06/10 00:50:39 (13 years ago)
Author:
JcDenis
Message:

efiMetadatas 0.3

  • Switched to DC 2.2
File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/efiMetadatas/_widgets.php

    r1989 r2304  
    33# This file is part of efiMetadatas, a plugin for Dotclear 2. 
    44#  
    5 # Copyright (c) 2009 JC Denis and contributors 
     5# Copyright (c) 2009-2010 JC Denis and contributors 
    66# jcdenis@gdwd.com 
    77#  
     
    2020     { 
    2121          global $core; 
    22  
     22           
    2323          $categories_combo = array('-' => '', __('Uncategorized') => 'null'); 
    2424          $categories = $core->blog->getCategories(); 
     
    2828               $categories_combo[$cat_title] = $categories->cat_id; 
    2929          } 
    30  
     30           
    3131          $thumbnail_combo = array( 
    3232               '-' => '', 
     
    3636               __('medium') => 'm' 
    3737          ); 
    38  
     38           
    3939          $w->create('efim', 
    4040               __('Entry first image metadatas'),array('efiMetadatasWidget','publicEFIM') 
     
    5353          ); 
    5454     } 
    55  
     55      
    5656     public static function publicEFIM($w) 
    5757     { 
    5858          global $core, $_ctx;  
    59  
     59           
    6060          # Not in post context 
    6161          if (!$_ctx->exists('posts') || !$_ctx->posts->post_id) return; 
    62  
     62           
    6363          # Not supported post type 
    6464          if (!in_array($_ctx->posts->post_type,array('post','gal','galitem'))) return ''; 
    65  
     65           
    6666          # Category limit 
    6767          if ($w->category == 'null' && $_ctx->posts->cat_id !== null) return; 
    6868          if ($w->category != 'null' && $w->category != '' && $w->category != $_ctx->posts->cat_id) return; 
    69  
     69           
    7070          # Content lookup 
    7171          $text = $_ctx->posts->post_excerpt_xhtml.$_ctx->posts->post_content_xhtml; 
    72  
     72           
    7373          # Find source image 
    7474          $img = efiMetadatas::imgSource($core,$text,$w->thumbsize); 
    75  
     75           
    7676          # No image 
    7777          if (!$img['source']) return; 
    78  
     78           
    7979          # List metas 
    8080          $metas = efiMetadatas::imgMeta($core,$img['source']); 
    81  
     81           
    8282          $content = ''; 
    8383          foreach($metas as $k => $v) 
     
    8787               $content .= '<li class="efi-'.$k.'"><strong>'.$v[0].':</strong><br />'.$v[1].'</li>'; 
    8888          } 
    89  
     89           
    9090          # No meta 
    9191          if (empty($content)) return; 
    92  
     92           
    9393          # thumbnail 
    9494          if ($img['thumb']) 
     
    101101               "</div>\n"; 
    102102          } 
    103  
     103           
    104104          return  
    105105          '<div class="entryFirstImageMetas">'. 
Note: See TracChangeset for help on using the changeset viewer.

Sites map