/** * Replaces all ocrrencies for lightbox with the apropiate code * @param string $output XOOPS output * @return string $text Output converted */ public function eventRmcommonEndFlush($output) { if (defined('XOOPS_CPFUNC_LOADED')) { return $output; } $pattern = "/\\[lightbox=(['\"]?)([^\"'<>]*)\\1](.*)\\[\\/lightbox\\]/sU"; $text = preg_replace_callback($pattern, 'found_lightbox', $output); $pattern = "/\\[lightbox](.*)\\[\\/lightbox\\]/sU"; $text = preg_replace_callback($pattern, 'found_lightbox', $output); if (RMLightbox::get()->elements) { $text = str_replace("<!--LightBoxPlugin-->", RMLightbox::get()->render(), $text); } return $text; }
/** * Get image data */ public function process_image_data($result) { $mc = RMUtilities::module_config('galleries'); $users = array(); $ret = array(); $tf = new RMTimeFormatter(0, "%M%/%d%/%Y%"); $db = Database::getInstance(); $i = 0; while ($row = $db->fetchArray($result)) { $img = new GSImage(); $img->assignVars($row); if (!isset($users[$img->owner()])) { $users[$img->owner()] = new GSUser($img->owner(), 1); } $imglink = $users[$img->owner()]->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/' : '&img=' . $img->id()); $ret[$i] = array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $users[$img->owner()]->filesURL() . '/ths/' . $img->image(), 'thumbuser' => $users[$img->owner()]->filesURL() . '/' . ($mc['user_format_mode'] ? 'formats/user_' : 'ths/') . $img->image(), 'thumbsrh' => $users[$img->owner()]->filesURL() . '/' . ($mc['search_format_mode'] ? 'formats/srh_' : 'ths/') . $img->image(), 'image' => $users[$img->owner()]->filesURL() . '/' . $img->image(), 'by' => sprintf(__('by %s', 'galleries'), '<a href="' . $users[$img->owner()]->userUrl() . '">' . $users[$img->owner()]->uname() . '</a>'), 'link' => $imglink, 'created' => $tf->format($img->created()), 'public' => $img->isPublic(), 'desc' => $img->desc()); // Format resize if (!$img->userFormat() && $mc['user_format_mode']) { $format = $mc['user_format_values']; GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/user_' . $img->image(), $format[1], $format[2]); $img->setUserFormat(1, 1); } if (!$img->searchFormat() && $mc['search_format_mode']) { $format = $mc['search_format_values']; GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/srh_' . $img->image(), $format[1], $format[2]); $img->setSearchFormat(1, 1); } if ($mc['search_format_mode']) { $ret[$i]['viewmore'] = sprintf(__('Ver <a href="%s">más fotos</a>.', 'galleries'), $users[$img->owner()]->userURL()); $ret[$i]['avatar'] = RMEvents::get()->run_event('rmcommon.get.avatar', $users[$img->owner()]->userVar('email'), 0, $users[$img->owner()]->userVar('user_avatar')); $tags = $img->tags(true); $tagurl = self::get_url() . ($mc['urlmode'] ? 'explore/tags/tag/' : '?explore=tags&tag='); $strtag = ''; foreach ($tags as $tag) { $strtag .= $strtag == '' ? "<a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>" : ", <a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>"; } $ret[$i]['tags'] = $strtag; } $i++; } RMTemplate::get()->add_local_script('photos.js', 'galleries'); if (!$mc['quickview']) { return $ret; } if (RMFunctions::plugin_installed('lightbox')) { RMLightbox::get()->add_element('.pic_qview a'); RMLightbox::get()->render(); } return $ret; }
static function eventRmcommonBaseLoaded() { include_once RMCPATH . '/plugins/lightbox/lightbox.php'; RMLightbox::get(); RMCustomCode::get()->add('lightbox', 'render_lightbox_element'); }
/** * Function to handle matches from preg_replace_callback */ function render_lightbox_element($atts, $content) { extract(RMCustomCode::get()->atts($atts, array('rel' => '', 'name' => 'lightbox-container'))); $ret = '<div class="' . $name . '">' . $content . '</div>'; RMLightbox::get()->add_element(".{$name} > a"); if ($rel != '') { RMLightbox::get()->add_option('rel', $rel); } return '<div class="lightbox-container">' . (isset($matches[3]) ? $matches[3] : $matches[1]) . '</div>'; }
// Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- $product = new ShopProduct($id); if ($product->isNew()) { ShopFunctions::error404(); } $xoopsOption['template_main'] = 'shop_product.html'; include 'header.php'; $tf = new RMTimeFormatter(0, '%d%/%T%/%Y%'); $sf = new ShopFunctions(); // Product data $xoopsTpl->assign('product', array('name' => $product->getVar('name'), 'description' => $product->getVar('description'), 'price' => $product->getVar('price') > 0 ? sprintf(__('Price: <strong>%s</strong>', 'shop'), sprintf($xoopsModuleConfig['format'], number_format($product->getVar('price'), 2))) : '', 'buy' => $sf->get_buy_link($product), 'type' => $product->getVar('type'), 'stock' => $product->getVar('available'), 'image' => $product->getVar('image'), 'created' => sprintf(__('Since: <strong>%s</strong>', 'shop'), $tf->format($product->getVar('created'))), 'updated' => $product->getVar('modified') > 0 ? sprintf(__("Updated: <strong>%s</strong>", 'shop'), $tf->format($product->getVar('modified'))) : '', 'link' => $product->permalink(), 'metas' => $product->get_meta(), 'images' => $product->get_images())); $product->setVar('hits', $product->getVar('hits') + 1); $product->save(); $options = array('<a href="' . ShopFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'contact/' . $product->getVar('nameid') . '/' : '?contact=' . $product->id()) . '">' . __('Request Information', 'shop') . '</a>'); $options = RMEvents::get()->run_event('shop.product.options', $options); $xoopsTpl->assign('options', $options); $xoopsTpl->assign('product_details', 1); $xoopsTpl->assign('xoops_pagetitle', $product->getVar('name') . ' » ' . $xoopsModuleConfig['modtitle']); $xoopsTpl->assign('lang_instock', __('In stock', 'shop')); $xoopsTpl->assign('lang_outstock', __('Out of stock', 'shop')); $xoopsTpl->assign('lang_buy', __('Buy Now!', 'shop')); RMTemplate::get()->add_style('main.css', 'shop'); // Now minishop will use lightbox plugin for Common Utilities if (RMFunctions::plugin_installed('lightbox')) { RMLightbox::get()->add_element('.prod_thumbs a'); RMLightbox::get()->render(); } include 'footer.php';
/** * Show all images existing in database */ function show_images() { global $xoopsModule, $xoopsModuleConfig; $db = Database::getInstance(); // Check if some category exists $catnum = RMFunctions::get_num_records("rmc_img_cats"); if ($catnum <= 0) { redirectMsg('images.php?action=newcat', __('There are not categories yet! Please create one in order to add images.', 'rmcommon'), 1); die; } $cat = rmc_server_var($_GET, 'category', 0); if ($cat <= 0) { header('location: images.php?action=showcats'); die; } $sql = "SELECT COUNT(*) FROM " . $db->prefix("rmc_images"); if ($cat > 0) { $sql .= " WHERE cat='{$cat}'"; } /** * Paginacion de Resultados */ $page = rmc_server_var($_GET, 'page', 1); $limit = $xoopsModuleConfig['imgsnumber']; list($num) = $db->fetchRow($db->query($sql)); $tpages = ceil($num / $limit); $page = $page > $tpages ? $tpages : $page; $start = $num <= 0 ? 0 : ($page - 1) * $limit; $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url('images.php?' . ($cat > 0 ? 'category=' . $cat : '') . '&page={PAGE_NUM}'); // Get categories $sql = "SELECT * FROM " . $db->prefix("rmc_images") . " " . ($cat > 0 ? "WHERE cat='{$cat}'" : '') . " ORDER BY id_img DESC LIMIT {$start},{$limit}"; $result = $db->query($sql); $images = array(); $categories = array(); $authors = array(); $category = new RMImageCategory($cat); $sizes = $category->getVar('sizes'); $current_size = array(); foreach ($sizes as $size) { if (empty($current_size)) { $current_size = $size; } else { if ($current_size['width'] >= $size['width'] && $size['width'] > 0) { $current_size = $size; } } } while ($row = $db->fetchArray($result)) { $img = new RMImage(); $img->assignVars($row); if (!isset($categories[$img->getVar('cat')])) { $categories[$img->getVar('cat')] = new RMImageCategory($img->getVar('cat')); } if (!isset($authors[$img->getVar('uid')])) { $authors[$img->getVar('uid')] = new XoopsUser($img->getVar('uid')); } $fd = pathinfo($img->getVar('file')); $images[] = array('id' => $img->id(), 'title' => $img->getVar('title'), 'date' => $img->getVar('date'), 'desc' => $img->getVar('desc', 'n'), 'cat' => $categories[$img->getVar('cat')]->getVar('name'), 'author' => $authors[$img->getVar('uid')], 'file' => XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/sizes/' . $fd['filename'] . '_' . $current_size['width'] . 'x' . $current_size['height'] . '.' . $fd['extension'], 'big' => XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/' . $fd['filename'] . '.' . $fd['extension']); } $categories = RMFunctions::load_images_categories(); if (RMFunctions::plugin_installed('lightbox')) { RMLightbox::get()->add_element('#list-images a.bigimages'); RMLightbox::get()->render(); } xoops_cp_header(); RMFunctions::create_toolbar(); RMTemplate::get()->add_style('imgmgr.css', 'rmcommon'); RMTemplate::get()->add_style('general.css', 'rmcommon'); RMTemplate::get()->add_script('include/js/jquery.checkboxes.js'); include RMTemplate::get()->get_template('images_images.php', 'module', 'rmcommon'); xoops_cp_footer(); }
public function eventRmcommonTextTodisplay($text, $source) { if (defined("XOOPS_CPFUNC_LOADED")) { return $text; } $search = "/\\[gallery (.*?)\\]/is"; $replace = "\$1"; $amatches = array(); $count = preg_match_all($search, $text, $amatches); if ($count <= 0) { return $text; } for ($ic = 0; $ic < $count; $ic++) { $matches = array($amatches[0][$ic], $amatches[1][$ic]); $search = explode(" ", strip_tags($matches[1])); foreach ($search as $i) { $t = explode("=", $i); ${$t}[0] = $t[1]; } include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php'; $data = GSFunctions::load_images($id, $num, 1); if (empty($data)) { $text = str_replace($matches[0], '', $text); continue; } $images = $data['images']; if (!defined("GS_INCLUDED_GALS")) { if (RMFunctions::plugin_installed("lightbox")) { RMLightbox::get()->add_element('.gs_gsl_item a'); RMLightbox::get()->render(); } RMTemplate::get()->add_xoops_style('inclusion.css', 'galleries'); RMTemplate::get()->add_local_script('inclusion.js', 'galleries'); RMTemplate::get()->add_head('<script type="text/javascript">var gsurl = "' . XOOPS_URL . '/modules/galleries";</script>'); define("GS_INCLUDED_GALS", 1); } // Pagination $page = $data['current']; $limit = $data['limit']; $num = $data['total']; $set = $data['set']; if ($full == 'true') { $nav = new RMPageNav($num, $limit, $page); $nav->set_template(RMTemplate::get()->get_template("other/gs_nav_included.php", "module", "galleries")); $nav->target_url($set['id'] . ',' . $limit); } $content = ''; ob_start(); echo '<div class="gals_loader">'; include RMTemplate::get()->get_template('other/gs_gals_inclusion.php', 'module', 'galleries'); echo '</div>'; $content = ob_get_clean(); $text = str_replace($matches[0], $content, $text); } return $text; }
/** * Function to handle matches from preg_replace_callback */ function found_lightbox($matches) { RMLightbox::get()->add_element('.lightbox_container ' . (isset($matches[2]) != '' ? $matches[2] : 'a')); return '<div class="lightbox_container">' . (isset($matches[3]) ? $matches[3] : $matches[1]) . '</div>'; }
/** * Function to handle matches from preg_replace_callback */ function render_lightbox_element($atts, $content) { $settings = RMSettings::plugin_settings('lighbox', true); $options = RMCustomCode::get()->atts($atts, array('rel' => 'false', 'name' => 'lightbox-container', 'transition' => $settings->transition, 'speed' => $settings->speed, 'maxWidth' => $settings->width, 'maxHeight' => $settings->height, 'scalePhotos' => $settings->scale ? 'true' : 'false', 'slideshow' => $settings->slideshow ? 'true' : 'false', 'slideshowSpeed' => $settings->slspeed, 'slideshowAuto' => $settings->slauto ? 'true' : 'false', 'slideshowStart' => __('Start Slideshow', 'lightbox'), 'slideshowStop' => __('Stop Slideshow', 'lightbox'))); $ret = '<div class="' . $options['name'] . '">' . $content . '</div>'; RMLightbox::get()->add_element(".{$options['name']} > a"); foreach ($options as $option => $value) { RMLightbox::get()->add_option($option, $value); } return $ret; }
$xoopsTpl->assign('lang_published', __('Published on:', 'dtransport')); $xoopsTpl->assign('lang_downopts', __('Download Options', 'dtransport')); $xoopsTpl->assign('lang_details', __('Details', 'dtransport')); $xoopsTpl->assign('lang_logs', __('Logs', 'dtransport')); $xoopsTpl->assign('lang_features', __('Features', 'dtransport')); $xoopsTpl->assign('lang_choose', __('You can choose between next download options if you prefer another file type or another location.', 'dtransport')); // Download options labels $xoopsTpl->assign('lang_title', __('Title', 'dtransport')); $xoopsTpl->assign('lang_size', __('Size', 'dtransport')); $xoopsTpl->assign('lang_hits', __('Hits', 'dtransport')); $xoopsTpl->assign('xoops_pagetitle', $item->getVar('name') . ($item->getVar('version') != '' ? " " . $item->getVar('version') : '') . " » " . $xoopsModule->name()); // Ubicación Actual //$location = "<strong>"._MS_DT_YOUREHERE."</strong> <a href='".DT_URL."'>".$xoopsModule->name()."</a> » "; $location .= " » <strong>" . $item->getVar('name') . "</strong>"; $xoopsTpl->assign('dt_location', $location); $tpl->add_xoops_style('main.css', 'dtransport'); $tpl->add_local_script('main.js', 'dtransport'); $metas = $data['metas']; $rmf->add_keywords_description(isset($metas['description']) ? $metas['description'] : $item->getVar('shortdesc'), isset($metas['keywords']) ? $metas['keywords'] : ''); // Lightbox plugins if ($rmf->plugin_installed("lightbox")) { $lightbox = RMLightbox::get(); $lightbox->add_element("a.item-images"); $lightbox->add_element("#dt-item-features a"); $lightbox->render(); } // Comments $rmf->get_comments('dtransport', 'item=' . $item->id(), 'module', 0, null, true); // Comments form RMFunctions::comments_form('dtransport', 'item=' . $item->id(), 'module', DT_PATH . '/class/dtransportcontroller.php'); include 'footer.php';