Ignore:
Timestamp:
Mar 26, 2015, 1:15:22 AM (9 years ago)
Author:
SergeD
Message:

version 1.2.23 - see changelog for details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/greydragon/themeconf.inc.php

    r31043 r31061  
    22/*
    33Theme Name: GreyDragon
    4 Version: 1.2.22
     4Version: 1.2.23
    55Description: GreyDragon Theme
    66Theme URI: http://piwigo.org/ext/extension_view.php?eid=775
     
    4848  $template->assign('greydragon', $themeCore->getConfig());
    4949
     50  $template->smarty->registerPlugin("modifier", "get_x_half", "greydragon_array_getXhalf");
     51  $template->smarty->registerPlugin("modifier", "get_y_half", "greydragon_array_getYhalf");
     52
    5053  // Allow dynamic addition of metadata tabs content
    5154  add_event_handler('loc_begin_picture', 'greydragon_picture_handler');
     55}
    5256
     57function greydragon_array_getXhalf($array) {
     58  if (isset($array) && (count($array) > 0)):
     59    return (int)($array[0] / 2);
     60  else:
     61    return "";
     62  endif;
    5363}
     64
     65function greydragon_array_getYhalf($array) {
     66  if (isset($array) && (count($array) > 1)):
     67    return (int)($array[1] / 2);
     68  else:
     69    return 1000;
     70  endif;
     71}
     72
    5473
    5574function greydragon_picture_handler() {
     
    6079
    6180function greydragon_prepare_meta($tpl_source, &$smarty) {
    62   // metadata array
    63   // each tab represented by respected sub array
    64   // sub array need to include
    65   //   "id"         = unique id of the tab
    66   //   "icon_class" = class to be used to render icon tabs
    67   //   "title"      = tab or menu block title
    68   //   "content"    = block content
    69   //   "target"     = optional, rendering target - "left", "top", "right", "bottom", not supported, reserved for future use
    70   //   "combine"    = combine_css or combine_js reference block
    71   //
    72   // prior to rendering, each element would be processed and converted into tab content in picture.tpl
    7381
    74   $metadata = array();
    75   $metadata = trigger_change('gd_get_metadata', $metadata);
    76 
    77   $meta_icon = "";
    78   $meta_text = "";
    79   $meta_content = "";
    80 
    81   foreach ($metadata as $item):
    82 
    83     $id            = $item["id"];
    84     $icon_class    = $item["icon_class"];
    85     $title         = $item["title"];
    86     $block_content = $item["content"];
    87     $combine       = $item["combine"];
    88     $no_overlay    = $item["no_overlay"];
    89 
    90     if ($no_overlay):
    91       $meta_icon .= '<li class="ico-btn btn-' . $id . '">' . $block_content . '</li>';
    92     else:
    93       $meta_icon .= '<li class="meta-' . $id . '{if $ico_mode=="on"} ' . $icon_class . '{/if}{if $def_tab == "' . $id . '"} active{/if}" >{if $ico_mode=="off"}' . $title . '{/if}</li>';
    94     endif;
    95 
    96     $meta_text .= '<li class="{if $ico_mode=="on"}' . $icon_class . '{/if}{if $def_tab == "' . $id . '"} active{/if}" rel="tab-' . $id . '">{if $ico_mode=="off"}' . $title . '{/if}</li>';
    97     if (isset($combine)):
    98       $meta_content .= '{strip}' . $combine . '{strip}';
    99     endif;
    100     $meta_content .= '<div id="tab-' . $id . '" class="image-metadata-tab">' . $block_content . '</div>';
    101   endforeach;
     82  $metadata = greyDragonCore::Instance()->getPageTabs();
    10283
    10384  $content  = $tpl_source;
    104   if ($meta_icon):
     85  if ($metadata["icon"]):
    10586    $pattern  = '#{\*GD_META_ICO\*}#';
    106     $replace  = $meta_icon . "{*GD_META_ICO*}";
     87    $replace  = $metadata["icon"] . "{*GD_META_ICO*}";
    10788    $content  = preg_replace($pattern, $replace, $content, 1);
    10889  endif;
    109   if ($meta_text):
     90  if ($metadata["text"]):
    11091    $pattern  = '#{\*GD_META_TXT\*}#';
    111     $replace  = $meta_text . "{*GD_META_TXT*}";
     92    $replace  = $metadata["text"] . "{*GD_META_TXT*}";
    11293    $content  = preg_replace($pattern, $replace, $content, 1);
    11394  endif;
    114   if ($meta_content):
     95  if ($metadata["content"]):
    11596    $pattern  = '#{\*GD_META_CONTENT\*}#';
    116     $replace  = $meta_content . "{*GD_META_CONTENT*}";
     97    $replace  = $metadata["content"] . "{*GD_META_CONTENT*}";
    11798    $content  = preg_replace($pattern, $replace, $content, 1);
    11899  endif;
     100
     101  $pattern  = '#<div.*"theImageAndInfos".*>#';
     102  $replace  = '$0
     103    {if isset($previous.U_IMG)}<a class="gd-nav nav-prev" title="{\'Previous\'|translate}" href="{$previous.U_IMG}">&nbsp;</a>{/if}
     104    {if isset($next.U_IMG)    }<a class="gd-nav nav-next" title="{\'Next\'|translate}" href="{$next.U_IMG}">&nbsp;</a>{/if}
     105    {if isset($U_UP)          }<a class="gd-nav nav-up"   title="{\'Up\'|translate}" href="{$U_UP}">&nbsp;</a>{/if}
     106{*    <a class="gd-nav nav-zoom" title="{\'Full HD\'|translate}" href="{$U_UP}">&nbsp;</a> *}
     107  {html_head}
     108    <style type="text/css">{strip}
     109      {if $current.selected_derivative}
     110      #theImageAndInfos .gd-nav.nav-prev {ldelim} margin-left: -{$current.selected_derivative->get_size()|get_x_half}px !important; top: {$current.selected_derivative->get_size()|get_y_half}px; {rdelim}
     111      #theImageAndInfos .gd-nav.nav-next {ldelim} margin-right: -{$current.selected_derivative->get_size()|get_x_half}px !important; top: {$current.selected_derivative->get_size()|get_y_half}px; {rdelim}
     112      {else}
     113      #theImageAndInfos .gd-nav.nav-prev {ldelim} margin-left: -30% !important; top: 50%; {rdelim}
     114      #theImageAndInfos .gd-nav.nav-next {ldelim} margin-right: -30% !important; top: 50%; {rdelim}
     115      {/if}
     116{*      #theImageAndInfos .gd-nav.nav-zoom {ldelim} top: {$current.selected_derivative->get_size()|get_y_half}px; {rdelim} *}
     117    {/strip}</style>
     118  {/html_head}';
     119
     120  $content  = preg_replace($pattern, $replace, $content, 1);
     121
    119122  return $content;
    120123}
Note: See TracChangeset for help on using the changeset viewer.