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


PHP ModuleManager::load方法代码示例

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


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

示例1: module

function module($strinfo, $vars = null)
{
    if (count(ModuleManager::$_order) > 0) {
        $mod = ModuleManager::$_order[count(ModuleManager::$_order) - 1];
        ModuleManager::$_modules[$mod]['modinfo'] = $strinfo;
        if ($vars != null) {
            foreach ($vars as $key => $var) {
                ModuleManager::$_modules[$mod][$key] = $var;
            }
            // Load dependencies
            if (isset($vars['depends']) && is_array($vars['depends'])) {
                $deps = (array) $vars['depends'];
                foreach ($vars['depends'] as $dep) {
                    ModuleManager::load($dep);
                }
            }
        }
    } else {
        Console::warn("Module reported modinfo '%s' without being requested?", $string);
    }
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:21,代码来源:utils.php

示例2:

<?php

ModuleManager::load('lepton.graphics.filter');
/**
 * WatermarkImageFilter applies a watermark on top of an image. The
 * watermark could (should?) be a transparent PNG image. The x and y values
 * passed to the constructor allows for positioning around the image edge.
 * If a positive number is used, this is seen as relative to the left or
 * top edge of the image. If a negative number is used, it is instead seen
 * as relative to the right or bottom edge of the image.
 *
 * @author Christopher Vagnetoft <noccy@chillat.net>
 */
class WatermarkImageFilter extends ImageFilter
{
    const POS_RELATIVE = 0;
    const POS_ABSOLUTE = 1;
    const POS_CENTERED = 2;
    private $hwatermark;
    private $placement;
    private $width;
    private $height;
    private $x;
    private $y;
    /**
     * @param int $x The X offset (positive values from left, negative from right)
     * @param int $y The Y offset (positive valeus from top, negative from bottom)
     * @param string $watermark The watermark image to apply
     * @param int $placement The placement method to use
     */
    function __construct($x, $y, $watermark, $placement = WatermarkImageFilter::POS_RELATIVE)
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:watermark.php

示例3: array

<?php

ModuleManager::load('lepton.mvc.forms');
class FormController extends Controller
{
    var $gbform = array('name' => 'required', 'email' => 'validate email required', 'website' => 'validate website optional', 'message' => 'required');
    function savepost()
    {
        $post = new WebForm($this->gbform);
        if (!$post->isValid()) {
            // Form is invalid, post it back to the user to allow correction
        } else {
            $db = new DatabaseConnection();
            $db->insertRow("INSERT INTO guestbook (name,email,website,message) VALUES (%s,%s,%s,%s)", $post->name, $post->email, $post->website, $post->message);
        }
    }
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:17,代码来源:formcontroller.php

示例4: index

<?php

ModuleManager::load('lepton.google.charting');
//
//  This is an example controller. You can modify this file as you see
//  fit. For more information, see the documentation.
//
class DefaultController extends Controller
{
    function index()
    {
        View::load('default/index.php');
    }
    function smarty()
    {
        View::load('index.tpl');
    }
    function chart()
    {
        $ds = new DataSet(null);
        $c = new GChart($ds, 300, 200);
        $c->render();
    }
    function upload()
    {
        if (request::isPost()) {
            $file = request::post('userfile');
            printf('<p>%s</p>', $file);
            $dest = APP_PATH . 'cache/image.jpg';
            printf('<p>%s</p>', $dest);
            if ($file->save($dest)) {
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:default.php

示例5: load

 /**
  *
  */
 static function load($module, $optional = false)
 {
     // Check if the path is globbed
     if (strpos($module, '*') == strlen($module) - 1) {
         $path = self::_mangleModulePath($module);
         Console::debugEx(LOG_EXTENDED, __CLASS__, "Looking for modules matching %s from %s", $module, $path);
         $f = glob($path);
         sort($f);
         $failed = false;
         foreach ($f as $file) {
             if (!ModuleManager::load(str_replace('*', basename($file, '.php'), $module))) {
                 $failed = true;
             }
         }
         return !$failed;
     }
     // Check if the module is already loaded
     if (ModuleManager::has($module)) {
         logger::debug("Already loaded %s.", $module);
         return true;
     }
     // Otherwise mangle the path
     $path = self::_mangleModulePath($module);
     /*
      if (file_exists(APP_PATH.$modpath)) {
      $path = APP_PATH.$modpath;
      } elseif (file_exists(SYS_PATH.$modpath)) {
      $path = SYS_PATH.$modpath;
      } else {
      $path = null;
      }
     */
     if ($path) {
         if (file_exists(basename($path, '.php') . '.class.php')) {
             $path = basename($path, '.php') . '.class.php';
         }
         if (file_exists($path)) {
             self::$_lastmodule = $module;
             Console::debugEx(LOG_BASIC, __CLASS__, "Loading %s (%s).", $module, str_replace(BASE_PATH, '', $path));
             try {
                 ModuleManager::$_modules[strtolower($module)] = array();
                 ModuleManager::$_order[] = strtolower($module);
                 // Console::debugEx(LOG_DEBUG2,__CLASS__,"  path = %s", $path);
                 require $path;
                 array_pop(ModuleManager::$_order);
             } catch (ModuleException $e) {
                 Console::debugEx(LOG_BASIC, __CLASS__, "Exception loading %s!", $module);
                 throw $e;
                 return false;
             }
             return true;
         } else {
             throw new ModuleException("Could not load module " . $module . ": Path not found");
             return false;
         }
     } else {
         Console::debugEx(LOG_BASIC, __CLASS__, "Failed to load %s.", $module);
         return false;
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:63,代码来源:base.php

示例6:

<?php

ModuleManager::load('lepton.net.sockets');
class HttpConnection
{
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:6,代码来源:http.php

示例7: package

 function package($op = null, $pkgname = null)
 {
     ModuleManager::load('lepton.utils.l2package');
     switch ($op) {
         case 'install':
             $pm = new L2PackageManager();
             $pkg = new L2Package($pkgname);
             $pm->installPackage($pkg);
             break;
         case 'remove':
             $pm = new L2PackageManager();
             $pkg = new L2Package($pkgname);
             $pm->removePackage($pkg);
             break;
         case 'list':
             $pm = new L2PackageManager();
             $pm->listPackages();
             break;
         default:
             Console::writeLn(__astr("\\b{Package}: Manage packages (l2p)"));
             Console::writeLn(__astr("    package \\b{install} \\u{package.l2p}        Installs a package"));
             Console::writeLn(__astr("    package \\b{remove} \\u{package}             Removes a package"));
             Console::writeLn(__astr("    package \\b{list} [\\u{package}]             List packages"));
             Console::writeLn(__astr("    package \\b{info} [\\u{package}]             Show information on packages"));
             Console::writeLn(__astr("    package \\b{find} [\\u{filename}]            Find package that owns file"));
             Console::writeLn(__astr("    package \\b{update} [\\u{package}|\\b{all}]       List packages"));
             Console::writeLn();
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:29,代码来源:baseactions.php

示例8:

<?php

ModuleManager::load('lepton.ui.curses.widget');
/**
 *
 *
 */
class CursesDialog extends CursesContainer
{
    private $_x, $_y, $_w, $_h;
    private $_title;
    private $_text;
    private $_wh;
    /**
     *
     */
    function __construct($x, $y, $w, $h, $title, $text)
    {
        $this->_x = $x;
        $this->_y = $y;
        $this->_w = $w;
        $this->_h = $h;
        $this->_title = $title;
        $this->_text = $text;
        $this->_wh = ncurses_newwin($this->_h, $this->_w, $this->_y, $this->_x);
        Console::debug("Created window with handle %xd", $this->_wh);
    }
    function __destruct()
    {
        Console::debug("Deleting window with handle %xd", $this->_wh);
        ncurses_delwin($this->_wh);
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:dialog.php

示例9: __construct

<?php

ModuleManager::load('lepton.fs.fs');
class FsContainer
{
    protected $_contents = array();
    public $_size = null;
    public function __construct($paths = null)
    {
        if (is_array($paths)) {
            foreach ($paths as $path) {
                $this->add($path);
            }
        }
    }
    public function recalculateSize()
    {
        $this->_size = 0;
        foreach ($this->_contents as $p) {
            $o = FsObject::get($p);
            $this->_size += $o->getSize();
        }
        return $this->_size;
    }
    public function add($path)
    {
        if (FsObject::exists($path)) {
            $this->_contents[] = $path;
        }
        if ($this->_size == null) {
            $this->_size = 0;
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:fsquota.php

示例10: define

<?php

define('NCC_FRAME', 1);
define('NCC_TEXT', 2);
define('NCC_TITLE', 3);
define('NCC_MORE', 4);
ModuleManager::load('lepton.ui.curses.*');
/**
 *
 *
 */
abstract class CursesApplication extends ConsoleApplication
{
    protected $workspace;
    protected $children;
    protected $topmost;
    /**
     *
     */
    function __construct()
    {
        ncurses_init();
        if (ncurses_has_colors()) {
            ncurses_start_color();
            ncurses_init_pair(NCC_FRAME, NCURSES_COLOR_BLACK, NCURSES_COLOR_BLUE);
            ncurses_init_pair(NCC_TEXT, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
            ncurses_init_pair(NCC_TITLE, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE);
            ncurses_init_pair(NCC_MORE, NCURSES_COLOR_WHITE, NCURSES_COLOR_BLUE);
            ncurses_curs_set(0);
        }
        $this->workspace = ncurses_newwin(0, 0, 0, 0);
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:application.php

示例11:

<?php

ModuleManager::checkExtension('ncurses', true);
ModuleManager::load('lepton.ui.curses.application');
开发者ID:noccy80,项目名称:lepton-ng,代码行数:4,代码来源:curses.php

示例12: routeRequest

<?php

ModuleManager::load('lepton.mvc.router');
ModuleManager::load('lepton.mvc.controller');
class DefaultRouter extends Router
{
    function routeRequest()
    {
        $controller = $this->getSegment(0);
        $method = $this->getSegment(1);
        $arguments = $this->getSegmentSlice(2);
        Controller::invoke($controller, $method, $arguments);
    }
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:14,代码来源:defaultrouter.php

示例13: switch

<?php

/**
 * Lepton Smarty-based Blog Controller
 *
 * Renders your blogs in full color with the use of Smarty templates!
 */
ModuleManager::load('lepton.cms.*');
ModuleManager::load('lepton.mvc.viewhandler.smarty');
class BlogController extends Controller
{
    /**
     *
     */
    function __request($method = null, $args = null)
    {
        switch ($method) {
            case 'tag':
                call_user_func_array(array($this, 'showtag'), $args);
                break;
            case 'category':
                call_user_func_array(array($this, 'category'), $args);
                break;
            case 'video':
                call_user_func_array(array($this, 'video'), $args);
                break;
            case 'image':
                call_user_func_array(array($this, 'image'), $args);
                break;
            case 'post':
                call_user_func_array(array($this, 'posts'), $args);
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:blog.php

示例14: module

<?php

module("SOAP Web Service Query Library");
ModuleManager::load('lepton.web.serviceconsumer');
class SoapServiceConsumer extends ServiceConsumer
{
    const XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
    const _NULL_ = "xxx_replacedduetobrokephpsoapclient_xxx";
    protected $mustParseNulls = false;
    protected $serviceurl;
    protected $headers = array();
    public function __construct($serviceurl, $username = null, $password = null)
    {
        $this->serviceurl = $serviceurl;
        $this->client = new SoapClient($this->serviceurl);
        if ($username && $password) {
            // Prepare SoapHeader parameters
            $auth = array('Username' => $username, 'Password' => $password);
            $this->headers[] = new SoapHeader($this->serviceurl, 'UserCredentials', $auth);
            $this->client->__setSoapHeaders($this->headers);
        }
    }
    public function addHeader($name, $value)
    {
        $this->headers[] = new SoapHeader($this->serviceurl, $name, $value);
        $this->client->__setSoapHeaders($this->headers);
    }
    public function __destruct()
    {
        unset($soapClient);
    }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:soap.php

示例15:

<?php

/**
 * @file index.php
 *
 * Lepton/NG: MVC Application Entrypoint
 *
 * Part of Lepton/NG - (c) 2010, Noccy Labs
 * Distributed under the GNU GPL v3
 *
 * NOTE:
 * You probably don't have to change anything in here. Just make sure your
 * configuration is correct (located in your app/config directory)
 *
 * @license GPL v2
 * @author Christopher Vagnetoft <noccy@chillat.net>
 */
// Load configuration and the base system.
require 'sys/base.php';
// debug::enable();
// Initialize an MVC application to handle the request for us
ModuleManager::load('lepton.base.mvc');
Lepton::run('MvcApplication', 'app');
开发者ID:noccy80,项目名称:lepton-ng,代码行数:23,代码来源:index.php


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