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


PHP call_user_method函数代码示例

本文整理汇总了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);
}
开发者ID:jjvein,项目名称:my_php_framework,代码行数:26,代码来源:controller.php

示例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;
 }
开发者ID:Evolix,项目名称:lilac,代码行数:34,代码来源:NagiosResourceImporter.php

示例3: get

 public function get($type)
 {
     $method = "_get_{$type}";
     if (method_exists($this, $method)) {
         return call_user_method($method, $this);
     }
 }
开发者ID:berlianaputri,项目名称:rps,代码行数:7,代码来源:Crawler.php

示例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());
 }
开发者ID:mergado,项目名称:mergado-api-client-php,代码行数:14,代码来源:ApiTest.php

示例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);
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:32,代码来源:view.pdf.php

示例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;
 }
开发者ID:Hasann,项目名称:vBulletin-Development-Environment,代码行数:39,代码来源:builder.php

示例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());
     }
 }
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:25,代码来源:edit_profile.php

示例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 {
     }
 }
开发者ID:CloudGt,项目名称:suggbox-php,代码行数:28,代码来源:Lb.php

示例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;
 }
开发者ID:Evolix,项目名称:lilac,代码行数:29,代码来源:NagiosContactGroupImporter.php

示例10: index

 public function index()
 {
     if (isset($_GET['acao'])) {
         return @call_user_method($_GET['acao'], $this);
     }
     return $this->listar();
 }
开发者ID:rtsnanner,项目名称:PHP-Scaffold,代码行数:7,代码来源:ContratoservicoController.php

示例11: process

 /**
  *
  */
 public function process()
 {
     global $a;
     if ($this->action == false) {
         return;
     }
     return call_user_method($this->action, $this);
 }
开发者ID:seekwhencer,项目名称:WebSocket-UI,代码行数:11,代码来源:actions.php

示例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']);
     }
 }
开发者ID:jhersonn20,项目名称:myportal,代码行数:8,代码来源:slideshow-gallery-pro.php

示例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;
         }
     }
 }
开发者ID:fewlines,项目名称:core,代码行数:13,代码来源:Bootstrap.php

示例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);
         }
     }
 }
开发者ID:ajspencer,项目名称:NCSSM-SG-WordPress,代码行数:13,代码来源:class.base.php

示例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);
 }
开发者ID:jjvein,项目名称:my_php_framework,代码行数:9,代码来源:twtapiuserwrapper.class.php


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