本文整理汇总了PHP中Horde_Util::extensionExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Util::extensionExists方法的具体用法?PHP Horde_Util::extensionExists怎么用?PHP Horde_Util::extensionExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Util
的用法示例。
在下文中一共展示了Horde_Util::extensionExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renderInfo
/**
* Return the rendered information about the Horde_Mime_Part object.
*
* URL parameters used by this function:
* - zip_contents: (integer) If set, show contents of ZIP file.
*
* @return array See Horde_Mime_Viewer_Driver::render().
*/
protected function _renderInfo()
{
global $injector;
$vars = $injector->getInstance('Horde_Variables');
if (!$this->getConfigParam('show_contents') && !$vars->zip_contents) {
$status = new IMP_Mime_Status($this->_mimepart, _("This is a compressed file."));
$status->addMimeAction('zipViewContents', _("Click to display the file contents."));
$status->icon('mime/compressed.png');
return array($this->_mimepart->getMimeId() => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
}
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/mime'));
$view->addHelper('Text');
$view->downloadclass = 'zipdownload';
$view->files = array();
$view->tableclass = 'zipcontents';
$zlib = Horde_Util::extensionExists('zlib');
foreach ($this->_getZipInfo() as $key => $val) {
$file = new stdClass();
$file->name = $val['name'];
$file->size = IMP::sizeFormat($val['size']);
/* TODO: Add ability to render in-browser for filetypes we can
* handle. */
if (!empty($val['size']) && strstr($val['attr'], 'D') === false && ($zlib && $val['method'] == 0x8 || $val['method'] == 0x0)) {
$file->download = $this->getConfigParam('imp_contents')->linkView($this->_mimepart, 'download_render', '', array('class' => 'iconImg downloadAtc', 'jstext' => _("Download"), 'params' => array('zip_attachment' => $key)));
} else {
$file->download = '';
}
$view->files[] = $file;
}
return array($this->_mimepart->getMimeId() => array('data' => $view->render('compressed'), 'type' => 'text/html; charset=UTF-8'));
}
示例2: __construct
/**
* Constructor.
*
* @param array $params Optional parameters:
* <pre>
* 'hostspec' - (string) The hostname or IP address of the FTP server.
* DEFAULT: 'localhost'
* 'port' - (integer) The server port to connect to.
* DEFAULT: 21
* </pre>
*
* @throws Horde_Auth_Exception
*/
public function __construct(array $params = array())
{
if (!Horde_Util::extensionExists('ftp')) {
throw new Horde_Auth_Exception(__CLASS__ . ': Required FTP extension not found. Compile PHP with the --enable-ftp switch.');
}
$params = array_merge(array('hostspec' => 'localhost', 'port' => 21), $params);
parent::__construct($params);
}
示例3: __construct
/**
* Constructs a new Turba LDAP driver object.
*
* @param string $name The source name
* @param array $params Hash containing additional configuration parameters.
*
* @return Turba_Driver_Ldap
*/
public function __construct($name = '', array $params = array())
{
if (!Horde_Util::extensionExists('ldap')) {
throw new Turba_Exception(_("LDAP support is required but the LDAP module is not available or not loaded."));
}
$params = array_merge(array('charset' => '', 'deref' => LDAP_DEREF_NEVER, 'multiple_entry_separator' => ', ', 'port' => 389, 'root' => '', 'scope' => 'sub', 'server' => 'localhost'), $params);
parent::__construct($name, $params);
}
示例4: __construct
/**
* Constructor.
*
* @throws Ingo_Exception
*/
public function __construct(array $params = array())
{
if (!Horde_Util::extensionExists('ldap')) {
throw new Ingo_Exception(_("LDAP support is required but the LDAP module is not available or not loaded."));
}
$default_params = array('hostspec' => 'localhost', 'port' => 389, 'script_attribute' => 'mailSieveRuleSource');
parent::__construct(array_merge($default_params, $params));
}
示例5: __construct
/**
* Constructor.
*
* @param array $params Optional parameters:
* <pre>
* 'app' - (string) The name of the authenticating application.
* DEFAULT: horde
* 'service' - (string) The name of the SASL service to use when
* authenticating.
* DEFAULT: php
* </pre>
*
* @throws Horde_Auth_Exception
*/
public function __construct(array $params = array())
{
if (!Horde_Util::extensionExists('sasl')) {
throw new Horde_Auth_Exception('Horde_Auth_Peclsasl:: requires the sasl PECL extension to be loaded.');
}
$params = array_merge(array('app' => 'horde', 'service' => 'php'), $params);
parent::__construct($params);
sasl_server_init($this->_params['app']);
}
示例6: _whupsCallback
/**
* The function to use as a callback to _toHTML().
*
* @param integer $key The position of the file in the zip archive.
* @param array $val The information array for the archived file.
*
* @return string The content-type of the output.
*/
protected function _whupsCallback($key, $val)
{
$name = preg_replace('/( )+$/', '', $val['name']);
if (!empty($val['size']) && strstr($val['attr'], 'D') === false && ($val['method'] == 0x8 && Horde_Util::extensionExists('zlib') || $val['method'] == 0x0)) {
$mime_part = $this->_mimepart;
$mime_part->setName(basename($name));
$val['name'] = str_replace($name, Horde::url('view.php')->add(array('actionID' => 'view_file', 'type' => Horde_Util::getFormData('type'), 'file' => Horde_Util::getFormData('file'), 'ticket' => Horde_Util::getFormData('ticket'), 'zip_attachment' => $key + 1))->link() . $name . '</a>', $val['name']);
}
return $val;
}
示例7: _IMPcallback
/**
* The function to use as a callback to _renderInfo().
*
* @param integer $key The position of the file in the zip archive.
* @param array $val The information array for the archived file.
*
* @return string The content-type of the output.
*/
protected function _IMPcallback($key, $val)
{
$name = preg_replace('/( )+$/', '', $val['name']);
if (!empty($val['size']) && strstr($val['attr'], 'D') === false && ($val['method'] == 0x8 && Horde_Util::extensionExists('zlib') || $val['method'] == 0x0)) {
$mime_part = clone $this->_mimepart;
$mime_part->setName(basename($name));
$val['name'] = str_replace($name, $this->getConfigParam('imp_contents')->linkView($mime_part, 'download_render', $name, array('jstext' => sprintf(_("View %s"), str_replace(' ', ' ', $name)), 'class' => 'fixed', 'params' => array('zip_attachment' => urlencode($key) + 1))), $val['name']);
}
return $val;
}
示例8: __construct
/**
* Constructor.
*
* @param array $params Optional parameters:
* <pre>
* 'service' - (string) The name of the PAM service to use when
* authenticating.
* DEFAULT: php
* </pre>
*
* @throws Horde_Auth_Exception
*/
public function __construct(array $params = array())
{
if (!Horde_Util::extensionExists('pam')) {
throw new Horde_Auth_Exception('PAM authentication is not available.');
}
if (!empty($params['service'])) {
ini_set('pam.servicename', $params['service']);
}
parent::__construct($params);
}
示例9: _getAccount
/**
* Returns the user account from the posix information.
*
* @return array A hash with complete account details.
*
* @throws Horde_Exception if posix extension is missing.
*/
protected function _getAccount()
{
if (!isset($this->_information)) {
// This won't work if we don't have posix extensions.
if (!Horde_Util::extensionExists('posix')) {
throw new Horde_Exception(_("POSIX extension is missing"));
}
$user = Horde_String::lower($this->getUsername());
$this->_information = posix_getpwnam($user);
}
return $this->_information;
}
示例10: __construct
/**
* Constructor.
*
* @param array $params Parameters:
* <pre>
* 'domain' - (string) [REQUIRED] The domain name to authenticate with.
* 'group' - Group name that the user must be a member of.
* DEFAULT: none
* 'hostspec' - (string) [REQUIRED] IP, DNS Name, or NetBios name of the
* SMB server to authenticate with.
* </pre>
*
* @throws Horde_Auth_Exception
* @throws InvalidArgumentException
*/
public function __construct(array $params = array())
{
if (!Horde_Util::extensionExists('smbauth')) {
throw new Horde_Auth_Exception(__CLASS__ . ': Required smbauth extension not found.');
}
foreach (array('domain', 'hostspec') as $val) {
if (empty($params[$val])) {
throw new InvalidArgumentException('Missing ' . $val . ' parameter.');
}
}
$params = array_merge(array('group' => null), $params);
parent::__construct($params);
}
示例11: __construct
/**
* Constructor.
*
* @param array $params Connection parameters.
* <pre>
* 'host' - (string) [REQUIRED] The RADIUS host to use (IP address or
* fully qualified hostname).
* 'method' - (string) [REQUIRED] The RADIUS method to use for validating
* the request.
* Either: 'PAP', 'CHAP_MD5', 'MSCHAPv1', or 'MSCHAPv2'.
* ** CURRENTLY, only 'PAP' is supported. **
* 'nas' - (string) The RADIUS NAS identifier to use.
* DEFAULT: The value of $_SERVER['HTTP_HOST'] or, if not
* defined, then 'localhost'.
* 'port' - (integer) The port to use on the RADIUS server.
* DEFAULT: Whatever the local system identifies as the
* 'radius' UDP port
* 'retries' - (integer) The maximum number of repeated requests to make
* before giving up.
* DEFAULT: 3
* 'secret' - (string) [REQUIRED] The RADIUS shared secret string for the
* host. The RADIUS protocol ignores all but the leading 128
* bytes of the shared secret.
* 'suffix' - (string) The domain name to add to unqualified user names.
* DEFAULT: NONE
* 'timeout' - (integer) The timeout for receiving replies from the server
* (in seconds).
* DEFAULT: 3
* </pre>
*
* @throws InvalidArgumentException
*/
public function __construct(array $params = array())
{
if (!Horde_Util::extensionExists('radius')) {
throw new Horde_Auth_Exception(__CLASS__ . ': requires the radius PECL extension to be loaded.');
}
foreach (array('host', 'secret', 'method') as $val) {
if (!isset($params[$val])) {
throw new InvalidArgumentException('Missing ' . $val . ' parameter.');
}
}
$params = array_merge(array('nas' => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost', 'port' => 0, 'retries' => 3, 'suffix' => '', 'timeout' => 3), $params);
parent::__construct($params);
}
示例12: postProcess
/**
* Executes any code necessary after applying the filter patterns.
*
* @param string $text The text after the filtering.
*
* @return string The modified text.
*/
public function postProcess($text)
{
if (!Horde_Util::extensionExists('tidy') || $this->_params['size'] !== false && strlen($text) > $this->_params['size']) {
return $text;
}
$tidy_config = array('enclose-block-text' => true, 'hide-comments' => true, 'indent' => false, 'numeric-entities' => true, 'preserve-entities' => true, 'show-body-only' => !empty($this->_params['body_only']), 'tab-size' => 0, 'wrap' => 0);
$tidy = new tidy();
if (strtolower($this->_params['charset']) == 'us-ascii') {
if ($tidy->parseString($text, $tidy_config, 'ascii')) {
$tidy->cleanRepair();
$text = $tidy->value;
}
} elseif ($tidy->parseString(Horde_String::convertCharset($text, $this->_params['charset'], 'UTF-8'), $tidy_config, 'utf8')) {
$tidy->cleanRepair();
$text = Horde_String::convertCharset($tidy->value, 'UTF-8', $this->_params['charset']);
}
return $text;
}
示例13: __construct
/**
* Constructor.
*
* @param integer $source The source of the XML help data, based on the
* SOURCE_* constants.
* @param string $data The data source. If $source is RAW, this is
* XML text. If $source is FILE, this is the XML
* filename.
* @param array $views Include these views.
*
* @throws Exception
* @throws Horde_Exception
*/
public function __construct($source, $data, array $views = array())
{
if (!Horde_Util::extensionExists('dom')) {
throw new Horde_Exception('DOM not available.');
}
$dom = new DOMDocument('1.0', 'UTF-8');
switch ($source) {
case self::SOURCE_RAW:
$dom->loadXML($data);
break;
case self::SOURCE_FILE:
if (!@is_file($data)) {
throw new Horde_Exception(Horde_Core_Translation::t("Help file not found."));
}
$dom->load($data);
break;
}
/* Get list of active entries. */
$this->_processXml($dom->getElementsByTagName('help')->item(0), $views);
}
示例14: decompress
/**
* @return string The uncompressed data.
*/
public function decompress($data, array $params = array())
{
/* If gzip is not compiled into PHP, return now. */
if (!Horde_Util::extensionExists('zlib')) {
throw new Horde_Compress_Exception(Horde_Compress_Translation::t("This server can't uncompress gzip files."));
}
/* Gzipped File - decompress it first. */
$position = 0;
$info = @unpack('CCM/CFLG/VTime/CXFL/COS', substr($data, $position + 2));
if (!$info) {
throw new Horde_Compress_Exception(Horde_Compress_Translation::t("Unable to decompress data."));
}
$position += 10;
if ($info['FLG'] & $this->_flags['FEXTRA']) {
$XLEN = unpack('vLength', substr($data, $position + 0, 2));
$XLEN = $XLEN['Length'];
$position += $XLEN + 2;
}
if ($info['FLG'] & $this->_flags['FNAME']) {
$filenamePos = strpos($data, "", $position);
// Filename
// substr($data, $position, $filenamePos - $position);
$position = $filenamePos + 1;
}
if ($info['FLG'] & $this->_flags['FCOMMENT']) {
$commentPos = strpos($data, "", $position);
// Comment
// substr($data, $position, $commentPos - $position);
$position = $commentPos + 1;
}
if ($info['FLG'] & $this->_flags['FHCRC']) {
$hcrc = unpack('vCRC', substr($data, $position + 0, 2));
$hcrc = $hcrc['CRC'];
$position += 2;
}
$result = @gzinflate(substr($data, $position, strlen($data) - $position));
if (empty($result)) {
throw new Horde_Compress_Exception(Horde_Compress_Translation::t("Unable to decompress data."));
}
return $result;
}
示例15: _render
/**
* Return the full rendered version of the Horde_Mime_Part object.
*
* @return array See parent::render().
* @throws Horde_Exception
*/
protected function _render()
{
$has_xsl = Horde_Util::extensionExists('xsl');
if ($has_xsl) {
$tmpdir = Horde_Util::createTempDir(true) . '/';
}
$fnames = array('content.xml', 'styles.xml', 'meta.xml');
$tags = array('text:p' => 'p', 'table:table' => 'table border="0" cellspacing="1" cellpadding="0" ', 'table:table-row' => 'tr bgcolor="#cccccc"', 'table:table-cell' => 'td', 'table:number-columns-spanned=' => 'colspan=');
if (!$this->getConfigParam('zip')) {
$this->setConfigParam('zip', Horde_Compress::factory('Zip'));
}
$list = $this->getConfigParam('zip')->decompress($this->_mimepart->getContents(), array('action' => Horde_Compress_Zip::ZIP_LIST));
foreach ($list as $key => $file) {
if (in_array($file['name'], $fnames)) {
$content = $this->getConfigParam('zip')->decompress($this->_mimepart->getContents(), array('action' => Horde_Compress_Zip::ZIP_DATA, 'info' => $list, 'key' => $key));
if ($has_xsl) {
file_put_contents($tmpdir . $file['name'], $content);
} elseif ($file['name'] == 'content.xml') {
return array($this->_mimepart->getMimeId() => array('data' => str_replace(array_keys($tags), array_values($tags), $content), 'status' => array(), 'type' => 'text/html; charset=UTF-8'));
}
}
}
if (!$has_xsl) {
return array();
}
$xslt = new XSLTProcessor();
$xsl = new DOMDocument();
$xsl->load(realpath(__DIR__ . '/Ooo/export/xhtml/opendoc2xhtml.xsl'));
$xslt->importStylesheet($xsl);
$xslt->setParameter('http://www.w3.org/1999/XSL/Transform', array('metaFileURL' => 'file://' . $tmpdir . 'meta.xml', 'stylesFileURL' => 'file://' . $tmpdir . 'styles.xml', 'java' => false));
$xml = new DOMDocument();
$xml->load(realpath($tmpdir . 'content.xml'));
$result = $xslt->transformToXml($xml);
if (!$result) {
$result = libxml_get_last_error()->message;
}
return array($this->_mimepart->getMimeId() => array('data' => $result, 'status' => array(), 'type' => 'text/html; charset=UTF-8'));
}