Ejemplo n.º 1
0
 function nggSmoothFrame($info)
 {
     global $data_ngs;
     if ($info["width"] == "") {
         $info["width"] = $data_ngs["width"];
     }
     if ($info["height"] == "") {
         $info["height"] = $data_ngs["height"];
     }
     $frame_url = "/wp-content/plugins/" . plugin_basename(dirname(__FILE__)) . "/nggSmoothFrame.php?galleryID=" . $info["galleryID"] . "&width=" . $info["width"] . "&height=" . $info["height"] . "&timed=" . $info["timed"] . "&showArrows=" . $info["showArrows"] . "&showCarousel=" . $info["showCarousel"] . "&embedLinks=" . $info["embedLinks"] . "&delay=" . $info["delay"] . "&defaultTransition=" . $info["defaultTransition"] . "&showInfopane=" . $info["showInfopane"] . "&textShowCarousel=" . $info["textShowCarousel"] . "&showCarouselOpen=" . $info["showCarouselOpen"] . "&margin=&align=";
     // margin and align goes to the IFrame
     // Increases frame width and height by 3px in order to display the complete image on the inside.
     return "<p style=\"" . nggSmoothAlign($info['align'], $info['margin'], "iframe") . "\">\n              <iframe width=\"" . ($info["width"] + 3) . "px\" height=\"" . ($info["height"] + 3) . "px\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" frameborder=\"0\" name=\"smooth_frame_" . rand() . "\" src=\"" . BASE_URL . $frame_url . "\"></iframe>\n            </p>";
 }
function nggSmoothShow($info, $pictures = null)
{
    global $wpdb, $data_ngs_default;
    $info = array_merge($data_ngs_default, $info);
    extract($info);
    // Get the pictures
    if ($galleryID) {
        $ngg_options = get_option('ngg_options');
        $pictures = $wpdb->get_results("SELECT t.*, tt.* FROM {$wpdb->nggallery} AS t INNER JOIN {$wpdb->nggpictures} AS tt ON t.gid = tt.galleryid WHERE t.gid = '{$galleryID}' AND tt.exclude != 1 ORDER BY tt.{$ngg_options['galSort']} {$ngg_options['galSortDir']} ");
        $final = array();
        foreach ($pictures as $picture) {
            $aux = array();
            $aux["title"] = $picture->alttext;
            // $picture->alttext;
            $aux["desc"] = $picture->description;
            $aux["link"] = BASE_URL . "/" . $picture->path . "/" . $picture->filename;
            $aux["img"] = BASE_URL . "/" . $picture->path . "/" . $picture->filename;
            $aux["thumb"] = BASE_URL . "/" . $picture->path . "/thumbs/thumbs_" . $picture->filename;
            $final[] = $aux;
        }
        $pictures = $final;
    } else {
        $galleryID = rand();
    }
    if (empty($pictures)) {
        return "";
    }
    // Gather pictures and Smooth Gallery
    $out = '<script type="text/javascript">
            function startGallery_' . $galleryID . '() { 
              var myGallery = new gallery($("myGallery_' . $galleryID . '"), {  ';
    // Leave a blank space in case there is no last comma to be removed later
    $out .= "                timed: " . ($timed ? 'true' : 'false') . ",";
    $out .= "         showCarousel: " . ($showCarousel ? 'true' : 'false') . ",";
    $out .= "         showInfopane: " . ($showInfopane ? 'true' : 'false') . ",";
    $out .= "           showArrows: " . ($showArrows ? 'true' : 'false') . ",";
    $out .= "           embedLinks: " . ($embedLinks ? 'true' : 'false') . ",";
    $out .= " slideInfoZoneOpacity: 0.80,";
    if ($timed) {
        if ($delay) {
            $out .= " delay: {$delay},";
        }
        if ($defaultTransition) {
            $out .= " defaultTransition: \"{$defaultTransition}\",";
        }
    }
    if ($showCarousel) {
        if ($textShowCarousel) {
            $out .= " textShowCarousel: \"{$textShowCarousel}\",";
        }
    }
    $out = substr($out, 0, -1);
    // Remove last comma
    $out .= '   });
              
              document.getElementById("myGallery_' . $galleryID . '").style.display = "block";
          ';
    if ($showCarousel && $showCarouselOpen) {
        $out .= ' myGallery.toggleCarousel(); ';
    }
    $out .= ' }
            window.addEvent("domready", startGallery_' . $galleryID . ');
          </script>
         ';
    /*
      $out .= " <style>
                  .jdGallery .slideInfoZone {
                    height: 78px;
                  }
    
                  .jdGallery .slideInfoZone h2 {
                      font-size: 1.5em;
                    font-family: Arial;
                    font-weight: bold;
                         margin: 2px 4px;
                          color: #FFF000;
                  }
    
                  .jdGallery .slideInfoZone p {
                      font-size: 2.0em;
                    font-family: Arial;
                    font-weight: bold;  
                         margin: 0px 8px;
                          color: #FFFFFF;
                    line-height: 1.0;
                  }
                </style>";
    */
    $out .= '<div style="width: ' . $width . 'px; height: ' . $height . 'px; border:0px solid; ' . nggSmoothAlign($align, $margin) . ' clear:both;">';
    // margin centers div and clear makes it work like a container
    $out .= '<div id="myGallery_' . $galleryID . '" class="myGallery" style="display:none; width: ' . $width . 'px !important; height: ' . $height . 'px !important;">';
    // Error with only one element
    foreach ($pictures as $picture) {
        if ($picture["img"]) {
            $out .= "<div class=\"imageElement\">";
            $out .= "  <h3> " . $picture["title"] . "</h3>";
            $out .= "  <p style=\"color: #FFF000;\"> " . $picture["desc"] . "</p>";
            $out .= "  <a target=\"_blank\" href=\"" . $picture["link"] . "\" title=\"open image\" class=\"open\"></a>";
            $out .= "  <img src=\"" . $picture["img"] . "\" class=\"full\" />";
            $out .= "  <img src=\"" . $picture["thumb"] . "\" class=\"thumbnail\" />";
            $out .= "</div>";
        }
    }
    $out .= ' </div></div>';
    return $out;
}