当前位置: 首页>>代码示例>>PHP>>正文


PHP ascii_to_entities函数代码示例

本文整理汇总了PHP中ascii_to_entities函数的典型用法代码示例。如果您正苦于以下问题:PHP ascii_to_entities函数的具体用法?PHP ascii_to_entities怎么用?PHP ascii_to_entities使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ascii_to_entities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_ascii_to_entities

 public function test_ascii_to_entities()
 {
     $strs = array('“‘ “test”' => '“‘ “test”', '†¥¨ˆøåß∂ƒ©˙∆˚¬' => '†¥¨ˆøåß∂ƒ©˙∆˚¬');
     foreach ($strs as $str => $expect) {
         $this->assertEquals($expect, ascii_to_entities($str));
     }
 }
开发者ID:rishikeshwalawalkar,项目名称:GetARide,代码行数:7,代码来源:text_helper_test.php

示例2: editService

 public function editService($id = 0)
 {
     // Xử lý dấu tiếng việt cho đường link
     $slug = $this->input->post('service_name');
     $slug = mb_strtolower(url_title(removesign($slug)));
     $data = array('service_name' => ascii_to_entities($this->input->post('service_name')), 'status' => $this->input->post('status'), 'online' => $this->input->post('online'), 'coquan' => ascii_to_entities($this->input->post('coquan')), 'trinhtu' => ascii_to_entities($this->input->post('trinhtu')), 'cachthuc' => ascii_to_entities($this->input->post('cachthuc')), 'doituong' => ascii_to_entities($this->input->post('doituong')), 'thoihan' => ascii_to_entities($this->input->post('thoihan')), 'lephi' => ascii_to_entities($this->input->post('lephi')), 'ketqua' => ascii_to_entities($this->input->post('ketqua')), 'donmau' => ascii_to_entities($this->input->post('donmau')), 'profile' => ascii_to_entities($this->input->post('profile')), 'profile_quantity' => ascii_to_entities($this->input->post('profile_quantity')), 'yeucau' => ascii_to_entities($this->input->post('yeucau')), 'cancuphaply' => ascii_to_entities($this->input->post('cancuphaply')), 'slug' => $slug, 'field_id' => $this->input->post('field_id'), 'staff_id' => $this->session->userdata('staff_id'));
     return $this->db->update('service', $data, array('service_id' => $id));
 }
开发者ID:nghiadd,项目名称:publicservice,代码行数:8,代码来源:service_model.php

示例3: index

 public function index()
 {
     $str = "chứng minh";
     $str = strtolower($str);
     $str = ascii_to_entities($str);
     $query = $this->db->get('service');
     $result = $query->result_array();
     foreach ($result as $item) {
         $str_data = strtolower($item['service_name']);
         if (preg_match('/' . $str . '/', $str_data, $matches)) {
             echo $item['service_id'];
             echo $matches[0] . "<br />";
         }
     }
 }
开发者ID:nghiadd,项目名称:publicservice,代码行数:15,代码来源:test.php

示例4: edit

 public function edit($id = 0)
 {
     $this->load->helper('text');
     if (isset($_POST['submit']) && !empty($_POST['submit'])) {
         $agency_name = $this->input->post('agency_name');
         $agency_name = ascii_to_entities($agency_name);
         $this->agency_model->editAgency($id, $agency_name);
         redirect('./admin/agency');
     } else {
         $data['title'] = "Thêm cơ quan";
         $data['base'] = $this->base;
         // Lưu đường dẫn cơ bản, tên của các file css
         $data['resetcss'] = $this->resetcss;
         $data['admincss'] = $this->admincss;
         $result = $this->agency_model->getAgencyById($id);
         $data['row'] = $result;
         // Gọi các template
         $this->load->view('admin/templates/header', $data);
         $this->load->view('admin/templates/sidebar', $data);
         $this->load->view('admin/agency/edit', $data);
         $this->load->view('admin/templates/footer', $data);
     }
 }
开发者ID:nghiadd,项目名称:publicservice,代码行数:23,代码来源:agency.php

示例5: editPost

 /**
  * Edit Post
  *
  * @access	public
  * @param	parameter list
  * @return	void
  */
 function editPost($plist)
 {
     $this->EE->load->library('xmlrpc');
     $parameters = $plist->output_parameters();
     if (!$this->fetch_member_data($parameters['2'], $parameters['3'])) {
         return $this->EE->xmlrpc->send_error_message('802', $this->EE->lang->line('invalid_access'));
     }
     if (!$this->userdata['can_access_content']) {
         return $this->EE->xmlrpc->send_error_message('802', $this->EE->lang->line('invalid_access'));
     }
     if (!$this->userdata['can_edit_other_entries']) {
         // If there aren't any channels assigned to the user, bail out
         if (count($this->userdata['allowed_channels']) == 0) {
             return $this->EE->xmlrpc->send_error_message('802', $this->EE->lang->line('invalid_access'));
         }
     }
     /** ---------------------------------------
     		/**  Details from Parameters
     		/** ---------------------------------------*/
     $entry_id = $parameters['1'];
     $this->status = $parameters['5'] == '0' ? 'closed' : 'open';
     $sticky = 'n';
     /** ---------------------------------------
     		/**  Retrieve Entry Information
     		/** ---------------------------------------*/
     $this->EE->db->select('channel_id, author_id, title');
     $this->EE->db->where('entry_id', $entry_id);
     $query = $this->EE->db->get('channel_titles');
     if ($query->num_rows() == 0) {
         return $this->EE->xmlrpc->send_error_message('802', $this->EE->lang->line('no_entry_found'));
     }
     if (!$this->userdata['can_edit_other_entries']) {
         if ($query->row('author_id') != $this->userdata['member_id']) {
             return $this->EE->xmlrpc->send_error_message('802', $this->EE->lang->line('entry_uneditable'));
         }
     }
     $this->channel_id = $query->row('channel_id');
     $this->title = $query->row('title');
     $this->parse_channel($this->channel_id);
     /** ---------------------------------------
     		/**  Parse Channel Meta-Information
     		/** ---------------------------------------*/
     // using entities because of <title> conversion by xss_clean()
     if (preg_match('/&lt;title&gt;(.+?)&lt;\\/title&gt;/is', $parameters['4'], $matches)) {
         // Load the text helper
         $this->EE->load->helper('text');
         $this->title = $this->EE->config->item('auto_convert_high_ascii') == 'y' ? ascii_to_entities(trim($matches['1'])) : $matches['1'];
         $parameters['4'] = str_replace($matches['0'], '', $parameters['4']);
     }
     if (preg_match('/<category>(.*?)<\\/category>/is', $parameters['4'], $matches)) {
         $this->categories = trim($matches['1']);
         $parameters['4'] = str_replace($matches['0'], '', $parameters['4']);
         if ($this->categories != '') {
             $this->check_categories($this->channel_id, '1');
         }
     }
     if (preg_match('/<sticky>(.+?)<\\/sticky>/is', $parameters['4'], $matches)) {
         $sticky = (trim($matches['1']) == 'yes' or trim($matches['1']) == 'y') ? 'y' : 'n';
         $parameters['4'] = str_replace($matches['0'], '', $parameters['4']);
     }
     /** ---------------------------------
     		/**  Build our query string
     		/** ---------------------------------*/
     $metadata = array('entry_id' => $entry_id, 'title' => $this->title, 'ip_address' => $this->EE->input->ip_address(), 'sticky' => $sticky, 'status' => $this->status);
     /** ---------------------------------------
     		/**  Parse Channel Field Data
     		/** ---------------------------------------*/
     $entrydata = array('channel_id' => $this->channel_id);
     if (count($this->fields) > 0) {
         foreach ($this->fields as $field_id => $afield) {
             if ($this->block_entry === TRUE) {
                 // Empty all fields.  Default field will be set with all
                 // content.
                 $entry_data['field_id_' . $field_id] = '';
                 $entry_data['field_ft_' . $field_id] = $afield['1'];
             } elseif (preg_match('/<' . $afield['0'] . '>(.*?)<\\/' . $afield['0'] . '>/is', $parameters['4'], $matches)) {
                 if (!isset($entry_data['field_id_' . $field_id])) {
                     $entry_data['field_id_' . $field_id] = $matches['1'];
                     $entry_data['field_ft_' . $field_id] = $afield['1'];
                 } else {
                     $entry_data['field_id_' . $field_id] .= "\n" . $matches['1'];
                 }
                 $parameters['4'] = trim(str_replace($matches['0'], '', $parameters['4']));
             }
         }
     }
     // Default Field for Remaining Content
     if (trim($parameters['4']) != '' && count($this->fields) > 0) {
         if (!isset($entry_data[$this->field])) {
             $entry_data['field_id_' . $this->field] = trim($parameters['4']);
             $entry_data['field_ft_' . $this->field] = $this->fields[$this->field]['1'];
         } else {
             $entry_data[$this->field] .= $this->block_entry === TRUE ? trim($parameters['4']) : "\n" . trim($parameters['4']);
//.........这里部分代码省略.........
开发者ID:rmdort,项目名称:adiee,代码行数:101,代码来源:mod.blogger_api.php

示例6: process_string_as_template

 /**
  * Process Template
  *
  * @access	public
  * @param	string
  * @param	string
  * @param	bool
  * @param	string|integer
  * @return	null
  */
 public function process_string_as_template($str)
 {
     // --------------------------------------------
     //  Solves the problem of redirect links (?URL=)
     //  being added by Typography in a CP request
     // --------------------------------------------
     if (REQ == 'CP') {
         $this->old_get = isset($_GET['M']) ? $_GET['M'] : '';
         $_GET['M'] = 'send_email';
     }
     // standardize newlines
     $str = preg_replace("/(\r\n)|(\r)|(\n)/", "\n", $str);
     ee()->load->helper('text');
     // convert high ascii
     $str = ee()->config->item('auto_convert_high_ascii') == 'y' ? ascii_to_entities($str) : $str;
     // -------------------------------------
     //  Prepare for Processing
     // -------------------------------------
     //need to make sure this isn't run as static or cached
     $this->template_type = 'webpage';
     $this->cache_status = 'NO_CACHE';
     //restore_xml_declaration gets calls in parse_globals
     $this->template = $this->convert_xml_declaration($this->remove_ee_comments($str));
     $this->log_item("Template Type: " . $this->template_type);
     // -------------------------------------`
     //	add our globals to global vars
     // -------------------------------------
     $this->log_item("Solspace globals added (Keys): " . implode('|', array_keys($this->global_vars)));
     $this->log_item("Solspace globals added (Values): " . trim(implode('|', $this->global_vars)));
     ee()->config->_global_vars = array_merge(ee()->config->_global_vars, $this->global_vars);
     $this->parse($str, false, ee()->config->item('site_id'));
     if (REQ == 'CP') {
         $_GET['M'] = $this->old_get;
     }
     // -------------------------------------------
     // 'template_post_parse' hook.
     //  - Modify template after tag parsing
     //
     if (ee()->extensions->active_hook('template_post_parse') === TRUE) {
         $this->final_template = ee()->extensions->call('template_post_parse', $this->final_template, false, ee()->config->item('site_id'));
     }
     //
     // -------------------------------------------
     // --------------------------------------------
     //  Finish with Global Vars and Return!
     // --------------------------------------------
     return $this->parse_globals($this->final_template);
 }
开发者ID:realfluid,项目名称:umbaugh,代码行数:58,代码来源:parser.addon_builder.php

示例7: _table_datasource

 /**
  * Edit table datasource
  *
  * Must remain public so that it can be called from the
  * table library!
  *
  * @access	public
  */
 public function _table_datasource($tbl_settings, $defaults)
 {
     // Get filter information
     // ----------------------------------------------------------------
     $keywords = (string) $this->input->post('keywords');
     $channel_id = (string) $this->input->get_post('channel_id');
     if ($channel_id == 'null') {
         $channel_id = NULL;
     }
     if (!$keywords) {
         $keywords = (string) $this->input->get('keywords');
         if ($keywords) {
             $keywords = base64_decode($keywords);
         }
     }
     if ($keywords) {
         $this->load->helper('search');
         $keywords = sanitize_search_terms($keywords);
         if (substr(strtolower($keywords), 0, 3) == 'ip:') {
             $keywords = str_replace('_', '.', $keywords);
         }
     }
     // Because of the auto convert we prepare a specific variable with the converted ascii
     // characters while leaving the $keywords variable intact for display and URL purposes
     $this->load->helper('text');
     $search_keywords = $this->config->item('auto_convert_high_ascii') == 'y' ? ascii_to_entities($keywords) : $keywords;
     $perpage = $this->input->get_post('perpage');
     $perpage = $perpage ? $perpage : $defaults['perpage'];
     $rownum = $tbl_settings['offset'];
     // We want the filter to work based on both get and post
     $filter_data = array('channel_id' => $channel_id, 'keywords' => $keywords, 'cat_id' => $this->input->get_post('cat_id'), 'status' => $this->input->get_post('status'), 'order' => $this->input->get_post('order'), 'date_range' => $this->input->get_post('date_range'), 'author_id' => $this->input->get_post('author_id'), 'exact_match' => $this->input->get_post('exact_match'), 'cat_id' => $this->input->get_post('cat_id') != 'all' ? $this->input->get_post('cat_id') : '', 'search_in' => $this->input->get_post('search_in') ? $this->input->get_post('search_in') : 'title', 'rownum' => $rownum, 'perpage' => $perpage, 'search_keywords' => $search_keywords);
     $channels = $defaults['channels'];
     $order = $tbl_settings['sort'];
     $columns = $tbl_settings['columns'];
     // -------------------------------------------
     // 'edit_entries_additional_where' hook.
     //  - Add additional where, where_in, where_not_in
     //
     $_hook_wheres = $this->extensions->call('edit_entries_additional_where', $filter_data);
     if ($this->extensions->end_script === TRUE) {
         return;
     }
     //
     // -------------------------------------------
     $filter_data['_hook_wheres'] = is_array($_hook_wheres) ? $_hook_wheres : array();
     $this->load->model('search_model');
     $filter_result = $this->search_model->get_filtered_entries($filter_data, $order);
     $rows = $filter_result['results'];
     $total = $filter_result['total_count'];
     unset($filter_result);
     $filter_url = $this->_create_return_filter($filter_data);
     // Gather up ids for a single quick query down the line
     $entry_ids = array();
     foreach ($rows as $row) {
         $entry_ids[] = $row['entry_id'];
     }
     // Load the site's templates
     // ----------------------------------------------------------------
     $templates = array();
     $tquery = $this->db->query("SELECT exp_template_groups.group_name, exp_templates.template_name, exp_templates.template_id\n\t\t\t\t\t\t\tFROM exp_template_groups, exp_templates\n\t\t\t\t\t\t\tWHERE exp_template_groups.group_id = exp_templates.group_id\n\t\t\t\t\t\t\tAND exp_templates.site_id = '" . $this->db->escape_str($this->config->item('site_id')) . "'");
     foreach ($tquery->result_array() as $row) {
         $templates[$row['template_id']] = $row['group_name'] . '/' . $row['template_name'];
     }
     // Comment count
     // ----------------------------------------------------------------
     $show_link = TRUE;
     $comment_counts = array();
     if (count($entry_ids) and $this->db->table_exists('comments')) {
         $comment_qry = $this->db->select('entry_id, COUNT(*) as count')->where_in('entry_id', $entry_ids)->group_by('entry_id')->get('comments');
         foreach ($comment_qry->result() as $row) {
             $comment_counts[$row->entry_id] = $row->count;
         }
     }
     // Date formatting
     $date_fmt = $this->session->userdata('time_format') != '' ? $this->session->userdata('time_format') : $this->config->item('time_format');
     $datestr = '%m/%d/%y %h:%i %a';
     if ($date_fmt != 'us') {
         $datestr = '%Y-%m-%d %H:%i';
     }
     // Autosave - Grab all autosaved entries
     // ----------------------------------------------------------------
     $this->prune_autosave();
     $this->db->select('entry_id, original_entry_id, channel_id, title, author_id, status, entry_date, dst_enabled, comment_total');
     $autosave = $this->db->get('channel_entries_autosave');
     $autosave_array = array();
     $autosave_show = FALSE;
     if ($autosave->num_rows()) {
         $this->load->helper('snippets');
         $autosave_show = TRUE;
     }
     foreach ($autosave->result() as $entry) {
         if ($entry->original_entry_id) {
//.........这里部分代码省略.........
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:101,代码来源:content_edit.php

示例8: _clean_str

 /**
  * Clean Tag String
  *
  * @access	private
  * @param	string
  * @return	string
  */
 private function _clean_str($str = '')
 {
     $this->EE->load->helper('text');
     if ($this->EE->config->item('auto_convert_high_ascii') == 'y') {
         $str = ascii_to_entities($str);
     }
     return $this->EE->security->xss_clean($str);
 }
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:15,代码来源:mcp.user.php

示例9: generate_csv

function generate_csv($req, $entete)
{
    //	$dbconn = pg_connect(CONFIG_DB) or die('Connexion impossible : ' . pg_last_error());
    $result = gquery($req);
    // pg_query($req) or die('Échec de la requête : ' . pg_last_error());
    $data = array();
    $i = 0;
    while ($ligne = pg_fetch_array($result, NULL, PGSQL_NUM)) {
        $data[$i] = $ligne;
        foreach ($data[$i] as &$a) {
            $a = ascii_to_entities($a);
        }
        $i = $i + 1;
    }
    //$data = flipDiagonally($data);
    //pg_close($dbconn);
    header('Content-Encoding: UTF-8');
    header("Content-type: text/csv; charset=UTF-8");
    header("Content-Disposition: attachment; filename=file.csv");
    header("Pragma: no-cache");
    header("Expires: 0");
    $content = json_encode($data, JSON_NUMERIC_CHECK);
    $content = str_replace('],[', "\n", $content);
    $content = str_replace(',', ';', $content);
    $content = str_replace('[', '', $content);
    $content = str_replace(']', '', $content);
    echo html_entity_decode(ascii_to_entities($entete)) . "\n" . html_entity_decode($content);
}
开发者ID:pierreleplatois,项目名称:sialab,代码行数:28,代码来源:jsonp.php

示例10: _array_ascii_to_entities

 /**
  * ASCII to Entities
  */
 function _array_ascii_to_entities($vals)
 {
     if (is_array($vals)) {
         foreach ($vals as &$val) {
             $val = FF2EE2::_array_ascii_to_entities($val);
         }
     } else {
         get_instance()->load->helper('text');
         $vals = ascii_to_entities($vals);
     }
     return $vals;
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:15,代码来源:ff2ee2.php

示例11: _recursive_ascii_to_entities

 /**
  * Recursive ASCII to entities.
  *
  * This is a helper method used for Arrays POSTed, a la Matrix
  *
  * @param 	array
  * @return 	array
  */
 function _recursive_ascii_to_entities($arr)
 {
     $result = array();
     foreach ($arr as $key => $value) {
         if (is_array($value)) {
             $result[$key] = $this->_recursive_ascii_to_entities($value);
         } else {
             $result[$key] = ascii_to_entities($value);
         }
     }
     return $result;
 }
开发者ID:rmdort,项目名称:adiee,代码行数:20,代码来源:Api_channel_entries.php

示例12: datepicker_js

 /**
  * Datepicker Javascript
  *
  * @param	bool	allows the turning off of some options for 2.x
  * @return	string
  */
 public function datepicker_js($include_jqui = TRUE)
 {
     ee()->load->helper('text');
     $output = '';
     $app_ver = substr((string) APP_VER, 0, 1);
     $output .= "\n\t\t\t<script type='text/javascript'>\n\t\t\t\tvar SSCalendar\t\t\t\t\t= {};\n\t\t\t\tSSCalendar.version\t\t\t\t= {$app_ver};\n\t\t\t\tSSCalendar.dateFormat\t\t\t= 'DATEFORMAT';\n\t\t\t\tSSCalendar.firstDay\t\t\t\t= FIRSTDAY;\n\t\t\t\tSSCalendar.dateFormatSettings\t= {\n\t\t\t\t\tdayNamesMin\t\t: [DAYNAMESMIN],\n\t\t\t\t\tdayNamesShort\t: [DAYNAMESSHORT],\n\t\t\t\t\tdayNames\t\t: [DAYNAMESLONG],\n\t\t\t\t\tmonthNamesShort\t: [MONTHNAMESSHORT],\n\t\t\t\t\tmonthNames\t\t: [MONTHNAMESLONG]\n\t\t\t\t};\n\t\t\t\tSSCalendar.lang\t\t\t\t= {\n\t\t\t\t\t[LANG]\n\t\t\t\t};\n\t\t\t\t// if there is not a default_entry_title set\n\t\t\t\t// when you insert entries into exp_channels\n\t\t\t\t// it defaults to NULL instead of a blank string\n\t\t\t\t// we fixed it in an update, but this is just in case\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\tif (typeof EE !== 'undefined' &&\n\t\t\t\t\t\ttypeof EE.publish !== 'undefined' &&\n\t\t\t\t\t\t( typeof EE.publish.default_entry_title !== 'undefined' ||\n\t\t\t\t\t\t  ! EE.publish.default_entry_title )\n\t\t\t\t\t)\n\t\t\t\t\t{\n\t\t\t\t\t\tEE.publish.default_entry_title = '';\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t</script>";
     if ($include_jqui and (REQ == 'PAGE' or APP_VER < 2.0)) {
         $output .= "\n<script type='text/javascript' src='" . $this->sc->addon_theme_url . "js/ui.datepicker.js'></script>";
     } else {
         if (APP_VER >= 2.0 and REQ == 'CP' and isset(ee()->cp)) {
             ee()->load->library('javascript');
             ee()->cp->add_js_script(array('ui' => 'datepicker'));
         }
     }
     $publish_js = "\n<script type='text/javascript' src='" . $this->sc->addon_theme_url . "js/calendar_publish.js'></script>";
     if (APP_VER >= 2.0 and REQ == 'CP') {
         ee()->cp->add_to_head($publish_js);
     } else {
         $output .= $publish_js;
     }
     $daynamesmin = $daynamesshort = $daynameslong = $monthnamesshort = $monthnameslong = array();
     for ($i = 0; $i < 7; $i++) {
         $daynamesmin[] = ascii_to_entities(lang('day_' . $i . '_2'));
         $daynamesshort[] = ascii_to_entities(lang('day_' . $i . '_3'));
         $daynameslong[] = ascii_to_entities(lang('day_' . $i . '_full'));
     }
     for ($i = 1; $i <= 12; $i++) {
         $monthnamesshort[] = ascii_to_entities(lang('month_' . $i . '_3'));
         $monthnameslong[] = ascii_to_entities(lang('month_' . $i . '_full'));
     }
     $find = array('DATEFORMAT', 'DAYNAMESMIN', 'DAYNAMESSHORT', 'DAYNAMESLONG', 'MONTHNAMESSHORT', 'MONTHNAMESLONG', 'FIRSTDAY');
     $replace = array($this->data->preference('date_format'), "'" . implode("', '", $daynamesmin) . "'", "'" . implode("', '", $daynamesshort) . "'", "'" . implode("', '", $daynameslong) . "'", "'" . implode("', '", $monthnamesshort) . "'", "'" . implode("', '", $monthnameslong) . "'", $this->data->preference('first_day_of_week'));
     $output = str_replace($find, $replace, $output);
     $find = array('type' => lang('type'), 'include' => lang('include'), 'exclude' => lang('exclude'), 'repeat' => lang('repeat'), 'none' => lang('none'), 'daily' => lang('daily'), 'weekly' => lang('weekly'), 'monthly' => lang('monthly'), 'yearly' => lang('yearly'), 'select_dates' => lang('select_dates'), 'all_day_event' => lang('all_day_event'), 'from' => lang('from'), 'to' => lang('to'), 'every' => lang('every'), 'day_s' => lang('day_s'), 'week_s_on' => lang('week_s_on'), 'at' => lang('at'), 'month_s_by_day_of' => lang('month_s_by_day_of'), 'x1st' => lang('1st'), 'x2nd' => lang('2nd'), 'x3rd' => lang('3rd'), 'x4th' => lang('4th'), 'x5th' => lang('5th'), 'only_on' => lang('only_on'), 'year_s' => lang('year_s'), 'end' => lang('end'), 'never' => lang('never'), 'by_date' => lang('by_date'), 'after' => lang('after'), 'time_s' => lang('time_s'), 'am' => lang('AM'), 'pm' => lang('PM'), 'day_1_3' => lang('day_1_3'), 'day_2_3' => lang('day_2_3'), 'day_3_3' => lang('day_3_3'), 'day_4_3' => lang('day_4_3'), 'day_5_3' => lang('day_5_3'), 'day_6_3' => lang('day_6_3'), 'day_0_3' => lang('day_0_3'), 'today' => lang('today'), 'yesterday' => lang('yesterday'), 'tomorrow' => lang('tomorrow'), 'day' => lang('day'), 'week' => lang('week'), 'month' => lang('month'), 'year' => lang('year'), 'ago' => lang('ago'), 'begin' => lang('begin'), 'last' => lang('last'));
     $lang = '';
     foreach ($find as $k => $v) {
         $lang .= "'{$k}': '" . ascii_to_entities(addslashes($v)) . "',\n";
     }
     $lang = substr($lang, 0, strlen($lang) - 2) . "\n";
     $output = str_replace('[LANG]', $lang, $output);
     return $output;
 }
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:48,代码来源:act.calendar.php

示例13: post_entry

 /**
  * 	Post Entry 
  */
 function post_entry()
 {
     // Default Channel Data
     $channel_id = $this->moblog_array['moblog_channel_id'];
     $this->EE->db->select('site_id, channel_title, channel_url, rss_url, comment_url, deft_comments, cat_group, field_group, channel_notify, channel_notify_emails');
     $query = $this->EE->db->get_where('channels', array('channel_id' => $channel_id));
     if ($query->num_rows() == 0) {
         $this->message_array[] = 'invalid_channel';
         // How the hell did this happen?
         return FALSE;
     }
     $site_id = $query->row('site_id');
     $notify_address = ($query->row('channel_notify') == 'y' and $query->row('channel_notify_emails') != '') ? $query->row('channel_notify_emails') : '';
     // Collect the meta data
     $this->post_data['subject'] = strip_tags($this->post_data['subject']);
     $this->moblog_array['moblog_author_id'] = $this->moblog_array['moblog_author_id'] == 'none' ? '1' : $this->moblog_array['moblog_author_id'];
     $author_id = $this->author != '' ? $this->author : $this->moblog_array['moblog_author_id'];
     if (!is_numeric($author_id) or $author_id == '0') {
         $author_id = '1';
     }
     // Load the text helper
     $this->EE->load->helper('text');
     $entry_date = $this->EE->localize->now + $this->entries_added - $this->time_offset;
     $data = array('channel_id' => $channel_id, 'site_id' => $site_id, 'author_id' => $author_id, 'title' => $this->EE->config->item('auto_convert_high_ascii') == 'y' ? ascii_to_entities($this->post_data['subject']) : $this->post_data['subject'], 'ip_address' => $this->post_data['ip'], 'entry_date' => $entry_date, 'edit_date' => gmdate("YmdHis", $entry_date), 'year' => gmdate('Y', $entry_date), 'month' => gmdate('m', $entry_date), 'day' => gmdate('d', $entry_date), 'sticky' => isset($this->post_data['sticky']) ? $this->post_data['sticky'] : $this->sticky, 'status' => $this->post_data['status'] == 'none' ? 'open' : $this->post_data['status'], 'allow_comments' => $query->row('deft_comments'));
     // Remove ignore text
     $this->body = preg_replace("#<img\\s+src=\\s*[\"']cid:(.*?)\\>#si", '', $this->body);
     // embedded images
     $this->moblog_array['moblog_ignore_text'] = $this->remove_newlines($this->moblog_array['moblog_ignore_text'], $this->newline);
     // One biggo chunk
     if ($this->moblog_array['moblog_ignore_text'] != '' && stristr($this->body, $this->moblog_array['moblog_ignore_text']) !== FALSE) {
         $this->body = str_replace($this->moblog_array['moblog_ignore_text'], '', $this->body);
     } elseif ($this->moblog_array['moblog_ignore_text'] != '') {
         // By line
         $delete_text = $this->remove_newlines($this->moblog_array['moblog_ignore_text'], $this->newline);
         $delete_array = explode($this->newline, $delete_text);
         if (count($delete_array) > 0) {
             foreach ($delete_array as $ignore) {
                 if (trim($ignore) != '') {
                     $this->body = str_replace(trim($ignore), '', $this->body);
                 }
             }
         }
     }
     /** -------------------------------------
     		/**  Specified Fields for Email Text
     		/** -------------------------------------*/
     if (preg_match_all("/[\\<\\{]field\\:(.*?)[\\}\\>](.*?)[\\<\\{]\\/field\\:(.*?)[\\}\\>]/", $this->body, $matches)) {
         $this->EE->db->select('channel_fields.field_id, channel_fields.field_name, channel_fields.field_label, channel_fields.field_fmt');
         $this->EE->db->from('channels, channel_fields');
         $this->EE->db->where('channels.field_group = ' . $this->EE->db->dbprefix('channel_fields') . '.group_id', NULL, FALSE);
         $this->EE->db->where('channels.channel_id', $this->moblog_array['moblog_channel_id']);
         /* -------------------------------------
         			/*  Hidden Configuration Variable
         			/*  - moblog_allow_nontextareas => Removes the textarea only restriction
         			/*	for custom fields in the moblog module (y/n)
         			/* -------------------------------------*/
         if ($this->EE->config->item('moblog_allow_nontextareas') != 'y') {
             $this->EE->db->where('channel_fields.field_type', 'textarea');
         }
         $results = $this->EE->db->get();
         if ($results->num_rows() > 0) {
             $field_name = array();
             $field_label = array();
             $field_format = array();
             foreach ($results->result_array() as $row) {
                 $field_name[$row['field_id']] = $row['field_name'];
                 $field_label[$row['field_id']] = $row['field_label'];
                 $field_format[$row['field_id']] = $row['field_fmt'];
             }
             unset($results);
             for ($i = 0; $i < count($matches[0]); $i++) {
                 $x = preg_split("/[\\s]+/", $matches['1'][$i]);
                 if ($key = array_search($x['0'], $field_name) or $key = array_search($x['0'], $field_label)) {
                     $format = (!isset($x['1']) or !stristr($x['1'], "format")) ? $field_format[$key] : preg_replace("/format\\=[\"\\'](.*?)[\\'\"]/", "\$1", trim($x['1']));
                     $matches['2'][$i] = str_replace($this->newline, "\n", $matches['2'][$i]);
                     if (!isset($this->entry_data[$key])) {
                         $this->entry_data[$key] = array('data' => $matches['2'][$i], 'format' => $format);
                     } else {
                         $this->entry_data[$key] = array('data' => $matches['2'][$i] . $this->entry_data[$key]['data'], 'format' => $format);
                     }
                     $this->body = str_replace($matches['0'][$i], '', $this->body);
                 }
             }
         }
     }
     // Return New Lines
     $this->body = str_replace($this->newline, "\n", $this->body);
     // Parse template
     $tag = 'field';
     if (!preg_match_all("/" . LD . $tag . "(.*?)" . RD . "(.*?)" . LD . '\\/' . $tag . RD . "/s", $this->template, $matches)) {
         $this->parse_field($this->moblog_array['moblog_field_id'], $this->template, $query->row('field_group'));
     } else {
         for ($i = 0; $i < count($matches['0']); $i++) {
             $params = $this->assign_parameters($matches['1'][$i]);
             $params['format'] = !isset($params['format']) ? '' : $params['format'];
             $params['name'] = !isset($params['name']) ? '' : $params['name'];
             $this->parse_field($params, $matches['2'][$i], $query->row('field_group'));
//.........这里部分代码省略.........
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:101,代码来源:mod.moblog.php

示例14: text_helper

 public function text_helper()
 {
     $this->load->helper('text');
     $string = "Here is a nice text string consisting of eleven words.";
     $string = word_limiter($string, 4, "...");
     $this->htmlp($string);
     $string = "Here is a nice text string consisting of eleven words.";
     $string = character_limiter($string, 20, "...");
     $this->htmlp($string);
     $string = ascii_to_entities($string);
     $this->htmlp($string);
     $string = convert_accented_characters($string);
     $this->htmlp($string);
     $string = "darn shit sucks dinner";
     $disallowed = array('darn', 'shucks', 'golly', 'phooey');
     $string = word_censor($string, $disallowed, 'Beep!');
     $this->htmlp($string);
     $string = highlight_code($string);
     $this->htmlp($string);
     $string = "Here is a nice text string about nothing in particular.";
     $this->htmlp(highlight_phrase($string, "nice text", '<span style="color:#990000;">', '</span>'));
     $string = "Here is a simple string of text that will help us demonstrate this function.";
     $this->htmlp(word_wrap($string, 25));
     $str = 'this_string_is_entirely_too_long_and_might_break_my_design.jpg';
     $this->htmlp(ellipsize($str, 32, 0.5));
 }
开发者ID:jaffarsolo,项目名称:ci3-examples,代码行数:26,代码来源:Helpers.php

示例15: process_string_as_template

 /**
  * Process Template
  *
  * @access	public
  * @param	string
  * @param	string
  * @param	bool
  * @param	string|integer
  * @return	null
  */
 public function process_string_as_template($str)
 {
     // standardize newlines
     $str = preg_replace("/(\r\n)|(\r)|(\n)/", "\n", $str);
     ee()->load->helper('text');
     // convert high ascii
     $str = ee()->config->item('auto_convert_high_ascii') == 'y' ? ascii_to_entities($str) : $str;
     // -------------------------------------
     //  Prepare for Processing
     // -------------------------------------
     $this->template_type = 'webpage';
     $this->template = $this->convert_xml_declaration($this->remove_ee_comments($str));
     $this->log_item("Template Type: " . $this->template_type);
     // --------------------------------------------------
     //  Parse 'Site' variables
     // --------------------------------------------------
     $this->log_item("Parsing Site Variables");
     foreach (array('site_id', 'site_label', 'site_short_name') as $site_var) {
         $this->global_vars[$site_var] = stripslashes(ee()->config->item($site_var));
     }
     // Parse {last_segment} variable
     $seg_array = ee()->uri->segment_array();
     ee()->config->_global_vars['last_segment'] = end($seg_array);
     // --------------------------------------------
     //  Parse Global Vars - EE 2.x
     // --------------------------------------------
     $this->log_item("Snippets (Keys): " . implode('|', array_keys(ee()->config->_global_vars)));
     $this->log_item("Snippets (Values): " . trim(implode('|', ee()->config->_global_vars)));
     foreach (ee()->config->_global_vars as $key => $val) {
         $this->template = str_replace(LD . $key . RD, $val, $this->template);
     }
     // in case any of these variables have EE comments of their own
     $this->template = $this->remove_ee_comments($this->template);
     // -------------------------------------
     //  Parse Global Vars - Solspace Modules
     //  (which use this for setting own globals)
     // -------------------------------------
     if (count($this->global_vars) > 0) {
         $this->log_item("Global Path.php Variables (Keys): " . implode('|', array_keys($this->global_vars)));
         $this->log_item("Global Path.php Variables (Values): " . trim(implode('|', $this->global_vars)));
         foreach ($this->global_vars as $key => $val) {
             $this->template = str_replace(LD . $key . RD, $val, $this->template);
         }
     }
     // -------------------------------------
     //  Parse URI segments
     // -------------------------------------
     for ($i = 1; $i < 10; $i++) {
         $this->template = str_replace(LD . 'segment_' . $i . RD, ee()->uri->segment($i), $this->template);
         $this->segment_vars['segment_' . $i] = ee()->uri->segment($i);
     }
     /** -------------------------------------
     		/**  Parse date format string "constants"
     		/** -------------------------------------*/
     $date_constants = array('DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%O', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RFC2822' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%Q');
     $this->log_item("Parse Date Format String Constants");
     foreach ($date_constants as $key => $val) {
         $this->template = str_replace(LD . $key . RD, $val, $this->template);
     }
     // --------------------------------------------------
     //  Current time {current_time format="%Y %m %d %H:%i:%s"}
     // --------------------------------------------------
     $this->log_item("Parse Current Time Variables");
     $this->template = str_replace(LD . 'current_time' . RD, ee()->localize->now, $this->template);
     if (strpos($this->template, LD . 'current_time') !== FALSE and preg_match_all("/" . LD . "current_time\\s+format=([\"\\'])([^\\1]*?)\\1" . RD . "/", $this->template, $matches)) {
         for ($j = 0; $j < count($matches['0']); $j++) {
             //EE2.6+ support
             $func = is_callable(array(ee()->localize, 'format_date')) ? 'format_date' : 'decode_date';
             $this->template = preg_replace("/" . preg_quote($matches['0'][$j], '/') . "/", ee()->localize->{$func}($matches['2'][$j], ee()->localize->now), $this->template, 1);
         }
     }
     // --------------------------------------------
     //  Remove White Space from Variables
     //		- Prevents errors apparently,
     //		particularly when PHP is used in a template.
     // --------------------------------------------
     $this->template = preg_replace("/" . LD . "\\s*(\\S+)\\s*" . RD . "/U", LD . "\\1" . RD, $this->template);
     // -------------------------------------
     //  Parse Input Stage PHP
     // -------------------------------------
     if ($this->parse_php == TRUE and $this->php_parse_location == 'input') {
         $this->log_item("Parsing PHP on Input");
         $this->template = $this->parse_template_php($this->template);
     }
     // -------------------------------------
     //  Smite Our Enemies:  Conditionals
     // -------------------------------------
     $this->log_item("Parsing Segment, Embed, and Global Vars Conditionals");
     $this->template = $this->parse_simple_segment_conditionals($this->template);
     $this->template = $this->simple_conditionals($this->template, $this->embed_vars);
//.........这里部分代码省略.........
开发者ID:exxed,项目名称:NewBlu20,代码行数:101,代码来源:parser.addon_builder.php


注:本文中的ascii_to_entities函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。