protected function getInput() { $writeable = '<b><font color="green">' . JText::_('COM_BIDS_WRITABLE') . '</font></b>'; $unwriteable = '<b><font color="red">' . JText::_('COM_BIDS_UNWRITABLE') . '</font></b>'; $template_dir = $unwriteable; if (is_writable(AUCTION_TEMPLATE_CACHE)) { $template_dir = $writeable; } jimport('joomla.filesystem.folder'); $cache_files = JFolder::files(AUCTION_TEMPLATE_CACHE); $cache_size = 0; $nr_files = 0; $last_cached = $first_cached = JText::_("COM_BIDS_NOTHING_CACHED"); if (is_array($cache_files)) { $last_cached = 0; $first_cached = 0; foreach ($cache_files as $file) { $cache_size += filesize(AUCTION_TEMPLATE_CACHE . DS . $file); $last_cached = $last_cached ? max($last_cached, date("d M Y H:i:s", filemtime(AUCTION_TEMPLATE_CACHE . DS . $file))) : date("d M Y H:i:s", filemtime(AUCTION_TEMPLATE_CACHE . DS . $file)); $first_cached = $first_cached ? max($first_cached, date("d M Y H:i:s", filemtime(AUCTION_TEMPLATE_CACHE . DS . $file))) : date("d M Y H:i:s", filemtime(AUCTION_TEMPLATE_CACHE . DS . $file)); } $nr_files = count($cache_files); } $cache_size = sprintf("%.2f kB", $cache_size / 1024); $dir = AUCTION_TEMPLATE_CACHE; if (!Jfolder::exists($dir)) { $cache_text = JText::_("COM_BIDS_CREATE_CACHE_FILE"); } else { $cache_text = JText::_("COM_BIDS_PURGE_CACHE_FILE"); } $html = "\r\n <table class='adminlist'>\r\n <tr>\r\n <td class='paramlist_key'>" . JText::_("COM_BIDS_SMARTY_TEMPLATE_CACHE_DIRECTORY") . "</td>\r\n <td>{$template_dir}</td>\r\n </tr>\r\n <tr>\r\n <td class='paramlist_key'>" . JText::_("COM_BIDS_NR_FILES_CACHED") . "</td>\r\n <td>{$nr_files}</td>\r\n </tr>\r\n <tr>\r\n <td class='paramlist_key'>" . JText::_("COM_BIDS_CACHE_SIZE") . "</td>\r\n <td>{$cache_size}</td>\r\n </tr>\r\n <tr>\r\n <td class='paramlist_key'>" . JText::_("COM_BIDS_LATEST_CACHED_FILE_ON") . "</td>\r\n <td>{$last_cached}</td>\r\n </tr>\r\n <tr>\r\n <td class='paramlist_key'>" . JText::_("COM_BIDS_OLDEST_CACHED_FILE_ON") . "</td>\r\n <td>{$first_cached}</td>\r\n </tr>\r\n <tr>\r\n <td colspan='2'>\r\n <a href='index.php?option=" . APP_EXTENSION . "&task=purgecache'>" . $cache_text . "</a>\r\n </td>\r\n </tr>\r\n </table>\r\n "; return $html; }
public function getPrettyPhoto($type, $source, $width = 50, $height = 50, $option = 'smart', $quality = 90, $theme = 'facebook', $padding = 10, $opacity = '0.8', $title = false, $speed = 'normal', $user = false, $apikey = false, $setid = false, $number = false, $extlink) { // Import libraries jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); //define variables $show_title = $title === false ? false : true; $html = ''; switch ($type) { case 'popup': if (Jfile::exists($source) === false) { return; } $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $resized = resizeImageHelper::getResizedImage($source, $width, $height, $option, $quality); $html .= '<a href="' . $source . '" rel="prettyPhoto" title="' . $title . '"><img src="' . $resized . '" class="thumbnail" alt="' . $title . '" border="0" title="' . $title . '"></a>'; break; case "iframe": //if (Jfile::exists($source)===false){return;} //if (Jfile::exists($source)===false){return;} //define variables $show_title = $title === false ? false : true; $extlink = 'http://' . str_replace('http://', '', trim($extlink)); $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto[iframes]\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $resized = resizeImageHelper::getResizedImage($source, $width, $height, $option, $quality); $html .= '<a href="' . $extlink . '?iframe=true&width=100%&height=100%" rel="prettyPhoto[iframes]" title="' . $title . '"><img src="' . $resized . '" class="thumbnail" alt="' . $title . '" border="0" title="' . $title . '"></a>'; break; case "inline": $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto[inline]\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $html .= '<div class="pp_inline clearfix">{content}</div>'; $html .= '<a href="#inline-1" rel="prettyPhoto" ><img src="/wp-content/themes/NMFE/images/thumbnails/earth-logo.jpg" alt="" width="50" /></a> <div id="inline-1" class="hide"> <p>This is inline content opened in prettyPhoto.</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p></div> </div>'; break; case "quicktime": $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $html .= '<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>'; break; case "flash": $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $html .= '<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>'; break; case "flickr": $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; break; case "picasa": $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; break; case "gallery": if (Jfolder::exists($source) === false) { return; } $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $html .= '<div class="pp_gallery"> <a href="#" class="pp_arrow_previous">Previous</a> <ul> {gallery} </ul> <a href="#" class="pp_arrow_next">Next</a> </div>'; break; case "slideshow": if (Jfolder::exists($source) === false) { return; } $html .= '<script type="text/javascript" charset="utf-8"> (function($) { $(document).ready(function(){ $("a[rel^=\'prettyPhoto\']").prettyPhoto({ animation_speed: "' . $speed . '", slideshow: false, autoplay_slideshow: false, opacity: "' . $opacity . '", show_title: "' . $show_title . '", allow_resize: true, default_width: 500, default_height: 350, counter_separator_label: "/", theme: "' . $theme . '", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true }); })})(jQuery);</script>'; $html .= '<div class="pp_pic_holder"> <div class="ppt"> </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">Expand</a> <div class="pp_hoverContainer"> <a class="pp_next" href="#">next</a> <a class="pp_previous" href="#">previous</a> </div> <div id="pp_full_res"></div> <div class="pp_details clearfix"> <p class="pp_description"></p> <a class="pp_close" href="#">Close</a> <div class="pp_nav"> <a href="#" class="pp_arrow_previous">Previous</a> <p class="currentTextHolder">0/0</p> <a href="#" class="pp_arrow_next">Next</a> </div> </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>'; break; } return $html; }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->filter->client_id = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.client_id', 'client_id', 2, 'int'); $pageInfo->filter->template = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.template', 'template', '', 'string'); $pageInfo->filter->component = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.component', 'component', '', 'string'); $pageInfo->filter->viewType = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.viewType', 'viewType', '', 'string'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.limit', 'limit', $app->getCfg('list_limit'), 'int'); if (empty($pageInfo->limit->value)) { $pageInfo->limit->value = 500; } if (JRequest::getVar('search') != $app->getUserState($this->paramBase . ".search")) { $app->setUserState($this->paramBase . '.limitstart', 0); $pageInfo->limit->start = 0; } else { $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); } $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . '.search', 'search', '', 'string'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . '.filter_order', 'filter_order', 'a.user_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . '.filter_order_Dir', 'filter_order_Dir', 'desc', 'word'); $views = array(); switch ($pageInfo->filter->client_id) { case 0: $views[0] = HIKASHOP_FRONT . 'views' . DS; break; case 1: $views[1] = HIKASHOP_BACK . 'views' . DS; break; default: $views[0] = HIKASHOP_FRONT . 'views' . DS; $views[1] = HIKASHOP_BACK . 'views' . DS; break; } JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $pluginViews = array(); $dispatcher->trigger('onViewsListingFilter', array(&$pluginViews, $pageInfo->filter->client_id)); if (!empty($pluginViews)) { $i = 2; foreach ($pluginViews as $pluginView) { $views[$i++] = $pluginView; } } $this->assignRef('pluginViews', $pluginViews); jimport('joomla.filesystem.folder'); if (version_compare(JVERSION, '1.6', '<')) { require_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_templates' . DS . 'helpers' . DS . 'template.php'; } $templates = array(); $templateValues = array(); foreach ($views as $client_id => $view) { $component_name = ''; $component = HIKASHOP_COMPONENT; if (is_array($view)) { $client_id = $view['client_id']; $component_name = $view['name']; $component = $view['component']; $view = $view['view']; } if (!empty($pageInfo->filter->component) && $pageInfo->filter->component != $component) { continue; } $folders = JFolder::folders($view); if (empty($folders)) { continue; } $clientTemplates = array(); foreach ($folders as $folder) { if (JFolder::exists($view . $folder . DS . 'tmpl')) { $files = JFolder::files($view . $folder . DS . 'tmpl'); if (!empty($files)) { foreach ($files as $file) { if (substr($file, -4) == '.php') { $obj = new stdClass(); $obj->path = $view . $folder . DS . 'tmpl' . DS . $file; $obj->filename = $file; $obj->folder = $view . $folder . DS . 'tmpl' . DS; $obj->client_id = $client_id; $obj->view = $folder; $obj->type = 'component'; $obj->type_name = $component; $obj->file = substr($file, 0, strlen($file) - 4); $clientTemplates[] = $obj; } } } } } if ($client_id == 0 && $component == HIKASHOP_COMPONENT) { $plugins_folder = rtrim(JPATH_PLUGINS, DS) . DS . 'hikashoppayment'; if (Jfolder::exists($plugins_folder)) { $files = Jfolder::files($plugins_folder); foreach ($files as $file) { if (preg_match('#^.*_(?!configuration).*\\.php$#', $file)) { $obj = new stdClass(); $obj->path = $plugins_folder . DS . $file; $obj->filename = $file; $obj->folder = $plugins_folder; $obj->client_id = $client_id; $obj->type = 'plugin'; $obj->view = ''; $obj->type_name = 'hikashoppayment'; $obj->file = substr($file, 0, strlen($file) - 4); $clientTemplates[] = $obj; } } } } if (!empty($clientTemplates)) { $client = JApplicationHelper::getClientInfo($client_id); $tBaseDir = $client->path . DS . 'templates'; if (version_compare(JVERSION, '1.6', '<')) { $joomlaTemplates = TemplatesHelper::parseXMLTemplateFiles($tBaseDir); } else { $query = 'SELECT * FROM ' . hikashop_table('extensions', false) . ' WHERE type=\'template\' AND client_id=' . (int) $client_id; $db = JFactory::getDBO(); $db->setQuery($query); $joomlaTemplates = $db->loadObjectList(); foreach ($joomlaTemplates as $k => $v) { $joomlaTemplates[$k]->assigned = $joomlaTemplates[$k]->protected; $joomlaTemplates[$k]->published = $joomlaTemplates[$k]->enabled; $joomlaTemplates[$k]->directory = $joomlaTemplates[$k]->element; } } for ($i = 0; $i < count($joomlaTemplates); $i++) { if (version_compare(JVERSION, '1.6', '<')) { $joomlaTemplates[$i]->assigned = TemplatesHelper::isTemplateAssigned($joomlaTemplates[$i]->directory); $joomlaTemplates[$i]->published = TemplatesHelper::isTemplateDefault($joomlaTemplates[$i]->directory, $client->id); } if ($joomlaTemplates[$i]->published || $joomlaTemplates[$i]->assigned) { if (!empty($pageInfo->filter->template) && $joomlaTemplates[$i]->directory != $pageInfo->filter->template) { continue; } $templateValues[$joomlaTemplates[$i]->directory] = $joomlaTemplates[$i]->directory; $templateFolder = $tBaseDir . DS . $joomlaTemplates[$i]->directory . DS; foreach ($clientTemplates as $template) { $templatePerJoomlaTemplate = clone $template; $templatePerJoomlaTemplate->template = $joomlaTemplates[$i]->directory; $templatePerJoomlaTemplate->component = $component_name; $templatePerJoomlaTemplate->override = $templateFolder . 'html' . DS . $template->type_name . DS; if ($template->type == 'component') { $templatePerJoomlaTemplate->override .= $template->view . DS; } $templatePerJoomlaTemplate->override .= $template->filename; $templatePerJoomlaTemplate->overriden = false; if (file_exists($templatePerJoomlaTemplate->override)) { $templatePerJoomlaTemplate->overriden = true; } $templatePerJoomlaTemplate->id = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename; $key = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename; if (!empty($pageInfo->filter->viewType) && $templatePerJoomlaTemplate->view != $pageInfo->filter->viewType) { continue; } $templates[$key] = $templatePerJoomlaTemplate; } if (JFolder::exists($templateFolder . 'html' . DS . $component . DS)) { $folders = JFolder::folders($templateFolder . 'html' . DS . $component . DS); if (!empty($folders)) { foreach ($folders as $folder) { $files = JFolder::files($templateFolder . 'html' . DS . $component . DS . $folder); if (empty($files)) { continue; } foreach ($files as $file) { if (substr($file, -4) != '.php') { continue; } $filename = $templateFolder . 'html' . DS . $component . DS . $folder . DS . $file; $found = false; foreach ($templates as $tpl) { if ($tpl->override == $filename) { $found = true; break; } } if (!$found) { $obj = new stdClass(); $obj->path = $view . $folder . DS . 'tmpl' . DS . $file; $obj->filename = $file; $obj->folder = $view . $folder . DS . 'tmpl' . DS; $obj->client_id = $client_id; $obj->view = $folder; $obj->template = $joomlaTemplates[$i]->directory; $obj->type = 'component'; $obj->type_name = $component; $obj->file = substr($file, 0, strlen($file) - 4); $obj->override = $filename; $obj->overriden = true; $obj->id = $obj->client_id . '|' . $obj->template . '|' . $obj->type . '|' . $obj->type_name . '|' . $obj->view . '|' . $obj->filename; $key = $obj->client_id . '|' . $obj->template . '|' . $obj->view . '|' . $obj->filename; $templates[$key] = $obj; } } } } } } } } } ksort($templates); $searchMap = array('filename', 'view', 'template'); if (!empty($pageInfo->search)) { $unset = array(); foreach ($templates as $k => $template) { $found = false; foreach ($searchMap as $field) { if (strpos($template->{$field}, $pageInfo->search) !== false) { $found = true; } } if (!$found) { $unset[] = $k; } } if (!empty($unset)) { foreach ($unset as $u) { unset($templates[$u]); } } $templates = hikashop_search($pageInfo->search, $templates, 'id'); } $viewTypes = array('0' => JHTML::_('select.option', 0, JText::_('ALL_VIEWS'))); foreach ($templates as $temp) { if (!isset($viewTypes[strip_tags($temp->view)]) && !empty($temp->view)) { $viewTypes[strip_tags($temp->view)] = JHTML::_('select.option', strip_tags($temp->view), strip_tags($temp->view)); } } $pageInfo->elements = new stdClass(); $pageInfo->elements->total = count($templates); if ($pageInfo->limit->value == 500) { $pageInfo->limit->value = 100; } $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); $templates = array_slice($templates, $this->pagination->limitstart, $this->pagination->limit); $pageInfo->elements->page = count($templates); $this->assignRef('viewTypes', $viewTypes); $this->assignRef('rows', $templates); $this->assignRef('templateValues', $templateValues); $viewType = hikashop_get('type.view'); $this->assignRef('viewType', $viewType); $templateType = hikashop_get('type.template'); $this->assignRef('templateType', $templateType); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_view_manage', 'all')); $this->assignRef('manage', $manage); $delete = hikashop_isAllowed($config->get('acl_view_delete', 'all')); $this->assignRef('delete', $delete); $this->toolbar = array(array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); jimport('joomla.client.helper'); $ftp = JClientHelper::setCredentialsFromRequest('ftp'); $this->assignRef('ftp', $ftp); }