Example #1
0
function photocrati_gallery_path_uri($path = null, $url_encode = false)
{
    $theme_dir = strtolower(get_template_directory());
    $theme_dir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $theme_dir);
    $gallery_dir = strtolower(photocrati_gallery_file_path());
    $common_dir = substr($gallery_dir, 0, strlen($theme_dir));
    $uri = null;
    $path = str_replace(array('/', '\\'), '/', $path);
    if ($url_encode) {
        $path_list = explode('/', $path);
        foreach ($path_list as $index => $path_item) {
            $path_list[$index] = urlencode($path_item);
        }
        $path = implode('/', $path_list);
    }
    if ($common_dir == $theme_dir) {
        $theme_uri = get_template_directory_uri();
        $uri = $theme_uri . '/photocrati-gallery/' . $path;
    } else {
        // XXX complete for plugin
        // Note, paths could not match but STILL being contained in the theme (i.e. WordPress returns the wrong path for the theme directory, either with wrong formatting or wrong encoding)
    }
    return $uri;
}
Example #2
0
function render_iframe_gallery()
{
    //if (preg_match("/\/?display_gallery-iframe/", $_SERVER['REQUEST_URI'])) {
    if (isset($_GET['display_gallery_iframe'])) {
        include photocrati_gallery_file_path('gallery-iframe.php');
        exit(0);
    }
}