本文整理汇总了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);
}
示例2: testLoadClass
public function testLoadClass()
{
Pluf::loadClass('Pluf_Model');
$this->assertEquals(true, class_exists('Pluf_Model'));
}
示例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 }");
}
}
示例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()
示例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);
}