/** * widget for blog stuff * * @param array $vars variables * * @return html */ function Blog_widget2($vars = null) { $c = ''; global $PAGEDATA; $entry_ids = array(); if ($vars->tag) { $rs = dbAll('select entry_id from blog_tags where tag="' . addslashes($vars->tag) . '"'); foreach ($rs as $r) { $entry_ids[] = $r['entry_id']; } } $blog_author = ''; $excerpts_offset = isset($vars->excerpts_offset) && $vars->excerpts_offset ? $vars->excerpts : 0; $excerpts_per_page = isset($vars->excerpts) && $vars->excerpts ? $vars->excerpts : 2; $links_prefix = $PAGEDATA->getRelativeURL(); if ($PAGEDATA->type != 'blog|blog') { $page = PAGE::getInstanceByType('blog'); $links_prefix = $page->getRelativeURL(); } /** @noinspection PhpUnusedLocalVariableInspection */ $excerpt_length = 100; /** @noinspection PhpUnusedLocalVariableInspection */ $nobottomlinks = true; if (!isset($vars->widgetType)) { $vars->widgetType = '0'; } switch ($vars->widgetType) { case '1': // { featured posts require dirname(__FILE__) . '/featured-posts.php'; break; // } // } default: // { if (isset($vars->imageSizeX) && $vars->imageSizeX) { /** @noinspection PhpUnusedLocalVariableInspection */ $excerptImageSizeX = (int) $vars->imageSizeX; } if (isset($vars->imageSizeY) && $vars->imageSizeY) { /** @noinspection PhpUnusedLocalVariableInspection */ $excerptImageSizeY = (int) $vars->imageSizeY; } require dirname(__FILE__) . '/excerpts.php'; break; //} } return $c; }
/** * get category url * * @param int $cid category id * * @return string */ function ClassifiedAds_getCategoryUrl($cid) { if ((int) $cid === 0) { return PAGE::getInstanceByType('classified-ads')->getRelativeUrl(); } if (!isset($GLOBALS['ClassifiedAdsUrls'])) { $GLOBALS['ClassifiedAdsUrls'] = array(); } if (isset($GLOBALS['ClassifiedAdsUrls'][$cid])) { return $GLOBALS['ClassifiedAdsUrls'][$cid]; } $r = dbRow('select name,parent from classifiedads_categories where id=' . $cid); $url = ClassifiedAds_getCategoryUrl($r['parent']) . '/' . preg_replace('/[^a-z0-9A-Z]/', '-', $r['name']); $GLOBALS['ClassifiedAdsUrls'][$cid] = $url; return $url; }