Exemplo n.º 1
0
 /**
  * Adds a new custom segment at the end of the breadcrumbs array
  *
  * @access public
  * @param string $title : the title of the segment
  * @param string $url : the url of the segment the segment is referring to
  * @param array $breadcrumbs : the breadcrumbs array. If set to NULL this method will just return one segment array without merging it to anything
  * @return array : the new breadcrumbs array with the custom segment at the end or just the segment array
  */
 public function new_segment($title, $url, $breadcrumbs = NULL)
 {
     if (!is_valid_string($title) || !is_valid_ci_url($url) || !is_array($breadcrumbs) && $breadcrumbs !== NULL) {
         if ($breadcrumbs === NULL) {
             return NULL;
         }
         return $breadcrumbs;
     }
     $segment = array('title' => $title, 'url' => $url);
     $data = array();
     if ($breadcrumbs !== NULL) {
         $data = $breadcrumbs;
     }
     array_push($data, $segment);
     return $data;
 }
Exemplo n.º 2
0
 /**
  * Adds a new custom segment at the end of the breadcrumbs array
  *
  * @access public
  * @param string $title : the title of the segment
  * @param string $url : the url of the segment the segment is referring to
  * @param array $breadcrumbs : the breadcrumbs array. If set to NULL this method will just return one segment array without merging it to anything
  * @return array : the new breadcrumbs array with the custom segment at the end or just the segment array
  */
 public function new_segment($title, $url, $breadcrumbs = array())
 {
     if (!is_valid_string($title) && !is_valid_ci_url($url) && !is_valid_slug($url) && !is_valid_number($url) && !is_array($breadcrumbs) && !empty($breadcrumbs)) {
         if (!empty($breadcrumbs)) {
             return FALSE;
         }
         return $breadcrumbs;
     }
     if (!empty($breadcrumbs) && !is_valid_ci_url($url)) {
         $last = $breadcrumbs[count($breadcrumbs) - 1]['url'];
         $url = strip_trailing_slash($last) . '/' . $url;
     }
     $segment = array('title' => $title, 'url' => $url);
     $breadcrumbs[] = $segment;
     return $breadcrumbs;
 }