本文整理汇总了PHP中Action::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::run方法的具体用法?PHP Action::run怎么用?PHP Action::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _run
protected static function _run($action, $data)
{
try {
$value = Action::run($action, $data);
var_export($value);
echo "\n";
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
}
示例2: __construct
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
static::$current_page = static::getPage(Url::getUriString());
// Send default header
header('Content-Type: text/html; charset=' . Config::get('system.charset'));
// Run actions before page rendered
Action::run('before_page_rendered');
// Display page for current requested url
static::display(static::$current_page);
// Run actions after page rendered
Action::run('after_page_rendered');
}
示例3: __construct
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
$plugins_cache_id = '';
$plugin_manifest = [];
$plugin_settings = [];
// Get Plugins List
$plugins_list = Config::get('system.plugins');
// If Plugins List isnt empty then create plugin cache ID
if (is_array($plugins_list) && count($plugins_list) > 0) {
// Go through...
foreach ($plugins_list as $plugin) {
if (File::exists($_plugin = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
$plugins_cache_id .= filemtime($_plugin);
}
}
// Create Unique Cache ID for Plugins
$plugins_cache_id = md5('plugins' . ROOT_DIR . PLUGINS_PATH . $plugins_cache_id);
}
// Get plugins list from cache or scan plugins folder and create new plugins cache item
if (Cache::driver()->contains($plugins_cache_id)) {
Config::set('plugins', Cache::driver()->fetch($plugins_cache_id));
} else {
// If Plugins List isnt empty
if (is_array($plugins_list) && count($plugins_list) > 0) {
// Go through...
foreach ($plugins_list as $plugin) {
if (File::exists($_plugin_manifest = PLUGINS_PATH . '/' . $plugin . '/' . $plugin . '.yml')) {
$plugin_manifest = Yaml::parseFile($_plugin_manifest);
}
if (File::exists($_plugin_settings = PLUGINS_PATH . '/' . $plugin . '/settings.yml')) {
$plugin_settings = Yaml::parseFile($_plugin_settings);
}
$_plugins_config[File::name($_plugin_manifest)] = array_merge($plugin_manifest, $plugin_settings);
}
Config::set('plugins', $_plugins_config);
Cache::driver()->save($plugins_cache_id, $_plugins_config);
}
}
// Include enabled plugins
if (is_array(Config::get('plugins')) && count(Config::get('plugins')) > 0) {
foreach (Config::get('plugins') as $plugin_name => $plugin) {
if (Config::get('plugins.' . $plugin_name . '.enabled')) {
include_once PLUGINS_PATH . '/' . $plugin_name . '/' . $plugin_name . '.php';
}
}
}
// Run Actions on plugins_loaded
Action::run('plugins_loaded');
}
示例4: __construct
/**
* Constructor.
*
* @access protected
*/
protected function __construct()
{
// Get Theme Templates
static::$current_template = Template::factory(THEMES_PATH . '/' . Config::get('system.theme'));
// Get Current Page
static::$current_page = static::getPage(Url::getUriString());
// Send default header
header('Content-Type: text/html; charset=' . Config::get('system.charset'));
// Run actions before page rendered
Action::run('before_page_rendered');
// Display page for current requested url
static::display(static::$current_page);
// Run actions after page rendered
Action::run('after_page_rendered');
}
示例5: run
public function run($sAction, $aParams = array())
{
$sMethod = 'action' . $sAction;
if (method_exists($this, $sMethod)) {
$aFilters = $this->filters();
$aActionFilters = array();
if (is_array($aFilters) && count($aFilters)) {
foreach ($aFilters as $key => $actions) {
if (is_array($actions)) {
foreach ($actions as $action) {
if (strcasecmp($sAction, $action) === 0) {
$aActionFilters[] = $key;
break;
}
}
} else {
if (strcasecmp($sAction, $actions) === 0) {
$aActionFilters[] = $key;
}
}
}
if (count($aActionFilters)) {
$oFilterChain = new FilterChain();
foreach ($aActionFilters as $filter) {
$sFilterClass = $filter . 'Filter';
$oFilterChain->registerFilter(new $sFilterClass());
}
$oFilterChain->process();
}
}
$oAction = new Action($this, $sAction, $aParams);
return $oAction->run();
} else {
$this->redirect('/site/404');
}
}
示例6: __
<div class="form-group">
<?php
echo Form::label('access', __('Access', 'pages')) . Form::select('access', $access_array, $access, array('class' => 'form-control'));
?>
</div>
<?php
}
?>
</div>
</div>
<div class="row margin-bottom-1">
<div class="col-xs-12">
<?php
Action::run('admin_editor', array(Html::toText($to_edit)));
?>
</div>
</div>
<div class="row margin-top-1">
<div class="col-xs-12">
<div class="form-group">
<div class="input-group">
<?php
echo Form::input('page_tags', $tags_to_edit, array('class' => 'form-control'));
?>
<span class="input-group-addon add-on">
<?php
echo __('Tags', 'pages');
?>
示例7:
?>
$('.reset-password-btn').click(function() {
$('.reset-password-area, .administration-btn').show();
$('.administration-area, .reset-password-btn').hide();
});
$('.administration-btn').click(function() {
$('.reset-password-area, .administration-btn').hide();
$('.administration-area, .reset-password-btn').show();
});
});
</script>
<?php
Action::run('admin_header');
?>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
<![endif]-->
</head>
<body class="login-body">
<?php
// Monstra Notifications
Notification::get('success') and Alert::success(Notification::get('success'));
Notification::get('warning') and Alert::warning(Notification::get('warning'));
Notification::get('error') and Alert::error(Notification::get('error'));
示例8: mountAction
/**
*
* Método que executa uma Action
* @param Action $action Action a ser executada
*
*/
public static function mountAction($action)
{
$args = Proxy::mountForm();
if ($action) {
$access = ACL::checkProfile($action->getPermissions());
if ($access) {
try {
?>
<script language="javascript">
function load(i) {
document.getElementById("bar").style.width=i;
};
</script>
<div class='container'>
<div class='row span5 offset3'>
<div class="progress progress-striped active">
<div id='bar' class="bar" style="width: 0%;"></div>
</div>
</div>
</div>
<?php
$action->run($args);
if ($action->hasMessage()) {
SessionManager::setKey('bodymsg', $action->getMessage());
SessionManager::setKey('bodymsgtype', $action->getMessageType());
}
if ($action->hasPopup()) {
SessionManager::setKey('popup', $action->getPopup());
}
Forward::go($action->getForward());
} catch (Exception $e) {
SessionManager::setKey('bodymsg', "[ERRO] " . $e->getMessage());
SessionManager::setKey('bodymsgtype', Constants::$_MSG_ERRO);
Forward::go(Forward::$_BACK);
}
}
}
}
示例9:
Stylesheet::load();
?>
<!-- JavaScripts -->
<?php
Javascript::add('public/assets/js/jquery.min.js', 'frontend', 1);
?>
<?php
Javascript::add('public/assets/js/bootstrap.min.js', 'frontend', 2);
?>
<?php
Javascript::load();
?>
<?php
Action::run('theme_header');
?>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<![endif]-->
<!-- Fav-icons -->
<link rel="icon" href="<?php
echo Site::url();
?>
/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="<?php
echo Site::url();
?>
示例10: main
/**
* Themes plugin admin
*/
public static function main()
{
// Get current themes
$current_site_theme = Option::get('theme_site_name');
$current_admin_theme = Option::get('theme_admin_name');
// Init vars
$themes_site = Themes::getSiteThemes();
$themes_admin = Themes::getAdminThemes();
$templates = Themes::getTemplates();
$chunks = Themes::getChunks();
$styles = Themes::getStyles();
$scripts = Themes::getScripts();
$errors = array();
$chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
$template_path = THEMES_SITE . DS . $current_site_theme . DS;
$style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
$script_path = THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS;
// Save site theme
if (Request::post('save_site_theme')) {
if (Security::check(Request::post('csrf'))) {
Option::update('theme_site_name', Request::post('themes'));
// Clean Monstra TMP folder.
Monstra::cleanTmp();
// Increment Styles and Javascript version
Stylesheet::stylesVersionIncrement();
Javascript::javascriptVersionIncrement();
Request::redirect('index.php?id=themes');
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Save site theme
if (Request::post('save_admin_theme')) {
if (Security::check(Request::post('csrf'))) {
Option::update('theme_admin_name', Request::post('themes'));
// Clean Monstra TMP folder.
Monstra::cleanTmp();
Request::redirect('index.php?id=themes');
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Its mean that you can add your own actions for this plugin
Action::run('admin_themes_extra_actions');
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Add chunk
// -------------------------------------
case "add_chunk":
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') {
$errors['file_empty_name'] = __('Required field', 'themes');
}
if (file_exists($chunk_path . Security::safeName(Request::post('name'), null, false) . '.chunk.php')) {
$errors['file_exists'] = __('This chunk already exists', 'themes');
}
if (count($errors) == 0) {
// Save chunk
File::setContent($chunk_path . Security::safeName(Request::post('name'), null, false) . '.chunk.php', Request::post('content'));
Notification::set('success', __('Your changes to the chunk <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name'), null, false))));
if (Request::post('add_file_and_exit')) {
Request::redirect('index.php?id=themes');
} else {
Request::redirect('index.php?id=themes&action=edit_chunk&filename=' . Security::safeName(Request::post('name'), null, false));
}
}
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Save fields
if (Request::post('name')) {
$name = Request::post('name');
} else {
$name = '';
}
if (Request::post('content')) {
$content = Request::post('content');
} else {
$content = '';
}
// Display view
View::factory('box/themes/views/backend/add')->assign('name', $name)->assign('content', $content)->assign('errors', $errors)->assign('action', 'chunk')->display();
break;
// Add template
// -------------------------------------
// Add template
// -------------------------------------
case "add_template":
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') {
//.........这里部分代码省略.........
示例11: foreach
}
// If is admin then load admin area
if ($is_admin) {
// If id is empty then redirect to default plugin PAGES
if (Request::get('id')) {
$area = Request::get('id');
} else {
Request::redirect('index.php?id=dashboard');
}
$plugins_registered = Plugin::$plugins;
foreach ($plugins_registered as $plugin) {
$plugins_registered_areas[] = $plugin['id'];
}
// Show plugins admin area only for registered plugins
if (in_array($area, $plugins_registered_areas)) {
$plugin_admin_area = true;
} else {
$plugin_admin_area = false;
}
// Backend pre render
Action::run('admin_pre_render');
// Display admin template
require 'themes' . DS . Option::get('theme_admin_name') . DS . 'index.template.php';
// Backend post render
Action::run('admin_post_render');
} else {
// Display login template
require 'themes' . DS . Option::get('theme_admin_name') . DS . 'login.template.php';
}
// Flush (send) the output buffer and turn off output buffering
ob_end_flush();
示例12: _Excute
/**
* 执行情景模式
*
* @param params params
*/
public static function _Excute($params)
{
if (isset($params["sceneid"])) {
$sceneid = $params["sceneid"];
$db = Db::init();
$invokes = $db->get_results("select * from scene_info where sceneid={$sceneid}");
if (isset($invokes[0])) {
foreach ($invokes as $invoke) {
//var_dump($invoke);
Action::run($invoke->cmdline, $invoke->mid, $_GET["u"]);
}
}
return Error::getRetString(0);
} else {
return Error::getRetString(10007);
}
}
示例13: header
<?php
require_once __DIR__ . "/../libs/Action.php";
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
$string = file_get_contents("php://input");
//$array = json_decode($json_string, true); //解析post数据
$uuid = $_GET["u"];
//用户email
$mid = $_GET["mid"];
//房子主设备ID
$vercode = $_GET["vercode"];
//用户验证码
echo Action::run($string, $mid, $uuid);
示例14:
<footer class="container">
<div class="pull-left"><?php
echo Chunk::get('footer-links');
?>
</div>
<div class="pull-right"><?php
Action::run('theme_footer');
echo Site::powered();
?>
</div>
</footer>
<?php
echo Snippet::get('google-analytics');
?>
</body>
</html>
示例15: __
<?php
echo Form::hidden('csrf', Security::token());
?>
<div class="form-group margin-bottom-1">
<?php
echo Form::label('name', __('Name', 'blocks'));
?>
<?php
echo Form::input('name', $name, array('class' => isset($errors['blocks_empty_name']) || isset($errors['blocks_exists']) ? 'form-control error-field' : 'form-control'));
?>
<?php
if (isset($errors['blocks_empty_name'])) {
echo '<span class="error-message">' . $errors['blocks_empty_name'] . '</span>';
}
if (isset($errors['blocks_exists'])) {
echo '<span class="error-message">' . $errors['blocks_exists'] . '</span>';
}
?>
</div>
<div class="row margin-bottom-1">
<div class="col-xs-12">
<?php
Action::run('admin_editor', array(Html::toText($content)));
?>
</div>
</div>
<?php
echo Form::submit('add_blocks_and_exit', __('Save and Exit', 'blocks'), array('class' => 'btn btn-phone btn-primary')) . Html::nbsp(2) . Form::submit('add_blocks', __('Save', 'blocks'), array('class' => 'btn btn-phone btn-primary')) . Html::nbsp(2) . Html::anchor(__('Cancel', 'blocks'), 'index.php?id=blocks', array('title' => __('Cancel', 'blocks'), 'class' => 'btn btn-phone btn-default')) . Form::close();