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


PHP Horde_Util::loadExtension方法代码示例

本文整理汇总了PHP中Horde_Util::loadExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Util::loadExtension方法的具体用法?PHP Horde_Util::loadExtension怎么用?PHP Horde_Util::loadExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Util的用法示例。


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

示例1: _getFaces

 /**
  * Get faces
  *
  * @param string $file Picture filename
  * @throws Horde_Exception
  */
 protected function _getFaces($file)
 {
     if (!Horde_Util::loadExtension('facedetect')) {
         throw new Ansel_Exception('You do not have the facedetect extension enabled in PHP');
     }
     return face_detect($file, $this->_defs);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:13,代码来源:Facedetect.php

示例2: _changePassword

 /**
  */
 protected function _changePassword($user, $oldpass, $newpass)
 {
     if (!Horde_Util::loadExtension('expect')) {
         throw new Passwd_Exception(_("expect extension cannot be loaded"));
     }
     // Set up parameters
     foreach (array('logfile', 'loguser', 'timeout') as $val) {
         if (isset($this->_params[$val])) {
             ini_set('expect.' . $val, $this->_params[$val]);
         }
     }
     // Open connection
     $call = sprintf('ssh %s@%s %s', $user, $this->_params['host'], $this->_params['program']);
     if (!($this->_stream = expect_popen($call))) {
         throw new Passwd_Exception(_("Unable to open expect stream"));
     }
     // Log in
     $this->_ctl('(P|p)assword.*', _("Could not login to system (no password prompt)"));
     // Send login password
     fwrite($this->_stream, $oldpass . "\n");
     // Expect old password prompt
     $this->_ctl('((O|o)ld|login|current).* (P|p)assword.*', _("Could not start passwd program (no old password prompt)"));
     // Send old password
     fwrite($this->_stream, $oldpass . "\n");
     // Expect new password prompt
     $this->_ctl('(N|n)ew.* (P|p)assword.*', _("Could not change password (bad old password?)"));
     // Send new password
     fwrite($this->_stream, $newpass . "\n");
     // Expect reenter password prompt
     $this->_ctl("((R|r)e-*enter.*(P|p)assword|Retype new( UNIX)? password|(V|v)erification|(V|v)erify|(A|a)gain).*", _("New password not valid (too short, bad password, too similar, ...)"));
     // Send new password
     fwrite($this->_stream, $newpass . "\n");
     // Expect successfully message
     $this->_ctl('((P|p)assword.* changed|successfully)', _("Could not change password."));
 }
开发者ID:horde,项目名称:horde,代码行数:37,代码来源:Expectpecl.php

示例3: __construct

 /**
  * Const'r
  *
  * @see Horde_Image_Base::_construct
  */
 public function __construct($params, $context = array())
 {
     if (!Horde_Util::loadExtension('imagick')) {
         throw new Horde_Image_Exception('Required PECL Imagick extension not found.');
     }
     parent::__construct($params, $context);
     ini_set('imagick.locale_fix', 1);
     $this->_imagick = new Imagick();
     if (!empty($params['filename'])) {
         $this->loadFile($params['filename']);
     } elseif (!empty($params['data'])) {
         $this->loadString($params['data']);
     } else {
         $this->_width = max(array($this->_width, 1));
         $this->_height = max(array($this->_height, 1));
         try {
             $this->_imagick->newImage($this->_width, $this->_height, $this->_background);
         } catch (ImagickException $e) {
             throw new Horde_Image_Exception($e);
         }
     }
     try {
         $this->_imagick->setImageFormat($this->_type);
     } catch (ImagickException $e) {
         throw new Horde_Image_Exception($e);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:32,代码来源:Imagick.php

示例4: getSignatureFromFile

 /**
  * Get an image signature from an arbitrary file. Currently used when
  * searching for faces that appear in a user-supplied image.
  *
  * @param integer $filename Image filename to check
  *
  * @return binary vector signature
  */
 public function getSignatureFromFile($filename)
 {
     if ($GLOBALS['conf']['faces']['search'] == 0 || Horde_Util::loadExtension('libpuzzle') === false) {
         return '';
     }
     return puzzle_fill_cvec_from_file($filename);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:15,代码来源:Base.php

示例5: __construct

 /**
  * Constructor.
  *
  * @see $_config
  *
  * @param array $config Configuration array.
  */
 public function __construct($config = array())
 {
     if (!Horde_Util::loadExtension('ldap')) {
         throw new Horde_Ldap_Exception('No PHP LDAP extension');
     }
     $this->setConfig($config);
     $this->bind();
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:15,代码来源:Ldap.php

示例6: _getImageData

 /**
  * Returns decoded image data
  *
  * @param string $data         The image data
  * @param string $encoding     The encoding type for the image data.
  *                             (none, base64, or binhex)
  * @param string $compression  The compression type for the image data.
  *                             (none, gzip, or lzf)
  * @param boolean $upload      Process direction (true of encode/compress or false if decode/decompress)
  *
  * @return string  The decoded/encoded image data
  */
 protected function _getImageData($data, $encoding = 'none', $compression = 'none', $upload = true)
 {
     switch ($encoding) {
         case 'base64':
             $data = $upload ? base64_decode($data) : base64_encode($data);
             break;
         case 'binhex':
             $data = $upload ? pack('H*', $data) : unpack('H*', $data);
     }
     switch ($compression) {
         case 'gzip':
             if (Horde_Util::loadExtension('zlib')) {
                 return $upload ? gzuncompress($data) : gzcompress($data);
             }
             break;
         case 'lzf':
             if (Horde_Util::loadExtension('lzf')) {
                 return $upload ? lzf_decompress($data) : lzf_compress($data);
             }
             break;
         default:
             return $data;
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:36,代码来源:Api.php

示例7: getFaceTile

 /**
  * Generate HTML for a face's tile
  *
  * @param integer $face  The face id.
  *
  * @return string  The generated HTML
  */
 public static function getFaceTile($face)
 {
     $faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
     if (!is_array($face)) {
         $face = $faces->getFaceById($face, true);
     }
     $face_id = $face['face_id'];
     // The HTML to display the face image.
     $imghtml = sprintf("<img src=\"%s\" class=\"bordered-facethumb\" id=\"%s\" alt=\"%s\" />", $faces->getFaceUrl($face['image_id'], $face_id), 'facethumb' . $face_id, htmlspecialchars($face['face_name']));
     $img_view_url = Ansel::getUrlFor('view', array('gallery' => $face['gallery_id'], 'view' => 'Image', 'image' => $face['image_id'], 'havesearch' => false));
     // Build the actual html
     $html = '<div id="face' . $face_id . '"><table><tr><td>' . $img_view_url->link() . $imghtml . '</a></td><td>';
     if (!empty($face['face_name'])) {
         $html .= Horde::url('faces/face.php')->add('face', $face['face_id'])->link() . $face['face_name'] . '</a><br />';
     }
     // Display the face name or a link to claim the face.
     if (empty($face['face_name']) && $GLOBALS['conf']['report_content']['driver']) {
         $html .= Horde::url('faces/claim.php')->add('face', $face_id)->link(array('title' => _("Do you know someone in this photo?"))) . _("Claim") . '</a>';
     }
     // Link for searching for similar faces.
     if (Horde_Util::loadExtension('libpuzzle') !== false) {
         $html .= Horde::url('faces/search/image_search.php')->add('face_id', $face_id)->link() . _("Find similar") . '</a>';
     }
     $html .= '</td></tr></table></div>';
     return $html;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:33,代码来源:Faces.php

示例8: __construct

 /**
  */
 public function __construct($app, $params = array())
 {
     parent::__construct($app, $params);
     $this->enabled = Horde_Util::loadExtension('soap');
     $this->_name = _("EU VAT identification");
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:8,代码来源:Vatid.php


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