Autodoc
  • Namespace
  • Function
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • AdminDecorator
  • AdminIndexController
  • BlockController
  • BlockDecorator
  • ConfigBlock
  • ConfigController
  • ConfigOperation
  • Core
  • DeleteBlock
  • DeleteController
  • Document
  • DocumentDecorator
  • EditBlock
  • EditController
  • FormBlock
  • Hooks
  • InterlockBlock
  • Kses
  • ManageBlock
  • Module
  • Modules
  • StatsDecorator

Constants

  • OPERATION_SAVE_MODE
  • OPERATION_SAVE_MODE_CONTINUE
  • OPERATION_SAVE_MODE_DISPLAY
  • OPERATION_SAVE_MODE_LIST
  • OPERATION_SAVE_MODE_NEW

Functions

  • slugize
  • start
  • strip_stopwords
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee;
13 
14 // http://www.ranks.nl/resources/stopwords.html
15 
16 function strip_stopwords($str, $stopwords=null)
17 {
18     $stopwords = "alors au aucuns aussi autre avant avec avoir à bon car ce cela ces ceux chaque
19 ci comme comment d' dans de des dedans dehors depuis deux devrait doit donc dos droite du début elle
20 elles en encore essai est et eu fait faites fois font force haut hors ici il ils j' je juste
21 l' la le les leur là ma maintenant m' mais mes mine moins mon mot même n' ni nommés notre nous
22 nouveaux ou où par parce parole pas personnes peut peu pièce plupart pour pourquoi quand que quel
23 quelle quelles quels qui sa sans ses seulement si sien son sont sous soyez sujet sur t' ta tandis
24 tellement tels tes ton tous tout trop très tu valeur voie voient vont votre vous vu ça étaient
25 état étions été être";
26 
27     $stopwords = explode(' ', preg_replace('#\s+#', ' ', $stopwords));
28 
29     $patterns = array();
30 
31     foreach ($stopwords as $word)
32     {
33         $patterns[] = '# ' . preg_quote($word) . ' #i';
34     }
35 
36     return preg_replace($patterns, ' ', $str);
37 }
38 
39 /**
40  * Creates a string suitable for an URL path.
41  *
42  * To create the _slug_, stop words are removed with the {@link strip_stopwords} then the string
43  * is normalized with {@link ICanBoogie\normalize} and limited to 80 characters.
44  *
45  * @param string $str
46  *
47  * TODO-20130128: Add a locale_id param so that a localized dictionnary is used to strip stop
48  * words.
49  *
50  * @return string
51  */
52 function slugize($str)
53 {
54     $str = \Icybee\strip_stopwords($str);
55 
56     return trim(substr(\ICanBoogie\normalize($str), 0, 80), '-');
57 }
Autodoc API documentation generated by ApiGen 2.8.0