Beispiel #1
0
 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;
 }
} elseif ($action == 'load_structure') {
    include RMTemplate::get()->get_template('other/gs_for_editor.php', 'module', 'galleries');
    die;
} elseif ($action == 'load_included') {
    if (!$xoopsSecurity->checkReferer()) {
        die;
    }
    $set = rmc_server_var($_POST, 'set', 0);
    $page = rmc_server_var($_POST, 'page', 1);
    $limit = rmc_server_var($_POST, 'limit', 0);
    $full = true;
    if ($set <= 0 || $limit <= 0) {
        die;
    }
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php';
    $data = GSFunctions::load_images($set, $limit, $page);
    if (empty($data)) {
        die;
    }
    $images = $data['images'];
    // Pagination
    $page = $data['current'];
    $limit = $data['limit'];
    $num = $data['total'];
    $set = $data['set'];
    $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);
    include RMTemplate::get()->get_template('other/gs_gals_inclusion.php', 'module', 'galleries');
    die;
}