本文整理汇总了PHP中seo类的典型用法代码示例。如果您正苦于以下问题:PHP seo类的具体用法?PHP seo怎么用?PHP seo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了seo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_sub_category
function edit_sub_category($name, $id, $markbold, $category_id)
{
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/seo.class.php";
$seo_class = new seo();
$sql = "update `" . $this->table . "` set name='" . $this->mysql->magicquotes($name) . "',markbold='" . $this->mysql->magicquotes($markbold) . "',category_id='" . $this->mysql->magicquotes($category_id) . "',seo_url='" . $this->mysql->magicquotes($seo_class->get_seo_url($name)) . "' where id='" . $id . "'";
$result = $this->mysql->query($sql);
}
示例2: getList
/**
* get search results of keywords.
*
* @param string $keywords
* @param object $pager
* @access public
* @return array
*/
public function getList($keywords, $pager)
{
$spliter = $this->app->loadClass('spliter');
$words = explode(' ', seo::unify($keywords, ' '));
$against = '';
foreach ($words as $word) {
$splitedWords = $spliter->utf8Split($word);
$against .= '"' . $splitedWords['words'] . '"';
}
$words = str_replace('"', '', $against);
$words = str_pad($words, 5, '_');
/*$scoreColumn = "((1 * (MATCH(title) AGAINST('{$against}' IN BOOLEAN MODE))) + (0.6 * (MATCH(title) AGAINST('{$against}' IN BOOLEAN MODE))) )";
$results = $this->dao->select("*, {$scoreColumn} as score")
->from(TABLE_SEARCH_INDEX)
->where("MATCH(title,content) AGAINST('+{$against}' IN BOOLEAN MODE) >= 1")
->andWhere('status')->eq('normal')
->andWhere('addedDate')->le(helper::now())
->orderBy('score_desc, editedDate_desc')
->page($pager)
->fetchAll('id');*/
$words = str_replace('_', '', $words);
$results = $this->dao->select("*")->from(TABLE_SEARCH_INDEX)->where("title")->like("%{$words}%")->orWhere("content")->like("%{$words}%")->orderBy('editedDate_desc')->page($pager)->fetchAll();
foreach ($results as $record) {
$record->title = str_replace('</span> ', '</span>', $this->decode($this->markKeywords($record->title, $words)));
$record->title = str_replace('_', '', $this->decode($this->markKeywords($record->title, $words)));
$record->summary = $this->getSummary($record->content, $words);
$record->summary = str_replace('_', '', $record->summary);
}
return $this->processLinks($results);
}
示例3: action_leaderboard
public function action_leaderboard()
{
$active = DB::query(Database::SELECT, "\n\t SELECT users.id, COUNT(talkreplies.user_id) as posts\n\t FROM talkreplies\n\t LEFT JOIN users ON users.id = talkreplies.user_id\n\t GROUP BY talkreplies.user_id\n\t ORDER BY posts DESC\n\t LIMIT 10\n\t ")->execute()->as_array();
$streaks = ORM::factory('User')->order_by('current_streak', 'DESC')->limit(10)->find_all();
$points = DB::query(Database::SELECT, "\n\t\t\tSELECT (SUM(page.points)+user.points) as points, page.user_id AS id FROM `pages` AS page\n\t\t\tJOIN `users` AS user ON user.id = page.user_id\n\t\t\tGROUP BY page.user_id\n\t\t\tORDER BY points DESC\n\t\t\tLIMIT 10\n\t\t")->execute()->as_array();
seo::instance()->title("Morning Pages leaderboard");
seo::instance()->description("Morning Pages leaderboard");
$this->bind('active', $active);
$this->bind('streaks', $streaks);
$this->bind('points', $points);
}
示例4: action_404
public function action_404()
{
seo::instance()->title("Page not found");
seo::instance()->description("Morning Pages is about writing three pages of stream of consciousness thought every day. Become a better person by using MorninPages.net");
$error = ORM::factory('Error');
$error->type = '404';
$error->url = URL::site(request::detect_uri() . (isset($_GET) && !empty($_GET) ? '?' . http_build_query($_GET) : ''), request::factory());
$error->ip = $_SERVER['REMOTE_ADDR'];
$error->client = $_SERVER['HTTP_USER_AGENT'];
$error->server = serialize($_SERVER);
$error->referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
$error->time = time();
$error->save();
// 404 HTTP response
$this->response->status(404);
}
示例5: action_options
public function action_options()
{
$this->require_login(true);
$errors = false;
if ($_POST) {
try {
$user = user::get();
$user->update_user($_POST, array('email', 'bio', 'website', 'password'));
$user->save();
$options = $user->option;
$options->timezone_id = (int) arr::get($_POST, 'timezone_id', 152);
$options->language = (int) arr::get($_POST, 'language', 1);
$options->save();
notes::success('Your info has been updated!');
user::redirect('options');
} catch (ORM_Validation_Exception $e) {
$errors = $e->errors('models');
}
}
$this->bind('errors', $errors);
seo::instance()->title("Morning Pages User Options");
seo::instance()->description("Use these settings to adjust privacy levels, change writing settings, or more.");
}
示例6: setUpload
/**
* Set upload configures.
*
* @access public
* @return void
*/
public function setUpload()
{
if (!empty($_POST)) {
$setting = fixer::input('post')->remove('allowedFiles')->setDefault('allowUpload', '0')->get();
$dangers = explode(',', $this->config->file->dangers);
$allowedFiles = trim(strtolower($this->post->allowedFiles), ',');
$allowedFiles = str_replace($dangers, '', $allowedFiles);
$allowedFiles = seo::unify($allowedFiles, ',');
$allowedFiles = ',' . $allowedFiles . ',';
$fileConfig = array('allowed' => $allowedFiles);
$this->loadModel('setting')->setItems('system.common.file', $fileConfig);
$result = $this->loadModel('setting')->setItems('system.common.site', $setting);
$cache = $this->loadModel('cache')->createConfigCache();
if (!$cache) {
$this->send(array('result' => 'fail', 'message' => sprintf($this->lang->error->noWritable, $this->app->getTmpRoot() . 'cache')));
}
if ($result) {
$this->send(array('result' => 'success', 'message' => $this->lang->setSuccess, 'locate' => inlink('setupload')));
}
$this->send(array('result' => 'fail', 'message' => $this->lang->fail));
}
$this->view->title = $this->lang->site->setBasic;
$this->display();
}
示例7: seo
$cat_info = $seo->getSectionByName($_GET['cat'], false, $direct_id);
if ($cat_info) {
$catid = $cat_info['id'];
$content_type = $content_type ? $content_type : 'dir';
} else {
$catid = 0;
$content_type = $content_type ? $content_type : 'direction';
}
$subdomains = $seo->getSubdomains();
$rpath = '../';
$countries = $seo->getCountries();
if (empty($_GET['subdomain']) && empty($_GET['direction']) || !empty($_GET['subdomain']) && empty($_GET['direction'])) {
if (empty($_GET['subdomain'])) {
$seo = new seo('all');
} else {
$seo = new seo($_GET['subdomain']);
}
$tmp_directions = $seo->getDirections();
foreach ($tmp_directions as $direction) {
$directions[$direction['id']] = $direction;
}
$sections = $seo->getSectionsForMain();
$content = 'content-main.php';
} else {
$content = 'content.php';
}
switch ($content_type) {
case 'article':
$page_title = $section_content['name_section'];
break;
case 'dir':
示例8: update
/**
* Update a product.
*
* @param int $productID
* @access public
* @return void
*/
public function update($productID)
{
$product = fixer::input('post')->join('categories', ',')->stripTags('content,desc', $this->config->allowedTags->admin)->setDefault('price', 0)->setDefault('amount', 0)->setDefault('promotion', 0)->setDefault('unsaleable', 0)->add('editor', $this->app->user->account)->add('editedDate', helper::now())->get();
$product->alias = seo::unify($product->alias, '-');
$product->keywords = seo::unify($product->keywords, ',');
$this->dao->update(TABLE_PRODUCT)->data($product, $skip = 'categories,uid,label,value')->autoCheck()->batchCheck($this->config->product->require->edit, 'notempty')->checkIF($product->mall, 'mall', 'URL')->where('id')->eq($productID)->exec();
$attributes = $this->saveAttributes($productID);
if ($attributes === false) {
return false;
}
$this->loadModel('file')->updateObjectID($this->post->uid, $productID, 'product');
$this->file->copyFromContent($this->post->content, $productID, 'product');
if (dao::isError()) {
return false;
}
$this->loadModel('tag')->save($product->keywords);
$this->processCategories($productID, $this->post->categories);
$product = $this->getByID($productID);
if (empty($product)) {
return false;
}
$product->attributes = $attributes;
return $this->loadModel('search')->save('product', $product);
}
示例9:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Morning Pages - Free online journaling platform</title>
<?php
/* <script src="//use.typekit.net/rod6iku.js"></script>
<script>try{Typekit.load();}catch(e){}</script> */
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="Morning Pages" name="name">
<meta content="<?php
echo seo::instance()->description();
?>
" name="description">
<meta name="google-site-verification" content="GRSH_5xF1zNVylG4dVPeMMzbAd-3x5snMapOlZwfNp8" />
<link href="<?php
echo URL::site('media/img/favicon.ico');
?>
" rel="shortcut icon" />
<link rel="apple-touch-icon" href="<?php
echo URL::site('media/img/favicon.png');
?>
" />
<link rel="stylesheet" type="text/css" id="mainstyles" href="<?php
echo URL::site('media/css/style.css');
?>
" />
</head>
<?php
$theme = '';
示例10: isset
</ul>
</li>
<?php
$grnum++;
}
}
//foreach
?>
<?php
}
?>
<?php
if ($direct_id) {
?>
<li class="all-employers"><span class="wrap-item"><a href="<?php
echo seo::getFriendlyURL($subdomain, '', '');
?>
">Все направления</a></span></li>
<?php
}
?>
</ul>
<b class="b2"></b>
<b class="b1"></b>
</div>
<script type="text/javascript">asynccall('initCtg(<?php
echo isset($gr_show) ? $gr_show : -1;
?>
)');</script>
示例11: action_faq
public function action_faq()
{
seo::instance()->title("Morning Pages Questions");
seo::instance()->description("Frequently asked questions regarding your Morning Pages, the Morning Pages website, and more. Don't see your listed? Check the Morning Pages forum for more info.");
}
示例12: update
/**
* Update an article.
*
* @param string $articleID
* @access public
* @return void
*/
public function update($articleID, $type = 'article')
{
$article = $this->getByID($articleID);
$category = array_keys($article->categories);
$article = fixer::input('post')->stripTags('content,link', $this->config->allowedTags->admin)->join('categories', ',')->add('editor', $this->app->user->account)->add('editedDate', helper::now())->setIF(!$this->post->isLink, 'link', '')->get();
$article->keywords = seo::unify($article->keywords, ',');
$article->alias = seo::unify($article->alias, '-');
$article->content = $this->rtrimContent($article->content);
$this->dao->update(TABLE_ARTICLE)->data($article, $skip = 'categories,uid,isLink')->autoCheck()->batchCheckIF($type != 'page' and !$this->post->isLink, $this->config->article->require->edit, 'notempty')->batchCheckIF($type == 'page' and !$this->post->isLink, $this->config->article->require->page, 'notempty')->batchCheckIF($type != 'page' and $this->post->isLink, $this->config->article->require->link, 'notempty')->batchCheckIF($type == 'page' and $this->post->isLink, $this->config->article->require->pageLink, 'notempty')->checkIF($type == 'page' and $this->post->alias, 'alias', 'unique', "type='page' and id<>{$articleID}")->where('id')->eq($articleID)->exec();
$this->loadModel('file')->updateObjectID($this->post->uid, $articleID, $type);
$this->file->copyFromContent($this->post->content, $articleID, $type);
if (dao::isError()) {
return false;
}
$this->loadModel('tag')->save($article->keywords);
if ($type != 'page') {
$this->processCategories($articleID, $type, $this->post->categories);
}
if (dao::isError()) {
return false;
}
$article = $this->getByID($articleID);
if (empty($article)) {
return false;
}
return $this->loadModel('search')->save($type, $article);
}
示例13: COUNT
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/seo.php';
/*
* Исправление сбитых позиций в SEO-каталоге /catalog/
*/
$sql = 'SELECT parent FROM seo_sections
WHERE parent <> 0
GROUP BY parent
HAVING COUNT(parent) <> MAX(pos_num) OR MIN(pos_num) <> 1';
$parents = $DB->rows($sql);
$seo = new seo();
if ($parents) {
foreach ($parents as $k => $v) {
$sql = "SELECT id FROM seo_sections WHERE parent = {$v['parent']} ORDER BY id ASC";
$rows = $DB->rows($sql);
if ($rows) {
foreach ($rows as $i => $row) {
$info['pos_num'] = $i + 1;
$seo->updateSection($row['id'], $info);
}
echo "Update parent - {$v['parent']}<br/>";
}
}
}
示例14: foreach
<div class="b-menu b-menu_seo b-menu_padtop_20 b-menu_padbot_20 b-menu_bordtop_b2">
<div class="b-menu__inner">
<h3 class="b-menu__h4 b-menu__h4_padbot_10">О разделах каталога фрилансеров:</h3>
<table class="b-menu__table b-menu__table_width_full" cellpadding="0" cellspacing="0" border="0">
<tbody>
<?php
$n = 1;
foreach ($seo_catalog_data as $seo_direct) {
if ($n == 1) {
echo '<tr class="b-menu__tr">';
}
echo '<td class="b-menu__td b-menu__td_padright_20 b-menu__td_padbot_10"><a class="b-menu__link b-menu__link_fontsize_11" href="' . seo::getFriendlyURL('', $seo_direct['name_section_link'], '') . '">' . reformat($seo_direct['dir_name']) . '</a></td>';
if ($n == 8) {
echo '</tr>';
$n = 1;
} else {
$n++;
}
}
if ($n != 1) {
for ($i = $n; $i <= 8; $i++) {
echo '<td class="b-menu__td b-menu__td_padright_20 b-menu__td_padbot_10"> </td>';
}
echo '</tr>';
}
?>
</tbody>
</table>
</div>
</div>
示例15: unset
$smarty->assignByRef('langs', $langs);
// список доступных локализаций
// URL где находится форма менеджера SEO
$seoUrl = '?m=users&s=companies&action=seo';
$smarty->assignByRef('seoUrl', $seoUrl);
if (isset($_POST['save'])) {
unset($_POST['save']);
if (!empty($_POST)) {
foreach ($_POST as $key => $val) {
$file = str_replace("_", ".", $key);
seo::saveSeoFile($file, $val, $currLang);
}
messages::messageChangeSaved(MESSAGE_CHANGE_SAVED, false, CONF_ADMIN_FILE . $seoUrl);
}
}
$smarty->assign('seo', seo::getSeoFiles('companies', $currLang));
} else {
/**
* Действия
*/
if (!empty($_POST['action'])) {
// отображение на главной
if ('show' === $_POST['action'] && !empty($_POST['companies'])) {
$user->updateConfUser(array('main_logo' => 1), 'id IN (' . implode(',', secure::escQuoteData(array_keys($_POST['companies']))) . ')');
messages::messageChangeSaved(MESSAGE_CHANGE_SAVED, false, CONF_ADMIN_FILE . '?m=users&s=companies');
}
// удаление с главной
if ('remove' === $_POST['action'] && !empty($_POST['companies'])) {
$user->updateConfUser(array('main_logo' => 0), 'id IN (' . implode(',', secure::escQuoteData(array_keys($_POST['companies']))) . ')');
messages::messageChangeSaved(MESSAGE_CHANGE_SAVED, false, CONF_ADMIN_FILE . '?m=users&s=companies');
}