1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Merge pull request #1469 from lonalore/master

Gallery plugin fixes and enhancements
This commit is contained in:
Cameron 2016-04-06 14:32:36 -07:00
commit e1e77d9f1c
65 changed files with 1711 additions and 811 deletions

View File

@ -437,7 +437,7 @@ class e_media
* @param $search
* @return array
*/
public function getImages($cat='', $from=0, $amount=null,$search=null)
public function getImages($cat='', $from=0, $amount=null, $search=null, $orderby=null)
{
$inc = array();
$searchinc = array();
@ -490,8 +490,15 @@ class e_media
{
$query .= " AND ( ".implode(" OR ",$searchinc)." ) " ;
}
$query .= " ORDER BY media_id DESC";
if($orderby)
{
$query .= " ORDER BY " . $orderby;
}
else
{
$query .= " ORDER BY media_id DESC";
}
if($amount == 'all')
{

View File

@ -116,6 +116,8 @@ define("LAN_EMAIL","Email address");
define("LAN_WROTE", "wrote"); // as in John wrote.." ";
define("LAN_RE_ORDER", "Re-order");
define("LAN_RELATED", "Related");
define("LAN_CLOSE", "Close");
define("LAN_EXPAND", "Expand");
define("LAN_ENTER_USRNAME_EMAIL", "Please enter your username or email"); // admin php hover field admin name
define("LAN_PWD_REQUIRED", "Password is required"); // admin php hover field admin password

View File

@ -1,270 +1,657 @@
<?php
/*
/**
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* @author e107coders
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/download/admin_download.php,v $
* $Revision: 12639 $
* $Date: 2012-04-20 00:28:53 -0700 (Fri, 20 Apr 2012) $
* $Author: e107coders $
* @file
* Class installations to handle configuration forms on Admin UI.
*/
$eplug_admin = true;
require_once("../../class2.php");
if (!getperms("P") || !e107::isInstalled('gallery'))
if(!getperms("P") || !e107::isInstalled('gallery'))
{
e107::redirect('admin');
exit() ;
exit();
}
$e_sub_cat = 'gallery';
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_admin.php
e107::lan('gallery', true, true);
$e_sub_cat = 'gallery';
/**
* Class plugin_gallery_admin.
*/
class plugin_gallery_admin extends e_admin_dispatcher
{
/**
* Format: 'MODE' => array('controller' =>'CONTROLLER_CLASS'[, 'index' => 'list', 'path' => 'CONTROLLER SCRIPT PATH', 'ui' => 'UI CLASS NAME child of e_admin_ui', 'uipath' => 'UI SCRIPT PATH']);
* Note - default mode/action is autodetected in this order:
* - $defaultMode/$defaultAction (owned by dispatcher - see below)
* - $adminMenu (first key if admin menu array is not empty)
* - $modes (first key == mode, corresponding 'index' key == action)
* Required (set by child class).
*
* Controller map array in format.
* @code
* 'MODE' => array(
* 'controller' =>'CONTROLLER_CLASS_NAME',
* 'path' => 'CONTROLLER SCRIPT PATH',
* 'ui' => 'UI_CLASS', // extend of 'comments_admin_form_ui'
* 'uipath' => 'path/to/ui/',
* );
* @endcode
*
* @var array
*/
protected $modes = array (
'main' => array (
'controller' => 'gallery_cat_admin_ui',
'path' => null,
'ui' => 'gallery_cat_admin_form_ui',
'uipath' => null
protected $modes = array(
'main' => array(
'controller' => 'gallery_cat_admin_ui',
'path' => null,
'ui' => 'gallery_cat_admin_form_ui',
'uipath' => null
),
'cat' => array (
'controller' => 'gallery_cat_ui',
'path' => null,
'ui' => 'gallery_cat_form_ui',
'uipath' => null
)
'cat' => array(
'controller' => 'gallery_cat_ui',
'path' => null,
'ui' => 'gallery_cat_form_ui',
'uipath' => null
)
);
/* 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
* Optional (set by child class).
*
* Required for admin menu render. Format:
* @code
* 'mode/action' => array(
* 'caption' => 'Link title',
* 'perm' => '0',
* 'url' => '{e_PLUGIN}plugname/admin_config.php',
* ...
* );
* @endcode
*
* Note that 'perm' and 'userclass' restrictions are inherited from the $modes, $access and $perm, so you don't
* have to set that vars if you don't need any additional 'visual' control.
*
* All valid key-value pair (see e107::getNav()->admin function) are accepted.
*
* @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'
'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P')
);
/**
* Navigation menu title
* Optional (set by child class).
*
* @var string
*/
protected $menuTitle = 'Gallery';
protected $menuTitle = LAN_PLUGIN_GALLERY_TITLE;
/**
* Initial function.
*/
function init()
{
if(E107_DEBUG_LEVEL > 0)
{
$this->adminMenu['main/list'] = array('caption'=> LAN_CATEGORY, 'perm' => 'P');
}
$this->adminMenu['main/list'] = array(
'caption' => LAN_CATEGORY,
'perm' => 'P',
);
}
}
}
/**
* Class gallery_cat_admin_ui.
*/
class gallery_cat_admin_ui extends e_admin_ui
{
protected $pluginTitle = 'Gallery Categories';
protected $pluginName = 'gallery';
protected $table = "core_media_cat";
protected $pid = "media_cat_id";
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 $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')
);
/**
* Could be LAN constant (multi-language support).
*
* @var string plugin name
*/
protected $pluginTitle = LAN_PLUGIN_GALLERY_TITLE;
public function beforeCreate($new_data)
{
/**
* Plugin name.
*
* @var string
*/
protected $pluginName = 'gallery';
$replace = array("_"," ","'",'"',"."); //FIXME Improve
$new_data['media_cat_category'] = strtolower(str_replace($replace,"",$new_data['media_cat_title']));
return $new_data;
}
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>";
$mes->addInfo($message);
}
protected $preftabs = array('General', 'Slideshow Menu');
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')),
/**
* Plugin table.
*
* @var string
*/
protected $table = "core_media_cat";
/**
* Primary key in plugin table.
*
* @var string
*/
protected $pid = "media_cat_id";
/**
* Default (db) limit value.
*
* @var integer
*/
protected $perPage = 10;
/**
* SQL order, false to disable order, null is default order.
*
* @var string
*/
protected $listOrder = 'media_cat_order';
/**
* SQL query for listing. Without any Order or Limit.
*
* @var string
*/
protected $listQry = "SELECT * FROM `#core_media_cat` WHERE media_cat_owner = 'gallery' ";
/**
* UI field data.
*
* @var array
*/
protected $fields = array(
'checkboxes' => array(
'title' => '',
'type' => null,
'width' => '5%',
'forced' => true,
'thclass' => 'center',
'class' => 'center',
),
'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',
),
);
/**
* Referenced from $prefs property per field - 'tab => xxx' where xxx is the tab key (identifier).
*
* Example:
* @code
* array(
* '0' => 'Tab label',
* '1' => 'Another label',
* );
* @endcode
*
* @var array
* Edit/create form tabs.
*/
protected $preftabs = array(
LAN_GALLERY_ADMIN_02,
LAN_GALLERY_ADMIN_03,
LAN_GALLERY_ADMIN_32,
);
/**
* Plugin Preference description array.
*
* @var array
*/
protected $prefs = array(
'popup_w' => array(
'title' => LAN_GALLERY_ADMIN_04,
'tab' => 0,
'type' => 'text',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_05,
),
'popup_h' => array(
'title' => LAN_GALLERY_ADMIN_06,
'tab' => 0,
'type' => 'text',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_07,
),
'downloadable' => array(
'title' => LAN_GALLERY_ADMIN_08,
'tab' => 0,
'type' => 'boolean',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_09,
),
'slideshow_category' => array(
'title' => LAN_GALLERY_ADMIN_10,
'tab' => 1,
'type' => 'dropdown',
'data' => 'str',
'help' => LAN_GALLERY_ADMIN_11,
),
'slideshow_duration' => array(
'title' => LAN_GALLERY_ADMIN_12,
'type' => 'number',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_13,
),
'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,
),
'slideshow_effect' => array(
'title' => LAN_GALLERY_ADMIN_18,
'type' => 'dropdown',
'tab' => 1,
'data' => 'str',
'help' => LAN_GALLERY_ADMIN_19
),
'perpage' => array(
'title' => LAN_GALLERY_ADMIN_20,
'tab' => 0,
'type' => 'number',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_21,
),
'orderby' => array(
'title' => LAN_GALLERY_ADMIN_22,
'tab' => 0,
'type' => 'dropdown',
'data' => 'str',
'writeParms' => array(
'optArray' => array(
'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,
),
),
),
'pp_global' => array(
'title' => LAN_GALLERY_ADMIN_70,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_hook' => array(
'title' => LAN_GALLERY_ADMIN_71,
'type' => 'text',
'data' => 'str',
'writeParms' => array(
'default' => 'data-gal',
),
'tab' => 2,
),
'pp_animation_speed' => array(
'title' => LAN_GALLERY_ADMIN_33,
'type' => 'dropdown',
'data' => 'str',
'writeParms' => array(
'optArray' => array(
'fast' => LAN_GALLERY_ADMIN_62,
'slow' => LAN_GALLERY_ADMIN_63,
'normal' => LAN_GALLERY_ADMIN_64,
),
),
'tab' => 2,
),
'pp_slideshow' => array(
'title' => LAN_GALLERY_ADMIN_34,
'type' => 'text',
'data' => 'int',
'writeParms' => array(
'default' => 5000,
),
'tab' => 2,
),
'pp_autoplay_slideshow' => array(
'title' => LAN_GALLERY_ADMIN_35,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_opacity' => array(
'title' => LAN_GALLERY_ADMIN_36,
'help' => LAN_GALLERY_ADMIN_37,
'type' => 'text',
'data' => 'float',
'writeParms' => array(
'default' => 0.80,
),
'tab' => 2,
),
'pp_show_title' => array(
'title' => LAN_GALLERY_ADMIN_38,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_allow_resize' => array(
'title' => LAN_GALLERY_ADMIN_39,
'help' => LAN_GALLERY_ADMIN_40,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_default_width' => array(
'title' => LAN_GALLERY_ADMIN_41,
'type' => 'text',
'data' => 'int',
'writeParms' => array(
'default' => 500,
),
'tab' => 2,
),
'pp_default_height' => array(
'title' => LAN_GALLERY_ADMIN_42,
'type' => 'text',
'data' => 'int',
'writeParms' => array(
'default' => 344,
),
'tab' => 2,
),
'pp_counter_separator_label' => array(
'title' => LAN_GALLERY_ADMIN_43,
'help' => LAN_GALLERY_ADMIN_44,
'type' => 'text',
'data' => 'str',
'writeParms' => array(
'default' => '/',
),
'tab' => 2,
),
'pp_theme' => array(
'title' => LAN_GALLERY_ADMIN_45,
'type' => 'dropdown',
'data' => 'str',
'writeParms' => array(
'optArray' => array(
'pp_default' => LAN_DEFAULT,
'light_rounded' => LAN_GALLERY_ADMIN_65,
'dark_rounded' => LAN_GALLERY_ADMIN_66,
'light_square' => LAN_GALLERY_ADMIN_67,
'dark_square' => LAN_GALLERY_ADMIN_68,
'facebook' => LAN_GALLERY_ADMIN_69,
),
),
'tab' => 2,
),
'pp_horizontal_padding' => array(
'title' => LAN_GALLERY_ADMIN_46,
'help' => LAN_GALLERY_ADMIN_47,
'type' => 'text',
'data' => 'int',
'writeParms' => array(
'default' => 20,
),
'tab' => 2,
),
'pp_hideflash' => array(
'title' => LAN_GALLERY_ADMIN_48,
'help' => LAN_GALLERY_ADMIN_49,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_wmode' => array(
'title' => LAN_GALLERY_ADMIN_50,
'help' => LAN_GALLERY_ADMIN_51,
'type' => 'text',
'data' => 'str',
'writeParms' => array(
'default' => 'opaque',
),
'tab' => 2,
),
'pp_autoplay' => array(
'title' => LAN_GALLERY_ADMIN_52,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_modal' => array(
'title' => LAN_GALLERY_ADMIN_53,
'help' => LAN_GALLERY_ADMIN_54,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_deeplinking' => array(
'title' => LAN_GALLERY_ADMIN_55,
'help' => LAN_GALLERY_ADMIN_56,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_overlay_gallery' => array(
'title' => LAN_GALLERY_ADMIN_57,
'help' => LAN_GALLERY_ADMIN_58,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_keyboard_shortcuts' => array(
'title' => LAN_GALLERY_ADMIN_59,
'help' => LAN_GALLERY_ADMIN_60,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
'pp_ie6_fallback' => array(
'title' => LAN_GALLERY_ADMIN_61,
'type' => 'boolean',
'data' => 'int',
'tab' => 2,
),
);
/**
* Initial function.
*/
function init()
{
$effects = array(
'scrollHorz' => 'slide left',
'scrollVert' => 'slide down',
// 'turnDown' => 'turn Down',
// 'turnUp' => 'turn Up',
// 'curtainX' => 'curtainX',
// 'curtainY' => 'curtainY',
'fade' => 'fade',
// 'zoom' => 'zoom'
);
$this->prefs['slideshow_effect']['writeParms'] = $effects;
$this->prefs['slideshow_effect']['readParms'] = $effects;
//
// $transitions = array('sinoidal'=>'sinoidal','spring'=>'spring');
// $this->prefs['slideshow_transition']['writeParms'] = $transitions;
// $this->prefs['slideshow_transition']['readParms'] = $transitions;
'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;
$categories = e107::getMedia()->getCategories('gallery');
$cats = array();
foreach($categories as $k=>$var)
foreach($categories as $k => $var)
{
$id = preg_replace("/[^0-9]/", '', $k);
$cats[$id] = $var['media_cat_title'];
$cats[$id] = $var['media_cat_title'];
}
$this->prefs['slideshow_category']['writeParms'] = $cats;
$this->prefs['slideshow_category']['readParms'] = $cats;
$this->prefs['slideshow_category']['writeParms'] = $cats;
$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);
}
/**
* User defined pre-create logic, return false to prevent DB query execution.
*
* @param $new_data
* Posted data.
* @param $old_data
*
* @return boolean
*/
public function beforeCreate($new_data, $old_data)
{
$replace = array("_", " ", "'", '"', "."); // FIXME Improve.
$new_data['media_cat_category'] = strtolower(str_replace($replace, "", $new_data['media_cat_title']));
return $new_data;
}
function galleryPage()
{
$mes = e107::getMessage();
$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.
public function gallery_category_parent($curVal,$mode)
// 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
// Get UI instance
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter.
// Get UI instance.
$controller = $this->getController();
switch($mode)
{
case 'read':
return e107::getParser()->toHTML($controller->getDownloadCategoryTree($curVal), false, 'TITLE');
break;
break;
case 'write':
return $this->selectbox('gallery_category_parent', $controller->getDownloadCategoryTree(), $curVal);
break;
break;
case 'filter':
case 'batch':
return $controller->getDownloadCategoryTree();
break;
break;
}
}
}
class gallery_main_admin_ui extends e_admin_ui
{
}
class gallery_main_admin_form_ui extends e_admin_form_ui
{
}
new plugin_gallery_admin();
require_once(e_ADMIN."auth.php");
e107::getAdminUI()->runPage(); //gallery/includes/admin.php is auto-loaded.
require_once(e_ADMIN."footer.php");
exit;
?>
new plugin_gallery_admin();
require_once(e_ADMIN . "auth.php");
e107::getAdminUI()->runPage(); //gallery/includes/admin.php is auto-loaded.
require_once(e_ADMIN . "footer.php");
exit;

View File

@ -16,33 +16,34 @@
/**
*
* @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.
*/
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,41 +53,23 @@ 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');
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default',
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('footer-inline',$prettyPhoto,'jquery');
$this->catList = e107::getMedia()->getCategories('gallery');
}
public function actionIndex()
{
if(isset($_GET['cat']) && !empty($_GET['cat']))
@ -95,59 +78,61 @@ JS;
}
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'])
{
@ -157,59 +142,60 @@ JS;
}
$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);
$list = e107::getMedia()->getImages($cid,$sc->from,$sc->amount);
$catname = $tp->toHtml($this->catList[$cid]['media_cat_title'],false,'defs');
$sc->from = $request->getRequestParam('frm', 0);
$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');
$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

@ -48,3 +48,8 @@ ul.gallery-cat > li > div > h3 { text-align: center }
.row-fluid .gallery-cat div.span4:nth-child(3n + 4) { margin-left : 0px; }
.row-fluid .gallery-cat div.span3:nth-child(4n + 5) { margin-left : 0px; }
.row-fluid .gallery-cat div.span2:nth-child(6n + 7) { margin-left : 0px; }
/* Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890 */
.thumbnails .span2:nth-child(6n+1) {
margin-left:0;
}

View File

@ -5,13 +5,11 @@
*
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
*/
if (!defined('e107_INIT')) { exit; }
//e107::js('gallery', 'jslib/lightbox/js/lightbox.js','jquery');
//e107::css('gallery', 'jslib/lightbox/css/lightbox.css','jquery');
// See: http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone
if(!defined('e107_INIT'))
{
exit;
}
if(USER_AREA)
{
@ -20,43 +18,14 @@ if(USER_AREA)
/* Gallery CSS */
.thumbnails .span2:nth-child(6n+1) {
margin-left:0;
}",'jquery');
/*
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default',
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('footer-inline',$prettyPhoto,'jquery');
unset($gp);
*/
}", 'jquery');
}
?>
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
if(vartrue($plugPrefs['pp_global'], false))
{
e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php');
// Load prettyPhoto settings and files.
gallery_load_prettyphoto();
}

View File

@ -0,0 +1,162 @@
<?php
/**
* @file
* Provides information about external libraries.
*/
/**
* Class PLUGIN_library.
*/
class gallery_library
{
/**
* Return information about external libraries.
*
* @return
* An associative array whose keys are internal names of libraries and whose values are describing each library.
* Each key is the directory name below the '{e_WEB}/lib' directory, in which the library may be found. Each
* value is an associative array containing:
* - name: The official, human-readable name of the library.
* - vendor_url: The URL of the homepage of the library.
* - download_url: The URL of a web page on which the library can be obtained.
* - path: (optional) A relative path from the directory of the library to the actual library. Only required if
* the extracted download package contains the actual library files in a sub-directory.
* - library_path: (optional) The absolute path to the library directory. This should not be declared normally, as
* it is automatically detected, to allow for multiple possible library locations. A valid use-case is an
* external library, in which case the full URL to the library should be specified here.
* - version: (optional) The version of the library. This should not be declared normally, as it is automatically
* detected (see 'version_callback' below) to allow for version changes of libraries without code changes of
* implementing plugins and to support different versions of a library simultaneously. A valid use-case is an
* external library whose version cannot be determined programmatically. Either 'version' or 'version_callback'
* (or 'version_arguments' in case libraryGetVersion() is being used as a version callback) must be declared.
* - version_callback: (optional) The name of a function that detects and returns the full version string of the
* library. The first argument is always $library, an array containing all library information as described here.
* There are two ways to declare the version callback's additional arguments, either as a single $options
* parameter or as multiple parameters, which correspond to the two ways to specify the argument values (see
* 'version_arguments'). Defaults to libraryGetVersion(). Unless 'version' is declared or libraryGetVersion()
* is being used as a version callback, 'version_callback' must be declared. In the latter case, however,
* 'version_arguments' must be declared in the specified way.
* - version_arguments: (optional) A list of arguments to pass to the version callback. Version arguments can be
* declared either as an associative array whose keys are the argument names or as an indexed array without
* specifying keys. If declared as an associative array, the arguments get passed to the version callback as a
* single $options parameter whose keys are the argument names (i.e. $options is identical to the specified
* array). If declared as an indexed array, the array values get passed to the version callback as separate
* arguments in the order they were declared. The default version callback libraryGetVersion() expects a
* single, associative array with named keys:
* - file: The filename to parse for the version, relative to the path specified as the 'library_path' property
* (see above). For example: 'docs/changelog.txt'.
* - pattern: A string containing a regular expression (PCRE) to match the library version. For example:
* '@version\s+([0-9a-zA-Z\.-]+)@'. Note that the returned version is not the match of the entire pattern
* (i.e. '@version 1.2.3' in the above example) but the match of the first sub-pattern (i.e. '1.2.3' in the
* above example).
* - lines: (optional) The maximum number of lines to search the pattern in. Defaults to 20.
* - cols: (optional) The maximum number of characters per line to take into account. Defaults to 200. In case
* of minified or compressed files, this prevents reading the entire file into memory.
* Defaults to an empty array. 'version_arguments' must be specified unless 'version' is declared or the
* specified 'version_callback' does not require any arguments. The latter might be the case with a
* library-specific version callback, for example.
* - files: An associative array of library files to load. Supported keys are:
* - js: A list of JavaScript files to load.
* - css: A list of CSS files to load.
* - php: A list of PHP files to load.
* - dependencies: An array of libraries this library depends on. Similar to declaring plugin dependencies, the
* dependency declaration may contain information on the supported version. Examples of supported declarations:
* @code
* $library['dependencies'] = array(
* // Load the 'example' library, regardless of the version available:
* 'example',
* // Only load the 'example' library, if version 1.2 is available:
* 'example (1.2)',
* // Only load a version later than 1.3-beta2 of the 'example' library:
* 'example (>1.3-beta2)'
* // Only load a version equal to or later than 1.3-beta3:
* 'example (>=1.3-beta3)',
* // Only load a version earlier than 1.5:
* 'example (<1.5)',
* // Only load a version equal to or earlier than 1.4:
* 'example (<=1.4)',
* // Combinations of the above are allowed as well:
* 'example (>=1.3-beta2, <1.5)',
* );
* @endcode
* - variants: (optional) An associative array of available library variants. For example, the top-level 'files'
* property may refer to a default variant that is compressed. If the library also ships with a minified and
* uncompressed/source variant, those can be defined here. Each key should describe the variant type, e.g.
* 'minified' or 'source'. Each value is an associative array of top-level properties that are entirely
* overridden by the variant, most often just 'files'. Additionally, each variant can contain following
* properties:
* - variant_callback: (optional) The name of a function that detects the variant and returns TRUE or FALSE,
* depending on whether the variant is available or not. The first argument is always $library, an array
* containing all library information as described here. The second argument is always a string containing the
* variant name. There are two ways to declare the variant callback's additional arguments, either as a single
* $options parameter or as multiple parameters, which correspond to the two ways to specify the argument
* values (see 'variant_arguments'). If omitted, the variant is expected to always be available.
* - variant_arguments: A list of arguments to pass to the variant callback. Variant arguments can be declared
* either as an associative array whose keys are the argument names or as an indexed array without specifying
* keys. If declared as an associative array, the arguments get passed to the variant callback as a single
* $options parameter whose keys are the argument names (i.e. $options is identical to the specified array).
* If declared as an indexed array, the array values get passed to the variant callback as separate arguments
* in the order they were declared.
* Variants can be version-specific (see 'versions').
* - versions: (optional) An associative array of supported library versions. Naturally, libraries evolve over
* time and so do their APIs. In case a library changes between versions, different 'files' may need to be
* loaded, different 'variants' may become available, or e107 plugins need to load different integration files
* adapted to the new version. Each key is a version *string* (PHP does not support floats as keys). Each value
* is an associative array of top-level properties that are entirely overridden by the version.
* - integration_files: (optional) Sets of files to load for the plugin, using the same notion as the top-level
* 'files' property. Each specified file should contain the path to the file relative to the plugin it belongs
* to.
* Additional top-level properties can be registered as needed.
*/
function config()
{
$libraries['jquery.prettyPhoto'] = array(
// Only used in administrative UI of Libraries API.
'name' => 'prettyPhoto',
'vendor_url' => 'http://www.no-margin-for-errors.com',
'download_url' => 'https://github.com/scaron/prettyphoto',
'version_arguments' => array(
'file' => 'js/jquery.prettyPhoto.js',
// Version: 3.1.6
'pattern' => '/Version: (\d+\.+\d+\.+\d+)/',
'lines' => 5,
),
'files' => array(
'js' => array(
'js/jquery.prettyPhoto.js' => array(
'type' => 'footer',
),
),
'css' => array(
'css/prettyPhoto.css',
),
),
);
$libraries['jquery.cycle'] = array(
// Only used in administrative UI of Libraries API.
'name' => 'jQuery Cycle Plugin',
'vendor_url' => 'http://jquery.malsup.com/cycle/',
'download_url' => 'http://jquery.malsup.com/cycle/',
'version_arguments' => array(
'file' => 'jquery.cycle.all.js',
// Version: 2.9999.5
'pattern' => '/Version: (\d+\.+\d+\.+\d+)/',
'lines' => 5,
),
'files' => array(
'js' => array(
'jquery.cycle.all.js' => array(
'type' => 'footer',
),
),
),
);
return $libraries;
}
}

View File

@ -6,79 +6,71 @@
* 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 $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';
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default',
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('footer-inline',$prettyPhoto,'jquery');
$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';
}
function sc_gallery_caption($parm='')
function sc_gallery_caption($parm = '')
{
e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php');
// Load prettyPhoto settings and files.
gallery_load_prettyphoto();
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$hook = varset($plugPrefs['pp_hook'], 'data-gal');
$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) . "' " . $hook . "='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}
@ -88,153 +80,170 @@ JS;
* 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);
e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php');
// Load prettyPhoto settings and files.
gallery_load_prettyphoto();
$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]';
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$hook = varset($plugPrefs['pp_hook'], 'data-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) ? 'prettyPhoto[pp_gal]' : 'prettyPhoto[pp_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>" : "";
$description .= $tp->toAttribute($this->var['media_description']);
$text = "<a class='".$class."' title=\"".$description."\" href='".$srcFull."' data-gal='{$rel}' >";
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');
}
$text .= $tp->toImage($this->var['media_url'],$att);
$description = $tp->toAttribute($this->var['media_description']);
$text = "<a class='" . $class . "' title='" . $description . "' href='" . $srcFull . "' " . $hook . "='" . $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 = '')
{
$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);
$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?
$tmpl = e107::getTemplate('gallery','gallery');
$limit = vartrue($parm['limit'], 6);
$list = e107::getMedia()->getImages('gallery_image|gallery_'.$cat.'|gallery_image_'.$cat, 0, $limit);
$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}
@ -244,40 +253,43 @@ JS;
*/
function sc_gallery_slides($parm)
{
$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);
$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];
$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];
$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 -->" : "";
@ -285,21 +297,22 @@ JS;
}
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++)
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

@ -1,150 +1,126 @@
<?php
/*
/**
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Cron Administration
*
* $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.8/e107_admin/cron.php $
* $Id: cron.php 12492 2011-12-30 16:09:10Z e107steved $
*
* @file
* Render gallery pages.
*/
/**
*
* @package e107
* @subpackage frontend
* @version $Id: cron.php 12492 2011-12-30 16:09:10Z e107steved $
* Ultra-simple Image-Gallery
*/
require_once("../../class2.php");
if (!e107::isInstalled('gallery'))
if(!e107::isInstalled('gallery'))
{
e107::redirect();
exit;
}
e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php');
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::css('gallery', 'gallery_style.css');
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
e107::css('inline', "
/* Gallery CSS */
.thumbnails .span2:nth-child(6n+1) {
margin-left:0;
}",'jquery');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('inline',$prettyPhoto,'jquery');
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_front.php
e107::lan('gallery', false, true);
e107::css('gallery', 'css/gallery.css');
// Load prettyPhoto settings and files.
gallery_load_prettyphoto();
require_once(HEADERF);
/**
* Class gallery.
*/
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;
$list = e107::getMedia()->getImages($cat,$sc->from,$sc->amount);
$catname = $tp->toHtml($this->catList[$cat]['media_cat_title'],false,'defs');
$inner = "";
$sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0;
$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 = "";
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);
}
}
@ -152,6 +128,3 @@ new gallery;
require_once(FOOTERF);
exit;
?>

View File

@ -1,53 +1,78 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Custom download install/uninstall/update routines
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/download/download_setup.php,v $
* $Revision: 12639 $
* $Date: 2012-04-20 00:28:53 -0700 (Fri, 20 Apr 2012) $
* $Author: e107coders $
*
*/
/**
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* @file
* Custom install/uninstall/update routines.
*/
/**
* Class gallery_setup.
*/
class gallery_setup
{
/**
* This function is called before plugin table has been created by the
* [PLUGIN]_sql.php file.
*
* @param array $var
*/
function install_pre($var)
{
// print_a($var);
$mes = eMessage::getInstance();
// $mes->add("custom install 'pre' function.", E_MESSAGE_SUCCESS);
}
/**
* This function is called after plugin table has been created by the
* [PLUGIN]_sql.php file.
*
* @param array $var
*/
function install_post($var)
{
$sql = e107::getDb();
$mes = eMessage::getInstance();
// $mes->add("custom install 'post' function.", E_MESSAGE_SUCCESS);
}
function uninstall_pre($var)
{
$sql = e107::getDb();
$mes = eMessage::getInstance();
// $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS);
}
// IMPORTANT : This function below is for modifying the CONTENT of the tables only, NOT the table-structure.
// To Modify the table-structure, simply modify your {plugin}_sql.php file and an update will be detected automatically.
/*
* @var $needed - true when only a check for a required update is being performed.
* Return: Reason the upgrade is required, otherwise set it to return FALSE.
*/
function upgrade_post($needed)
function uninstall_options()
{
}
function uninstall_post($var)
{
}
/**
* Trigger an upgrade alert or not.
*
* @param array $var
*
* @return bool
* True to trigger an upgrade alert, and false to not.
*/
function upgrade_required($var)
{
return false;
}
function upgrade_pre($var)
{
}
function upgrade_post($var)
{
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* @file
* Helper functions for "gallery" plugin.
*/
/**
* Helper function to load prettyPhoto library's settings and files.
*/
function gallery_load_prettyphoto()
{
// Re-use the statically cached value to save memory. Load settings and files only once!!!
static $gallery_load_prettyphoto;
if(!isset($gallery_load_prettyphoto['loaded']) || !$gallery_load_prettyphoto['loaded'])
{
$tp = e107::getParser();
$plugPref = e107::getPlugConfig('gallery')->getPref();
$template = e107::getTemplate('gallery');
// Load prettyPhoto library.
e107::library('load', 'jquery.prettyPhoto');
$settings = array(
'prettyphoto' => array(
'hook' => $tp->toText(varset($plugPref['pp_hook'], 'data-gal')),
'animation_speed' => $tp->toText(varset($plugPref['pp_animation_speed'], 'fast')),
'slideshow' => (int) varset($plugPref['pp_slideshow'], 5000),
'autoplay_slideshow' => (bool) varset($plugPref['pp_autoplay_slideshow'], false),
'opacity' => (float) varset($plugPref['pp_opacity'], 0.80),
'show_title' => (bool) varset($plugPref['pp_show_title'], true),
'allow_resize' => (bool) varset($plugPref['pp_allow_resize'], true),
'default_width' => (int) varset($plugPref['pp_default_width'], 500),
'default_height' => (int) varset($plugPref['pp_default_height'], 344),
'counter_separator_label' => $tp->toText(varset($plugPref['pp_counter_separator_label'], '/')),
'theme' => $tp->toText(varset($plugPref['pp_theme'], 'pp_default')),
'horizontal_padding' => (int) varset($plugPref['pp_horizontal_padding'], 20),
'hideflash' => (bool) varset($plugPref['pp_hideflash'], false),
'wmode' => $tp->toText(varset($plugPref['pp_wmode'], 'opaque')),
'autoplay' => (bool) varset($plugPref['pp_autoplay'], true),
'modal' => (bool) varset($plugPref['pp_modal'], false),
'deeplinking' => (bool) varset($plugPref['pp_deeplinking'], false),
'overlay_gallery' => (bool) varset($plugPref['pp_overlay_gallery'], true),
'keyboard_shortcuts' => (bool) varset($plugPref['pp_keyboard_shortcuts'], true),
'ie6_fallback' => (bool) varset($plugPref['pp_ie6_fallback'], true),
'markup' => $template['prettyphoto']['content'],
'gallery_markup' => $template['prettyphoto']['gallery_item'],
'image_markup' => $template['prettyphoto']['image_item'],
'flash_markup' => $template['prettyphoto']['flash_item'],
'quicktime_markup' => $template['prettyphoto']['quicktime_item'],
'iframe_markup' => $template['prettyphoto']['iframe_item'],
'inline_markup' => $template['prettyphoto']['inline_item'],
'custom_markup' => $template['prettyphoto']['custom_item'],
'social_tools' => $template['prettyphoto']['social_item'],
),
);
if(vartrue($plugPref['downloadable'], false))
{
$settings['prettyphoto']['image_markup'] .= '<span class="download-btn">';
$settings['prettyphoto']['image_markup'] .= '<a class="btn btn-default btn-xs" href="{path}">' . LAN_DOWNLOAD . '</a>';
$settings['prettyphoto']['image_markup'] .= '</span>';
}
e107::js('settings', array('gallery' => $settings));
e107::js('gallery', 'js/gallery.js');
$gallery_load_prettyphoto['loaded'] = true;
}
}

View File

@ -0,0 +1,49 @@
var e107 = e107 || {'settings': {}, 'behaviors': {}};
(function ($)
{
/**
* Behavior to initialize gallery slideshow.
*
* @type {{attach: Function}}
*/
e107.behaviors.galleryCycle = {
attach: function (context, settings)
{
$(context).find("#gallery-slideshow-content").once('gallery-slideshow-content').each(function ()
{
$(this).cycle({
fx: settings.gallery.fx,
next: '.gal-next',
prev: '.gal-prev',
speed: settings.gallery.speed, // speed of the transition (any valid fx speed value)
timeout: settings.gallery.timeout,
slideExpr: '.slide',
pause: 1, // pause on hover - TODO pref
activePagerClass: '.gallery-slide-jumper-selected',
before: function (currSlideElement, nextSlideElement, options, forwardFlag)
{
var nx = $(nextSlideElement).attr('id').split('item-');
var th = $(currSlideElement).attr('id').split('item-');
$('#gallery-jumper-' + th[1]).removeClass('gallery-slide-jumper-selected');
$('#gallery-jumper-' + nx[1]).addClass('gallery-slide-jumper-selected');
}
});
});
$(context).find(".gallery-slide-jumper").once('gallery-slide-jumper').each(function ()
{
$(this).click(function ()
{
var nid = $(this).attr('id');
var id = nid.split('-jumper-');
var go = parseInt(id[1]) - 1;
$('#gallery-slideshow-content').cycle(go);
return false;
});
});
}
};
})(jQuery);

View File

@ -0,0 +1,58 @@
var e107 = e107 || {'settings': {}, 'behaviors': {}};
(function ($)
{
/**
* Behavior to initialize prettyPhoto on gallery elements.
*
* @type {{attach: Function}}
*/
e107.behaviors.gallery = {
attach: function (context, settings)
{
var pPhoto = settings.gallery.prettyphoto || {};
var pPhook = pPhoto.hook || 'data-gal';
$(context).find("a[" + pPhook + "^='prettyPhoto']").once('gallery-prettyPhoto').prettyPhoto(
{
hook: pPhook,
animation_speed: pPhoto.animation_speed, // fast/slow/normal
slideshow: pPhoto.slideshow, // false OR interval time in ms
autoplay_slideshow: pPhoto.autoplay_slideshow, // true/false
opacity: pPhoto.opacity, // Value between 0 and 1
show_title: pPhoto.show_title, // true/false
allow_resize: pPhoto.allow_resize, // Resize the photos bigger than viewport. true/false
default_width: pPhoto.default_width,
default_height: pPhoto.default_height,
counter_separator_label: pPhoto.counter_separator_label, // The separator for the gallery counter 1 "of" 2
theme: pPhoto.theme, // light_rounded / dark_rounded / light_square / dark_square / facebook
horizontal_padding: pPhoto.horizontal_padding, // The padding on each side of the picture
hideflash: pPhoto.hideflash, // Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto
wmode: pPhoto.wmode, // Set the flash wmode attribute
autoplay: pPhoto.autoplay, // Automatically start videos: true/false
modal: pPhoto.modal, // If set to true, only the close button will close the window
deeplinking: pPhoto.deeplinking, // Allow prettyPhoto to update the url to enable deeplinking.
overlay_gallery: pPhoto.overlay_gallery, // If set to true, a gallery will overlay the fullscreen image on mouse over
keyboard_shortcuts: pPhoto.keyboard_shortcuts, // Set to false if you open forms inside prettyPhoto
ie6_fallback: pPhoto.ie6_fallback, // true/false
markup: pPhoto.markup,
gallery_markup: pPhoto.gallery_markup,
image_markup: pPhoto.image_markup,
flash_markup: pPhoto.flash_markup,
quicktime_markup: pPhoto.quicktime_markup,
iframe_markup: pPhoto.iframe_markup,
inline_markup: pPhoto.inline_markup,
custom_markup: pPhoto.custom_markup,
social_tools: pPhoto.social_tools,
changepicturecallback: function ()
{
var $ppContent = $(".pp_content");
$ppContent.css("height", $ppContent.height() + jQuery(".download-btn").outerHeight() + 10);
}
}
);
}
};
})(jQuery);

View File

@ -0,0 +1,82 @@
<?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");
define("LAN_GALLERY_ADMIN_32", "prettyPhoto settings");
define("LAN_GALLERY_ADMIN_33", "Animation speed");
define("LAN_GALLERY_ADMIN_34", "Slideshow: Interval time");
define("LAN_GALLERY_ADMIN_35", "Slideshow: Autoplay");
define("LAN_GALLERY_ADMIN_36", "Opacity");
define("LAN_GALLERY_ADMIN_37", "Value between 0 and 1.");
define("LAN_GALLERY_ADMIN_38", "Show title");
define("LAN_GALLERY_ADMIN_39", "Allow resize");
define("LAN_GALLERY_ADMIN_40", "Resize the photos bigger than viewport.");
define("LAN_GALLERY_ADMIN_41", "Default width");
define("LAN_GALLERY_ADMIN_42", "Default height");
define("LAN_GALLERY_ADMIN_43", "Counter separator label");
define("LAN_GALLERY_ADMIN_44", "The separator for the gallery counter 1 \"of\" 2");
define("LAN_GALLERY_ADMIN_45", "Theme");
define("LAN_GALLERY_ADMIN_46", "Horizontal padding");
define("LAN_GALLERY_ADMIN_47", "The padding on each side of the picture.");
define("LAN_GALLERY_ADMIN_48", "Hide flash");
define("LAN_GALLERY_ADMIN_49", "Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto.");
define("LAN_GALLERY_ADMIN_50", "Wmode");
define("LAN_GALLERY_ADMIN_51", "Set the flash wmode attribute.");
define("LAN_GALLERY_ADMIN_52", "Autoplay videos");
define("LAN_GALLERY_ADMIN_53", "Modal close");
define("LAN_GALLERY_ADMIN_54", "If set to true, only the close button will close the window.");
define("LAN_GALLERY_ADMIN_55", "Deep-linking");
define("LAN_GALLERY_ADMIN_56", "Allow prettyPhoto to update the url to enable deep-linking.");
define("LAN_GALLERY_ADMIN_57", "Overlay gallery");
define("LAN_GALLERY_ADMIN_58", "If set to true, a gallery will overlay the fullscreen image on mouse over.");
define("LAN_GALLERY_ADMIN_59", "Keyboard shortcuts");
define("LAN_GALLERY_ADMIN_60", "Set to false if you open forms inside prettyPhoto.");
define("LAN_GALLERY_ADMIN_61", "IE6 fallback");
define("LAN_GALLERY_ADMIN_62", "fast");
define("LAN_GALLERY_ADMIN_63", "slow");
define("LAN_GALLERY_ADMIN_64", "normal");
define("LAN_GALLERY_ADMIN_65", "Light rounded");
define("LAN_GALLERY_ADMIN_66", "Dark rounded");
define("LAN_GALLERY_ADMIN_67", "Light square");
define("LAN_GALLERY_ADMIN_68", "Dark square");
define("LAN_GALLERY_ADMIN_69", "Facebook");
define("LAN_GALLERY_ADMIN_70", "Load prettyPhoto globally");
define("LAN_GALLERY_ADMIN_71", "prettyPhoto attribute (hook)");

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<e107Plugin name="Gallery" lan="LAN_PLUGIN_GALLERY_TITLE" version="1.0" date="2012-08-01" compatibility="2.0" installRequired="true">
<e107Plugin name="Gallery" lan="LAN_PLUGIN_GALLERY_TITLE" version="1.1" date="2016-03-30" compatibility="2.0" installRequired="true">
<author name="e107 Inc." url="http://e107.org" />
<description lan="LAN_PLUGIN_GALLERY_DIZ">A simple image gallery</description>
<category>content</category>
@ -23,5 +23,27 @@
<pref name="slideshow_freq">4000</pref>
<pref name="slideshow_effect">scrollHorz</pref>
<pref name="perpage">12</pref>
<pref name="orderby">media_id DESC</pref>
<pref name="pp_global">1</pref>
<pref name="pp_hook">data-gal</pref>
<pref name="pp_animation_speed">fast</pref>
<pref name="pp_slideshow">5000</pref>
<pref name="pp_autoplay_slideshow">0</pref>
<pref name="pp_opacity">0.80</pref>
<pref name="pp_show_title">1</pref>
<pref name="pp_allow_resize">1</pref>
<pref name="pp_default_width">500</pref>
<pref name="pp_default_height">344</pref>
<pref name="pp_counter_separator_label">/</pref>
<pref name="pp_theme">pp_default</pref>
<pref name="pp_horizontal_padding">20</pref>
<pref name="pp_hideflash">0</pref>
<pref name="pp_wmode">opaque</pref>
<pref name="pp_autoplay">1</pref>
<pref name="pp_modal">0</pref>
<pref name="pp_deeplinking">0</pref>
<pref name="pp_overlay_gallery">0</pref>
<pref name="pp_keyboard_shortcuts">1</pref>
<pref name="pp_ie6_fallback">1</pref>
</pluginPrefs>
</e107Plugin>

View File

@ -1,100 +1,44 @@
<?php
/*
* Copyright (c) 2012 e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: e_shortcode.php 12438 2011-12-05 15:12:56Z secretr $
*
* Gallery Template
*/
if (!defined('e107_INIT')) { exit; }
/**
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* @file
* Render gallery menu.
*/
if(!defined('e107_INIT'))
{
exit;
}
e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php');
e107::plugLan('gallery', 'front');
$gp = e107::getPlugPref('gallery');
e107::css('gallery', 'css/gallery.css');
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
// Load prettyPhoto settings and files.
gallery_load_prettyphoto();
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
e107::library('load', 'jquery.cycle');
e107::js('gallery', 'js/gallery.cycle.js');
$settings = array(
'fx' => varset($gp['slideshow_effect'], 'scrollHorz'),
'speed' => varset($gp['slideshow_duration'], 1000),
'timeout' => varset($gp['slideshow_freq'], 4000),
);
e107::css('gallery', 'gallery_style.css');
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
e107::css('inline', "
.thumbnails .span2:nth-child(6n+1) {
margin-left:0;
}",'jquery');
$prettyPhoto = <<<JS
$(document).ready(function(){
$("a[data-gal^='prettyPhoto']").prettyPhoto(
{
hook: 'data-gal',
theme: 'pp_default',
overlay_gallery: false,
deeplinking: false
}
);
});
JS;
e107::js('footer-inline',$prettyPhoto,'jquery');
e107::js('gallery', 'jslib/jquery.cycle.all.js','jquery');
e107::js('footer-inline',"
$(document).ready(function()
{
$('#gallery-slideshow-content').cycle({
fx: '".varset($gp['slideshow_effect'],'scrollHorz')."',
next: '.gal-next',
prev: '.gal-prev',
speed: ".varset($gp['slideshow_duration'],1000).", // speed of the transition (any valid fx speed value)
timeout: ".varset($gp['slideshow_freq'],4000).",
slideExpr: '.slide',
pause: 1, // pause on hover - TODO pref
activePagerClass: '.gallery-slide-jumper-selected',//,
before: function(currSlideElement, nextSlideElement, options, forwardFlag)
{
var nx = $(nextSlideElement).attr('id').split('item-');
var th = $(currSlideElement).attr('id').split('item-');
$('#gallery-jumper-'+th[1]).removeClass('gallery-slide-jumper-selected');
$('#gallery-jumper-'+nx[1]).addClass('gallery-slide-jumper-selected');
}
});
$('.gallery-slide-jumper').click(function() {
var nid = $(this).attr('id');
var id = nid.split('-jumper-');
var go = parseInt(id[1]) - 1;
$('#gallery-slideshow-content').cycle(go);
return false;
});
$('#img.lb-close').on('live', function(e) {
$(this).attr('src','".e_PLUGIN."gallery/jslib/lightbox/images/close.png');
});
});
");
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,83 +1,181 @@
<?php
/*
* Copyright (c) 2012 e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id: e_shortcode.php 12438 2011-12-05 15:12:56Z secretr $
*
* Gallery Template
*/
/**
* Copyright (c) 2012 e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* @file
* Templates for "gallery" plugin.
*/
$GALLERY_TEMPLATE['list_caption'] = LAN_PLUGIN_GALLERY_TITLE;
$GALLERY_TEMPLATE['list_start'] =
'{GALLERY_BREADCRUMB}
<div class="row gallery">
';
$GALLERY_TEMPLATE['list_item'] = '
<div class="span2 col-xs-6 col-md-3">
<div class="thumbnail">
{GALLERY_THUMB=w=300&h=200}
<h5>{GALLERY_CAPTION}</h5>
$GALLERY_TEMPLATE['list_start'] = '{GALLERY_BREADCRUMB}
<div class="row gallery">
';
$GALLERY_TEMPLATE['list_item'] = '
<div class="span2 col-xs-6 col-md-3">
<div class="thumbnail">
{GALLERY_THUMB=w=300&h=200}
<h5>{GALLERY_CAPTION}</h5>
</div>
</div>
</div>';
';
$GALLERY_TEMPLATE['list_end'] =
"</div>
<div class='center' >
<div class='gallery-list-nextprev'>{GALLERY_NEXTPREV}</div>
<div class='gallery-list-back'><a class='btn btn-default' href='{GALLERY_BASEURL}'>".LAN_BACK."</a></div>
$GALLERY_TEMPLATE['list_end'] = '
</div>
<div class="center">
<div class="gallery-list-nextprev">{GALLERY_NEXTPREV}</div>
<div class="gallery-list-back">
<a class="btn btn-default" href="{GALLERY_BASEURL}">' . LAN_BACK . '</a>
</div>
";
// Bootstrap3 Compatible.
</div>
';
// Bootstrap3 Compatible.
$GALLERY_TEMPLATE['cat_caption'] = LAN_PLUGIN_GALLERY_TITLE;
$GALLERY_TEMPLATE['cat_start'] =
'{GALLERY_BREADCRUMB}
<div class="row gallery-cat">';
$GALLERY_TEMPLATE['cat_start'] = '{GALLERY_BREADCRUMB}
<div class="row gallery-cat">
';
$GALLERY_TEMPLATE['cat_item'] = '
<div class="span3 col-xs-6 col-md-3">
<div >
{GALLERY_CAT_THUMB}
<h3>{GALLERY_CAT_TITLE}</h3>
<div class="span3 col-xs-6 col-md-3">
<div>
{GALLERY_CAT_THUMB}
<h3>{GALLERY_CAT_TITLE}</h3>
</div>
</div>
</div>';
';
$GALLERY_TEMPLATE['cat_end'] =
"</div>
";
$GALLERY_TEMPLATE['cat_end'] = '
</div>
';
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1') Overrides preference in admin.
// {GALLERY_SLIDES=X} X = number of items per slide.
// {GALLERY_JUMPER=space} will remove numbers and just leave spaces.
$GALLERY_TEMPLATE['slideshow_wrapper'] = '
<div id="gallery-slideshow-wrapper">
<div id="gallery-slideshow-content" >
{GALLERY_SLIDES=4}
</div>
</div>
<div class="gallery-slideshow-controls">
<a href="#" class="gallery-control gal-next btn btn-xs btn-default" style="float: right">Next {GLYPH=fa-chevron-right}</a>
<a href="#" class="gallery-control gal-prev btn btn-xs btn-default" >{GLYPH=fa-chevron-left} Previous</a>
<span class="gallery-slide-jumper-container">{GALLERY_JUMPER}</span>
</div>
';
<div id="gallery-slideshow-wrapper">
<div id="gallery-slideshow-content">
{GALLERY_SLIDES=4}
</div>
</div>
<div class="gallery-slideshow-controls">
<a href="#" class="gallery-control gal-next btn btn-xs btn-default pull-right">
' . LAN_NEXT . ' {GLYPH=fa-chevron-right}
</a>
<a href="#" class="gallery-control gal-prev btn btn-xs btn-default">
{GLYPH=fa-chevron-left} ' . LAN_PREVIOUS . '
</a>
<span class="gallery-slide-jumper-container">
{GALLERY_JUMPER}
</span>
</div>
';
$GALLERY_TEMPLATE['slideshow_slide_item'] = '<span class="gallery-slide-item">{GALLERY_THUMB: w=150&h=120}</span>';
$GALLERY_TEMPLATE['prettyphoto']['content'] = '
<div class="pp_pic_holder">
<div class="ppt">&nbsp;</div>
<div class="pp_top">
<div class="pp_left"></div>
<div class="pp_middle"></div>
<div class="pp_right"></div>
</div>
<div class="pp_content_container">
<div class="pp_left">
<div class="pp_right">
<div class="pp_content">
<div class="pp_loaderIcon"></div>
<div class="pp_fade">
<a href="#" class="pp_expand" title="Expand the image">' . LAN_EXPAND . '</a>
<div class="pp_hoverContainer">
<a class="pp_next" href="#">' . LAN_NEXT . '</a>
<a class="pp_previous" href="#">' . LAN_PREVIOUS . '</a>
</div>
<div id="pp_full_res"></div>
<div class="pp_details">
<div class="pp_nav">
<a href="#" class="pp_arrow_previous">' . LAN_PREVIOUS . '</a>
<p class="currentTextHolder">0/0</p>
<a href="#" class="pp_arrow_next">' . LAN_NEXT . '</a>
</div>
<p class="pp_description"></p>
{pp_social}
<a class="pp_close" href="#">' . LAN_CLOSE . '</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="pp_bottom">
<div class="pp_left"></div>
<div class="pp_middle"></div>
<div class="pp_right"></div>
</div>
</div>
<div class="pp_overlay"></div>
';
?>
$GALLERY_TEMPLATE['prettyphoto']['gallery_item'] = '
<div class="pp_gallery">
<a href="#" class="pp_arrow_previous">' . LAN_PREVIOUS . '</a>
<div>
<ul>
{gallery}
</ul>
</div>
<a href="#" class="pp_arrow_next">' . LAN_NEXT . '</a>
</div>
';
$GALLERY_TEMPLATE['prettyphoto']['image_item'] = '
<img id="fullResImage" src="{path}" />
';
$GALLERY_TEMPLATE['prettyphoto']['flash_item'] = '
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}">
<param name="wmode" value="{wmode}" />
<param name="allowfullscreen" value="true" />
<param name="allowscriptaccess" value="always" />
<param name="movie" value="{path}" />
<embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed>
</object>
';
$GALLERY_TEMPLATE['prettyphoto']['quicktime_item'] = '
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}">
<param name="src" value="{path}">
<param name="autoplay" value="{autoplay}">
<param name="type" value="video/quicktime">
<embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed>
</object>
';
$GALLERY_TEMPLATE['prettyphoto']['iframe_item'] = '
<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>
';
$GALLERY_TEMPLATE['prettyphoto']['inline_item'] = '
<div class="pp_inline">{content}</div>
';
$GALLERY_TEMPLATE['prettyphoto']['custom_item'] = '';
$GALLERY_TEMPLATE['prettyphoto']['social_item'] = '
<div class="pp_social">
<div class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-count="none">' . LAN_SHARE . '</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</div>
<div class="facebook">
<iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href=\'+location.href+\'&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe>
</div>
</div>
';

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',
// allow only mapped vars - cat and frm parameters to be passed
'<cat:{galleryCat}>' => array('index/list', 'mapVars' => array('media_cat_sef' => 'cat', 'from' => 'frm')),
)
'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')),
)
);
}
/**
* 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;
}
}

View File

@ -251,6 +251,24 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
}
};
/**
* Check if the selector is valid.
*
* @param selector
* @returns {boolean}
*/
e107.callbacks.isValidSelector = function (selector)
{
try
{
var $element = $(selector);
} catch(error)
{
return false;
}
return true;
};
/**
* Dynamic next/prev.
*

View File

@ -23,7 +23,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
e107.behaviors.initializeSmoothScrolling = {
attach: function (context, settings)
{
if(window.location.hash)
if(window.location.hash && e107.callbacks.isValidSelector(window.location.hash))
{
$(context).find('body').once('initialize-smooth-scrolling').each(function ()
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -47,10 +47,11 @@ if(e_AJAX_REQUEST)
{
if(vartrue($_POST['q']))
{
$q = filter_var($_POST['q'], FILTER_SANITIZE_STRING);
$l = vartrue($_POST['l']) ? intval($_POST['l']) : 10;
$db = e107::getDb();
$tp = e107::getParser();
$q = $tp->filter($_POST['q']);
$l = vartrue($_POST['l']) ? intval($_POST['l']) : 10;
$where = "user_name LIKE '". $q."%' ";
@ -70,8 +71,8 @@ if(e_AJAX_REQUEST)
if(count($data))
{
header('Content-type: application/json');
echo json_encode($data);
$ajax = e107::getAjax();
$ajax->response($data);
}
}
}