本文整理汇总了PHP中seo_url函数的典型用法代码示例。如果您正苦于以下问题:PHP seo_url函数的具体用法?PHP seo_url怎么用?PHP seo_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了seo_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_article
function add_article($data)
{
$config['upload_path'] = get_config_value('upload_news_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
if ($_FILES['image']['name']) {
$this->load->library('upload', $config);
if ($this->upload->do_upload('image')) {
$datax = $this->upload->data();
} else {
print_r($this->upload->display_errors());
exit;
}
} else {
$datax['file_name'] = NULL;
}
$this->db->set('title', $data['title']);
$this->db->set('alias', seo_url($data['title']));
$this->db->set('category_id', $data['category_id']);
$this->db->set('image', $datax['file_name']);
$this->db->set('short_content', $data['short_content']);
$this->db->set('full_content', $data['full_content']);
$this->db->set('time', time());
$this->db->set('publish', 1);
$result = $this->db->insert('article');
return $result;
}
示例2: update_category
function update_category($data)
{
$this->db->set('name', $data['name']);
$this->db->set('alias', seo_url($data['name']));
$this->db->where('id', $data['id']);
$result = $this->db->update('category');
return $result;
}
示例3: update_slugs
public function update_slugs()
{
foreach ($this->get_all() as $row) {
if ($row['slug'] == '') {
$data['slug'] = strtolower(seo_url($row['title']));
$this->update($row['id'], $data);
}
}
}
示例4: run_hook
run_hook('admin_editpage_before');
//Include page information, if we're editing a page.
if (isset($_GET['page']) && file_exists(PAGE_DIR . '/' . get_page_filename($_GET['page']))) {
require_once PAGE_DIR . '/' . get_page_filename($_GET['page']);
}
//If form is posted...
if (isset($_POST['save']) || isset($_POST['save_exit'])) {
//Allow modules to add data to page
$module_additional_data = null;
run_hook('admin_save_page_afterpost', array(&$module_additional_data));
if (!isset($_POST['hidden'])) {
$_POST['hidden'] = 'yes';
}
//Save the page, but only if a title has been entered and it's seo url is not empty.
if (!empty($_POST['title']) && seo_url($_POST['title'])) {
if (!empty($_POST['seo_name']) && $_POST['seo_name'] != seo_url($_POST['title'])) {
$title = array('title' => $_POST['title'], 'seo_name' => trim(str_replace(array('\\', '/', ':', '*', '?', '"', '<', '>', '|'), '', $_POST['seo_name'])));
} else {
$title = $_POST['title'];
}
//If we are editing an existing page, pass current seo-name.
if (isset($_GET['page'])) {
$seoname = save_page($title, $_POST['content'], $_POST['hidden'], $_POST['sub_page'], $_POST['description'], $_POST['keywords'], $module_additional_data, $_GET['page']);
} else {
//If we are creating a new page, don't pass seo-name.
$seoname = save_page($title, $_POST['content'], $_POST['hidden'], $_POST['sub_page'], $_POST['description'], $_POST['keywords'], $module_additional_data);
}
//If seoname is false, a file already exists with the same name
if (empty($seoname)) {
$error = show_error($lang['page']['name_exists'], 1, true);
}
示例5: _e
<h2>
<?php
_e('SEO Title and Meta Description', SEO_PLUGIN_FOLDER);
?>
</h2>
<div class="form-group">
<label class="form-label" for="seo_item_meta_title">
<?php
_e('Snippet Preview', SEO_PLUGIN_FOLDER);
?>
: </label>
<div class="form-controls" id="seo_snippet_preview"> <a class="preview_title" id="preview_title"><?php
echo $detail['seo_item_meta_title'];
?>
</a> <span class="preview_url"><?php
echo str_replace('http://', '', osc_base_url()) . seo_url($detail['seo_item_meta_title']);
?>
</span>
<p class="preview_desc"><?php
echo $detail['seo_item_meta_description'];
?>
</p>
</div>
</div>
<div class="form-group" id="seo_item_meta">
<div class="form-control-list">
<label for="seo_item_meta_title">
<?php
_e('Meta Title', SEO_PLUGIN_FOLDER);
?>
: </label>
示例6: blog_page_admin_newpost
function blog_page_admin_newpost()
{
global $lang, $var1, $cont1, $cont2, $cont3;
//If form is posted...
if (isset($_POST['save']) || isset($_POST['save_exit'])) {
if (seo_url($cont1)) {
//Save blogpost.
$seoname = blog_save_post($cont1, $cont2, $cont3);
//Redirect user.
if (isset($_POST['save'])) {
redirect('?module=blog&page=editpost&var1=' . $seoname, 0);
} else {
redirect('?module=blog', 0);
}
} else {
$error = show_error($lang['page']['no_title'], 1, true);
}
}
if (isset($error)) {
echo $error;
}
?>
<div class="rightmenu">
<p><?php
echo $lang['page']['items'];
?>
</p>
<?php
show_link_insert_box();
show_image_insert_box('images');
?>
</div>
<form method="post" action="">
<p>
<label class="kop2" for="cont1"><?php
echo $lang['general']['title'];
?>
</label>
<input name="cont1" id="cont1" type="text" />
</p>
<p>
<label class="kop2" for="cont2"><?php
echo $lang['blog']['category'];
?>
</label>
<select name="cont2" id="cont2">
<option value=""><?php
echo $lang['blog']['choose_cat'];
?>
</option>
<?php
//If there are categories.
if ($categories = blog_get_categories()) {
foreach ($categories as $category) {
echo '<option value="' . $category['seoname'] . '">' . $category['title'] . '</option>';
}
unset($key);
}
?>
</select>
</p>
<p>
<label class="kop2" for="cont3"><?php
echo $lang['general']['contents'];
?>
</label>
<textarea class="<?php
if (defined('WYSIWYG_TEXTAREA_CLASS')) {
echo WYSIWYG_TEXTAREA_CLASS;
}
?>
" name="cont3" id="cont3" cols="70" rows="20"></textarea>
</p>
<?php
show_common_submits('?module=blog', true);
?>
</form>
<?php
}
示例7: update_deal_category
function update_deal_category()
{
if ($_FILES['white_icon']['name']) {
$white_icon = $this->load_white_icon_name($this->input->post('id'));
unlink('upload/deal_category/' . $white_icon);
$config['upload_path'] = get_config_value('upload_deal_category_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('white_icon')) {
$datax = $this->upload->data();
$this->db->set('white_icon', $datax['file_name']);
} else {
print_r($this->upload->display_errors());
exit;
}
}
if ($_FILES['red_icon']['name']) {
$red_icon = $this->load_red_icon_name($this->input->post('id'));
unlink('upload/deal_category/' . $red_icon);
$config['upload_path'] = get_config_value('upload_deal_category_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('red_icon')) {
$datax = $this->upload->data();
$this->db->set('red_icon', $datax['file_name']);
} else {
print_r($this->upload->display_errors());
exit;
}
}
$this->db->set('name', $this->input->post('name'));
$this->db->set('alias', seo_url($this->input->post('name')));
$this->db->where('id', $this->input->post('id'));
$result = $this->db->update('deal_category');
return $result;
}
示例8: editPublisherProcess
public function editPublisherProcess($id)
{
$name = Input::get('name');
$cat_img = Input::file('picture');
$publisher = Publisher::find($id);
if ($publisher) {
$publisher->name = $name;
$validator = Validator::make(array('picture' => $cat_img), array('picture' => 'required|mimes:jpeg,bmp,gif,png'));
if ($validator->fails()) {
//do nothing
} else {
$file_name = seo_url(Input::get('name')) . '-' . time();
$ext = Input::file('picture')->getClientOriginalExtension();
Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
$local_url = $file_name . "." . $ext;
$s3_url = URL::to('/') . '/uploads/' . $local_url;
$publisher->image = $s3_url;
}
$publisher->save();
if ($publisher) {
return Redirect::back()->with('flash_success', tr('publisher_update'));
} else {
return Redirect::back()->with('flash_error', tr('went_wrong'));
}
}
}
示例9: date
<td><?php
echo date("d-m-Y", $rows['time']);
?>
<br/>
til: <?php
echo date("d-m-Y", $rows['end_date']);
?>
</td>
<td><a href="<?php
echo base_url() . index_page();
?>
sugarshop/detail/<?php
echo $rows['id'];
?>
/<?php
echo seo_url($rows['name']);
?>
.html"><?php
echo $rows['name'];
?>
</a></td>
<td class="txt-center"><?php
echo $rows['quantity']->quantity;
?>
</td>
<td class="txt-center"><a href="<?php
echo base_url() . index_page();
?>
b2b/detail/<?php
echo $rows['id'];
?>
示例10: save_edit
function save_edit()
{
if ($_FILES['image']['name']) {
$image = $this->article_model->load_image_name($this->input->post('id'));
unlink('upload/images/' . $image);
$config['upload_path'] = get_config_value('upload_news_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('image')) {
$datax = $this->upload->data();
$data['image'] = $datax['file_name'];
} else {
print_r($this->upload->display_errors());
exit;
}
}
$data['title'] = $this->input->post('title');
$data['alias'] = seo_url($this->input->post('title'));
$data['category_id'] = $this->input->post('category_id');
$data['short_content'] = html_entity_decode($this->input->post('short_content'), ENT_QUOTES, "UTF-8");
$data['full_content'] = html_entity_decode($this->input->post('full_content'), ENT_QUOTES, "UTF-8");
$isOK = $this->article_model->update_article($this->input->post('id'), $data);
if ($isOK) {
$this->session->set_flashdata('message', 'Information is saved');
redirect('/article');
} else {
$this->session->set_flashdata('message', 'Can\'t save information');
redirect('/article');
}
}
示例11: base_url
?>
thumbnail/timthumb.php?src=<?php
echo base_url() . get_config_value('upload_deal_category_path') . $rows['white_icon'];
?>
&q=100&w=33&h=33"/>
<div class="common-popup">
<div class="top"><span class="arrow"></span></div>
<div class="content">
<?php
if ($rows['dealID']) {
?>
<a style="color: #ffffff; font-size: 13px;" href="<?php
echo base_url() . index_page();
?>
sugarshop/detail/<?php
echo $rows['dealID'] . "/" . seo_url($rows['dealName']);
?>
.html"><?php
echo $rows['dealName'];
?>
</a>
<?php
} else {
?>
<p style="color: #ffffff; font-size: 13px;"><?php
echo $rows['dealName'];
?>
</p>
<?php
}
?>
示例12: save_page
/**
* Save a page with a lot of options.
*
* @since 4.7
* @package admin
* @param mixed $title if string - The title, if array title => The title, seo_name => The seo_name.
* @param string $content The content.
* @param string $hidden Should it be hidden ('yes' or 'no')?
* @param string $subpage Specifies the parent page, if the saved page should be a sub page. Default to null.
* @param string $description Description of the page. Defaults to null.
* @param string $keywords Keywords of the page. Defaults to null.
* @param array $module_additional_data Additional data variable, can be edited by modules through hooks (admin_save_page_module_additional_data). Defaults to null.
* @param string $current_seoname Current seoname of the page, if we are editing a page. Defaults to null.
* @return string Seoname of the saved page.
*/
function save_page($title, $content, $hidden, $subpage = null, $description = null, $keywords = null, $module_additional_data = null, $current_seoname = null)
{
//Run a few hooks.
run_hook('admin_save_page', array(&$title, &$content));
run_hook('admin_save_page_meta', array(&$description, &$keywords));
run_hook('admin_save_page_module_additional_data', array(&$module_additional_data));
//Configure title and seo_name
if (is_array($title)) {
if (!empty($title['seo_name'])) {
$seo_title = $title['seo_name'];
$title = $title['title'];
} else {
$seo_title = seo_url($title['title']);
$title = $title['title'];
}
} else {
$seo_title = seo_url($title);
}
//Check if the seo url is empty.
if (empty($seo_title)) {
return false;
}
//Check if a page already exists with the name.
if ((!isset($current_seoname) || $current_seoname != $subpage . $seo_title) && get_page_filename($subpage . $seo_title) != false) {
return false;
}
//Do we want to create a new page?
if (!isset($current_seoname)) {
//Check if we want a sub-page.
if (!empty($subpage)) {
//We need to make sure that the dir exists, and if not, create it.
if (!file_exists(PAGE_DIR . '/' . rtrim($subpage, '/'))) {
mkdir(PAGE_DIR . '/' . rtrim($subpage, '/'));
chmod(PAGE_DIR . '/' . rtrim($subpage, '/'), 0777);
}
$pages = read_dir_contents(PAGE_DIR . '/' . rtrim($subpage, '/'), 'files');
} else {
$pages = read_dir_contents(PAGE_DIR, 'files');
}
//Are there any pages?
if ($pages == false) {
$number = 1;
} else {
$number = count($pages) + 1;
}
$newfile = $subpage . $number . '.' . $seo_title;
} else {
$filename = get_page_filename($current_seoname);
//the old file name
//Is it a sub-page, or do we want to make it one?
if (strpos($current_seoname, '/') !== false || !empty($subpage)) {
$page_name = explode('/', $subpage);
$count = count($page_name);
unset($page_name[$count]);
$dir = get_sub_page_dir($current_seoname);
$filename_array = str_replace($dir . '/', '', $filename);
$filename_array = explode('.', $filename_array);
$newfilename = implode('/', $page_name) . '/' . $filename_array[0] . '.' . $seo_title;
$newdir = get_sub_page_dir($newfilename);
//We need to make sure that the dir exists, and if not, create it.
if (!file_exists(PAGE_DIR . '/' . $newdir)) {
mkdir(PAGE_DIR . '/' . $newdir);
chmod(PAGE_DIR . '/' . $newdir, 0777);
}
//If the name isn't the same as before, we have to find the correct number.
if ($newfilename . '.php' != $filename) {
//If the sub-folder is the same, use the same number as before.
if ($dir . '/' == $newdir) {
$number = $filename_array[0];
} else {
$pages = read_dir_contents(PAGE_DIR . '/' . $newdir, 'files');
if ($pages) {
$count = count($pages);
$number = $count + 1;
} else {
$number = 1;
}
}
$newfile = implode('/', $page_name) . $number . '.' . $seo_title;
}
} else {
$filename_array = explode('.', $filename);
$newfile = $filename_array[0] . '.' . $seo_title;
}
}
//.........这里部分代码省略.........
示例13: blog_create_category
/**
* Create a blog category.
*
* @param string $category The name of the category that needs to be created.
*/
function blog_create_category($category)
{
//Check if 'categories' directory exists, if not; create it.
if (!is_dir(BLOG_CATEGORIES_DIR)) {
mkdir(BLOG_CATEGORIES_DIR);
chmod(BLOG_CATEGORIES_DIR, 0777);
}
$data['category_title'] = sanitize($category);
save_file(BLOG_CATEGORIES_DIR . '/' . seo_url($category) . '.php', $data);
}
示例14: get_topic
function get_topic($page = false)
{
global $datastore;
$xml = '';
$this->priority = $this->topic_priority;
if ($page) {
$page = $page - 1;
$page = $page * 40000;
$this->limit = " LIMIT {$page},40000";
} else {
if ($this->limit < 1) {
$this->limit = false;
}
if ($this->limit) {
$this->limit = " LIMIT 0," . $this->limit;
} else {
$this->limit = '';
}
}
if (!($forums = $datastore->get('cat_forums'))) {
$datastore->update('cat_forums');
$forums = $datastore->get('cat_forums');
}
$not_forums_id = $forums['not_auth_forums']['guest_view'];
$ignore_forum_sql = $not_forums_id ? "WHERE forum_id NOT IN({$not_forums_id})" : '';
$sql = DB()->sql_query("SELECT topic_id, topic_title, topic_time FROM " . BB_TOPICS . " " . $ignore_forum_sql . " ORDER BY topic_time ASC" . $this->limit);
while ($row = DB()->sql_fetchrow($sql)) {
if (function_exists('seo_url')) {
$loc = $this->home . seo_url(TOPIC_URL . $row['topic_id'], $row['topic_title']);
} else {
$loc = $this->home . TOPIC_URL . $row['topic_id'];
}
$xml .= $this->get_xml($loc, date('c', $row['topic_time']));
}
return $xml;
}
示例15: update_deal
function update_deal()
{
if ($_FILES['image1']['name']) {
$image = $this->load_image_name($this->input->post('id'));
unlink('upload/deal/' . $image->image1);
$config['upload_path'] = get_config_value('upload_deal_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('image1')) {
$datax = $this->upload->data();
$this->db->set('image1', $datax['file_name']);
} else {
print_r($this->upload->display_errors());
exit;
}
}
if ($_FILES['image2']['name']) {
$image = $this->load_image_name($this->input->post('id'));
unlink('upload/deal/' . $image->image2);
$config['upload_path'] = get_config_value('upload_deal_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('image2')) {
$datax = $this->upload->data();
$this->db->set('image2', $datax['file_name']);
} else {
print_r($this->upload->display_errors());
exit;
}
}
if ($_FILES['image3']['name']) {
$image = $this->load_image_name($this->input->post('id'));
unlink('upload/deal/' . $image->image3);
$config['upload_path'] = get_config_value('upload_deal_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('image3')) {
$datax = $this->upload->data();
$this->db->set('image3', $datax['file_name']);
} else {
print_r($this->upload->display_errors());
exit;
}
}
if ($_FILES['image4']['name']) {
$image = $this->load_image_name($this->input->post('id'));
unlink('upload/deal/' . $image->image4);
$config['upload_path'] = get_config_value('upload_deal_path');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = get_config_value('max_size');
$config['encrypt_name'] = TRUE;
// rename to random string
$this->load->library('upload', $config);
if ($this->upload->do_upload('image4')) {
$datax = $this->upload->data();
$this->db->set('image4', $datax['file_name']);
} else {
print_r($this->upload->display_errors());
exit;
}
}
$tmp = explode('-', $this->input->post('date'));
$end_date = mktime($this->input->post('hour'), $this->input->post('minute'), 0, $tmp[1], $tmp[0], $tmp[2]);
$this->db->set('name', $this->input->post('name'));
$this->db->set('alias', seo_url($this->input->post('name')));
$this->db->set('category_id', $this->input->post('category_id'));
$this->db->set('b2b_id', $this->input->post('b2b_id'));
$this->db->set('title', $this->input->post('title'));
$this->db->set('description', $this->input->post('description'));
$this->db->set('old_price', $this->input->post('old_price'));
$this->db->set('new_price', $this->input->post('new_price'));
$this->db->set('quantity', $this->input->post('quantity'));
$this->db->set('end_date', $end_date);
$this->db->where('id', $this->input->post('id'));
$result = $this->db->update('deal');
return $result;
}