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


PHP Horde::loadConfiguration方法代码示例

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


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

示例1: builder

 /**
  * Attempts to determine a files programming language and returns
  * a parser instance for this language.
  *
  * @param Luxor_Files $files  An instance of Luxor_Files to use for file
  *                            operations and path name resolution.
  * @param string $pathname    The path name of the file to create a
  *                            parser for.
  *
  * @return mixed    The created concrete Luxor_Lang instance, or false
  *                  on error.
  */
 function builder($files, $pathname)
 {
     global $languages;
     $languages = Horde::loadConfiguration('languages.php', 'languages', 'luxor');
     /* First, check the 'filetype' hash for a matching file extension. */
     foreach ($languages['filetype'] as $type) {
         if (preg_match('/' . $type[1] . '/', $pathname)) {
             return Luxor_Lang::factory($type[2], $type);
         }
     }
     /* Next, try to detect the shebang line. */
     $fh = $files->getFileHandle($pathname);
     if (!$fh || is_a($fh, 'PEAR_Error')) {
         return $fh;
     }
     $line = fgets($fh);
     if (!preg_match('/^\\#!\\s*(\\S+)/s', $line, $match)) {
         return false;
     }
     if (isset($languages['interpreters'][$match[1]])) {
         $lang = $languages['filetype'][$languages['interpreters'][$match[1]]];
         return Luxor_Lang::factory($lang[2], $lang);
     }
     return false;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:37,代码来源:Lang.php

示例2: create

 public function create(Horde_Injector $injector)
 {
     /* Brings in the $styles array in this scope only */
     $styles = Horde::loadConfiguration('styles.php', 'styles', 'ansel');
     /* No prettythumbs allowed at all by admin choice */
     if (empty($GLOBALS['conf']['image']['prettythumbs'])) {
         $test = $styles;
         foreach ($test as $key => $style) {
             if ($style['thumbstyle'] != 'Thumb') {
                 unset($styles[$key]);
             }
         }
     }
     /* Check if the browser / server has png support */
     if ($GLOBALS['conf']['image']['type'] != 'png') {
         $test = $styles;
         foreach ($test as $key => $style) {
             if (!empty($style['requires_png'])) {
                 if (!empty($style['fallback'])) {
                     $styles[$key] = $styles[$style['fallback']];
                 } else {
                     unset($styles[$key]);
                 }
             }
         }
     }
     return $styles;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:28,代码来源:Styles.php

示例3: getAttributes

 /**
  * Find a list of configured attributes.
  *
  * Load the attributes configuration file or uses an already-loaded
  * cached copy. If loading for the first time, cache it for later use.
  *
  * @return array  The attributes list.
  */
 public static function getAttributes()
 {
     static $_attributes;
     if (!isset($_attributes)) {
         $_attributes = Horde::loadConfiguration('attributes.php', '_attributes');
     }
     return $_attributes;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:Sam.php

示例4: getCountries

 /**
  * Returns avaiable countries
  */
 static function getCountries()
 {
     try {
         return Horde::loadConfiguration('countries.php', 'countries', 'folks');
     } catch (Horde_Exception $e) {
         return Horde_Nls::getCountryISO();
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:Folks.php

示例5: __construct

 public function __construct()
 {
     global $registry, $notification, $browser, $conf;
     $this->registry =& $registry;
     $this->notification =& $notification;
     $this->auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create();
     $this->conf = Horde::loadConfiguration('conf.php', 'conf');
     $this->objects = Horde::loadConfiguration('objects.php', 'objects');
     $this->attributes = Horde::loadConfiguration('attributes.php', 'attributes');
     $this->labels = Horde::loadConfiguration('labels.php', 'labels');
     $this->perms = Horde::loadConfiguration('perms.php', 'perms');
     $this->order = Horde::loadConfiguration('order.php', 'order');
     $this->visible = Horde::loadConfiguration('visible.php', 'visible');
     $this->search = Horde::loadConfiguration('search.php', 'search');
 }
开发者ID:horde,项目名称:horde,代码行数:15,代码来源:Koward.php

示例6: _params

 /**
  */
 protected function _params()
 {
     $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
     $params['source'] = array('name' => _("Feed"), 'type' => 'enum', 'values' => array());
     $channels = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannels();
     foreach ($channels as $channel) {
         $params['source']['values'][$channel['channel_id']] = $channel['channel_name'];
     }
     natcasesort($params['source']['values']);
     $params['view'] = array('name' => _("View"), 'type' => 'enum', 'values' => array());
     foreach ($templates as $key => $template) {
         $params['view']['values'][$key] = $template['name'];
     }
     $params['max'] = array('name' => _("Maximum Stories"), 'type' => 'int', 'default' => 10, 'required' => false);
     return $params;
 }
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:NewsPopular.php

示例7: indexFile

 /**
  * Indexes a file.
  *
  * @param string $path  The full path name of the file to index.
  * @param int $fileId   The file's unique ID.
  *
  * @return mixed        A PEAR_Error on error.
  */
 function indexFile($path, $fileId)
 {
     global $conf, $index;
     $typemap = $this->_langmap['typemap'];
     $languages = Horde::loadConfiguration('languages.php', 'languages', 'luxor');
     if (isset($languages['eclangnamemapping'][$this->_language])) {
         $langforce = $languages['eclangnamemapping'][$this->_language];
     } else {
         $langforce = $this->_language;
     }
     $version = shell_exec($conf['paths']['ectags'] . ' --version');
     if (!preg_match('/Exuberant ctags +(\\d+)/i', $version, $match) || $match[1] < 5) {
         return PEAR::raiseError(sprintf(_("Exuberant ctags version 5 or above required, found version %s"), $version));
     }
     if (file_exists($conf['paths']['ectags'])) {
         /* Call excuberant ctags. */
         $ectags = @popen($conf['paths']['ectags'] . ' ' . $languages['ectagsopts'] . ' --excmd=number --language-force=' . $langforce . ' -f - ' . $path, 'r');
         if (!$ectags) {
             return PEAR::raiseError(_("Can't run ectags."));
         }
         while ($fgets = trim(fgets($ectags))) {
             @(list($sym, $file, $line, $type, $ext) = explode("\t", $fgets));
             $line = preg_replace('/;"$/', '', $line);
             preg_match('/language:(\\w+)/', $ext, $match);
             $ext = @$match[1];
             if (!isset($typemap[$type])) {
                 continue;
             }
             $type = $typemap[$type];
             if (!empty($ext) && preg_match('/^(struct|union|class|enum):(.*)/', $ext, $match)) {
                 $ext = str_replace('::<anonymous>', '', $match[2]);
             } else {
                 $ext = '';
             }
             /* Build index. */
             $result = $index->index($sym, $fileId, $line, $this->_langmap['langid'], $type);
             if (is_a($result, 'PEAR_Error')) {
                 pclose($ectags);
                 return $result;
             }
         }
         pclose($ectags);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:52,代码来源:Generic.php

示例8: run

 public function run()
 {
     $this->_runtime = time();
     // See if we need to include the reminders config file.
     if (filemtime(WHUPS_BASE . '/config/reminders.php') > $this->_filestamp) {
         $this->_filestamp = $this->_runtime;
         $this->_reminders = Horde::loadConfiguration('reminders.php', 'reminders', 'whups');
     }
     foreach ($this->_reminders as $reminder) {
         $ds = new Horde_Scheduler_Cron_Date($reminder['frequency']);
         if ($ds->scheduledAt($this->_runtime)) {
             if (!empty($reminder['server_name'])) {
                 $GLOBALS['conf']['server']['name'] = $reminder['server_name'];
             }
             $vars = new Horde_Variables($reminder);
             Whups::sendReminders($vars);
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:19,代码来源:Scheduler.php

示例9: printfile_raw

function printfile_raw($pathname)
{
    global $mime_drivers, $mime_drivers_map;
    $result = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'horde');
    extract($result);
    $result = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'luxor');
    if (isset($result['mime_drivers'])) {
        $mime_drivers = array_replace_recursive($mime_drivers, $result['mime_drivers']);
    }
    if (isset($result['mime_drivers_map'])) {
        $mime_drivers_map = array_replace_recursive($mime_drivers_map, $result['mime_drivers_map']);
    }
    $filename = $GLOBALS['files']->toReal($pathname);
    $data = file_get_contents($filename);
    $mime_part = new Horde_Mime_Part(Horde_Mime_Magic::filenameToMime($pathname), $data);
    $mime_part->setName($pathname);
    $viewer = $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->create($mime_part);
    if ($viewer->getType() == 'text/plain') {
        return '<pre class="fixed">' . htmlspecialchars($viewer->render()) . '</pre>';
    } else {
        return $viewer->render();
    }
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:23,代码来源:source.php

示例10: run

 /**
  * $registry
  * $notification
  * $conf
  * $criteria
  *
  */
 public function run()
 {
     extract($this->_params, EXTR_REFS);
     $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
     /* Get requested channel. */
     try {
         $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($criteria['feed']);
     } catch (Exception $e) {
         Horde::log($e, 'ERR');
         $notification->push(_("Invalid channel."), 'horde.error');
         Horde::url('delivery/index.php', true)->redirect();
         exit;
     }
     $title = sprintf(_("HTML Delivery for \"%s\""), $channel['channel_name']);
     $options = array();
     foreach ($templates as $key => $info) {
         $options[] = '<option value="' . $key . '"' . ($key == $criteria['format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
     }
     $template = new Horde_Template();
     $template->setOption('gettext', 'true');
     $template->set('url', Horde::selfUrl());
     $template->set('session', Horde_Util::formInput());
     $template->set('channel_id', $criteria['feed']);
     $template->set('channel_name', $channel['channel_name']);
     $template->set('format', $criteria['format']);
     $template->set('options', $options);
     // @TODO: This is ugly. storage driver shouldn't be rendering any display
     // refactor this to use individual views possibly with a choice of different templates
     $template->set('stories', $GLOBALS['injector']->getInstance('Jonah_Driver')->renderChannel($criteria['feed'], $criteria['format']));
     // Buffer the notifications and send to the template
     Horde::startBuffer();
     $GLOBALS['notification']->notify(array('listeners' => 'status'));
     $template->set('notify', Horde::endBuffer());
     $GLOBALS['page_output']->header(array('title' => $title));
     echo $template->fetch(JONAH_TEMPLATES . '/delivery/html.html');
     $GLOBALS['page_output']->footer();
 }
开发者ID:horde,项目名称:horde,代码行数:44,代码来源:DeliveryHtml.php

示例11: up

 public function up()
 {
     $this->changeColumn('ansel_shares', 'attribute_style', 'text');
     // Create: ansel_hashes
     $t = $this->createTable('ansel_hashes', array('autoincrementKey' => false));
     $t->column('style_hash', 'string', array('limit' => 255));
     $t->primaryKey(array('style_hash'));
     $t->end();
     $styles = Horde::loadConfiguration('styles.php', 'styles', 'ansel');
     // Migrate existing data
     $sql = 'SELECT share_id, attribute_style FROM ansel_shares';
     $this->announce('Migrating gallery styles.', 'cli.message');
     $defaults = array('thumbstyle' => 'Thumb', 'background' => 'none', 'gallery_view' => 'Gallery', 'widgets' => array('Tags' => array('view' => 'gallery'), 'OtherGalleries' => array(), 'Geotag' => array(), 'Links' => array(), 'GalleryFaces' => array(), 'OwnerFaces' => array()));
     $rows = $this->_connection->selectAll($sql);
     $update = 'UPDATE ansel_shares SET attribute_style = ? WHERE share_id = ?;';
     foreach ($rows as $row) {
         // Make sure we haven't already migrated
         if (@unserialize($row['attribute_style']) instanceof Ansel_Style) {
             $this->announce('Skipping share ' . $row['attribute_style'] . ', already migrated.', 'cli.message');
             continue;
         }
         if (empty($styles[$row['attribute_style']])) {
             $newStyle = '';
         } else {
             $properties = array_merge($defaults, $styles[$row['attribute_style']]);
             // Translate previous generator names:
             $properties = $this->_translate_generators($properties);
             $newStyle = serialize(new Ansel_Style($properties));
         }
         $this->announce('Migrating share id: ' . $row['share_id'] . ' from: ' . $row['attribute_style'] . ' to: ' . $newStyle, 'cli.message');
         try {
             $this->_connection->execute($update, array($newStyle, $row['share_id']));
         } catch (Horde_Db_Exception $e) {
             $this->announce('ERROR: ' . $e->getMessage());
         }
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:3_ansel_upgrade_style.php

示例12: renderChannel

 /**
  * Returns the stories of a channel rendered with the specified template.
  *
  * @param integer $channel_id  The news channel to get stories from.
  * @param string  $tpl         The name of the template to use.
  * @param integer $max         The maximum number of stories to get. If
  *                             null, all stories will be returned.
  * @param integer $from        The number of the story to start with.
  * @param integer $order       How to sort the results for internal channels
  *                             Possible values are the Jonah::ORDER_*
  *                             constants.
  *
  * @TODO: This doesn't belong in a storage driver class. Move it to a
  * view or possible a static method in Jonah::?
  *
  * @return string  The rendered story listing.
  */
 public function renderChannel($channel_id, $tpl, $max = 10, $from = 0, $order = Jonah::ORDER_PUBLISHED)
 {
     $channel = $this->getChannel($channel_id);
     $templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
     $escape = !isset($templates[$tpl]['escape']) || !empty($templates[$tpl]['escape']);
     $template = new Horde_Template();
     if ($escape) {
         $channel['channel_name'] = htmlspecialchars($channel['channel_name']);
         $channel['channel_desc'] = htmlspecialchars($channel['channel_desc']);
     }
     $template->set('channel', $channel, true);
     /* Get one story more than requested to see if there are more stories. */
     if ($max !== null) {
         $stories = $this->getStories(array('channel_id' => $channel_id, 'published' => true, 'startnumber' => $from, 'limit' => $max), $order);
     } else {
         $stories = $this->getStories(array('channel_id' => $channel_id, 'published' => true), $order);
         $max = count($stories);
     }
     if (!$stories) {
         $template->set('error', _("No stories are currently available."), true);
         $template->set('stories', false, true);
         $template->set('image', false, true);
         $template->set('form', false, true);
     } else {
         /* Escape. */
         if ($escape) {
             array_walk($stories, array($this, '_escapeStories'));
         }
         /* Process story summaries. */
         array_walk($stories, array($this, '_escapeStoryDescriptions'));
         $template->set('error', false, true);
         $template->set('story_marker', Horde::img('story_marker.png'));
         $template->set('image', false, true);
         $template->set('form', false, true);
         if ($from) {
             $template->set('previous', max(0, $from - $max), true);
         } else {
             $template->set('previous', false, true);
         }
         if ($from && !empty($channel['channel_page_link'])) {
             $template->set('previous_link', str_replace(array('%25c', '%25n', '%c', '%n'), array('%c', '%n', $channel['channel_id'], max(0, $from - $max)), $channel['channel_page_link']), true);
         } else {
             $template->set('previous_link', false, true);
         }
         $more = count($stories) > $max;
         if ($more) {
             $template->set('next', $from + $max, true);
             array_pop($stories);
         } else {
             $template->set('next', false, true);
         }
         if ($more && !empty($channel['channel_page_link'])) {
             $template->set('next_link', str_replace(array('%25c', '%25n', '%c', '%n'), array('%c', '%n', $channel['channel_id'], $from + $max), $channel['channel_page_link']), true);
         } else {
             $template->set('next_link', false, true);
         }
         $template->set('stories', $stories, true);
     }
     return $template->parse($templates[$tpl]['template']);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:77,代码来源:Driver.php

示例13: array

<?php

/**
 * Script to handle requests for html delivery of stories.
 *
 * Copyright 2004-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (BSD). If you did not
 * did not receive this file, see http://cvs.horde.org/co.php/jonah/LICENSE.
 *
 * @author Jan Schneider <jan@horde.org>
 */
require_once __DIR__ . '/lib/Application.php';
$jonah = Horde_Registry::appInit('jonah', array('authentication' => 'none', 'session_control' => 'readonly'));
$jonah = Horde_Registry::appInit('jonah');
$templates = Horde::loadConfiguration('templates.php', 'templates', 'jonah');
/* Get the id and format of the feed to display. */
$criteria = Horde_Util::nonInputVar('criteria');
if (empty($criteria['channel_format'])) {
    // Select the default channel format
    $criteria['channel_format'] = key($templates);
}
$options = array();
foreach ($templates as $key => $info) {
    $options[] = '<option value="' . $key . '"' . ($key == $criteria['channel_format'] ? ' selected="selected"' : '') . '>' . $info['name'] . '</option>';
}
if (empty($criteria['channel_id']) && !empty($criteria['feed'])) {
    $criteria['channel_id'] = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannelId($criteria['feed']);
}
if (empty($criteria['channel_id'])) {
    $notification->push(_("No valid feed name or ID requested."), 'horde.error');
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:feed.php

示例14: dirDesc

 /**
  * Prints a descriptive blurb at the end of directory listings.
  *
  * @param Luxor_File $files  An instance of Luxor_File.
  * @param string $path       The directory where to look for a README file.
  */
 function dirDesc($files, $path)
 {
     $table_head = '<br /><br /><table width="100%" cellpadding="5"><tr><td class="text"><span class="fixed">';
     $table_foot = '</span></td></tr></table>';
     if (file_exists($filename = $files->toReal($path . '/README')) || file_exists($filename = $files->toReal($path . '/README.txt'))) {
         $contents = file_get_contents($filename);
         return $table_head . $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($contents, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)) . $table_foot;
     } elseif ($filename = file_exists($files->toReal($path . '/README.html'))) {
         global $mime_drivers, $mime_drivers_map;
         $result = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'horde');
         extract($result);
         $result = Horde::loadConfiguration('mime_drivers.php', array('mime_drivers', 'mime_drivers_map'), 'luxor');
         $mime_drivers = array_replace_recursive($mime_drivers, $result['mime_drivers']);
         $mime_drivers_map = array_replace_recursive($mime_drivers_map, $result['mime_drivers_map']);
         $contents = file_get_contents($filename);
         $mime_part = new Horde_Mime_Part('text/plain', $contents);
         $mime_part->setName('README');
         return $table_head . $GLOBALS['injector']->getInstance('Horde_Core_Factory_MimeViewer')->create($mime_part)->render() . $table_foot;
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:26,代码来源:Luxor.php

示例15: getBackend

 /**
  * Loads the Gollem backend configuration from backends.php.
  *
  * @param string $backend  Returns this labeled entry only.
  *
  * @return mixed  If $backend is set return this entry; else, return the
  *                entire backends array. Returns false on error.
  */
 public static function getBackend($backend = null)
 {
     if (!($backends = self::_getBackends())) {
         try {
             $backends = Horde::loadConfiguration('backends.php', 'backends', 'gollem');
             if (is_null($backends)) {
                 return false;
             }
         } catch (Horde_Exception $e) {
             Horde::log($e, 'ERR');
             return false;
         }
         foreach (array_keys($backends) as $key) {
             if (!empty($backends[$key]['disabled']) || !Gollem::checkPermissions('backend', Horde_Perms::SHOW, $key)) {
                 unset($backends[$key]);
             }
         }
         self::_setBackends($backends);
     }
     if (is_null($backend)) {
         return $backends;
     }
     /* Check for the existence of the backend in the config file. */
     if (empty($backends[$backend]) || !is_array($backends[$backend])) {
         $entry = sprintf('Invalid backend key "%s" from client [%s]', $backend, $_SERVER['REMOTE_ADDR']);
         Horde::log($entry, 'ERR');
         return false;
     }
     return $backends[$backend];
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:38,代码来源:Auth.php


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