@@ 460-479 (lines=20) @@ | ||
457 | return $this->slug; |
|
458 | } |
|
459 | ||
460 | private function _makeSlug() |
|
461 | { |
|
462 | $name = $this->title; |
|
463 | ||
464 | $ghost = new self(); |
|
465 | $uniqifier = 0; |
|
466 | ||
467 | do { |
|
468 | $ghost->reset(); |
|
469 | $slug = $this->_sluggify($name); |
|
470 | $slug = $slug . ($uniqifier > 0 ? '-' . $uniqifier : ''); |
|
471 | $ghost->loadBySlug($slug); |
|
472 | $uniqifier++; |
|
473 | if ($uniqifier >= 100) { |
|
474 | throw new Ajde_Controller_Exception('Max recursion depth reached for setting slug'); |
|
475 | } |
|
476 | } while ($ghost->hasLoaded()); |
|
477 | ||
478 | return $slug; |
|
479 | } |
|
480 | ||
481 | /** |
|
482 | * @param bool $breadcrumb |
@@ 137-156 (lines=20) @@ | ||
134 | return $this->_slugPrefix . '/' . $this->slug; |
|
135 | } |
|
136 | ||
137 | private function _makeSlug() |
|
138 | { |
|
139 | $name = $this->has('title') ? $this->title : ''; |
|
140 | ||
141 | $ghost = new self(); |
|
142 | $uniqifier = 0; |
|
143 | ||
144 | do { |
|
145 | $ghost->reset(); |
|
146 | $slug = $this->_sluggify($name); |
|
147 | $slug = $slug . ($uniqifier > 0 ? '-' . $uniqifier : ''); |
|
148 | $ghost->loadBySlug($slug); |
|
149 | $uniqifier++; |
|
150 | if ($uniqifier >= 100) { |
|
151 | throw new Ajde_Controller_Exception('Max recursion depth reached for setting slug'); |
|
152 | } |
|
153 | } while ($ghost->hasLoaded()); |
|
154 | ||
155 | return $slug; |
|
156 | } |
|
157 | ||
158 | private function _sluggify($name) |
|
159 | { |