本文整理汇总了PHP中call_user_method函数的典型用法代码示例。如果您正苦于以下问题:PHP call_user_method函数的具体用法?PHP call_user_method怎么用?PHP call_user_method使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call_user_method函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controller_render
function controller_render($name, $action)
{
if (!$name) {
$name = 'default';
}
$name = strtolower($name);
$ret = preg_match('/(^[a-z][a-z]*?[a-z]$)/', $name);
if ($ret <= 0) {
return '控制器名称非法' . $ret . $name;
}
$path = _ROOT . 'controller/' . $name . '.php';
if (!file_exists($path)) {
return '控制器不存在';
}
include_once $path;
$classname = $name . 'Controller';
if (!class_exists($classname)) {
return '控制器声明不完全';
}
$o = new $classname();
if (!method_exists($o, 'render')) {
return '控制器未继承BaseController::Render';
}
define('BASE_CONTROLLER', $name);
return call_user_method('render', $o, $action);
}
示例2: import
public function import()
{
$job = $this->getEngine()->getJob();
$config = $this->getEngine()->getConfig();
$resourcesCfg = new NagiosResource();
$segment = $this->getSegment();
$values = $segment->getValues();
$fileName = $segment->getFilename();
foreach ($values as $key => $entries) {
foreach ($entries as $entry) {
$value = $entry['value'];
$lineNum = $entry['line'];
if (key_exists($key, $this->fieldMethods) && $this->fieldMethods[$key] != '') {
// Okay, let's check that the method DOES exist
if (!method_exists($resourcesCfg, $this->fieldMethods[$key])) {
$job->addError("Method " . $this->fieldMethods[$key] . " does not exist for variable: " . $key . " on line " . $lineNum . " in file " . $fileName);
if (!$config->getVar('continue_error')) {
return false;
}
} else {
call_user_method($this->fieldMethods[$key], $resourcesCfg, $value);
}
}
}
}
// If we got here, it's safe to delete the existing main config and save the new one
$oldConfig = NagiosResourcePeer::doSelectOne(new Criteria());
if ($oldConfig) {
$oldConfig->delete();
}
$resourcesCfg->save();
$job->addNotice("NagiosResourceImporter finished importing resources configuration.");
return true;
}
示例3: get
public function get($type)
{
$method = "_get_{$type}";
if (method_exists($this, $method)) {
return call_user_method($method, $this);
}
}
示例4: testApiBuildUrlBasicWithTwoMethods
/**
* @param $methodOne
* @param $methodTwo
*
* @dataProvider providerTestApiBuildUrlBasic
*
*/
public function testApiBuildUrlBasicWithTwoMethods($methodOne, $methodTwo, $expected)
{
$api = new Api();
call_user_method($methodOne, $api);
call_user_method($methodTwo, $api);
$this->assertEquals($expected, $api->get());
}
示例5: display
function display($tpl = null) {
$tpl = null;
$this->set('_layout', 'default');
$user = JFactory::getUser();
$app = JFactory::getApplication('SITE');
if ($user->guest) {
$session = JFactory::getSession();
$session->set('oseReturnUrl', base64_encode('index.php?option=com_osemsc&view=member'));
$app->redirect('index.php?option=com_osemsc&view=login');
} else {
$member = oseRegistry::call('member');
$view = $member->getInstance('PanelView');
$member->instance($user->id);
$hasMember = $member->hasOwnMsc();
if ($hasMember > 0) {
$result = $member->getMemberPanelView('Member');
if ($result['tpl'] != 'master') {
$tpl = $result['tpl'];
}
} else {
$app->redirect('index.php?option=com_osemsc&view=member', JText::_('You do not have access'));
}
}
$task = JRequest::getCmd('memberTask', null);
if (empty($task)) {
oseExit();
}
if (!method_exists($this, $task)) {
oseExit();
}
call_user_method($task, $this);
}
示例6: build
/**
* Builds a project.
* Takes filesystem data and builds a product XML file
* Also copies associated files to upload directory
*
* @param VDE_Project
*/
public function build(VDE_Project $project)
{
if (!is_dir($project->buildPath)) {
if (!mkdir($project->buildPath, 0644)) {
throw new VDE_Builder_Exception('Could not create project directory');
}
}
$this->_output .= "Building project {$project->id}\n";
$this->_project = $project;
$this->_xml = new vB_XML_Builder($this->_registry);
$this->_phrases = array();
$this->_files = array();
$this->_xml->add_group('product', array('productid' => $project->id, 'active' => $project->active));
$this->_xml->add_tag('title', $project->meta['title']);
$this->_xml->add_tag('description', $project->meta['description']);
$this->_xml->add_tag('version', $project->meta['version']);
$this->_xml->add_tag('url', $project->meta['url']);
$this->_xml->add_tag('versioncheckurl', $project->meta['versionurl']);
foreach ($this->_types as $type) {
$suffix = ucfirst($type);
$method = method_exists($project, $extended = "getExtended{$suffix}") ? $extended : "get{$suffix}";
call_user_method("_process{$suffix}", $this, call_user_method($method, $project));
}
$this->_xml->close_group();
file_put_contents($xmlPath = sprintf('%s/product-%s.xml', $project->buildPath, $project->id), $xml = "<?xml version=\"1.0\" encoding=\"{$project->encoding}\"?>\r\n\r\n" . $this->_xml->output());
$this->_output .= "Created Product XML Successfully at {$xmlPath}\n";
if ($uploadFiles = array_merge($project->files, $this->_files)) {
$this->_copyFiles($uploadFiles, $project->buildPath . '/upload');
}
$this->_output .= "Project {$project->meta[title]} Built Succesfully!\n\n";
return $this->_output;
}
示例7: callback
public function callback($type, $method = 'callback')
{
$at = AuthenticationType::getByHandle($type);
$this->view();
if (!method_exists($at->controller, $method)) {
throw new exception('Invalid method.');
}
if ($method != 'callback') {
if (!is_array($at->controller->apiMethods) || !in_array($method, $at->controller->apiMethods)) {
throw new Exception("Invalid method.");
}
}
try {
$message = call_user_method($method, $at->controller);
if (trim($message)) {
$this->set('message', $message);
}
} catch (exception $e) {
if ($e instanceof AuthenticationTypeFailureException) {
// Throw again if this is a big`n
throw $e;
}
$this->error->add($e->getMessage());
}
}
示例8: loadModule
public function loadModule($module)
{
if (!isset($_GET['module'])) {
if (isset($_GET["r"])) {
$d = explode("/", $_GET["r"]);
if (count($d) != 2) {
echo "Invalid R parameters";
exit;
} else {
if ($d[0] != "" && $d[1] != "") {
$this->default_controller = $d[0];
$this->default_view = $d[1];
}
}
}
$this->default_controller = $this->default_controller . "Controller";
$this->default_controller[0] = strtoupper($this->default_controller[0]);
require_once "app/controllers/" . $this->default_controller . ".php";
$controller = new $this->default_controller();
$method = $this->default_view . "Action";
if (method_exists($controller, $method)) {
$data = call_user_method($method, $controller);
} else {
echo "<b>" . $method . "</b> not found in " . $this->default_controller;
}
} else {
}
}
示例9: import
public function import()
{
$job = $this->getEngine()->getJob();
$config = $this->getEngine()->getConfig();
$segment = $this->getSegment();
$values = $segment->getValues();
$fileName = $segment->getFilename();
$contactgroup = new NagiosContactGroup();
foreach ($values as $key => $entries) {
foreach ($entries as $entry) {
// Skips
$value = $entry['value'];
$lineNum = $entry['line'];
// Okay, let's check that the method DOES exist
if (!method_exists($contactgroup, $this->fieldMethods[$key])) {
$job->addError("Method " . $this->fieldMethods[$key] . " does not exist for variable: " . $key . " on line " . $lineNum . " in file " . $fileName);
if (!$config->getVar('continue_error')) {
return false;
}
} else {
call_user_method($this->fieldMethods[$key], $contactgroup, $value);
}
}
}
$contactgroup->save();
$contactgroup->clearAllReferences(true);
$job->addNotice("NagiosContactGroupImporter finished importing contact group: " . $contactgroup->getName());
return true;
}
示例10: index
public function index()
{
if (isset($_GET['acao'])) {
return @call_user_method($_GET['acao'], $this);
}
return $this->listar();
}
示例11: process
/**
*
*/
public function process()
{
global $a;
if ($this->action == false) {
return;
}
return call_user_method($this->action, $this);
}
示例12: admin_notices
function admin_notices()
{
$this->check_uploaddir();
if (!empty($_GET[$this->pre . 'message'])) {
$msg_type = !empty($_GET[$this->pre . 'updated']) ? 'msg' : 'err';
call_user_method('render_' . $msg_type, $this, $_GET[$this->pre . 'message']);
}
}
示例13: autoCall
/**
* This function will call all methods
* which begins with the auto call flag
*/
public final function autoCall()
{
foreach ((new \ReflectionClass($this))->getMethods() as $method) {
if (preg_match('/^' . self::AUTO_CALL_FLAG . '(.*)$/', $method->name) && !array_key_exists($method->name, self::$called)) {
call_user_method($method->name, $this);
self::$called[$method->name] = true;
}
}
}
示例14: init
/**
* Default initialization method
* To be overriden by child classes
*/
function init()
{
$func = 'register_hooks';
if (isset($this)) {
if (method_exists($this, $func)) {
call_user_method($func, $this);
}
}
}
示例15: query
function query($method, $params)
{
$this->result();
$method = str_replace(".", "_", $method);
if (!method_exists($this, $method)) {
return $this->result(array('message' => '方法未定义'));
}
return call_user_method($method, $this, $params);
}