本文整理汇总了PHP中Am_Controller::escape方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Controller::escape方法的具体用法?PHP Am_Controller::escape怎么用?PHP Am_Controller::escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Controller
的用法示例。
在下文中一共展示了Am_Controller::escape方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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);
}
示例2: _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));
}
示例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;
}
示例4: renderLink
public function renderLink(ResourceAbstract $resource)
{
$html = "";
$url = $resource->getUrl();
if (!empty($url)) {
$html = sprintf('<a href="%s" target="_blank">%s</a>', Am_Controller::escape($url), ___('link'));
}
return $this->renderTd($html, false);
}
示例5: getReadme
public function getReadme()
{
$ipn = Am_Controller::escape($this->getPluginUrl('ipn'));
return <<<CUT
You need to enable 'Direct HTTP server-to-server request' on page 'Configuration -> Technical Information -> Transaction Feedback' in your ePDQ account
and set it to
<strong>{$ipn}</strong>
CUT;
}
示例6: renderTable
function renderTable($kvRows)
{
$h = "<table class='logdetail'>\n";
foreach ($kvRows as $k => $v) {
$h .= sprintf("<tr><th>%s</th><td>%s</td></tr>\n", Am_Controller::escape($k), Am_Controller::escape($v));
}
$h .= "</table>\n";
return $h;
}
示例7: 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
);
}
示例8: initElements
function initElements()
{
$this->addElement('text', 'site_title', array('size' => 40), array('help-id' => '#Site Title'))->setLabel(___('Site Title'));
$this->addElement('static', null, null, array('help-id' => '#Root Url and License Key'))->setContent('<div><a href="' . Am_Controller::escape(REL_ROOT_URL) . '/admin-license" target="_top">' . ___('change') . '</a></div>')->setLabel(___('Root Url and License Keys'));
$this->addText('flowplayer_license')->setLabel(___("FlowPlayer License Key\nyou may get your key in %smembers area%s", '<a href="http://www.amember.com/amember/member?flowplayer_key=1">', '</a>'))->addRule('regex', ___('Value must be alphanumeric'), '/^[a-zA-Z0-9]*$/');
$this->addElement('select', 'theme', null, array('help-id' => '#User Pages Theme'))->setLabel(___('User Pages Theme'))->loadOptions(Am_View::getThemes('user'));
$this->addElement('select', 'admin_theme')->setLabel(___('Admin Pages Theme'))->loadOptions(Am_View::getThemes('admin'));
/*
if (!extension_loaded("curl")){
$el = $this->addElement('text', 'curl')
->setLabel(___('cURL executable file location', "you need it only if you are using payment processors<br />
like Authorize.Net or PayFlow Pro<br />
usually valid path is /usr/bin/curl or /usr/local/bin/curl"));
$el->default = '/usr/bin/curl';
$el->addRule('callback2', 'error', array($this, 'validateCurl'));
}
*/
$fs = $this->addElement('fieldset', '##02')->setLabel(___('Signup Form Configuration'));
// $this->addElement('advcheckbox', 'generate_login')
// ->setLabel(___('Generate Login', 'should aMember generate username for customer?'));
$this->setDefault('login_min_length', 5);
$this->setDefault('login_max_length', 16);
$loginLen = $fs->addGroup()->setLabel(___('Username length'));
$loginLen->addInteger('login_min_length')->setLabel('min');
$loginLen->addInteger('login_max_length')->setLabel('max');
$fs->addElement('advcheckbox', 'login_disallow_spaces')->setLabel(___('Do not allow spaces in username'));
$fs->addElement('advcheckbox', 'login_dont_lowercase')->setLabel(___("Do not lowercase username\n" . "by default, aMember automatically lowercases entered username\n" . "here you can disable this function"));
// $fs->addElement('advcheckbox', 'generate_pass')
// ->setLabel(___('Generate Password', 'should aMember generate password for customer?'));
//
$this->setDefault('pass_min_length', 6);
$this->setDefault('pass_max_length', 25);
$passLen = $fs->addGroup()->setLabel(___('Password Length'));
$passLen->addInteger('pass_min_length')->setLabel('min');
$passLen->addInteger('pass_max_length')->setLabel('max');
$fs = $this->addElement('fieldset', '##03')->setLabel(___('Miscellaneous'));
$this->setDefault('admin.records-on-page', 10);
$fs->addElement('text', 'admin.records-on-page')->setLabel(___('Records per page (for grids)'));
$this->setDefault('currency', 'USD');
$currency = $fs->addElement('select', 'currency', array('size' => 1))->setLabel(___("Base Currency\n" . "base currency to be used for reports and affiliate commission.\n" . "It could not be changed if there are any invoices in database"))->loadOptions(Am_Currency::getFullList());
if (Am_Di::getInstance()->db->selectCell("SELECT COUNT(*) FROM ?_invoice")) {
$currency->toggleFrozen(true);
}
}
示例9: __toString
public function __toString()
{
$output = sprintf('<div style="padding:0.5em"><h1>%s</h1><div class="grid-container"><table id="regional-tax-table" %s><tr><th>%s</th>
<th>%s</th>
<th>%s</th>
<th>%s</th>
<th> </th></tr>', ___('Configured Tax Values'), 'class="grid"', ___('Country'), ___('State'), ___('Zip'), ___('Tax Value'));
$label_add = ___('Add');
$output .= "<tr class='regional-tax-add'>" . "<td width='30%'><select id='regional-tax-country' size='1'><option/>" . Am_Controller::renderOptions(Am_Di::getInstance()->countryTable->getOptions()) . "</select>" . "<td width='30%'><select id='regional-tax-state' size='1'></select></td>" . "<td><input type='text' id='regional-tax-zip' /></td>" . "<td><input type='text' id='regional-tax-rate' size='5' maxlength='5' /></td>" . "<td><input type='button' id='regional-tax-add-button' value='{$label_add}'/></td>" . "</tr>\n";
$name = $this->getName();
foreach ($this->regional_taxes as $id => $region) {
$hidden = Am_Controller::escape(implode('|', array($region['country'], $region['state'], $region['zip'], $region['tax_value'])));
$output .= '<tr>' . sprintf('<td>%s</td>', Am_Di::getInstance()->countryTable->getTitleByCode($region['country'])) . sprintf('<td>%s</td>', $region['state'] ? Am_Di::getInstance()->stateTable->getTitleByCode($region['country'], $region['state']) : '*') . sprintf('<td>%s</td>', $region['zip'] ? $region['zip'] : '*') . sprintf('<td>%.2f%s</td>', $region['tax_value'], ' %') . sprintf('<td><a href="javascript:" class="regional-tax-remove">%s</a>%s</td>', ___('Remove'), "<input type='hidden' name='{$name}[]' value='{$hidden}'>") . '</tr>';
}
$output .= '</table></div></div>';
$id = $this->getId();
$output .= "\n <style type='text/css'>\n #row-{$id} .element-title { display: none; }\n #row-{$id} .element { margin-left: 0 } \n </style>\n ";
return sprintf('<tr><td colspan="2" id="tax-regional-regions">%s</td></tr>', $output . $this->getJs());
}
示例10: ajaxCheckUniqEmail
function ajaxCheckUniqEmail($vars)
{
$user_id = $this->getDi()->auth->getUserId();
if (!$user_id) {
$user_id = $this->getDi()->session->signup_member_id;
}
$email = $vars['email'];
$msg = null;
if ($_url = @$vars['_url']) {
$url = base64_decode($_url);
} else {
$url = REL_ROOT_URL . '/member';
}
if (!$this->getDi()->userTable->checkUniqEmail($email, $user_id)) {
$msg = ___('An account with the same email already exists.') . '<br />' . ___('Please %slogin%s to your existing account.%sIf you have not completed payment, you will be able to complete it after login', '<a href="' . Am_Controller::escape($url) . '" class="ajax-link">', '</a>', '<br />');
}
if (!$msg) {
$msg = Am_Di::getInstance()->banTable->checkBan(array('email' => $email));
}
if (!$msg && !Am_Validate::email($email)) {
$msg = ___('Please enter valid Email');
}
return $this->ajaxResponse($msg ? $msg : true);
}
示例11: renderInputs
public function renderInputs()
{
$filter = (array) $this->vars['filter'];
$filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
$filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
$filter['text'] = Am_Controller::escape(@$filter['text']);
$options = Am_Controller::renderOptions(array('' => '***', 'invoice' => ___('Invoice'), 'login' => ___('Username')), @$filter['type']);
//'receipt' => ___('Receipt'),
$start = ___("Start Date");
$end = ___("End Date");
$tfilter = ___("Filter");
$prefix = $this->grid->getId();
return <<<CUT
<b>{$start}</b>
<input type="text" name="{$prefix}_filter[dat1]" class='datepicker' value="{$filter['dat1']}" />
<b>{$end}</b>
<input type="text" name="{$prefix}_filter[dat2]" class='datepicker' value="{$filter['dat2']}" />
<b>{$tfilter}</b>
<input type="text" name="{$prefix}_filter[text]" value="{$filter['text']}" />
<select name="{$prefix}_filter[type]">
{$options}
</select>
CUT;
}
示例12: onGridProductInitForm
function onGridProductInitForm(Am_Event $event)
{
$form = $event->getGrid()->getForm();
$fs = $form->addAdvFieldset('cart')->setLabel(___('Shopping Cart'));
$fs->addUpload('img', null, array('prefix' => self::UPLOAD_PREFIX))->setLabel(___("Product Picture\n" . 'for shopping cart pages. Only jpg, png and gif formats allowed'))->setAllowedMimeTypes(array('image/png', 'image/jpeg', 'image/gif'));
$fs->addText('path', array('class' => 'el-wide'))->setId('product-path')->setLabel(___("Path\n" . 'will be used to construct user-friendly url, in case of you ' . 'leave it empty aMember will use id of this product to do it'))->addRule('callback', ___('Path should be unique across all products'), array('callback' => array($this, 'checkPath'), 'arguments' => array($event->getGrid())));
$root_url = Am_Controller::escape(Am_Di::getInstance()->config->get('root_url'));
$fs->addStatic()->setLabel(___('Permalink'))->setContent(<<<CUT
<div data-root_url="{$root_url}" id="product-permalink"></div>
CUT
);
$fs->addScript()->setScript(<<<CUT
\$('#product-path').bind('keyup', function(){
\$('#product-permalink').closest('.row').toggle(\$(this).val() != '');
\$('#product-permalink').html(\$('#product-permalink').data('root_url') + '/product/' + encodeURIComponent(\$(this).val()).replace(/%20/g, '+'))
}).trigger('keyup')
CUT
);
$fs->addHtmlEditor('cart_description')->setLabel(___("Product Description\n" . 'displayed on the shopping cart page'));
$fs = $form->addAdvFieldset('meta', array('id' => 'meta'))->setLabel(___('Meta Data'));
$fs->addText('meta_title', array('class' => 'el-wide'))->setLabel(___('Title'));
$fs->addText('meta_keywords', array('class' => 'el-wide'))->setLabel(___('Keywords'));
$fs->addText('meta_description', array('class' => 'el-wide'))->setLabel(___('Description'));
}
示例13: renderSubject
function renderSubject(MailQueue $m)
{
$s = $m->subject;
if (strpos($s, '=?') === 0) {
$s = mb_decode_mimeheader($s);
}
return "<td>" . Am_Controller::escape($s) . "</td>";
}
示例14: renderEditCategoryTitle
public function renderEditCategoryTitle($record, $fieldName, $grid)
{
return sprintf('<td><a href="javascript:;" class="link am-helpdesk-edit-category" data-category_id="%s">%s</a></td>', $this->getDi()->app->obfuscate($record->pk()), Am_Controller::escape($record->title));
}
示例15: cancelPaymentAction
public function cancelPaymentAction(\Am_Request $request, \Zend_Controller_Response_Http $response, array $invokeArgs)
{
$ret = parent::cancelPaymentAction($request, $response, $invokeArgs);
foreach ($response->getHeaders() as $h) {
if ($h['name'] == 'Location') {
$redirect = $h['value'];
}
}
if ($response->isRedirect()) {
$response->clearAllHeaders()->clearBody();
$url = Am_Controller::escape($redirect);
$response->setBody("<html>\n <head>\n <script type='text/javascript'>\n window.top.location.href = '{$url}';\n </script>\n </head>\n </html>\n ");
}
return $ret;
}