1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Moved harcoded texts to LAN files. Use "Images per page" pref instead of hardcoded amount.

This commit is contained in:
Lóna Lore 2016-03-29 14:17:29 +02:00
parent c54cc47832
commit 111454bb87
10 changed files with 663 additions and 409 deletions

View File

@ -14,18 +14,21 @@
* $Author: e107coders $
*/
// TODO: lan
// TODO: prefs for prettyPhoto library, e.g. theme settings
$eplug_admin = true;
require_once("../../class2.php");
if(!getperms("P") || !e107::isInstalled('gallery'))
{
e107::redirect('admin');
exit();
}
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_admin.php
e107::lan('gallery', true, true);
$e_sub_cat = 'gallery';
@ -55,40 +58,20 @@ class plugin_gallery_admin extends e_admin_dispatcher
)
);
/* Both are optional
protected $defaultMode = null;
protected $defaultAction = null;
*/
/**
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']);
* Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array
* @var array
*/
protected $adminMenu = array(
// 'main/list' => array('caption'=> LAN_CATEGORY, 'perm' => 'P'),
// 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
//'main/gallery' => array('caption'=> 'Info', 'perm' => 'P'),//, 'url'=>'{e_ADMIN}image.php'
'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P')
);
/**
* Optional, mode/action aliases, related with 'selected' menu CSS class
* Format: 'MODE/ACTION' => 'MODE ALIAS/ACTION ALIAS';
* This will mark active main/list menu item, when current page is main/edit
* @var array
*/
protected $adminMenuAliases = array(
/// 'main/edit' => 'main/list',
// 'cat/edit' => 'cat/list'
);
/**
* Navigation menu title
* @var string
*/
protected $menuTitle = 'Gallery';
protected $menuTitle = LAN_PLUGIN_GALLERY_TITLE;
function init()
{
@ -103,30 +86,106 @@ class plugin_gallery_admin extends e_admin_dispatcher
class gallery_cat_admin_ui extends e_admin_ui
{
protected $pluginTitle = 'Gallery Categories';
protected $pluginTitle = LAN_PLUGIN_GALLERY_TITLE;
protected $pluginName = 'gallery';
protected $table = "core_media_cat";
protected $pid = "media_cat_id";
protected $perPage = 10; //no limit
protected $perPage = 10; // No limit.
protected $listOrder = 'media_cat_order';
protected $listQry = "SELECT * FROM `#core_media_cat` WHERE media_cat_owner = 'gallery' "; // without any Order or Limit.
// protected $listQry = "SELECT * FROM #core_media "; // without any Order or Limit.
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
protected $listQry = "SELECT * FROM `#core_media_cat` WHERE media_cat_owner = 'gallery' "; // Without any Order or Limit.
protected $fields = array(
'checkboxes' => array('title' => '', 'type' => null, 'width' => '5%', 'forced' => true, 'thclass' => 'center', 'class' => 'center'),
// 'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE),
'media_cat_image' => array('title' => LAN_IMAGE, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class' => 'center', 'readParms' => 'thumb=60&thumb_urlraw=0&thumb_aw=60', 'readonly' => false, 'batch' => false, 'filter' => false),
'media_cat_owner' => array('title' => "Owner", 'type' => 'hidden', 'nolist' => true, 'width' => 'auto', 'thclass' => 'left', 'readonly' => false, 'writeParms' => 'value=gallery'),
'media_cat_category' => array('title' => LAN_CATEGORY, 'type' => 'hidden', 'nolist' => true, 'width' => 'auto', 'thclass' => 'left', 'readonly' => true),
'media_cat_title' => array('title' => LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly' => false),
'media_cat_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left'),
'media_cat_diz' => array('title' => LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1', 'readonly' => false), // Display name
'media_cat_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int', 'filter' => true, 'batch' => true),
'media_cat_order' => array('title' => LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center'),
'options' => array('title' => LAN_OPTIONS, 'type' => null, 'width' => '5%', 'forced' => true, 'thclass' => 'center last', 'class' => 'right')
'checkboxes' => array(
'title' => '',
'type' => null,
'width' => '5%',
'forced' => true,
'thclass' => 'center',
'class' => 'center',
),
/*
'media_cat_id' => array(
'title' => LAN_ID,
'type' => 'number',
'width' => '5%',
'forced' => true,
'readonly' => true,
),
*/
'media_cat_image' => array(
'title' => LAN_IMAGE,
'type' => 'image',
'data' => 'str',
'width' => '100px',
'thclass' => 'center',
'class' => 'center',
'readParms' => 'thumb=60&thumb_urlraw=0&thumb_aw=60',
'readonly' => false,
'batch' => false,
'filter' => false,
),
'media_cat_owner' => array(
'title' => LAN_OWNER,
'type' => 'hidden',
'nolist' => true,
'width' => 'auto',
'thclass' => 'left',
'readonly' => false,
'writeParms' => 'value=gallery',
),
'media_cat_category' => array(
'title' => LAN_CATEGORY,
'type' => 'hidden',
'nolist' => true,
'width' => 'auto',
'thclass' => 'left',
'readonly' => true,
),
'media_cat_title' => array(
'title' => LAN_TITLE,
'type' => 'text',
'width' => 'auto',
'thclass' => 'left',
'readonly' => false,
),
'media_cat_sef' => array(
'title' => LAN_SEFURL,
'type' => 'text',
'inline' => true,
'width' => 'auto',
'thclass' => 'left',
),
'media_cat_diz' => array(
'title' => LAN_DESCRIPTION,
'type' => 'bbarea',
'width' => '30%',
'readParms' => 'expand=...&truncate=150&bb=1',
'readonly' => false,
),
'media_cat_class' => array(
'title' => LAN_VISIBILITY,
'type' => 'userclass',
'width' => 'auto',
'data' => 'int',
'filter' => true,
'batch' => true,
),
'media_cat_order' => array(
'title' => LAN_ORDER,
'type' => 'text',
'width' => 'auto',
'thclass' => 'center',
'class' => 'center',
),
'options' => array(
'title' => LAN_OPTIONS,
'type' => null,
'width' => '5%',
'forced' => true,
'thclass' => 'center last',
'class' => 'right',
),
);
@ -141,45 +200,163 @@ class gallery_cat_admin_ui extends e_admin_ui
function galleryPage()
{
$mes = e107::getMessage();
$message = "<b>Gallery</b> is active. Simply import and assign images to the gallery categories using the <a href='" . e_ADMIN . "image.php'>Media Manager</a>";
$tp = e107::getParser();
$x = LAN_PLUGIN_GALLERY_TITLE;
$y = "<a href='" . e_ADMIN . "image.php'>" . LAN_MEDIAMANAGER . "</a>";
$message = $tp->lanVars(LAN_GALLERY_ADMIN_01, array($x, $y), true);
$mes->addInfo($message);
}
protected $preftabs = array('General', 'Slideshow Menu');
protected $preftabs = array(LAN_GALLERY_ADMIN_02, LAN_GALLERY_ADMIN_03);
protected $prefs = array(
'popup_w' => array('title' => 'Image Max. Width', 'tab' => 0, 'type' => 'text', 'data' => 'int', 'help' => 'Images will be auto-resized if greater than the width given here'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'popup_h' => array('title' => 'Image Max. Height', 'tab' => 0, 'type' => 'text', 'data' => 'int', 'help' => 'Images will be auto-resized if greater than the height given here'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'downloadable' => array('title' => 'Show "download" link', 'tab' => 0, 'type' => 'boolean', 'data' => 'int', 'help' => 'A download option will be shown next to the popup caption'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'slideshow_category' => array('title' => 'Slideshow category', 'tab' => 1, 'type' => 'dropdown', 'data' => 'str', 'help' => 'Images from this category will be used in the sliding menu.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
// 'slideshow_thumb_w' => array('title'=> 'Thumbnail Width', 'type' => 'number', 'data' => 'integer', 'help'=>'Width in px'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
// 'slideshow_thumb_h' => array('title'=> 'Thumbnail Height', 'type' => 'number', 'data' => 'integer', 'help'=>'Height in px'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
// 'slideshow_perslide' => array('title'=> 'Images per slide', 'type' => 'number', 'data' => 'integer', 'help'=>'Number of images to show per slide.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'slideshow_duration' => array('title' => 'Slide duration', 'type' => 'number', 'tab' => 1, 'data' => 'integer', 'help' => 'The duration (in seconds) of a full jump.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'slideshow_auto' => array('title' => 'Slide auto-start', 'type' => 'boolean', 'tab' => 1, 'data' => 'integer', 'help' => 'When enabled image-rotation begins automatically when the page is loaded.'),
'slideshow_freq' => array('title' => 'Slide frequency', 'type' => 'number', 'tab' => 1, 'data' => 'integer', 'help' => 'When auto-start is enabled, this dictates how long a slides stays put before the next jump. '), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
// 'slideshow_circular' => array('title'=> 'Slide circular-mode', 'type' => 'boolean', 'data' => 'integer', 'help'=>'By default when the first/last slide is reached, calling prev/next does nothing. If you want the effect to continue enable this option.'), //
'slideshow_effect' => array('title' => 'Slide effect', 'type' => 'dropdown', 'tab' => 1, 'data' => 'str', 'help' => 'Type of effect. '), //
// 'slideshow_transition' => array('title'=> 'Slide transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') //
'perpage' => array('title' => 'Images per page', 'tab' => 0, 'type' => 'number', 'data' => 'int', 'help' => 'Number of images to be shown per page'), // 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
'popup_w' => array(
'title' => LAN_GALLERY_ADMIN_04,
'tab' => 0,
'type' => 'text',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_05,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'popup_h' => array(
'title' => LAN_GALLERY_ADMIN_06,
'tab' => 0,
'type' => 'text',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_07,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'downloadable' => array(
'title' => LAN_GALLERY_ADMIN_08,
'tab' => 0,
'type' => 'boolean',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_09,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'slideshow_category' => array(
'title' => LAN_GALLERY_ADMIN_10,
'tab' => 1,
'type' => 'dropdown',
'data' => 'str',
'help' => LAN_GALLERY_ADMIN_11,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
/*
'slideshow_thumb_w' => array(
'title' => 'Thumbnail Width',
'type' => 'number',
'data' => 'integer',
'help' => 'Width in px',
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
*/
/*
'slideshow_thumb_h' => array(
'title' => 'Thumbnail Height',
'type' => 'number',
'data' => 'integer',
'help' => 'Height in px',
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
*/
/*
'slideshow_perslide' => array(
'title' => 'Images per slide',
'type' => 'number',
'data' => 'integer',
'help' => 'Number of images to show per slide.',
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
*/
'slideshow_duration' => array(
'title' => LAN_GALLERY_ADMIN_12,
'type' => 'number',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_13,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'slideshow_auto' => array(
'title' => LAN_GALLERY_ADMIN_14,
'type' => 'boolean',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_15,
),
'slideshow_freq' => array(
'title' => LAN_GALLERY_ADMIN_16,
'type' => 'number',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_17,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
/*
'slideshow_circular' => array(
'title' => 'Slide circular-mode',
'type' => 'boolean',
'data' => 'integer',
'help' => 'By default when the first/last slide is reached, calling prev/next does nothing. If you want the effect to continue enable this option.',
),
*/
'slideshow_effect' => array(
'title' => LAN_GALLERY_ADMIN_18,
'type' => 'dropdown',
'tab' => 1,
'data' => 'str',
'help' => LAN_GALLERY_ADMIN_19
),
/*
'slideshow_transition' => array(
'title' => 'Slide transition',
'type' => 'dropdown',
'data' => 'str',
'help' => 'Type of transition.',
),
*/
'perpage' => array(
'title' => LAN_GALLERY_ADMIN_20,
'tab' => 0,
'type' => 'number',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_21,
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'orderby' => array(
'title' => 'Order images by',
'title' => LAN_GALLERY_ADMIN_22,
'tab' => 0,
'type' => 'dropdown',
'data' => 'str',
'writeParms' => array(
'optArray' => array(
'media_id ASC' => 'Media ID ASC',
'media_id DESC' => 'Media ID DESC',
'media_name ASC' => 'Media Name ASC',
'media_name DESC' => 'Media Name DESC',
'media_caption ASC' => 'Media Caption ASC',
'media_caption DESC' => 'Media Caption DESC',
'media_id ASC' => LAN_GALLERY_ADMIN_23,
'media_id DESC' => LAN_GALLERY_ADMIN_24,
'media_name ASC' => LAN_GALLERY_ADMIN_25,
'media_name DESC' => LAN_GALLERY_ADMIN_26,
'media_caption ASC' => LAN_GALLERY_ADMIN_27,
'media_caption DESC' => LAN_GALLERY_ADMIN_28,
),
),
),
@ -189,20 +366,14 @@ class gallery_cat_admin_ui extends e_admin_ui
function init()
{
$effects = array(
'scrollHorz' => 'slide left',
'scrollVert' => 'slide down',
// 'turnDown' => 'turn Down',
// 'turnUp' => 'turn Up',
// 'curtainX' => 'curtainX',
// 'curtainY' => 'curtainY',
'fade' => 'fade',
// 'zoom' => 'zoom'
'scrollHorz' => LAN_GALLERY_ADMIN_29,
'scrollVert' => LAN_GALLERY_ADMIN_30,
'fade' => LAN_GALLERY_ADMIN_31,
);
$this->prefs['slideshow_effect']['writeParms'] = $effects;
$this->prefs['slideshow_effect']['readParms'] = $effects;
//
// $transitions = array('sinoidal'=>'sinoidal','spring'=>'spring');
// $this->prefs['slideshow_transition']['writeParms'] = $transitions;
@ -220,20 +391,22 @@ class gallery_cat_admin_ui extends e_admin_ui
$this->prefs['slideshow_category']['readParms'] = $cats;
$mes = e107::getMessage();
$message = "<b>Gallery</b> is active. Simply import and assign images to the gallery categories using the <a href='" . e_ADMIN . "image.php'>Media Manager</a>";
$tp = e107::getParser();
$x = LAN_PLUGIN_GALLERY_TITLE;
$y = "<a href='" . e_ADMIN . "image.php'>" . LAN_MEDIAMANAGER . "</a>";
$message = $tp->lanVars(LAN_GALLERY_ADMIN_01, array($x, $y), true);
$mes->addInfo($message);
}
}
class gallery_cat_admin_form_ui extends e_admin_form_ui
{
// Override the default Options field.
// Override the default Options field.
public function gallery_category_parent($curVal, $mode)
{
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter

View File

@ -16,33 +16,32 @@
/**
*
* @package e107
* @subpackage frontend
* @subpackage frontend
* @version $Id$
* Ultra-simple Image-Gallery
* Ultra-simple Image-Gallery
*/
/*
* THIS SCRIPT IS HIGHLY EXPERIMENTAL. USE AT OWN RISK.
*
*/
/*
* THIS SCRIPT IS HIGHLY EXPERIMENTAL. USE AT OWN RISK.
*
*/
class plugin_gallery_index_controller extends eControllerFront
{
/**
* Plugin name - used to check if plugin is installed
* Set this only if plugin requires installation
* @var string
*/
protected $plugin = 'gallery';
/**
* Default controller access
* @var integer
*/
protected $userclass = e_UC_PUBLIC;
/**
* User input filter
* Format 'action' => array(var => validationArray)
@ -52,17 +51,17 @@ class plugin_gallery_index_controller extends eControllerFront
'category' => array(
'cat' => array('regex', '/[\w\pL\s\-+.,]+/u'),
),
'list' => array(
'list' => array(
'cat' => array('regex', '/[\w\pL\s\-+.,]+/u'),
'frm' => array('int'),
),
);
/**
* @var array
*/
protected $catList;
public function init()
{
e107::plugLan('gallery', 'front');
@ -73,7 +72,7 @@ class plugin_gallery_index_controller extends eControllerFront
$this->catList = e107::getMedia()->getCategories('gallery');
}
public function actionIndex()
{
if(isset($_GET['cat']) && !empty($_GET['cat']))
@ -82,59 +81,61 @@ class plugin_gallery_index_controller extends eControllerFront
}
else
{
$this->_forward('category');
$this->_forward('category');
}
}
public function actionCategory()
{
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery',TRUE);
$text = "";
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true);
$text = "";
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
{
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
}
$text = e107::getParser()->parseTemplate($template['cat_start'],TRUE, $sc);
$text = e107::getParser()->parseTemplate($template['cat_start'], true, $sc);
foreach($this->catList as $val)
{
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['cat_item'],TRUE);
}
$text .= e107::getParser()->parseTemplate($template['cat_end'],TRUE, $sc);
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['cat_item'], true);
}
$text .= e107::getParser()->parseTemplate($template['cat_end'], true, $sc);
if(isset($template['cat_caption']))
{
$title = e107::getParser()->parseTemplate($template['cat_caption'],TRUE, $sc);
$title = e107::getParser()->parseTemplate($template['cat_caption'], true, $sc);
$this->addTitle($title)->addBody($text);
}
else
else
{
$this->addTitle(LAN_PLUGIN_GALLERY_TITLE)->addBody($text);
}
}
public function actionList()
{
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$request = $this->getRequest();
// use only filtered variables
$cid = $request->getRequestParam('cat');
if($cid && !isset($this->catList[$cid]))
{
// get ID by SEF
$_cid = null;
foreach ($this->catList as $id => $row)
foreach($this->catList as $id => $row)
{
if($cid === $row['media_cat_sef'])
{
@ -144,62 +145,60 @@ class plugin_gallery_index_controller extends eControllerFront
}
$cid = $_cid;
}
if(empty($cid) || !isset($this->catList[$cid]))
{
$this->_forward('category');
return;
}
$tp = e107::getParser();
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery',TRUE);
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
$tp = e107::getParser();
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true);
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
{
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
}
$sc->total = e107::getMedia()->countImages($cid);
$sc->amount = e107::getPlugPref('gallery','perpage', 12); // TODO Add Pref. amount per page.
$sc->total = e107::getMedia()->countImages($cid);
$sc->amount = varset($plugPrefs['perpage'], 12);
$sc->curCat = $cid;
$sc->from = $request->getRequestParam('frm', 0);
$sc->from = $request->getRequestParam('frm', 0);
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$list = e107::getMedia()->getImages($cid,$sc->from,$sc->amount,null,$orderBy);
$catname = $tp->toHtml($this->catList[$cid]['media_cat_title'],false,'defs');
$list = e107::getMedia()->getImages($cid, $sc->from, $sc->amount, null, $orderBy);
$catname = $tp->toHtml($this->catList[$cid]['media_cat_title'], false, 'defs');
$cat = $this->catList[$cid];
$inner = "";
$inner = "";
foreach($list as $row)
{
$sc->setVars($row)
->addVars($cat);
->addVars($cat);
$inner .= $tp->parseTemplate($template['list_item'],TRUE, $sc);
$inner .= $tp->parseTemplate($template['list_item'], true, $sc);
}
$text = $tp->parseTemplate($template['list_start'],TRUE, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['list_end'],TRUE, $sc);
$text = $tp->parseTemplate($template['list_start'], true, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['list_end'], true, $sc);
if(isset($template['list_caption']))
{
$title = $tp->parseTemplate($template['list_caption'],TRUE, $sc);
$title = $tp->parseTemplate($template['list_caption'], true, $sc);
$this->addTitle($title)->addBody($text);
}
else
{
$this->addTitle($catname)
->addTitle(LAN_PLUGIN_GALLERY_TITLE)
->addBody($text);
->addTitle(LAN_PLUGIN_GALLERY_TITLE)
->addBody($text);
}
}
}

View File

@ -6,63 +6,70 @@
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
*/
if (!defined('e107_INIT')) { exit; }
if(!defined('e107_INIT'))
{
exit;
}
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_front.php
e107::lan('gallery', false, true);
class gallery_shortcodes extends e_shortcode
{
public $total = 0;
public $amount = 3;
public $from = 0;
public $curCat = null;
public $sliderCat = 1;
public $slideMode = FALSE;
public $slideCount = 1;
private $downloadable = FALSE;
private $attFull = null;
public $total = 0;
public $amount = 3;
public $from = 0;
public $curCat = null;
public $sliderCat = 1;
public $slideMode = false;
public $slideCount = 1;
private $downloadable = false;
private $attFull = null;
function init()
{
$this->downloadable = e107::getPlugPref('gallery','downloadable');
$prefW = e107::getPlugPref('gallery','pop_w');
$prefH = e107::getPlugPref('gallery','pop_h');
$pop_w = vartrue($prefW, 1024);
$pop_h = vartrue($prefH, 768);
$this->attFull = array('w'=>$pop_w, 'h'=>$pop_h, 'x'=>1, 'crop'=>0); // 'w='.$pop_w.'&h='.$pop_h.'&x=1';
$this->downloadable = e107::getPlugPref('gallery', 'downloadable');
$prefW = e107::getPlugPref('gallery', 'pop_w');
$prefH = e107::getPlugPref('gallery', 'pop_h');
$pop_w = vartrue($prefW, 1024);
$pop_h = vartrue($prefH, 768);
$this->attFull = array('w' => $pop_w, 'h' => $pop_h, 'x' => 1, 'crop' => 0); // 'w='.$pop_w.'&h='.$pop_h.'&x=1';
e107::library('load', 'jquery.prettyPhoto');
e107::js('gallery', 'js/gallery.js');
}
function sc_gallery_caption($parm='')
function sc_gallery_caption($parm = '')
{
$tp = e107::getParser();
$text = "<a class='gallery-caption' title='".$tp->toAttribute($this->var['media_caption'])."' href='".$tp->thumbUrl($this->var['media_url'], $this->attFull)."' data-gal='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]"
$text = "<a class='gallery-caption' title='" . $tp->toAttribute($this->var['media_caption']) . "' href='" . $tp->thumbUrl($this->var['media_url'], $this->attFull) . "' data-gal='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]"
$text .= $this->var['media_caption'];
$text .= "</a>";
return $text;
}
function sc_gallery_description($parm='')
function sc_gallery_description($parm = '')
{
$tp = e107::getParser();
return $tp->toHTML($this->var['media_description'], true, 'BODY');
}
function sc_gallery_breadcrumb($parm='')
function sc_gallery_breadcrumb($parm = '')
{
$breadcrumb = array();
$breadcrumb[] = array('text'=> LAN_PLUGIN_GALLERY_TITLE, 'url'=> e107::getUrl()->create('gallery', $this->var));
$breadcrumb[] = array('text' => LAN_PLUGIN_GALLERY_TITLE, 'url' => e107::getUrl()->create('gallery', $this->var));
if(vartrue($this->curCat))
{
$breadcrumb[] = array('text'=> $this->sc_gallery_cat_title('title'), 'url'=> e107::getUrl()->create('gallery/index/list', $this->var));
$breadcrumb[] = array('text' => $this->sc_gallery_cat_title('title'), 'url' => e107::getUrl()->create('gallery/index/list', $this->var));
}
return e107::getForm()->breadcrumb($breadcrumb);
}
/**
* All possible parameters
* {GALLERY_THUMB=w=200&h=200&thumburl&thumbsrc&imageurl&orig}
@ -72,153 +79,167 @@ class gallery_shortcodes extends e_shortcode
* imageurl - full path to the destination image (no proxy)
* actualPreview - large preview will use the original path to the image (no proxy)
*/
function sc_gallery_thumb($parm='')
function sc_gallery_thumb($parm = '')
{
$tp = e107::getParser();
$parms = eHelper::scParams($parm);
$w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160;
$h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight(); // 130;
$class = ($this->slideMode == TRUE) ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'],'gallery-thumb img-responsive');
// $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery';
$rel = ($this->slideMode == TRUE) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]';
$tp = e107::getParser();
$parms = eHelper::scParams($parm);
$w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160;
$h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight(); // 130;
$class = ($this->slideMode == true) ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'], 'gallery-thumb img-responsive');
// $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery';
$rel = ($this->slideMode == true) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]';
//$att = array('aw'=>$w, 'ah'=>$h, 'x'=>1, 'crop'=>1);
$caption = $tp->toAttribute($this->var['media_caption']) ;
$att = array('w'=>$w, 'h'=>$h, 'class'=>$class, 'alt'=>$caption, 'x'=>1, 'crop'=>1);
$caption = $tp->toAttribute($this->var['media_caption']);
$att = array('w' => $w, 'h' => $h, 'class' => $class, 'alt' => $caption, 'x' => 1, 'crop' => 1);
$srcFull = $tp->thumbUrl($this->var['media_url'], $this->attFull);
if(vartrue($parms['actualPreview']))
if(vartrue($parms['actualPreview']))
{
$srcFull = $tp->replaceConstants($this->var['media_url'], 'full');
}
if(isset($parms['thumburl'])) return $srcFull;
elseif(isset($parms['thumbsrc'])) return $tp->thumbUrl($this->var['media_url'],$att);
elseif(isset($parms['imageurl'])) return $tp->replaceConstants($this->var['media_url'], 'full');
$description = ($this->downloadable) ? " <a class='btn btn-xs btn-default btn-mini e-tip' title='Right-click > Save Link As' href='".$srcFull."'>Download</a>" : "";
if(isset($parms['thumburl']))
{
return $srcFull;
}
elseif(isset($parms['thumbsrc']))
{
return $tp->thumbUrl($this->var['media_url'], $att);
}
elseif(isset($parms['imageurl']))
{
return $tp->replaceConstants($this->var['media_url'], 'full');
}
$description = ($this->downloadable) ? " <a class='btn btn-xs btn-default btn-mini e-tip' title='" . LAN_GALLERY_FRONT_01 . "' href='" . $srcFull . "'>" . LAN_DOWNLOAD . "</a>" : "";
$description .= $tp->toAttribute($this->var['media_description']);
$text = "<a class='".$class."' title=\"".$description."\" href='".$srcFull."' data-gal='{$rel}' >";
$text .= $tp->toImage($this->var['media_url'],$att);
$text = "<a class='" . $class . "' title=\"" . $description . "\" href='" . $srcFull . "' data-gal='{$rel}' >";
$text .= $tp->toImage($this->var['media_url'], $att);
$text .= "</a>";
return $text;
return $text;
}
function sc_gallery_cat_title($parm='')
function sc_gallery_cat_title($parm = '')
{
$tp = e107::getParser();
$url = e107::getUrl()->create('gallery/index/list', $this->var);
if($parm == 'title') return $tp->toHtml($this->var['media_cat_title'], false, 'TITLE');
$text = "<a href='".$url."'>";
$url = e107::getUrl()->create('gallery/index/list', $this->var);
if($parm == 'title')
{
return $tp->toHtml($this->var['media_cat_title'], false, 'TITLE');
}
$text = "<a href='" . $url . "'>";
$text .= $tp->toHtml($this->var['media_cat_title'], false, 'TITLE');
$text .= "</a>";
return $text;
return $text;
}
function sc_gallery_cat_url($parm='')
function sc_gallery_cat_url($parm = '')
{
return e107::getUrl()->create('gallery/index/list', $this->var);
return e107::getUrl()->create('gallery/index/list', $this->var);
}
function sc_gallery_cat_description($parm='')
function sc_gallery_cat_description($parm = '')
{
$tp = e107::getParser();
return $tp->toHTML($this->var['media_cat_diz'], true, 'BODY');
}
function sc_gallery_baseurl()
{
return e107::getUrl()->create('gallery');
return e107::getUrl()->create('gallery');
}
function sc_gallery_cat_thumb($parm='')
function sc_gallery_cat_thumb($parm = '')
{
$parms = eHelper::scParams($parm);
$w = vartrue($parms['w']) ? $parms['w'] : 300; // 260;
$h = vartrue($parms['h']) ? $parms['h'] : 200; // 180;
$att = 'aw='.$w.'&ah='.$h.'&x=1'; // 'aw=190&ah=150';
$w = vartrue($parms['w']) ? $parms['w'] : 300; // 260;
$h = vartrue($parms['h']) ? $parms['h'] : 200; // 180;
$att = 'aw=' . $w . '&ah=' . $h . '&x=1'; // 'aw=190&ah=150';
$url = e107::getUrl()->create('gallery/index/list', $this->var);
if(isset($parms['thumbsrc'])) return e107::getParser()->thumbUrl($this->var['media_cat_image'],$att);
$text = "<a class='thumbnail' href='".$url."'>";
$text .= "<img class='img-responsive' data-src='holder.js/".$w."x".$h."' src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
if(isset($parms['thumbsrc']))
{
return e107::getParser()->thumbUrl($this->var['media_cat_image'], $att);
}
$text = "<a class='thumbnail' href='" . $url . "'>";
$text .= "<img class='img-responsive' data-src='holder.js/" . $w . "x" . $h . "' src='" . e107::getParser()->thumbUrl($this->var['media_cat_image'], $att) . "' alt='' />";
$text .= "</a>";
return $text;
return $text;
}
function sc_gallery_nextprev($parm='')
function sc_gallery_nextprev($parm = '')
{
// we passs both fields, the router will convert one of them to 'cat' variable, based on the current URL config
$url = 'route::gallery/index/list?media_cat_category='.$this->curCat.'--AMP--media_cat_sef='.$this->var['media_cat_sef'].'--AMP--frm=--FROM--::full=1';
$parm = 'total='.$this->total.'&amount='.$this->amount.'&current='.$this->from.'&url='.rawurlencode($url); // .'&url='.$url;
$text = e107::getParser()->parseTemplate("{NEXTPREV=".$parm."}");
return $text;
$url = 'route::gallery/index/list?media_cat_category=' . $this->curCat . '--AMP--media_cat_sef=' . $this->var['media_cat_sef'] . '--AMP--frm=--FROM--::full=1';
$parm = 'total=' . $this->total . '&amount=' . $this->amount . '&current=' . $this->from . '&url=' . rawurlencode($url); // .'&url='.$url;
$text = e107::getParser()->parseTemplate("{NEXTPREV=" . $parm . "}");
return $text;
}
function sc_gallery_slideshow($parm='')
{
$this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery','slideshow_category'),1);
$tmpl = e107::getTemplate('gallery','gallery');
function sc_gallery_slideshow($parm = '')
{
$this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1);
$tmpl = e107::getTemplate('gallery', 'gallery');
$template = array_change_key_case($tmpl);
return e107::getParser()->parseTemplate($template['slideshow_wrapper']);
}
/**
* Display a Grid of thumbnails - useful for home pages.
* Amount per row differs according to device, so they are not set here, only the amount.
* Display a Grid of thumbnails - useful for home pages.
* Amount per row differs according to device, so they are not set here, only the amount.
* @example {GALLERY_PORTFOLIO: placeholder=1&category=2}
*/
function sc_gallery_portfolio($parms='')
function sc_gallery_portfolio($parms = '')
{
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$ns = e107::getRender();
$parm = eHelper::scParams($parms);
$cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1); //TODO Separate pref?
$ns = e107::getRender();
$parm = eHelper::scParams($parms);
$cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery','slideshow_category'), 1); //TODO Separate pref?
$tmpl = e107::getTemplate('gallery', 'gallery');
$limit = vartrue($parm['limit'], 6);
$tmpl = e107::getTemplate('gallery','gallery');
$limit = vartrue($parm['limit'], 6);
$list = e107::getMedia()->getImages('gallery_image|gallery_'.$cat.'|gallery_image_'.$cat, 0, $limit, null, $orderBy);
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$list = e107::getMedia()->getImages('gallery_image|gallery_' . $cat . '|gallery_image_' . $cat, 0, $limit, null, $orderBy);
if(count($list) < 1 && vartrue($parm['placeholder']))
{
$list = array();
for ($i=0; $i < $limit; $i++)
for($i = 0; $i < $limit; $i++)
{
$list[] = array('media_url'=>'');
}
$list[] = array('media_url' => '');
}
}
//NOTE: Using tablerender() allows the theme developer to set the number of columns etc using col-xx-xx
$text = '';
foreach($list as $val)
{
$this->var = $val;
$text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'),'gallery_portfolio',true);
$text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'), 'gallery_portfolio', true);
}
return $text;
}
/**
* All possible parameters
* {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM}
@ -228,43 +249,43 @@ class gallery_shortcodes extends e_shortcode
*/
function sc_gallery_slides($parm)
{
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$tp = e107::getParser();
$this->slideMode = TRUE;
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (integer) vartrue($parms['limit'], 16);
$list = e107::getMedia()->getImages('gallery_image|gallery_'.$this->sliderCat.'|gallery_image_'.$this->sliderCat,0,$limit,null,$orderBy);
$tmpl = e107::getTemplate('gallery','gallery');
$tmpl = array_change_key_case($tmpl); // change template key to lowercase (BC fix)
$tmpl_key = vartrue($parms['template'],'slideshow_slide_item');
$item_template = $tmpl[$tmpl_key]; // e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
$catList = e107::getMedia()->getCategories('gallery');
$cat = $catList['gallery_'.$this->sliderCat];
$tp = e107::getParser();
$this->slideMode = true;
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (integer) vartrue($parms['limit'], 16);
$list = e107::getMedia()->getImages('gallery_image|gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit, null, $orderBy);
$tmpl = e107::getTemplate('gallery', 'gallery');
$tmpl = array_change_key_case($tmpl); // change template key to lowercase (BC fix)
$tmpl_key = vartrue($parms['template'], 'slideshow_slide_item');
$item_template = $tmpl[$tmpl_key]; // e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
$catList = e107::getMedia()->getCategories('gallery');
$cat = $catList['gallery_' . $this->sliderCat];
$count = 1;
$inner = '';
foreach($list as $row)
{
$this->setVars($row)
->addVars($cat);
$inner .= ($count == 1) ? "\n\n<!-- SLIDE ".$count." -->\n<div class='slide' id='gallery-item-".$this->slideCount."'>\n" : "";
$inner .= "\n\t".$tp->parseTemplate($item_template,TRUE)."\n";
->addVars($cat);
$inner .= ($count == 1) ? "\n\n<!-- SLIDE " . $count . " -->\n<div class='slide' id='gallery-item-" . $this->slideCount . "'>\n" : "";
$inner .= "\n\t" . $tp->parseTemplate($item_template, true) . "\n";
$inner .= ($count == $amount) ? "\n</div>\n\n" : "";
if($count == $amount)
{
$count = 1;
$count = 1;
$this->slideCount++;
}
else
{
$count++;
}
}
}
$inner .= ($count != 1) ? "</div><!-- END SLIDES -->" : "";
@ -272,21 +293,22 @@ class gallery_shortcodes extends e_shortcode
}
function sc_gallery_jumper($parm)
{
// echo "SlideCount=".$this->slideCount;
if($this->slideCount ==1 && deftrue('E107_DBG_BASIC')){ return "gallery-jumper must be loaded after Gallery-Slides"; }
$text = '';
for($i=1; $i < ($this->slideCount); $i++)
// echo "SlideCount=".$this->slideCount;
if($this->slideCount == 1 && deftrue('E107_DBG_BASIC'))
{
$val = ($parm == 'space') ? "&nbsp;" : $i;
$text .= '<a href="#" class="gallery-slide-jumper" id="gallery-jumper-'.$i.'">'.$val.'</a>';
return "gallery-jumper must be loaded after Gallery-Slides";
}
return $text;
$text = '';
for($i = 1; $i < ($this->slideCount); $i++)
{
$val = ($parm == 'space') ? "&nbsp;" : $i;
$text .= '<a href="#" class="gallery-slide-jumper" id="gallery-jumper-' . $i . '">' . $val . '</a>';
}
return $text;
}
}
?>

View File

@ -16,19 +16,22 @@
/**
*
* @package e107
* @subpackage frontend
* @subpackage frontend
* @version $Id: cron.php 12492 2011-12-30 16:09:10Z e107steved $
* Ultra-simple Image-Gallery
* Ultra-simple Image-Gallery
*/
require_once("../../class2.php");
if (!e107::isInstalled('gallery'))
if(!e107::isInstalled('gallery'))
{
e107::redirect();
exit;
}
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_front.php
e107::lan('gallery', false, true);
e107::library('load', 'jquery.prettyPhoto');
e107::css('gallery', 'css/gallery.css');
e107::js('gallery', 'js/gallery.js');
@ -38,90 +41,90 @@ require_once(HEADERF);
class gallery
{
private $catList = array();
function __construct()
{
$this->catList = e107::getMedia()->getCategories('gallery');
if((vartrue($_GET['cat'])) && isset($this->catList[$_GET['cat']]))
{
$this->showImages($_GET['cat']);
$this->showImages($_GET['cat']);
}
else
{
$this->listCategories();
$this->listCategories();
}
}
function listCategories()
{
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery',TRUE);
$text = "";
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true);
$text = "";
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootstrap3 to bootstrap2 compat.
{
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
}
$text = e107::getParser()->parseTemplate($template['cat_start'],TRUE, $sc);
$text = e107::getParser()->parseTemplate($template['cat_start'], true, $sc);
foreach($this->catList as $val)
{
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['cat_item'],TRUE, $sc);
}
$text .= e107::getParser()->parseTemplate($template['cat_end'],TRUE, $sc);
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['cat_item'], true, $sc);
}
$text .= e107::getParser()->parseTemplate($template['cat_end'], true, $sc);
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $text);
}
function showImages($cat)
{
$mes = e107::getMessage();
$tp = e107::getParser();
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery',TRUE);
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$mes = e107::getMessage();
$tp = e107::getParser();
$template = e107::getTemplate('gallery');
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true);
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
{
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
}
$sc->total = e107::getMedia()->countImages($cat);
$sc->amount = 12; // TODO Add Pref. amount per page.
$sc->total = e107::getMedia()->countImages($cat);
$sc->amount = varset($plugPrefs['perpage'], 12);
$sc->curCat = $cat;
$sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0;
$sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0;
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount, null, $orderBy);
$catname = $tp->toHtml($this->catList[$cat]['media_cat_title'], false, 'defs');
$inner = "";
$list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount, null, $orderBy);
$catname = $tp->toHtml($this->catList[$cat]['media_cat_title'],false,'defs');
$inner = "";
foreach($list as $row)
{
$sc->setVars($row);
$inner .= $tp->parseTemplate($template['list_item'],TRUE, $sc);
$sc->setVars($row);
$inner .= $tp->parseTemplate($template['list_item'], true, $sc);
}
$text = $tp->parseTemplate($template['list_start'],TRUE, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['list_end'],TRUE, $sc);
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render().$text);
$text = $tp->parseTemplate($template['list_start'], true, $sc);
$text .= $inner;
$text .= $tp->parseTemplate($template['list_end'], true, $sc);
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render() . $text);
}
}
@ -129,6 +132,3 @@ new gallery;
require_once(FOOTERF);
exit;
?>

View File

@ -0,0 +1,38 @@
<?php
/**
* @file
* Language file for "gallery" plugin.
*/
define("LAN_GALLERY_ADMIN_01", "[x] is active. Simply import and assign images to the gallery categories using the [y]");
define("LAN_GALLERY_ADMIN_02", "General");
define("LAN_GALLERY_ADMIN_03", "Slideshow Menu");
define("LAN_GALLERY_ADMIN_04", "Image Max. Width");
define("LAN_GALLERY_ADMIN_05", "Images will be auto-resized if greater than the width given here");
define("LAN_GALLERY_ADMIN_06", "Image Max. Height");
define("LAN_GALLERY_ADMIN_07", "Images will be auto-resized if greater than the height given here");
define("LAN_GALLERY_ADMIN_08", "Show \"download\" link");
define("LAN_GALLERY_ADMIN_09", "A download option will be shown next to the popup caption");
define("LAN_GALLERY_ADMIN_10", "Slideshow category");
define("LAN_GALLERY_ADMIN_11", "Images from this category will be used in the sliding menu.");
define("LAN_GALLERY_ADMIN_12", "Slide duration");
define("LAN_GALLERY_ADMIN_13", "The duration (in seconds) of a full jump.");
define("LAN_GALLERY_ADMIN_14", "Slide auto-start");
define("LAN_GALLERY_ADMIN_15", "When enabled image-rotation begins automatically when the page is loaded.");
define("LAN_GALLERY_ADMIN_16", "Slide frequency");
define("LAN_GALLERY_ADMIN_17", "When auto-start is enabled, this dictates how long a slides stays put before the next jump.");
define("LAN_GALLERY_ADMIN_18", "Slide effect");
define("LAN_GALLERY_ADMIN_19", "Type of effect.");
define("LAN_GALLERY_ADMIN_20", "Images per page");
define("LAN_GALLERY_ADMIN_21", "Number of images to be shown per page");
define("LAN_GALLERY_ADMIN_22", "Order images by");
define("LAN_GALLERY_ADMIN_23", "Media ID ASC");
define("LAN_GALLERY_ADMIN_24", "Media ID DESC");
define("LAN_GALLERY_ADMIN_25", "Media Name ASC");
define("LAN_GALLERY_ADMIN_26", "Media Name DESC");
define("LAN_GALLERY_ADMIN_27", "Media Caption ASC");
define("LAN_GALLERY_ADMIN_28", "Media Caption DESC");
define("LAN_GALLERY_ADMIN_29", "slide left");
define("LAN_GALLERY_ADMIN_30", "slide down");
define("LAN_GALLERY_ADMIN_31", "fade");

View File

@ -0,0 +1,8 @@
<?php
/**
* @file
* Language file for "gallery" plugin.
*/
define("LAN_GALLERY_FRONT_01", "Right-click > Save Link As");

View File

@ -1,10 +1,14 @@
<?php
/*
* Copyright (c) e107 Inc 2008-2012 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* Gallery Global Language
*/
define("LAN_PLUGIN_GALLERY_TITLE", "Gallery");
define("LAN_PLUGIN_GALLERY_DIZ", "A simple image gallery");
/**
* @file
* Language file for "gallery" plugin.
*/
define("LAN_PLUGIN_GALLERY_TITLE", "Gallery");
define("LAN_PLUGIN_GALLERY_DIZ", "A simple image gallery");
define("LAN_PLUGIN_GALLERY_SEF_01", "Gallery SEF");
define("LAN_PLUGIN_GALLERY_SEF_02", "SEF URLs enabled.");
define("LAN_PLUGIN_GALLERY_SEF_03", "SEF URLs disabled.");
define("LAN_PLUGIN_GALLERY_SEF_04", "Gallery default");

View File

@ -31,6 +31,6 @@ $settings = array(
e107::js('settings', array('gallery' => $settings));
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
e107::getRender()->tablerender("Gallery", $text, 'gallery_slideshow');
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $text, 'gallery_slideshow');
unset($text);
unset($gp);

View File

@ -1,37 +1,42 @@
<?php
/*
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* System routing config
*/
class plugin_gallery_rewrite_url extends eUrlConfig
{
public function config()
{
return array(
'config' => array(
'allowMain' => true,
'format' => 'path',
'defaultRoute' => 'index/category',
'allowMain' => true,
'format' => 'path',
'defaultRoute' => 'index/category',
// false - disable all parameters passed to assemble method by default
'allowVars' => array('cat', 'frm'),
'allowVars' => array('cat', 'frm'),
// custom assemble/parse URL regex template
'varTemplates' => array('galleryCat' => '[\w\pL\s\-+.,]+'),
),
// rule set array
'rules' => array(
'/' => 'index/category',
'rules' => array(
'/' => 'index/category',
// allow only mapped vars - cat and frm parameters to be passed
'<cat:{galleryCat}>' => array('index/list', 'mapVars' => array('media_cat_sef' => 'cat', 'from' => 'frm')),
)
'<cat:{galleryCat}>' => array('index/list', 'mapVars' => array('media_cat_sef' => 'cat', 'from' => 'frm')),
)
);
}
/**
* Admin callback
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
@ -40,16 +45,16 @@ class plugin_gallery_rewrite_url extends eUrlConfig
{
// static may be used for performance - XXX LANS
static $admin = array(
'labels' => array(
'name' => 'Gallery', // Module name
'label' => 'Gallery SEF', // Current profile name
'description' => 'SEF URLs enabled.',
'examples' => array('{SITEURL}gallery/my-gallery-title'), //
'labels' => array(
'name' => LAN_PLUGIN_GALLERY_TITLE, // Module name
'label' => LAN_PLUGIN_GALLERY_SEF_01, // Current profile name
'description' => LAN_PLUGIN_GALLERY_SEF_02,
'examples' => array('{SITEURL}gallery/my-gallery-title'), //
),
'form' => array(), // Under construction - additional configuration options
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
);
return $admin;
}
}

View File

@ -1,33 +1,38 @@
<?php
/*
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
*
* System routing config
*/
class plugin_gallery_url extends eUrlConfig
{
public function config()
{
return array(
'config' => array(
'allowMain' => true,
'format' => 'path', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
'defaultRoute' => 'index/category', // [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
'allowMain' => true,
'format' => 'path', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
'defaultRoute' => 'index/category', // [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
// false - disable all parameters passed to assemble method by default
'allowVars' => array('cat', 'frm'),
),
'allowVars' => array('cat', 'frm'),
),
// rule set array
'rules' => array(
'/' => 'index/category',
'list' => array('index/list', 'mapVars' => array('media_cat_sef' => 'cat', 'from' => 'frm'), 'allowVars' => array('cat', 'frm'),),
)
'rules' => array(
'/' => 'index/category',
'list' => array('index/list', 'mapVars' => array('media_cat_sef' => 'cat', 'from' => 'frm'), 'allowVars' => array('cat', 'frm'),),
)
);
}
/**
* Admin callback
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
@ -36,16 +41,16 @@ class plugin_gallery_url extends eUrlConfig
{
// static may be used for performance - XXX LANS
static $admin = array(
'labels' => array(
'name' => 'Gallery', // Module name
'label' => 'Gallery default', // Current profile name
'description' => 'SEF URLs disabled.', //
'examples' => array("{e_PLUGIN_ABS}gallery/?cat=gallery_1")
'labels' => array(
'name' => LAN_PLUGIN_GALLERY_TITLE, // Module name
'label' => LAN_PLUGIN_GALLERY_SEF_04, // Current profile name
'description' => LAN_PLUGIN_GALLERY_SEF_03,
'examples' => array("{e_PLUGIN_ABS}gallery/?cat=gallery_1")
),
'form' => array(), // Under construction - additional configuration options
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
);
return $admin;
}
}