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


PHP seo::unify方法代码示例

本文整理汇总了PHP中seo::unify方法的典型用法代码示例。如果您正苦于以下问题:PHP seo::unify方法的具体用法?PHP seo::unify怎么用?PHP seo::unify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在seo的用法示例。


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

示例1: 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);
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:38,代码来源:model.php

示例2: 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();
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:30,代码来源:control.php

示例3: setUpload

 /**
  * Set upload configures.
  *
  * @access public
  * @return void
  */
 public function setUpload()
 {
     $this->lang->site->menu = $this->lang->security->menu;
     $this->lang->menuGroups->site = 'security';
     $this->loadModel('file');
     if (!empty($_POST)) {
         $setting = fixer::input('post')->remove('allowedFiles,thumbs')->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, ',');
         if (!preg_match('/^[a-z0-9,]+$/', $allowedFiles)) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
         }
         $allowedFiles = explode(',', $allowedFiles);
         foreach ($allowedFiles as $extension) {
             if (strlen($extension) > 5) {
                 $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
             }
         }
         $allowedFiles = implode(',', $allowedFiles);
         foreach ($dangers as $danger) {
             if (strpos($allowedFiles, $danger) !== false) {
                 $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
             }
         }
         $allowedFiles = ',' . $allowedFiles . ',';
         $result = $this->loadModel('setting')->setItem('system.common.file.allowed', $allowedFiles);
         if (!$result) {
             $this->send(array('result' => 'fail', 'message' => $this->lang->fail));
         }
         $result = $this->loadModel('setting')->setItems('system.common.site', $setting);
         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->setUpload;
     $this->display();
 }
开发者ID:hansen1416,项目名称:eastsoft,代码行数:46,代码来源:control.php

示例4: 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);
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:34,代码来源:model.php

示例5: processTag

 /**
  * Unify keywords of article, product and category, count tag's rank and save.
  *
  * @access public
  * @return void
  */
 public function processTag()
 {
     $tags = '';
     $articles = $this->dao->select('id, keywords')->from(TABLE_ARTICLE)->fetchPairs('id', 'keywords');
     foreach ($articles as $id => $keywords) {
         $keywords = seo::unify($keywords, ',');
         $this->dao->update(TABLE_ARTICLE)->set('keywords')->eq($keywords)->where('id')->eq($id)->exec();
         $tags = $keywords;
     }
     $products = $this->dao->select('id, keywords')->from(TABLE_PRODUCT)->fetchPairs('id', 'keywords');
     foreach ($products as $id => $keywords) {
         $keywords = seo::unify($keywords, ',');
         $this->dao->update(TABLE_PRODUCT)->set('keywords')->eq($keywords)->where('id')->eq($id)->exec();
         $tags .= ',' . $keywords;
     }
     $categories = $this->dao->select('id, keywords')->from(TABLE_CATEGORY)->fetchPairs('id', 'keywords');
     foreach ($categories as $id => $keywords) {
         $keywords = seo::unify($keywords, ',');
         $this->dao->update(TABLE_CATEGORY)->set('keywords')->eq($keywords)->where('id')->eq($id)->exec();
         $tags .= ',' . $keywords;
     }
     $this->loadModel('tag')->save($tags);
 }
开发者ID:x303597316,项目名称:chanzhieps,代码行数:29,代码来源:model.php

示例6: 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);
 }
开发者ID:eric0614,项目名称:chanzhieps,代码行数:31,代码来源:model.php

示例7: update

 /**
  * Update a node.
  *
  * @param int $nodeID
  * @access public
  * @return bool
  */
 public function update($nodeID)
 {
     $oldNode = $this->getNodeByID($nodeID);
     $node = fixer::input('post')->add('id', $nodeID)->add('editor', $this->app->user->account)->add('editedDate', helper::now())->setForce('keywords', seo::unify($this->post->keywords, ','))->setForce('alias', seo::unify($this->post->alias, '-'))->setForce('type', $oldNode->type)->stripTags('content', $this->config->allowedTags->admin)->get();
     $this->dao->update(TABLE_BOOK)->data($node, $skip = 'uid,referer')->autoCheck()->batchCheckIF($node->type == 'book', $this->config->book->require->book, 'notempty')->batchCheckIF($node->type != 'book', $this->config->book->require->node, 'notempty')->checkIF($node->type == 'book', 'alias', 'unique', "`type` = 'book' AND id != '{$nodeID}'")->where('id')->eq($nodeID)->exec();
     if (dao::isError()) {
         return false;
     }
     $this->fixPath($oldNode->book->id);
     if (dao::isError()) {
         return false;
     }
     $this->loadModel('tag')->save($node->keywords);
     if (dao::isError()) {
         return false;
     }
     if ($node->type == 'article') {
         $this->loadModel('file')->updateObjectID($this->post->uid, $nodeID, 'book');
         $this->file->copyFromContent($this->post->content, $nodeID, 'book');
         if (dao::isError()) {
             return false;
         }
     }
     $book = $this->getNodeByID($nodeID);
     return $this->loadModel('search')->save('book', $book);
 }
开发者ID:AlenWon,项目名称:chanzhieps,代码行数:33,代码来源:model.php

示例8: manageChildren

 /**
  * Manage children of one category.
  * 
  * @param string $type 
  * @param string $children 
  * @access public
  * @return void
  */
 public function manageChildren($type, $parent, $children)
 {
     /* Get parent. */
     $parent = $this->getByID($parent);
     /* Init the category object. */
     $category = new stdclass();
     $category->parent = $parent ? $parent->id : 0;
     $category->grade = $parent ? $parent->grade + 1 : 1;
     $category->type = $type;
     $category->postedDate = helper::now();
     $i = 1;
     foreach ($children as $key => $categoryName) {
         $alias = $this->post->alias[$key];
         $alias = seo::unify($alias, '-');
         $order = $i * 10;
         if (empty($categoryName)) {
             continue;
         }
         /* First, save the child without path field. */
         $category->name = $categoryName;
         $category->alias = $alias;
         $category->order = $order;
         $mode = $this->post->mode[$key];
         /* Add id to check alias. */
         $category->id = $mode == 'new' ? 0 : ($category->id = $key);
         if (!$this->checkAlias($category)) {
             return sprintf($this->lang->tree->aliasRepeat, $alias);
         }
         if ($category->type == 'forum' or $category->type == 'blog') {
             if (is_numeric($category->alias)) {
                 return $this->lang->tree->aliasNumber;
             }
         }
         if ($mode == 'new') {
             unset($category->id);
             $this->dao->insert(TABLE_CATEGORY)->data($category)->exec();
             /* After saving, update it's path. */
             $categoryID = $this->dao->lastInsertID();
             $categoryPath = $parent ? $parent->path . $categoryID . ',' : ",{$categoryID},";
             $this->dao->update(TABLE_CATEGORY)->set('path')->eq($categoryPath)->where('id')->eq($categoryID)->exec();
         } else {
             $categoryID = $key;
             $this->dao->update(TABLE_CATEGORY)->set('name')->eq($categoryName)->set('alias')->eq($alias)->set('order')->eq($order)->where('id')->eq($categoryID)->exec();
         }
         $i++;
     }
     return !dao::isError();
 }
开发者ID:mustafakarali,项目名称:b2c-1,代码行数:56,代码来源:model.php


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