本文整理汇总了PHP中Cake\Core\Configure::version方法的典型用法代码示例。如果您正苦于以下问题:PHP Configure::version方法的具体用法?PHP Configure::version怎么用?PHP Configure::version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Core\Configure
的用法示例。
在下文中一共展示了Configure::version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
echo Configure::version();
header("X-XSS-Protection: 0");
$words = array('a' => 'apple');
$param = $_GET["param"];
$this->set('data', $words[$param]);
}
示例2: testPatchOptionalNotNull
/**
* @return void
*/
public function testPatchOptionalNotNull()
{
$this->skipIf(version_compare(Configure::version(), '3.3.7') <= 0);
$data = ['string_optional_notnull' => '', 'active_optional_notnull' => ''];
$entity = $this->Table->newEntity($data);
$expected = ['string_optional_notnull' => '', 'active_optional_notnull' => false];
$this->assertSame($expected, $entity->toArray());
}
示例3: testCompositeConstraintsSnapshot
public function testCompositeConstraintsSnapshot()
{
$this->skipIf(version_compare(Configure::version(), '3.0.8', '<'), 'Cannot run "testCompositeConstraintsSnapshot" because CakePHP Core feature' . 'is not implemented in this version');
$this->loadFixtures('Orders');
$this->Task->params['require-table'] = false;
$this->Task->params['connection'] = 'test';
$result = $this->Task->bake('CompositeConstraintsSnapshot');
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);
}
示例4: __construct
/**
* Constructor.
*
* @param string $package Package name as string. e.g. `vendor-name/package-name`
* @param string $path Full path to package's root directory
* @param string $version Package version number
*/
public function __construct($package, $path, $version = null)
{
$this->_packageName = $package;
list($this->_vendor, $this->_name) = packageSplit($this->_packageName);
$this->_version = $version;
$this->_path = $path;
if (strtolower($this->_packageName) === 'cakephp/cakephp') {
$this->_version = Configure::version();
} elseif (strtolower($this->_packageName) === 'quickapps/cms') {
$this->_version = quickapps('version');
}
}
示例5: _prepare
/**
* Get necessary data about environment to pass back to controller
*
* @param \Cake\Controller\Controller $controller The controller.
* @return array
*/
protected function _prepare(Controller $controller)
{
$return = [];
// PHP Data
$phpVer = phpversion();
$return['php'] = array_merge(['PHP_VERSION' => $phpVer], $_SERVER);
unset($return['php']['argv']);
// CakePHP Data
$return['cake'] = ['APP' => APP, 'APP_DIR' => APP_DIR, 'CACHE' => CACHE, 'CAKE' => CAKE, 'CAKE_CORE_INCLUDE_PATH' => CAKE_CORE_INCLUDE_PATH, 'CORE_PATH' => CORE_PATH, 'CAKE_VERSION' => Configure::version(), 'DS' => DS, 'LOGS' => LOGS, 'ROOT' => ROOT, 'TESTS' => TESTS, 'TMP' => TMP, 'WWW_ROOT' => WWW_ROOT];
$cakeConstants = array_fill_keys(['DS', 'ROOT', 'TIME_START', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'YEAR'], '');
$var = get_defined_constants(true);
$return['app'] = array_diff_key($var['user'], $return['cake'], $cakeConstants);
if (isset($var['hidef'])) {
$return['hidef'] = $var['hidef'];
}
return $return;
}
示例6: main
/**
* Main function Prints out the list of shells.
*
* @return void
*/
public function main()
{
if (!$this->param('xml') && !$this->param('version')) {
$this->out("<info>Current Paths:</info>", 2);
$this->out("* app: " . APP_DIR);
$this->out("* root: " . rtrim(ROOT, DIRECTORY_SEPARATOR));
$this->out("* core: " . rtrim(CORE_PATH, DIRECTORY_SEPARATOR));
$this->out("");
$this->out("<info>Available Shells:</info>", 2);
}
if ($this->param('version')) {
$this->out(Configure::version());
return;
}
$shellList = $this->Command->getShellList();
if (!$shellList) {
return;
}
if (!$this->param('xml')) {
$this->_asText($shellList);
} else {
$this->_asXml($shellList);
}
}
示例7: testPasswordHasher
/**
* Test cake2.4 passwordHasher feature
*
* @return void
*/
public function testPasswordHasher()
{
$this->skipIf((double) Configure::version() < 2.4, 'Needs 2.4 and above');
$this->Users->addBehavior('Tools.Passwordable', ['formField' => 'pwd', 'formFieldRepeat' => 'pwd_repeat', 'allowSame' => false, 'current' => false, 'passwordHasher' => 'Complex']);
$user = $this->Users->newEntity();
$data = ['pwd' => 'somepwd', 'pwd_repeat' => 'somepwd'];
$this->Users->patchEntity($user, $data);
$result = $this->Users->save($user);
$this->assertTrue((bool) $result);
$uid = (string) $user->id;
$this->Users->removeBehavior('Passwordable');
$this->Users->addBehavior('Tools.Passwordable', ['current' => true]);
$user = $this->Users->newEntity();
$data = ['id' => $uid, 'pwd' => '123456', 'pwd_repeat' => '12345678'];
$this->Users->patchEntity($user, $data);
$this->assertTrue($this->Users->behaviors()->has('Passwordable'));
$is = $this->Users->save($user);
$this->assertFalse($is);
$user = $this->Users->newEntity();
$data = ['id' => $uid, 'pwd_current' => 'somepwdx', 'pwd' => '123456', 'pwd_repeat' => '123456'];
$this->Users->patchEntity($user, $data);
$is = $this->Users->save($user);
$this->assertFalse($is);
$user = $this->Users->newEntity();
$data = ['id' => $uid, 'pwd_current' => 'somepwd', 'pwd' => '123456', 'pwd_repeat' => '123456'];
$this->Users->patchEntity($user, $data);
$is = $this->Users->save($user);
$this->assertTrue(!empty($is));
}
示例8: testVersion
/**
* testVersion method
*
* @return void
*/
public function testVersion()
{
$result = Configure::version();
$this->assertTrue(version_compare($result, '1.2', '>='));
}
示例9: testMainVersion
/**
* test that main prints the cakephp's version.
*
* @return void
*/
public function testMainVersion()
{
$this->Shell->params['version'] = true;
$this->Shell->main();
$output = $this->out->messages();
$output = implode("\n", $output);
$expected = Configure::version();
$this->assertEquals($expected, $output);
}
示例10: _welcome
/**
* Displays a header for the shell
*
* @return void
*/
protected function _welcome()
{
$this->out();
$this->out(sprintf('<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
$this->hr();
$this->out(sprintf('App : %s', APP_DIR));
$this->out(sprintf('Path: %s', APP));
$this->out(sprintf('DocumentRoot: %s', $this->_documentRoot));
if (!empty($this->_iniFile)) {
$this->out(sprintf('php.ini FilePath: %s', $this->_iniFile));
}
$this->hr();
}
示例11: checkup
/**
* System checkup
* @return void
* @uses MeCms\Core\Plugin::all()
* @uses MeCms\Core\Plugin::path()
* @uses MeTools\Utility\Apache::module()
* @uses MeTools\Utility\Apache::version()
*/
public function checkup()
{
$checkup['apache'] = ['expires' => Apache::module('mod_expires'), 'rewrite' => Apache::module('mod_rewrite'), 'version' => Apache::version()];
$checkup['backups'] = ['path' => rtr(Configure::read('MysqlBackup.target') . DS), 'writeable' => folderIsWriteable(Configure::read('MysqlBackup.target'))];
$checkup['cache'] = Cache::enabled();
//Checks for PHP's extensions
foreach (['exif', 'imagick', 'mcrypt', 'zip'] as $extension) {
$checkup['phpExtensions'][$extension] = extension_loaded($extension);
}
$checkup['plugins'] = ['cakephp' => Configure::version(), 'mecms' => trim(file_get_contents(Plugin::path(MECMS, 'version')))];
//Gets plugins versions
foreach (Plugin::all(['exclude' => MECMS]) as $plugin) {
$file = Plugin::path($plugin, 'version', true);
if ($file) {
$checkup['plugins']['plugins'][$plugin] = trim(file_get_contents($file));
} else {
$checkup['plugins']['plugins'][$plugin] = __d('me_cms', 'n.a.');
}
}
//Checks for temporary directories
foreach ([LOGS, TMP, Configure::read('Assets.target'), CACHE, LOGIN_LOGS, Configure::read('Thumbs.target')] as $path) {
$checkup['temporary'][] = ['path' => rtr($path), 'writeable' => folderIsWriteable($path)];
}
//Checks for webroot directories
foreach ([BANNERS, PHOTOS, WWW_ROOT . 'files', WWW_ROOT . 'fonts'] as $path) {
$checkup['webroot'][] = ['path' => rtr($path), 'writeable' => folderIsWriteable($path)];
}
array_walk($checkup, function ($value, $key) {
$this->set($key, $value);
});
}
示例12: _welcome
/**
* Displays a header for the shell
*
* @return void
*/
protected function _welcome()
{
$this->out();
$this->out(__d('cake_console', '<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
$this->hr();
$this->out(__d('cake_console', 'App : %s', APP_DIR));
$this->out(__d('cake_console', 'Path: %s', APP));
$this->out(__d('cake_console', 'DocumentRoot: %s', $this->_documentRoot));
$this->hr();
}
示例13: _welcome
/**
* Override Cake\Console\Shell method to return different welcome screen.
*
* @return void
*/
protected function _welcome()
{
$this->hr();
$this->out(sprintf('<info>CakePHP %s Console</info>', 'v' . Configure::version()));
$this->hr();
}
示例14: _checkVersion
/**
* Checks the versions of PHP, CakePHP and PHPSass
*
* @throws CakeException If one of the required versions is not available
*
* @return void
*/
protected function _checkVersion()
{
if (PHP_VERSION < self::$_minVersionPHP) {
throw new CakeException(__('The SassCompiler plugin requires PHP version %s or higher!', self::$_minVersionPHP));
}
if (Configure::version() < self::$_minVersionCakePHP) {
throw new CakeException(__('The SassCompiler plugin requires CakePHP version %s or higher!', self::$_minVersionCakePHP));
}
$scssc = new SassCompiler();
if ($scssc::$VERSION < self::$_minVersionScssc) {
throw new CakeException(__('The SassCompiler plugin requires scssc version %s or higher!', self::$_minVersionLessc));
}
unset($scssc);
}
示例15: startup
/**
* Show custom welcome.
*
* @return void
*/
public function startup()
{
$this->hr();
$this->out(sprintf('<info>CakePHP %s Console</info>', 'v' . Configure::version()));
$this->hr();
}