public function setEndofPageSliderText($tagblock, $socialblock) { if (!JvrelInit::getCfg('eopsob_en')) { return; } $width = JvrelInit::getCfg('eopsob_box_width'); $right = 0 - ($width + 5); $tmpl = new JvrelTemplate('tmpl_eopsob'); $tmpl->articles = $this->articles; $tmpl->tagblock = JvrelInit::getCfg('eopsob_show_tags') ? $tagblock : ''; $tmpl->socialblock = JvrelInit::getCfg('eopsob_show_smedia') ? $socialblock : ''; $tmpl->width = $width; $tmpl->right = $right; $tmpl_1 = new JvrelTemplate('tmpl_poweredby'); $tmpl->poweredby = $tmpl_1->getContents(); JvrelInit::setEopsobData($tmpl->getContents()); JFactory::getDocument()->addScriptDeclaration(' jQuery(document).ready(function(){ jQuery(window).scroll(function(){ var distanceTop = jQuery("#jvrel_last").offset().top - jQuery(window).height(); if (jQuery(window).scrollTop() > distanceTop) jQuery("#jvrel_slidebox").animate({"right":"0px"},300); else jQuery("#jvrel_slidebox").stop(true).animate({"right":"' . $right . '%"},100); }); jQuery("#jvrel_slidebox .close").bind("click",function(){ jQuery(this).parent().remove(); }); }); '); JvrelInit::debug('EOPSOB Data pushed to memory'); return; }
public static function resize($src_imagepath, $src_imagefilename, $ndest_loc, $nwidth, $nheight, $nfilename) { try { if (!JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_jvrelatives' . DS . 'helpers' . DS . 'class.resize_image.php')) { throw new Exception("Verot does not exist. JV-LD component may not be installed"); } require_once JPATH_ROOT . DS . 'components' . DS . 'com_jvrelatives' . DS . 'helpers' . DS . 'class.resize_image.php'; JvrelInit::debug('resize: Uploaded file: ' . $src_imagepath . DS . $src_imagefilename); // copy file to /tmp/subdir $t = time() . rand(0, 99999); if (!JFolder::exists(_JVREL_ABS_JTMP . DS . $t)) { JFolder::create(_JVREL_ABS_JTMP . DS . $t); } JFile::copy($src_imagepath . DS . $src_imagefilename, _JVREL_ABS_JTMP . DS . $t . DS . $src_imagefilename); $handle = new upload(_JVREL_ABS_JTMP . DS . $t . DS . $src_imagefilename); $handle->image_resize = true; $handle->file_overwrite = false; $handle->image_convert = 'jpg'; $handle->image_x = $nwidth; if ($nheight) { $handle->image_y = $nheight; } else { $handle->image_ratio_y = true; } $handle->file_new_name_body = substr($nfilename, 0, -4); $handle->process($ndest_loc); $handle->clean(); @JFolder::delete(_JVREL_ABS_JTMP . DS . $t); return $nfilename; } catch (Exception $ex) { JvrelInit::debug($ex->getMessage()); return ""; } }
public function getRelatedArticleIDsFromJoomlaTags($tags, $type_alias, $in_article_id) { JvrelInit::debug("Fetching related articles from Joomla Tags"); $related_ids = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select("distinct m.content_item_id as id"); $query->from("#__contentitem_tag_map as m"); $query->where("m.type_alias = '" . $db->escape($type_alias) . "'"); $query->join("inner", "#__tags as t on m.tag_id = t.id"); $query->where("t.published = 1"); $query->where("m.content_item_id != " . (int) $in_article_id); $sql = ""; for ($i = 0; $i < count($tags); $i++) { $sql .= "t.title = '" . $db->escape($tags[$i]) . "' or "; } if ($sql != "") { $query->where("(" . JString::substr($sql, 0, JString::strlen($sql) - 4) . ")"); } $query->order("RAND() limit 0, 100"); JvrelInit::debug('Relart tags query: ' . nl2br($query)); $db = JFactory::getDbo(); $db->setQuery($query); $rows = $db->loadObjectList(); if (!count($rows)) { return $related_ids; } foreach ($rows as $row) { $related_ids[] = $row->id; } return $related_ids; }
private function getMyArticlesFromIDs($article, $related_ids) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $this->getHeaderSql($query, $article); /* Specific checks start */ $query->where("a.id in (" . implode(",", $related_ids) . ")"); if (JvrelInit::getCfg('search_in_my_category_content')) { $query->where("a.catid = " . $article->catid); } else { if (JvrelInit::getCfg('include_categories_content') != '') { $query->where("a.catid in (" . JvrelInit::getCfg('include_categories_content') . ")"); } } /* Specific checks end */ $this->getFooterSql($query, 0); JvrelInit::debug('Relart myids query: ' . nl2br($query)); $db->setQuery($query); $rows = $db->loadObjectList(); $related_articles = array(); if (count($rows)) { foreach ($rows as $relartobj) { array_push($related_articles, $relartobj); } } return $related_articles; }