本文整理汇总了PHP中MainController类的典型用法代码示例。如果您正苦于以下问题:PHP MainController类的具体用法?PHP MainController怎么用?PHP MainController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Dispatch
/**
* Dispatch an event to the modules, will call the
* modules with the EventListener() function.
*
* @see http://www.nsslive.net/codon/docs/events
* @param string $eventname
* @param string $origin
* @param list $params list additional parameters after $origin
* @return boolean true by default
*/
public static function Dispatch($eventname, $origin)
{
// if there are parameters added, then call the function
// using those additional params
$params = array();
$params[0] = $eventname;
$params[1] = $origin;
$args = func_num_args();
if ($args > 2) {
for ($i = 2; $i < $args; $i++) {
$tmp = func_get_arg($i);
array_push($params, $tmp);
}
}
# Load each module and call the EventListen function
if (!self::$listeners) {
self::$listeners = array();
}
foreach (self::$listeners as $ModuleName => $Events) {
$ModuleName = strtoupper($ModuleName);
global ${$ModuleName};
# Run if no specific events specified, or if the eventname is there
if (!$Events || in_array($eventname, $Events)) {
self::$lastevent = $eventname;
MainController::Run($ModuleName, 'EventListener', $params);
if (isset(self::$stopList[$eventname]) && self::$stopList[$eventname] == true) {
unset(self::$stopList[$eventname]);
return false;
}
}
}
return true;
}
示例2: route_submit
/**
* Function: submit
* Submits a post to the blog owner.
*/
public function route_submit()
{
if (!Visitor::current()->group->can("submit_article")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to submit articles."));
}
if (!empty($_POST)) {
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
if (empty($_POST['body'])) {
Flash::notice(__("Post body can't be empty!"), redirect("/"));
}
if (!isset($_POST['draft'])) {
$_POST['draft'] = "true";
}
$_POST['body'] = "{$_POST['body']}\n\n\n{$_POST['name']}\n{$_POST['email']}\n";
$post = Feathers::$instances[$_POST['feather']]->submit();
if (!in_array(false, $post)) {
Flash::notice(__("Thank you for your submission. ", "submission"), "/");
}
}
if (Theme::current()->file_exists("forms/post/submit")) {
MainController::current()->display("forms/post/submit", array("feather" => $feather), __("Submit a Text Post"));
} else {
require "pages/submit.php";
}
}
示例3: delete_link
public function delete_link($text = null, $before = null, $after = null, $classes = "")
{
if (!$this->deletable()) {
return false;
}
fallback($text, __("Delete"));
$name = strtolower(get_class($this));
echo $before . '<a href="' . url("delete_attachment/" . $this->id, MainController::current()) . '" title="Delete" class="' . ($classes ? $classes . " " : '') . $name . '_delete_link delete_link" id="' . $name . '_delete_' . $this->id . '">' . $text . '</a>' . $after;
}
示例4: pingback_ping
public function pingback_ping($args)
{
$config = Config::current();
$linked_from = str_replace('&', '&', $args[0]);
$linked_to = str_replace('&', '&', $args[1]);
$cleaned_url = str_replace(array("http://www.", "http://"), "", $config->url);
if ($linked_to == $linked_from) {
return new IXR_ERROR(0, __("The from and to URLs cannot be the same."));
}
if (!substr_count($linked_to, $cleaned_url)) {
return new IXR_Error(0, __("There doesn't seem to be a valid link in your request."));
}
if (preg_match("/url=([^&#]+)/", $linked_to, $url)) {
$post = new Post(array("url" => $url[1]));
} else {
$post = MainController::current()->post_from_url(null, str_replace(rtrim($config->url, "/"), "/", $linked_to), true);
}
if (!$post) {
return new IXR_Error(33, __("I can't find a post from that URL."));
}
# Wait for the "from" server to publish
sleep(1);
$from = parse_url($linked_from);
if (empty($from["host"])) {
return false;
}
if (empty($from["scheme"]) or $from["scheme"] != "http") {
$linked_from = "http://" . $linked_from;
}
# Grab the page that linked here.
$content = get_remote($linked_from);
# Get the title of the page.
preg_match("/<title>([^<]+)<\\/title>/i", $content, $title);
$title = $title[1];
if (empty($title)) {
return new IXR_Error(32, __("There isn't a title on that page."));
}
$content = strip_tags($content, "<a>");
$url = preg_quote($linked_to, "/");
if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
$url = str_replace("&", "&", preg_quote($linked_to, "/"));
if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
$url = str_replace("&", "&", preg_quote($linked_to, "/"));
if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
return false;
}
}
}
$context[1] = truncate($context[1], 100, "...", true);
$excerpt = strip_tags(str_replace($context[0], $context[1], $content));
$match = preg_quote($context[1], "/");
$excerpt = preg_replace("/.*?\\s(.{0,100}{$match}.{0,100})\\s.*/s", "\\1", $excerpt);
$excerpt = "[...] " . trim(normalize($excerpt)) . " [...]";
Trigger::current()->call("pingback", $post, $linked_to, $linked_from, $title, $excerpt);
return _f("Pingback from %s to %s registered!", array($linked_from, $linked_to));
}
示例5: hoursMergeForRidesInfo
static function hoursMergeForRidesInfo($weekdayHours, $dateHours)
{
$result = array();
MainController::printArray($dateHours);
// if ($weekdayHours['hour_from'] == $dateHours['hour_from']
// && $weekdayHours['hour_to'] == $dateHours['hour_to']
// && $weekdayHours['direction_id'] == $dateHours['direction_id'])
// {
// $result[] = $weekdayHours;
// }
self::sortHours($result);
return $result;
}
示例6: __construct
public function __construct($action, $urlValues)
{
parent::__construct($action, $urlValues);
//create the model object
require "protected/models/news.php";
$this->model = new NewsModel();
}
示例7: init
function init()
{
parent::init();
#$this->view->contentItemUri = $this->Content->getItemUri(); #@deprecated since 5/7/2009 use url()!
if (empty($this->Content->ItemCountPerPage)) {
$this->Content->ItemCountPerPage = 15;
}
}
示例8: beforeAction
public function beforeAction($action)
{
parent::beforeAction($action);
if (Yii::app()->user->model->rang == 1) {
return true;
} else {
throw new CHttpException(403, "Не дорос еще");
}
}
示例9: init
public function init()
{
parent::init();
if (isset($this->_user->loggedIn)) {
$loggedIn = $this->_user->loggedIn;
$this->_project = new Project();
$this->_project->setUserData($loggedIn->uid, $this->_user->getPath(), $loggedIn->name, $loggedIn->email);
}
}
示例10: executeBefore
protected function executeBefore()
{
switch ($this->_action) {
case 'view':
$this->addTitle($this->_model->getTitle());
$this->addCSS('view_message');
break;
}
parent::executeBefore();
}
示例11: __construct
public function __construct()
{
parent::__construct();
Doo::loadClass('UserSession');
$this->usession = new UserSession();
$username = $this->usession->uget('username');
if (!$username) {
header('Location:' . DOO::conf()->SUBFOLDER . 'login');
}
$this->init();
}
示例12: UsersModel
function __construct()
{
parent::__construct();
$this->users_model = new UsersModel();
$this->fields = $this->users_model->fields;
$this->submit();
$this->delete();
$this->view();
$this->edit();
$this->add();
}
示例13: restEvents
public function restEvents()
{
parent::restEvents();
// $this->onRest('post.filter.model.find.all', function($result) {
// foreach ($result as &$res) {
// if ($res['providers']['profile_photo']!="")
// $res['providers']['profile_photo'] = Yii::app()->getBaseUrl(true) ."/images/". $res['providers']['profile_photo'];
// if ($res['users']['profile_photo']!="")
// $res['users']['profile_photo'] = Yii::app()->getBaseUrl(true) ."/images/". $res['users']['profile_photo'];
// }
// return $result;
// });
}
示例14: __construct
public function __construct($registry)
{
parent::__construct($registry);
$this->file = $this->sanitizePath(DIR_SYSTEM . '../vendor/openpay/Openpay.php');
$minTotal = $this->currency->convert(1, 'USD', $this->currency->getCode());
if (!defined('MODULE_CODE')) {
define('MODULE_CODE', 'OPENPAY');
}
if (!defined('MODULE_NAME')) {
define('MODULE_NAME', 'openpay_banks');
}
if (!defined('MIN_TOTAL')) {
define('MIN_TOTAL', $minTotal);
}
if (!defined('TRANSACTION_CREATE_CUSTOMER')) {
define('TRANSACTION_CREATE_CUSTOMER', 'Customer creation');
}
if (!defined('TRANSACTION_CREATE_CHARGE')) {
define('TRANSACTION_CREATE_CHARGE', 'Charge creation');
}
if (!defined('TRANSACTION_CAPTURE_CHARGE')) {
define('TRANSACTION_CAPTURE_CHARGE', 'Charge capture');
}
if (!defined('TRANSACTION_REFUND_CHARGE')) {
define('TRANSACTION_REFUND_CHARGE', 'Charge refund');
}
if (!defined('TRANSACTION_CREATE_PLAN')) {
define('TRANSACTION_CREATE_PLAN', 'Plan creation');
}
if (!defined('TRANSACTION_CREATE_SUBSCRIPTION')) {
define('TRANSACTION_CREATE_SUBSCRIPTION', 'Subscription creation');
}
if (!defined('TRANSACTION_CANCEL_SUBSCRIPTION')) {
define('TRANSACTION_CANCEL_SUBSCRIPTION', 'Subscription cancel');
}
if (!defined('TRANSACTION_CREATE_INVOICE')) {
define('TRANSACTION_CREATE_INVOICE', 'Create invoice');
}
if (!defined('TRANSACTION_PAID_INVOICE')) {
define('TRANSACTION_PAID_INVOICE', 'Invoice paid');
}
if (!defined('TRANSACTION_CREATE_ORDER')) {
define('TRANSACTION_CREATE_ORDER', 'Order #%d was created');
}
if (!defined('PRO_MODE')) {
define('PRO_MODE', false);
}
$this->decimalZero = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
$this->available_ps = array('pp_express', 'openpay_banks');
}
示例15: init
function init()
{
parent::init();
if (!$this->authAllowed) {
$this->_redirect('/');
die;
}
if ($this->authHTTPS) {
FrontEnd::checkHTTPS();
}
$this->_formRender = isset($this->conf->auth->formRender) ? false : true;
if (!isset($this->logoutRedirect)) {
$this->logoutRedirect = '/';
}
$this->users = new Users();
$this->view->mode = 'insert';
}