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


PHP text::cutString方法代码示例

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


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

示例1: process

 public function process($do)
 {
     if ($do == 'ok') {
         $this->status = true;
         return;
     }
     if (empty($_POST['feed_url'])) {
         return;
     }
     $this->feed_url = $_POST['feed_url'];
     $feed = feedReader::quickParse($this->feed_url);
     if ($feed === false) {
         throw new Exception(__('Cannot retrieve feed URL.'));
     }
     if (count($feed->items) == 0) {
         throw new Exception(__('No items in feed.'));
     }
     if ($this->core->plugins->moduleExists('metadata')) {
         $meta = new dcMeta($this->core);
     }
     $cur = $this->core->con->openCursor($this->core->prefix . 'post');
     $this->core->con->begin();
     foreach ($feed->items as $item) {
         $cur->clean();
         $cur->user_id = $this->core->auth->userID();
         $cur->post_content = $item->content ? $item->content : $item->description;
         $cur->post_title = $item->title ? $item->title : text::cutString(html::clean($cur->post_content), 60);
         $cur->post_format = 'xhtml';
         $cur->post_status = -2;
         $cur->post_dt = strftime('%Y-%m-%d %H:%M:%S', $item->TS);
         try {
             $post_id = $this->core->blog->addPost($cur);
         } catch (Exception $e) {
             $this->core->con->rollback();
             throw $e;
         }
         if (isset($meta)) {
             foreach ($item->subject as $subject) {
                 $meta->setPostMeta($post_id, 'tag', dcMeta::sanitizeMetaID($subject));
             }
         }
     }
     $this->core->con->commit();
     http::redirect($this->getURL() . '&do=ok');
 }
开发者ID:HackerMajor,项目名称:root,代码行数:45,代码来源:class.dc.import.feed.php

示例2: foreach

        $tb_excerpt = $post->post_excerpt_xhtml . ' ' . $post->post_content_xhtml;
        $post_title = $post->post_title;
        $post_url = $post->getURL();
    }
} else {
    $core->error->add(__('This entry does not exist.'));
    $can_view_page = false;
}
# Change excerpt
if (!empty($_POST['tb_excerpt'])) {
    $tb_excerpt = $_POST['tb_excerpt'];
}
# Sanitize excerpt
$tb_excerpt = html::clean($tb_excerpt);
$tb_excerpt = html::decodeEntities($tb_excerpt);
$tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt), 255);
$tb_excerpt = preg_replace('/\\s+/ms', ' ', $tb_excerpt);
# Send pings
if ($post && !$post->isEmpty() && !empty($_POST['tb_urls'])) {
    $tb_urls = $_POST['tb_urls'];
    $tb_urls = str_replace("\r", '', $tb_urls);
    $post_title = html::escapeHTML(trim(html::clean($post_title)));
    foreach (explode("\n", $tb_urls) as $tb_url) {
        try {
            $TB->ping($tb_url, $id, $post_title, $tb_excerpt, $post_url);
        } catch (Exception $e) {
            $core->error->add($e->getMessage());
        }
    }
    if (!$core->error->flag()) {
        http::redirect('trackbacks.php?id=' . $id . '&sent=1');
开发者ID:HackerMajor,项目名称:root,代码行数:31,代码来源:trackbacks.php

示例3: trigger_error

?>



<?php 
# début Okatea : traitements avant affichage
# vérification de la présence d'un identifiant, sinon warning et fin
if (empty($mPageIdentifier)) {
    trigger_error('You must assign a mPageIdentifier variable for this template', E_USER_WARNING);
    return;
}
# récupération de la page pour l'encart
$rsInsertPage = $okt->pages->getPage($mPageIdentifier);
# troncature du contenu ?
if ($okt->pages->config->insert_truncat_char > 0) {
    $rsInsertPage->content = text::cutString(html::clean($rsInsertPage->content), $okt->pages->config->insert_truncat_char);
}
# fin Okatea : traitements avant affichage
?>


<?php 
# début Okatea : ajout du CHEMIN du fichier LESS
$okt->page->css->addLessFile(__DIR__ . '/styles.less');
# fin Okatea : ajout du CHEMIN du fichier LESS
?>


<?php 
# début Okatea : ajout de jQuery
$okt->page->js->addFile(OKT_PUBLIC_URL . '/js/jquery/jquery.min.js');
开发者ID:jewelhuq,项目名称:okatea,代码行数:31,代码来源:template.php

示例4: cut_string

 public static function cut_string($str, $l)
 {
     return text::cutString($str, $l);
 }
开发者ID:HackerMajor,项目名称:root,代码行数:4,代码来源:lib.tpl.context.php

示例5: receive_pb

 /**
 Receives a pingback and insert it as a comment of given post.
 
 @param	from_url		<b>string</b>		Source URL
 @param	to_url			<b>string</b>		Target URL
 */
 public function receive_pb($from_url, $to_url)
 {
     $reg = '!^' . preg_quote($this->core->blog->url) . '(.*)!';
     $type = $args = $next = '';
     # Are you dumb?
     if (!preg_match($reg, $to_url, $m)) {
         throw new Exception(__('Any chance you ping one of my contents? No? Really?'), 0);
     }
     # Does the targeted URL look like a registered post type?
     $url_part = $m[1];
     $p_type = '';
     $post_types = $this->core->getPostTypes();
     foreach ($post_types as $k => $v) {
         $reg = '!^' . preg_quote(str_replace('%s', '', $v['public_url'])) . '(.*)!';
         if (preg_match($reg, $url_part, $n)) {
             $p_type = $k;
             $post_url = $n[1];
             break;
         }
     }
     if (empty($p_type)) {
         throw new Exception(__('Sorry but you can not ping this type of content.'), 33);
     }
     # Time to see if we've got a winner...
     $params = array('post_type' => $p_type, 'post_url' => $post_url);
     $posts = $this->core->blog->getPosts($params);
     # Missed!
     if ($posts->isEmpty()) {
         throw new Exception(__('Oops. Kinda "not found" stuff. Please check the target URL twice.'), 33);
     }
     # Nice try. But, sorry, no.
     if (!$posts->trackbacksActive()) {
         throw new Exception(__('Sorry, dude. This entry does not accept pingback at the moment.'), 33);
     }
     if ($this->pingAlreadyDone($posts->post_id, $from_url)) {
         throw new Exception(__('Don\'t repeat yourself, please.'), 48);
     }
     # OK. We've found our champion. Time to check the remote part.
     try {
         $http = self::initHttp($from_url, $from_path);
         # First round : just to be sure the ping comes from an acceptable resource type.
         $http->setHeadersOnly(true);
         $http->get($from_path);
         $c_type = explode(';', $http->getHeader('content-type'));
         # Bad luck. Bye, bye...
         if (!in_array($c_type[0], array('text/html', 'application/xhtml+xml'))) {
             throw new Exception(__('Your source URL does not look like a supported content type. Sorry. Bye, bye!'), 0);
         }
         # Second round : let's go fetch and parse the remote content
         $http->setHeadersOnly(false);
         $http->get($from_path);
         $remote_content = $http->getContent();
         $charset = self::getCharsetFromRequest($http->getHeader('content-type'));
         if (!$charset) {
             $charset = self::detectCharset($remote_content);
         }
         if (strtolower($charset) != 'utf-8') {
             $remote_content = iconv($charset, 'UTF-8', $remote_content);
         }
         # We want a title...
         if (!preg_match('!<title>([^<].*?)</title>!mis', $remote_content, $m)) {
             throw new Exception(__('Where\'s your title?'), 0);
         }
         $title = trim(html::clean($m[1]));
         $title = html::decodeEntities($title);
         $title = html::escapeHTML($title);
         $title = text::cutString($title, 60);
         preg_match('!<body[^>]*?>(.*)?</body>!msi', $remote_content, $m);
         $source = $m[1];
         $source = preg_replace('![\\r\\n\\s]+!ms', ' ', $source);
         $source = preg_replace("/<\\/*(h\\d|p|th|td|li|dt|dd|pre|caption|input|textarea|button)[^>]*>/", "\n\n", $source);
         $source = strip_tags($source, '<a>');
         $source = explode("\n\n", $source);
         $excerpt = '';
         foreach ($source as $line) {
             if (strpos($line, $to_url) !== false) {
                 if (preg_match("!<a[^>]+?" . $to_url . "[^>]*>([^>]+?)</a>!", $line, $m)) {
                     $excerpt = strip_tags($line);
                     break;
                 }
             }
         }
         if ($excerpt) {
             $excerpt = '(&#8230;) ' . text::cutString(html::escapeHTML($excerpt), 200) . ' (&#8230;)';
         } else {
             $excerpt = '(&#8230;)';
         }
         $this->addBacklink($posts->post_id, $from_url, '', $title, $excerpt, $comment);
     } catch (Exception $e) {
         throw new Exception(__('Sorry, an internal problem has occured.'), 0);
     }
     return __('Thanks, mate. It was a pleasure.');
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:99,代码来源:class.dc.trackback.php

示例6: editPost

 private function editPost($post_id, $user, $pwd, $content, $struct = array(), $publish = true)
 {
     $post_id = (int) $post_id;
     $post_type = 'post';
     if (!empty($struct['post_type'])) {
         $post_type = $struct['post_type'];
     }
     $post = $this->getPostRS($post_id, $user, $pwd, $post_type);
     $title = !empty($struct['title']) ? $struct['title'] : '';
     $excerpt = !empty($struct['mt_excerpt']) ? $struct['mt_excerpt'] : '';
     $description = !empty($struct['description']) ? $struct['description'] : null;
     $dateCreated = !empty($struct['dateCreated']) ? $struct['dateCreated'] : null;
     $open_comment = isset($struct['mt_allow_comments']) ? $struct['mt_allow_comments'] : 1;
     $open_tb = isset($struct['mt_allow_pings']) ? $struct['mt_allow_pings'] : 1;
     if ($description !== null) {
         $content = $description;
     }
     if (!$title) {
         $title = text::cutString(html::clean($content), 25) . '...';
     }
     $excerpt_xhtml = $this->core->callFormater('xhtml', $excerpt);
     $content_xhtml = $this->core->callFormater('xhtml', $content);
     if (empty($content)) {
         throw new Exception('Cannot create an empty entry');
     }
     $cur = $this->core->con->openCursor($this->core->prefix . 'post');
     $cur->post_type = $post_type;
     $cur->post_title = trim($title);
     $cur->post_content = $content;
     $cur->post_excerpt = $excerpt;
     $cur->post_content_xhtml = $content_xhtml;
     $cur->post_excerpt_xhtml = $excerpt_xhtml;
     $cur->post_open_comment = (int) ($open_comment == 1);
     $cur->post_open_tb = (int) ($open_tb == 1);
     $cur->post_status = (int) $publish;
     $cur->post_format = 'xhtml';
     $cur->post_url = $post->post_url;
     if ($dateCreated) {
         if ($dateCreated instanceof xmlrpcDate) {
             $cur->post_dt = date('Y-m-d H:i:00', $dateCreated->getTimestamp());
         } elseif (is_string($dateCreated) && @strtotime($dateCreated)) {
             $cur->post_dt = date('Y-m-d H:i:00', strtotime($dateCreated));
         }
     } else {
         $cur->post_dt = $post->post_dt;
     }
     # Categories in an array
     if (isset($struct['categories']) && is_array($struct['categories'])) {
         $categories = $struct['categories'];
         $cat_id = !empty($categories[0]) ? $categories[0] : null;
         $cur->cat_id = $this->getCatID($cat_id);
     }
     if (isset($struct['wp_slug'])) {
         $cur->post_url = $struct['wp_slug'];
     }
     if (isset($struct['wp_password'])) {
         $cur->post_password = $struct['wp_password'];
     }
     if ($cur->post_type == 'post') {
         # --BEHAVIOR-- xmlrpcBeforeEditPost
         $this->core->callBehavior('xmlrpcBeforeEditPost', $this, $post_id, $cur, $content, $struct, $publish);
         $this->core->blog->updPost($post_id, $cur);
         # --BEHAVIOR-- xmlrpcAfterEditPost
         $this->core->callBehavior('xmlrpcAfterEditPost', $this, $post_id, $cur, $content, $struct, $publish);
     } elseif ($cur->post_type == 'page') {
         if (isset($struct['wp_page_order'])) {
             $cur->post_position = (int) $struct['wp_page_order'];
         }
         $this->core->blog->settings->system->post_url_format = '{t}';
         $this->core->blog->updPost($post_id, $cur);
     } else {
         throw new Exception('Invalid post type', 401);
     }
     return true;
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:75,代码来源:class.dc.xmlrpc.php

示例7: Exception

    try {
        if (empty($__resources['rss_news'])) {
            throw new Exception();
        }
        $feed_reader = new feedReader();
        $feed_reader->setCacheDir(DC_TPL_CACHE);
        $feed_reader->setTimeout(2);
        $feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/');
        $feed = $feed_reader->parse($__resources['rss_news']);
        if ($feed) {
            $latest_news = '<div class="box medium dc-box"><h3>' . __('Dotclear news') . '</h3><dl id="news">';
            $i = 1;
            foreach ($feed->items as $item) {
                $dt = isset($item->link) ? '<a href="' . $item->link . '" class="outgoing" title="' . $item->title . '">' . $item->title . ' <img src="images/outgoing-blue.png" alt="" /></a>' : $item->title;
                if ($i < 3) {
                    $latest_news .= '<dt>' . $dt . '</dt>' . '<dd><p><strong>' . dt::dt2str(__('%d %B %Y:'), $item->pubdate, 'Europe/Paris') . '</strong> ' . '<em>' . text::cutString(html::clean($item->content), 120) . '...</em></p></dd>';
                } else {
                    $latest_news .= '<dt>' . $dt . '</dt>' . '<dd>' . dt::dt2str(__('%d %B %Y:'), $item->pubdate, 'Europe/Paris') . '</dd>';
                }
                $i++;
                if ($i > 2) {
                    break;
                }
            }
            $latest_news .= '</dl></div>';
            $__dashboard_items[$dashboardItem][] = $latest_news;
            $dashboardItem++;
        }
    } catch (Exception $e) {
    }
}
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:index.php

示例8: while

$iNumPages = $oFaqPager->getNbPages();
$okt->faq->filters->normalizePage($iNumPages);
$aFaqParams['limit'] = ($okt->faq->filters->params->page - 1) * $okt->faq->filters->params->nb_per_page . ',' . $okt->faq->filters->params->nb_per_page;
# récupération des questions
$faqList = $okt->faq->getQuestions($aFaqParams);
$count_line = 0;
while ($faqList->fetch()) {
    $faqList->odd_even = $count_line % 2 == 0 ? 'even' : 'odd';
    $count_line++;
    $faqList->url = $faqList->getQuestionUrl();
    if (!$okt->faq->config->enable_rte) {
        $faqList->content = util::nlToP($faqList->content);
    }
    if ($okt->faq->config->public_truncat_char > 0) {
        $faqList->content = html::clean($faqList->content);
        $faqList->content = text::cutString($faqList->content, $okt->faq->config->public_truncat_char);
    }
}
unset($count_line);
# module actuel
$okt->page->module = 'faq';
$okt->page->action = 'list_questions';
# début du fil d'ariane
$okt->page->breadcrumb->add($okt->faq->getName(), $okt->faq->config->url);
# ajout du numéro de page au title
if ($okt->faq->filters->params->page > 1) {
    $okt->page->addTitleTag(sprintf(__('c_c_Page_%s'), $okt->faq->filters->params->page));
}
# title tag du module
$okt->page->addTitleTag($okt->faq->getTitle());
$faqList->numPages = $iNumPages;
开发者ID:jewelhuq,项目名称:okatea,代码行数:31,代码来源:list_questions.php

示例9: receive

 /**
 Receives a trackback and insert it as a comment of given post.
 
 @param	post_id		<b>integer</b>		Post ID
 */
 public function receive($post_id)
 {
     header('Content-Type: text/xml; charset=UTF-8');
     if (empty($_POST)) {
         http::head(405, 'Method Not Allowed');
         echo '<?xml version="1.0" encoding="utf-8"?>' . "\n" . "<response>\n" . "  <error>1</error>\n" . "  <message>POST request needed</message>\n" . "</response>";
         return;
     }
     $post_id = (int) $post_id;
     $title = !empty($_POST['title']) ? $_POST['title'] : '';
     $excerpt = !empty($_POST['excerpt']) ? $_POST['excerpt'] : '';
     $url = !empty($_POST['url']) ? $_POST['url'] : '';
     $blog_name = !empty($_POST['blog_name']) ? $_POST['blog_name'] : '';
     $charset = '';
     $comment = '';
     $err = false;
     $msg = '';
     if ($this->core->blog === null) {
         $err = true;
         $msg = 'No blog.';
     } elseif ($url == '') {
         $err = true;
         $msg = 'URL parameter is required.';
     } elseif ($blog_name == '') {
         $err = true;
         $msg = 'Blog name is required.';
     }
     if (!$err) {
         $post = $this->core->blog->getPosts(array('post_id' => $post_id, 'post_type' => ''));
         if ($post->isEmpty()) {
             $err = true;
             $msg = 'No such post.';
         } elseif (!$post->trackbacksActive()) {
             $err = true;
             $msg = 'Trackbacks are not allowed for this post or weblog.';
         }
     }
     if (!$err) {
         $charset = self::getCharsetFromRequest();
         if (!$charset) {
             $charset = mb_detect_encoding($title . ' ' . $excerpt . ' ' . $blog_name, 'UTF-8,ISO-8859-1,ISO-8859-2,ISO-8859-3,' . 'ISO-8859-4,ISO-8859-5,ISO-8859-6,ISO-8859-7,ISO-8859-8,' . 'ISO-8859-9,ISO-8859-10,ISO-8859-13,ISO-8859-14,ISO-8859-15');
         }
         if (strtolower($charset) != 'utf-8') {
             $title = iconv($charset, 'UTF-8', $title);
             $excerpt = iconv($charset, 'UTF-8', $excerpt);
             $blog_name = iconv($charset, 'UTF-8', $blog_name);
         }
         $title = trim(html::clean($title));
         $title = html::decodeEntities($title);
         $title = html::escapeHTML($title);
         $title = text::cutString($title, 60);
         $excerpt = trim(html::clean($excerpt));
         $excerpt = html::decodeEntities($excerpt);
         $excerpt = preg_replace('/\\s+/ms', ' ', $excerpt);
         $excerpt = text::cutString($excerpt, 252);
         $excerpt = html::escapeHTML($excerpt) . '...';
         $blog_name = trim(html::clean($blog_name));
         $blog_name = html::decodeEntities($blog_name);
         $blog_name = html::escapeHTML($blog_name);
         $blog_name = text::cutString($blog_name, 60);
         $url = trim(html::clean($url));
         if (!$blog_name) {
             $blog_name = 'Anonymous blog';
         }
         $comment = "<!-- TB -->\n" . '<p><strong>' . ($title ? $title : $blog_name) . "</strong></p>\n" . '<p>' . $excerpt . '</p>';
         $cur = $this->core->con->openCursor($this->core->prefix . 'comment');
         $cur->comment_author = (string) $blog_name;
         $cur->comment_site = (string) $url;
         $cur->comment_content = (string) $comment;
         $cur->post_id = $post_id;
         $cur->comment_trackback = 1;
         $cur->comment_status = $this->core->blog->settings->trackbacks_pub ? 1 : -1;
         $cur->comment_ip = http::realIP();
         try {
             # --BEHAVIOR-- publicBeforeTrackbackCreate
             $this->core->callBehavior('publicBeforeTrackbackCreate', $cur);
             if ($cur->post_id) {
                 $comment_id = $this->core->blog->addComment($cur);
                 # --BEHAVIOR-- publicAfterTrackbackCreate
                 $this->core->callBehavior('publicAfterTrackbackCreate', $cur, $comment_id);
             }
         } catch (Exception $e) {
             $err = 1;
             $msg = 'Something went wrong : ' . $e->getMessage();
         }
     }
     $debug_trace = "  <debug>\n" . '    <title>' . $title . "</title>\n" . '    <excerpt>' . $excerpt . "</excerpt>\n" . '    <url>' . $url . "</url>\n" . '    <blog_name>' . $blog_name . "</blog_name>\n" . '    <charset>' . $charset . "</charset>\n" . '    <comment>' . $comment . "</comment>\n" . "  </debug>\n";
     $resp = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . "<response>\n" . '  <error>' . (int) $err . "</error>\n";
     if ($msg) {
         $resp .= '  <message>' . $msg . "</message>\n";
     }
     if (!empty($_POST['__debug'])) {
         $resp .= $debug_trace;
     }
     echo $resp . "</response>";
//.........这里部分代码省略.........
开发者ID:HackerMajor,项目名称:root,代码行数:101,代码来源:class.dc.trackback.php

示例10: preparePosts

 /**
  * Formatage des données d'un newsRecordset en vue d'un affichage d'une liste.
  *
  * @param newsRecordset $rsPosts
  * @param integer $iTruncatChar (null)
  * @return void
  */
 public function preparePosts(newsRecordset $rsPosts, $iTruncatChar = null)
 {
     # on utilise une troncature personnalisée à cette préparation
     if (!is_null($iTruncatChar)) {
         $iNumCharBeforeTruncate = (int) $iTruncatChar;
     } elseif ($this->config->public_truncat_char > 0) {
         $iNumCharBeforeTruncate = $this->config->public_truncat_char;
     } else {
         $iNumCharBeforeTruncate = 0;
     }
     $iCountLine = 0;
     while ($rsPosts->fetch()) {
         # odd/even
         $rsPosts->odd_even = $iCountLine % 2 == 0 ? 'even' : 'odd';
         $iCountLine++;
         # formatages génériques
         $this->commonPreparation($rsPosts);
         # troncature
         if ($iNumCharBeforeTruncate > 0) {
             $rsPosts->content = html::clean($rsPosts->content);
             $rsPosts->content = text::cutString($rsPosts->content, $iNumCharBeforeTruncate);
         }
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:31,代码来源:module_handler.php

示例11: postLine

 private function postLine()
 {
     $res = '<tr>' . '<td>' . '<a href="' . sprintf($this->p_url, $this->rs->meta_id) . '">' . html::escapeHTML(text::cutString($this->rs->meta_id, 50)) . '</a>' . '</td>' . '<td class="nowrap">' . html::escapeHTML(text::cutString($this->rs->meta_desc, 50)) . '</td>' . '</tr>';
     return $res;
 }
开发者ID:nikrou,项目名称:tagDescription,代码行数:5,代码来源:tag.description.admin.list.php

示例12: catalogCategory

 /**
  * Affichage de la liste des produits d'une rubrique.
  *
  */
 public function catalogCategory($aMatches)
 {
     # si les rubriques ne sont pas actives -> 404
     if (!$this->okt->catalog->config->categories_enable) {
         $this->serve404();
     }
     # module actuel
     $this->okt->page->module = 'catalog';
     $this->okt->page->action = 'category';
     # récupération de la rubrique en fonction du slug
     if (!empty($aMatches[0])) {
         $slug = $aMatches[0];
     } else {
         $this->serve404();
     }
     $rsCategory = $this->okt->catalog->getCategories(array('slug' => $slug, 'visibility' => 1));
     if ($rsCategory->isEmpty()) {
         $this->serve404();
     }
     # route par défaut ?
     $bIsDefaultRoute = $this->isDefaultRoute(__CLASS__, __FUNCTION__, $slug);
     # initialisation des paramètres
     $aProductsParams = array('visibility' => 1, 'category_id' => $rsCategory->id);
     # initialisation des filtres
     $this->okt->catalog->filtersStart();
     # ré-initialisation filtres
     if (!empty($_GET['catalog_init_filters'])) {
         $this->okt->catalog->filters->initFilters();
         http::redirect($this->okt->catalog->config->url);
     }
     # initialisation des filtres
     $this->okt->catalog->filters->setCatalogParams($aProductsParams);
     $this->okt->catalog->filters->getFilters();
     # initialisation de la pagination
     $num_filtered_products = $this->okt->catalog->getProds($aProductsParams, true);
     $oProductsPager = new publicPager($this->okt->catalog->filters->params->page, $num_filtered_products, $this->okt->catalog->filters->params->nb_per_page);
     $iNumPages = $oProductsPager->getNbPages();
     $this->okt->catalog->filters->normalizePage($iNumPages);
     $aProductsParams['limit'] = ($this->okt->catalog->filters->params->page - 1) * $this->okt->catalog->filters->params->nb_per_page . ',' . $this->okt->catalog->filters->params->nb_per_page;
     # récupération des produits
     $productsList = $this->okt->catalog->getProds($aProductsParams);
     $count_line = 0;
     while ($productsList->fetch()) {
         $productsList->odd_even = $count_line % 2 == 0 ? 'even' : 'odd';
         $count_line++;
         $productsList->url = $productsList->getProductUrl();
         if (!$this->okt->catalog->config->rte_enable) {
             $productsList->content = util::nlToP($productsList->content);
         }
         if ($this->okt->catalog->config->public_truncat_char > 0) {
             $productsList->content = html::clean($productsList->content);
             $productsList->content = text::cutString($productsList->content, $this->okt->catalog->config->public_truncat_char);
         }
         $productsList->category_url = $productsList->getCategoryUrl();
     }
     # meta description
     if ($this->okt->catalog->config->meta_description != '') {
         $this->okt->page->meta_description = $this->okt->catalog->config->meta_description;
     } else {
         $this->okt->page->meta_description = util::getSiteMetaDesc();
     }
     # meta keywords
     if ($this->okt->catalog->config->meta_keywords != '') {
         $this->okt->page->meta_keywords = $this->okt->catalog->config->meta_keywords;
     } else {
         $this->okt->page->meta_keywords = util::getSiteMetaKeywords();
     }
     # ajout du numéro de page au title
     if ($this->okt->catalog->filters->params->page > 1) {
         $this->okt->page->addTitleTag(sprintf(__('c_c_Page_%s'), $this->okt->catalog->filters->params->page));
     }
     # title tag du module
     $this->okt->page->addTitleTag($this->okt->catalog->getTitle());
     # fil d'ariane
     if (!$bIsDefaultRoute) {
         $this->okt->page->breadcrumb->add($this->okt->catalog->getName(), $this->okt->catalog->config->url);
         $rsPath = $this->okt->catalog->getPath($rsCategory->id, true);
         while ($rsPath->fetch()) {
             $this->okt->page->addTitleTag($rsPath->name);
             $this->okt->page->breadcrumb->add($rsPath->name, $this->okt->page->getBaseUrl() . $this->okt->catalog->config->public_catalog_url . '/' . $rsPath->slug);
         }
     }
     # titre de la page
     $this->okt->page->setTitle($rsCategory->name);
     # titre SEO de la page
     $this->okt->page->setTitleSeo($rsCategory->name);
     # raccourcis
     $productsList->numPages = $iNumPages;
     $productsList->pager = $oProductsPager;
     # affichage du template
     echo $this->okt->tpl->render('catalog_list_tpl', array('productsList' => $productsList, 'rsCategory' => $rsCategory));
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:96,代码来源:class.catalog.controller.php

示例13: faqList

 /**
  * Affichage de la liste des questions.
  *
  */
 public function faqList()
 {
     # module actuel
     $this->okt->page->module = 'faq';
     $this->okt->page->action = 'list_questions';
     # paramètres de base de selection des articles
     $aFaqParams = array('visibility' => 1, 'language' => $this->okt->user->language);
     # initialisation des filtres
     $this->okt->faq->filtersStart();
     # ré-initialisation filtres
     if (!empty($_GET['init_filters'])) {
         $this->okt->faq->filters->initFilters();
         http::redirect($this->okt->faq->config->url);
     }
     # initialisation des filtres
     $this->okt->faq->filters->setQuestionsParams($aFaqParams);
     $this->okt->faq->filters->getFilters();
     # initialisation de la pagination
     $iNumFilteredQuestions = $this->okt->faq->getQuestions($aFaqParams, true);
     $oFaqPager = new publicPager($this->okt->faq->filters->params->page, $iNumFilteredQuestions, $this->okt->faq->filters->params->nb_per_page);
     $iNumPages = $oFaqPager->getNbPages();
     $this->okt->faq->filters->normalizePage($iNumPages);
     $aFaqParams['limit'] = ($this->okt->faq->filters->params->page - 1) * $this->okt->faq->filters->params->nb_per_page . ',' . $this->okt->faq->filters->params->nb_per_page;
     # récupération des questions
     $faqList = $this->okt->faq->getQuestions($aFaqParams);
     $count_line = 0;
     while ($faqList->fetch()) {
         $faqList->odd_even = $count_line % 2 == 0 ? 'even' : 'odd';
         $count_line++;
         $faqList->url = $faqList->getQuestionUrl();
         if (!$this->okt->faq->config->enable_rte) {
             $faqList->content = util::nlToP($faqList->content);
         }
         if ($this->okt->faq->config->public_truncat_char > 0) {
             $faqList->content = html::clean($faqList->content);
             $faqList->content = text::cutString($faqList->content, $this->okt->faq->config->public_truncat_char);
         }
     }
     unset($count_line);
     # fil d'ariane
     if (!$this->isDefaultRoute(__CLASS__, __FUNCTION__)) {
         $this->okt->page->breadcrumb->add($this->okt->faq->getName(), $this->okt->faq->config->url);
     }
     # ajout du numéro de page au title
     if ($this->okt->faq->filters->params->page > 1) {
         $this->okt->page->addTitleTag(sprintf(__('c_c_Page_%s'), $this->okt->faq->filters->params->page));
     }
     # title tag du module
     $this->okt->page->addTitleTag($this->okt->faq->getTitle());
     # titre de la page
     $this->okt->page->setTitle($this->okt->faq->getName());
     # titre SEO de la page
     $this->okt->page->setTitleSeo($this->okt->faq->getNameSeo());
     # raccourcis
     $faqList->numPages = $iNumPages;
     $faqList->pager = $oFaqPager;
     # affichage du template
     if ($this->okt->faq->config->enable_categories) {
         $sTemplatename = 'faq_list_questions_with_categories_tpl';
     } else {
         $sTemplatename = 'faq_list_questions_tpl';
     }
     echo $this->okt->tpl->render($sTemplatename, array('faqList' => $faqList));
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:68,代码来源:class.faq.controller.php

示例14: while

$iNumPages = $oProductsPager->getNbPages();
$okt->catalog->filters->normalizePage($iNumPages);
$aProductsParams['limit'] = ($okt->catalog->filters->params->page - 1) * $okt->catalog->filters->params->nb_per_page . ',' . $okt->catalog->filters->params->nb_per_page;
# récupération des produits
$productsList = $okt->catalog->getProds($aProductsParams);
$count_line = 0;
while ($productsList->fetch()) {
    $productsList->odd_even = $count_line % 2 == 0 ? 'even' : 'odd';
    $count_line++;
    $productsList->url = $productsList->getProductUrl();
    if (!$okt->catalog->config->rte_enable) {
        $productsList->content = util::nlToP($productsList->content);
    }
    if ($okt->catalog->config->public_truncat_char > 0) {
        $productsList->content = html::clean($productsList->content);
        $productsList->content = text::cutString($productsList->content, $okt->catalog->config->public_truncat_char);
    }
    $productsList->category_url = $productsList->getCategoryUrl();
}
unset($count_line);
# module actuel
$okt->page->module = 'catalog';
$okt->page->action = 'list';
# meta description
if ($okt->catalog->config->meta_description != '') {
    $okt->page->meta_description = $okt->catalog->config->meta_description;
} else {
    $okt->page->meta_description = util::getSiteMetaDesc();
}
# meta keywords
if ($okt->catalog->config->meta_keywords != '') {
开发者ID:jewelhuq,项目名称:okatea,代码行数:31,代码来源:list.php


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