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


PHP config::def方法代码示例

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


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

示例1: array

<?php

config::def('lepton.crypto.rndsources', array('UrandomRndSource', 'RandomRndSource', 'TimebasedRndSource'));
/**
 * @class RndGen
 * @brief Random number generation
 *
 * This class calls on the best supported random number source available to the
 * system. New sources can be added with the lepton.crypto.rndsources config
 * setting.
 *
 * @author Christopher Vagnetoft <noccy.com>
 */
class RndGen
{
    const KEY_RND_SOURCES = 'lepton.crypto.rndsources';
    private $src;
    function __construct()
    {
        logger::debug(__CLASS__ . ': Finding suitable source of randomness');
        $sources = config::get(RndGen::KEY_RND_SOURCES);
        foreach ($sources as $source) {
            logger::debug(__CLASS__ . ': Testing source %s', $source);
            $sh = new $source();
            if ($sh->supported()) {
                logger::debug(__CLASS__ . ': Supported source found: %s', $source);
                $sh->initialize();
                $this->src = $sh;
                return;
            }
            unset($sh);
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:rndgen.php

示例2: module

<?php

module("Lepton CMS Blog Stub");
config::def('lepton.cms.blog.defaultblog', 'default');
using('lepton.cms.blog.*');
开发者ID:noccy80,项目名称:lepton-ng,代码行数:5,代码来源:blog.php

示例3: define

<?php

config::def('lepton.gallery.mediadir', base::appPath() . '/media/');
config::def('lepton.gallery.cachedir', base::appPath() . '/cache/');
// config::def('lepton.gallery.renderer', array('WatermarkImageFilter','mylogo.png'));
using('lepton.graphics.canvas');
using('lepton.utils.pagination');
class GalleryItemsTable extends SqlTableSchema
{
    function define()
    {
        // Only to be used during testing!
        $this->dropOnCreate();
        // Table name
        $this->setName('galleryitems');
        // Table columns
        $this->addColumn('id', 'int', self::COL_AUTO | self::KEY_PRIMARY);
        $this->addColumn('name', 'varchar:160');
        $this->addColumn('uuid', 'char:37', self::COL_FIXED);
        $this->addColumn('src', 'varchar:200');
        // Indexes
        $this->addIndex('uuidkey', array('uuid'), self::KEY_UNIQUE);
        $this->addIndex('srckey', array('src'), self::KEY_UNIQUE);
    }
}
SqlTableSchema::apply(new GalleryItemsTable());
/**
 * @class Gallery
 * @package lepton.media
 * @brief Gallery Management
 *
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:gallery.php

示例4: getInformationFromIp

<?php

config::def(GeoLocation::KEY_RESOLVER, 'GeopluginResolver');
interface IGeoResolver
{
    static function getInformationFromIp($ip);
}
abstract class GeoResolver implements IGeoResolver
{
}
using('lepton.geo.resolvers.*');
/**
 *
 *
 * @todo Make this class extendable with various APIs including maxmind's
 *       geoIp.
 *
 * 'geoplugin_city' => 'Hammarö',
 * 'geoplugin_region' => 'Värmlands Län',
 * 'geoplugin_areaCode' => '0',
 * 'geoplugin_dmaCode' => '0',
 * 'geoplugin_countryCode' => 'SE',
 * 'geoplugin_countryName' => 'Sweden',
 * 'geoplugin_continentCode' => 'EU',
 * 'geoplugin_latitude' => '59.333301544189',
 * 'geoplugin_longitude' => '13.516699790955',
 * 'geoplugin_regionCode' => '22',
 * 'geoplugin_regionName' => 'Värmlands Län',
 * 'geoplugin_currencyCode' => 'SEK',
 * 'geoplugin_currencySymbol' => 'kr',
 * 'geoplugin_currencyConverter' => 6.2286000252,
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:geo.php

示例5: using

<?php

using('lepton.user.extensions');
config::def('lepton.avatar.providers', array('LocalAvatarProvider', 'GravatarAvatarProvider'));
config::push('lepton.user.extensions', 'AvatarProvider');
////////// AvatarProviders ////////////////////////////////////////////////
/**
 * AvatarProvider interface and base class. Derive your avatar mnaagement functions
 * from the AvatarProvider class. The first class in the chain to return a non-null
 * string will be used as the avatar source.
 */
class AvatarProvider extends UserExtension
{
    function getMethods()
    {
        return array('getAvatar', 'setAvatar');
    }
    function getAvatar($size = null)
    {
        $prov = config('lepton.avatar.providers');
        foreach ($prov as $provider) {
            $prov = new $provider();
            $avatar = $prov->getAvatar($this->user, $size);
            if ($avatar) {
                break;
            }
        }
        return $avatar;
    }
    function setAvatar($avatar)
    {
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:avatars.php

示例6:

<?php

config::def('lepton.net.mail.from', '"Local Lepton Installation" <lepton@localhost>');
using('lepton.mvc.response');
// has content type code for now
/**
 * @class MailMessage
 * @example mimemessage.p
 * @brief Constructs a MIME encapsulated message
 *
 * The created message is compliant with RFC2045 and RFC822 and can be sent
 * using any SMTP backend.
 */
class MailMessage
{
    const KEY_MAIL_FROM = 'lepton.net.mail.from';
    const KEY_MAIL_FROMNAME = 'lepton.net.mail.fromname';
    const FROM_ADDRONLY = 1;
    const FROM_NAMEONLY = 2;
    const FROM_FULL = 3;
    // These values are used with the getRecipients and getReceipientList
    // methods.
    const ADDR_TO = 1;
    const ADDR_CC = 2;
    const ADDR_BCC = 4;
    const ADDR_MIME = 3;
    // to + cc
    const ADDR_ALL = 255;
    // to + cc + bcc
    const RCPT_TO = 'to';
    const RCPT_CC = 'cc';
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:message.php

示例7: sendMessage

<?php

/**
 * WARNNING! This implementation will be removed shortly to be replaced by 
 * the full mime implementation at lepton.net.mail.*!
 *
 * The APIs should be somewhat identical, but you should still be careful
 * when using this code.
 */
config::def('lepton.net.mail.from', 'Local Lepton Installation <lepton@localhost>');
config::def('lepton.net.mail.smtpserver', 'localhost');
config::def('lepton.net.mail.localhost', 'localhost');
config::def('lepton.net.mail.smtpport', 25);
config::def('lepton.net.mail.backend', 'PearMailerBackend');
config::def('lepton.net.mail.pear.backend', 'smtp');
class MailException extends Exception
{
}
interface IMailerBackend
{
    public function sendMessage(MailMessage $message);
}
abstract class MailerBackend implements IMailerBackend
{
    static function send(MailMessage $message)
    {
        $bc = config::get('lepton.net.mail.backend');
        $b = new $bc();
        return $b->sendMessage($message);
    }
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:mail.php

示例8: module

<?php

module("Google Charts API");
// Passthrough requests when possible (redirect instead of proxying)
config::def('google.charts.api.passthrough', true);
// Load the data storage that we need
using('lepton.data.*');
interface IGChart
{
    function buildPostData();
}
/**
 * @class GChart
 * @brief Google Charting Class.
 * Draws charts via Google's Chart API either by redirecting or proxying the
 * request.
 *
 * @property width The width of the graph
 * @property height The height of the graph
 * @package lepton.google.charting
 */
abstract class GChart extends Chart implements IGChart
{
    /// @const Configuration key for if charts are to be passed through
    const CONF_PASSTHROUGH = 'google.charts.api.passthrough';
    /// @var The pool to use for distributing the load over several servers
    static $spool = 0;
    private $charttype = 'p3';
    protected $width;
    protected $height;
    /**
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:charting.php

示例9: foreach

    {
        if (count(self::$_hints) > 0) {
            echo '<style type="text/css">';
            echo '#lepton-debug-el { position:absolute; z-index:9999999; left:50px; width:650px; top:50px; height:300px; background-color:#FFFFFF; background:rgba(255,255,255,0.7); padding:5px; border:solid 2px #C0C0C0; -moz-box-shadow:5px 5px 25px #000; }';
            echo '#lepton-debug-el hr { height:1px; color:#C0C0C0; background-color:#C0C0C0; border:solid 1px transparent; padding:0px; margin:10px 0px 10px 0px; }';
            echo '#lepton-debug-el h1 { margin:0px 0px 2px 0px; padding:0px; font:bold 12pt sans-serif; color:#404040; }';
            echo '#lepton-debug-el h2 { margin:2px 0px 2px 0px; padding:0px; font:bold 9pt sans-serif; color:#404040; }';
            echo '#lepton-debug-el p { margin:2px 0px 2px 0px; padding:0px; font:8pt sans-serif; color:#404040; }';
            echo '#lepton-debug-el p.id { margin:2px 0px 4px 0px; padding:0px; font:6pt sans-serif; color:#404040; }';
            echo '#lepton-debug-el pre { overflow-x:scroll; overflow-y:scroll; font-size:8pt; padding:5px; background-color:#F8F8F8; border:inset 1px #F0F0F0; }';
            echo '#lepton-debug-el a { color:#A06060; text-decoration:underline; font: 8pt sans-serif; text-decoration:none; }';
            echo '#lepton-debug-el a:hover { text-decoration:underline; }';
            echo '#lepton-debug-el input[type=button] { font:8pt sans-serif; color:#606060; }';
            echo '#lepton-debug-el input[type=submit] { font:8pt sans-serif; color:#202020; }';
            echo '</style>';
            echo '<div id="lepton-debug-el" style="overflow-y:hidden;">';
            echo '<h1>Optimization report</h1><hr>';
            foreach (self::$_hints as $hint) {
                echo sprintf('<div style="float:left;"><img src="%s"></div>', array_key_exists($hint['icon'], self::$_icons) ? self::$_icons[$hint['icon']] : $hint['icon']);
                echo '<h2>' . $hint['title'] . '</h2>';
                echo '<p class="id">' . $hint['modulecode'] . '</p>';
                echo $hint['description'];
                echo '<hr>';
            }
            echo '</div>';
        }
    }
}
define('RTOPT', true);
config::def(RuntimeOptimization::KEY_DBQUERYTIME, 1.0);
开发者ID:noccy80,项目名称:lepton-ng,代码行数:30,代码来源:rtoptimization.php

示例10: array

<?php

config::def('cache.memcached.servers', array('127.0.0.1:11211'));
using('lepton.utils.datetime');
class CacheException extends Exception
{
    const ERR_KEY_NOT_FOUND = 16;
}
// if (!class_exists('memcached')) throw new FunctionNotSupportedException("No Memcached support");
/**
 * @class Cache
 * @brief Cache implementation based on memcached.
 * 
 * 
 * 
 * @todo Make abstract to allow to work 
 * @author Christopher Vagnetoft <noccy.com>
 */
class Cache
{
    private static $initialized = false;
    private static $mci = null;
    /**
     * @brief Initialize the cache subsystem.
     * 
     * 
     */
    private static function initialize()
    {
        if (self::$initialized) {
            return;
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:cache.php


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