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


PHP url_title函数代码示例

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


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

示例1: comments

 public function comments($image_id)
 {
     $image = $this->db->select('title')->from('nf_gallery_images')->where('image_id', $image_id)->row();
     if ($image) {
         return array('title' => $image, 'url' => 'gallery/image/' . $image_id . '/' . url_title($image) . '.html');
     }
 }
开发者ID:nsystem1,项目名称:neofrag-cms,代码行数:7,代码来源:gallery.php

示例2: process_post

 /**
  * Process Post
  *
  * Process data that was not part of the 
  * initial streams call.
  *
  * @return 	void
  */
 public function process_post(&$post)
 {
     $this->load->helper('text');
     // Keywords array
     /*$keywords = Keywords::get($post->keywords);
     		$formatted_keywords = array();
     		$keywords_arr = array();
     
     		foreach ($keywords as $key)
     		{
     			$formatted_keywords[] 	= array('keyword' => $key->name);
     			$keywords_arr[] 		= $key->name;
     
     		}
     		$post->keywords = $formatted_keywords;
     		$post->keywords_arr = $keywords_arr;*/
     // Full URL for convenience.
     //$post->url = site_url('kasus/'.date('Y/m/d', $post->created_on).'/'.$post->slug);
     $slug = url_title($post->title, 'dash', TRUE);
     $post->url = site_url('kasus/' . date('Y/m/d', strtotime($post->created_on)) . '/' . $slug);
     // What is the preview? If there is a field called intro,
     // we will use that, otherwise we will cut down the news post itself.
     //$post->preview = (isset($post->intro)) ? $post->intro : $post->body;
     // Category
     /*if ($post->category_id > 0 and isset($this->categories[$post->category_id]))
     		{
     			$post->category = $this->categories[$post->category_id];
     		}*/
 }
开发者ID:blekedeg,项目名称:lbhpers,代码行数:37,代码来源:kasus_m.php

示例3: index

 /**
  * @author : Gede Lumbung
  * @web : http://gedelumbung.com
  **/
 function index($title = "", $uri = 0)
 {
     if ($this->session->userdata('logged_in') != "") {
         $id_param = $this->session->userdata("id_member");
         $d['left_top_menu'] = $this->app_global_web_model->generate_menu("kiri", "nav pull-left");
         $d['right_top_menu'] = $this->app_global_web_model->generate_menu("kanan", "nav pull-right");
         $d['center_bottom_menu'] = $this->app_global_web_model->generate_menu("footer");
         $d['combo_lokasi'] = $this->app_global_web_model->generate_combo_lokasi();
         $d['combo_kategori'] = $this->app_global_web_model->generate_combo_kategori();
         $d['list_kategori'] = $this->app_global_web_model->generate_list_kategori("nav nav-list");
         $d['left_artikel_hot'] = $this->app_global_web_model->generate_front_artikel($_SESSION['site_limit_artikel_hot'], 0, "counter", 1);
         $d['left_iklan_hot'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "counter");
         $d['left_iklan_new'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "id_iklan");
         $where['id_member'] = $id_param;
         $gen_menu = $this->db->get_where("dlmbg_member", $where);
         if ($gen_menu->num_rows() == 0) {
             redirect(base_url());
         }
         $menu_crumb = $gen_menu->row();
         $this->breadcrumb->append_crumb('BERANDA', base_url());
         $this->breadcrumb->append_crumb('DASHBOARD', base_url() . 'user/dashboard');
         $this->breadcrumb->append_crumb(strtoupper($menu_crumb->nama), base_url() . 'web/kategori/get/' . $id_param . '/' . url_title($menu_crumb->nama, '-', TRUE));
         $d['dt_retrieve'] = $this->app_user_web_model->generate_detail_member($id_param, $_SESSION['site_limit_iklan_kategori'], $uri);
         $this->load->view($_SESSION['site_theme'] . '/bg_header', $d);
         $this->load->view($_SESSION['site_theme'] . '/user/dashboard/bg_home');
         $this->load->view($_SESSION['site_theme'] . '/bg_left');
         $this->load->view($_SESSION['site_theme'] . '/bg_footer');
     } else {
         redirect(base_url());
     }
 }
开发者ID:mylinkedshare,项目名称:Advertising,代码行数:35,代码来源:dashboard.php

示例4: thread_notifier

 /**
  * New Comment Notification
  *
  * Javascript calls this every few seconds to check
  * on the existence of new comments
  *
  * @access	public
  * @param	int		thread id
  * @param	int		current number of comments
  * @return	void
  */
 function thread_notifier($thread_id = 0, $current_count = 0)
 {
     // make sure thread_id and current_count are integers
     $thread_id = (int) $thread_id;
     $current_count = (int) $current_count;
     // the typecasting above will convert non-integers to zero
     if ($thread_id === 0 || $current_count === 0) {
         return;
     }
     // find out how many comments are in the thread
     $thread_info = $this->thread_dal->comment_count_info($thread_id);
     $db_count = $thread_info->max_rows;
     // handle JSON, otherwise fail through to HTML output
     if ($this->is_request_json()) {
         return send_json($this->output, 200, array('thread_id' => $thread_id, 'comment_count' => $db_count, 'new_comment_count' => $db_count - $current_count));
     }
     // if the numbers dont match, throw out some html
     if ($db_count > $current_count) {
         // number of new posts
         $new_posts = $db_count - $current_count;
         $title = url_title($thread_info->subject, 'dash', TRUE);
         $shown = $this->session->userdata('comments_shown');
         if (!$shown) {
             $shown = 25;
         }
         $count = (ceil($db_count / $shown) - 1) * $shown;
         echo '<div id="notifier"><a id="notify" href="/thread/' . $thread_id . '/' . $title . '/p/' . $count . '/r' . mt_rand(10000, 99999) . '#bottom">' . $new_posts . ' new post' . ($new_posts === 1 ? '' : 's') . " added</a></div>";
     }
 }
开发者ID:notjosh,项目名称:seaforium,代码行数:40,代码来源:ajax.php

示例5: test_url_title_extra_dashes

 public function test_url_title_extra_dashes()
 {
     $words = array('_foo bar_' => 'foo_bar', '_What\'s wrong with CSS?_' => 'Whats_wrong_with_CSS');
     foreach ($words as $in => $out) {
         $this->assertEquals($out, url_title($in, 'underscore'));
     }
 }
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:7,代码来源:url_helper_test.php

示例6: parse

 public function parse()
 {
     $tmpname = wp_unique_filename($this->targetDir, str_replace("sql", "xml", basename($this->_filename)));
     $this->xml_path = $this->targetDir . '/' . url_title($tmpname);
     $this->toXML();
     return $this->xml_path;
 }
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:7,代码来源:XmlImportSQLParse.php

示例7: Create_url_title

	public function Create_url_title($tagdata = '')
	{
		$this->EE = get_instance();
		
		$this->EE->load->helper('url');
		
		$separator = NULL;
		
		if (in_array($this->EE->TMPL->fetch_param('separator'), array('dash', '-')))
		{
			$separator = 'dash';
		}
		elseif ($this->EE->TMPL->fetch_param('separator') == '_')
		{
			$separator = '_';
		}
		else
		{
			$separator = $this->EE->config->item('word_separator');
		}
		
		if (func_num_args() === 0)
		{
			$tagdata = $this->EE->TMPL->tagdata;
		}
		
		$this->return_data = url_title(
			trim($tagdata),
			$separator,
			(preg_match('/0|no|off|n/i', $this->EE->TMPL->fetch_param('lowercase'))) ? FALSE : TRUE
		);
	}
开发者ID:rsanchez,项目名称:create_url_title,代码行数:32,代码来源:pi.create_url_title.php

示例8: getfrom404

 public function getfrom404()
 {
     $istem = parse_url($_SERVER['REQUEST_URI']);
     $this->output->set_header("HTTP/1.0 200 OK");
     $this->output->set_header("HTTP/1.1 200 OK");
     $istem = parse_url($_SERVER['REQUEST_URI']);
     $i = $istem['path'];
     $flag404 = TRUE;
     $d = explode("/", $i, -1);
     $id = '';
     foreach ($d as $k) {
         if (strlen($k) > 2) {
             redirect();
         }
         //Direkt ID ile içerik çekilmesi engelleniyor. Parçalar 2 şer harften büyük olamaz.
         if ($k == '') {
             continue;
         }
         $k = is_numeric($k) ? $k : '00';
         $id .= $k;
     }
     if ($id < 1) {
         redirect();
     }
     $person = $this->db->select('id,name')->from('liste')->where('id', $id)->limit('1')->get()->row();
     if (!isset($person->id) || $person->id < 1) {
         redirect();
     }
     redirect(base_url() . 'face/get/' . genid_from_id($person->id) . '/' . url_title($person->name), 'location', 301);
 }
开发者ID:berkantaydin,项目名称:reversefacebook,代码行数:30,代码来源:stats.php

示例9: add

 public function add($id = NULL)
 {
     $data = array();
     if ($id !== NULL) {
         $data = $this->mongo_db->page->findOne(array('_id' => new MongoID($id)));
         if (!count($data)) {
             show_404();
         }
     }
     $this->load->library(array('form_validation'));
     $this->form_validation->set_rules('title', 'Sayfa Başlığı', 'trim|required');
     $this->form_validation->set_rules('content', 'Sayfa İçeriği', 'required');
     if ($this->form_validation->run()) {
         $sql_data = array('slug' => url_title($this->form_validation->set_value('title')), 'author' => $this->session->userdata('user_id'), 'title' => $this->form_validation->set_value('title'), 'content' => $this->form_validation->set_value('content'), 'meta_title' => $this->input->post('meta_title'), 'meta_description' => $this->input->post('meta_description'), 'meta_keyword' => $this->input->post('meta_keyword'), 'created_at' => isset($data['created_at']) ? $data['created_at'] : new MongoDate(), 'updated_at' => new MongoDate());
         if ($id !== NULL) {
             $sql_data['_id'] = new MongoID($id);
         }
         $sql_data = array_merge($data, $sql_data);
         $this->mongo_db->page->ensureIndex('slug');
         $this->mongo_db->page->save($sql_data);
         if (isset($data['slug']) && $data['slug'] != $sql_data['slug']) {
             $redirect = array('old_slug' => $data['slug'], 'new_slug' => $sql_data['slug'], 'module' => 'page');
             $this->mongo_db->redirect->save($redirect);
         }
         if ($id === NULL) {
             flash_message('success', 'Sayfa başarıyla eklendi.');
         } else {
             flash_message('success', 'Sayfa başarıyla düzenlendi.');
         }
         redirect('admin/page/index');
     }
     $this->template->view('admin/add', $data)->render();
 }
开发者ID:navruzm,项目名称:navruz.net,代码行数:33,代码来源:admin.php

示例10: main_form

 /**
  *  Admin CRUD
  */
 public function main_form($form_type, $url = null)
 {
     if ($this->input->post('url')) {
         $_POST['url'] = url_title($this->input->post('url'), 'dash', TRUE);
     }
     $this->load->helper(array('form', 'url'));
     $this->load->library('form_validation');
     if ($form_type == 'edit_sidebar') {
         $this->form_validation->set_rules('title', 'Title', 'trim|required|callback_be_unique');
     } else {
         $this->form_validation->set_rules('title', 'Title', 'trim|required');
     }
     $this->form_validation->set_rules('url', 'URL', 'trim|required|callback_be_unique');
     $this->form_validation->set_error_delimiters('<li>', '</li>');
     if ($this->form_validation->run() == FALSE) {
         return false;
     } else {
         if ($form_type == 'new') {
             //                $this->new_user();
         }
         if ($form_type == 'edit' || $form_type == 'edit_sidebar') {
             $this->update_page($url);
         }
         return true;
     }
 }
开发者ID:RCDawson,项目名称:bhp,代码行数:29,代码来源:settings_model.php

示例11: get

 function get($id_param, $title = "", $uri = 0)
 {
     $d['left_top_menu'] = $this->app_global_web_model->generate_menu("kiri", "nav pull-left");
     $d['right_top_menu'] = $this->app_global_web_model->generate_menu("kanan", "nav pull-right");
     $d['center_bottom_menu'] = $this->app_global_web_model->generate_menu("footer");
     $d['combo_lokasi'] = $this->app_global_web_model->generate_combo_lokasi();
     $d['combo_kategori'] = $this->app_global_web_model->generate_combo_kategori();
     $d['list_kategori'] = $this->app_global_web_model->generate_list_kategori("nav nav-list");
     $d['left_artikel_hot'] = $this->app_global_web_model->generate_front_artikel($_SESSION['site_limit_artikel_hot'], 0, "counter", 1);
     $d['left_iklan_hot'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "counter");
     $d['left_iklan_new'] = $this->app_global_web_model->generate_list_iklan($_SESSION['site_limit_sidebar'], "id_iklan");
     $where['id_kategori'] = $id_param;
     $gen_menu = $this->db->get_where("dlmbg_kategori", $where);
     if ($gen_menu->num_rows() == 0) {
         redirect(base_url());
     }
     $menu_crumb = $gen_menu->row();
     $this->breadcrumb->append_crumb('BERANDA', base_url());
     $this->breadcrumb->append_crumb('KATEGORI', base_url() . 'web/kategori');
     $this->breadcrumb->append_crumb(strtoupper($menu_crumb->kategori), base_url() . 'web/kategori/get/' . $id_param . '/' . url_title($menu_crumb->kategori, '-', TRUE));
     $d['dt_retrieve'] = $this->app_global_web_model->generate_indexs_iklan_kategori($id_param, $_SESSION['site_limit_iklan_kategori'], $uri);
     $d['kategori_title'] = strtoupper($menu_crumb->kategori);
     $this->load->view($_SESSION['site_theme'] . '/bg_header', $d);
     $this->load->view($_SESSION['site_theme'] . '/kategori/bg_detail');
     $this->load->view($_SESSION['site_theme'] . '/bg_left');
     $this->load->view($_SESSION['site_theme'] . '/bg_footer');
 }
开发者ID:mylinkedshare,项目名称:Advertising,代码行数:27,代码来源:kategori.php

示例12: get_comments

 /**
  * Get a count of all the comments for a given thread id
  *
  * @param	int
  * @param	int
  */
 private function get_comments($thread_id)
 {
     $sql = "SELECT\n\t\t\t\tSQL_CALC_FOUND_ROWS\n\t      comments.comment_id,\n\t      comments.content,\n\t      comments.original_content,\n\t      comments.created,\n\t      comments.deleted,\n\t      comments.user_id AS author_id,\n\t      users.username AS author_name,\n\t      users.banned AS author_banned,\n\t      users.emoticon,\n\t      IFNULL(acquaintances.type, 0) AS author_acquaintance_type\n\t    FROM comments\n\t    LEFT JOIN users\n\t      ON comments.user_id = users.id\n\t    LEFT JOIN acquaintances\n\t      ON acquaintances.acq_user_id = users.id\n\t      AND acquaintances.user_id = ?\n\t    WHERE comments.thread_id = ?\n\t    ORDER BY comments.created\n\t    LIMIT ?, ?";
     $result = $this->db->query($sql, array($this->meta['user_id'], $thread_id, $this->page, $this->meta['comments_shown']));
     if (!$result->num_rows()) {
         return NULL;
     } else {
         $return = array();
         $i = 0;
         foreach ($result->result() as $row) {
             if ($row->deleted == '0') {
                 $return[$i] = (object) array('comment_id' => $row->comment_id, 'content' => $row->content, 'created' => strtotime($row->created), 'deleted' => 0, 'author_id' => (int) $row->author_id, 'author_name' => $row->author_name, 'author_banned' => (bool) $row->author_banned, 'url_safe_author_name' => url_title($row->author_name, 'dash'), 'emoticon' => (bool) $row->emoticon, 'author_acquaintance_type' => (int) $row->author_acquaintance_type, 'author_acquaintance_name' => $row->author_acquaintance_type == 1 ? 'buddy' : ($row->author_acquaintance_type == 2 ? 'enemy' : NULL), 'owner' => $this->meta['user_id'] == $row->author_id, 'editable' => $this->meta['user_id'] == $row->author_id && $row->created < time() - 60 * 60 * 24, 'show_controls' => $this->page == 0 && $this->meta['user_id'] == $row->author_id && !$i);
                 // update comments if the content doesnt match original
                 if ($row->content === '' && $row->content == _process_post($row->original_content)) {
                     $return[$i]->content = _process_post($row->original_content);
                     $this->db->query("UPDATE comments SET content = ? WHERE comment_id = ?", array($return[$i]->content, $row->comment_id));
                 }
                 if ($return[$i]->author_acquaintance_type == 2) {
                     ++$this->return->information->enemies;
                 }
             } else {
                 $return[$i] = (object) array('comment_id' => (int) $row->comment_id, 'created' => $row->created, 'deleted' => 1);
             }
             ++$i;
         }
         return $return;
     }
 }
开发者ID:notjosh,项目名称:seaforium,代码行数:34,代码来源:thread_model.php

示例13: update_cms

 public function update_cms($array)
 {
     if (isset($array['cms_name'])) {
         $this->db->set('cms_name', $array['cms_name']);
         // prepend the section if it is entered (added this way for backwards compatability)
         if (isset($array['site_section'])) {
             $this->db->set('cms_url', url_title($array['site_section']) . "_" . url_title($array['cms_name']));
         } else {
             $this->db->set('cms_url', url_title($array['cms_name']));
         }
     }
     if (isset($array['cms_text'])) {
         $this->db->set('cms_text', $array['cms_text']);
     }
     if (isset($array['custom_1'])) {
         $this->db->set('custom_1', $array['custom_1']);
     }
     if (isset($array['custom_2'])) {
         $this->db->set('custom_2', $array['custom_2']);
     }
     if (isset($array['site_section'])) {
         $this->db->set('site_section', $array['site_section']);
     }
     $this->db->where('cms_id', $array['cms_id']);
     $this->db->update('cms');
     log_message('debug', "updateCMS:" . trim($this->db->last_query()));
     return $this->db->affected_rows();
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:28,代码来源:cms_model.php

示例14: edit

 function edit($id = 0)
 {
     if (!$id) {
         redirect('admin/news/index');
     }
     $this->load->library('validation');
     $this->validation->set_rules($this->rules);
     $this->validation->set_fields();
     $article = $this->news_m->getArticle($id, 'all');
     if ($this->validation->run()) {
         if ($this->news_m->updateArticle($_POST, $id)) {
             $this->session->set_flashdata(array('success' => 'The article "' . $this->input->post('title') . '" was updated.'));
             // The twitter module is here, and enabled!
             if ($this->settings->item('twitter_news') == 1 && ($article->status != 'live' && $this->input->post('status') == 'live')) {
                 $url = shorten_url('news/' . $this->input->post('created_on_year') . '/' . str_pad($this->input->post('created_on_month'), 2, '0', STR_PAD_LEFT) . '/' . url_title($this->input->post('title')));
                 $this->load->module_model('twitter', 'twitter_m');
                 $this->twitter_m->update(sprintf('Posted "%s" %s', $this->input->post('title'), $url));
             }
             // End twitter code
         } else {
             $this->session->set_flashdata(array('error' => 'An error occurred.'));
         }
         redirect('admin/news/index');
     }
     // Go through all the known fields and get the post values
     foreach (array_keys($this->rules) as $field) {
         if (isset($_POST[$field])) {
             $article->{$field} = $this->validation->{$field};
         }
     }
     $this->data->article =& $article;
     // Load WYSIWYG editor
     $this->layout->extra_head($this->load->view('fragments/wysiwyg', $this->data, TRUE));
     $this->layout->create('admin/form', $this->data);
 }
开发者ID:BenneX,项目名称:pyrocms,代码行数:35,代码来源:admin.php

示例15: insert_event_form

 function insert_event_form()
 {
     if (isset($_POST['event_name'])) {
         $this->db->set('event_name', $_POST['event_name']);
         $this->db->set('event_url_name', url_title($_POST['event_name']));
     }
     if (isset($_POST['event_desc'])) {
         $this->db->set('event_desc', $_POST['event_desc']);
     }
     if (isset($_POST['event_desc_brief'])) {
         $this->db->set('event_desc_brief', $_POST['event_desc_brief']);
     }
     if (isset($_POST['event_type'])) {
         $this->db->set('event_type', $_POST['event_type']);
     }
     if (isset($_POST['event_avatar'])) {
         $this->db->set('event_avatar', $_POST['event_avatar']);
     }
     if (isset($_POST['event_date'])) {
         $this->db->set('event_date', $_POST['event_date']);
     }
     if (isset($_POST['location'])) {
         $this->db->set('location', $_POST['location']);
     }
     $this->db->insert('cn_events');
     log_message('debug', "EVENT:insertEvent:" . trim($this->db->last_query()));
     $event_id = $this->db->insert_id();
     return $event_id;
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:29,代码来源:event_model.php


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