function twitter_breadcrumb($separator = '/') { $breadcrumb = array(); $text = ''; $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); $separator = '<span class="divider">' . trim($separator) . '</span>'; $page_title = '<li><a href="' . osc_base_url() . '">' . osc_page_title() . '</a>' . $separator . '</li>'; switch ($location) { case 'item': switch ($section) { case 'item_add': break; default: $aCategories = Category::newInstance()->toRootTree((string) osc_item_category_id()); $category = ''; if (count($aCategories) == 0) { break; } foreach ($aCategories as $aCategory) { $list[] = '<li><a href="' . osc_item_category_url($aCategory['pk_i_id']) . '">' . $aCategory['s_name'] . '</a>' . $separator . '</li>'; } $category = implode('', $list); break; } switch ($section) { case 'item_add': $text = $page_title . '<li>' . __('Publish an item', 'twitter') . '</li>'; break; case 'item_edit': $text = $page_title . '<li><a href="' . osc_item_url() . '">' . osc_item_title() . '</a>' . $separator . '</li><li>' . __('Edit your item', 'twitter') . '</li>'; break; case 'send_friend': $text = $page_title . $category . '<li><a href="' . osc_item_url() . '">' . osc_item_title() . '</a>' . $separator . '</li><li>' . __('Send to a friend', 'twitter') . '</li>'; break; case 'contact': $text = $page_title . $category . '<li><a href="' . osc_item_url() . '">' . osc_item_title() . '</a>' . $separator . '<li><li>' . __('Contact seller', 'twitter') . '</li>'; break; default: $text = $page_title . $category . '<li>' . osc_item_title() . '</li>'; break; } break; case 'page': $text = $page_title . '<li>' . osc_static_page_title() . '</li>'; break; case 'search': $region = Params::getParam('sRegion'); $city = Params::getParam('sCity'); $pattern = Params::getParam('sPattern'); $category = osc_search_category_id(); $category = count($category) == 1 ? $category[0] : ''; $b_show_all = $pattern == '' && $category == '' && $region == '' && $city == ''; $b_category = $category != ''; $b_pattern = $pattern != ''; $b_region = $region != ''; $b_city = $city != ''; $b_location = $b_region || $b_city; if ($b_show_all) { $text = $page_title . '<li>' . __('Search', 'twitter') . '</li>'; break; } // init $result = $page_title; if ($b_category) { $list = array(); $aCategories = Category::newInstance()->toRootTree($category); if (count($aCategories) > 0) { $deep = 1; foreach ($aCategories as $single) { $list[] = '<li><a href="' . osc_item_category_url($single['pk_i_id']) . '">' . $single['s_name'] . '</a>' . $separator . '</li>'; $deep++; } // remove last link if (!$b_pattern && !$b_location) { $list[count($list) - 1] = preg_replace('|<li><a href.*?>(.*?)</a>.*?</li>|', '$01', $list[count($list) - 1]); } $result .= implode('', $list); } } if ($b_location) { $list = array(); $params = array(); if ($b_category) { $params['sCategory'] = $category; } if ($b_city) { $aCity = City::newInstance()->findByName($city); if (count($aCity) == 0) { $params['sCity'] = $city; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $city . '</a>' . $separator . '</li>'; } else { $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']); $params['sRegion'] = $aRegion['s_name']; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $aRegion['s_name'] . '</a>' . $separator . '</li>'; $params['sCity'] = $aCity['s_name']; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $aCity['s_name'] . '</a>' . $separator . '</li>'; } if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<li><a href.*?>(.*?)</a>.*?</li>|', '$01', $list[count($list) - 1]); } $result .= implode('', $list); } else { if ($b_region) { $params['sRegion'] = $region; $list[] = '<li><a href="' . osc_search_url($params) . '">' . $region . '</a>' . $separator . '</li>'; if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<li><a href.*?>(.*?)</a>.*?</li>|', '$01', $list[count($list) - 1]); } $result .= implode('', $list); } } } if ($b_pattern) { $result .= '<li>' . __('Search Results', 'twitter') . ': ' . $pattern . '</li>'; } // remove last separator $result = preg_replace('|' . trim($separator) . '\\s*$|', '', $result); $text = $result; break; case 'login': switch ($section) { case 'recover': $text = $page_title . '<li>' . __('Recover your password', 'twitter') . '</li>'; break; default: $text = $page_title . '<li>' . __('Login', 'twitter') . '</li>'; } break; case 'register': $text = $page_title . '<li>' . __('Create a new account', 'twitter') . '</li>'; break; case 'contact': $text = $page_title . '<li>' . __('Contact', 'twitter') . '</li>'; break; default: break; } return '<ul class="breadcrumb">' . $text . '</ul>'; }
if (osc_price_enabled_at_items()) { ?> <small><strong><?php echo osc_item_formated_price(); ?> </strong></small> · <?php } ?> <a href="<?php echo osc_item_url(); ?> "><?php echo osc_item_title(); ?> </a> <span class="label"><a href="<?php echo osc_item_category_url(osc_item_category_id()); ?> "><?php echo osc_item_category(); ?> </a></span> <?php if (osc_item_is_premium()) { ?> <span class="label success"><?php _e('Premium', 'twitter'); ?> </span><?php } ?> </h3> <p><?php