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


PHP text::splitWords方法代码示例

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


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

示例1: setItemI18n

 /**
  * Ajout/modification des textes internationnalisés d'un élément.
  *
  * @param integer $iItemId
  * @param array $aItemLocalesData
  */
 protected function setItemI18n($iItemId, $aItemLocalesData)
 {
     foreach ($this->okt->languages->list as $aLanguage) {
         if (empty($aItemLocalesData[$aLanguage['code']]['title'])) {
             continue;
         }
         $oCursor = $this->db->openCursor($this->t_items_locales);
         $oCursor->item_id = $iItemId;
         $oCursor->language = $aLanguage['code'];
         foreach ($aItemLocalesData[$aLanguage['code']] as $k => $v) {
             $oCursor->{$k} = $v;
         }
         $oCursor->content = $this->okt->HTMLfilter($oCursor->content);
         $oCursor->words = implode(' ', array_unique(text::splitWords($oCursor->title . ' ' . $oCursor->subtitle . ' ' . $oCursor->content . ' ' . $oCursor->author . ' ' . $oCursor->place)));
         $oCursor->meta_description = html::clean($oCursor->meta_description);
         $oCursor->meta_keywords = html::clean($oCursor->meta_keywords);
         $oCursor->insertUpdate();
         $this->setItemSlug($iItemId, $aLanguage['code']);
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:26,代码来源:class.galleries.items.php

示例2: getCommentCursor

 private function getCommentCursor($cur)
 {
     if ($cur->comment_content !== null && $cur->comment_content == '') {
         throw new Exception(__('You must provide a comment'));
     }
     if ($cur->comment_author !== null && $cur->comment_author == '') {
         throw new Exception(__('You must provide an author name'));
     }
     if ($cur->comment_email != '' && !text::isEmail($cur->comment_email)) {
         throw new Exception(__('Email address is not valid.'));
     }
     if ($cur->comment_site !== null && $cur->comment_site != '') {
         if (!preg_match('|^http(s?)://|i', $cur->comment_site, $matches)) {
             $cur->comment_site = 'http://' . $cur->comment_site;
         } else {
             $cur->comment_site = strtolower($matches[0]) . substr($cur->comment_site, strlen($matches[0]));
         }
     }
     if ($cur->comment_status === null) {
         $cur->comment_status = (int) $this->settings->system->comments_pub;
     }
     # Words list
     if ($cur->comment_content !== null) {
         $cur->comment_words = implode(' ', text::splitWords($cur->comment_content));
     }
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:26,代码来源:class.dc.blog.php

示例3: indexAllComments

 /**
 Recreates comments search engine index.
 
 @param	start	<b>integer</b>		Start comment index
 @param	limit	<b>integer</b>		Number of comments to index
 
 @return	<b>integer</b>		<var>$start</var> and <var>$limit</var> sum
 */
 public function indexAllComments($start = null, $limit = null)
 {
     $strReq = 'SELECT COUNT(comment_id) ' . 'FROM ' . $this->prefix . 'comment';
     $rs = $this->con->select($strReq);
     $count = $rs->f(0);
     $strReq = 'SELECT comment_id, comment_content ' . 'FROM ' . $this->prefix . 'comment ';
     if ($start !== null && $limit !== null) {
         $strReq .= $this->con->limit($start, $limit);
     }
     $rs = $this->con->select($strReq);
     $cur = $this->con->openCursor($this->prefix . 'comment');
     while ($rs->fetch()) {
         $cur->comment_words = implode(' ', text::splitWords($rs->comment_content));
         $cur->update('WHERE comment_id = ' . (int) $rs->comment_id);
         $cur->clean();
     }
     if ($start + $limit > $count) {
         return null;
     }
     return $start + $limit;
 }
开发者ID:archcidburnziso,项目名称:Bilboplanet,代码行数:29,代码来源:class.bp.core.php

示例4: indexAllProducts

 /**
  * Reconstruction des index de recherche de tous les produits
  *
  */
 public function indexAllProducts()
 {
     $rsProducts = $this->getProds(array('visibility' => 2));
     while ($rsProducts->fetch()) {
         $words = $rsProducts->title . ' ' . $rsProducts->subtitle . ' ' . $rsProducts->content_short . ' ' . $rsProducts->content . ' ';
         $words = implode(' ', text::splitWords($words));
         $query = 'UPDATE ' . $this->t_products . ' SET ' . 'words=\'' . $this->db->escapeStr($words) . '\' ' . 'WHERE id=' . (int) $rsProducts->id;
         $this->db->execute($query);
     }
     return true;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:15,代码来源:module_handler.php

示例5: getThemesAdminList

 /**
  * Retourne la liste des thèmes disponibles avec les infos de l'administration.
  *
  * @return array
  */
 public function getThemesAdminList()
 {
     $aThemes = $this->getThemesList();
     foreach ($aThemes as $iThemeId => $aTheme) {
         # search indexes
         $aThemes[$iThemeId]['index'] = text::splitWords($aThemes[$iThemeId]['name'] . ' ' . $aThemes[$iThemeId]['desc'] . ' ' . $aThemes[$iThemeId]['tags']);
         $aThemes[$iThemeId]['index'] = array_map('strtolower', $aThemes[$iThemeId]['index']);
         $aThemes[$iThemeId]['index'] = array_unique($aThemes[$iThemeId]['index']);
         array_unshift($aThemes[$iThemeId]['index'], $iThemeId);
         # is active ?
         if ($aTheme['id'] == $this->okt->config->theme) {
             $aThemes[$iThemeId]['is_active'] = true;
             array_unshift($aThemes[$iThemeId]['index'], 'active');
             array_unshift($aThemes[$iThemeId]['index'], 'actif');
         } else {
             $aThemes[$iThemeId]['is_active'] = false;
         }
         # is mobile ?
         if ($aTheme['id'] == $this->okt->config->theme_mobile) {
             $aThemes[$iThemeId]['is_mobile'] = true;
             array_unshift($aThemes[$iThemeId]['index'], 'mobile');
             array_unshift($aThemes[$iThemeId]['index'], 'mobil');
             array_unshift($aThemes[$iThemeId]['index'], 'active');
             array_unshift($aThemes[$iThemeId]['index'], 'actif');
         } else {
             $aThemes[$iThemeId]['is_mobile'] = false;
         }
         # is tablet ?
         if ($aTheme['id'] == $this->okt->config->theme_tablet) {
             $aThemes[$iThemeId]['is_tablet'] = true;
             array_unshift($aThemes[$iThemeId]['index'], 'tablet');
             array_unshift($aThemes[$iThemeId]['index'], 'tablette');
             array_unshift($aThemes[$iThemeId]['index'], 'active');
             array_unshift($aThemes[$iThemeId]['index'], 'actif');
         } else {
             $aThemes[$iThemeId]['is_tablet'] = false;
         }
         # has screenshot ?
         if (file_exists($this->sPath . '/' . $aTheme['id'] . '/screenshot.jpg')) {
             $aThemes[$iThemeId]['screenshot'] = true;
         } else {
             $aThemes[$iThemeId]['screenshot'] = false;
         }
         # has config ?
         if (file_exists($this->sPath . '/' . $aTheme['id'] . '/admin/config.php')) {
             $aThemes[$iThemeId]['has_config'] = true;
         } else {
             $aThemes[$iThemeId]['has_config'] = false;
         }
     }
     return $aThemes;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:57,代码来源:class.oktThemes.php

示例6: importComments

 protected function importComments($post_id, $new_post_id, $db)
 {
     $count_c = $count_t = 0;
     $rs = $db->select('SELECT * FROM ' . $this->vars['db_prefix'] . 'comment ' . 'WHERE post_id = ' . (int) $post_id . ' ');
     while ($rs->fetch()) {
         $cur = $this->con->openCursor($this->prefix . 'comment');
         $cur->post_id = (int) $new_post_id;
         $cur->comment_author = $this->cleanStr($rs->comment_auteur);
         $cur->comment_status = (int) $rs->comment_pub;
         $cur->comment_dt = $rs->comment_dt;
         $cur->comment_upddt = $rs->comment_upddt;
         $cur->comment_email = $this->cleanStr($rs->comment_email);
         $cur->comment_content = $this->cleanStr($rs->comment_content);
         $cur->comment_ip = $rs->comment_ip;
         $cur->comment_trackback = (int) $rs->comment_trackback;
         $cur->comment_site = $this->cleanStr($rs->comment_site);
         if ($cur->comment_site != '' && !preg_match('!^http://.*$!', $cur->comment_site)) {
             $cur->comment_site = substr('http://' . $cur->comment_site, 0, 255);
         }
         if ($rs->exists('spam') && $rs->spam && ($rs->comment_status = 0)) {
             $cur->comment_status = -2;
         }
         $cur->comment_words = implode(' ', text::splitWords($cur->comment_content));
         $cur->comment_id = $this->con->select('SELECT MAX(comment_id) FROM ' . $this->prefix . 'comment')->f(0) + 1;
         $cur->insert();
         if ($cur->comment_trackback && $cur->comment_status == 1) {
             $count_t++;
         } elseif ($cur->comment_status == 1) {
             $count_c++;
         }
     }
     if ($count_t > 0 || $count_c > 0) {
         $this->con->execute('UPDATE ' . $this->prefix . 'post SET ' . 'nb_comment = ' . $count_c . ', ' . 'nb_trackback = ' . $count_t . ' ' . 'WHERE post_id = ' . (int) $new_post_id . ' ');
     }
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:35,代码来源:class.dc.import.dc1.php

示例7: importComments

 protected function importComments($post_id, $new_post_id, &$db)
 {
     $count_c = $count_t = 0;
     $rs = $db->select('SELECT * FROM ' . $this->vars['db_prefix'] . 'comments ' . 'WHERE comment_post_ID = ' . (int) $post_id . ' ');
     while ($rs->fetch()) {
         $cur = $this->con->openCursor($this->prefix . 'comment');
         $cur->post_id = (int) $new_post_id;
         $cur->comment_author = $this->cleanStr($rs->comment_author);
         $cur->comment_status = (int) $rs->comment_approved;
         $cur->comment_dt = $rs->comment_date;
         $cur->comment_email = $this->cleanStr($rs->comment_author_email);
         $cur->comment_content = $this->core->callFormater($this->vars['comment_formater'], $this->cleanStr($rs->comment_content));
         $cur->comment_ip = $rs->comment_author_IP;
         $cur->comment_trackback = $rs->comment_type == 'trackback' ? 1 : 0;
         $cur->comment_site = substr($this->cleanStr($rs->comment_author_url), 0, 255);
         if (!isset($cur->comment_site)) {
             $cur->comment_site = NULL;
         }
         if ($rs->comment_approved == 'spam') {
             $cur->comment_status = -2;
         }
         $cur->comment_words = implode(' ', text::splitWords($cur->comment_content));
         $cur->comment_id = $this->con->select('SELECT MAX(comment_id) FROM ' . $this->prefix . 'comment')->f(0) + 1;
         $cur->insert();
         if ($cur->comment_trackback && $cur->comment_status == 1) {
             $count_t++;
         } elseif ($cur->comment_status == 1) {
             $count_c++;
         }
     }
     if ($count_t > 0 || $count_c > 0) {
         $this->con->execute('UPDATE ' . $this->prefix . 'post SET ' . 'nb_comment = ' . $count_c . ', ' . 'nb_trackback = ' . $count_t . ' ' . 'WHERE post_id = ' . (int) $new_post_id . ' ');
     }
 }
开发者ID:HackerMajor,项目名称:root,代码行数:34,代码来源:class.dc.import.wp.php

示例8: getUsers

 /**
  * Renvoie les données concernant un ou plusieurs utilisateurs.
  * La méthode renvoie false si elle échoue.
  *
  * @param	array	params		Les paramètres
  * @param	boolean	count_only	Permet de ne retourner que le compte
  * @return	recordset
  */
 public function getUsers($aParams = array(), $count_only = false)
 {
     $sReqPlus = 'WHERE 1 ';
     if (isset($aParams['id'])) {
         $sReqPlus .= 'AND u.id=' . (int) $aParams['id'] . ' ';
     }
     if (isset($aParams['username'])) {
         $sReqPlus .= 'AND u.username=\'' . $this->db->escapeStr($aParams['username']) . '\' ';
     }
     if (isset($aParams['active'])) {
         if ($aParams['active'] == 0) {
             $sReqPlus .= 'AND u.active=0 ';
         } elseif ($aParams['active'] == 1) {
             $sReqPlus .= 'AND u.active=1 ';
         } elseif ($aParams['active'] == 2) {
             $sReqPlus .= '';
         }
     }
     if (isset($aParams['group_id'])) {
         if (is_array($aParams['group_id'])) {
             $aParams['group_id'] = array_map('intval', $aParams['group_id']);
             $sReqPlus .= 'AND u.group_id IN (' . implode(',', $aParams['group_id']) . ') ';
         } else {
             $sReqPlus .= 'AND u.group_id=' . (int) $aParams['group_id'] . ' ';
         }
     }
     if (!empty($aParams['group_id_not'])) {
         if (is_array($aParams['group_id_not'])) {
             $aParams['group_id_not'] = array_map('intval', $aParams['group_id_not']);
             $sReqPlus .= 'AND u.group_id NOT IN (' . implode(',', $aParams['group_id_not']) . ') ';
         } else {
             $sReqPlus .= 'AND u.group_id<>' . (int) $aParams['group_id_not'] . ' ';
         }
     }
     if (!empty($aParams['search'])) {
         $aWords = text::splitWords($aParams['search']);
         if (!empty($aWords)) {
             foreach ($aWords as $i => $w) {
                 $aWords[$i] = 'u.username LIKE \'%' . $this->db->escapeStr($w) . '%\' OR ' . 'u.lastname LIKE \'%' . $this->db->escapeStr($w) . '%\' OR ' . 'u.firstname LIKE \'%' . $this->db->escapeStr($w) . '%\' OR ' . 'u.email LIKE \'%' . $this->db->escapeStr($w) . '%\' ';
             }
             $sReqPlus .= ' AND ' . implode(' AND ', $aWords) . ' ';
         }
     }
     if ($count_only) {
         $sQuery = 'SELECT COUNT(u.id) AS num_users ' . 'FROM ' . $this->t_users . ' AS u ' . $sReqPlus;
     } else {
         $sQuery = 'SELECT u.*, g.* ' . 'FROM ' . $this->t_users . ' AS u ' . 'LEFT JOIN ' . $this->t_groups . ' AS g ON g.group_id=u.group_id ' . $sReqPlus;
         if (isset($aParams['order'])) {
             $sQuery .= 'ORDER BY ' . $aParams['order'] . ' ';
         } else {
             $sQuery .= 'ORDER BY u.username DESC ';
         }
         if (isset($aParams['limit'])) {
             $sQuery .= 'LIMIT ' . $aParams['limit'] . ' ';
         }
     }
     if (($rs = $this->db->select($sQuery)) === false) {
         return new recordset(array());
     }
     if ($count_only) {
         return (int) $rs->num_users;
     } else {
         return $rs;
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:73,代码来源:module_handler.php

示例9: indexAllPosts

 /**
  * Reconstruction des index de recherche de tous les articles.
  *
  */
 public function indexAllPosts()
 {
     $rsPosts = $this->db->select('SELECT post_id, language, title, subtitle, content FROM ' . $this->t_news_locales);
     while ($rsPosts->fetch()) {
         $words = $rsPosts->title . ' ' . $rsPosts->subtitle . ' ' . $rsPosts->content . ' ';
         $words = implode(' ', text::splitWords($words));
         $query = 'UPDATE ' . $this->t_news . ' SET ' . 'words=\'' . $this->db->escapeStr($words) . '\' ' . 'WHERE post_id=' . (int) $rsPosts->id . ' ' . 'AND language=\'' . $this->db->escapeStr($rsPosts->language) . '\' ';
         $this->db->execute($query);
     }
     return true;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:15,代码来源:module_handler.php

示例10: setQuestionI18n

 /**
  * Enregistrement des textes internationalisés
  *
  * @return boolean
  */
 protected function setQuestionI18n()
 {
     foreach ($this->okt->languages->list as $aLanguage) {
         $this->params['content'][$aLanguage['code']] = $this->okt->HTMLfilter($this->params['content'][$aLanguage['code']]);
         $words = implode(' ', text::splitWords($this->params['title'][$aLanguage['code']] . ' ' . $this->params['content'][$aLanguage['code']]));
         $query = 'INSERT INTO ' . $this->t_faq_locales . ' ' . '(faq_id, language, title, title_tag, title_seo, slug, content, meta_description, meta_keywords, words) ' . 'VALUES (' . (int) $this->params['id'] . ', ' . '\'' . $this->db->escapeStr($aLanguage['code']) . '\', ' . (empty($this->params['title'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['title'][$aLanguage['code']]) . '\'') . ', ' . (empty($this->params['title_tag'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['title_tag'][$aLanguage['code']]) . '\'') . ', ' . (empty($this->params['title_seo'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['title_seo'][$aLanguage['code']]) . '\'') . ', ' . (empty($this->params['slugs'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['slugs'][$aLanguage['code']]) . '\'') . ', ' . (empty($this->params['content'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['content'][$aLanguage['code']]) . '\'') . ', ' . (empty($this->params['meta_description'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['meta_description'][$aLanguage['code']]) . '\'') . ', ' . (empty($this->params['meta_keywords'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['meta_keywords'][$aLanguage['code']]) . '\'') . ', ' . (empty($words) ? 'NULL' : '\'' . $this->db->escapeStr($words) . '\'') . ' ' . ') ON DUPLICATE KEY UPDATE ' . 'title=' . (empty($this->params['title'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['title'][$aLanguage['code']]) . '\'') . ', ' . 'title_tag=' . (empty($this->params['title_tag'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['title_tag'][$aLanguage['code']]) . '\'') . ', ' . 'title_seo=' . (empty($this->params['title_seo'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['title_seo'][$aLanguage['code']]) . '\'') . ', ' . 'slug=' . (empty($this->params['slugs'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['slugs'][$aLanguage['code']]) . '\'') . ', ' . 'content=' . (empty($this->params['content'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['content'][$aLanguage['code']]) . '\'') . ', ' . 'meta_description=' . (empty($this->params['meta_description'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['meta_description'][$aLanguage['code']]) . '\'') . ', ' . 'meta_keywords=' . (empty($this->params['meta_keywords'][$aLanguage['code']]) ? 'NULL' : '\'' . $this->db->escapeStr($this->params['meta_keywords'][$aLanguage['code']]) . '\'') . ', ' . 'words=' . (empty($words) ? 'NULL' : '\'' . $this->db->escapeStr($words) . '\'') . ' ';
         if (!$this->db->execute($query)) {
             return false;
         }
         if (!$this->setQuestionSlug($this->params['id'], $aLanguage['code'])) {
             return false;
         }
     }
     return true;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:20,代码来源:module_handler.php


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