當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Am_Controller類代碼示例

本文整理匯總了PHP中Am_Controller的典型用法代碼示例。如果您正苦於以下問題:PHP Am_Controller類的具體用法?PHP Am_Controller怎麽用?PHP Am_Controller使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Am_Controller類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process

 public function process(Am_Controller $action = null)
 {
     $action->view->url = $this->getURL();
     $action->view->vars = $this->getVars();
     $action->render('payment', '', true);
     throw new Am_Exception_Redirect($this->getURL());
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:7,代碼來源:Form.php

示例2: process

 public function process(Am_Controller $action = null)
 {
     $action->view->addBasePath($this->_path);
     $action->view->assign($this->getVars());
     $action->renderScript($this->_template);
     throw new Am_Exception_Redirect();
 }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:7,代碼來源:netdebits.php

示例3: process

 public function process(Am_Controller $controller = null)
 {
     if ($controller === null) {
         Am_Controller::redirectLocation($this->getUrl());
     } else {
         $controller->redirectLocation($this->getUrl());
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:8,代碼來源:Redirect.php

示例4: _initSetupForm

 protected function _initSetupForm(Am_Form_Setup $form)
 {
     $url = 'https://auth.aweber.com/1.0/oauth/authorize_app/' . self::APP_ID;
     $el = $form->addTextarea('auth', array('cols' => 80, 'rows' => 4))->setLabel("aWeber App Authorization Code\n" . "get it on <a target='_blank' href='{$url}'>aWeber Website</a>");
     $el->addRule('regex', 'Invalid value', '/^[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|[a-zA-Z0-9]+\\|\\s*$/');
     if ($this->getConfig('auth') && !$this->getConfig('access.access_token')) {
         if (!empty($_GET['oauth_token'])) {
             $api = $this->getApi();
             $api->user->tokenSecret = $_COOKIE['requestTokenSecret'];
             $api->user->requestToken = $_GET['oauth_token'];
             $api->user->verifier = $_GET['oauth_verifier'];
             list($accessToken, $accessTokenSecret) = $api->getAccessToken();
             $this->getDi()->config->saveValue('newsletter.aweber.access', array('access_token' => $accessToken, 'access_secret' => $accessTokenSecret));
             Am_Controller::redirectLocation(REL_ROOT_URL . "/admin-setup/aweber");
             return;
         } else {
             $api = $this->getApi();
             $callbackUrl = Am_Controller::getFullUrl();
             try {
                 list($requestToken, $requestTokenSecret) = $api->getRequestToken($callbackUrl);
                 Am_Controller::setCookie('requestTokenSecret', $requestTokenSecret);
                 $form->addStatic()->setLabel('Access Tokens')->setContent(sprintf('Access tokens are empty or expired, %sclick this link%s to update', '<a href="' . Am_Controller::escape($api->getAuthorizeUrl()) . '">', '</a>'));
             } catch (Exception $e) {
                 $this->getDi()->errorLogTable->logException($e);
                 $form->addStatic()->setLabel('Access Tokens')->setContent('Plugin configuration error. Got an error from API: ' . $e->getMessage());
             }
         }
     }
     $fields = $this->getDi()->userTable->getFields(true);
     unset($fields['email']);
     unset($fields['name_f']);
     unset($fields['name_l']);
     $ff = $form->addMagicSelect('fields')->setLabel("Pass additional fields to AWeber\nfields must be configured in AWeber with exactly same titles\nelse API calls will fail and users will not be added\n\nBy default the plugin passes \"email\" and \"name\"\nfields to Aweber, so usually you do not need to select \nthat fields to send as additional fields.\n");
     $ff->loadOptions(array_combine($fields, $fields));
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:35,代碼來源:aweber.php

示例5: infoTabEcheckAction

 function infoTabEcheckAction()
 {
     require_once APPLICATION_PATH . '/default/controllers/AdminUsersController.php';
     $this->setActiveMenu('users-browse');
     $user_id = $this->_request->getInt('user_id');
     if (!$user_id) {
         throw Am_Exception_InputError("Empty [user_id] passsed");
     }
     $echeck = $this->getDi()->echeckRecordTable->findFirstByUserId($user_id);
     $this->view->echeck = $echeck;
     $this->view->addUrl = $this->getUrl(null, null, null, 'user_id', $this->getInt('user_id'), array('add' => 1));
     if ($echeck || $this->_request->getInt('add') || $this->_request->get('_save_')) {
         $form = $this->createEcheckAdminForm((bool) $echeck);
         if ($form) {
             if ($form->isSubmitted() && $form->validate()) {
                 if (!$echeck) {
                     $echeck = $this->getDi()->echeckRecordTable->createRecord();
                 }
                 $form->toEcheckRecord($echeck);
                 $echeck->user_id = $user_id;
                 $echeck->save();
                 Am_Controller::redirectLocation($this->_request->getRequestUri());
             } elseif ($echeck) {
                 $arr = $echeck->toArray();
                 unset($arr['echeck_ban']);
                 $form->addDataSource(new HTML_QuickForm2_DataSource_Array($arr));
             }
             $this->view->form = $form;
             $this->view->form->setAction($this->_request->getRequestUri());
         }
     }
     $this->view->display('admin/echeck/info-tab.phtml');
     // ????
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:34,代碼來源:AdminController.php

示例6: folderAction

 function folderAction()
 {
     $id = $this->_request->getInt('id');
     if (!$id) {
         throw new Am_Exception_InputError("Empty folder#");
     }
     $folder = $this->getDi()->folderTable->load($id);
     if (empty($folder)) {
         throw new Am_Exception_InputError("Folder not found");
     }
     // Check if login cookie exists. If not, user is not logged in and should be redirected to login page.
     $pl = $this->getDi()->plugins_protect->loadGet('new-rewrite');
     // User will be there only if file related to folder doesn't exists.
     // So if main file exists, this means that user is logged in but don't have an access.
     // If main file doesn't exists, redirect user to new-rewrite in order to recreate it.
     // Main file will be created even if user is not active.
     if (is_file($pl->getFilePath($pl->getEscapedCookie()))) {
         $this->view->accessObjectTitle = ___("Folder %s (%s)", $folder->title, $folder->url);
         $this->view->orderUrl = REL_ROOT_URL . '/signup';
         $this->view->display('no-access.phtml');
     } else {
         $url = sprintf("%s/protect/new-rewrite?f=%d&url=%s", REL_ROOT_URL, $id, $this->_request->getParam('url', $folder->getUrl()));
         Am_Controller::redirectLocation($url);
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:25,代碼來源:NoAccessController.php

示例7: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $req = new Am_HttpRequest(sprintf('https://gateway-japa.americanexpress.com/api/rest/version/23/merchant/%s/session', $this->getConfig('merchant')), Am_HttpRequest::METHOD_POST);
     $req->setAuth('merchant.' . $this->getConfig('merchant'), $this->getConfig('password'));
     $req->setBody(Am_Controller::getJson(array('apiOperation' => 'CREATE_PAYMENT_PAGE_SESSION', 'order' => array('id' => $invoice->public_id, 'amount' => $invoice->first_total, 'currency' => $invoice->currency), 'paymentPage' => array('cancelUrl' => $this->getCancelUrl(), 'returnUrl' => $this->getPluginUrl('thanks')))));
     $this->logRequest($req);
     $res = $req->send();
     $this->logResponse($res);
     if ($res->getStatus() != 201) {
         $result->setFailed(sprintf('Incorrect Responce Status From Paysystem [%s]', $res->getStatus()));
         return;
     }
     $msg = Am_Controller::decodeJson($res->getBody());
     if ($msg['result'] == 'ERROR') {
         $result->setFailed($msg['error']['explanation']);
         return;
     }
     $invoice->data()->set(self::DATA_KEY, $msg['successIndicator'])->update();
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->{'merchant'} = $this->getConfig('merchant');
     $a->{'order.description'} = $invoice->getLineDescription();
     $a->{'paymentPage.merchant.name'} = $this->getDi()->config->get('site_title');
     $a->{'session.id'} = $msg['session']['id'];
     $this->logRequest($a);
     $result->setAction($a);
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:26,代碼來源:amex-hpp.php

示例8: _afterInitSetupForm

    function _afterInitSetupForm(Am_Form_Setup $form)
    {
        $url = Am_Controller::escape(REL_ROOT_URL) . '/default/admin-content/p/newsletter/index';
        $text = ___("Once the plugin configuration is finished on this page, do not forget to add\n" . "a record on %saMember CP -> Protect Content -> Newsletters%s page", '<a href="' . $url . '" target="_blank" class="link">', '</a>');
        $form->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>
CUT
);
        if ($this->canGetLists()) {
            $lists = array();
            try {
                foreach ($this->getLists() as $k => $v) {
                    $lists[$k] = $v['title'];
                }
            } catch (Exception $e) {
                //just log
                $this->getDi()->errorLogTable->logException($e);
            }
            $gr = $form->addGroup()->setLabel(___('Unsubscribe customer from selected newsletter threads'));
            $gr->addSelect('unsubscribe_after_signup')->loadOptions(array('' => ___('Please Select'), self::UNSUBSCRIBE_AFTER_ADDED => ___('After the user has been added'), self::UNSUBSCRIBE_AFTER_PAID => ___('After first payment has been completed')));
            $gr->addStatic()->setContent('<br><br>');
            $gr->addMagicSelect('unsubscribe_after_signup_lists')->loadOptions($lists);
        }
        parent::_afterInitSetupForm($form);
    }
開發者ID:grlf,項目名稱:eyedock,代碼行數:27,代碼來源:Plugin.php

示例9: getWrapper

 protected function getWrapper($obj, $grid)
 {
     $id = $this->action->getIdForRecord($obj);
     list($url, $params) = $this->divideUrlAndParams($this->action->getUrl($obj, $id));
     $start = sprintf("<span class='live-edit' id='%s' livetemplate='%s' liveurl='%s' livedata='%s' placeholder='%s'>", $grid->getId() . '_' . $this->field->getFieldName() . '-' . $grid->escape($id), $grid->escape($this->getInputTemplate()), $url, Am_Controller::getJson($params), $grid->escape($this->action->getPlaceholder()));
     $stop = '</span>';
     return array($start, $stop);
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:8,代碼來源:LiveEdit.php

示例10: getContent

 protected function getContent($obj, Am_Grid_Editable $grid)
 {
     $id = $this->action->getIdForRecord($obj);
     $val = $obj->{$this->field->getFieldName()};
     list($url, $params) = $this->divideUrlAndParams($this->action->getUrl($obj, $id));
     $content = sprintf('<input name="%s" class="live-checkbox" data-url="%s" data-id="%d" data-params="%s" data-value="%s" data-empty_value="%s" type="checkbox" %s/>', Am_Controller::escape($grid->getId() . '_' . $this->field->getFieldName() . '-' . $grid->escape($id)), Am_Controller::escape($url), $id, Am_Controller::escape(Am_Controller::getJson($params)), Am_Controller::escape($this->action->getValue()), Am_Controller::escape($this->action->getEmptyValue()), $val == $this->action->getValue() ? 'checked ' : '');
     return $content;
 }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:8,代碼來源:LiveCheckbox.php

示例11: renderInputs

 public function renderInputs()
 {
     $gridId = $this->grid->getId();
     $options = array_merge(array('' => ''), Am_Currency::getSupportedCurrencies());
     array_remove_value($options, Am_Currency::getDefault());
     $filter = $this->getParam('filter');
     return sprintf("<select name='{$gridId}_filter[currency]'>\n%s\n</select>\n", Am_Controller::renderOptions($options, @$filter['currency']));
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:8,代碼來源:AdminCurrencyExchangeController.php

示例12: process

 /**
  * This function is likely never returns
  * but anyway handle result and exceptions
  * @return Am_Paysystem_Result
  */
 function process()
 {
     Am_Di::getInstance()->hook->call(Am_Event::INVOICE_BEFORE_PAYMENT, array('invoice' => $this->invoice, 'controller' => $this->controller));
     $plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
     $this->result = new Am_Paysystem_Result();
     $plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
     if ($this->result->isSuccess() || $this->result->isFailure()) {
         if ($transaction = $this->result->getTransaction()) {
             $transaction->setInvoice($this->invoice);
             $transaction->process();
         }
     }
     if ($this->result->isSuccess()) {
         if (method_exists($this->controller, 'getForm')) {
             $this->controller->getForm()->getSessionContainer()->destroy();
         }
         $url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
         $this->callback($this->onSuccess);
         $this->controller->redirectLocation($url);
         // no return
         // Am_Exception_Redirect only for APPLICATION_ENV = 'testing'
     } elseif ($this->result->isAction()) {
         if (method_exists($this->controller, 'getForm')) {
             $this->controller->getForm()->getSessionContainer()->destroy();
         }
         $this->callback($this->onAction);
         $this->result->getAction()->process($this->controller);
         // no return
         // Am_Exception_Redirect only for APPLICATION_ENV = 'testing'
     } else {
         //  ($result->isFailure()) {
         $this->callback($this->onFailure);
     }
     return $this->result;
 }
開發者ID:irovast,項目名稱:eyedock,代碼行數:40,代碼來源:PayProcessMediator.php

示例13: process

 /**
  * This function is likely never returns
  * but anyway handle result and exceptions
  * @return Am_Paysystem_Result
  */
 function process()
 {
     $err = $this->invoice->validate();
     if ($err) {
         throw new Am_Exception_InputError($err[0]);
     }
     $this->invoice->save();
     $plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
     $this->result = new Am_Paysystem_Result();
     $plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
     if ($this->result->isSuccess() || $this->result->isFailure()) {
         if ($transaction = $this->result->getTransaction()) {
             $transaction->setInvoice($this->invoice);
             $transaction->process();
         }
     }
     if ($this->result->isSuccess()) {
         $url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
         $this->callback($this->onSuccess);
         $this->controller->redirectLocation($url, ___("Invoice processed"), ___("Invoice processed successfully"));
         // no return Am_Exception_Redirect
     } elseif ($this->result->isAction()) {
         $this->callback($this->onAction);
         $this->result->getAction()->process($this->controller);
         // no return Am_Exception_Redirect
     } else {
         //  ($result->isFailure()) {
         $this->callback($this->onFailure);
     }
     return $this->result;
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:36,代碼來源:PayProcessMediator.php

示例14: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     if ($this->getDi()->auth->getUserId()) {
         $this->_redirect('member');
     }
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:7,代碼來源:SubscribeController.php

示例15: init

 public function init()
 {
     parent::init();
     set_time_limit(0);
     ignore_user_abort(true);
     @ini_set('memory_limit', '256M');
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:7,代碼來源:CronController.php


注:本文中的Am_Controller類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。