本文整理汇总了PHP中_ws函数的典型用法代码示例。如果您正苦于以下问题:PHP _ws函数的具体用法?PHP _ws怎么用?PHP _ws使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_ws函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtml
public function getHtml($error = null)
{
$captcha_url = wa()->getRootUrl(false, true) . $this->getAppId() . '/captcha.php?rid=' . uniqid(time());
$refresh = _ws("Refresh CAPTCHA");
$class = $error ? ' wa-error' : '';
return <<<HTML
<div class="wa-captcha">
<p>
<img class="wa-captcha-img" src="{$captcha_url}" alt="CAPTCHA" title="{$refresh}">
<strong>→</strong>
<input type="text" name="captcha" class="wa-captcha-input{$class}" autocomplete="off">
</p>
<p>
<a href="#" class="wa-captcha-refresh">{$refresh}</a>
</p>
<script type="text/javascript">
\$(function() {
\$('div.wa-captcha .wa-captcha-refresh, div.wa-captcha .wa-captcha-img').click(function(){
var div = \$(this).parents('div.wa-captcha');
var captcha = div.find('.wa-captcha-img');
if(captcha.length) {
captcha.attr('src', captcha.attr('src').replace(/\\?.*\$/,'?rid='+Math.random()));
captcha.one('load', function() {
div.find('.wa-captcha-input').focus();
});
};
return false;
});
});
</script>
</div>
HTML;
}
示例2: execute
public function execute()
{
if (!$this->getUser()->getRights('shop', 'settings')) {
throw new waException(_w('Access denied'));
}
$plugin_id = waRequest::get('id');
if (!$plugin_id) {
throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
}
$namespace = 'shop_' . $plugin_id;
/**
* @var shopPlugin $plugin
*/
$plugin = waSystem::getInstance()->getPlugin($plugin_id);
$settings = (array) $this->getRequest()->post($namespace);
$files = waRequest::file($namespace);
$settings_defenitions = $plugin->getSettings();
foreach ($files as $name => $file) {
if (isset($settings_defenitions[$name])) {
$settings[$name] = $file;
}
}
try {
$this->response = $plugin->saveSettings($settings);
$this->response['message'] = _w('Saved');
} catch (Exception $e) {
$this->setError($e->getMessage());
}
}
示例3: execute
public function execute()
{
$e = $this->getRequest()->param('exception');
if ($e && $e instanceof Exception) {
/**
* @var Exception $e
*/
$code = $e->getCode();
if (!$code) {
$code = 500;
}
$message = $e->getMessage();
} else {
$code = 404;
$message = _ws("Page not found");
}
$this->getResponse()->setStatus($code);
$this->getResponse()->setTitle(htmlentities($code . '. ' . $message, ENT_QUOTES, 'utf-8'));
$this->view->assign('error_code', $code);
$this->view->assign('error_message', $message);
if ($code == 404) {
$this->setLayout(new blogFrontendLayout());
}
$this->setThemeTemplate('error.html', waRequest::param('theme', 'default'));
}
示例4: execute
public function execute()
{
parent::execute();
$this->view->assign('my_nav_selected', 'profile');
$user = wa()->getUser();
$user_info = array();
foreach ($this->form->fields as $id => $field) {
if (!in_array($id, array('password', 'password_confirm'))) {
if ($id === 'photo') {
$user_info[$id] = array('name' => _ws('Photo'), 'value' => '<img src="' . $user->getPhoto() . '">');
} else {
$user_info[$id] = array('name' => $this->form->fields[$id]->getName(null, true), 'value' => $user->get($id, 'html'));
}
}
}
$this->view->assign('user_info', $user_info);
// Set up layout and template from theme
$this->setThemeTemplate('my.profile.html');
if (!waRequest::isXMLHttpRequest()) {
$this->setLayout(new photosDefaultFrontendLayout());
$this->getResponse()->setTitle(_w('My account') . ' — ' . _w('My profile'));
$this->layout->assign('breadcrumbs', $this->getBreadcrumbs());
$this->layout->assign('nofollow', true);
}
}
示例5: execute
public function execute()
{
if (!$this->appSettings('show_comments', true)) {
throw new waException(_ws("Page not found"), 404);
}
$this->comment_model = new blogCommentModel();
$this->blog_id = waRequest::param('blog_id', false, waRequest::TYPE_ARRAY_INT);
$this->verify();
if ($this->getRequest()->method() == 'post') {
$res = $this->addComment();
} else {
$this->comment_id = waRequest::param('blog_id', false, waRequest::TYPE_ARRAY_INT);
$res = true;
}
if (waRequest::get('json')) {
if ($this->comment_id) {
$this->displayComment();
}
} else {
if (!$res) {
var_export($this->errors);
exit;
//handle error on non ajax
}
$url = blogPost::getUrl($this->post) . '#comment' . intval($this->parent_id ? $this->parent_id : $this->comment_id);
$this->redirect($url);
}
}
示例6: saveAction
public function saveAction()
{
$plugin_id = waRequest::get('id');
if (!$plugin_id) {
throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
}
$namespace = $this->getAppId() . '_' . $plugin_id;
/**
* @var shopPlugin $plugin
*/
$plugin = waSystem::getInstance()->getPlugin($plugin_id);
$settings = (array) $this->getRequest()->post($namespace);
$files = waRequest::file($namespace);
$settings_defenitions = $plugin->getSettings();
foreach ($files as $name => $file) {
if (isset($settings_defenitions[$name])) {
$settings[$name] = $file;
}
}
try {
$response = $plugin->saveSettings($settings);
$response['message'] = _w('Saved');
$this->displayJson($response);
} catch (Exception $e) {
$this->setError($e->getMessage());
$this->displayJson(array(), $e->getMessage());
}
}
示例7: execute
public function execute()
{
// Layout caching is forbidden
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Expires: " . date("r"));
$this->executeAction('sidebar', new contactsBackendSidebarAction());
$fields = array();
// normally this is done with waContactFields::getInfo() but we don't need most of the info
// so we loop through fields manually.
foreach (waContactFields::getAll('enabled') as $field_id => $f) {
/**
* @var $f waContactField
*/
$fields[$field_id] = array();
$fields[$field_id]['id'] = $field_id;
$fields[$field_id]['name'] = $f->getName();
$fields[$field_id]['fields'] = $f instanceof waContactCompositeField;
if ($ext = $f->getParameter('ext')) {
$fields[$field_id]['ext'] = $ext;
foreach ($fields[$field_id]['ext'] as &$v) {
$v = _ws($v);
}
}
}
// Plugin assets
if ($this->getConfig()->getInfo('edition') === 'full') {
wa()->event('assets');
}
$this->view->assign('admin', wa()->getUser()->getRights('contacts', 'backend') > 1);
$this->view->assign('global_admin', wa()->getUser()->getRights('webasyst', 'backend') > 0);
$this->view->assign('fields', $fields);
$this->view->assign('versionFull', $this->getConfig()->getInfo('edition') === 'full');
}
示例8: __construct
public function __construct()
{
// check access rights
if (!$this->getRights('design')) {
throw new waRightsException(_ws("Access denied"));
}
}
示例9: init
public function init()
{
$this->addItem('upload', _w('Can upload photos and create new albums'));
$this->addItem('edit', _w('Can edit and delete photos and albums uploaded by other users'));
$this->addItem('pages', _ws('Can edit pages'));
$this->addItem('design', _ws('Can edit design'));
}
示例10: init
public function init()
{
// Право удалять записи
$this->addItem('delete', 'Can delete posts', 'checkbox');
// Право редактировать дизайн (шаблоны и темы)
$this->addItem('design', _ws('Can edit design'), 'checkbox');
}
示例11: execute
public function execute()
{
$plugin_id = waRequest::get('id');
if (!$plugin_id) {
throw new waException(_ws("Can't save plugin settings: unknown plugin id"));
}
$namespace = 'photos_' . $plugin_id;
/**
* @var photosPlugin $plugin
*/
$plugin = waSystem::getInstance()->getPlugin($plugin_id);
$settings = (array) $this->getRequest()->post($namespace);
$files = waRequest::file($namespace);
$settings_defenitions = $plugin->getSettings();
foreach ($files as $name => $file) {
if (isset($settings_defenitions[$name])) {
$settings[$name] = $file;
}
}
try {
$plugin->saveSettings($settings);
} catch (Exception $e) {
$this->errors = $e->getMessage();
}
}
示例12: getDelimiters
public static function getDelimiters()
{
$result = array();
foreach (self::$delimiters as $k => $d) {
$result[$k] = array($d[0], _ws($d[1]));
}
return $result;
}
示例13: getMessage
public function getMessage($name, $variables = array())
{
$message = isset($this->messages[$name]) ? $this->messages[$name] : _ws('Invalid');
foreach ($variables as $k => $v) {
$message = str_replace('%' . $k . '%', $v, $message);
}
return $message;
}
示例14: init
public function init()
{
if (!isset($this->options['validators'])) {
$options = $this->options;
$options['required'] = true;
$this->options['validators'] = new waStringValidator($options, array('required' => _ws('At least one of these fields must be filled')));
}
}
示例15: execute
public function execute()
{
$filepath = wa()->getCachePath('plugins/discountcards/export-discountcards.csv', 'shop');
if (!file_exists($filepath)) {
throw new waException(_ws("Page not found"), 404);
}
waFiles::readFile($filepath, 'export-discountcards.csv');
}