• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP extension_loaded函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中extension_loaded函数的典型用法代码示例。如果您正苦于以下问题:PHP extension_loaded函数的具体用法?PHP extension_loaded怎么用?PHP extension_loaded使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: dump

function dump($var, $echo = true, $label = null, $strict = true)
{
    $label = $label === null ? '' : rtrim($label) . ' ';
    if (!$strict) {
        if (ini_get('html_errors')) {
            $output = print_r($var, true);
            $output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        } else {
            $output = $label . " : " . print_r($var, true);
        }
    } else {
        ob_start();
        var_dump($var);
        $output = ob_get_clean();
        if (!extension_loaded('xdebug')) {
            $output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
        }
    }
    if ($echo) {
        echo $output;
        return null;
    } else {
        return $output;
    }
}
开发者ID:winiceo,项目名称:job,代码行数:26,代码来源:lib.php


示例2: _testXPath

 function _testXPath($xpath_expression)
 {
     if (!class_exists('DOMDocument') || !class_exists('DOMXPath')) {
         if (function_exists('domxml_open_mem')) {
             $dom = domxml_open_mem($this->_response);
             if (!$dom) {
                 $this->fail('Error parsing doc');
                 return false;
             }
             var_dump($dom);
             $xpath = $dom->xpath_init();
             var_dump($xpath);
             $ctx = $dom->xpath_new_context();
             var_dump($xpath_expression);
             $result = $ctx->xpath_eval($xpath_expression);
             var_dump($result);
             $return = new stdClass();
             $return->length = count($result->nodeset);
             return $return;
         }
         $this->fail('No xpath support built in');
         return false;
     } else {
         if (extension_loaded('domxml')) {
             $this->fail('Please disable the domxml extension. Only php5 builtin domxml is supported');
             return false;
         }
     }
     $dom = new DOMDocument();
     $dom->loadHtml($this->_response);
     $xpath = new DOMXPath($dom);
     $node = $xpath->query($xpath_expression);
     return $node;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:34,代码来源:AkTestApplication.php


示例3: __construct

 /**
  * Constructor
  *
  * @param array $options associative array of options
  * @throws Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     if (!extension_loaded('memcache')) {
         Zend_Cache::throwException('The memcache extension must be loaded for using this backend !');
     }
     parent::__construct($options);
     if (isset($this->_options['servers'])) {
         $value = $this->_options['servers'];
         if (isset($value['host'])) {
             // in this case, $value seems to be a simple associative array (one server only)
             $value = array(0 => $value);
             // let's transform it into a classical array of associative arrays
         }
         $this->setOption('servers', $value);
     }
     $this->_memcache = new Memcache();
     foreach ($this->_options['servers'] as $server) {
         if (!array_key_exists('persistent', $server)) {
             $server['persistent'] = Zend_Cache_Backend_Memcached::DEFAULT_PERSISTENT;
         }
         if (!array_key_exists('port', $server)) {
             $server['port'] = Zend_Cache_Backend_Memcached::DEFAULT_PORT;
         }
         $this->_memcache->addServer($server['host'], $server['port'], $server['persistent']);
     }
 }
开发者ID:Velrok,项目名称:wg-organizer,代码行数:33,代码来源:Memcached.php


示例4: init

 public function init()
 {
     $this->settings = get_option('ninja_forms_settings');
     if (!extension_loaded('curl')) {
         throw new Exception(sprintf(__('The cURL extension is not loaded. %sPlease ensure its installed and activated.%s', 'ninja-forms-upload'), '<a href="http://php.net/manual/en/curl.installation.php">', '</a>'));
     }
     $this->oauth = new Dropbox_OAuth_Consumer_Curl(self::CONSUMER_KEY, self::CONSUMER_SECRET);
     $this->oauth_state = $this->get_option('dropbox_oauth_state');
     $this->request_token = $this->get_token('request');
     $this->access_token = $this->get_token('access');
     if ($this->oauth_state == 'request') {
         //If we have not got an access token then we need to grab one
         try {
             $this->oauth->setToken($this->request_token);
             $this->access_token = $this->oauth->getAccessToken();
             $this->oauth_state = 'access';
             $this->oauth->setToken($this->access_token);
             $this->save_tokens();
             //Supress the error because unlink, then init should be called
         } catch (Exception $e) {
         }
     } elseif ($this->oauth_state == 'access') {
         $this->oauth->setToken($this->access_token);
     } else {
         //If we don't have an acess token then lets setup a new request
         $this->request_token = $this->oauth->getRequestToken();
         $this->oauth->setToken($this->request_token);
         $this->oauth_state = 'request';
         $this->save_tokens();
     }
     $this->dropbox = new Dropbox_API($this->oauth);
 }
开发者ID:seancho0420,项目名称:globalink,代码行数:32,代码来源:dropbox.php


示例5: refresh

 public function refresh($force = false)
 {
     if (extension_loaded('curl')) {
         $data = array();
         if ($force) {
             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "'");
         } else {
             $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "currency WHERE code != '" . $this->db->escape($this->config->get('config_currency')) . "' AND date_modified < '" . $this->db->escape(date('Y-m-d H:i:s', strtotime('-1 day'))) . "'");
         }
         foreach ($query->rows as $result) {
             $data[] = $this->config->get('config_currency') . $result['code'] . '=X';
         }
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, 'http://download.finance.yahoo.com/d/quotes.csv?s=' . implode(',', $data) . '&f=sl1&e=.csv');
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_HEADER, false);
         curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
         curl_setopt($curl, CURLOPT_TIMEOUT, 30);
         $content = curl_exec($curl);
         curl_close($curl);
         $lines = explode("\n", trim($content));
         foreach ($lines as $line) {
             $currency = utf8_substr($line, 4, 3);
             $value = utf8_substr($line, 11, 6);
             if ((double) $value) {
                 $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (double) $value . "', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
             }
         }
         $this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" . $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");
         $this->cache->delete('currency');
     }
 }
开发者ID:royopa,项目名称:arastta,代码行数:32,代码来源:currency.php


示例6: __construct

 /**
  * Constructor
  * 
  * @param  array $opts 
  * @return void
  * @throws Zend\Serializer\Exception if wddx extension not found
  */
 public function __construct($opts = array())
 {
     if (!extension_loaded('wddx')) {
         throw new ExtensionNotLoadedException('PHP extension "wddx" is required for this adapter');
     }
     parent::__construct($opts);
 }
开发者ID:alab1001101,项目名称:zf2,代码行数:14,代码来源:WDDX.php


示例7: check

 public function check()
 {
     if (phpversion() < '5.0.0') {
         return Response::json(FAIL, array('您的php版本过低,不能安装本软件,请升级到5.0.0或更高版本再安装,谢谢!'));
     }
     if (!extension_loaded('PDO')) {
         return Response::json(FAIL, array('请加载PHP的PDO模块,谢谢!'));
     }
     if (!function_exists('session_start')) {
         return Response::json(FAIL, array('请开启session,谢谢!'));
     }
     if (!is_writable(ROOT_PATH)) {
         return Response::json(FAIL, array('请保证代码目录有写权限,谢谢!'));
     }
     $config = (require CONFIG_PATH . 'mysql.php');
     try {
         $mysql = new PDO('mysql:host=' . $config['master']['host'] . ';port=' . $config['master']['port'], $config['master']['user'], $config['master']['pwd']);
     } catch (Exception $e) {
         return Response::json(FAIL, array('请正确输入信息连接mysql,保证启动mysql,谢谢!'));
     }
     $mysql->exec('CREATE DATABASE ' . $config['master']['dbname']);
     $mysql = null;
     unset($config);
     return Response::json(SUCC, array('检测通过'));
 }
开发者ID:swg0110,项目名称:iBarn,代码行数:25,代码来源:Install.class.php


示例8: parse

 /**
  * @param string xml content
  * @return true|PEAR_Error
  */
 function parse($data)
 {
     if (!extension_loaded('xml')) {
         include_once 'PEAR.php';
         return PEAR::raiseError("XML Extension not found", 1);
     }
     $this->_dataStack = $this->_valStack = array();
     $this->_depth = 0;
     if (strpos($data, 'encoding="UTF-8"') || strpos($data, 'encoding="utf-8"') || strpos($data, "encoding='UTF-8'") || strpos($data, "encoding='utf-8'")) {
         $this->encoding = 'UTF-8';
     }
     if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') {
         $data = utf8_decode($data);
         $this->encoding = 'ISO-8859-1';
     }
     $xp = xml_parser_create($this->encoding);
     xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
     xml_set_object($xp, $this);
     xml_set_element_handler($xp, 'startHandler', 'endHandler');
     xml_set_character_data_handler($xp, 'cdataHandler');
     if (!xml_parse($xp, $data)) {
         $msg = xml_error_string(xml_get_error_code($xp));
         $line = xml_get_current_line_number($xp);
         xml_parser_free($xp);
         include_once 'PEAR.php';
         return PEAR::raiseError("XML Error: '{$msg}' on line '{$line}'", 2);
     }
     xml_parser_free($xp);
     return true;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:34,代码来源:XMLParser.php


示例9: displayList

 public function displayList()
 {
     global $cookie, $currentIndex;
     $warnings = array();
     if (!file_exists(_PS_ROOT_DIR_ . '/.htaccess')) {
         $warnings[] = $this->l('In order to enable the PrestaShop Webservice, please generate the .htaccess file via the "Generators" tab (in the "Tools" tab).');
     }
     if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === false) {
         $warnings[] = $this->l('To avoid operating problems, please use an Apache server.');
     }
     if (function_exists('apache_get_modules')) {
         $apache_modules = apache_get_modules();
         if (!in_array('mod_auth_basic', $apache_modules)) {
             $warnings[] = $this->l('Please activate the Apache module \'mod_auth_basic\' to allow authentication of PrestaShop webservice.');
         }
         if (!in_array('mod_rewrite', $apache_modules)) {
             $warnings[] = $this->l('Please activate the Apache module \'mod_rewrite\' to allow using the PrestaShop webservice.');
         }
     } else {
         $warnings[] = $this->l('We could not check if basic authentication and rewrite extensions are activated. Please manually check if they are activated in order to use the PrestaShop webservice.');
     }
     if (!extension_loaded('SimpleXML')) {
         $warnings[] = $this->l('Please activate the PHP extension \'SimpleXML\' to allow testing of PrestaShop webservice.');
     }
     if (!configuration::get('PS_SSL_ENABLED')) {
         $warnings[] = $this->l('If possible, it is preferable to use SSL (https) for webservice calls, as it avoids the security issues of type "man in the middle".');
     }
     $this->displayWarning($warnings);
     foreach ($this->_list as $k => $item) {
         if ($item['is_module'] && $item['class_name'] && $item['module_name'] && ($instance = Module::getInstanceByName($item['module_name'])) && !$instance->useNormalPermissionBehaviour()) {
             unset($this->_list[$k]);
         }
     }
     parent::displayList();
 }
开发者ID:greench,项目名称:prestashop,代码行数:35,代码来源:AdminWebservice.php


示例10: stemWord

 /**
  * Apply Spanish normalizing logic to string.
  *
  * @param array $words
  * @return array
  */
 public static function stemWord($string)
 {
     if (extension_loaded('stem')) {
         return stem_spanish($string);
     }
     return $string;
 }
开发者ID:pierswarmers,项目名称:rtCorePlugin,代码行数:13,代码来源:rtIndexCleanerEs.class.php


示例11: setUp

 public function setUp()
 {
     if (!extension_loaded('openssl')) {
         $this->markTestSkipped('Tests_HTTP_Functions requires openssl.');
     }
     parent::setUp();
 }
开发者ID:rclilly,项目名称:wordpress-develop,代码行数:7,代码来源:functions.php


示例12: _processXmlResponse

 private function _processXmlResponse($url, $xml = '')
 {
     /* 
     A private utility method used by other public methods to process XML responses.
     */
     if (extension_loaded('curl')) {
         $ch = curl_init() or die(curl_error());
         $timeout = 10;
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
         if (!empty($xml)) {
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
             curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/xml', 'Content-length: ' . strlen($xml)));
         }
         $data = curl_exec($ch);
         curl_close($ch);
         if ($data) {
             return new \SimpleXMLElement($data);
         } else {
             return false;
         }
     }
     if (!empty($xml)) {
         throw new Exception('Set xml, but curl does not installed.');
     }
     return simplexml_load_file($url);
 }
开发者ID:Kerion,项目名称:bbb-api,代码行数:32,代码来源:BigBlueButton.php


示例13: verifySupport

 /**
  * Verify that we can support the curl extention.
  * If this is not the case we will throw a BadFunctionCallException.
  *
  * @throws BadFunctionCallException
  * @return bool
  */
 public function verifySupport()
 {
     if (!extension_loaded('curl')) {
         throw new \BadFunctionCallException('The cURL extension is required.');
     }
     return true;
 }
开发者ID:johnnymast,项目名称:redbox-crawl,代码行数:14,代码来源:Curl.php


示例14: __construct

 /**
 +----------------------------------------------------------
 * 架构函数
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 * @param array $config 数据库配置数组
 +----------------------------------------------------------
 */
 public function __construct($config = '')
 {
     if (!extension_loaded('mysql')) {
         throw_exception(L('_NOT_SUPPERT_') . ':mysql');
     }
     $this->config = $this->parseConfig($config);
 }
开发者ID:nexteee,项目名称:php,代码行数:16,代码来源:Db.class.php


示例15: __construct

 /**
  * Class constructor
  *
  * @param array|Zend_Config|null $options (Optional) Options to set
  */
 public function __construct($options = null)
 {
     if (!extension_loaded('zlib')) {
         throw new Zend_Filter_Exception('This filter needs the zlib extension');
     }
     parent::__construct($options);
 }
开发者ID:trigoesrodrigo,项目名称:icingaweb2,代码行数:12,代码来源:Gz.php


示例16: send

 private function send($url, $headers, $data)
 {
     if (!extension_loaded('curl')) {
         die('Sorry cURL is not installed!');
     }
     $uri = HydnaUtil::parse_uri($url);
     $curl_handle = curl_init();
     $conn = sprintf('%s://%s:%d%s', $uri['scheme'], $uri['host'], $uri['port'], $uri['channel']);
     if (!empty($uri['token'])) {
         $conn .= sprintf('?%s', $uri['token']);
     }
     curl_setopt($curl_handle, CURLOPT_URL, $conn);
     curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, Hydna::$TIMEOUT);
     curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $headers);
     $data = HydnaUtil::clean_payload($data);
     curl_setopt($curl_handle, CURLOPT_POST, true);
     curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);
     $result = curl_exec($curl_handle);
     $code = curl_getinfo($curl_handle, CURLINFO_HTTP_CODE);
     curl_close($curl_handle);
     if ($code != 200) {
         throw new Exception("Error, response code: " . $code);
     }
     return true;
 }
开发者ID:pythonpoole,项目名称:hydna-php,代码行数:26,代码来源:hydna-push.php


示例17: __construct

 /**
  * Constructor
  *
  * @param  array $options associative array of options
  * @throws Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     if (!extension_loaded('xcache')) {
         Zend_Cache::throwException('The xcache extension must be loaded for using this backend !');
     }
     parent::__construct($options);
 }
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:14,代码来源:Xcache.php


示例18: escape

 public function escape(array $values)
 {
     if (extension_loaded("mbstring")) {
         $toEnc = defined("SDB_MSSQL_ENCODING") ? SDB_MSSQL_ENCODING : "SJIS";
         $fromEnc = mb_internal_encoding();
         $currentRegexEnc = mb_regex_encoding();
         mb_regex_encoding($fromEnc);
         foreach ($values as $k => &$val) {
             if (is_bool($val)) {
                 $val = $val ? "1" : "0";
             } elseif (is_string($val)) {
                 $val = "'" . mb_convert_encoding(mb_ereg_replace("'", "''", $val), $toEnc, $fromEnc) . "'";
             }
         }
         mb_regex_encoding($currentRegexEnc);
     } else {
         foreach ($values as &$val) {
             if (is_bool($val)) {
                 $val = $val ? "1" : "0";
             } elseif (is_string($val)) {
                 $val = "'" . str_replace("'", "''", $val) . "'";
             }
         }
     }
     return $values;
 }
开发者ID:reoring,项目名称:sabel,代码行数:26,代码来源:Statement.php


示例19: isPhpGd

 /**
  * Check if php GD library is installed or not
  * @last edit: $arsalanshah
  * @Reason: Initial;
  *
  */
 public static function isPhpGd()
 {
     if (extension_loaded('gd') && function_exists('gd_info')) {
         return true;
     }
     return false;
 }
开发者ID:nongdanit-nongdanit,项目名称:ossn,代码行数:13,代码来源:OssnInstall.php


示例20: __construct

 /**
  * Class constructor
  */
 public function __construct()
 {
     if (!extension_loaded('lzf')) {
         require_once 'Zend/Filter/Exception.php';
         throw new Zend_Filter_Exception('This filter needs the lzf extension');
     }
 }
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:10,代码来源:Lzf.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP extern_server_file函数代码示例发布时间:2022-05-15
下一篇:
PHP extension_allowed函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap