当前位置: 首页>>代码示例>>PHP>>正文


PHP Validate::isAbsoluteUrl方法代码示例

本文整理汇总了PHP中Validate::isAbsoluteUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isAbsoluteUrl方法的具体用法?PHP Validate::isAbsoluteUrl怎么用?PHP Validate::isAbsoluteUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validate的用法示例。


在下文中一共展示了Validate::isAbsoluteUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logHttpReferer

 public static function logHttpReferer()
 {
     global $cookie;
     if (!isset($cookie->id_connections) or !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_REFERER']) and !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     if (isset($_SERVER['HTTP_REFERER']) and Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         if (preg_replace('/^www./', '', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) and !strncmp(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH), parse_url('http://' . Tools::getHttpHost(false, false) . __PS_BASE_URI__, PHP_URL_PATH), strlen(__PS_BASE_URI__))) {
             return false;
         }
         if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
             $source->http_referer = strval($_SERVER['HTTP_REFERER']);
             $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
             if (!Validate::isMessage($source->keywords)) {
                 return false;
             }
         }
     }
     $source->id_connections = intval($cookie->id_connections);
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= strval($_SERVER['REQUEST_URI']);
     }
     if (!Validate::isUrl($source->request_uri)) {
         unset($source->request_uri);
     }
     return $source->add();
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:34,代码来源:ConnectionsSource.php

示例2: setNewConnection

    public static function setNewConnection($cookie)
    {
        // The old connections details are removed from the database in order to spare some memory
        Connection::cleanConnectionsPages();
        // A new connection is created if the guest made no actions during 30 minutes
        $result = Db::getInstance()->getRow('
		SELECT c.`id_guest`
		FROM `' . _DB_PREFIX_ . 'connections` c
		LEFT JOIN `' . _DB_PREFIX_ . 'connections_page` cp ON c.`id_connections` = cp.`id_connections`
		WHERE c.`id_guest` = ' . intval($cookie->id_guest) . '
		AND DATE_ADD(cp.`time_start`, INTERVAL 30 MINUTE) > \'' . pSQL(date('Y-m-d H:i:s')) . '\'
		ORDER BY cp.`time_start` DESC');
        if (!$result['id_guest'] and intval($cookie->id_guest)) {
            $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
            if (preg_replace('/^www./', '', parse_url($referer, PHP_URL_HOST)) == preg_replace('/^www./', '', $_SERVER['HTTP_HOST'])) {
                $referer = '';
            }
            $connection = new Connection();
            $connection->id_guest = intval($cookie->id_guest);
            $connection->id_page = Page::getCurrentId();
            $connection->ip_address = isset($_SERVER['REMOTE_ADDR']) ? ip2long($_SERVER['REMOTE_ADDR']) : '';
            if (Validate::isAbsoluteUrl($referer)) {
                $connection->http_referer = $referer;
            }
            $connection->add();
            $cookie->id_connections = $connection->id;
            return $connection->id_page;
        }
    }
开发者ID:sealence,项目名称:local,代码行数:29,代码来源:Connection.php

示例3: update_carrier_url

function update_carrier_url()
{
    // Get all carriers
    $sql = '
		SELECT c.`id_carrier`, c.`url`
		FROM `' . _DB_PREFIX_ . 'carrier` c';
    $carriers = Db::getInstance()->ExecuteS($sql);
    // Check each one and erase carrier URL if not correct URL
    foreach ($carriers as $carrier) {
        if (!Validate::isAbsoluteUrl($carrier['url'])) {
            Db::getInstance()->Execute('
				UPDATE `' . _DB_PREFIX_ . 'carrier`
				SET `url` = \'\'
				WHERE  `id_carrier`= ' . (int) $carrier['id_carrier']);
        }
    }
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:17,代码来源:updatecarrierurl.php

示例4: getContent

 public function getContent()
 {
     $output = '<h2>' . $this->displayName . '</h2>';
     if (Tools::isSubmit('submitBlockRss')) {
         $errors = array();
         $urlfeed = Tools::getValue('urlfeed');
         $title = Tools::getValue('title');
         $nbr = (int) Tools::getValue('nbr');
         if ($urlfeed and !Validate::isAbsoluteUrl($urlfeed)) {
             $errors[] = $this->l('Invalid feed URL');
         } elseif (!$title or empty($title) or !Validate::isGenericName($title)) {
             $errors[] = $this->l('Invalid title');
         } elseif (!$nbr or $nbr <= 0 or !Validate::isInt($nbr)) {
             $errors[] = $this->l('Invalid number of feeds');
         } elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'] . __PS_BASE_URI__)) {
             $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');
         } elseif (!($contents = Tools::file_get_contents($urlfeed))) {
             $errors[] = $this->l('Feed is unreachable, check your URL');
         } else {
             try {
                 $xmlFeed = new XML_Feed_Parser($contents);
             } catch (XML_Feed_Parser_Exception $e) {
                 $errors[] = $this->l('Invalid feed:') . ' ' . $e->getMessage();
             }
         }
         if (!sizeof($errors)) {
             Configuration::updateValue('RSS_FEED_URL', $urlfeed);
             Configuration::updateValue('RSS_FEED_TITLE', $title);
             Configuration::updateValue('RSS_FEED_NBR', $nbr);
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         } else {
             $output .= $this->displayError(implode('<br />', $errors));
         }
     } else {
         $errors = array();
         if (stristr(Configuration::get('RSS_FEED_URL'), $_SERVER['HTTP_HOST'] . __PS_BASE_URI__)) {
             $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');
         }
         if (sizeof($errors)) {
             $output .= $this->displayError(implode('<br />', $errors));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:44,代码来源:blockrss.php

示例5: logHttpReferer

 public static function logHttpReferer(Cookie $cookie = null)
 {
     if (!$cookie) {
         $cookie = Context::getContext()->cookie;
     }
     if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     // If the referrer is not correct, we drop the connection
     if (isset($_SERVER['HTTP_REFERER']) && !Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         return false;
     }
     // If there is no referrer and we do not want to save direct traffic (as opposed to referral traffic), we drop the connection
     if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     // There are a few more operations if there is a referrer
     if (isset($_SERVER['HTTP_REFERER'])) {
         // If the referrer is internal (i.e. from your own website), then we drop the connection
         $parsed = parse_url($_SERVER['HTTP_REFERER']);
         $parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
         if (!isset($parsed['host']) || (!isset($parsed['path']) || !isset($parsed_host['path']))) {
             return false;
         }
         if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
             return false;
         }
         $source->http_referer = substr($_SERVER['HTTP_REFERER'], 0, ConnectionsSource::$uri_max_size);
         $source->keywords = substr(trim(SearchEngine::getKeywords($_SERVER['HTTP_REFERER'])), 0, ConnectionsSource::$uri_max_size);
     }
     $source->id_connections = (int) $cookie->id_connections;
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= $_SERVER['REQUEST_URI'];
     } elseif (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= $_SERVER['REDIRECT_URL'];
     }
     if (!Validate::isUrl($source->request_uri)) {
         $source->request_uri = '';
     }
     $source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
     return $source->add();
 }
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:44,代码来源:ConnectionsSource.php

示例6: logHttpReferer

 public static function logHttpReferer(Cookie $cookie = null)
 {
     if (!$cookie) {
         $cookie = Context::getContext()->cookie;
     }
     if (!isset($cookie->id_connections) || !Validate::isUnsignedId($cookie->id_connections)) {
         return false;
     }
     if (!isset($_SERVER['HTTP_REFERER']) && !Configuration::get('TRACKING_DIRECT_TRAFFIC')) {
         return false;
     }
     $source = new ConnectionsSource();
     if (isset($_SERVER['HTTP_REFERER']) && Validate::isAbsoluteUrl($_SERVER['HTTP_REFERER'])) {
         $parsed = parse_url($_SERVER['HTTP_REFERER']);
         $parsed_host = parse_url(Tools::getProtocol() . Tools::getHttpHost(false, false) . __PS_BASE_URI__);
         if (preg_replace('/^www./', '', $parsed['host']) == preg_replace('/^www./', '', Tools::getHttpHost(false, false)) && !strncmp($parsed['path'], $parsed_host['path'], strlen(__PS_BASE_URI__))) {
             return false;
         }
         if (Validate::isAbsoluteUrl(strval($_SERVER['HTTP_REFERER']))) {
             $source->http_referer = substr(strval($_SERVER['HTTP_REFERER']), 0, ConnectionsSource::$uri_max_size);
             $source->keywords = trim(SearchEngine::getKeywords(strval($_SERVER['HTTP_REFERER'])));
             if (!Validate::isMessage($source->keywords)) {
                 return false;
             }
         }
     }
     $source->id_connections = (int) $cookie->id_connections;
     $source->request_uri = Tools::getHttpHost(false, false);
     if (isset($_SERVER['REDIRECT_URL'])) {
         $source->request_uri .= strval($_SERVER['REDIRECT_URL']);
     } elseif (isset($_SERVER['REQUEST_URI'])) {
         $source->request_uri .= strval($_SERVER['REQUEST_URI']);
     }
     if (!Validate::isUrl($source->request_uri)) {
         $source->request_uri = '';
     }
     $source->request_uri = substr($source->request_uri, 0, ConnectionsSource::$uri_max_size);
     return $source->add();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:39,代码来源:ConnectionsSource.php

示例7: saveFile

 /**
  * 下载文件保存到指定位置
  *
  * @param $url
  * @param $filepath
  *
  * @return bool
  */
 public static function saveFile($url, $filepath)
 {
     if (Validate::isAbsoluteUrl($url) && !empty($filepath)) {
         $file = self::file_get_contents($url);
         $fp = @fopen($filepath, 'w');
         if ($fp) {
             @fwrite($fp, $file);
             @fclose($fp);
             return $filepath;
         }
     }
     return false;
 }
开发者ID:liu33851861,项目名称:CZD_Yaf_Extension,代码行数:21,代码来源:Tools.php

示例8: addMedia

 /**
  * Adds a media file(s) (CSS, JS) to page header
  *
  * @param string|array $media_uri Path to file, or an array of paths like: array(array(uri => media_type), ...)
  * @param string|null $css_media_type CSS media type
  * @param int|null $offset
  * @param bool $remove If True, removes media files
  * @param bool $check_path If true, checks if files exists
  * @return true|void
  */
 public function addMedia($media_uri, $css_media_type = null, $offset = null, $remove = false, $check_path = true)
 {
     if (!is_array($media_uri)) {
         if ($css_media_type) {
             $media_uri = array($media_uri => $css_media_type);
         } else {
             $media_uri = array($media_uri);
         }
     }
     $list_uri = array();
     foreach ($media_uri as $file => $media) {
         if (!Validate::isAbsoluteUrl($media)) {
             $different = 0;
             $different_css = 0;
             $type = 'css';
             if (!$css_media_type) {
                 $type = 'js';
                 $file = $media;
             }
             if (strpos($file, __PS_BASE_URI__ . 'modules/') === 0) {
                 $override_path = str_replace(__PS_BASE_URI__ . 'modules/', _PS_ROOT_DIR_ . '/themes/' . _THEME_NAME_ . '/' . $type . '/modules/', $file, $different);
                 if (strrpos($override_path, $type . '/' . basename($file)) !== false) {
                     $override_path_css = str_replace($type . '/' . basename($file), basename($file), $override_path, $different_css);
                 }
                 if ($different && @filemtime($override_path)) {
                     $file = str_replace(__PS_BASE_URI__ . 'modules/', __PS_BASE_URI__ . 'themes/' . _THEME_NAME_ . '/' . $type . '/modules/', $file, $different);
                 } elseif ($different_css && @filemtime($override_path_css)) {
                     $file = $override_path_css;
                 }
                 if ($css_media_type) {
                     $list_uri[$file] = $media;
                 } else {
                     $list_uri[] = $file;
                 }
             } else {
                 $list_uri[$file] = $media;
             }
         } else {
             $list_uri[$file] = $media;
         }
     }
     if ($remove) {
         if ($css_media_type) {
             return parent::removeCSS($list_uri, $css_media_type);
         }
         return parent::removeJS($list_uri);
     }
     if ($css_media_type) {
         return parent::addCSS($list_uri, $css_media_type, $offset, $check_path);
     }
     return parent::addJS($list_uri, $check_path);
 }
开发者ID:ekachandrasetiawan,项目名称:BeltcareCom,代码行数:62,代码来源:FrontController.php

示例9: postProcess

 public function postProcess()
 {
     if (Tools::isSubmit('submitSettings')) {
         if (isset($_POST['login'])) {
             Configuration::updateValue('PS_TRUST_EMAIL', $_POST['email']);
         }
         if (isset($_POST['passwd'])) {
             Configuration::updateValue('PS_TRUST_PASSWD', $_POST['passwd']);
         }
         if ($activity = Tools::getValue('shop_activity')) {
             Configuration::updateValue('PS_SHOP_ACTIVITY', $activity);
         }
         $carriers_configuration = array();
         $payments_configuration = array();
         foreach ($_POST as $field => $val) {
             if (preg_match('/^carrier_([0-9]+)$/Ui', $field, $res)) {
                 $carriers_configuration[$res[1]] = $val;
             } elseif (preg_match('/^paymentmodule_([0-9]+)$/Ui', $field, $pay_res)) {
                 $payments_configuration[$pay_res[1]] = $val;
             }
         }
         $this->_setCarriersConfiguration($carriers_configuration);
         $this->_setPaymentsConfiguration($payments_configuration);
     } elseif (Tools::isSubmit('submitCreateAccount')) {
         if (!Validate::isEmail($email = Tools::getValue('email'))) {
             $this->_errors[] = $this->l('Email is invalid');
         }
         if (!Validate::isAbsoluteUrl($shop_url = Tools::getValue('shop_url'))) {
             $this->_errors[] = $this->l('Shop URL is invalid');
         }
         if (!count($this->_errors)) {
             if ($this->_createAccount($email, $shop_url)) {
                 $this->_html .= $this->displayConfirmation('Account successfull created');
             }
         }
     }
     if (sizeof($this->_errors)) {
         $err = '';
         foreach ($this->_errors as $error) {
             $err .= $error . '<br />';
         }
         $this->_html .= $this->displayError($err);
     }
 }
开发者ID:Sosiashvili,项目名称:prestafraud,代码行数:44,代码来源:prestafraud.php

示例10: hookTop

 function hookTop($params)
 {
     if (strstr($_SERVER['REQUEST_URI'], '404.php') and isset($_SERVER['REDIRECT_URL'])) {
         $_SERVER['REQUEST_URI'] = $_SERVER['REDIRECT_URL'];
     }
     if (!Validate::isUrl($request_uri = $_SERVER['REQUEST_URI']) or strstr($_SERVER['REQUEST_URI'], '-admin404')) {
         return;
     }
     if (strstr($_SERVER['PHP_SELF'], '404.php') and !strstr($_SERVER['REQUEST_URI'], '404.php')) {
         $http_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
         if (empty($http_referer) or Validate::isAbsoluteUrl($http_referer)) {
             Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'pagenotfound` (`request_uri`,`http_referer`,`date_add`) VALUES (\'' . pSQL($request_uri) . '\',\'' . pSQL($http_referer) . '\',NOW())');
         }
     }
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:15,代码来源:pagesnotfound.php

示例11: cccJS

 /**
  * Combine Compress and Cache (ccc) JS calls
  *
  * @param array js_files
  * @return array processed js_files
  */
 public static function cccJS($js_files)
 {
     //inits
     $compressed_js_files_not_found = array();
     $js_files_infos = array();
     $js_files_date = 0;
     $compressed_js_filename = '';
     $js_external_files = array();
     $protocol_link = Tools::getCurrentUrlProtocolPrefix();
     $cache_path = _PS_THEME_DIR_ . 'cache/';
     // get js files infos
     foreach ($js_files as $filename) {
         if (Validate::isAbsoluteUrl($filename)) {
             $js_external_files[] = $filename;
         } else {
             $infos = array();
             $infos['uri'] = $filename;
             $url_data = parse_url($filename);
             $infos['path'] = _PS_ROOT_DIR_ . Tools::str_replace_once(__PS_BASE_URI__, '/', $url_data['path']);
             if (!@filemtime($info['path'])) {
                 $infos['path'] = _PS_CORE_DIR_ . Tools::str_replace_once(__PS_BASE_URI__, '/', $url_data['path']);
             }
             $js_files_infos[] = $infos;
             $js_files_date = max(file_exists($infos['path']) ? @filemtime($infos['path']) : 0, $js_files_date);
             $compressed_js_filename .= $filename;
         }
     }
     // get compressed js file infos
     $compressed_js_filename = md5($compressed_js_filename);
     $version = (int) Configuration::get('PS_CCCJS_VERSION');
     $compressed_js_path = $cache_path . 'v_' . $version . '_' . $compressed_js_filename . '.js';
     $compressed_js_file_date = file_exists($compressed_js_path) ? @filemtime($compressed_js_path) : 0;
     // aggregate and compress js files content, write new caches files
     if ($js_files_date > $compressed_js_file_date) {
         if ($compressed_js_file_date) {
             Configuration::updateValue('PS_CCCJS_VERSION', ++$version);
         }
         $compressed_js_path = $cache_path . 'v_' . $version . '_' . $compressed_js_filename . '.js';
         $content = '';
         foreach ($js_files_infos as $file_infos) {
             if (file_exists($file_infos['path'])) {
                 $tmp_content = file_get_contents($file_infos['path']);
                 if (preg_match('@\\.(min|pack)\\.[^/]+$@', $file_infos['path'], $matches)) {
                     $content .= preg_replace('/\\/\\/@\\ssourceMappingURL\\=[_a-zA-Z0-9-.]+\\.' . $matches[1] . '\\.map\\s+/', '', $tmp_content);
                 } else {
                     $content .= Media::packJS($tmp_content);
                 }
             } else {
                 $compressed_js_files_not_found[] = $file_infos['path'];
             }
         }
         if (!empty($compressed_js_files_not_found)) {
             $content = '/* WARNING ! file(s) not found : "' . implode(',', $compressed_js_files_not_found) . '" */' . "\n" . $content;
         }
         file_put_contents($compressed_js_path, $content);
         chmod($compressed_js_path, 0777);
     }
     // rebuild the original js_files array
     if (strpos($compressed_js_path, _PS_ROOT_DIR_) !== false) {
         $url = str_replace(_PS_ROOT_DIR_ . '/', __PS_BASE_URI__, $compressed_js_path);
     }
     if (strpos($compressed_js_path, _PS_CORE_DIR_) !== false) {
         $url = str_replace(_PS_CORE_DIR_ . '/', __PS_BASE_URI__, $compressed_js_path);
     }
     return array_merge(array($protocol_link . Tools::getMediaServer($url) . $url), $js_external_files);
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:72,代码来源:Media.php

示例12: _createAccount

 private function _createAccount()
 {
     if (!($email = Tools::getValue('email')) or !Validate::isEmail($email)) {
         $this->_errors[] = $this->l('Email is invalid');
     }
     if (!($shop_url = Tools::getValue('shop_url')) or !Validate::isAbsoluteUrl($shop_url)) {
         $this->_errors[] = $this->l('Shop URL is invalid');
     }
     if (sizeof($this->_errors)) {
         return false;
     }
     $root = new SimpleXMLElement("<?xml version=\"1.0\"?><fraud_monitor></fraud_monitor>");
     $xml = $root->addChild('create_account');
     $xml->addChild('email', $email);
     $xml->addChild('shop_url', $shop_url);
     $result = $this->_pushDatas($root->asXml());
     if ($result == 'nok' || !($xml_result = simplexml_load_string($result))) {
         $this->_errors[] = $this->l('Impossible to create a new account, please report this bug on http://forge.prestashop.com/');
         return false;
     }
     if (!(int) $xml_result->create_account->result) {
         $this->_errors[] = (string) $xml_result->create_account->errors;
         return false;
     }
     Configuration::updateValue('PS_TRUST_SHOP_ID', (string) $xml_result->create_account->shop_id);
     Configuration::updateValue('PS_TRUST_SHOP_KEY', (string) $xml_result->create_account->shop_key);
     $this->_html .= $this->displayConfirmation('Account successfull created');
 }
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:28,代码来源:prestafraud.php

示例13: checkPostedDatas

 private function checkPostedDatas()
 {
     $mail = Tools::getValue('email');
     $website = Tools::getValue('website');
     if ($mail and !preg_match('#^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,6}$#', $mail)) {
         $this->_html .= parent::displayError($this->l('There is an error in your e-mail syntax!'));
     } else {
         if ($website and (!Validate::isURL($website) or !Validate::isAbsoluteUrl($website))) {
             $this->_html .= parent::displayError($this->l('There is an error in your URL syntax!'));
         } else {
             if (!$this->checkVersionsAndCompatibility() or !$this->checkNames() or !$this->checkDocumentation()) {
                 return false;
             } else {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:19,代码来源:themeinstallator.php

示例14: validateBlog

 public function validateBlog()
 {
     if (empty($_POST['title'])) {
         $this->errors[] = Tools::displayError('Title is required!');
     }
     if (mb_strlen($_POST['short_description']) < 10) {
         $this->errors[] = Tools::displayError('Short description should be atleast 10 characters!');
     }
     if (!Validate::isAbsoluteUrl($_POST['youtube'])) {
         $this->errors[] = Tools::displayError('Invalid URL!');
     }
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:12,代码来源:smartform.php

示例15: getKeywords

 public function getKeywords($url)
 {
     if (!Validate::isAbsoluteUrl($url)) {
         return false;
     }
     $parsedUrl = parse_url($url);
     if (!isset($parsedUrl['query']) && isset($parsedUrl['fragment'])) {
         $parsedUrl['query'] = $parsedUrl['fragment'];
     }
     if (!isset($parsedUrl['query'])) {
         return false;
     }
     $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT `server`, `getvar` FROM `' . _DB_PREFIX_ . 'search_engine`');
     foreach ($result as $index => $row) {
         $host =& $row['server'];
         $varname =& $row['getvar'];
         if (strstr($parsedUrl['host'], $host)) {
             $kArray = array();
             preg_match('/[^a-z]' . $varname . '=.+\\&' . '/U', $parsedUrl['query'], $kArray);
             if (!isset($kArray[0]) || empty($kArray[0])) {
                 preg_match('/[^a-z]' . $varname . '=.+$' . '/', $parsedUrl['query'], $kArray);
             }
             if (!isset($kArray[0]) || empty($kArray[0])) {
                 return false;
             }
             $kString = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($kArray[0], '&'), strlen($varname) + 1), '=')));
             return $kString;
         }
     }
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:30,代码来源:sekeywords.php


注:本文中的Validate::isAbsoluteUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。