@@ 23-31 (lines=9) @@ | ||
20 | * @param string $title The title to use for the file |
|
21 | * @return string The file safe title |
|
22 | */ |
|
23 | static function filename($title) |
|
24 | { |
|
25 | $result = strtolower(trim($title)); |
|
26 | $result = str_replace("'", '', $result); |
|
27 | $result = preg_replace('#[^a-z0-9_]+#', '-', $result); |
|
28 | $result = preg_replace('#\-{2,}#', '-', $result); |
|
29 | ||
30 | return preg_replace('#(^\-+|\-+$)#D', '', $result); |
|
31 | } |
|
32 | ||
33 | /** |
|
34 | * Builds a new Excel Spreadsheet object |
@@ 490-498 (lines=9) @@ | ||
487 | $this->slug = $this->_makeSlug(); |
|
488 | } |
|
489 | ||
490 | private function _sluggify($name) |
|
491 | { |
|
492 | // @see http://stackoverflow.com/a/5240834 |
|
493 | $slug = iconv('UTF-8', 'ASCII//TRANSLIT', $name); |
|
494 | $slug = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $name); |
|
495 | $slug = strtolower(trim($slug, '-')); |
|
496 | $slug = preg_replace("/[\/_| -]+/", '-', $slug); |
|
497 | ||
498 | return $slug; |
|
499 | } |
|
500 | ||
501 | public function loadBySlug($slug, $publishedCheck = false) |
@@ 158-166 (lines=9) @@ | ||
155 | return $slug; |
|
156 | } |
|
157 | ||
158 | private function _sluggify($name) |
|
159 | { |
|
160 | // @see http://stackoverflow.com/a/5240834 |
|
161 | $slug = iconv('UTF-8', 'ASCII//TRANSLIT', $name); |
|
162 | $slug = preg_replace("/[^a-zA-Z0-9\/_| -]/", '', $name); |
|
163 | $slug = strtolower(trim($slug, '-')); |
|
164 | $slug = preg_replace("/[\/_| -]+/", '-', $slug); |
|
165 | ||
166 | return $slug; |
|
167 | } |
|
168 | ||
169 | /** |