本文整理汇总了PHP中Text::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::get方法的具体用法?PHP Text::get怎么用?PHP Text::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public static function process($action = 'list', $id = null, $filters = array())
{
$groups = Model\Icon::groups();
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$icon = new Model\Icon(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'order' => $_POST['order'], 'group' => empty($_POST['group']) ? null : $_POST['group']));
if ($icon->save($errors)) {
switch ($_POST['action']) {
case 'add':
Message::Info(Text::get('admin-icons-info-add'));
break;
case 'edit':
Message::Info(Text::get('admin-icons-info-edit'));
// Evento Feed
$log = new Feed();
$log->populate('modificacion de tipo de retorno/recompensa (admin)', '/admin/icons', \vsprintf("El admin %s ha %s el tipo de retorno/recompensa %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);
break;
}
} else {
Message::Error(implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'icons', 'file' => 'edit', 'action' => $_POST['action'], 'icon' => $icon, 'groups' => $groups));
}
}
switch ($action) {
case 'edit':
$icon = Model\Icon::get($id);
return new View('view/admin/index.html.php', array('folder' => 'icons', 'file' => 'edit', 'action' => 'edit', 'icon' => $icon, 'groups' => $groups));
break;
}
$icons = Model\Icon::getAll($filters['group']);
return new View('view/admin/index.html.php', array('folder' => 'icons', 'file' => 'list', 'icons' => $icons, 'groups' => $groups, 'filters' => $filters));
}
示例2: 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::get('admin-templates-error-record-fail') . 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;
}
}
示例3: 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::get('admin-worth-info-modified'));
// Evento Feed
$log = new Feed();
$log->populate(Text::get('admin-worth-info-modified'), '/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::get('admin-worth-error-save-fail') . 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));
}
示例4: 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::get('admin-home-info-frontpage_feature'));
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::get('admin-home-info-frontpage_feature_get'));
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);
}
示例5: resetUserSession
/**
* Kicks the selected user out of the system instantly by resetting the user's session.
* This means, the user will be "logged out".
*
* @param $userId
* @return bool
*/
private static function resetUserSession($userId)
{
$database = DatabaseFactory::getFactory()->getConnection();
$query = $database->prepare("UPDATE users SET session_id = :session_id WHERE user_id = :user_id LIMIT 1");
$query->execute(array(':session_id' => null, ':user_id' => $userId));
if ($query->rowCount() == 1) {
Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_USER_SUCCESSFULLY_KICKED'));
return true;
}
}
示例6: setRequestDetails
/**
* @function setRequestDetails
* @public
* @static
* @returns NONE
* @desc
* @param {string} foo Use the 'foo' param for bar.
* @example NONE
*/
public static function setRequestDetails($recordID, $tableNo, $subj, $subSubj, $tutName)
{
$database = DatabaseFactory::getFactory()->getConnection();
// to do = update according to the settings needed given func's params/args.
$query = $database->prepare("UPDATE users SET user_deleted = :user_deleted WHERE user_id = :user_id LIMIT 1");
$query->execute(array(':user_deleted' => $delete, ':user_id' => $userId));
// to do = determine if needed below if-statement
if ($query->rowCount() == 1) {
Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_SUSPENSION_DELETION_STATUS'));
return true;
}
}
示例7: process
public static function process($action = 'list', $id = null, $filters = array())
{
// agrupaciones de mas a menos abertas
$groups = Model\License::groups();
// tipos de retorno para asociar
$icons = Model\Icon::getAll('social');
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// objeto
$license = new Model\License(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'url' => $_POST['url'], 'group' => $_POST['group'], 'order' => $_POST['order'], 'icons' => $_POST['icons']));
if ($license->save($errors)) {
switch ($_POST['action']) {
case 'add':
Message::Info(Text::get('admin-licenses-info-add'));
break;
case 'edit':
Message::Info(Text::get('admin-licenses-info-edit'));
// Evento Feed
$log = new Feed();
$log->populate('modificacion de licencia (admin)', '/admin/licenses', \vsprintf("El admin %s ha %s la licencia %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('project', $license->name))));
$log->doAdmin('admin');
unset($log);
break;
}
} else {
Message::Error(implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => $_POST['action'], 'license' => $license, 'icons' => $icons, 'groups' => $groups));
}
}
switch ($action) {
case 'up':
Model\License::up($id);
break;
case 'down':
Model\License::down($id);
break;
case 'add':
$next = Model\License::next();
return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => 'add', 'license' => (object) array('order' => $next, 'icons' => array()), 'icons' => $icons, 'groups' => $groups));
break;
case 'edit':
$license = Model\License::get($id);
return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => 'edit', 'license' => $license, 'icons' => $icons, 'groups' => $groups));
break;
case 'remove':
// Model\License::delete($id);
break;
}
$licenses = Model\License::getAll($filters['icon'], $filters['group']);
return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'list', 'licenses' => $licenses, 'filters' => $filters, 'groups' => $groups, 'icons' => $icons));
}
示例8: changeUserRole
/**
* Upgrades / downgrades the user's account. Currently it's just the field user_account_type in the database that
* can be 1 or 2 (maybe "basic" or "premium"). Put some more complex stuff in here, maybe a pay-process or whatever
* you like.
*
* @param $type
*
* @return bool
*/
public static function changeUserRole($type)
{
if (!$type) {
return false;
}
// save new role to database
if (self::saveRoleToDatabase($type)) {
Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_TYPE_CHANGE_SUCCESSFUL'));
return true;
} else {
Session::add('feedback_negative', Text::get('FEEDBACK_ACCOUNT_TYPE_CHANGE_FAILED'));
return false;
}
}
示例9: process
public static function process($action = 'list', $id = null, $filters = array())
{
$sections = Model\Faq::sections();
if (!isset($sections[$filters['section']])) {
unset($filters['section']);
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$faq = new Model\Faq(array('id' => $_POST['id'], 'node' => \GOTEO_NODE, 'section' => $_POST['section'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'order' => $_POST['order'], 'move' => $_POST['move']));
if ($faq->save($errors)) {
switch ($_POST['action']) {
case 'add':
Message::Info(Text::get('faq-info-add-question'));
break;
case 'edit':
Message::Info(Text::get('faq-info-edit-question'));
break;
}
} else {
Message::Error(implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'edit', 'action' => $_POST['action'], 'faq' => $faq, 'filter' => $filter, 'sections' => $sections));
}
}
switch ($action) {
case 'up':
Model\Faq::up($id);
throw new Redirection('/admin/faq');
break;
case 'down':
Model\Faq::down($id);
throw new Redirection('/admin/faq');
break;
case 'add':
$next = Model\Faq::next($filters['section']);
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'edit', 'action' => 'add', 'faq' => (object) array('section' => $filters['section'], 'order' => $next, 'cuantos' => $next), 'sections' => $sections));
break;
case 'edit':
$faq = Model\Faq::get($id);
$cuantos = Model\Faq::next($faq->section);
$faq->cuantos = $cuantos - 1;
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'edit', 'action' => 'edit', 'faq' => $faq, 'sections' => $sections));
break;
case 'remove':
Model\Faq::delete($id);
break;
}
$faqs = Model\Faq::getAll($filters['section']);
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'list', 'faqs' => $faqs, 'sections' => $sections, 'filters' => $filters));
}
示例10: deleteNote
/**
* Delete a specific note
* @param int $note_id id of the note
* @return bool feedback (was the note deleted properly ?)
*/
public static function deleteNote($note_id)
{
if (!$note_id) {
return false;
}
$note = NoteQuery::create()->findPK($note_id);
$note->delete();
if ($note) {
return true;
}
// default return
Session::add('feedback_negative', Text::get('FEEDBACK_NOTE_DELETION_FAILED'));
return false;
}
示例11: getPublicProfileOfUser
/**
* @function getPublicProfileOfUser
* @public
* @static
* @returns {array} A single user profile.
* @desc Gets a user's profile data, according to the given $user_id.
* @param {integer} $user_id The user's id.
* @example NONE
*/
public static function getPublicProfileOfUser($user_id)
{
$database = DatabaseFactory::getFactory()->getConnection();
$sql = "SELECT user_id, user_name, user_email, user_active, user_deleted FROM users WHERE user_id = :user_id LIMIT 1";
$query = $database->prepare($sql);
$query->execute(array(':user_id' => $user_id));
$user = $query->fetch();
if ($query->rowCount() != 1) {
Session::add('feedback_negative', Text::get('FEEDBACK_USER_DOES_NOT_EXIST'));
}
// all elements of array passed to Filter::XSSFilter for XSS sanitation, have a look into
// application/core/Filter.php for more info on how to use. Removes (possibly bad) JavaScript etc from
// the user's values
array_walk_recursive($user, 'Filter::XSSFilter');
return $user;
}
示例12: setAccountDeletionStatus
/**
* @function setAccountDeletionStatus
* @public
* @static
* @returns NONE
* @desc
* @param {string} foo Use the 'foo' param for bar.
* @example NONE
*/
public static function setAccountDeletionStatus($softDelete, $userId)
{
$database = DatabaseFactory::getFactory()->getConnection();
// FYI "on" is what a checkbox delivers by default when submitted.
if ($softDelete == "on") {
$delete = 1;
} else {
$delete = 0;
}
$query = $database->prepare("UPDATE users SET user_deleted = :user_deleted WHERE user_id = :user_id LIMIT 1");
$query->execute(array(':user_deleted' => $delete, ':user_id' => $userId));
if ($query->rowCount() == 1) {
Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_SUSPENSION_DELETION_STATUS'));
return true;
}
}
示例13: setAccountSuspensionAndDeletionStatus
/**
* @param $suspensionInDays
* @param $softDelete
* @param $userId
* @return bool
*/
public static function setAccountSuspensionAndDeletionStatus($suspensionInDays, $softDelete, $userId)
{
if ($suspensionInDays > 0) {
$suspensionTime = time() + $suspensionInDays * 60 * 60 * 24;
} else {
$suspensionTime = null;
}
// FYI "on" is what a checkbox delivers by default when submitted. Didn't know that for a long time :)
$delete = $softDelete == "on" ? 1 : 0;
$user = UserQuery::create()->findPk($userId);
$user->setUserSuspensionTimestamp($suspensionTime);
$user->setUserDeleted($delete);
$user->save();
if ($user) {
Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_SUSPENSION_DELETION_STATUS'));
return true;
}
return true;
}
示例14: setAccountSuspensionAndDeletionStatus
public static function setAccountSuspensionAndDeletionStatus($suspensionInDays, $softDelete, $userId)
{
$database = DatabaseFactory::getFactory()->getConnection();
if ($suspensionInDays > 0) {
$suspensionTime = time() + $suspensionInDays * 60 * 60 * 24;
} else {
$suspensionTime = null;
}
// FYI "on" is what a checkbox delivers by default when submitted. Didn't know that for a long time :)
if ($softDelete == "on") {
$delete = 1;
} else {
$delete = 0;
}
$query = $database->prepare("UPDATE users SET user_suspension_timestamp = :user_suspension_timestamp, user_deleted = :user_deleted WHERE user_id = :user_id LIMIT 1");
$query->execute(array(':user_suspension_timestamp' => $suspensionTime, ':user_deleted' => $delete, ':user_id' => $userId));
if ($query->rowCount() == 1) {
Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_SUSPENSION_DELETION_STATUS'));
return true;
}
}
示例15: validateUser
/**
* Validate the user against the DB, or increment the "failed-login-count" to prevent
* bruteforce password/user attacks
* @param string $userName
* @param string $userPassword
* @return mixed
*/
private static function validateUser(string $userName, string $userPassword)
{
if (Session::get('failed-login-count') >= 3 && Session::get('last-failed-login') > time() - 30) {
Session::push('feedback_negative', Text::get("LOGIN_FAILED_ATTEMPTS"));
return false;
}
$result = UserModel::getUserByName($userName);
if (!$result) {
self::incrementUserFailedLoginCount();
Session::push("feedback-negative", Text::get("USERNAME_OR_PASSWORD_WRONG"));
return false;
}
if ($result->user_failed_logins >= 3 && $result->user_last_failed_login > time() - 30) {
Session::push('feedback_negative', Text::get('PASSWORD_WRONG_ATTEMPTS'));
return false;
}
if (!password_verify($userPassword, $result->user_password_hash)) {
self::incrementUserFailedLoginCountInDb($result->user_name);
Session::push('feedback_negative', Text::get('USERNAME_OR_PASSWORD_WRONG'));
return false;
}
self::resetUserFailedLoginCount();
return $result;
}