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


PHP Am_Controller::getJson方法代码示例

本文整理汇总了PHP中Am_Controller::getJson方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Controller::getJson方法的具体用法?PHP Am_Controller::getJson怎么用?PHP Am_Controller::getJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Am_Controller的用法示例。


在下文中一共展示了Am_Controller::getJson方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _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

示例2: 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

示例3: 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

示例4: getWrapper

 protected function getWrapper($obj, $grid)
 {
     $id = $this->action->getIdForRecord($obj);
     $val = $obj->{$this->field->getFieldName()};
     list($url, $params) = $this->divideUrlAndParams($this->action->getUrl($obj, $id));
     $start = sprintf('<span class="live-edit%s" id="%s" livetemplate="%s" liveurl="%s" livedata="%s" placeholder="%s" data-init-callback="%s">', $val ? '' : ' live-edit-placeholder', $grid->getId() . '_' . $this->field->getFieldName() . '-' . $grid->escape($id), $grid->escape($this->getInputTemplate()), $url, $grid->escape(Am_Controller::getJson($params)), $grid->escape($this->action->getPlaceholder()), $grid->escape($this->action->getInitCallback()));
     $stop = '</span>';
     return array($start, $stop);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:9,代码来源:LiveEdit.php

示例5: renderClientRules

    protected function renderClientRules(HTML_QuickForm2_JavascriptBuilder $builder)
    {
        $id = Am_Controller::escape($this->editor->getId());
        $vars = "";
        foreach ($this->tagsOptions as $k => $v) {
            $vars .= sprintf("[%s, %s],\n", Am_Controller::getJson($v), Am_Controller::getJson($k));
        }
        $vars = trim($vars, "\n\r,");
        $builder->addElementJavascript(<<<CUT
\$(function(){
    \$('select#insert-tags').change(function(){
        var val = \$(this).val();
        if (!val) return;
        \$("#txt-0").insertAtCaret(val);
        \$(this).prop("selectedIndex", -1);
    });
            
    if (CKEDITOR.instances["{$id}"]) {
        delete CKEDITOR.instances["{$id}"];
    }
    var editor = null;
    \$("input[name='format']").change(function()
    {
        if (window.configDisable_rte) return;
        if (!this.checked) return;
        if (this.value == 'html')
        {
            if (!editor) {
                editor = initCkeditor("{$id}", { placeholder_items: [
                    {$vars}
                ], entities_greek: false});
            }
            \$('#insert-tags-wrapper').hide();
        } else {
            if (editor) {
                editor.destroy();
                editor = null;
            }
            \$('#insert-tags-wrapper').show();
        }
    }).change();
});            
CUT
);
    }
开发者ID:grlf,项目名称:eyedock,代码行数:45,代码来源:MailEditor.php

示例6: addDbPrefix

    public function addDbPrefix()
    {
        $title = $this->getTitle();
        $fs = $this->addFieldset('db-prefix')->setLabel(___("%s database and tables prefix", $title));
        $group = $fs->addGroup()->setLabel("{$title} Database name and Tables Prefix");
        $group->addText("db", array('class' => 'db-prefiix'))->addRule('required', 'this field is required');
        $group->addText("prefix", array('class' => 'db-prefiix'));
        $group->addRule('callback2', '-error-', array($this, 'configCheckDbSettings'));
        try {
            $a = array();
            foreach ($this->plugin->guessDbPrefix(Am_Di::getInstance()->db) as $v) {
                list($d, $p) = explode('.', $v, 2);
                $a[] = array('label' => $v, 'value' => $d);
            }
            if ($a) {
                $guessDb = Am_Controller::getJson((array) $a);
                $this->addScript('guess_db_script')->setScript(<<<CUT
\$(function(){
    \$("input[name\$='___db']").autocomplete({
        source : {$guessDb},
        minLength: 0
    }).focus(function(){
        \$(this).autocomplete("search", "");
    }).bind( "autocompleteselect", function(event, ui) {
        var a = ui.item.label.split(".", 2);
        \$(event.target).autocomplete("close");
        \$("input[name\$='___prefix']").val(a[1]);
    });
});
CUT
);
            }
        } catch (Am_Exception $e) {
        }
    }
开发者ID:subashemphasize,项目名称:test_site,代码行数:35,代码来源:ProtectDatabased.php

示例7: run

 public function run(Zend_Controller_Response_Abstract $response = null)
 {
     $args = array($this);
     $this->runCallback(self::CB_BEFORE_RUN, $args);
     if ($response === null) {
         $response = new Zend_Controller_Response_Http();
     }
     $this->response = $response;
     $action = $this->getCurrentAction();
     $this->request->setActionName($action);
     ob_start();
     $this->actionRun($action);
     if ($this->response->isRedirect() && $this->completeRequest->isXmlHttpRequest()) {
         $url = null;
         foreach ($response->getHeaders() as $header) {
             if ($header['name'] == 'Location') {
                 $url = $header['value'];
             }
         }
         $code = $response->getHttpResponseCode();
         // change request to ajax response
         $response->clearAllHeaders();
         $response->clearBody();
         $response->setHttpResponseCode(200);
         $response->setHeader("Content-Type", "application/json; charset=UTF-8", true);
         $response->setBody(Am_Controller::getJson(array('ngrid-redirect' => $url, 'status' => $code)));
         //throw new Am_Exception_Redirect($url);
     } else {
         $response->appendBody(ob_get_clean());
     }
     unset($this->response);
     return $response;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:33,代码来源:ReadOnly.php

示例8: getFormJavascript

    public function getFormJavascript($formId = null, $addScriptTags = true)
    {
        $rules = Am_Controller::getJson($this->rules);
        $messages = Am_Controller::getJson($this->messages);
        $formSelector = Am_Controller::getJson('form#' . $formId);
        /**
         * we send special submit handler for multi page form (signup)
         * to avoide issue when clicked button do not included to request
         * (it contain info about next action for multi page action)
         * in case of valid field has remote validation and validation
         * is not finished when user click submit button.
         */
        $submitHandler = strpos($formId, 'page') === 0 ? ',submitHandler: function(form, event){form.submit();}' : '';
        $output = <<<CUT
<script type="text/javascript">
jQuery(document).ready(function(\$) {
    if (jQuery && jQuery.validator)
    {
        jQuery.validator.addMethod("regex", function(value, element, params) {
            return this.optional(element) || new RegExp(params[0],params[1]).test(value);
        }, "Invalid Value");

        jQuery({$formSelector}).validate({
            ignore: ':hidden'
            ,rules: {$rules}
            ,messages: {$messages}
            //,debug : true
            ,errorPlacement: function(error, element) {
                error.appendTo( element.parent());
            }
            {$submitHandler}
            // custom validate js code start
            //-CUSTOM VALIDATE JS CODE-//
            // custom validate js code end
        });
    }
    // custom js code start
    //-CUSTOM JS CODE-//
    // custom js code end
});
</script>
CUT;
        $output = str_replace('//-CUSTOM JS CODE-//', implode(";\n", $this->scripts), $output);
        $addValidateJs = join(",\n", $this->addValidateJs);
        if ($addValidateJs != '') {
            $output = str_replace('//-CUSTOM VALIDATE JS CODE-//', "\n," . $addValidateJs, $output);
        }
        if (!$this->rules && !$this->scripts && !$this->addValidateJs) {
            return null;
        }
        return $output;
    }
开发者ID:grlf,项目名称:eyedock,代码行数:52,代码来源:JavascriptBuilder.php

示例9: render

    public function render()
    {
        $ret = $this->getData();
        $ret['element'] = $this->divId;
        $class = $ret['class'];
        unset($ret['class']);
        $options = Am_Controller::getJson($ret);
        return <<<CUT
<div id='{$this->divId}' style='width: {$this->getWidth()}; height: {$this->getHeight()};'></div>
<script type='text/javascript'>
new {$class}({$options});
</script>
CUT;
    }
开发者ID:irovast,项目名称:eyedock,代码行数:14,代码来源:Report.php

示例10: setFields

 function setFields(array $fields)
 {
     $this->fields = Am_Controller::getJson($fields);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:4,代码来源:SavedForm.php

示例11: createForm

 function createForm()
 {
     $form = new Am_Form_Admin();
     $title = $form->addText('title', array('class' => 'el-wide'))->setLabel(___("Title\ndisplayed to customers"));
     $title->addRule('required');
     $form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
     $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
     $path = $form->addText('path')->setLabel(___('Path to Folder'))->setAttribute('size', 50)->addClass('dir-browser');
     $path->addRule('required');
     $path->addRule('callback2', '-- Wrong path --', array($this, 'validatePath'));
     $url = $form->addGroup()->setLabel(___('Folder URL'));
     $url->addRule('required');
     $url->addText('url')->setAttribute('size', 50)->setId('url');
     $url->addHtml()->setHtml(' <a href="#" id="test-url-link">' . ___('open in new window') . '</a>');
     $methods = array('new-rewrite' => ___('New Rewrite'), 'htpasswd' => ___('Traditional .htpasswd'));
     foreach ($methods as $k => $v) {
         if (!Am_Di::getInstance()->plugins_protect->isEnabled($k)) {
             unset($methods[$k]);
         }
     }
     $method = $form->addAdvRadio('method')->setLabel(___('Protection Method'));
     $method->loadOptions($methods);
     if (count($methods) == 0) {
         throw new Am_Exception_InputError(___('No protection plugins enabled, please enable new-rewrite or htpasswd at aMember CP -> Setup -> Plugins'));
     } elseif (count($methods) == 1) {
         $method->setValue(key($methods))->toggleFrozen(true);
     }
     $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'))->setAttribute('without_free_without_login', 'true');
     $form->addScript('script')->setScript('
     $(function(){
         $(".dir-browser").dirBrowser({
             urlField : "#url",
             rootUrl  : ' . Am_Controller::getJson(REL_ROOT_URL) . ',
         });
         $("#test-url-link").click(function() {
             var href = $("input", $(this).parent()).val();
             if (href)
                 window.open(href , "test-url", "");
         });
     });
     ');
     $form->addText('no_access_url', array('class' => 'el-wide'))->setLabel(___("No Access URL\ncustomer without required access will be redirected to this url\nleave empty if you want to redirect to default 'No access' page"));
     $this->addCategoryToForm($form);
     return $form;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:45,代码来源:AdminContentController.php

示例12: renderNameStandart

 protected function renderNameStandart($obj)
 {
     $data = array('name' => $obj->getName(), 'size_readable' => $obj->getSizeReadable(), 'upload_id' => $obj->pk(), 'mime' => $obj->mime, 'ok' => true);
     return sprintf('<a href="javascript:;" class="filesmanager-file" data-info="%s"><span class="upload-name">%s</span></a>', $this->escape(Am_Controller::getJson($data)), $this->escape($obj->name));
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:5,代码来源:AdminUploadController.php

示例13: renderBrick

 public function renderBrick(Am_Form_Brick $brick, $enabled)
 {
     $class = '';
     $configure = $labels = null;
     $attr = array('id' => $brick->getId(), 'class' => "brick {$class} " . $brick->getClass(), 'data-class' => $brick->getClass(), 'data-title' => strtolower($brick->getName()));
     if ($brick->haveConfigForm()) {
         $attr['data-config'] = Am_Controller::getJson($brick->getConfigArray());
         $configure = "<a class='configure local' href='javascript:;'>" . ___('configure') . "</a>";
     }
     if ($brick->getStdLabels()) {
         $attr['data-labels'] = Am_Controller::getJson($brick->getCustomLabels());
         $attr['data-stdlabels'] = Am_Controller::getJson($brick->getStdLabels());
         $class = $brick->getCustomLabels() ? 'labels custom-labels' : 'labels';
         $labels = "<a class='{$class} local' href='javascript:;'>" . ___('labels') . "</a>";
     }
     if ($brick->isMultiple()) {
         $attr['data-multiple'] = "1";
     }
     if ($brick->hideIfLoggedInPossible() == Am_Form_Brick::HIDE_DESIRED) {
         $attr['data-hide'] = $brick->hideIfLoggedIn() ? 1 : 0;
     }
     $attrString = "";
     foreach ($attr as $k => $v) {
         $attrString .= " {$k}=\"" . htmlentities($v, ENT_QUOTES, 'UTF-8', true) . "\"";
     }
     $checkbox = $this->renderHideIfLoggedInCheckbox($brick);
     return "<div {$attrString}>\n        <strong class=\"brick-title\">{$brick->getName()}</strong>\n        {$configure}\n        {$labels}\n        {$checkbox}\n        </div>";
 }
开发者ID:grlf,项目名称:eyedock,代码行数:28,代码来源:BricksEditor.php

示例14: render

    public function render(HTML_QuickForm2_Renderer $renderer)
    {
        $id = $this->getId();
        $url = REL_ROOT_URL . '/application/default/views/public/js/ckeditor/ckeditor.js';
        $renderer->getJavascriptBuilder()->addElementJavascript(<<<CUT
if (!window.CKEDITOR) {            
    var script = \$('<script type="text/javascript" src="{$url}"></' + 'script>');  
    \$('head').append(script);    
}
CUT
);
        if (!$this->dontInitMce) {
            $options = $this->mceOptions ? Am_Controller::getJson($this->mceOptions) : '{}';
            $renderer->getJavascriptBuilder()->addElementJavascript(<<<CUT
\$(function(){            
    initCkeditor('{$id}', {$options});
});
CUT
);
        }
        return parent::render($renderer);
    }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:22,代码来源:Form.php

示例15: setValue

 public function setValue($value)
 {
     $value = is_array($value) ? Am_Controller::getJson($value) : $value;
     parent::setValue($value);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:5,代码来源:sliiing.php


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