本文整理汇总了PHP中ezcBaseFeatures::hasExtensionSupport方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcBaseFeatures::hasExtensionSupport方法的具体用法?PHP ezcBaseFeatures::hasExtensionSupport怎么用?PHP ezcBaseFeatures::hasExtensionSupport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcBaseFeatures
的用法示例。
在下文中一共展示了ezcBaseFeatures::hasExtensionSupport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
protected function setup()
{
if (!self::$stackInitialized) {
if (ezcBaseFeatures::hasExtensionSupport('apc')) {
$memoryStorage = new ezcCacheStorageApcPlain();
} else {
if (ezcBaseFeatures::hasExtensionSupport('memcache')) {
$memoryStorage = new ezcCacheStorageMemcachePlain('foo');
} else {
$this->markTestSkipped('APC or Memcached needed to run this test.');
}
}
// Start cleanly
$memoryStorage->reset();
$tmpDir = $this->createTempDir(__CLASS__);
$tmpDirEvalArray = "{$tmpDir}/plain";
$tmpDirArray = "{$tmpDir}/array";
mkdir($tmpDirEvalArray);
mkdir($tmpDirArray);
$fileStorageEvalArray = new ezcCacheStorageFileEvalArray($tmpDirEvalArray);
$fileStorageArray = new ezcCacheStorageFileArray($tmpDirArray);
ezcCacheStackTestConfigurator::reset();
ezcCacheStackTestConfigurator::$storages = array(new ezcCacheStackStorageConfiguration('eval_array_storage', $fileStorageEvalArray, 10, 0.8), new ezcCacheStackStorageConfiguration('array_storage', $fileStorageArray, 8, 0.5), new ezcCacheStackStorageConfiguration('memory_storage', $memoryStorage, 5, 0.5));
ezcCacheStackTestConfigurator::$metaStorage = $fileStorageArray;
ezcCacheManager::createCache(__CLASS__, null, 'ezcCacheStack', new ezcCacheStackOptions(array('configurator' => 'ezcCacheStackTestConfigurator', 'replacementStrategy' => 'ezcCacheStackLfuReplacementStrategy')));
self::$stackInitialized = true;
}
$this->testDataArray = array(array('id_1', 'id_1_content', array('lang' => 'en', 'area' => 'news')), array('id_2', 'id_2_content', array('lang' => 'en', 'area' => 'news')), array('id_3', 'id_3_content', array('lang' => 'de', 'area' => 'news')), array('id_4', 'id_4_content', array('lang' => 'no', 'area' => 'news')), array('id_5', 'id_5_content', array('lang' => 'de', 'area' => 'news')));
}
示例2: setUp
protected function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('exif')) {
$this->markTestSkipped('ext/exif is required to run this test.');
}
$this->basePath = dirname(__FILE__) . '/data/';
}
示例3: createBignumLibrary
/**
* Creates a new big number library which uses the PHP extension $lib.
*
* If $lib is null then an autodetection of the library is tried. If neither
* gmp or bcmath are installed then an exception will be thrown.
*
* If $lib is specified, then that library will be used (if it is installed),
* otherwise an exception will be thrown.
*
* @throws ezcBaseExtensionNotFoundException
* if neither of the PHP gmp and bcmath extensions are installed ($lib === null),
* or if the specified $lib is not installed
* @throws ezcBaseValueException
* if the value provided for $lib is not correct
* @param string $lib The PHP library to use for big number support. Default
* is null, which means the available library is autodetected.
* @return ezcAuthenticationBignumLibrary
*/
public static function createBignumLibrary($lib = null)
{
$library = null;
switch ($lib) {
case null:
if (!ezcBaseFeatures::hasExtensionSupport('bcmath')) {
if (!ezcBaseFeatures::hasExtensionSupport('gmp')) {
throw new ezcBaseExtensionNotFoundException('gmp | bcmath', null, "PHP not compiled with --enable-bcmath or --with-gmp.");
} else {
$library = new ezcAuthenticationGmpLibrary();
}
} else {
$library = new ezcAuthenticationBcmathLibrary();
}
break;
case 'gmp':
if (!ezcBaseFeatures::hasExtensionSupport('gmp')) {
throw new ezcBaseExtensionNotFoundException('gmp', null, "PHP not compiled with --with-gmp.");
}
$library = new ezcAuthenticationGmpLibrary();
break;
case 'bcmath':
if (!ezcBaseFeatures::hasExtensionSupport('bcmath')) {
throw new ezcBaseExtensionNotFoundException('bcmath', null, "PHP not compiled with --enable-bcmath.");
}
$library = new ezcAuthenticationBcmathLibrary();
break;
default:
throw new ezcBaseValueException('library', $lib, '"gmp" || "bcmath" || null');
}
return $library;
}
示例4: __construct
/**
* Construct converter
*
* Construct converter from XSLT file, which is used for the actual
* conversion.
*
* @param ezcDocumentXsltConverterOptions $options
* @return void
*/
public function __construct(ezcDocumentXsltConverterOptions $options = null)
{
if (!ezcBaseFeatures::hasExtensionSupport('xsl')) {
throw new ezcBaseExtensionNotFoundException('xsl');
}
parent::__construct($options === null ? new ezcDocumentXsltConverterOptions() : $options);
}
示例5: __construct
/**
* Constructs a new ezcCacheMemcacheBackend object.
*
* For options for this backend see {@link ezcCacheStorageMemcacheOptions}.
*
* @throws ezcBaseExtensionNotFoundException
* If the PHP memcache and zlib extensions are not installed.
* @throws ezcCacheMemcacheException
* If the connection to the Memcache host did not succeed.
*
* @param array(string=>mixed) $options
*/
public function __construct(array $options = array())
{
if (!ezcBaseFeatures::hasExtensionSupport('memcache')) {
throw new ezcBaseExtensionNotFoundException('memcache', null, "PHP does not have Memcache support.");
}
if (!ezcBaseFeatures::hasExtensionSupport('zlib')) {
throw new ezcBaseExtensionNotFoundException('zlib', null, "PHP not configured with --with-zlib.");
}
$this->options = new ezcCacheStorageMemcacheOptions($options);
$this->connectionIdentifier = $this->options->host . ':' . $this->options->port;
if (!isset(self::$connections[$this->connectionIdentifier])) {
self::$connections[$this->connectionIdentifier] = new Memcache();
// Currently 0 backends use the connection
self::$connectionCounter[$this->connectionIdentifier] = 0;
}
$this->memcache = self::$connections[$this->connectionIdentifier];
// Now 1 backend uses it
self::$connectionCounter[$this->connectionIdentifier]++;
if ($this->options->persistent === true) {
if (!@$this->memcache->pconnect($this->options->host, $this->options->port, $this->options->ttl)) {
throw new ezcCacheMemcacheException('Could not connect to Memcache using a persistent connection.');
}
} else {
if (!@$this->memcache->connect($this->options->host, $this->options->port, $this->options->ttl)) {
throw new ezcCacheMemcacheException('Could not connect to Memcache.');
}
}
$this->memcache->setCompressThreshold(self::COMPRESS_THRESHOLD);
}
示例6: setUp
protected function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('posix')) {
$this->markTestSkipped('ext/posix is required for this test.');
}
$this->tempDir = $this->createTempDir('ezcConfigurationArrayWriterTest');
}
示例7: setUp
public function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
$this->markTestSkipped('This test requires pecl/haru installed.');
}
parent::setUp();
}
示例8: setUp
public function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('pdo_sqlite')) {
$this->markTestSkipped();
return;
}
}
示例9: getDriver
/**
* Get driver to test
*
* @return ezcDocumentPdfDriver
*/
protected function getDriver()
{
if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
$this->markTestSkipped('This test requires pecl/haru installed.');
}
return new ezcDocumentPdfHaruDriver();
}
示例10: __construct
/**
* Create a new image handler.
* Creates an image handler. This should never be done directly,
* but only through the manager for configuration reasons. One can
* get a direct reference through manager afterwards.
*
* @param ezcImageHandlerSettings $settings
* Settings for the handler.
*
* @throws ezcImageHandlerNotAvailableException
* If the precondition for the handler is not fulfilled.
*/
public function __construct(ezcImageHandlerSettings $settings)
{
if (!ezcBaseFeatures::hasExtensionSupport('gd')) {
throw new ezcImageHandlerNotAvailableException("ezcImageGdHandler", "PHP extension 'GD' not available.");
}
$this->determineTypes();
parent::__construct($settings);
}
示例11: setUp
protected function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('apc')) {
$this->markTestSkipped("PHP must have APC support.");
}
// Class name == <inheriting class> - "Test"
$storageClass = $this->storageClass = substr(get_class($this), 0, strlen(get_class($this)) - 4);
$this->storage = new $storageClass($this->createTempDir('ezcCacheTest'), array('ttl' => 10));
}
示例12: setUp
public function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
$this->markTestSkipped('This test requires pecl/haru installed.');
}
parent::setUp();
// Change error reporting - this is evil, but otherwise TCPDF will
// abort the tests, because it throws lots of E_NOTICE and
// E_DEPRECATED.
$this->oldErrorReporting = error_reporting(E_PARSE | E_ERROR | E_WARNING);
}
示例13: createRoutes
/**
* (non-PHPdoc)
* @see lib/ezc/MvcTools/src/ezcMvcRouter::createRoutes()
*/
public function createRoutes()
{
if (empty($this->routes)) {
// Check if route caching is enabled and if APC is available
$isRouteCacheEnabled = eZINI::instance('rest.ini')->variable('CacheSettings', 'RouteApcCache') === 'enabled';
if ($isRouteCacheEnabled && ezcBaseFeatures::hasExtensionSupport('apc')) {
$this->routes = $this->getCachedRoutes();
} else {
$this->routes = $this->doCreateRoutes();
}
}
return $this->routes;
}
示例14: testRenderLongTextWithInternalLinks
public function testRenderLongTextWithInternalLinks()
{
if (!ezcBaseFeatures::hasExtensionSupport('haru')) {
$this->markTestSkipped('This test requires pecl/haru installed.');
}
$docbook = new ezcDocumentDocbook();
$docbook->loadFile(dirname(__FILE__) . '/../files/pdf/internal_links.xml');
$style = new ezcDocumentPcssStyleInferencer();
$style->appendStyleDirectives(array(new ezcDocumentPcssLayoutDirective(array('page'), array('page-size' => 'A6'))));
$renderer = new ezcDocumentPdfMainRenderer(new ezcDocumentPdfHaruDriver(), $style);
$pdf = $renderer->render($docbook, new ezcDocumentPdfDefaultHyphenator());
$this->assertPdfDocumentsSimilar($pdf, __CLASS__ . '_' . __FUNCTION__);
}
示例15: setUp
protected function setUp()
{
if (!ezcBaseFeatures::hasExtensionSupport('ming')) {
$this->markTestSkipped('This test needs ext/ming support.');
}
static $i = 0;
$this->tempDir = $this->createTempDir(__CLASS__ . sprintf('_%03d_', ++$i)) . '/';
$this->basePath = dirname(__FILE__) . '/data/';
$this->driver = new ezcGraphFlashDriver();
$this->driver->options->width = 200;
$this->driver->options->height = 100;
$this->driver->options->font->path = $this->basePath . 'fdb_font.fdb';
}