function set_link($value) { if (!of_class($value, URL__CLASS)) { $value = new Url($value); } $this->link = $value->absolute(); }
function test_anchors() { $url = new Url('/news/../admin/menus/../updates/../../wiki/wiki.php#welcome'); self::assertEquals('/wiki/wiki.php#welcome', $url->relative()); $url = new Url('#welcome'); self::assertEquals('#welcome', $url->absolute()); }
function get_url($relative = false) { import('util/url'); $url = new Url('/syndication.php?m=' . $this->module_id . '&cat=' . $this->category . '&name=' . $this->name); if ($relative) { return $url->relative(); } return $url->absolute(); }
function _get_url($string_url, $compute_relative_url = true) { $url = new Url($string_url); if ($compute_relative_url) { return $url->relative(); } else { return $url->absolute(); } }
public function execute(HTTPRequestCustom $request) { $status = 200; $url = ''; $image_to_check = $request->get_string('image', ''); $image = new Url($image_to_check); if ($image_to_check) { $file_headers = get_headers($image->absolute(), true); if (is_array($file_headers)) { if (preg_match('/^HTTP\\/[12]\\.[01] (\\d\\d\\d)/', $file_headers[0], $matches)) { $status = (int) $matches[1]; } } } if ($status == 200) { $url = $image->absolute(); } return new JSONResponse(array('url' => $url)); }
public function url_is_valid(FormField $field) { $status = 200; $url = new Url($field->get_value()); $file_headers = get_headers($url->absolute(), true); if (is_array($file_headers)) { if (preg_match('/^HTTP\\/[12]\\.[01] (\\d\\d\\d)/', $file_headers[0], $matches)) { $status = (int) $matches[1]; } } return $status == 200; }
public function execute(HTTPRequestCustom $request) { $status = 200; $url_to_check = $request->get_value('url_to_check', ''); if ($url_to_check) { $url = new Url($url_to_check); $file_headers = get_headers($url->absolute(), true); if (is_array($file_headers)) { if (preg_match('/^HTTP\\/[12]\\.[01] (\\d\\d\\d)/', $file_headers[0], $matches)) { $status = (int) $matches[1]; } } } return new JSONResponse(array('status' => $status)); }
/** * @desc Sets the feed item link * @param mixed $value a string url or an Url object */ public function set_link($value) { if (!$value instanceof Url) { $value = new Url($value); } $this->link = $value->absolute(); }
/** * @desc Returns an absolute url * @param mixed $url the url representation. Could be a string or an Url object * @return string an absolute url */ public static function to_absolute($url) { if (!$url instanceof Url) { $url = new Url($url); } return $url->absolute(); }
/** * @desc Second parses relative urls to absolute urls. * @param string $url Url to second parse * @return string The second parsed url. * @see Url */ public static function second_parse_url($url) { $Url = new Url($url); return $Url->absolute(); }
function second_parse_url(&$url) { import('util/url'); $Url = new Url($url); return $Url->absolute(); }
public function absolute_url(Url $url) { return $url->absolute(); }
static function _convert_url_to_absolute($url_params) { $url = new Url($url_params[2]); $url_params[2] = $url->absolute(); return $url_params[1] . $url_params[2] . $url_params[3]; }
$start = retrieve(POST, 'start', 0, TSTRING_UNCHANGE); $start_hour = retrieve(POST, 'start_hour', 0, TSTRING_UNCHANGE); $start_min = retrieve(POST, 'start_min', 0, TSTRING_UNCHANGE); $end = retrieve(POST, 'end', 0, TSTRING_UNCHANGE); $end_hour = retrieve(POST, 'end_hour', 0, TSTRING_UNCHANGE); $end_min = retrieve(POST, 'end_min', 0, TSTRING_UNCHANGE); $current_date = retrieve(POST, 'current_date', '', TSTRING_UNCHANGE); $current_hour = retrieve(POST, 'current_hour', 0, TSTRING_UNCHANGE); $current_min = retrieve(POST, 'current_min', 0, TSTRING_UNCHANGE); $start_timestamp = strtotimestamp($start, $LANG['date_format_short']); $end_timestamp = strtotimestamp($end, $LANG['date_format_short']); $current_date_timestamp = strtotimestamp($current_date, $LANG['date_format_short']); $img_displays = ''; if (!empty($img)) { $img_url = new Url(stripslashes($img)); $img_displays = '<img src="' . $img_url->absolute() . '" alt="' . stripslashes($alt) . '" title="' . stripslashes($alt) . '" class="img_right" />'; $img_preview = '<img src="' . $img_url->absolute() . '" alt="' . stripslashes($alt) . '" title="' . stripslashes($alt) . '" />'; } $Template->assign_block_vars('news', array('TITLE' => $title, 'PREVIEWED_CONTENTS' => second_parse(stripslashes($contents)), 'PREVIEWED_EXTEND_CONTENTS' => second_parse(stripslashes($extend_contents)), 'PSEUDO' => $User->get_attribute('login'), 'U_USER_ID' => url('.php?id=' . $User->get_attribute('user_id'), '-' . $User->get_attribute('user_id') . '.php'), 'IMG' => $img_displays, 'DATE' => gmdate_format('date_format_short'))); $i = 0; $result = $Sql->query_while("SELECT id, name FROM " . PREFIX . "news_cat", __LINE__, __FILE__); while ($row = $Sql->fetch_assoc($result)) { $selected = $row['id'] == $idcat ? 'selected="selected"' : ''; $Template->assign_block_vars('select', array('CAT' => '<option value="' . $row['id'] . '" ' . $selected . '>' . $row['name'] . '</option>')); $i++; } $Sql->query_close($result); if ($i == 0) { $Errorh->handler($LANG['require_cat_create'], E_USER_WARNING); } $Template->assign_vars(array('MODULE_DATA_PATH' => $Template->get_module_data_path('news'), 'TOKEN' => $Session->get_token(), 'NEWS_TITLE' => $title, 'CONTENTS' => retrieve(POST, 'contents', '', TSTRING_UNCHANGE), 'EXTEND_CONTENTS' => retrieve(POST, 'extend_contents', '', TSTRING_UNCHANGE), 'IMG_PREVIEW' => !empty($img) ? $img_preview : $LANG['no_img'], 'IMG' => $img, 'ALT' => stripslashes($alt), 'START' => $start, 'START_HOUR' => !empty($start_hour) ? $start_hour : '', 'START_MIN' => !empty($start_min) ? $start_min : '', 'END' => $end, 'END_HOUR' => !empty($end_hour) ? $end_hour : '', 'END_MIN' => !empty($end_min) ? $end_min : '', 'CURRENT_DATE' => $current_date, 'CURRENT_HOUR' => !empty($current_hour) ? $current_hour : '', 'CURRENT_MIN' => !empty($current_min) ? $current_min : '', 'DAY_RELEASE_S' => !empty($start_timestamp) ? gmdate_format('d', $start_timestamp) : '', 'MONTH_RELEASE_S' => !empty($start_timestamp) ? gmdate_format('m', $start_timestamp) : '', 'YEAR_RELEASE_S' => !empty($start_timestamp) ? gmdate_format('Y', $start_timestamp) : '', 'DAY_RELEASE_E' => !empty($end_timestamp) ? gmdate_format('d', $end_timestamp) : '', 'MONTH_RELEASE_E' => !empty($end_timestamp) ? gmdate_format('m', $end_timestamp) : '', 'YEAR_RELEASE_E' => !empty($end_timestamp) ? gmdate_format('Y', $end_timestamp) : '', 'DAY_DATE' => !empty($current_date_timestamp) ? gmdate_format('d', $current_date_timestamp) : '', 'MONTH_DATE' => !empty($current_date_timestamp) ? gmdate_format('m', $current_date_timestamp) : '', 'YEAR_DATE' => !empty($current_date_timestamp) ? gmdate_format('Y', $current_date_timestamp) : '', 'VISIBLE_WAITING' => $get_visible == 2 ? 'checked="checked"' : '', 'VISIBLE_ENABLED' => $get_visible == 1 ? 'checked="checked"' : '', 'VISIBLE_UNAPROB' => $get_visible == 0 ? 'checked="checked"' : '', 'KERNEL_EDITOR' => display_editor(), 'KERNEL_EDITOR_EXTEND' => display_editor('extend_contents'), 'L_NEWS_MANAGEMENT' => $LANG['news_management'], 'L_ADD_NEWS' => $LANG['add_news'], 'L_CONFIG_NEWS' => $LANG['configuration_news'], 'L_CAT_NEWS' => $LANG['category_news'], 'L_IMG_MANAGEMENT' => $LANG['img_management'], 'L_PREVIEW_IMG' => $LANG['preview_image'], 'L_PREVIEW_IMG_EXPLAIN' => $LANG['preview_image_explain'], 'L_IMG_LINK' => $LANG['img_link'], 'L_IMG_DESC' => $LANG['img_desc'], 'L_BB_UPLOAD' => $LANG['bb_upload'], 'L_REQUIRE_TITLE' => $LANG['require_title'], 'L_REQUIRE_TEXT' => $LANG['require_text'], 'L_REQUIRE_CAT' => $LANG['require_cat'], 'L_PREVIEW' => $LANG['preview'], 'L_COM' => $LANG['com'], 'L_ON' => $LANG['on'], 'L_REQUIRE' => $LANG['require'], 'L_TITLE' => $LANG['title'], 'L_NEWS_DATE' => $LANG['news_date'], 'L_AT' => $LANG['at'], 'L_UNIT_HOUR' => $LANG['unit_hour'], 'L_YES' => $LANG['yes'], 'L_NO' => $LANG['no'], 'L_TEXT' => $LANG['content'], 'L_EXTENDED_NEWS' => $LANG['extended_news'], 'L_CATEGORY' => $LANG['category'], 'L_UNTIL' => $LANG['until'], 'L_RELEASE_DATE' => $LANG['release_date'], 'L_IMMEDIATE' => $LANG['immediate'], 'L_UNAPROB' => $LANG['unaprob'], 'L_SUBMIT' => $LANG['submit'], 'L_RESET' => $LANG['reset']));