PHP Функция function_exists - примеры использования

На этой странице представлены лучшие примеры PHP кода для метода function_exists, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
Показать файл Файл: ocf_members.php Проект: erico-deh/ocPortal
1
 /**
  * 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();
 }
Пример #2
Показать файл Файл: qqwb_env.func.php Проект: YouthAndra/huaitaoo2o
0
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;
}
Пример #3
Показать файл Файл: ImageTypeTest.php Проект: Antoad/GenemuFormBundle
0
 public function setUp()
 {
     parent::setUp();
     if (!function_exists('gd_info')) {
         $this->markTestSkipped('Gd not installed');
     }
 }
Пример #4
Показать файл Файл: CEAcceleratorCache.php Проект: alsvader/hackbanero
0
 /**
  * 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.'));
     }
 }
Пример #5
Показать файл Файл: exif.class.php Проект: vluo/myPoto
0
 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;
 }
Пример #6
Показать файл Файл: cherry-plugin.php Проект: drupalninja/schome_org
0
 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');
 }
Пример #7
Показать файл Файл: jam_application.php Проект: jammarmalade/blog
0
 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;
 }
Пример #8
Показать файл Файл: class.misc.php Проект: kumarsivarajan/ctrl-dock
0
 function decrypt($text, $salt)
 {
     if (!function_exists('mcrypt_encrypt') || !function_exists('mcrypt_decrypt')) {
         return $text;
     }
     return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
 }
Пример #9
Показать файл Файл: apache.adapter.php Проект: notmaintained/inertia
0
function apache_request_headers_()
{
    if (!function_exists('apache_request_headers')) {
        return default_request_headers_();
    }
    return apache_request_headers();
}
Пример #10
Показать файл Файл: UpdatesForm.php Проект: dsyman2/X2CRM
0
 public function __construct($config, $transFunc, $transFuncArgs = array())
 {
     $this->config = array('x2_version' => '', 'php_version' => phpversion(), 'GD_support' => function_exists('gd_info') ? 1 : 0, 'db_type' => 'MySQL', 'db_version' => '', 'unique_id' => 'none', 'formId' => '', 'submitButtonId' => '', 'statusId' => '', 'themeUrl' => '', 'titleWrap' => array('<h2>', '</h2>'), 'receiveUpdates' => 1, 'serverInfo' => False, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'registered' => 0, 'edition' => 'opensource', 'isUpgrade' => False);
     foreach ($config as $key => $value) {
         $this->config[$key] = $value;
     }
     // Is it OS edition?
     $this->os = $config['edition'] == 'opensource' && !$this->config['isUpgrade'];
     // Empty the unique_id field; user will fill it.
     if (!$this->os) {
         if ($this->config['unique_id'] == 'none') {
             $this->config['unique_id'] = '';
         }
     }
     // $this->config['unique_id'] = 'something'; // To test what the form looks like when unique_id is filled
     // Translate all messages for the updates form:
     foreach (array('label', 'message', 'leadSources') as $attr) {
         $attrArr = $this->{$attr};
         foreach (array_keys($this->{$attr}) as $key) {
             $attrArr[$key] = call_user_func_array($transFunc, array_merge($transFuncArgs, array($attrArr[$key])));
         }
         $this->{$attr} = $attrArr;
     }
     $this->message['connectionNOsMessage'] .= ': <a href="http://www.x2crm.com/contact/">x2crm.com</a>.';
 }
Пример #11
Показать файл Файл: Install.class.php Проект: swg0110/iBarn
0
 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('检测通过'));
 }
Пример #12
Показать файл Файл: functions.php Проект: OlgaX/wp-template
0
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);
    }
}
Пример #13
Показать файл Файл: Controller.php Проект: neolf/PIWIK4MOBILE
0
 /**
  * Output binary image from base-64 encoded data.
  *
  * @deprecated 1.5.1
  *
  * @param string $imageData Base-64 encoded image data (via $_POST)
  */
 public static function outputBinaryImage()
 {
     Piwik::checkUserHasSomeViewAccess();
     $rawData = Piwik_Common::getRequestVar('imageData', '', 'string', $_POST);
     // returns false if any illegal characters in input
     $data = base64_decode($rawData);
     if ($data !== false) {
         // check for PNG header
         if (Piwik_Common::substr($data, 0, 8) === "‰PNG\r\n\n") {
             header('Content-Type: image/png');
             // more robust validation (if available)
             if (function_exists('imagecreatefromstring')) {
                 // validate image data
                 $imgResource = @imagecreatefromstring($data);
                 if ($imgResource !== false) {
                     // output image and clean-up
                     imagepng($imgResource);
                     imagedestroy($imgResource);
                     exit;
                 }
             } else {
                 echo $data;
                 exit;
             }
         }
     }
     Piwik::setHttpStatus('400 Bad Request');
     exit;
 }
Пример #14
Показать файл Файл: jobseeker_edit.php Проект: rcm-dev/jobsperak
0
 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
 {
     if (PHP_VERSION < 6) {
         $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
     }
     $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
     switch ($theType) {
         case "text":
             $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
             break;
         case "long":
         case "int":
             $theValue = $theValue != "" ? intval($theValue) : "NULL";
             break;
         case "double":
             $theValue = $theValue != "" ? doubleval($theValue) : "NULL";
             break;
         case "date":
             $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
             break;
         case "defined":
             $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
             break;
     }
     return $theValue;
 }
Пример #15
Показать файл Файл: Client.php Проект: nicolasverlhiac/algoliasearch-client-php
0
 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;
         }
     }
 }
Пример #16
Показать файл Файл: plugin-upgrade.php Проект: vinvinh315/maintainwebsolutions.com
0
 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;
 }
Пример #17
Показать файл Файл: cfruntime.php Проект: kostya1017/our
0
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;
}
Пример #18
Показать файл Файл: pagelist.php Проект: BogusCurry/pmwiki
0
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;
}
Пример #19
Показать файл Файл: exclude-woo.php Проект: Chr15t1anRJW/RJW-functionality-plugin
0
function child_manage_woocommerce_styles()
{
    //remove generator meta tag
    remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator'));
    //first check that woo exists to prevent fatal errors
    if (function_exists('is_woocommerce')) {
        //dequeue scripts and styles
        if (!is_woocommerce() && !is_cart() && !is_checkout()) {
            wp_dequeue_style('woocommerce_frontend_styles');
            wp_dequeue_style('woocommerce_fancybox_styles');
            wp_dequeue_style('woocommerce_chosen_styles');
            wp_dequeue_style('woocommerce_prettyPhoto_css');
            wp_dequeue_script('wc_price_slider');
            wp_dequeue_script('wc-single-product');
            wp_dequeue_script('wc-add-to-cart');
            wp_dequeue_script('wc-cart-fragments');
            wp_dequeue_script('wc-checkout');
            wp_dequeue_script('wc-add-to-cart-variation');
            wp_dequeue_script('wc-single-product');
            wp_dequeue_script('wc-cart');
            wp_dequeue_script('wc-chosen');
            wp_dequeue_script('woocommerce');
            wp_dequeue_script('prettyPhoto');
            wp_dequeue_script('prettyPhoto-init');
            wp_dequeue_script('jquery-blockui');
            wp_dequeue_script('jquery-placeholder');
            wp_dequeue_script('fancybox');
            wp_dequeue_script('jqueryui');
        }
    }
}
Пример #20
Показать файл Файл: HTTPRequest.class.php Проект: viniciusbudines/sisnuss
0
 public function processRequest($method = 'POST')
 {
     $params = http_build_query($this->urlParams);
     if (w2p_check_url($this->url)) {
         if (function_exists('curl_init')) {
             $ch = curl_init($this->url);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             $response = curl_exec($ch);
             curl_close($ch);
         } else {
             /*
              * Thanks to Wez Furlong for the core of the logic for this 
              *   method to POST data via PHP without cURL
              *   http://netevil.org/blog/2006/nov/http-post-from-php-without-curl
              */
             $ctx = stream_context_create($params);
             $fp = @fopen($this->url, 'rb', false, $ctx);
             if (!$fp) {
                 throw new Exception("Problem with {$url}, {$php_errormsg}");
             }
             $response = @stream_get_contents($fp);
             if ($response === false) {
                 throw new Exception("Problem reading data from {$url}, {$php_errormsg}");
             }
         }
         return $response;
     } else {
         //throw an error?
     }
 }
Пример #21
Показать файл Файл: Shell.php Проект: kchhainarong/chantuchP
0
 /**
  * Constructor.
  *
  * If there is no readline support for the current PHP executable
  * a \RuntimeException exception is thrown.
  *
  * @param Application $application An application instance
  */
 public function __construct(Application $application)
 {
     $this->hasReadline = function_exists('readline');
     $this->application = $application;
     $this->history = getenv('HOME') . '/.history_' . $application->getName();
     $this->output = new ConsoleOutput();
 }
Пример #22
Показать файл Файл: class.ImageHelper.php Проект: xenten/swift-kanban
0
	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;
	}
Пример #23
Показать файл Файл: ST_Service.php Проект: shimion/st
0
 public function Services_meta()
 {
     $Services_meta = array('id' => 'Services_section', 'title' => __('Home Page Additional Information', 'SimThemes'), 'desc' => '', 'pages' => array('Service'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => 'service_icon', 'label' => __('Service Icon', 'SimThemes'), 'desc' => sprintf(__('Please select the icon', 'SimThemes')), 'std' => '', 'type' => 'font-awesome', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => ''), array('id' => 'client_Email', 'label' => __('Clint Email', 'SimThemes'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'operator' => 'and'), array('id' => 'client_Designation', 'label' => __('Clint Designation', 'SimThemes'), 'desc' => '', 'std' => '', 'type' => 'text', 'section' => 'option_types', 'rows' => '', 'post_type' => '', 'taxonomy' => '', 'min_max_step' => '', 'class' => '', 'operator' => 'and')));
     if (function_exists('ot_register_meta_box')) {
         ot_register_meta_box($Services_meta);
     }
 }
Пример #24
Показать файл Файл: Inline.php Проект: shinichi81/Codeigniter-TDD-with-Hooks
0
 /**
  * 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;
 }
Пример #25
Показать файл Файл: theme-init.php Проект: kevinreilly/mendelements.com
0
	function my_setup() {
		// This theme styles the visual editor with editor-style.css to match the theme style.
		add_editor_style();

		// This theme uses post thumbnails
		if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
			add_theme_support( 'post-thumbnails' );
			set_post_thumbnail_size( 200, 150, true ); // Normal post thumbnails
			add_image_size( 'slider-post-thumbnail', 940, 446, true ); // Slider Thumbnail
			add_image_size( 'slider-thumb', 100, 50, true ); // Slider Small Thumbnail
		}

		// Add default posts and comments RSS feed links to head
		add_theme_support( 'automatic-feed-links' );

		// custom menu support
		add_theme_support( 'menus' );
		if ( function_exists( 'register_nav_menus' ) ) {
			register_nav_menus(
				array(
					'header_menu' => theme_locals("header_menu"),
					'footer_menu' => theme_locals("footer_menu")
				)
			);
		}
	}
Пример #26
Показать файл Файл: admin-panel.php Проект: panchortuzar/revistaemprendedores-shop
0
 /**
  * Check if users need to set the file permissions in order to support the theme, and if not, displays warnings messages in admin option page.
  */
 function wt_warnings()
 {
     global $wp_version;
     $warnings = array();
     if (!wt_check_wp_version()) {
         $warnings[] = 'Wordpress version(<b>' . $wp_version . '</b>) is too low. Please upgrade to the latest version.';
     }
     if (!function_exists("imagecreatetruecolor")) {
         $warnings[] = 'GD Library Error: <b>imagecreatetruecolor does not exist</b>. Please contact your host provider and ask them to install the GD library, otherwise this theme won\'t work properly.';
     }
     if (!is_writeable(THEME_CACHE_DIR)) {
         $warnings[] = 'The cache folder (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '</b>) is not writeable. Please set the correct file permissions (<b>\'777\' or \'755\'</b>), otherwise this theme won\'t work properly.';
     }
     if (!file_exists(THEME_CACHE_DIR . DIRECTORY_SEPARATOR . 'skin.css')) {
         $warnings[] = 'The skin style file (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '/skin.css' . '</b>) doesn\'t exists or it was deleted. Please manually create this file or click on \'Save changes\' and it will be automatically created.';
     }
     if (!is_writeable(THEME_CACHE_DIR . DIRECTORY_SEPARATOR . 'skin.css')) {
         $warnings[] = 'The skin style file (<b>' . str_replace(WP_CONTENT_DIR, '', THEME_CACHE_DIR) . '/skin.css' . '</b>) is not writeable. Please set the correct permissions (<b>\'777\' or \'755\'</b>), otherwise this theme won\'t work properly.';
     }
     $str = '';
     if (!empty($warnings)) {
         $str = '<ul>';
         foreach ($warnings as $warning) {
             $str .= '<li>' . $warning . '</li>';
         }
         $str .= '</ul>';
         echo "\r\n\t\t\t\t<div id='theme-warning' class='error fade'><p><strong>" . sprintf(__('%1$s Error Messages', 'wt_admin'), THEME_NAME) . "</strong><br/>" . $str . "</p></div>\r\n\t\t\t";
     }
 }
Пример #27
Показать файл Файл: module.archive.rar.php Проект: anandsrijan/mahariya-001
0
 public function Analyze()
 {
     $info =& $this->getid3->info;
     $info['fileformat'] = 'rar';
     if ($this->option_use_rar_extension === true) {
         if (function_exists('rar_open')) {
             if ($rp = rar_open($info['filenamepath'])) {
                 $info['rar']['files'] = array();
                 $entries = rar_list($rp);
                 foreach ($entries as $entry) {
                     $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
                 }
                 rar_close($rp);
                 return true;
             } else {
                 $info['error'][] = 'failed to rar_open(' . $info['filename'] . ')';
             }
         } else {
             $info['error'][] = 'RAR support does not appear to be available in this PHP installation';
         }
     } else {
         $info['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)';
     }
     return false;
 }
Пример #28
Показать файл Файл: line.func.php Проект: lz1988/stourwebcms
0
function GetRecSpot($lineid, $webid)
{
    $func = "getRecSpots_" . $GLOBALS['cfg_df_style'];
    $func = function_exists($func) ? $func : 'getRecSpots_default';
    $temp = $func($lineid, $webid);
    return $temp;
}
Пример #29
Показать файл Файл: test.php Проект: spoymenov/arisgames
0
 protected function callFunction($class, $function, $params)
 {
     $paramString = "/";
     foreach ($params as $param) {
         $paramString .= urlencode($param) . "/";
     }
     $url = Config::WWWPath . "/server/json.php/v1." . $class . "." . $function . $paramString;
     if (TestConf::verbosity > 3) {
         echo "\tCalling URL: " . $url . "\n";
     }
     if (!function_exists('curl_init')) {
         die('You must have cUrl installed to run this test.');
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_REFERER, Config::WWWPath . '/server/test');
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     $output = curl_exec($ch);
     curl_close($ch);
     if (TestConf::verbosity == 5) {
         echo "\t\tResult: " . $this->stripComments($output) . "\n";
     }
     if (TestConf::verbosity > 5) {
         echo "\t\tResult: " . $output . "\n";
     }
     return $output;
 }
Пример #30
Показать файл Файл: StateStoreSubscriber.php Проект: pozypakya/php-impala
0
 public function recv_UpdateState()
 {
     $bin_accel = $this->input_ instanceof TBinaryProtocolAccelerated && function_exists('thrift_protocol_read_binary');
     if ($bin_accel) {
         $result = thrift_protocol_read_binary($this->input_, '\\Impala\\StateStoreSubscriber_UpdateState_result', $this->input_->isStrictRead());
     } else {
         $rseqid = 0;
         $fname = null;
         $mtype = 0;
         $this->input_->readMessageBegin($fname, $mtype, $rseqid);
         if ($mtype == TMessageType::EXCEPTION) {
             $x = new TApplicationException();
             $x->read($this->input_);
             $this->input_->readMessageEnd();
             throw $x;
         }
         $result = new \Impala\StateStoreSubscriber_UpdateState_result();
         $result->read($this->input_);
         $this->input_->readMessageEnd();
     }
     if ($result->success !== null) {
         return $result->success;
     }
     throw new \Exception("UpdateState failed: unknown result");
 }