本文整理汇总了PHP中function_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP function_exists函数的具体用法?PHP function_exists怎么用?PHP function_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了function_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qqwb_env
function qqwb_env()
{
$msgs = array();
$files = array(ROOT_PATH . 'include/ext/qqwb/qqoauth.php', ROOT_PATH . 'include/ext/qqwb/oauth.php', ROOT_PATH . 'modules/qqwb.mod.php');
foreach ($files as $f) {
if (!is_file($f)) {
$msgs[] = "文件<b>{$f}</b>不存在";
}
}
$funcs = array('version_compare', array('fsockopen', 'pfsockopen'), 'preg_replace', array('iconv', 'mb_convert_encoding'), array("hash_hmac", "mhash"));
foreach ($funcs as $func) {
if (!is_array($func)) {
if (!function_exists($func)) {
$msgs[] = "函数<b>{$func}</b>不可用";
}
} else {
$t = false;
foreach ($func as $f) {
if (function_exists($f)) {
$t = true;
break;
}
}
if (!$t) {
$msgs[] = "函数<b>" . implode(" , ", $func) . "</b>都不可用";
}
}
}
return $msgs;
}
示例2: getThumbnailDimension
function getThumbnailDimension($path, $w, $h)
{
$dim = array('w' => $w, 'h' => $h);
if ($w && $h || (!$w && !$h)) return $dim;
if (@is_readable($path) && function_exists('getimagesize'))
{
$info = @getimagesize($path);
if (!empty($info) && count($info) > 1)
{
if (empty($w))
{
$w = round($h * $info[0] / $info[1]);
$dim['w'] = $w;
}
else
{
$h = round($w * $info[1] / $info[0]);
$dim['h'] = $h;
}
}
}
return $dim;
}
示例3: parse
/**
* Converts a YAML string to a PHP array.
*
* @param string $value A YAML string
* @param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
* @param Boolean $objectSupport true if object support is enabled, false otherwise
*
* @return array A PHP array representing the YAML string
*/
public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
self::$exceptionOnInvalidType = $exceptionOnInvalidType;
self::$objectSupport = $objectSupport;
$value = trim($value);
if (0 == strlen($value)) {
return '';
}
if (function_exists('mb_internal_encoding') && (int) ini_get('mbstring.func_overload') & 2) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('ASCII');
}
$i = 0;
switch ($value[0]) {
case '[':
$result = self::parseSequence($value, $i);
++$i;
break;
case '{':
$result = self::parseMapping($value, $i);
++$i;
break;
default:
$result = self::parseScalar($value, null, array('"', "'"), $i);
}
// some comments are allowed at the end
if (preg_replace('/\\s+#.*$/A', '', substr($value, $i))) {
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)));
}
if (isset($mbEncoding)) {
mb_internal_encoding($mbEncoding);
}
return $result;
}
示例4: cherry_plugin_settings
function cherry_plugin_settings()
{
global $wpdb;
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$upload_dir = wp_upload_dir();
$plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . 'cherry-plugin.php');
//Cherry plugin constant variables
define('CHERRY_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CHERRY_PLUGIN_URL', plugin_dir_url(__FILE__));
define('CHERRY_PLUGIN_DOMAIN', $plugin_data['TextDomain']);
define('CHERRY_PLUGIN_DOMAIN_DIR', $plugin_data['DomainPath']);
define('CHERRY_PLUGIN_VERSION', $plugin_data['Version']);
define('CHERRY_PLUGIN_NAME', $plugin_data['Name']);
define('CHERRY_PLUGIN_SLUG', plugin_basename(__FILE__));
define('CHERRY_PLUGIN_DB', $wpdb->prefix . CHERRY_PLUGIN_DOMAIN);
define('CHERRY_PLUGIN_REMOTE_SERVER', esc_url('http://tmbhtest.com/cherryframework.com/components_update/'));
//Other constant variables
define('CURRENT_THEME_DIR', get_stylesheet_directory());
define('CURRENT_THEME_URI', get_stylesheet_directory_uri());
define('UPLOAD_BASE_DIR', str_replace("\\", "/", $upload_dir['basedir']));
define('UPLOAD_DIR', str_replace("\\", "/", $upload_dir['path'] . '/'));
// if ( !defined('API_URL') ) {
// define( 'API_URL', esc_url( 'http://updates.cherry.template-help.com/cherrymoto/v3/api/' ) );
// }
load_plugin_textdomain(CHERRY_PLUGIN_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/' . CHERRY_PLUGIN_DOMAIN_DIR);
do_action('cherry_plugin_settings');
}
示例5: run
/**
* Standard modular run function.
*
* @return tempcode Results
*/
function run()
{
if (get_forum_type() != 'ocf') {
return new ocp_tempcode();
} else {
ocf_require_all_forum_stuff();
}
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
require_code('ocf_posts_action');
require_code('ocf_posts_action2');
// Members
$start = 0;
do {
$members = $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 500, $start);
foreach ($members as $member) {
ocf_force_update_member_post_count($member['id']);
$num_warnings = $GLOBALS['FORUM_DB']->query_value('f_warnings', 'COUNT(*)', array('w_member_id' => $member['id'], 'w_is_warning' => 1));
$GLOBALS['FORUM_DB']->query_update('f_members', array('m_cache_warnings' => $num_warnings), array('id' => $member['id']), '', 1);
}
$start += 500;
} while (array_key_exists(0, $members));
return new ocp_tempcode();
}
示例6: get_exif
function get_exif($file)
{
if (!function_exists('exif_read_data')) {
return false;
}
$exif = @exif_read_data($file, "IFD0");
if ($exif === false) {
return false;
}
$exif_info = exif_read_data($file, NULL, true);
$exif_arr = $this->supported_exif();
$new_exif = array();
foreach ($exif_arr as $k => $v) {
$arr = explode('.', $v);
if (isset($exif_info[$arr[0]])) {
if (isset($exif_info[$arr[0]][$arr[1]])) {
$new_exif[$k] = $exif_info[$arr[0]][$arr[1]];
} else {
$new_exif[$k] = false;
}
} else {
$new_exif[$k] = false;
}
if ($k == 'Software' && !empty($new_exif['Software'])) {
$new_exif['Software'] = preg_replace('/([^a-zA-Z0-9_\\-,\\.\\:&#@!\\(\\)\\s]+)/i', '', $new_exif['Software']);
}
}
return $new_exif;
}
示例7: __aws_sdk_ua_callback
function __aws_sdk_ua_callback()
{
$ua_append = '';
$extensions = get_loaded_extensions();
$sorted_extensions = array();
if ($extensions) {
foreach ($extensions as $extension) {
if ($extension === 'curl' && function_exists('curl_version')) {
$curl_version = curl_version();
$sorted_extensions[strtolower($extension)] = $curl_version['version'];
} elseif ($extension === 'pcre' && defined('PCRE_VERSION')) {
$pcre_version = explode(' ', PCRE_VERSION);
$sorted_extensions[strtolower($extension)] = $pcre_version[0];
} elseif ($extension === 'openssl' && defined('OPENSSL_VERSION_TEXT')) {
$openssl_version = explode(' ', OPENSSL_VERSION_TEXT);
$sorted_extensions[strtolower($extension)] = $openssl_version[1];
} else {
$sorted_extensions[strtolower($extension)] = phpversion($extension);
}
}
}
foreach (array('simplexml', 'json', 'pcre', 'spl', 'curl', 'openssl', 'apc', 'xcache', 'memcache', 'memcached', 'pdo', 'pdo_sqlite', 'sqlite', 'sqlite3', 'zlib', 'xdebug') as $ua_ext) {
if (isset($sorted_extensions[$ua_ext]) && $sorted_extensions[$ua_ext]) {
$ua_append .= ' ' . $ua_ext . '/' . $sorted_extensions[$ua_ext];
} elseif (isset($sorted_extensions[$ua_ext])) {
$ua_append .= ' ' . $ua_ext . '/0';
}
}
return $ua_append;
}
示例8: __construct
function __construct($applicationID, $apiKey, $hostsArray = null, $options = array())
{
if ($hostsArray == null) {
$this->context = new ClientContext($applicationID, $apiKey, null);
} else {
$this->context = new ClientContext($applicationID, $apiKey, $hostsArray);
}
if (!function_exists('curl_init')) {
throw new \Exception('AlgoliaSearch requires the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
throw new \Exception('AlgoliaSearch requires the JSON PHP extension.');
}
$this->cainfoPath = __DIR__ . '/../../resources/ca-bundle.crt';
foreach ($options as $option => $value) {
switch ($option) {
case self::CAINFO:
$this->cainfoPath = $value;
break;
case self::CURLOPT:
$this->curlOptions = $this->checkCurlOptions($value);
break;
default:
throw new \Exception('Unknown option: ' . $option);
break;
}
}
}
示例9: setUp
public function setUp()
{
parent::setUp();
if (!function_exists('gd_info')) {
$this->markTestSkipped('Gd not installed');
}
}
示例10: ox_adding_scripts
function ox_adding_scripts()
{
if (!function_exists('is_login_page')) {
function is_login_page()
{
return !strncmp($_SERVER['REQUEST_URI'], '/wp-login.php', strlen('/wp-login.php'));
}
}
if (!is_admin() && !is_login_page()) {
/*removed wp-embed.min.js*/
wp_deregister_script('wp-embed');
/*jquery*/
wp_deregister_script('jquery');
$infooter = !is_page(array($order_form_pages)) ? true : false;
wp_register_script('jquery', "http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js", false, '1.11.3', $infooter);
wp_enqueue_script('jquery');
/*bootstrap*/
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css');
/*slicknav menu*/
wp_enqueue_script('slicknav', get_template_directory_uri() . '/js/jquery.slicknav.min.js', array('jquery'), '', true);
/*bxslider*/
wp_enqueue_style('bxslider', get_template_directory_uri() . '/css/jquery.bxslider.min.css');
wp_enqueue_script('bxslider', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array('jquery'), '', true);
/*zopim chat*/
wp_enqueue_script('zopim', get_template_directory_uri() . '/js/zopimClear.js', array('jquery'), '', true);
/*custom css*/
wp_enqueue_style('custom', get_template_directory_uri() . '/style.css', array('bootstrap'));
/*custom js*/
wp_enqueue_script('custom', get_template_directory_uri() . '/js/custom.js', array('jquery'), '', true);
}
}
示例11: init
/**
* Initializes this application component.
* This method is required by the {@link IApplicationComponent} interface.
* It checks the availability of eAccelerator.
* @throws CException if eAccelerator extension is not loaded, is disabled or the cache functions are not compiled in.
*/
public function init()
{
parent::init();
if (!function_exists('eaccelerator_get')) {
throw new CException(Yii::t('yii', 'CEAcceleratorCache requires PHP eAccelerator extension to be loaded, enabled or compiled with the "--with-eaccelerator-shared-memory" option.'));
}
}
示例12: _init_env
private function _init_env()
{
error_reporting(E_ERROR);
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
// ' " \ NULL 等字符转义 当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1
define('GZIP', function_exists('ob_gzhandler'));
// ob 缓存压缩输出
if (function_exists('date_default_timezone_set')) {
@date_default_timezone_set('Etc/GMT-8');
//东八区 北京时间
}
define('TIMESTAMP', time());
if (!defined('BLOG_FUNCTION') && !@(include BLOG_ROOT . '/source/functions.php')) {
exit('functions.php is missing');
}
define('IS_ROBOT', checkrobot());
global $_B;
$_B = array('uid' => 0, 'username' => '', 'groupid' => 0, 'timestamp' => TIMESTAMP, 'clientip' => $this->_get_client_ip(), 'mobile' => '', 'agent' => '', 'admin' => 0);
checkmobile();
$_B['PHP_SELF'] = bhtmlspecialchars($this->_get_script_url());
$_B['basefilename'] = basename($_B['PHP_SELF']);
$sitepath = substr($_B['PHP_SELF'], 0, strrpos($_B['PHP_SELF'], '/'));
$_B['siteurl'] = bhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/');
getReferer();
$url = parse_url($_B['siteurl']);
$_B['siteroot'] = isset($url['path']) ? $url['path'] : '';
$_B['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
$this->b =& $_B;
}
示例13: FmtPageList
function FmtPageList($fmt, $pagename, $opt)
{
global $GroupPattern, $FmtV, $FPLFunctions;
# if (isset($_REQUEST['q']) && $_REQUEST['q']=='') $_REQUEST['q']="''";
$rq = htmlspecialchars(stripmagic(@$_REQUEST['q']), ENT_NOQUOTES);
$FmtV['$Needle'] = $opt['o'] . ' ' . $rq;
if (preg_match("!^({$GroupPattern}(\\|{$GroupPattern})*)?/!i", $rq, $match)) {
$opt['group'] = @$match[1];
$rq = substr($rq, strlen(@$match[1]) + 1);
}
$opt = array_merge($opt, ParseArgs($opt['o'] . ' ' . $rq), @$_REQUEST);
if (@($opt['req'] && !$opt['-'] && !$opt[''] && !$opt['+'] && !$opt['q'])) {
return;
}
$matches = array();
$fmtfn = @$FPLFunctions[$opt['fmt']];
if (!function_exists($fmtfn)) {
$fmtfn = 'FPLByGroup';
}
$out = $fmtfn($pagename, $matches, $opt);
$FmtV['$MatchCount'] = count($matches);
$GLOBALS['SearchIncl'] = array_merge((array) @$opt[''], (array) @$opt['+']);
$GLOBALS['SearchExcl'] = array_merge((array) $opt['-']);
$GLOBALS['SearchGroup'] = @$opt['group'];
if ($fmt != '$MatchList') {
$FmtV['$MatchList'] = $out;
$out = FmtPageName($fmt, $pagename);
}
if ($out[0] == '<') {
return '<div>' . Keep($out) . '</div>';
}
PRR();
return $out;
}
示例14: check_update
public static function check_update($plugin_path, $plugin_slug, $plugin_url, $offering, $key, $version, $option)
{
$version_info = function_exists('get_site_transient') ? get_site_transient("gforms_userregistration_version") : get_transient("gforms_userregistration_version");
//making the remote request for version information
if (!$version_info) {
//Getting version number
$version_info = self::get_version_info($offering, $key, $version);
self::set_version_info($version_info);
}
if ($version_info == -1) {
return $option;
}
if (empty($option->response[$plugin_path])) {
$option->response[$plugin_path] = new stdClass();
}
//Empty response means that the key is invalid. Do not queue for upgrade
if (!$version_info["is_valid_key"] || version_compare($version, $version_info["version"], '>=')) {
unset($option->response[$plugin_path]);
} else {
$option->response[$plugin_path]->url = $plugin_url;
$option->response[$plugin_path]->slug = $plugin_slug;
$option->response[$plugin_path]->package = str_replace("{KEY}", $key, $version_info["url"]);
$option->response[$plugin_path]->new_version = $version_info["version"];
$option->response[$plugin_path]->id = "0";
}
return $option;
}
示例15: apache_request_headers_
function apache_request_headers_()
{
if (!function_exists('apache_request_headers')) {
return default_request_headers_();
}
return apache_request_headers();
}