本文整理汇总了PHP中text类的典型用法代码示例。如果您正苦于以下问题:PHP text类的具体用法?PHP text怎么用?PHP text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Initialize the products form
*/
public function initialize($entity = null, $options = array())
{
$f = new text("url_base");
$f->setLabel('URL BASE');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new select("ativo", array('1' => 'Sim', '0' => 'Não'));
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new select("manutencao", array('1' => 'Sim', '0' => 'Não'));
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new select("orcamento", array('1' => 'Sim', '0' => 'Não'));
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new select("adicionar_carrinho", array('1' => 'Sim', '0' => 'Não'));
$f->setLabel('Adicionar Carrinho');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("plano");
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new numeric("limite_produtos");
$f->setLabel('Limite de Produtos');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new select("certificado", array('certising' => 'Certising', 'comodo' => 'Comodo', 'norton' => 'Norton', 'rapidssl' => 'Rapid SSL', 'site_blindado' => 'Site Blindado'));
$f->setAttribute('class', 'form-control');
$this->add($f);
}
示例2: initialize
/**
* Initialize the products form
*/
public function initialize($entity = null, $options = array())
{
$f = new text("aws_bucket");
$f->setLabel('AWS Bucket');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("aws_id");
$f->setLabel('AWS ID');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("aws_location");
$f->setLabel('AWS LOCATION');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("aws_secret_key");
$f->setLabel('AWS SECRET KEY');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("facebook_appId");
$f->setLabel('Facebook app id');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("facebook_appSecret");
$f->setLabel('Facebooke app secret');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("sendgrid_username");
$f->setLabel('Sendgrid username');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("sendgrid_password");
$f->setLabel('sendgrid password');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new text("sendgrid_templateId");
$f->setLabel('sendgrid template ID');
$f->setAttribute('class', 'form-control');
$this->add($f);
$f = new TextArea("mapa");
$f->setLabel('Google Maps');
$f->setAttribute('class', 'form-control');
$f->setAttribute('rows', '10');
$this->add($f);
$f = new TextArea("chat");
$f->setLabel('Chat');
$f->setAttribute('class', 'form-control');
$f->setAttribute('rows', '10');
$this->add($f);
}
示例3: reset
public function reset()
{
if ($this->owner->logged_in()) {
url::redirect('/admin/testimonials/display');
}
$login_shell = new View('admin/login_shell');
$login_shell->content = new View('admin/reset');
if (empty($_POST)) {
die($login_shell);
}
$post = new Validation($_POST);
$post->pre_filter('trim');
$post->add_rules('email', 'required', 'valid::email');
# if Post is good, atttempt to log owner in.
if ($post->validate()) {
$owner = ORM::factory('owner')->find($_POST['email']);
if (!$owner->loaded) {
die('email does not have an account');
}
$pw = text::random('alnum', 8);
$owner->password = $pw;
$owner->save();
$replyto = 'unknown';
$body = "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda";
# to do FIX THE HEADERS.
$subject = 'Your Pluspanda Password Has Been Reset =)';
$headers = "From: noreply@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion();
mail($_POST['email'], $subject, $body, $headers);
die('Please check your email for your new password!');
}
# error
$login_shell->content->alert = alerts::display(array('error' => 'Invalid Email or Password.'));
$login_shell->content->values = $_POST;
die($login_shell);
}
示例4: create_token
protected function create_token()
{
// Token will always be 64 chars, as uniqid is 13 chars
$unique = uniqid();
$hard_to_guess = text::random('alnum', 51);
return $unique . $hard_to_guess;
}
示例5: __construct
/**
* quickbox::__construct()
*
* @param array $init Initialization configuration
*
* Constructor which basically creates quickbox
* and readies it for doing things.
*/
public function __construct ($init)
{
# We need to include initialize the config class because it allows us to get and
# set configuration variables without using a global
require $init['quickbox/path'] . '/classes/core/config.class.php';
config::init($init);
define(DEBUG, config::get('debug'));
# Start a database connection
$this->db = new database();
try
{
$this->db->init();
} catch (Exception $e)
{
trigger_error(text::get('system/fatalError',$e->getMessage()), E_USER_ERROR);
}
require $init['quickbox/path'] . '/classes/core/metaclass.class.php';
metaclass::init($this->db);
# Put the post and get variables into a private for later use.
$_POST = $_POST;
$this->qbGet = $_GET;
# Start the session, giving it the database connection.
$this->qbSession = new session($this->db);
if ($this->qbGet['page'] == 'logout')
{
$this->qbSession->logout();
}
$this->qbSession->checkCookie();
if (strlen($_POST['user']) > 0 && $_POST['login'] == 1)
{
$this->qbErrors['login'] = $this->qbSession->login($_POST['user'], $_POST['password']);
}
$this->qbPage = ($_GET['page'] ? janitor::cleanData($_GET['page']) : 'home');
}
示例6: login
public function login ($user, $password)
{
$safeUser = janitor::cleanData($user, 'sql');
$query = new query();
$query->select()->from('userUsers')->joinLeft('userGroups', 'userUsers.group', 'id')->where('username', $user)->limit(
'1');
$result = $this->sDb->query($query);
if ($this->sDb->numRows($result) > 0)
{
$row = $this->sDb->assoc($result);
$safePassword = janitor::passwd($password, $row['salt']);
if ($safePassword['passwd'] == $row['password'])
{
$this->user = $user;
$this->userData = $row;
$this->setCookie($user, $row['email']);
$this->setSession($safeUser);
return false;
} else
{
return text::get('login/failedLogin');
}
} else
{
return text::get('login/failedLogin');
}
}
示例7: getUri
private function getUri()
{
self::$URL = $_SERVER['HTTP_HOST'];
// $URI = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['PHP_SELF']);
// var_dump($_SERVER['SCRIPT_NAME'], $_SERVER['PHP_SELF']);
$URI = $_SERVER['REQUEST_URI'];
list(self::$URN) = explode("?", $URI);
// remove '?'
self::$URI = self::$URL . self::$URN;
if (strlen(self::$URN) > 2 && substr(self::$URN, -1, 1) == "/") {
self::$URN = substr(self::$URN, 0, -1);
}
$arr = explode("/", substr(self::$URN, 1));
foreach ($arr as $val) {
self::$URNPart[] = $val;
}
list(self::$URL) = explode(":", self::$URL);
// remove ':' port
$arr = explode(".", self::$URL);
foreach ($arr as $val) {
self::$URLPart[] = $val;
}
self::$subdomain = implode(".", array_slice(self::$URLPart, 0, -2));
Log::log(self::CLASSNAME, 'URN: ' . self::$URN);
Log::log(self::CLASSNAME, 'URL: ' . self::$URL);
Log::log(self::CLASSNAME, 'URI: ' . self::$URI);
Log::log(self::CLASSNAME, 'URN parts: ' . text::arrayToString(self::$URNPart, true));
Log::log(self::CLASSNAME, 'URL parts: ' . text::arrayToString(self::$URLPart, true));
Log::log(self::CLASSNAME, 'Subdomain: ' . self::$subdomain);
}
示例8: index
/**
* 列表
*/
public function index()
{
//查询条件
$query_struct = array('orderby' => array('id' => 'DESC'));
/* 搜索 */
$search_arr = array('title', 'content');
$search_type = $this->input->get('search_type');
$search_value = $this->input->get('search_value');
if (!empty($search_value) && in_array($search_type, $search_arr)) {
$query_struct['like'][$search_type] = $search_value;
}
$where_view['search_value'] = $search_value;
//调用分页
$per_page = controller_tool::per_page();
$query_struct['per_page'] = $per_page;
$this->pagination = new Pagination(array('total_items' => Mynotice::instance()->count($query_struct), 'items_per_page' => $per_page));
$query_struct['per_page'] = $this->pagination->sql_offset;
$notice = Mynotice::instance()->lists($query_struct);
foreach ($notice as $k => $v) {
$notice[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30));
$notice[$k]['manager_id'] = Mymanager::instance($v['manager_id'])->get('name');
}
//VIEW
$this->template->content = new View("manage/notice_list");
$this->template->content->notice = $notice;
$this->template->content->where = $where_view;
}
示例9: token
public static function token()
{
if (($token = Session::instance()->get('csrf')) === FALSE) {
Session::instance()->set('csrf', $token = text::random('alnum', 16));
}
return $token;
}
示例10: QPHeader
/**
@function QPHeader
Encodes given string as a quoted printable mail header.
@param str string String to encode
@return string
*/
public static function QPHeader($str, $charset = 'UTF-8')
{
if (!preg_match('/[^\\x00-\\x3C\\x3E-\\x7E]/', $str)) {
return $str;
}
return '=?' . $charset . '?Q?' . text::QPEncode($str) . '?=';
}
示例11: index
/**
* 列表
*/
public function index()
{
$query_struct = array();
/**
* 搜索
*/
$search_value = $this->input->get('search_value');
if ($search_value) {
$query_struct['where']['mail_category_id'] = $search_value;
}
//调用分页
$per_page = controller_tool::per_page();
$this->pagination = new Pagination(array('total_items' => Mymail_template::instance()->count($query_struct), 'items_per_page' => $per_page));
$mail_templates = Mymail_template::instance()->mail_templates($query_struct, array('id' => 'DESC'), $per_page, $this->pagination->sql_offset);
foreach ($mail_templates as $k => $v) {
foreach ($v as $key => $value) {
if (!is_numeric($value) && empty($value)) {
$mail_templates[$k][$key] = 'NULL';
}
}
$mail_templates[$k]['content_small'] = strip_tags(text::limit_words($v['content'], 30));
$mail_templates[$k]['active_img'] = view_tool::get_active_img($v['active']);
}
$mail_categories = Mymail_category::instance()->mail_categories();
$this->template->content = new View("manage/mail_template_list");
$this->template->content->mail_templates = $mail_templates;
$this->template->content->mail_categories = $mail_categories;
}
示例12: save
public function save()
{
if (!$_POST) {
die;
}
$this->rsp = Response::instance();
if (!valid::email($_POST['email'])) {
$this->rsp->msg = 'Invalid Email!';
$this->rsp->send();
} elseif ($this->owner->unique_key_exists($_POST['email'])) {
$this->rsp->msg = 'Email already exists!';
$this->rsp->send();
}
$pw = text::random('alnum', 8);
$this->owner->email = $_POST['email'];
$this->owner->password = $pw;
$this->owner->save();
$replyto = 'unknown';
$body = "Hi there, thanks for saving your progess over at http://pluspanda.com \r\n" . "Your auto-generated password is: {$pw} \r\n" . "Change your password to something more appropriate by going here:\r\n" . "http://pluspanda.com/admin/account?old={$pw} \r\n\n" . "Thank you! - Jade from pluspanda";
# to do FIX THE HEADERS.
$subject = 'Your Pluspanda account information =)';
$headers = "From: welcome@pluspanda.com \r\n" . "Reply-To: Jade \r\n" . 'X-Mailer: PHP/' . phpversion();
mail($_POST['email'], $subject, $body, $headers);
# add to mailing list.
include Kohana::find_file('vendor/mailchimp', 'MCAPI');
$config = Kohana::config('mailchimp');
$mailchimp = new MCAPI($config['apikey']);
$mailchimp->listSubscribe($config['list_id'], $_POST['email'], '', 'text', FALSE, TRUE, TRUE, FALSE);
$this->rsp->status = 'success';
$this->rsp->msg = 'Thanks, Account Saved!';
$this->rsp->send();
}
示例13: cache
/**
* Cache data.
*
* @return void
*/
public static function cache()
{
if (!Profiler::show('cache')) {
return;
}
$queries = Cache::$queries;
$table = new Profiler_Table();
$table->add_column();
$table->add_column('kp-column kp-data');
$table->add_column('kp-column kp-data');
$table->add_column('kp-column kp-data');
$table->add_row(array('Cache', 'Gets', 'Sets', 'Deletes'), 'kp-title', 'background-color: #E0FFE0');
text::alternate();
$total_gets = $total_sets = $total_deletes = 0;
$total_requests = array();
foreach ($queries as $type => $requests) {
foreach ($requests as $query) {
if (!isset($total_requests[$query])) {
$total_requests[$query] = array('gets' => 0, 'sets' => 0, 'deletes' => 0);
}
$total_requests[$query][$type]++;
}
}
foreach ($total_requests as $query => $types) {
$data = array($query, $types['gets'], $types['sets'], $types['deletes']);
$class = text::alternate('', 'kp-altrow');
$table->add_row($data, $class);
$total_gets += $types['gets'];
$total_sets += $types['sets'];
$total_deletes += $types['deletes'];
}
$data = array('Total: ' . count($total_requests), $total_gets, $total_sets, $total_deletes);
$table->add_row($data, 'kp-totalrow');
Profiler::add($table);
}
示例14: generate_challenge
/**
* Generates a new Captcha challenge.
*
* @return string The challenge answer
*/
public function generate_challenge()
{
// Complexity setting is used as character count
$text = text::random('distinct', max(1, Captcha::$config['complexity']));
// Complexity setting is used as character count
return $text;
}
示例15: index
/**
* 分类列表
*/
public function index()
{
//* 权限验证 */
$site_id = site::id();
Myseo_manage::instance()->update_seo_manage_by_site_id($site_id);
if ($site_id == 0) {
remind::set('请首先进入所要操作的站点', request::referrer(), 'error');
}
$site_id_list = role::check('seo_manage', 0, 0);
if (empty($site_id_list)) {
remind::set('access denied', request::referrer(), 'error');
}
$query_struct = array();
$query_struct = array('where' => array('site_id' => $site_id));
$list_columns = array(array('name' => 'ID', 'column' => 'id', 'class_num' => '1'), array('name' => '分类', 'column' => 'parent_id', 'class_num' => '4'), array('name' => '包含子分类', 'column' => 'is_contain_child', 'class_num' => '3'), array('name' => 'Meta Title', 'column' => 'meta_title', 'class_num' => '5'), array('name' => 'Meta Keywords', 'column' => 'meta_keywords', 'class_num' => '5'), array('name' => 'Meta Description', 'column' => 'meta_description', 'class_num' => '6'), array('name' => '发布时间', 'column' => 'create_timestamp', 'class_num' => '5'), array('name' => '更新时间', 'column' => 'update_timestamp', 'class_num' => '5'));
$this->template->content = new View("product/seo_manage_list");
$this->template->content->list_columns = $list_columns;
/**
* 搜索
*/
/*
$search_arr = array('site_domain','site_id');
$search_type = $this->input->get('search_type');
$search_value = $this->input->get('search_value');
if($search_value&&$search_type)
{
if(in_array($search_type,$search_arr))
{
$query_struct['like'][$search_type] = $search_value;
}
}*/
//调用分页
$per_page = controller_tool::per_page();
$this->pagination = new Pagination(array('total_items' => Myseo_manage::instance()->count($query_struct), 'items_per_page' => $per_page));
$orderby = array('update_timestamp' => 'DESC');
$seo_manages = Myseo_manage::instance()->seo_manages($query_struct, $orderby, $per_page, $this->pagination->sql_offset);
$request_category = array('where' => array('site_id' => $site_id), 'like' => array(), 'orderby' => array());
$category = Mycategory::instance()->lists($request_category);
foreach ($category as $val) {
$category_list[$val['id']] = $val;
}
foreach ($seo_manages as $seo_manages_key => $seo_manages_value) {
$seo_manages[$seo_manages_key]['is_contain_child'] = view_tool::get_active_img($seo_manages_value['is_contain_child']);
$seo_manages[$seo_manages_key]['meta_description'] = strip_tags(text::limit_words($seo_manages_value['meta_description'], 50));
$seo_manages[$seo_manages_key]['create_timestamp'] = date('Y-m-d H:i:s', $seo_manages_value['create_timestamp']);
$seo_manages[$seo_manages_key]['update_timestamp'] = date('Y-m-d H:i:s', $seo_manages_value['update_timestamp']);
if ($seo_manages_value['parent_id'] && array_key_exists($seo_manages_value['parent_id'], $category_list)) {
$seo_manages[$seo_manages_key]['parent_id'] = $category_list[$seo_manages_value['parent_id']]['name'];
} else {
$seo_manages[$seo_manages_key]['parent_id'] = '';
}
foreach ($seo_manages_value as $key => $value) {
if (!is_numeric($value) && empty($value)) {
$seo_manages[$seo_manages_key][$key] = "NULL";
}
}
}
$this->template->content->seo_manages = $seo_manages;
}