コード例 #1
0
/**
 * Returns a search URL
 *
 * @param mixed $words the search words target
 * @param mixed $dates the dates that limit the search
 * @param mixed $fields the fields on which to search
 * @param int $page the page number for the URL
 * @param array $object_list the list of objects to search
 * @return string
 * @since 1.1.3
 */
function getSearchURL($words, $dates, $fields, $page, $object_list = NULL)
{
    if (!is_null($object_list)) {
        if (array_key_exists(0, $object_list)) {
            // handle old form albums list
            internal_deprecations::getSearchURL();
            $object_list = array('albums' => $object_list);
        }
    }
    $urls = '';
    $rewrite = false;
    if (MOD_REWRITE) {
        $rewrite = true;
        if (is_array($object_list)) {
            foreach ($object_list as $obj) {
                if ($obj) {
                    $rewrite = false;
                    break;
                }
            }
        }
    }
    if ($rewrite) {
        if (empty($dates)) {
            $url = SEO_WEBPATH . '/' . _SEARCH_ . '/';
        } else {
            $url = SEO_WEBPATH . '/' . _ARCHIVE_ . '/';
        }
    } else {
        $url = SEO_WEBPATH . "/index.php?p=search";
    }
    if (!empty($fields) && empty($dates)) {
        if (!is_array($fields)) {
            $fields = explode(',', $fields);
        }
        $temp = $fields;
        if ($rewrite && count($fields) == 1 && array_shift($temp) == 'tags') {
            $url = SEO_WEBPATH . '/' . _TAGS_ . '/';
        } else {
            $search = new SearchEngine();
            $urls = $search->getSearchFieldsText($fields, 'searchfields=');
        }
    }
    if (!empty($words)) {
        if (is_array($words)) {
            foreach ($words as $key => $word) {
                $words[$key] = search_quote($word);
            }
            $words = implode(',', $words);
        }
        $words = strtr($words, array('%' => '__25__', '&' => '__26__', '#' => '__23__', '/' => '__2F__'));
        if ($rewrite) {
            $url .= urlencode($words);
        } else {
            $url .= "&words=" . urlencode($words);
        }
    }
    if (!empty($dates)) {
        if (is_array($dates)) {
            $dates = implode(',', $dates);
        }
        if ($rewrite) {
            $url .= $dates;
        } else {
            $url .= "&date={$dates}";
        }
    }
    if ($page > 1) {
        if ($rewrite) {
            $url .= "/{$page}";
        } else {
            if ($urls) {
                $urls .= '&';
            }
            $urls .= "page={$page}";
        }
    }
    if (!empty($urls)) {
        if ($rewrite) {
            $url .= '?' . $urls;
        } else {
            $url .= '&' . $urls;
        }
    }
    if (is_array($object_list)) {
        foreach ($object_list as $key => $list) {
            if (!empty($list)) {
                $url .= '&in' . $key . '=' . html_encode(implode(',', $list));
            }
        }
    }
    return $url;
}
コード例 #2
0
ファイル: class-album.php プロジェクト: JoniWeiss/JoniWebGirl
 /**
  * Returns an URL to the album, including the current page number
  *
  * @param string $page if not null, apppend as page #
  * @return string
  * @deprecated since version 1.4.6
  */
 function getAlbumLink($page = NULL)
 {
     internal_deprecations::getAlbumLink();
     return $this->getLink();
 }
コード例 #3
0
ファイル: class-image.php プロジェクト: rb26/zenphoto
 /**
  * Returns a path urlencoded image page link for the image
  * @return string
  * @deprecated since version 1.4.6
  */
 function getImageLink()
 {
     internal_deprecations::getImageLink();
     return $this->getLink();
 }