本文整理汇总了PHP中Text::_方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::_方法的具体用法?PHP Text::_怎么用?PHP Text::_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public static function process($action = 'list', $id = null, $filters = array())
{
$errors = array();
// valores de filtro
$groups = Template::groups();
switch ($action) {
case 'edit':
// si estamos editando una plantilla
$template = Template::get($id);
// si llega post, vamos a guardar los cambios
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$template->title = $_POST['title'];
$template->text = $_POST['text'];
if ($template->save($errors)) {
Message::Info(Text::_('La plantilla se ha actualizado correctamente'));
throw new Redirection("/admin/templates");
} else {
Message::Error(Text::_('No se ha grabado correctamente. ') . implode('<br />', $errors));
}
}
// sino, mostramos para editar
return new View('view/admin/index.html.php', array('folder' => 'templates', 'file' => 'edit', 'template' => $template));
break;
case 'list':
// si estamos en la lista de páginas
$templates = Template::getAll($filters);
return new View('view/admin/index.html.php', array('folder' => 'templates', 'file' => 'list', 'templates' => $templates, 'groups' => $groups, 'filters' => $filters));
break;
}
}
示例2: process
public static function process($action = 'list', $id = null)
{
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $action == 'edit') {
// instancia
$data = array('id' => $_POST['id'], 'name' => $_POST['name'], 'amount' => $_POST['amount']);
if (WorthLib::save($data, $errors)) {
$action = 'list';
Message::Info(Text::_('Nivel de meritocracia modificado'));
// Evento Feed
$log = new Feed();
$log->populate(Text::_('Nivel de meritocracia modificado'), '/admin/worth', \vsprintf("El admin %s ha %s el nivel de meritocrácia %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('project', $icon->name))));
$log->doAdmin('admin');
unset($log);
} else {
Message::Error(Text::_('No se ha guardado correctamente. ') . implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'worth', 'file' => 'edit', 'action' => 'edit', 'worth' => (object) $data));
}
}
switch ($action) {
case 'edit':
$worth = WorthLib::getAdmin($id);
return new View('view/admin/index.html.php', array('folder' => 'worth', 'file' => 'edit', 'action' => 'edit', 'worth' => $worth));
break;
}
$worthcracy = WorthLib::getAll();
return new View('view/admin/index.html.php', array('folder' => 'worth', 'file' => 'list', 'worthcracy' => $worthcracy));
}
示例3: process
public static function process($action = 'list', $id = null, $filters = array(), $type = 'main')
{
//@NODESYS
$node = \GOTEO_NODE;
$type = 'main';
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$item = new Model\Home(array('item' => $_POST['item'], 'type' => $_POST['type'], 'node' => $node, 'order' => $_POST['order'], 'move' => 'down'));
if ($item->save($errors)) {
} else {
Message::Error(implode('<br />', $errors));
}
}
switch ($action) {
case 'remove':
Model\Home::delete($id, $node, $type);
throw new Redirection('/admin/home');
break;
case 'up':
Model\Home::up($id, $node, $type);
throw new Redirection('/admin/home');
break;
case 'down':
Model\Home::down($id, $node, $type);
throw new Redirection('/admin/home');
break;
case 'add':
$next = Model\Home::next($node, 'main');
$availables = Model\Home::available($node);
if (empty($availables)) {
Message::Info(Text::_('Todos los elementos disponibles ya estan en portada'));
throw new Redirection('/admin/home');
break;
}
return new View('view/admin/index.html.php', array('folder' => 'home', 'file' => 'add', 'action' => 'add', 'home' => (object) array('node' => $node, 'order' => $next, 'type' => 'main'), 'availables' => $availables));
break;
case 'addside':
$next = Model\Home::next($node, 'side');
$availables = Model\Home::availableSide($node);
if (empty($availables)) {
Message::Info(Text::_('Todos los elementos laterales disponibles ya estan en portada'));
throw new Redirection('/admin/home');
break;
}
return new View('view/admin/index.html.php', array('folder' => 'home', 'file' => 'add', 'action' => 'add', 'home' => (object) array('node' => $node, 'order' => $next, 'type' => 'side'), 'availables' => $availables));
break;
}
$viewData = array('folder' => 'home', 'file' => 'list');
$viewData['items'] = Model\Home::getAll($node);
/* Para añadir nuevos desde la lista */
$viewData['availables'] = Model\Home::available($node);
$viewData['new'] = (object) array('node' => $node, 'order' => Model\Home::next($node, 'main'), 'type' => 'main');
// laterales
$viewData['side_items'] = Model\Home::getAllSide($node);
$viewData['side_availables'] = Model\Home::availableSide($node);
$viewData['side_new'] = (object) array('node' => $node, 'order' => Model\Home::next($node, 'side'), 'type' => 'side');
return new View('view/admin/index.html.php', $viewData);
}
示例4: remove
/**
* Quitar una palabra clave de un proyecto
*
* @param varchar(50) $user id de un proyecto
* @param INT(12) $id identificador de la tabla keyword
* @param array $errors
* @return boolean
*/
public function remove(&$errors = array())
{
$values = array(':user' => $this->user, ':id' => $this->id);
try {
self::query("DELETE FROM user_web WHERE id = :id AND user = :user", $values);
return true;
} catch (\PDOException $e) {
$errors[] = Text::_('No se ha podido quitar la web ') . $this->id . Text::_(' del usuario ') . $this->user . ' ' . $e->getMessage();
return false;
}
}
示例5: save
public function save(&$errors = array())
{
if (!$this->validate($errors)) {
return false;
}
$values = array(':user' => $this->user, ':review' => $this->id);
try {
$sql = "REPLACE INTO user_review (user, review) VALUES(:user, :review)";
self::query($sql, $values);
return true;
} catch (\PDOException $e) {
$errors[] = Text::_("No se ha guardado correctamente. ") . $e->getMessage();
return false;
}
}
示例6: showRows
function showRows()
{
$order = !$_GET['order'] ? 'id' : $_GET['order'];
$orderdir = strtoupper($_GET['orderdir']) == 'DESC' ? 'DESC' : 'ASC';
$ordering = ' ORDER BY ' . $order . ' ' . $orderdir;
$query = 'SELECT count(*) AS count FROM ' . $this->table->_tbl;
$this->db->setQuery($query);
$row = $this->db->LoadObject();
if ($row->count > 0) {
$query = 'SELECT prices.*,apps.name AS app' . ' FROM ' . $this->table->_tbl . ' LEFT JOIN apps ON prices.appid=apps.id' . $ordering;
$pagination =& Factory::getPagination();
$pagination->pager($row->count, 20, 6);
$this->db->setQuery($query, $pagination->limiStart, $pagination->pageRows);
$rows = $this->db->LoadObjectList();
$this->assign('pagination', $pagination);
$this->assign('rows', $rows);
} else {
$this->assign('noRows', Text::_('No Data Found'));
}
$this->display('prices.tpl');
}
示例7: customInit
function customInit()
{
parent::customInit();
if (count($_POST) > 0) {
$username = $_POST['username'];
$password = $_POST['password'];
if ($username && $password) {
$this->db->setQuery('SELECT * FROM users WHERE username=' . $this->db->getEscaped($username) . ' AND password=' . $this->db->getEscaped(md5($password)));
if ($this->db->numRows() > 0) {
$this->session->set('admin', (object) array('username' => $username, 'password' => md5($password)));
$this->setRedirect('index.php');
} else {
$msg = Text::_('Wrong Username or Password');
}
} else {
$msg = Text::_('Please Enter Username and Password');
}
}
$_SESSION['msg'] = $msg;
$this->display('login.tpl');
die;
}
示例8: showRows
function showRows()
{
$html =& Factory::getHtml();
$order = !$_GET['order'] ? 'id' : $_GET['order'];
$orderdir = strtoupper($_GET['orderdir']) == 'DESC' ? 'DESC' : 'ASC';
$ordering = ' ORDER BY ' . $order . ' ' . $orderdir;
$query = 'SELECT count(*) AS count FROM ' . $this->table->_tbl;
$this->db->setQuery($query);
$row = $this->db->LoadObject();
if ($row->count > 0) {
$query = 'SELECT *' . ' FROM ' . $this->table->_tbl . $ordering;
$pagination =& Factory::getPagination();
$pagination->pager($row->count, 20, 6);
$this->db->setQuery($query, $pagination->limiStart, $pagination->pageRows);
$rows = $this->db->LoadObjectList();
$this->assign('pagination', $pagination);
$this->assign('rows', $rows);
$this->assign('orderDis', $orderDis);
$this->assign('html', $html);
} else {
$this->assign('noRows', Text::_('No Data Found'));
}
$this->display('reports.tpl');
}
示例9: showRows
function showRows()
{
$order = !$_GET['order'] ? 'id' : $_GET['order'];
$orderdir = strtoupper($_GET['orderdir']) == 'DESC' ? 'DESC' : 'ASC';
$ordering = ' ORDER BY ' . $order . ' ' . $orderdir;
$where = '';
if (!$this->user->admin) {
if (!empty($this->user->permissions['groups'])) {
$where[] = 'EXISTS (SELECT expenses_groups.expenseid FROM expenses_groups WHERE expenses_groups.groupid IN (' . implode(',', $this->user->permissions['groups']) . ')' . ' AND expenses.id=expenses_groups.expenseid AND expenses_groups.share>0)';
} else {
$where[] = '0';
}
if (!empty($this->user->permissions['markets'])) {
$where[] = 'EXISTS (SELECT expenses_markets.expenseid FROM expenses_markets WHERE expenses_markets.marketid IN (' . implode(',', $this->user->permissions['markets']) . ')' . ' AND expenses.id=expenses_markets.expenseid)';
} else {
$where[] = '0';
}
}
if (!empty($where)) {
$where = ' WHERE ' . implode(' AND ', $where);
}
$query = 'SELECT count(*) AS count FROM expenses' . $where;
$this->db->setQuery($query);
$row = $this->db->LoadObject();
if ($row->count > 0) {
$query = 'SELECT expenses.*' . ' FROM expenses' . $join4where . $where . $ordering;
$pagination =& Factory::getPagination();
$pagination->pager($row->count, 20, 6);
$this->db->setQuery($query, $pagination->limiStart, $pagination->pageRows);
$rows = $this->db->LoadObjectList();
$this->assign('pagination', $pagination);
$this->assign('rows', $rows);
} else {
$this->assign('noRows', Text::_('No Data Found'));
}
$this->display('expenses.tpl');
}
示例10: update
public function update(&$errors = array())
{
if (!$this->id) {
return false;
}
$fields = array('order', 'home', 'footer');
$set = '';
$values = array(':id' => $this->id);
foreach ($fields as $field) {
if (!isset($this->{$field})) {
continue;
}
if ($set != '') {
$set .= ", ";
}
$set .= "`{$field}` = :{$field} ";
$values[":{$field}"] = $this->{$field};
}
if ($set == '') {
$errors[] = Text::_('Sin datos');
return false;
}
try {
$sql = "UPDATE post SET " . $set . " WHERE post.id = :id";
self::query($sql, $values);
return true;
} catch (\PDOException $e) {
$errors[] = Text::_("No se ha guardado correctamente. ") . $e->getMessage();
return false;
}
}
示例11: process
public static function process($action = 'list', $id = null, $filters = array())
{
$node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
$errors = array();
switch ($action) {
case 'add':
// proyectos que están más allá de edición y con traducción deshabilitada
$availables = Model\User\Translate::getAvailables('project', $_SESSION['admin_node']);
if (empty($availables)) {
Message::Error(Text::_('No hay más proyectos disponibles para traducir'));
throw new Redirection('/admin/translates');
}
case 'edit':
case 'assign':
case 'unassign':
case 'send':
// a ver si tenemos proyecto
if (empty($id) && !empty($_POST['project'])) {
$id = $_POST['project'];
}
if (!empty($id)) {
$project = Model\Project::getMini($id);
} elseif ($action != 'add') {
Message::Error(Text::_('No hay proyecto sobre el que operar'));
throw new Redirection('/admin/translates');
}
// asignar o desasignar
// la id de revision llega en $id
// la id del usuario llega por get
$user = $_GET['user'];
if (!empty($user)) {
$userData = Model\User::getMini($user);
$assignation = new Model\User\Translate(array('item' => $project->id, 'type' => 'project', 'user' => $user));
switch ($action) {
case 'assign':
// se la ponemos
$what = Text::_('Asignado');
if ($assignation->save($errors)) {
Message::Info(Text::_('Traducción asignada correctamente'));
throw new Redirection('/admin/translates/edit/' . $project->id);
} else {
Message::Error(Text::_('No se ha guardado correctamente. ') . implode(', ', $errors));
}
break;
case 'unassign':
// se la quitamos
$what = Text::_('Desasignado');
if ($assignation->remove($errors)) {
Message::Info(Text::_('Traducción desasignada correctamente'));
throw new Redirection('/admin/translates/edit/' . $project->id);
} else {
Message::Error(Text::_('No se ha guardado correctamente. ') . implode(', ', $errors));
}
break;
}
if (empty($errors)) {
// Evento Feed
$log = new Feed();
$log->setTarget($userData->id, 'user');
$log->populate($what . ' traduccion (admin)', '/admin/translates', \vsprintf('El admin %s ha %s a %s la traducción del proyecto %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', $what), Feed::item('user', $userData->name, $userData->id), Feed::item('project', $project->name, $project->id))));
$log->doAdmin('admin');
unset($log);
}
$action = 'edit';
}
// fin asignar o desasignar
// añadir o actualizar
// se guarda el idioma original y si la traducción está abierta o cerrada
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['save'])) {
if (empty($id)) {
Message::Error(Text::_('Hemos perdido de vista el proyecto'));
throw new Redirection('/admin/translates');
}
// ponemos los datos que llegan
$sql = "UPDATE project SET lang = :lang, translate = 1 WHERE id = :id";
if (Model\Project::query($sql, array(':lang' => $_POST['lang'], ':id' => $id))) {
if ($action == 'add') {
Message::Info('El proyecto ' . $project->name . ' se ha habilitado para traducir');
} else {
Message::Info(Text::_('Datos de traducción actualizados'));
}
if ($action == 'add') {
// Evento Feed
$log = new Feed();
$log->setTarget($project->id);
$log->populate(Text::_('proyecto habilitado para traducirse (admin)'), '/admin/translates', \vsprintf('El admin %s ha %s la traducción del proyecto %s', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Habilitado'), Feed::item('project', $project->name, $project->id))));
$log->doAdmin('admin');
unset($log);
throw new Redirection('/admin/translates/edit/' . $project->id);
} else {
throw new Redirection('/admin/translates');
}
} else {
if ($action == 'add') {
Message::Error(Text::_('Ha fallado al habilitar la traducción del proyecto ') . $project->name);
} else {
Message::Error(Text::_('Ha fallado al actualizar los datos de la traducción'));
}
}
}
//.........这里部分代码省略.........
示例12: save
public function save(&$errors = array())
{
if (!$this->validate($errors)) {
return false;
}
// Primero la imagenImagen
if (is_array($this->image) && !empty($this->image['name'])) {
$image = new Image($this->image);
if ($image->save($errors)) {
$this->image = $image->id;
} else {
\Goteo\Library\Message::Error(Text::get('image-upload-fail') . implode(', ', $errors));
$this->image = '';
}
}
$fields = array('id', 'name', 'url', 'image', 'order');
$set = '';
$values = array();
foreach ($fields as $field) {
if ($set != '') {
$set .= ", ";
}
$set .= "`{$field}` = :{$field} ";
$values[":{$field}"] = $this->{$field};
}
try {
$sql = "REPLACE INTO sponsor SET " . $set;
self::query($sql, $values);
if (empty($this->id)) {
$this->id = self::insertId();
}
Check::reorder($this->id, 'up', 'sponsor');
return true;
} catch (\PDOException $e) {
$errors[] = Text::_("No se ha guardado correctamente. ") . $e->getMessage();
return false;
}
}
示例13: import
function import()
{
JRequest::checkToken('request') || die('Invalid Token');
$function = JRequest::getCmd('importfrom');
$this->helper->addTemplate(JRequest::getInt('template_product', 0));
switch ($function) {
case 'file':
$this->_file();
break;
case 'textarea':
$this->_textarea();
break;
case 'folder':
if (hikashop_level(2)) {
$this->_folder();
} else {
$app =& JFactory::getApplication();
$app->enqueueMessage(Text::_('ONLY_FROM_HIKASHOP_BUSINESS'), 'error');
}
break;
case 'vm':
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('virtuemart_products', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('vm_product', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('VirtueMart has not been found in the database', 'error');
} else {
$this->helperImport = hikashop_get('helper.import-vm1', $this);
$this->_vm();
}
} else {
$this->helperImport = hikashop_get('helper.import-vm2', $this);
$this->_vm();
}
break;
case 'mijo':
$this->helperImport = hikashop_get('helper.import-mijo', $this);
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('mijoshop_product', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('Mijoshop has not been found in the database', 'error');
} else {
$this->_mijo();
}
break;
case 'redshop':
$this->helperImport = hikashop_get('helper.import-reds', $this);
$query = 'SHOW TABLES LIKE ' . $this->db->Quote($this->db->getPrefix() . substr(hikashop_table('redshop_product', false), 3));
$this->db->setQuery($query);
$table = $this->db->loadResult();
if (empty($table)) {
$app =& JFactory::getApplication();
$app->enqueueMessage('Redshop has not been found in the database', 'error');
} else {
$this->_redshop();
}
break;
case 'openc':
$this->helperImport = hikashop_get('helper.import-openc', $this);
$this->_opencart();
break;
default:
$plugin = hikashop_import('hikashop', $function);
if ($plugin) {
$plugin->onImportRun();
}
break;
}
return $this->show();
}
示例14: assign
public function assign(&$errors = array())
{
$fields = array('tag', 'post');
$set = '';
$values = array();
foreach ($fields as $field) {
if ($set != '') {
$set .= ", ";
}
$set .= "`{$field}` = :{$field} ";
$values[":{$field}"] = $this->{$field};
}
try {
$sql = "REPLACE INTO post_tag SET " . $set;
self::query($sql, $values);
if (empty($this->id)) {
$this->id = self::insertId();
}
return true;
} catch (\PDOException $e) {
$errors[] = Text::_("No se ha guardado correctamente. ") . $e->getMessage();
return false;
}
}
示例15: remove
/**
* Quitarle una traducción al usuario
*
* @param varchar(50) $user id del usuario
* @param INT(12) $id identificador de la tabla project
* @param array $errors
* @return boolean
*/
public function remove(&$errors = array())
{
$values = array(':user' => $this->user, ':type' => $this->type, ':item' => $this->item);
try {
if (self::query("DELETE FROM user_translate WHERE type = :type AND item = :item AND user = :user", $values)) {
ACL::deny('/translate/' . $this->type . '/' . $this->item . '/*', '*', 'translator', $this->user);
return true;
} else {
return false;
}
} catch (\PDOException $e) {
$errors[] = Text::_('No se ha guardado correctamente. ') . $e->getMessage();
return false;
}
}