本文整理汇总了PHP中UrlManager::get_url_id方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlManager::get_url_id方法的具体用法?PHP UrlManager::get_url_id怎么用?PHP UrlManager::get_url_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlManager
的用法示例。
在下文中一共展示了UrlManager::get_url_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getURLImages
/**
* Does not look like this function is being used is being used
*
* @param type $url_id
* @return string
*/
public static function getURLImages($url_id = null)
{
if (is_null($url_id)) {
$url = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$url_id = UrlManager::get_url_id($url);
}
$url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
$images = array();
for ($img_id = 1; $img_id <= 3; $img_id++) {
if (file_exists($url_images_dir . $url_id . '_url_image_' . $img_id . '.png')) {
$images[] = api_get_path(WEB_PATH) . 'custompages/url-images/' . $url_id . '_url_image_' . $img_id . '.png';
}
}
return $images;
}
示例2: get_lang
// checking url
if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
UrlManager::add($url, $description, $active);
} else {
//create
UrlManager::add($url . '/', $description, $active);
}
$message = get_lang('URLAdded');
$url_to_go = 'access_urls.php';
} else {
$url_to_go = 'access_url_edit.php';
$message = get_lang('URLAlreadyAdded');
}
// URL Images
$url .= substr($url, strlen($url) - 1, strlen($url)) == '/' ? '' : '/';
$url_id = UrlManager::get_url_id($url);
$url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
$image_fields = array("url_image_1", "url_image_2", "url_image_3");
foreach ($image_fields as $image_field) {
if ($_FILES[$image_field]['error'] == 0) {
// Hardcoded: only PNG files allowed
if (end(explode('.', $_FILES[$image_field]['name'])) == 'png') {
move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png');
}
// else fail silently
}
// else fail silently
}
}
Security::clear_token();
$tok = Security::get_token();