Exemplo n.º 1
0
function mygallery($content)
{
    global $table_prefix, $wpdb, $wp_rewrite, $myurl, $mg_options;
    // load language
    if ($mg_options[language]) {
        load_textdomain('myGallery', myGalleryPath . '/languages/' . $mg_options[language] . '.mo');
    }
    // used variables
    $mg_options = get_option('mygalleryoptions');
    $mg_exifoptions = get_option('mygexifoptions');
    $myreference = get_permalink();
    $myurl = get_bloginfo('wpurl') . '/' . $mg_options[gallerybasepath];
    $mypicture_id = $_GET[picture_id];
    $search = "/\\[mygal=([A-Za-z0-9\\-\\_]+)(|\\([0-9\\,]+\\))\\]/";
    if ($mypicture_id) {
        if (preg_match($search, $content, $matches)) {
            $result = getpicture($mypicture_id);
            // exit if there is no pictures with this id
            if (!$result) {
                return;
            }
            $search = "/\\[mygal=" . $result->name . "(|\\([0-9\\,]+\\))]/";
            $replace = "[mybigpic][mygal=" . $result->name . "\$1]";
            $content = preg_replace($search, $replace, $content);
            // show thumbs under bgc picture
            if ($mg_options[bigpicshowthumbs]) {
                $content = conv_tag($content);
            } else {
                $search = "/\\[mygal=([A-Za-z0-9\\-\\_]+)(|\\([0-9\\,]+\\))\\]/";
                $replace = '';
                $content = preg_replace($search, $replace, $content);
            }
            // create HTML for big picture
            $search = "/\\[mybigpic\\]/";
            $replace = createhtmlforbigpicture($result, $mypicture_id, $myreference, $matches[2]);
            $content = preg_replace($search, $replace, $content);
        }
    } else {
        // if there is no gallery_id match, function returns a empty page
        $content = conv_tag($content);
    }
    return $content;
}
Exemplo n.º 2
0
function myshowgallerys($somegallerynames = 0)
{
    global $mg_options;
    if ($_GET['gallery']) {
        echo showtumbs($_GET['gallery']);
    } else {
        if ($_GET['picture_id']) {
            $result = getpicture($_GET['picture_id']);
            if ($result) {
                $mygalleryid = getgalleryidformpictureid($_GET['picture_id']);
                $mygalleryname = getgalleryname($mygalleryid);
                $myreference = gallery_reference(0, $mygalleryname);
                echo createhtmlforbigpicture($result, $_GET['picture_id'], $myreference);
                if ($mg_options[bigpicshowthumbs]) {
                    echo showtumbs($mygalleryname);
                }
            }
        } else {
            echo gallistgal($somegallerynames);
        }
    }
}