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


PHP Pluf::loadClass方法代码示例

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


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

示例1: formField

 /**
  * Get the form field for this field.
  *
  * We put this method at the field level as it allows us to easily
  * create a new DB field and a new Form field and use them without
  * the need to modify another place where the mapping would be
  * performed.
  *
  * @param array Definition of the field.
  * @param string Form field class.
  */
 function formField($def, $form_field = 'Pluf_Form_Field_Varchar')
 {
     Pluf::loadClass('Pluf_Form_BoundField');
     // To get mb_ucfirst
     $defaults = array('required' => !$def['blank'], 'label' => mb_ucfirst($def['verbose']), 'help_text' => $def['help_text']);
     unset($def['blank'], $def['verbose'], $def['help_text']);
     if (isset($def['default'])) {
         $defaults['initial'] = $def['default'];
         unset($def['default']);
     }
     if (isset($def['choices'])) {
         $defaults['widget'] = 'Pluf_Form_Widget_SelectInput';
         if (isset($def['widget_attrs'])) {
             $def['widget_attrs']['choices'] = $def['choices'];
         } else {
             $def['widget_attrs'] = array('choices' => $def['choices']);
         }
     }
     foreach (array_keys($def) as $key) {
         if (!in_array($key, array('widget', 'label', 'required', 'multiple', 'initial', 'choices', 'widget_attrs'))) {
             unset($def[$key]);
         }
     }
     $params = array_merge($defaults, $def);
     return new $form_field($params);
 }
开发者ID:burbuja,项目名称:pluf,代码行数:37,代码来源:Field.php

示例2: testLoadClass

 public function testLoadClass()
 {
     Pluf::loadClass('Pluf_Model');
     $this->assertEquals(true, class_exists('Pluf_Model'));
 }
开发者ID:burbuja,项目名称:pluf,代码行数:5,代码来源:PlufTest.php

示例3: __autoload

/**
 * Autoload function.
 *
 * @param string Class name.
 */
function __autoload($class_name)
{
    try {
        Pluf::loadClass($class_name);
    } catch (Exception $e) {
        if (Pluf::f('debug')) {
            print $e->getMessage();
            die;
        }
        eval("class {$class_name} { \n          function __construct() { \n            throw new Exception('Class {$class_name} not found');\n          }\n          \n          static function __callstatic(\$m, \$args) {\n            throw new Exception('Class {$class_name} not found');\n          }\n        }");
    }
}
开发者ID:burbuja,项目名称:pluf,代码行数:17,代码来源:Pluf.php

示例4: init

# Plume CMS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Plume CMS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#
# ***** END LICENSE BLOCK ***** */
Pluf::loadClass('Pluf_Model');
class TestModel extends Pluf_Model
{
    function init()
    {
        $this->_a['table'] = 'testmodel';
        $this->_a['model'] = 'TestModel';
        $this->_a['cols'] = array('id' => array('type' => 'Pluf_DB_Field_Sequence', 'blank' => true), 'title' => array('type' => 'Pluf_DB_Field_Varchar', 'blank' => false, 'size' => 100), 'description' => array('type' => 'Pluf_DB_Field_Text', 'blank' => true));
        $this->_a['idx'] = array('title' => array('type' => 'normal'));
        $this->_a['views'] = array('simple' => array('select' => 'testmodel_id, title, description'), '__unique__' => array('select' => 'testmodel_id'));
        parent::init();
    }
}
class TestModelRecurse extends Pluf_Model
{
    function init()
开发者ID:burbuja,项目名称:pluf,代码行数:31,代码来源:TestModels.php

示例5: getRemoteAccessUrl

 /**
  * Get the remote access url to the repository.
  *
  * This will always return the anonymous access url.
  */
 public function getRemoteAccessUrl()
 {
     $conf = $this->getConf();
     $scm = $conf->getVal('scm', 'git');
     $scms = Pluf::f('allowed_scm');
     Pluf::loadClass($scms[$scm]);
     return call_user_func(array($scms[$scm], 'getAnonymousAccessUrl'), $this);
 }
开发者ID:Br3nda,项目名称:indefero,代码行数:13,代码来源:Project.php


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