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