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


PHP Zend_Uri::check方法代码示例

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


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

示例1: setUri

 /**
  * Définition de l'Uri
  *
  * @param string $uri
  * @throws Zend_Service_Exception si l'uri est invalide
  */
 public function setUri($uri)
 {
     if (!Zend_Uri::check($uri)) {
         throw new Zend_Service_Exception('URL invalide');
     }
     $this->uri = $uri;
 }
开发者ID:sdis62,项目名称:toolbox,代码行数:13,代码来源:Generic.php

示例2: handleCampaignsRedirect

 /**
  * Handles campaign redirects on
  * controller_action_layout_generate_blocks_after
  *
  * @param Varien_Object $observer
  */
 public function handleCampaignsRedirect($observer)
 {
     if (!Mage::helper('factfinder')->isEnabled('campaigns') || Mage::registry('current_product') && !Mage::helper('factfinder_campaigns')->canShowCampaignsOnProduct()) {
         return;
     }
     if ((!Mage::registry('current_layer') || !Mage::helper('factfinder')->isEnabled('catalog_navigation')) && !Mage::registry('current_product')) {
         return;
     }
     if (Mage::registry('current_product')) {
         $product = Mage::registry('current_product');
         $ids = array($product->getData(Mage::helper('factfinder_campaigns')->getIdFieldName()));
         $handler = Mage::getModel('factfinder_campaigns/handler_product', $ids);
     } else {
         $handler = Mage::getSingleton('factfinder_campaigns/handler_search');
     }
     $redirect = $handler->getRedirect();
     if ($redirect) {
         // handle relative urls
         if (!Zend_Uri::check($redirect)) {
             $redirect = Mage::getBaseUrl() . $redirect;
         }
         $response = Mage::app()->getResponse();
         $response->setRedirect($redirect);
         $response->sendResponse();
         exit;
     }
 }
开发者ID:KaiStapel,项目名称:Magento-FACTFinder,代码行数:33,代码来源:Observer.php

示例3: watermark

 public static function watermark(array &$optionValues, XenForo_DataWriter $optionDw, $optionId)
 {
     if ($optionId !== 'sonnbXG_watermark') {
         return true;
     }
     if (!empty($optionValues['enabled'])) {
         switch ($optionValues['overlay']) {
             case 'image':
                 if (!Zend_Uri::check($optionValues['url']) && !is_file($optionValues['url'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_image_not_valid'), $optionId);
                     return false;
                 }
                 break;
             case 'text':
                 if (!self::isTextColorValid($optionValues['textColor'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_text_color_not_valid'), $optionId);
                     return false;
                 }
                 if (!self::isBgColorValid($optionValues['bgColor'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_bg_color_not_valid'), $optionId);
                     return false;
                 }
                 if (!empty($optionValues['font']) && !is_file($optionValues['font'])) {
                     $optionDw->error(new XenForo_Phrase('sonnb_xengallery_watermark_font_path_not_valid'), $optionId);
                     return false;
                 }
                 break;
         }
     }
     return true;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:31,代码来源:Check.php

示例4: checkUrl

 /** Check that the URL is valid
  * @access private
  * @param string $url to validate
  * @return string $url
  */
 private function checkUrl($url)
 {
     if (!Zend_Uri::check($url)) {
         throw new Pas_Exception_Url(self::INVALIDURL);
     }
     return $url;
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:12,代码来源:Sparql.php

示例5: getColorizedImage

 public function getColorizedImage($image_id, $color)
 {
     $color = str_replace('#', '', $color);
     $id = md5(implode('+', array($image_id, $color)));
     $url = '';
     $image = new Media_Model_Library_Image();
     if (is_numeric($image_id)) {
         $image->find($image_id);
         if (!$image->getId()) {
             return $url;
         }
         if (!$image->getCanBeColorized()) {
             $color = null;
         }
         $path = $image->getLink();
         $path = Media_Model_Library_Image::getBaseImagePathTo($path);
     } else {
         if (!Zend_Uri::check($image_id) and stripos($image_id, Core_Model_Directory::getBasePathTo()) === false) {
             $path = Core_Model_Directory::getBasePathTo($image_id);
         } else {
             $path = $image_id;
         }
     }
     try {
         $image = new Core_Model_Lib_Image();
         $image->setId($id)->setPath($path)->setColor($color)->colorize();
         $url = $image->getUrl();
     } catch (Exception $e) {
         $url = '';
     }
     return $url;
 }
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:32,代码来源:Default.php

示例6: validateUri

 /**
  * Callback to check extra-parameters.
  *
  * @internal The availability will be ckecked just before import.
  *
  * @param string $value The value to check.
  * @return boolean
  */
 public static function validateUri($uri)
 {
     if (empty($uri)) {
         return false;
     }
     $scheme = parse_url($uri, PHP_URL_SCHEME);
     // The check is done via the server for external urls.
     if (in_array($scheme, array('http', 'https', 'ftp', 'sftp'))) {
         return Zend_Uri::check($uri);
     }
     // Unknown or unmanaged scheme.
     if ($scheme != 'file' && $uri[0] != '/') {
         return false;
     }
     // Check the security setting.
     $settings = Zend_Registry::get('archive_folder');
     if ($settings->local_folders->allow != '1') {
         return false;
     }
     // Check the base path.
     $basepath = $settings->local_folders->base_path;
     $realpath = realpath($basepath);
     if ($basepath !== $realpath || strlen($realpath) <= 2) {
         return false;
     }
     // Check the uri.
     if ($settings->local_folders->check_realpath == '1') {
         if (strpos(realpath($uri), $realpath) !== 0 || !in_array(substr($uri, strlen($realpath), 1), array('', '/'))) {
             return false;
         }
     }
     // The uri is allowed.
     return true;
 }
开发者ID:Daniel-KM,项目名称:ArchiveFolder,代码行数:42,代码来源:Validator.php

示例7: savedomainAction

 public function savedomainAction()
 {
     if ($datas = $this->getRequest()->getPost()) {
         try {
             if (!empty($datas['domain'])) {
                 $datas['domain'] = trim(str_replace(array('https', 'http', '://'), '', $datas['domain']));
                 $parts = explode('/', $datas['domain']);
                 $datas['domain'] = !empty($parts[0]) ? $parts[0] : null;
                 $url = 'http://' . $datas['domain'];
                 if (!Zend_Uri::check($url)) {
                     throw new Exception($this->_('Please enter a valid address'));
                 } else {
                     if (addslashes($this->getRequest()->getBaseUrl()) == addslashes($url)) {
                         throw new Exception($this->_('Please enter a valid address'));
                     }
                 }
             } else {
                 $datas['domain'] = null;
             }
             $this->getApplication()->setDomain($datas['domain'])->save();
             $html = array('success' => '1', 'success_message' => $this->_('Infos successfully saved'), 'message_timeout' => 2, 'message_button' => 0, 'message_loader' => 0, 'domain' => $this->getApplication()->getDomain(), 'application_url' => $this->getApplication()->getUrl());
         } catch (Exception $e) {
             $html = array('message' => $e->getMessage());
         }
         $this->getLayout()->setHtml(Zend_Json::encode($html));
     }
 }
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:27,代码来源:SettingsController.php

示例8: onInitDependencies

 /**
  * Verifies config to make sure the Updater should run.
  * 1. It has not been configured yet
  * 2. Or it has been enabled at some point
  *
  * @param XenForo_Dependencies_Abstract $dependencies
  * @param string $apiUrl
  * @param string|null $addOnId
  * @throws XenForo_Exception
  */
 public static function onInitDependencies(XenForo_Dependencies_Abstract $dependencies, $apiUrl, $addOnId = null)
 {
     if (get_class($dependencies) !== 'XenForo_Dependencies_Admin') {
         // do nothing unless user are in AdminCP
         return;
     }
     if (XenForo_Application::$versionId < 1020000) {
         // only run if XenForo is at least 1.2.0
         return;
     }
     if (!Zend_Uri::check($apiUrl)) {
         throw new XenForo_Exception(sprintf('$apiUrl is invalid: %s', $apiUrl));
     }
     $addOnId = self::_getAddOnId($addOnId);
     $config = self::_getConfig($addOnId, $apiUrl);
     if (!empty($config['configured']) && empty($config['enabled'])) {
         // admin has turned it off, bye bye
         return;
     }
     if (!isset($GLOBALS[self::KEY])) {
         $GLOBALS[self::KEY] = array('version' => array(), 'onPreRoute' => array(), 'setupMethod' => array());
     }
     $GLOBALS[self::KEY]['version'][$apiUrl][self::$_version] = __CLASS__;
     if (!isset($GLOBALS[self::KEY]['onPreRoute'][$apiUrl])) {
         $GLOBALS[self::KEY]['onPreRoute'][$apiUrl] = create_function('$fc', __CLASS__ . '::onPreRoute($fc, ' . var_export($config, true) . ');');
         XenForo_CodeEvent::addListener('front_controller_pre_route', $GLOBALS[self::KEY]['onPreRoute'][$apiUrl]);
     }
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:38,代码来源:Updater.php

示例9: setCallbackUrl

 /**
  * Set the callback URL to be used by Publishers or Subscribers when
  * communication with the Hub Server
  *
  * @param string $url
  */
 public function setCallbackUrl($url)
 {
     if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) {
         require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
         throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' . ' of "' . $url . '" must be a non-empty string and a valid' . 'URL');
     }
     $this->_callbackUrl = $url;
 }
开发者ID:vijo,项目名称:rss2twi.php,代码行数:14,代码来源:HubServer.php

示例10: renderTagImage

 public function renderTagImage(array $tag, array $rendererStates)
 {
     $rendered = parent::renderTagImage($tag, $rendererStates);
     if (Zend_Uri::check($rendered)) {
         $this->_found[] = array('image', $rendered);
     }
     return '';
 }
开发者ID:Sywooch,项目名称:forums,代码行数:8,代码来源:ImageCollect.php

示例11: toQueryString

 /**
  * Cast to HTTP query string
  *
  * @param  mixed $url
  * @param  Zend_Oauth_Config_ConfigInterface $config
  * @param  null|array $params
  * @return string
  */
 public function toQueryString($url, Zend_Oauth_Config_ConfigInterface $config, array $params = null)
 {
     if (!Zend_Uri::check($url)) {
         throw new Zend_Oauth_Exception('\'' . $url . '\' is not a valid URI');
     }
     $params = $this->_httpUtility->assembleParams($url, $config, $params);
     return $this->_httpUtility->toEncodedQueryString($params);
 }
开发者ID:NerdGZ,项目名称:icingaweb2,代码行数:16,代码来源:Access.php

示例12: verifyUri

 /**
  * Verifies that the provided string is a valid URL
  *
  * @param string $url
  *
  * @return boolean
  */
 public static function verifyUri(&$uri, XenForo_DataWriter $dw, $fieldName = false)
 {
     if (Zend_Uri::check($uri)) {
         return true;
     }
     $dw->error(new XenForo_Phrase('please_enter_valid_url'), $fieldName);
     return false;
 }
开发者ID:Sywooch,项目名称:forums,代码行数:15,代码来源:Uri.php

示例13: _verifyRedirectUri

 protected function _verifyRedirectUri(&$redirectUri)
 {
     if (!Zend_Uri::check($redirectUri)) {
         $this->error(new XenForo_Phrase('bdapi_redirect_uri_must_be_valid'), 'redirect_uri');
         return false;
     }
     return true;
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:8,代码来源:Client.php

示例14: isValid

 /**
  * Validates if a string is valid as a sitemap location
  *
  * @link http://www.sitemaps.org/protocol.php#locdef <loc>
  *
  * @param  string  $value  value to validate
  * @return boolean
  */
 public function isValid($value)
 {
     $this->_setValue($value);
     if (!is_string($value)) {
         return false;
     }
     return Zend_Uri::check($value);
 }
开发者ID:crlang44,项目名称:frapi,代码行数:16,代码来源:Loc.php

示例15: isValid

 public function isValid($value)
 {
     if (!Zend_Uri::check($value)) {
         $this->_error(self::INVALID_URL);
         return false;
     }
     return true;
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:8,代码来源:Url.php


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