本文整理汇总了PHP中Method::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Method::create方法的具体用法?PHP Method::create怎么用?PHP Method::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createFromReflection
/**
* @param ReflectionClass $reflection
*/
protected function _createFromReflection($reflection)
{
$this->_className = $reflection->getName();
$this->_endLine = $reflection->getEndLine();
$this->_filePath = $reflection->getFileName();
foreach ($reflection->getMethods() as $method) {
//Method::create($this, $method);
$this->addMethod(Method::create($this, $method));
}
}
示例2: dispatch_array
/**
* Dispatch a method, whether a filter or function
* @param Callable|string $method The method to call
* @param array $args An array of arguments to be passed to the method
* @return bool|mixed The return value from the dispatched method
*/
public static function dispatch_array($method, $args = array())
{
if (is_callable($method)) {
return call_user_func_array($method, $args);
} elseif (is_string($method)) {
array_unshift($args, $method, false);
return call_user_func_array(Method::create('\\Habari\\Plugins', 'filter'), $args);
}
return false;
}
示例3: init
/**
* Initialize the session handlers
*/
public static function init()
{
// the default path for the session cookie is /, but let's make that potentially more restrictive so no one steals our cookehs
// we also can't use 'null' when we set a secure-only value, because that doesn't mean the same as the default like it should
$path = Site::get_path('base', true);
// the default is not to require a secure session
$secure = false;
// if we want to always require secure
if (Config::get('force_secure_session') == true) {
$secure = true;
}
// if this is an HTTPS connection by default we will
// IIS sets HTTPS == 'off', so we have to check the value too
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
$secure = true;
}
// but if we have explicitly disabled it, don't
// note the ===. not setting it (ie: null) should not be the same as setting it to false
if (Config::get('force_secure_session') === false) {
$secure = false;
}
// now we've got a path and secure, so set the cookie values
session_set_cookie_params(null, $path, null, $secure);
// figure out the session lifetime and let plugins change it
$lifetime = ini_get('session.gc_maxlifetime');
self::$lifetime = Plugins::filter('session_lifetime', $lifetime);
//$_SESSION = new SessionStorage();
if (isset($_COOKIE[self::HABARI_SESSION_COOKIE_NAME])) {
self::$session_id = $_COOKIE[self::HABARI_SESSION_COOKIE_NAME];
self::read();
self::$stored_session_hash = self::session_data_hash();
}
// make sure we check whether or not we should write the session after the page is rendered
register_shutdown_function(Method::create('\\Habari\\Session', 'shutdown'));
// process the write queue
register_shutdown_function(Method::create('\\Habari\\Session', 'process_queue'));
return true;
}
示例4: __call
/**
* Handle methods called on this class or its descendants that are not defined by this class.
* Allow plugins to provide additional theme actions, like a custom act_display_*()
*
* @param string $function The method that was called.
* @param array $params An array of parameters passed to the method
**/
public function __call($function, $params)
{
if (strpos($function, 'act_') === 0) {
// The first parameter is an array, get it
if (count($params) > 0) {
list($user_filters) = $params;
} else {
$user_filters = array();
}
$action = substr($function, 4);
Plugins::act('theme_action', $action, $this, $user_filters);
} else {
$purposed = 'output';
if (preg_match('/^(.*)_(return|end|out)$/', $function, $matches)) {
$purposed = $matches[2];
$function = $matches[1];
}
array_unshift($params, $function, $this);
$result = call_user_func_array(Method::create('\\Habari\\Plugins', 'theme'), $params);
switch ($purposed) {
case 'return':
return $result;
case 'end':
return end($result);
case 'out':
$output = implode('', (array) $result);
echo $output;
return $output;
default:
$output = implode('', (array) $result);
return $output;
}
}
}
示例5: array
',
ajaxConfigModule: '<?php
echo URL::get('admin_ajax', array('context' => 'dashboard'));
?>
'
}
};
// An almost "catch all" for those old browsers that don't support the X-Frame-Options header. We don't bust out, we just don't show any content
if ( top != self ) {
self.location.replace( 'about:blank' );
}
</script>
<?php
Plugins::act('admin_header', $this);
Stack::out('admin_header_javascript', Method::create('\\Habari\\Stack', 'scripts'));
Stack::out('admin_stylesheet', Method::create('\\Habari\\Stack', 'styles'));
?>
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<?php
Site::out_url('admin_theme');
?>
/css/ie.css" media="screen">
<![endif]-->
<?php
Plugins::act('admin_header_after', $this);
?>
</head>
<body class="page-<?php
echo $page;
示例6: __call
/**
* Handle calls to this Tag object that are implemented by plugins
* @param string $name The name of the function called
* @param array $args Arguments passed to the function call
* @return mixed The value returned from any plugin filters, null if no value is returned
*/
public function __call($name, $args)
{
array_unshift($args, 'tag_call_' . $name, null, $this);
return call_user_func_array(Method::create('\\Habari\\Plugins', 'filter'), $args);
}
示例7: upgrade_db_post_5111
public function upgrade_db_post_5111()
{
// add the cronjob to perform garbage collection on sessions
CronTab::add_hourly_cron('session_gc', Method::create('\\Habari\\Session', 'gc'), _t('Perform session garbage collection.'));
}
示例8:
?>
</a></span>
<?php
}
?>
</p>
</div>
<?php
Plugins::act('admin_footer', $this);
Stack::out('admin_footer_javascript', Method::create('\\Habari\\Stack', 'scripts'));
include 'db_profiling.php';
?>
<?php
if (Session::has_messages()) {
?>
<script type="text/javascript">
jQuery(document).ready(function() {
<?php
Session::messages_out(true, Method::create('\\Habari\\Format', 'humane_messages'));
?>
})
</script>
<?php
}
?>
</body>
</html>
<?php
示例9: InstallHandler
$installer = new InstallHandler();
$installer->upgrade_db();
}
// If we're doing unit testing, stop here
if (defined('UNIT_TEST')) {
return;
}
// if this is an asyncronous call, ignore abort.
if (isset($_GET['asyncronous']) && Utils::crypt(Options::get('GUID'), $_GET['asyncronous'])) {
ignore_user_abort(true);
}
// Send the Content-Type HTTP header.
// @todo Find a better place to put this.
header('Content-Type: text/html;charset=utf-8');
// Load and upgrade all the active plugins.
spl_autoload_register(Method::create('\\Habari\\Plugins', '_autoload'));
Plugins::load_active();
// All plugins loaded, tell the plugins.
Plugins::act('plugins_loaded');
// Start the session.
Session::init();
// Set the locale from the user info else config, database, then default english locale
if (User::identify()->loggedin && User::identify()->info->locale_lang) {
Locale::set(User::identify()->info->locale_lang);
} else {
Locale::set(Config::get('locale', Options::get('locale', 'en-us')));
}
if (Options::get('system_locale')) {
Locale::set_system_locale(Options::get('system_locale'));
}
// Replace the $_COOKIE superglobal with an object representation
示例10: array_or
/**
* Does a bitwise OR of all the numbers in an array
* @param array $input An array of integers
* @return int The bitwise OR of the input array
*/
public static function array_or($input)
{
return array_reduce($input, Method::create('\\Habari\\Utils', 'ror'), 0);
}
示例11:
<![endif]-->
<?php
Plugins::act('admin_header_after', $this);
?>
</head>
<body class="page-<?php
echo $page;
?>
modal">
<div id="spinner"></div>
<div id="page">
<?php
echo $content;
?>
<?php
Plugins::act('admin_footer', $this);
Stack::out('admin_footer_javascript', Method::create('\\Habari\\Stack', 'scripts'));
?>
</div>
</body>
</html>
<?php
示例12: get_plugin_classes
public static function get_plugin_classes()
{
$classes = get_declared_classes();
return array_filter($classes, Method::create('\\Habari\\Plugins', 'extends_plugin'));
}
示例13: revoke
/**
* Remove permissions to one or more tokens from a user
* @param mixed a token ID, name, or array of the same
**/
public function revoke($tokens)
{
$tokens = Utils::single_array($tokens);
// get token IDs
$tokens = array_map(Method::create('\\Habari\\ACL', 'token_id'), $tokens);
foreach ($tokens as $token) {
ACL::revoke_user_token($this->id, $token);
EventLog::log(_t('User %1$s: Permission to %2$s revoked.', array($this->username, ACL::token_name($token))), 'notice', 'user', 'habari');
}
}
示例14: set_tokens
/**
* Applies a new set of specific tokens to a post
* @param mixed $tokens A string token, or an array of tokens to apply to this post
*/
public function set_tokens($tokens)
{
$tokens = Utils::single_array($tokens);
$new_tokens = array_map(Method::create('\\Habari\\ACL', 'token_id'), $tokens);
$new_tokens = array_unique($new_tokens);
DB::delete('{post_tokens}', array('post_id' => $this->id));
foreach ($new_tokens as $token_id) {
DB::insert('{post_tokens}', array('post_id' => $this->id, 'token_id' => $token_id));
}
$this->tokens = $new_tokens;
}
示例15: check_plugins
/**
* Compare the current set of plugins with those we last checked for updates.
* This is run by AdminHandler on every page load to make sure we always have fresh data on the dashboard.
*/
public static function check_plugins()
{
// register the beacons
self::register_beacons();
// get the list we checked last time
$checked_list = Options::get('updates_beacons');
// if the lists are different
if ($checked_list != self::instance()->beacons) {
// remove any stored updates, just to avoid showing stale data
Options::delete('updates_available');
// schedule an update check the next time cron runs
CronTab::add_single_cron('update_check_single', Method::create('\\Habari\\Update', 'cron'), DateTime::create()->int, _t('Perform a single check for plugin updates, the plugin set has changed.'));
}
}