function logbee_header() { $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); if ($location == 'item' && $section == '') { echo ' <style type="text/css"> .logbee ul { margin: 10px 0; list-style: none; } .logbee ul li { float: left; } .logbee .clear { clear:both; } </style>'; // meta-tags $address_array = array(); if (osc_item_address() != "") { $address_array[] = osc_item_address(); } if (osc_item_city_area() != "") { $address_array[] = osc_item_city_area(); } if (osc_item_zip() != "") { $address_array[] = osc_item_zip(); } if (osc_item_city() != "") { $address_array[] = osc_item_city(); } if (osc_item_region() != "") { $address_array[] = osc_item_region(); } if (osc_item_country() != "") { $address_array[] = osc_item_country(); } $address = implode(", ", $address_array); $price = ''; if (osc_item_formated_price() != "") { $price = osc_item_formated_price(); } $email = ''; if (osc_item_show_email()) { $email = osc_item_contact_email(); } echo ' <meta property="logbee:title" content="' . osc_esc_html(osc_item_title()) . '"/> <meta property="logbee:url" content="' . osc_esc_html(osc_item_url()) . '"/> <meta property="logbee:desc" content="' . osc_esc_html(osc_item_description()) . '"/> <meta property="logbee:addr" content="' . osc_esc_html($address) . '"/> <meta property="logbee:email" content="' . osc_esc_html($email) . '"/> <meta property="logbee:price" content="' . osc_esc_html($price) . '"/>'; // do we have the cars_plugin enabled? if (osc_plugin_is_enabled('cars_attributes/index.php')) { require_once osc_plugin_path('') . '/cars_attributes/ModelCars.php'; if (osc_is_this_category('cars_plugin', osc_item_category_id())) { $detail = ModelCars::newInstance()->getCarAttr(osc_item_id()); echo ' <meta property="logbee:type" content="car"/> <meta property="logbee:mileage" content="' . osc_esc_html(@$detail['i_mileage']) . '"/> <meta property="logbee:firstreg" content="' . osc_esc_html(@$detail['i_year']) . '"/>'; } } // do we have the realestate_plugin enabled? if (osc_plugin_is_enabled('realestate_attributes/index.php')) { require_once osc_plugin_path('') . '/realestate_attributes/ModelRealEstate.php'; if (osc_is_this_category('realestate_plugin', osc_item_category_id())) { $detail = ModelRealEstate::newInstance()->getAttributes(osc_item_id()); echo ' <meta property="logbee:type" content="realty"/> <meta property="logbee:rooms" content="' . osc_esc_html(@$detail['i_num_rooms']) . '"/> <meta property="logbee:size" content="' . osc_esc_html(@$detail['s_square_meters']) . ' sqm"/>'; } } // images osc_reset_resources(); $images_array = array(); for ($i = 0; osc_has_item_resources(); $i++) { $images_array[] = osc_esc_html(osc_resource_url()); } $images = implode("|", $images_array); echo ' <meta property="logbee:imgurl" content="' . $images . '"/> '; osc_reset_resources(); echo "\n"; } }
/** * Show form to vote an item. (itemDetail) */ function voting_item_detail() { if (osc_is_this_category('voting', osc_item_category_id()) && osc_get_preference('item_voting', 'voting') == '1') { $aux_vote = ModelVoting::newInstance()->getItemAvgRating(osc_item_id()); $aux_count = ModelVoting::newInstance()->getItemNumberOfVotes(osc_item_id()); $vote['vote'] = $aux_vote['vote']; $vote['total'] = $aux_count['total']; $hash = ''; if (osc_logged_user_id() == 0) { $hash = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; $hash = sha1($hash); } else { $hash = null; } $vote['can_vote'] = true; if (osc_get_preference('user', 'voting') == 1) { if (!osc_is_web_user_logged_in()) { $vote['can_vote'] = false; } } if (!can_vote(osc_item_id(), osc_logged_user_id(), $hash)) { $vote['can_vote'] = false; } require 'item_detail.php'; } }
function digitalgoods_item_detail() { if (osc_is_this_category('digitalgoods', osc_item_category_id())) { $dg_files = DGModel::newInstance()->getFilesFromItem(osc_item_id()); require_once 'item_detail.php'; } }
function allSeo_description_filter($text) { // CLEAN EXISTING DESCRIPTION $text = ''; // HOME PAGE if (osc_is_home_page()) { $text = osc_page_description(); } // STATIC PAGE if (osc_is_static_page()) { if (GetPageDesc() == '') { $text = osc_highlight(osc_static_page_text(), 140, '', ''); } else { $text = GetPageDesc(); } } // SEARCH & CATEGORY PAGE if (osc_is_search_page()) { $cat = osc_search_category_id(); $cat_id = $cat[0]; $cat_field = Category::newInstance()->findByPrimaryKey($cat_id); $country = GetCtrDesc(osc_search_country()) ? GetCtrDesc(osc_search_country()) : osc_search_country(); $region = GetRegDesc(osc_search_region()) ? GetRegDesc(osc_search_region()) : osc_search_region(); $city = osc_search_city(); if (GetCatDesc($cat_id) != '') { $desc = GetCatDesc($cat_id); } else { $desc = $cat_field['s_name']; } $text = $desc; // ADD LOCATION DESCRIPTION if ($country != '') { $text .= ($text != '' ? ' - ' : '') . $country; } if ($region != '') { $text .= ($text != '' ? ' - ' : '') . $region; } if ($city != '') { $text .= ($text != '' ? ' - ' : '') . $city; } // Improve search/category title adding part of listings in this category/search if (osc_get_preference('allSeo_search_improve_desc', 'plugin-all_in_one') == 1) { osc_reset_custom_items(); osc_query_item(array("category" => $cat_id, "country_name" => $country, "region_name" => $region, "city_name" => $city)); while (osc_has_custom_items()) { $item = Item::newInstance()->findByPrimaryKey(osc_item_id()); $con = strip_tags($item['s_description']); if (osc_item_city() != '') { $text .= ' - ' . osc_item_city(); } if ($con != '') { $text .= ', ' . osc_highlight($con, 100); } } } $text = osc_highlight($text, 500); osc_reset_items(); } // Listing page if (osc_is_ad_page()) { if (GetItemDesc() == '') { if (GetCatDesc(osc_item_category_id()) != '') { $desc = GetCatDesc(osc_item_category_id()); } else { $desc = osc_item_category(); } $item = Item::newInstance()->findByPrimaryKey(osc_item_id()); $text = $desc . ' - ' . osc_highlight($item['s_description'], 120) . ', ' . SeoLocationShow(); } else { $text = GetItemDesc(); } } return $text; }
<?php if (is_voting_enabled()) { ?> <div class="rate_me rate_me_star"> <?php osclasswizards_item_star_rating(osc_item_id()); ?> <span><?php echo osclasswizards_item_avg_rating(osc_item_id()); ?> </span> </div> <?php } ?> <div class="attribute_list"> <span class="category"><i class="fa fa-<?php echo osclasswizards_category_icon(osc_item_category_id()); ?> "></i><?php echo osc_item_category(); ?> </span> <span class="location"><i class="fa fa-map-marker"></i> <?php echo osc_item_city(); ?> <?php if (osc_item_region() != '') { ?> (<?php echo osc_item_region(); ?> ) <?php
if ($open == 1) { if (can_vote($itemId, $userId, $hash)) { ModelVoting::newInstance()->insertItemVote($itemId, $userId, $iVote, $hash); } } else { if ($user == 1 && is_null($hash)) { if (can_vote($itemId, $userId, $hash)) { ModelVoting::newInstance()->insertItemVote($itemId, $userId, $iVote, $hash); } } } } // return updated voting $item = Item::newInstance()->findByPrimaryKey($itemId); View::newInstance()->_exportVariableToView('item', $item); if (osc_is_this_category('voting', osc_item_category_id())) { $aux_vote = ModelVoting::newInstance()->getItemAvgRating(osc_item_id()); $aux_count = ModelVoting::newInstance()->getItemNumberOfVotes(osc_item_id()); $vote['vote'] = $aux_vote['vote']; $vote['total'] = $aux_count['total']; $vote['can_vote'] = true; if (osc_get_preference('user', 'voting') == 1) { if (!osc_is_web_user_logged_in()) { $vote['can_vote'] = false; } } if (!can_vote(osc_item_id(), osc_logged_user_id(), $hash)) { $vote['can_vote'] = false; } require 'view_votes.php'; }
function breadcrumbs($separator = '/') { $text = ''; $location = Rewrite::newInstance()->get_location(); $section = Rewrite::newInstance()->get_section(); $separator = ' ' . trim($separator) . ' '; $page_title = '<a href="' . osc_base_url() . '"><span class="bc_root">' . osc_page_title() . '</span></a>'; 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; } $deep = 1; foreach ($aCategories as $aCategory) { $list[] = '<a href="' . breadcrumbs_category_url($aCategory['pk_i_id']) . '"><span class="bc_level_' . $deep . '">' . $aCategory['s_name'] . '</span></a>'; $deep++; } $category = implode($separator, $list) . $separator; $category = preg_replace('|' . trim($separator) . '\\s*$|', '', $category); break; } switch ($section) { case 'item_add': $text = $page_title . $separator . '<span class="bc_last">' . __('Publish an item', 'breadcrumbs'); break; case 'item_edit': $text = $page_title . $separator . $category . $separator . '<a href="' . osc_item_url() . '"><span class="bc_item">' . osc_item_title() . '</span></a>' . $separator . '<span class="bc_last">' . __('Edit your item', 'breadcrumbs') . '</span>'; break; case 'send_friend': $text = $page_title . $separator . $category . $separator . '<a href="' . osc_item_url() . '"><span class="bc_item">' . osc_item_title() . '</span></a>' . $separator . '<span class="bc_last">' . __('Send to a friend', 'breadcrumbs') . '</span>'; break; case 'contact': $text = $page_title . $separator . $category . $separator . '<a href="' . osc_item_url() . '"><span class="bc_item">' . osc_item_title() . '</span></a>' . $separator . '<span class="bc_last">' . __('Contact seller', 'breadcrumbs') . '</span>'; break; default: $text = $page_title . $separator . $category . $separator . '<span class="bc_last">' . osc_item_title() . '</span>'; break; } break; case 'page': $text = $page_title . $separator . '<span class="bc_last">' . osc_static_page_title() . '</span>'; break; case 'search': $region = osc_search_region(); $city = osc_search_city(); $pattern = osc_search_pattern(); $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 . $separator . '<span class="bc_last">' . __('Search', 'breadcrumbs') . '</span>'; break; } // init $result = $page_title . $separator; if ($b_category) { $list = array(); $aCategories = Category::newInstance()->toRootTree($category); if (count($aCategories) > 0) { $deep = 1; foreach ($aCategories as $single) { $list[] = '<a href="' . breadcrumbs_category_url($single['pk_i_id']) . '"><span class="bc_level_' . $deep . '">' . $single['s_name'] . '</span></a>'; $deep++; } // remove last link if (!$b_pattern && !$b_location) { $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]); } $result .= implode($separator, $list) . $separator; } } 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[] = '<a href="' . osc_search_url($params) . '"><span class="bc_city">' . $city . '</span></a>'; } else { $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']); $params['sRegion'] = $aRegion['s_name']; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_region">' . $aRegion['s_name'] . '</span></a>'; $params['sCity'] = $aCity['s_name']; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_city">' . $aCity['s_name'] . '</span></a>'; } if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]); } $result .= implode($separator, $list) . $separator; } else { if ($b_region) { $params['sRegion'] = $region; $list[] = '<a href="' . osc_search_url($params) . '"><span class="bc_region">' . $region . '</span></a>'; if (!$b_pattern) { $list[count($list) - 1] = preg_replace('|<a href.*?>(.*?)</a>|', '$01', $list[count($list) - 1]); } $result .= implode($separator, $list) . $separator; } } } if ($b_pattern) { $result .= '<span class="bc_last">' . __('Search Results', 'breadcrumbs') . ': ' . $pattern . '</span>' . $separator; } // remove last separator $result = preg_replace('|' . trim($separator) . '\\s*$|', '', $result); $text = $result; break; case 'login': switch ($section) { case 'recover': $text = $page_title . $separator . '<span class="bc_last">' . __('Recover your password', 'breadcrumbs') . '</span>'; default: $text = $page_title . $separator . '<span class="bc_last">' . __('Login', 'breadcrumbs') . '</span>'; } break; case 'register': $text = $page_title . $separator . '<span class="bc_last">' . __('Create a new account', 'breadcrumbs') . '</span>'; break; case 'user': $user_dashboard = '<a href="' . osc_user_dashboard_url() . '"><span class="bc_user">' . __('My account', 'breadcrumbs') . '</span></a>'; switch ($section) { case 'dashboard': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Dashboard', 'breadcrumbs') . '</span>'; break; case 'items': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Manage my items', 'breadcrumbs') . '</span>'; break; case 'alerts': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Manage my alerts', 'breadcrumbs') . '</span>'; break; case 'profile': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Update my profile', 'breadcrumbs') . '</span>'; break; case 'change_email': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Change my email', 'breadcrumbs') . '</span>'; break; case 'change_password': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Change my password', 'breadcrumbs') . '</span>'; break; case 'forgot': $text = $page_title . $separator . $user_dashboard . $separator . '<span class="bc_last">' . __('Recover my password', 'breadcrumbs') . '</span>'; break; } break; case 'contact': $text = $page_title . $separator . '<span class="bc_last">' . __('Contact', 'breadcrumbs') . '</span>'; break; default: break; } echo $text; return true; }
echo osc_item_category_id(); ?> )" > <div style="padding-bottom:4px;text-align:center;color:#000;"> <!--<img class="img-responsive" src="<?php echo osc_base_url() . 'oc-content/themes/classified/images/down.jpg'; ?> ">--> <span class="glyphicon glyphicon-chevron-down"></span> </div> </a> <a href="javascript:void(0);" class="hideAll_<?php echo osc_item_category_id(); ?> " onClick="hideAllSubcategories(<?php echo osc_item_category_id(); ?> )" style="display:none;"> <div style="padding-bottom:4px;text-align:center;color:#000"> <span class="glyphicon glyphicon-chevron-up"></span> </div> </a> </div> </div> <?php } ?> <?php
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
function republish_url() { $conn = getConnection(); $pCats = $conn->osc_dbFetchResult("SELECT * FROM %st_plugin_category WHERE s_plugin_name = '%s' AND fk_i_category_id = '%d'", DB_TABLE_PREFIX, 'adManage', osc_item_category_id()); $pCatCount = count($pCats); $adManage_url = ''; $rSecret = $conn->osc_dbFetchResult("SELECT * FROM %st_item_adManage_limit WHERE fk_i_item_id = '%d'", DB_TABLE_PREFIX, osc_item_id()); if (($rSecret['r_times'] < osc_adManage_repubTimes() || osc_adManage_repubTimes() == 0) && $pCatCount != 0) { if (osc_item_is_expired()) { $adManage_url = osc_base_url() . 'oc-content/plugins/advanced_ad_management/item_republish.php?repub=republish&id=' . osc_item_id() . '&rSecret=' . $rSecret['r_secret']; } } return $adManage_url; }
function osc_item_category_description($locale = "") { if ($locale == "") { $locale = osc_current_user_locale(); } $category = Category::newInstance()->findByPrimaryKey(osc_item_category_id()); return osc_field($category, "s_description", $locale); }
/** * Checks to see if the price is enabled for this category. * * @param string $locale * @return string */ function osc_item_category_price_enabled($catId = null) { if ($catId == null) { $category = Category::newInstance()->findByPrimaryKey(osc_item_category_id()); } else { $category = Category::newInstance()->findByPrimaryKey($catId); } return $category['b_price_enabled'] == 1 ? true : false; }
/** * Gets current page url * * @param string $locale * @return string */ function osc_static_page_url($locale = '') { if (osc_rewrite_enabled()) { $sanitized_categories = array(); $cat = Category::newInstance()->hierarchy(osc_item_category_id()); for ($i = count($cat); $i > 0; $i--) { $sanitized_categories[] = $cat[$i - 1]['s_slug']; } $url = str_replace('{PAGE_TITLE}', osc_static_page_title(), str_replace('{PAGE_ID}', osc_static_page_id(), str_replace('{PAGE_SLUG}', urlencode(osc_static_page_slug()), osc_get_preference('rewrite_page_url')))); if ($locale != '') { $path = osc_base_url() . $locale . "/" . $url; } else { $path = osc_base_url() . $url; } } else { if ($locale != '') { $path = osc_base_url(true) . "?page=page&id=" . osc_static_page_id() . "&lang=" . $locale; } else { $path = osc_base_url(true) . "?page=page&id=" . osc_static_page_id(); } } return $path; }
/** * Create automatically the url of the item details page * * @return string */ function osc_item_url($locale = '') { if (osc_rewrite_enabled()) { $sanitized_title = osc_sanitizeString(osc_item_title()); $sanitized_category = ''; $cat = Category::newInstance()->hierarchy(osc_item_category_id()); for ($i = count($cat); $i > 0; $i--) { $sanitized_category .= $cat[$i - 1]['s_slug'] . '/'; } if ($locale != '') { $path = osc_base_url() . sprintf('%s_%s%s_%d', $locale, $sanitized_category, $sanitized_title, osc_item_id()); } else { $path = osc_base_url() . sprintf('%s%s_%d', $sanitized_category, $sanitized_title, osc_item_id()); } } else { //$path = osc_base_url(true) . sprintf('?page=item&id=%d', osc_item_id()) ; $path = osc_item_url_ns(osc_item_id(), $locale); } return $path; }
public function init() { if (in_array($this->getLocation(), array('item', 'page', 'search', 'login', 'register', 'user', 'contact'))) { $l = array('url' => osc_base_url(), 'title' => osc_page_title()); $this->addLevel($l); } switch ($this->getLocation()) { case 'item': if ($this->getSection() == 'item_add') { $l = array('title' => $this->title['item_add']); $this->addLevel($l); break; } $aCategory = osc_get_category('id', osc_item_category_id()); // remove View::newInstance()->_erase('categories'); View::newInstance()->_erase('subcategories'); View::newInstance()->_exportVariableToView('category', $aCategory); $l = array('url' => osc_search_category_url(), 'title' => osc_category_name()); $this->addLevel($l); switch ($this->getSection()) { case 'item_edit': $l = array('url' => osc_item_url(), 'title' => osc_item_title()); $this->addLevel($l); $l = array('title' => $this->title['item_edit']); $this->addLevel($l); break; case 'send_friend': $l = array('url' => osc_item_url(), 'title' => osc_item_title()); $this->addLevel($l); $l = array('title' => $this->title['item_send_friend']); $this->addLevel($l); break; case 'contact': $l = array('url' => osc_item_url(), 'title' => osc_item_title()); $this->addLevel($l); $l = array('title' => $this->title['item_contact']); $this->addLevel($l); break; case '': $l = array('title' => osc_item_title()); $this->addLevel($l); break; } break; case 'search': $region = osc_search_region(); $city = osc_search_city(); $pattern = osc_search_pattern(); $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; // show all if ($b_show_all) { $l = array('title' => $this->title['search']); $this->addLevel($l); break; } // category if ($b_category) { $aCategories = Category::newInstance()->toRootTree($category); foreach ($aCategories as $c) { View::newInstance()->_erase('categories'); View::newInstance()->_erase('subcategories'); View::newInstance()->_exportVariableToView('category', $c); $l = array('url' => osc_search_category_url(), 'title' => osc_category_name()); $this->addLevel($l); } } // location if ($b_location) { $params = array(); if ($b_category) { $params['sCategory'] = $category; } if ($b_city) { //print_r("~~~~~~~~~~~~~~~~~~~".$city."~~~~~~~~~~~~~~~~~~~~"); $aCity = City::newInstance()->findByName($city); if (count($aCity) == 0) { $params['sCity'] = $city; $l = array('url' => osc_search_url($params), 'title' => $city); $this->addLevel($l); } else { $aRegion = Region::newInstance()->findByPrimaryKey($aCity['fk_i_region_id']); $params['sRegion'] = $aRegion['s_name']; $l = array('url' => osc_search_url($params), 'title' => $aRegion['s_name']); $this->addLevel($l); $params['sCity'] = $aCity['s_name']; $l = array('url' => osc_search_url($params), 'title' => $aCity['s_name']); $this->addLevel($l); } } else { if ($b_region) { $params['sRegion'] = $region; $l = array('url' => osc_search_url($params), 'title' => $region); $this->addLevel($l); } } } // pattern if ($b_pattern) { $l = array('title' => sprintf($this->title['search_pattern'], $pattern)); $this->addLevel($l); } // remove url from the last node $nodes = $this->getaLevel(); if ($nodes > 0) { if (array_key_exists('url', $nodes[count($nodes) - 1])) { unset($nodes[count($nodes) - 1]['url']); } } $this->setaLevel($nodes); break; case 'user': // use dashboard without url if you're in the dashboards if ($this->getSection() == 'dashboard') { $l = array('title' => $this->title['user_dashboard']); $this->addLevel($l); break; } // use dashboard without url if you're in the dashboards if ($this->getSection() == 'pub_profile') { $l = array('title' => sprintf($this->title['user_dashboard_profile'], osc_user_name())); $this->addLevel($l); break; } $l = array('url' => osc_user_dashboard_url(), 'title' => $this->title['user_account']); $this->addLevel($l); switch ($this->getSection()) { case 'items': $l = array('title' => $this->title['user_items']); $this->addLevel($l); break; case 'alerts': $l = array('title' => $this->title['user_alerts']); $this->addLevel($l); break; case 'profile': $l = array('title' => $this->title['user_profile']); $this->addLevel($l); break; case 'change_email': $l = array('title' => $this->title['user_change_email']); $this->addLevel($l); break; case 'change_password': $l = array('title' => $this->title['user_change_password']); $this->addLevel($l); break; case 'change_username': $l = array('title' => $this->title['user_change_username']); $this->addLevel($l); break; } break; case 'login': switch ($this->getSection()) { case 'recover': $l = array('title' => $this->title['login_recover']); $this->addLevel($l); break; case 'forgot': $l = array('title' => $this->title['login_forgot']); $this->addLevel($l); break; case '': $l = array('title' => $this->title['login']); $this->addLevel($l); break; } break; case 'register': $l = array('title' => $this->title['register']); $this->addLevel($l); break; case 'page': $l = array('title' => osc_static_page_title()); $this->addLevel($l); break; case 'contact': $l = array('title' => $this->title['contact']); $this->addLevel($l); break; } }
/** * Gets category description from current item, if $locale is unspecified $locale is current user locale * * @param type $locale * @return string */ function osc_item_category_description($locale = "") { if ($locale == "") { $locale = osc_current_user_locale(); } if (!View::newInstance()->_exists('item_category')) { View::newInstance()->_exportVariableToView('item_category', Category::newInstance()->findByPrimaryKey(osc_item_category_id())); } $category = View::newInstance()->_get('item_category'); return osc_field($category, "s_description", $locale); }
<?php $category = osc_get_category('id', osc_item_category_id()); $category_url = osc_search_url(array('sCategory' => $category['s_slug'])); ?> <div class="item <?php echo $class; if (osc_item_is_premium()) { echo ' premium'; } ?> "> <?php if (osc_images_enabled_at_items()) { ?> <?php if (osc_count_item_resources()) { ?> <a class="" href="<?php echo osc_item_url(); ?> " title="<?php echo osc_esc_html(osc_item_title()); ?> "><img src="<?php echo osc_resource_original_url(); ?> " title="" alt="<?php echo osc_esc_html(osc_item_title()); ?> " width="220" ></a>
public static function category_two_selects($categories = null, $item = null, $default_item = null, $parent_selectable = false) { $categoryID = Params::getParam('catId'); if (osc_item_category_id() != null) { $categoryID = osc_item_category_id(); } if (Session::newInstance()->_getForm('catId') != '') { $categoryID = Session::newInstance()->_getForm('catId'); } $subcategoryID = ''; if (!Category::newInstance()->isRoot($categoryID)) { $subcategoryID = $categoryID; $category = Category::newInstance()->findRootCategory($categoryID); $categoryID = $category['pk_i_id']; } if ($categories == null) { if (View::newInstance()->_exists('categories')) { $categories = View::newInstance()->_get('categories'); } else { $categories = osc_get_categories(); } } if ($item == null) { $item = osc_item(); } $subcategory = array(); ?> <select id="parentCategory" name="parentCatId"> <option value=""><?php _e('Select Category'); ?> </option> <?php foreach ($categories as $_category) { $selected = isset($item["fk_i_category_id"]) && $item["fk_i_category_id"] == $_category['pk_i_id'] || isset($categoryID) && $categoryID == $_category['pk_i_id']; if ($selected) { $subcategory = $_category; } echo '<option value="' . $_category['pk_i_id'] . '" ' . ($selected ? 'selected="selected"' : '') . '>' . $_category['s_name'] . '</option>'; } ?> </select> <select id="catId" name="catId"> <?php if (!empty($subcategory)) { if (count($subcategory['categories']) > 0) { echo '<option value="">' . __('Select Subcategory') . '</option>'; foreach ($subcategory['categories'] as $c) { $selected = isset($item["fk_i_category_id"]) && $item["fk_i_category_id"] == $c['pk_i_id'] || isset($subcategoryID) && $subcategoryID == $c['pk_i_id']; echo '<option value="' . $c['pk_i_id'] . '" ' . ($selected ? 'selected="selected"' : '') . '>' . $c['s_name'] . '</option>'; } } else { echo '<option value="' . $categoryID . '" >' . __('No Subcategory') . '</option>'; } } else { echo '<option value="">' . __('Select Subcategory') . '</option>'; } ?> </select> <script type="text/javascript" charset="utf-8"> <?php foreach ($categories as $c) { if (count($c['categories']) > 0) { $subcategory = array(); for ($i = 0; $i < count($c['categories']); $i++) { $subcategory[] = array($c['categories'][$i]['pk_i_id'], $c['categories'][$i]['s_name']); } printf('var categories_%1$s = %2$s;', $c['pk_i_id'], json_encode($subcategory)); echo PHP_EOL; } } ?> osc.item_post = {}; osc.item_post.category_id = '<?php echo $categoryID; ?> '; osc.item_post.subcategory_id = '<?php echo $subcategoryID; ?> '; $(document).ready(function(){ $("#parentCategory").bind('change', function(){ var categoryID = $(this).val(); if( categoryID == 0 ) { return false; } categories = window['categories_' + categoryID]; if( categories==null || !$.isArray(categories) ) { var options = '<option value="' + categoryID + '" >' + osc.langs.no_subcategory + '</option>'; } else { var options = '<option value="' + categoryID + '" >' + osc.langs.select_subcategory + '</option>'; $.each(categories, function(index, value){ options += '<option value="' + value[0] + '">' + value[1] + '</option>'; }); }; $('#catId').html(options); $("#catId").next("a").find(".select-box-label").text(osc.langs.select_subcategory); $("#catId").change(); }); }); </script> <?php }
function related_listings() { View::newInstance()->_exportVariableToView('items', array()); $mSearch = new Search(); $mSearch->addCategory(osc_item_category_id()); $mSearch->addRegion(osc_item_region()); $mSearch->addItemConditions(sprintf("%st_item.pk_i_id < %s ", DB_TABLE_PREFIX, osc_item_id())); $mSearch->limit('0', '3'); $aItems = $mSearch->doSearch(); $iTotalItems = count($aItems); if ($iTotalItems == 3) { View::newInstance()->_exportVariableToView('items', $aItems); return $iTotalItems; } unset($mSearch); $mSearch = new Search(); $mSearch->addCategory(osc_item_category_id()); $mSearch->addItemConditions(sprintf("%st_item.pk_i_id != %s ", DB_TABLE_PREFIX, osc_item_id())); $mSearch->limit('0', '3'); $aItems = $mSearch->doSearch(); $iTotalItems = count($aItems); if ($iTotalItems > 0) { View::newInstance()->_exportVariableToView('items', $aItems); return $iTotalItems; } unset($mSearch); return 0; }
$item_url = osc_item_url(); $img_title = osc_item_title(); if (!empty($resource) || $resource != "") { $resource_path = osc_apply_filter('resource_path', osc_base_url() . $resource[0]['s_path']); $img_source = (string) $resource_path . $resource[0]['pk_i_id'] . "." . $resource[0]['s_extension']; } else { $img_source = osc_current_web_theme_url('images/no-image-available.png'); } $total_listing = get_total_listing_by_parent($sa['cat_id']); $total_item_views = get_total_item_views($sa['cat_id']); if ($total_item_views == null || empty($total_item_views)) { $total_item_views = '0'; } else { $total_item_views = $total_item_views[0]['TotalViews']; } $category_name = get_parent_category_name(osc_item_category_id()); } ?> <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12"> <div class="automobile"> <h5 class="auto"><?php echo $category_name; ?> </h5> <a href="<?php echo $item_url; ?> "> <img src="<?php echo $img_source; ?>
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>'; }
public static function category_multiple_selects($categories = null, $item = null, $default_item = null, $parent_selectable = false) { $categoryID = Params::getParam('catId'); if (osc_item_category_id() != null) { $categoryID = osc_item_category_id(); } if (Session::newInstance()->_getForm('catId') != '') { $categoryID = Session::newInstance()->_getForm('catId'); } if ($item == null) { $item = osc_item(); } if (isset($item['fk_i_category_id'])) { $categoryID = $item['fk_i_category_id']; } $tmp_categories_tree = Category::newInstance()->toRootTree($categoryID); $categories_tree = array(); foreach ($tmp_categories_tree as $t) { $categories_tree[] = $t['pk_i_id']; } unset($tmp_categories_tree); if ($categories == null) { $categories = Category::newInstance()->listEnabled(); } parent::generic_input_hidden("catId", $categoryID); ?> <div id="select_holder"></div> <script type="text/javascript" charset="utf-8"> <?php $tmp_cat = array(); foreach ($categories as $c) { if ($c['fk_i_parent_id'] == null) { $c['fk_i_parent_id'] = 0; } $tmp_cat[$c['fk_i_parent_id']][] = array($c['pk_i_id'], $c['s_name']); } foreach ($tmp_cat as $k => $v) { echo 'var categories_' . $k . ' = ' . json_encode($v) . ';' . PHP_EOL; } ?> if(osc==undefined) { var osc = {}; } if(osc.langs==undefined) { osc.langs = {}; } if(osc.langs.select_category==undefined) { osc.langs.select_category = '<?php echo osc_esc_js(__('Select category')); ?> '; } if(osc.langs.select_subcategory==undefined) { osc.langs.select_subcategory = '<?php echo osc_esc_js(__('Select subcategory')); ?> '; } osc.item_post = {}; osc.item_post.category_id = '<?php echo $categoryID; ?> '; osc.item_post.category_tree_id = <?php echo json_encode($categories_tree); ?> ; $(document).ready(function(){ <?php if ($categoryID == array()) { ?> draw_select(1,0); <?php } else { ?> draw_select(1,0); <?php for ($i = 0; $i < count($categories_tree) - 1; $i++) { ?> draw_select(<?php echo $i + 2; ?> ,<?php echo $categories_tree[$i]; ?> ); <?php } ?> <?php } ?> $('body').on("change", '[name^="select_"]', function() { var depth = parseInt($(this).attr("depth")); for(var d=(depth+1);d<=4;d++) { $("#select_"+d).trigger('removed'); $("#select_"+d).remove(); } $("#catId").attr("value", $(this).val()); $("#catId").change(); if(catPriceEnabled[$('#catId').val()] == 1) { $('.price').show(); } else { $('.price').hide(); $('#price').val('') ; } if((depth==1 && $(this).val()!=0) || (depth>1 && $(this).val()!=$("#select_"+(depth-1)).val())) { draw_select(depth+1, $(this).val()); } return true; }); }); function draw_select(select, categoryID) { tmp_categories = window['categories_' + categoryID]; if( tmp_categories!=null && $.isArray(tmp_categories) ) { $("#select_holder").before('<select id="select_'+select+'" name="select_'+select+'" depth="'+select+'"></select>'); if(categoryID==0) { var options = '<option value="' + categoryID + '" >' + osc.langs.select_category + '</option>'; }else { var options = '<option value="' + categoryID + '" >' + osc.langs.select_subcategory + '</option>'; } $.each(tmp_categories, function(index, value){ options += '<option value="' + value[0] + '" '+(value[0]==osc.item_post.category_tree_id[select-1]?'selected="selected"':'')+'>' + value[1] + '</option>'; }); osc.item_post.category_tree_id[select-1] = null; $('#select_'+select).html(options); $('#select_'+select).next("a").find(".select-box-label").text(osc.langs.select_subcategory); $('#select_'+select).trigger("created"); }; } </script> <?php }
/** * Create automatically the url of the item details page * * @param string $locale * @return string */ function osc_item_url($locale = '') { if (osc_rewrite_enabled()) { $sanitized_categories = array(); $cat = Category::newInstance()->hierarchy(osc_item_category_id()); for ($i = count($cat); $i > 0; $i--) { $sanitized_categories[] = $cat[$i - 1]['s_slug']; } $url = str_replace('{CATEGORIES}', implode("/", $sanitized_categories), str_replace('{ITEM_ID}', osc_item_id(), str_replace('{ITEM_TITLE}', osc_sanitizeString(osc_item_title()), osc_get_preference('rewrite_item_url')))); if ($locale != '') { $path = osc_base_url() . $locale . "/" . $url; } else { $path = osc_base_url() . $url; } } else { $path = osc_item_url_ns(osc_item_id(), $locale); } return $path; }
/** * Return true if item is expired, else return false * * @return boolean */ function osc_item_is_expired() { if (osc_item_is_premium()) { return false; } else { $category = Category::newInstance()->findByPrimaryKey(osc_item_category_id()); $expiration = $category['i_expiration_days']; if ($expiration == 0) { return false; } else { $date_expiration = strtotime(date("Y-m-d H:i:s", strtotime(osc_item_pub_date())) . " +{$expiration} day"); $now = strtotime(date('Y-m-d H:i:s')); if ($date_expiration < $now) { return true; } else { return false; } } } }