public function display($pid) { if (!isset($this->optObj)) { if (!$this->loadProfileOptions()) { return ''; } } erpPROPaths::requireOnce(erpPROPaths::$erpPROTheme); if (!is_int($pid) || erpPROTheme::areOthersSuppressed()) { $this->setSuppressOthers(); return ''; } erpPROPaths::requireOnce(erpPROPaths::$VPluginThemeFactory); erpPROPaths::requireOnce(erpPROPaths::$erpProRelated); $relatedObj = erpProRelated::get_instance($this->optObj); $result = $relatedObj->getRelated($pid); $ratings = $relatedObj->getRatingsFromRelDataObj(); if (empty($result) || empty($result->posts)) { return ''; } VPluginThemeFactory::registerThemeInPathRecursive(erpPROPaths::getAbsPath(erpPROPaths::$scThemesFolder), $this->optObj->getDsplLayout()); $theme = VPluginThemeFactory::getThemeByName($this->optObj->getDsplLayout(), 'shortcode'); if (!$theme) { return ''; } $theme->setOptions($this->optObj->getOptions()); $theme->formPostData($result, $this->optObj, $ratings); $relContent = $theme->render(); $this->setSuppressOthers(); return $relContent; }
/** * Decides if content should be modified, if yes calls content modifier * * @param string $content * @return string * @author Panagiotis Vagenas <*****@*****.**> * @since 1.0.0 */ public function contentFilter($content) { global $post; /** * Check if is time to take action */ if ($this->isShowTime($post) && !$this->isInExcludedPostTypes($post) && !$this->isInExcludedTaxonomies($post) && (bool) $this->mainOpts->getValue('activate')) { erpPROPaths::requireOnce(erpPROPaths::$erpPROTheme); if (erpPROTheme::areOthersSuppressed()) { return $content; } erpPROPaths::requireOnce(erpPROPaths::$VPluginThemeFactory); erpPROPaths::requireOnce(erpPROPaths::$erpProRelated); $relatedObj = erpProRelated::get_instance($this->mainOpts); $result = $relatedObj->getRelated($post->ID); $ratings = $relatedObj->getRatingsFromRelDataObj(); if (empty($result) || empty($result->posts)) { return $content; } VPluginThemeFactory::registerThemeInPathRecursive(erpPROPaths::getAbsPath(erpPROPaths::$mainThemesFolder), $this->mainOpts->getDsplLayout()); $theme = VPluginThemeFactory::getThemeByName($this->mainOpts->getDsplLayout(), 'main'); if (!$theme) { return $content; } $theme->formPostData($result, $this->mainOpts, $ratings); $relContent = $theme->render(); return $this->mainOpts->getPosition() == 'top' ? $relContent . $content : $content . $relContent; } return $content; }