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


PHP version_compare函数代码示例

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


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

示例1: GPC

 function GPC()
 {
     if (!defined('str')) {
         define('str', 2);
     }
     if (!defined('int')) {
         define('int', 1);
     }
     if (!defined('arr_str')) {
         define('arr_str', 5);
     }
     if (!defined('arr_int')) {
         define('arr_int', 4);
     }
     if (!defined('none')) {
         define('none', 0);
     }
     if (!defined('arr_none')) {
         define('arr_none', 3);
     }
     if (!defined('db_esc')) {
         define('db_esc', 6);
     }
     if (!defined('html_enc')) {
         define('html_enc', 7);
     }
     if (!defined('path')) {
         define('path', 8);
     }
     $this->prepare_original = array('"', "'", '<', '>');
     $this->prepare_entity = array('&quot;', '&#039;', '&lt;', '&gt;');
     $this->php523 = version_compare(PHP_VERSION, '5.2.3', '>=');
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:33,代码来源:class.gpc.php

示例2: __construct

 public function __construct($options)
 {
     // we need at least PHP7
     if (version_compare(PHP_VERSION, '7.0.0') < 0) {
         throw new Exception("Foundation require PHP 7 or newer.");
     }
     // get all errors
     error_reporting(E_ALL);
     set_error_handler([$this, "errorHandler"]);
     // the application root is foundation directory's upper directory
     $this->rootpath = $options["rootpath"] ?? "../";
     $this->setupApplicationRoot();
     // application timezone
     $this->timezone = $options["timezone"] ?? "UTC";
     $this->setupApplicationTimezone();
     // environment
     $this->env = getenv("ENV") ?? "dev";
     // application namespace
     $this->namespace = $options["namespace"] ?? null;
     if (is_null($this->namespace)) {
         throw new Exception("App Namespace not given.");
     }
     // configure
     $this->config = (object) (require $this->rootpath . "/config/" . $this->env . ".php");
     // register autoloader
     $this->registerAutoloader();
 }
开发者ID:hax4,项目名称:foundation,代码行数:27,代码来源:Foundation.php

示例3: getInput

 protected function getInput()
 {
     JHTML::_('behavior.framework');
     $document =& JFactory::getDocument();
     if (!version_compare(JVERSION, '3.0', 'ge')) {
         $checkJqueryLoaded = false;
         $header = $document->getHeadData();
         foreach ($header['scripts'] as $scriptName => $scriptData) {
             if (substr_count($scriptName, '/jquery')) {
                 $checkJqueryLoaded = true;
             }
         }
         //Add js
         if (!$checkJqueryLoaded) {
             $document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.min.js');
         }
         $document->addScript(JURI::root() . $this->element['path'] . 'js/chosen.jquery.min.js');
         $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/chosen.css');
     }
     $document->addScript(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.lightbox-0.5.min.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/btbase64.min.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/bt.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/script.js');
     //Add css
     $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/bt.css');
     $document->addStyleSheet(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.css');
     $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/jquery.lightbox-0.5.css');
     return null;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:30,代码来源:asset.php

示例4: display

 /**
  * @since	1.6
  */
 function display($tpl = null)
 {
     // Get data from the model
     $this->state = $this->get('State');
     $this->changeSet = $this->get('Items');
     $this->errors = $this->changeSet->check();
     $this->results = $this->changeSet->getStatus();
     $this->schemaVersion = $this->get('SchemaVersion');
     $this->updateVersion = $this->get('UpdateVersion');
     $this->filterParams = $this->get('DefaultTextFilters');
     $this->schemaVersion = $this->schemaVersion ? $this->schemaVersion : JText::_('JNONE');
     $this->updateVersion = $this->updateVersion ? $this->updateVersion : JText::_('JNONE');
     $this->pagination = $this->get('Pagination');
     $this->errorCount = count($this->errors);
     $errors = count($this->errors);
     if ($this->schemaVersion != $this->changeSet->getSchema()) {
         $this->errorCount++;
     }
     if (!$this->filterParams) {
         $this->errorCount++;
     }
     if (version_compare($this->updateVersion, VJOKTE) != 0) {
         $this->errorCount++;
     }
     parent::display($tpl);
 }
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:29,代码来源:view.html.php

示例5: activate

 public function activate()
 {
     if (!in_array('woocommerce/woocommerce.php', get_option('active_plugins')) || !defined('WC_VERSION') || !version_compare(WC_VERSION, '2.6', '>=')) {
         deactivate_plugins(plugin_basename(__FILE__));
         wp_die(sprintf(__('Для работы плагина eDostavka нужно установить %s! не ниже 2.6 версии'), '<a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a>'));
     }
 }
开发者ID:kalbac,项目名称:wc-edostavka,代码行数:7,代码来源:wc-edostavka.php

示例6: load

 function load()
 {
     $this->values = array();
     if (JRequest::getCmd('from_display', false) == false) {
         $this->values[] = JHTML::_('select.option', '', JText::_('HIKA_INHERIT'));
     }
     $this->values[] = JHTML::_('select.optgroup', '-- ' . JText::_('FROM_HIKASHOP') . ' --');
     foreach ($this->default as $d) {
         $this->values[] = JHTML::_('select.option', $d, JText::_(strtoupper($d)));
     }
     if (version_compare(JVERSION, '1.6.0', '>=')) {
         $this->values[] = JHTML::_('select.optgroup', '-- ' . JText::_('FROM_HIKASHOP') . ' --');
     }
     $closeOpt = '';
     $values = $this->getLayout();
     foreach ($values as $value) {
         if (substr($value, 0, 1) == '#') {
             if (version_compare(JVERSION, '1.6.0', '>=') && !empty($closeOpt)) {
                 $this->values[] = JHTML::_('select.optgroup', $closeOpt);
             }
             $value = substr($value, 1);
             $closeOpt = '-- ' . JText::sprintf('FROM_TEMPLATE', basename($value)) . ' --';
             $this->values[] = JHTML::_('select.optgroup', $closeOpt);
         } else {
             $this->values[] = JHTML::_('select.option', $value, $value);
         }
     }
     if (version_compare(JVERSION, '1.6.0', '>=') && !empty($closeOpt)) {
         $this->values[] = JHTML::_('select.optgroup', $closeOpt);
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:31,代码来源:quantitydisplay.php

示例7: testEmpty

 /**
  * @expectedException \Psy\Exception\FatalErrorException
  * @expectedExceptionMessage Can't use function return value in write context
  */
 public function testEmpty()
 {
     if (version_compare(PHP_VERSION, '5.5', '>=')) {
         $this->markTestSkipped();
     }
     $this->traverser->traverse($this->parse('empty(strtolower("A"))'));
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:11,代码来源:FunctionReturnInWriteContextPassTest.php

示例8: testContainer

 public function testContainer()
 {
     $container = $this->createYamlBundleTestContainer();
     $this->assertInstanceOf('Symfony\\Bridge\\Doctrine\\Logger\\DbalLogger', $container->get('doctrine.dbal.logger'));
     $this->assertInstanceOf('Symfony\\Bridge\\Doctrine\\DataCollector\\DoctrineDataCollector', $container->get('data_collector.doctrine'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Configuration', $container->get('doctrine.dbal.default_connection.configuration'));
     $this->assertInstanceOf('Doctrine\\Common\\EventManager', $container->get('doctrine.dbal.default_connection.event_manager'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Connection', $container->get('doctrine.dbal.default_connection'));
     $this->assertInstanceOf('Doctrine\\Common\\Annotations\\Reader', $container->get('doctrine.orm.metadata.annotation_reader'));
     $this->assertInstanceOf('Doctrine\\ORM\\Configuration', $container->get('doctrine.orm.default_configuration'));
     $this->assertInstanceOf('Doctrine\\ORM\\Mapping\\Driver\\DriverChain', $container->get('doctrine.orm.default_metadata_driver'));
     $this->assertInstanceOf('Doctrine\\Common\\Cache\\ArrayCache', $container->get('doctrine.orm.default_metadata_cache'));
     $this->assertInstanceOf('Doctrine\\Common\\Cache\\ArrayCache', $container->get('doctrine.orm.default_query_cache'));
     $this->assertInstanceOf('Doctrine\\Common\\Cache\\ArrayCache', $container->get('doctrine.orm.default_result_cache'));
     $this->assertInstanceOf('Doctrine\\ORM\\EntityManager', $container->get('doctrine.orm.default_entity_manager'));
     $this->assertInstanceOf('Doctrine\\DBAL\\Connection', $container->get('database_connection'));
     $this->assertInstanceOf('Doctrine\\ORM\\EntityManager', $container->get('doctrine.orm.entity_manager'));
     $this->assertInstanceOf('Doctrine\\Common\\EventManager', $container->get('doctrine.orm.default_entity_manager.event_manager'));
     $this->assertInstanceOf('Doctrine\\Common\\EventManager', $container->get('doctrine.dbal.event_manager'));
     $this->assertInstanceOf('Symfony\\Bridge\\Doctrine\\CacheWarmer\\ProxyCacheWarmer', $container->get('doctrine.orm.proxy_cache_warmer'));
     $this->assertInstanceOf('Doctrine\\Common\\Persistence\\ManagerRegistry', $container->get('doctrine'));
     $this->assertInstanceOf('Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\UniqueEntityValidator', $container->get('doctrine.orm.validator.unique'));
     $this->assertSame($container->get('my.platform'), $container->get('doctrine.dbal.default_connection')->getDatabasePlatform());
     $this->assertTrue(Type::hasType('test'));
     if (version_compare(PHP_VERSION, '5.3.6', '<')) {
         $this->assertInstanceOf('Doctrine\\DBAL\\Event\\Listeners\\MysqlSessionInit', $container->get('doctrine.dbal.default_connection.events.mysqlsessioninit'));
     } else {
         $this->assertFalse($container->has('doctrine.dbal.default_connection.events.mysqlsessioninit'));
     }
 }
开发者ID:sanborino,项目名称:clinica,代码行数:30,代码来源:ContainerTest.php

示例9: addGroup

 public function addGroup($user_id, $group_id, $only = NULL)
 {
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         // Joomla! 1.6+ code here
         $user = JFactory::getUser($user_id);
         //$user		= JUser::getInstance($user_id);
         //if you want the user to in ONLY  the group you are adding  set only to true
         if ($only) {
             foreach ($user->groups as $group) {
                 unset($user->groups[$group]);
             }
         }
         $user->groups[] = $group_id;
         // Bind the data.
         $user->bind($user->groups);
         $user->save();
     } else {
         // Joomla! 1.5 code here
         $user = new JUser();
         //$user = JFactory::getUser();
         $user->load($order->user_id);
         $user->gid = $core_user_new_gid;
         $user->save();
     }
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:25,代码来源:acl.php

示例10: getBytes

 /**
  * PRNG generator based on security principles 
  * at http://phpsecurity.readthedocs.org/en/latest/Insufficient-Entropy-For-Random-Values.html 
  * 
  * @param mixed $length 
  * @param mixed $strong 
  * @access public
  * @return void
  */
 public function getBytes($length, $strong = false)
 {
     $bytes = '';
     if (function_exists('openssl_random_pseudo_bytes')
         && (version_compare(PHP_VERSION, '5.3.4') >= 0
         || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
     ) {
         $bytes = openssl_random_pseudo_bytes($length, $usable);
         if (true === $usable) {
             return $bytes;
         }
     }
     if (function_exists('mcrypt_create_iv')
         && (version_compare(PHP_VERSION, '5.3.7') >= 0
         || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
     ) {
         $bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
         if ($bytes !== false && strlen($bytes) === $length) {
             return $bytes;
         }
     }
     $checkAlternatives = (file_exists('/dev/urandom') && is_readable('/dev/urandom'))
         || class_exists('\\COM', false);
     if (true === $strong && false === $checkAlternatives) {
         throw new \Exception(
             'Unable to generate sufficiently strong random bytes due to a lack ',
             'of sources with sufficient entropy'
         );
     }
     $generator = $this->getAlternativeGenerator();
     return $generator->generate($length);
 }
开发者ID:Aasit,项目名称:DISCOUNT--SRV-I,代码行数:41,代码来源:RandomUtils.php

示例11: installStore

 public function installStore()
 {
     $pkg = Package::getByHandle('vivid_store');
     if (version_compare($pkg->getPackageVersion(), '2.1', '<')) {
         Installer::renameDatabaseTables($pkg);
     }
     if (version_compare(APP_VERSION, '5.7.4', '<')) {
         Installer::refreshDatabase($pkg);
     }
     Installer::installSinglePages($pkg);
     Installer::installProductParentPage($pkg);
     Installer::installStoreProductPageType($pkg);
     Installer::updateConfigStorage($pkg);
     Installer::setDefaultConfigValues($pkg);
     Installer::installPaymentMethods($pkg);
     Installer::installShippingMethods($pkg);
     Installer::installBlocks($pkg);
     Installer::setPageTypeDefaults($pkg);
     Installer::installCustomerGroups($pkg);
     Installer::installUserAttributes($pkg);
     Installer::installOrderAttributes($pkg);
     Installer::installProductAttributes($pkg);
     Installer::createDDFileset($pkg);
     Installer::installOrderStatuses($pkg);
     Installer::installDefaultTaxClass($pkg);
     if (version_compare($pkg->getPackageVersion(), '3.0', '<')) {
         Installer::migrateOldShippingMethod($pkg);
         Installer::migrateOldTaxRates($pkg);
     }
 }
开发者ID:pvernaglia,项目名称:vivid_store,代码行数:30,代码来源:controller.php

示例12: loadNode

 /**
  * Loads assets from the supplied node.
  *
  * @param \Twig_Node $node
  *
  * @return array An array of asset formulae indexed by name
  */
 private function loadNode(\Twig_Node $node)
 {
     $formulae = array();
     if ($node instanceof AsseticNode) {
         $formulae[$node->getAttribute('name')] = array($node->getAttribute('inputs'), $node->getAttribute('filters'), array('output' => $node->getAttribute('asset')->getTargetPath(), 'name' => $node->getAttribute('name'), 'debug' => $node->getAttribute('debug'), 'combine' => $node->getAttribute('combine'), 'vars' => $node->getAttribute('vars')));
     } elseif ($node instanceof \Twig_Node_Expression_Function) {
         $name = version_compare(\Twig_Environment::VERSION, '1.2.0-DEV', '<') ? $node->getNode('name')->getAttribute('name') : $node->getAttribute('name');
         if ($this->twig->getFunction($name) instanceof AsseticFilterFunction) {
             $arguments = array();
             foreach ($node->getNode('arguments') as $argument) {
                 $arguments[] = eval('return ' . $this->twig->compile($argument) . ';');
             }
             $invoker = $this->twig->getExtension('assetic')->getFilterInvoker($name);
             $inputs = isset($arguments[0]) ? (array) $arguments[0] : array();
             $filters = $invoker->getFilters();
             $options = array_replace($invoker->getOptions(), isset($arguments[1]) ? $arguments[1] : array());
             if (!isset($options['name'])) {
                 $options['name'] = $invoker->getFactory()->generateAssetName($inputs, $filters, $options);
             }
             $formulae[$options['name']] = array($inputs, $filters, $options);
         }
     }
     foreach ($node as $child) {
         if ($child instanceof \Twig_Node) {
             $formulae += $this->loadNode($child);
         }
     }
     if ($node->hasAttribute('embedded_templates')) {
         foreach ($node->getAttribute('embedded_templates') as $child) {
             $formulae += $this->loadNode($child);
         }
     }
     return $formulae;
 }
开发者ID:tahermarkos,项目名称:Transport,代码行数:41,代码来源:TwigFormulaLoader.php

示例13: connect

 /**
  * 连接数据库方法
  * @access public
  */
 public function connect($config = '', $linkNum = 0, $autoConnection = false)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         try {
             if (empty($config['dsn'])) {
                 $config['dsn'] = $this->parseDsn($config);
             }
             if (version_compare(PHP_VERSION, '5.3.6', '<=')) {
                 // 禁用模拟预处理语句
                 $this->options[PDO::ATTR_EMULATE_PREPARES] = false;
             }
             $this->linkID[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $this->options);
         } catch (\PDOException $e) {
             if ($autoConnection) {
                 trace($e->getMessage(), '', 'ERR');
                 return $this->connect($autoConnection, $linkNum);
             } elseif ($config['debug']) {
                 E($e->getMessage());
             }
         }
     }
     return $this->linkID[$linkNum];
 }
开发者ID:highestgoodlikewater,项目名称:ecshoptk,代码行数:30,代码来源:Driver.class.php

示例14: calibrefx_update_check

/**
 * This function calibrefx_update_check is to ...
 */
function calibrefx_update_check()
{
    global $wp_version;
    /** Get time of last update check */
    $calibrefx_update = get_transient('calibrefx-update');
    /** If it has expired, do an update check */
    if (!$calibrefx_update) {
        $url = 'http://api.calibrefx.com/themes-update/';
        $options = apply_filters('calibrefx_update_remote_post_options', array('body' => array('theme_name' => 'calibrefx', 'theme_version' => FRAMEWORK_VERSION, 'url' => home_url(), 'wp_version' => $wp_version, 'php_version' => phpversion(), 'user-agent' => "WordPress/{$wp_version};")));
        $response = wp_remote_post($url, $options);
        $calibrefx_update = wp_remote_retrieve_body($response);
        /** If an error occurred, return FALSE, store for 48 hour */
        if ('error' == $calibrefx_update || is_wp_error($calibrefx_update) || !is_serialized($calibrefx_update)) {
            set_transient('calibrefx-update', array('new_version' => FRAMEWORK_VERSION), 60 * 60 * 48);
            return false;
        }
        /** Else, unserialize */
        $calibrefx_update = maybe_unserialize($calibrefx_update);
        /** And store in transient for 48 hours */
        set_transient('calibrefx-update', $calibrefx_update, 60 * 60 * 48);
    }
    /** If we're already using the latest version, return false */
    if (version_compare(FRAMEWORK_VERSION, $calibrefx_update['new_version'], '>=')) {
        return false;
    }
    return $calibrefx_update;
}
开发者ID:alispx,项目名称:calibrefx,代码行数:30,代码来源:upgrade-hook.php

示例15: run

 public function run()
 {
     // The only supported upgrade for this is 7.6.0.0RC4 to 7.6.0.0
     if (version_compare($this->from_version, '7.6.0.0RC4', '==') && version_compare($this->to_version, '7.6.0.0', '==')) {
         // Fill in any missing settings
         $defaults = get_sugar_config_defaults();
         foreach ($defaults as $key => $default) {
             if (!array_key_exists($key, $this->upgrader->config)) {
                 $this->log("Setting {$key} does not exist. Setting the default value.");
                 $this->upgrader->config[$key] = $default;
             }
         }
         // Get the known PMSE settings from the database
         $current = $this->getCurrentSettings();
         // Get the new default values
         $pmse = $this->getDefaultSettings();
         // If there is no current entry in sugar_config for PMSE settings...
         if (!isset($this->upgrader->config['pmse_settings_default'])) {
             // ... loop over current settings in the database, replacing default
             // settings with custom ones if they exist
             foreach ($current as $key => $val) {
                 $pmse[$key] = $val;
             }
             $this->upgrader->config['pmse_settings_default'] = $pmse;
         }
         // delete PMSESettings.php
         $this->fileToDelete('modules/pmse_Inbox/engine/PMSESettings.php');
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:29,代码来源:9_FixPMSESettings.php


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