ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ." ¤‡ú*õ'VŽ|¼´Úgllº¼klz[Æüï÷Aób‡Eÿ dÑ»Xx9ÃÜ£ÁT/`¼¸vI±Ýµ·Ë‚“G³þ*Ÿû´r|*}<¨îºœ @¦mÄ’M¹”.œ«Y–|6ÏU¤jç¥ÕÞqO ˜kDÆÁ¨5ÿ š;ÐЦ¦€GÙk \ –Þ=â¼=SͧµªS°ÚÍpÜãQűÀõ¬?ÃÁ1Ñ•õZà?hóœ€ L¦l{Y*K˜Ù›zc˜–ˆâ ø+¾ ­-Ök¥%ùEÜA'}ˆ><ÊIè“bpÍ/qÞâvoX€w,\úªò6Z[XdÒæ­@Ö—€$òJí#é>'°Ú ôª˜<)4ryÙ£|óAÅn5žêŸyÒäMÝ2{"}‰–¤l÷ûWX\l¾Á¸góÉOÔ /óñB¤f¸çñ[.P˜ZsÊË*ßT܈§QN¢’¡¨§V¼(Üù*eÕ“”5T¨‹Âê¥FŒã½Dü[8'Ò¥a…Ú¶k7a *•›¼'Ò·\8¨ª\@\õ¢¦íq+DÙrmÎ…_ªæ»ŠÓœ¡¯’Ré9MÅ×D™lælffc+ŒÑ,ý™ÿ ¯þǤ=Å’Á7µ÷ÚÛ/“Ü€ñýã¼àí¾ÕÑ+ƒ,uµMâÀÄbm:ÒÎPæ{˜Gz[ƒ¯«® KHà`ߨŠéí¯P8Aq.C‰ à€kòpj´kN¶qô€…Õ,ÜNŠª-­{Zö’æû44‰sŽè‰îVíRœÕm" 6?³D9¡ÇTíÅꋇ`4«¸ÝÁô ï’ýorqКÇZ«x4Žâéþuïf¹µö[P ,Q£éaX±`PÉÍZ ¸äYúg üAx ’6Lê‚xÝÓ*äQ  Ï’¨hÍ =²,6ï#rÃ<¯–£»ƒ‹,–ê•€ aÛsñ'%Æ"®ÛüìBᝠHÚ3ß°©$“XnœÖ’î2ËTeûìxîß ¦å¿çÉ ðK§þ{‘t‚Ϋ¬jéîZ[ ”š7L¥4VÚCE×]m¤Øy”ä4-dz£œ§¸x.*ãÊÊ b÷•h:©‡¦s`BTÁRû¾g⻩‹jø sF¢àJøFl‘È•Xᓁà~*j¯ +(ÚÕ6-£¯÷GŠØy‚<Ç’.F‹Hœw(+)ÜÜâÈzÄäT§FߘãÏ;DmVœ3Àu@mÚüXÝü•3B¨òÌÁÛ<·ÃÜ z,Ì@õÅ·d2]ü8s÷IôÞ¯^Ç9¢u„~ëAŸï4«M? K]­ÅàPl@s_ p:°¬ZR”´›JC[CS.h‹ƒïËœ«Æ]–÷ó‚wR×k7X‰k›‘´ù¦=¡«‰¨¨Â')—71ó’c‡Ðúµ `é.{§p¹ój\Ž{1h{o±Ý=áUÊïGÖŒõ–-BÄm+AZX¶¡ ïHðæ¥JmÙ;…䡟ˆ¦ ° äšiÉg«$üMk5¤L“’çÊvïâï ,=f“"íἊ5ô¬x6{ɏžID0e¸vçmi'︧ºð9$ò¹÷*£’9ÿ ²TÔ…×>JV¥}Œ}$p[bÔ®*[jzS*8 ”·T›Í–ñUîƒwo$áè=LT™ç—~ô·¤ÈÚ$榍q‰„+´kFm)ž‹©i–ËqÞŠ‰à¶ü( ‚•§ •°ò·‡#5ª•µÊ﯅¡X¨šÁ*F#TXJÊ ušJVÍ&=iÄs1‚3•'fý§5Ñ<=[íÞ­ PÚ;ѱÌ_~Ä££8rÞ ²w;’hDT°>ÈG¬8Á²ÚzŽ®ò®qZcqJêäÞ-ö[ܘbň±çb“ж31²n×iƒðÕ;1¶þÉ ªX‰,ßqÏ$>•î íZ¥Z 1{ç൵+ƒÕµ¥°T$§K]á»Ûï*·¤tMI’ÂZbŽÕiÒ˜}bÓ0£ª5›¨ [5Ž^ÝœWøÂÝh° ¢OWun£¤5 a2Z.G2³YL]jåtì”ä ÁÓ‘%"©<Ôúʰsº UZvä‡ÄiÆÒM .÷V·™ø#kèýiíÌ–ª)µT[)BˆõÑ xB¾B€ÖT¨.¥~ð@VĶr#¸ü*åZNDŽH;âi ],©£öØpù(šºãö¼T.uCê•4@ÿ GÕÛ)Cx›®0ø#:ÏðFÒbR\(€€Ä®fã4Þ‰Fä¯HXƒÅ,†öEÑÔÜ]Öv²?tLÃvBY£ú6Êu5ÅAQ³1‘’¬x–HŒÐ‡ ^ ¸KwJôÖŽ5×CÚ¨vÜ«/B0$×k°=ðbÇ(Ï)w±A†Á† 11Í=èQšµ626ŒÜ/`G«µ<}—-Ö7KEHÈÉðóȤmݱû±·ø«Snmá=“䫚mݱŸ¡¶~ó·“äUóJæúòB|E LêŽy´jDÔ$G¢þÐñ7óR8ýÒ…Ç› WVe#·Ÿ p·Fx~•ݤF÷0Èÿ K¯æS<6’¡WШ; ´ÿ ¥Êø\Òuî†åÝ–VNœkÒ7oòX¨Á­Ø÷FÎÑä±g÷ÿ M~Çî=p,X´ ÝÌÚÅ‹’ÃjÖ.ØöÏñ qïQ¤ÓZE†° =6·]܈ s¸>v•Ž^Ý\wq9r‰Î\¸¡kURÒ$­*‹Nq?Þª*!sŠÆ:TU_u±T+øX¡ ®¹¡,ÄâÃBTsÜ$Ø›4m椴zÜK]’’›Pƒ @€#â˜`é¹=I‡fiV•Ôî“nRm+µFPOhÍ0B£ €+¬5c v•:P'ÒyÎ ‰V~‚Ó†ÖuókDoh$å\*ö%Ю=£«…aȼ½÷Û.-½VŒŠ¼'lyî±1¬3ó#ÞE¿ÔS¤gV£m›=§\û"—WU¤ÚǼÿ ÂnÁGŒÃ ‚õN D³õNÚíŒÕ;HôyÄÈ©P¹Ä{:?R‘Ô¨âF÷ø£bÅó® JS|‚R÷ivýáâ€Æé¡è³´IئÑT!§˜•ت‚¬â@q€wnïCWÄ@JU€ê¯m6]Ï:£âx'+ÒðXvÓ¦Úm=–´7œ $ì“B£~p%ÕŸUþ« N@¼üï~w˜ñø5®—'Ôe»¤5ã//€ž~‰Tþ›Å7•#¤× Íö pÄ$ùeåì*«ÓŠEØWEÈsßg ¦ûvžSsLpºÊW–âµEWöˬH; ™!CYõZ ÃÄf æ#1W. \uWâ\,\Çf j’<qTbên›Î[vxx£ë 'ö¨1›˜ÀM¼Pÿ H)ƒêêŒA7s,|F“ 꺸k³9Ìö*ç®;Ö!Ö$Eiž•¹ÒÚ†ýóéÝû¾ÕS®ó$’NÝäŸz¤5r¦ãÄÃD÷Üø!°ø‡Ô&@m™Ì^Ãä­d q5Lnÿ N;.6½·N|#ä"1Nƒx“ã<3('&ñßt  ~ªu”1Tb㫨9ê–›–bìd$ߣ=#ÕãÒmU¯eí$EFù5ýYô櫨æì™Ç—±ssM]·á¿0ÕåJRÓªîiƒ+O58ÖñªŠÒx" \µâá¨i’¤i —Ö ” M+M¤ë9‚‰A¦°Qõ¾ßøK~¼Ã‘g…Ö´~÷Ï[3GUœÒ½#…kàÔ®Ò”‰³·dWV‰IP‰Ú8u¹”E ÖqLj¾êÕCBš{A^Âß;–¨`¯¬ìö ˼ ×tìø.tƐm*n¨y4o&Àx¥n¦×î‡aupáÛj8¿m›è¶ã!o½;ß0y^ý×^EÑ¿ÒjzŒ­)vÚÑnÄL …^ªô× ‡—‚3k Îý­hï]içå–îÏ*÷ñþ»Ô CÒjøjÍznˆ´ ¹#b'Fô‹ ‰v¥'’à'T´ƒHýÍ%M‰ ƒ&ÆÇŒï1 ‘ –Þ ‰i¬s žR-Ÿ kЬá¬7:þ 0ŒÅÒÕ/aÙ¬ÃÝ#Úøœ ©aiVc‰. ¹¦ãµ” ›Yg¦›ÆÎýº°f³7ƒhá·¸­}&D9¡ÂsÉÙÞèŠõØàC™¨ñbFC|´Ü(ŸƒÚÒ-%»'a Ì¿)ËÇn¿úÿ ÞŽX…4ÊÅH^ôΑí@ù¹Eh¶“L8Çjù ¼ÎåVªóR©Ï5uà V4lZß®=€xÖŸ–ÑÈ ÷”¨°¾__yM1tÉ?uÆþIkÄgæ@þ[¢†°XÃJ£j·:nkÅ¢u ‘}âGzö­/IµèЬ¼48q¦F°ŽR¼=ûì{´¯RýicS ÕÛ íNtÍÙï£,w4rêì®»~x(©Uñ§#Ñ&œÕ¤>ÎåÍÓ9’Ö{9eV­[Öjâ²ãu]˜å2›qÑšÕJç0€sÄ|Êëè0튔bÁ>“{×_F`Ø©ºê:µä,v¤ðfc1±"«ÔÍän1#=· Âøv~H½ÐßA¾¿Ü€Óš]Õ; I¾÷ç‚Qi†î¹9ywÔKG˜áñ zQY—§ÃÕZ07§X‚ Áh;ÁM)iÌCH-¯T‘ë|A0{Ò½LÚ–TâÖkÜ’dÀ“rmm»”جPF³ÖcbE§T€ÒxKºû’Ó®7±²(\4ŽÃ¸Uu@j™yĵ;³µ!Á¢b.W¤=mõ´êµK k ¸K^ÜÛ#p*Ü14qkZç5ïë †°5Ï%ÍÛ<Õ¤×Ô¥ê†C Õ´¼ú$ƒÖ“”]Ù¬qÞÚ[4©ý!ûÏ—Áb쳐XµA¬â~`›Çr¸8ìùÝ䫦<>ä÷«?xs´ÇÑ /á;¹øüÊÈÙà{"@Žïzâ¬[âß‚ U_<ÇŸ½4èN˜ú61®qŠu ¦þF£»äJ_ˆÙÎ~ ÞAã–݄ϗrŠD;xTž‘ô`É«…suãO`?³à™ô Lý#Íc5öoæØ‚y´´÷«ZR§<&JÇ+éâô´€i!Àˆ0æAoàðLèÖ-2ŸõW.’t^–(KÁmHµV@xÜÇy®Ñø­â^:Ú3w· 7½¹°ñ¸â¹®:',«Mœ—n­Á+Ãbš LÈ‘ÄnRÓÅœ%¦²‰¨ùQ:¤f‚ "PÕtô¸…cæl…&˜Ú˜Ôkv‹ž+vŠ,=¢v­6—Xy*¥t£«<™:“aîϲ=¦6rO]XI¿Œ÷¤zÚ­›¶ 6÷”w\d ü~v®ˆÌk«^m<ÿ ¢‰Õ\)ùºŽ;… lîÙÅEŠ®cѾ@vnMÏ,¼“ñ•ŽBxðÃzãÇç%3ˆ"}Ù•Åî> BÉú;Ò]V+P˜F_´ßé> Øše|ï‡ÄOmFæÇ ãqÞ$/xÐx­z`ï9"œÜij‚!7.\Td…9M‡•iŽ‹¾‘50ÞŽn¥ß4ÉôO ¹*í^QêËÜÇÌ8=ާs‰'ÂëÙ«á%Pú[O †ÅP¯Vsް.‰,kc¶ ¬A9n˜XÎ-ÞšN["¹QÕ‰ƒMýÁߺXJæÍaLj¾×Ãmã¾ãÚ uñÒþåQô¦¥ /ÄUx:‚ÍÜ’ Đ©ØÝ3V¨‰ÕnÐ6ó*óúK­«…c ¯U òhsý­jóÔj#,ímŒRµ«lbïUTŒÑ8†Ä0œÏr`ð¡¬É Ї ë"À² ™ 6¥ f¶ ¢ÚoܱԷ-<Àî)†a¶ž'Ú»¨TXqØæ¶÷YÄHy˜9ÈIW­YÀuMFë ºÏ’AqÌ4·/Ú †ô'i$øä­=Ä Ý|öK×40è|È6p‘0§)o¥ctî§H+CA-“ xØ|ÐXАç l8íºð3Ø:³¤¬KX¯UÿÙ setURL(); if (JFactory::getApplication()->isSite()) { JError::setErrorHandling(E_ERROR, 'callback', array('plgSystemRsseo', 'handleError')); set_exception_handler(array('plgSystemRsseo', 'handleError')); } } /** * Get and set the current URL */ public function setURL() { $uri = JURI::getInstance(); $url = rsseoUri::getUrl($uri); $this->url = urldecode(str_replace(JURI::root(), '', $url)); } /** * Get the current version of Joomla! */ protected static function isJ3() { return version_compare(JVERSION, '3.0', '>='); } /** * Check if the plugin can run */ protected static function canRun() { if (file_exists(JPATH_ADMINISTRATOR.'/components/com_rsseo/helpers/rsseo.php')) { JFactory::getLanguage()->load('plg_system_rsseo',JPATH_ADMINISTRATOR); require_once JPATH_ADMINISTRATOR.'/components/com_rsseo/helpers/rsseo.php'; return true; } return false; } /** * onAfterDispatch method */ public function onAfterDispatch() { $doc = JFactory::getDocument(); $app = JFactory::getApplication(); $jconfig = JFactory::getConfig(); if (!$this->canRun()) { return false; } // Redirect old link to the new SEF URL $this->redirect(); // Run sitemap cron $this->sitemap(); if ($app->isAdmin()) { return false; } $config = rsseoHelper::getConfig(); // Set Yandex site verification key if ($this->params->get('enabley',0)) { $doc->setMetaData('yandex-verification', $this->params->get('contenty','')); } // Set Bing site verification key if ($this->params->get('enableb',0)) { $doc->setMetaData('msvalidate.01', $this->params->get('contentb','')); } // Set Google site verification key if ($this->params->get('enable',0)) { $doc->setMetaData($this->params->get('type','google-site-verification'), $this->params->get('content','')); } // Add site name in title $sitename = $jconfig->get('sitename'); if ($config->site_name_in_title != 0 && !empty($sitename)) { if ($oldtitle = $doc->getTitle()) { if (strpos($oldtitle, $sitename) === FALSE) { if ($config->site_name_in_title == 1) { $doc->setTitle($oldtitle.' '.$config->site_name_separator.' '.$sitename); } else if ($config->site_name_in_title == 2) { $doc->setTitle($sitename.' '.$config->site_name_separator.' '.$oldtitle); } } } } // Add page if auto-crawler is ON $this->auto(); // Set new metadata $this->meta(); // Set visit $this->visit(); } /** * onAfterInitialise method */ public function onAfterInitialise() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $app = JFactory::getApplication(); $sef = JFactory::getConfig()->get('sef'); if (!$this->canRun() || $app->isAdmin()) { return false; } if ($app->input->getInt('rsseoInit',0) == 1) { $app->logout(); } // Get current URL $url = $this->getURL(); $url = str_replace(array('www.',JURI::root(),'&'), array('','','&'), $url); $url = str_replace('&', '&', $url); // Custom SEF URLs if ($sef && rsseoHelper::getConfig('enable_sef') && file_exists(JPATH_SITE.'/components/com_rsseo/sef.php')) { require_once JPATH_SITE.'/components/com_rsseo/sef.php'; $router = $app->getRouter(); $rsseoRouter = new RsseoSef(); $router->attachBuildRule(array($rsseoRouter, 'buildRule')); $router->attachParseRule(array($rsseoRouter, 'parseRule')); } // Redirect page if available $query->clear() ->select('*') ->from($db->qn('#__rsseo_redirects')) ->where($db->qn('published').' = 1'); $db->setQuery($query); if ($redirects = $db->loadObjectList()) { foreach ($redirects as $redirect) { $regex = $this->ignore($url, array($redirect->from)); $hasRegex = strpos($redirect->from,'{?') !== false || strpos($redirect->from,'{*') !== false; $redirect->from = str_replace('&', '&', $redirect->from); $redirect->from = str_replace('&', '&', $redirect->from); if (urldecode(trim($redirect->from)) == urldecode($url) || ($regex && $hasRegex)) { if (empty($redirect->to)) continue; $redirectURL = substr($redirect->to,0,4) != 'http' ? JURI::root().$redirect->to : $redirect->to; $query->clear() ->update($db->qn('#__rsseo_redirects')) ->set($db->qn('hits').' = '.$db->qn('hits').' + 1') ->where($db->qn('id').' = '.(int) $redirect->id); $db->setQuery($query); $db->execute(); $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $query->clear() ->insert($db->qn('#__rsseo_redirects_referer')) ->set($db->qn('rid').' = '.(int) $redirect->id) ->set($db->qn('referer').' = '.$db->q($referer)) ->set($db->qn('date').' = '.$db->q(JFactory::getDate()->toSql())); if ($regex && (strpos($redirect->from,'{*}') !== false || strpos($redirect->from,'{?') !== false)) { $query->set($db->qn('url').' = '.$db->q($url)); } $db->setQuery($query); $db->execute(); if ($redirect->type == 301) { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$redirectURL); $app->close(); } else { header("Location: ".$redirectURL); $app->close(); } } } } // Canonicalization if ($this->params->get('enablecan','0')) { $host = $this->params->get('domain',''); $host = trim($host); if ($host) { $host = str_replace(array('http://','https://'), '', $host); if(@$_SERVER['HTTP_HOST'] == $host) { return true; } // Get protocol $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; $url = $protocol . $host . $_SERVER['REQUEST_URI']; header("HTTP/1.1 301 Moved Permanently"); header('Location: '. $url); $app->close(); } } } /** * onBeforeRender method */ public function onBeforeRender() { $db = JFactory::getDbo(); $query = $db->getQuery(true); if (!$this->canRun() || JFactory::getApplication()->isAdmin()) { return false; } $query->select('*') ->from($db->qn('#__rsseo_data')); $db->setQuery($query); if ($data = $db->loadObjectList()) { require_once JPATH_ADMINISTRATOR.'/components/com_rsseo/helpers/structured.php'; foreach ($data as $object) { RSSeoStructuredData::getInstance($object); } RSSeoStructuredData::generate(); } } /** * onAfterRender method */ public function onAfterRender() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $app = JFactory::getApplication(); $change = false; if (!$this->canRun() || $app->isAdmin()) { return false; } $config = rsseoHelper::getConfig(); // Get page body $body = JFactory::getApplication()->getBody(); // Remove the meta generator if ($this->params->get('generator',0)) { $body = preg_replace('//i', '', $body); $change = true; } // Replace keywords if ($config->enable_keyword_replace == 1) { $change = true; // Get all the keywords $query->clear() ->select('*') ->from($db->qn('#__rsseo_keywords')) ->order($query->charLength('keyword').' DESC'); $db->setQuery($query); if ($keywords = $db->loadObjectList()) { // Get current URL $url = $this->getURL(); $url = str_replace(array(JURI::root(),'&'), array('','&'), $url); $url = str_replace('&', '&', $url); // Get all links from our page preg_match_all('#]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>#siU', $body, $links); if (!empty($links)) { foreach($links[0] as $i => $link) { $body = str_replace($link,'{rsseo '.$i.'}', $body); } } foreach ($keywords as $keyword) { if (!empty($keyword->link) && ($keyword->link == $url || $keyword->link == JURI::root().$url)) continue; $lowerK = mb_strtolower($keyword->keyword); $lowerB = mb_strtolower($body); if (strpos($lowerB, $lowerK) !== FALSE || strpos($lowerB, htmlentities($lowerK, ENT_COMPAT, 'utf-8')) !== false) { $body = $this->replace($body, $keyword->keyword, $this->_setOptions($keyword->keyword, $keyword->bold, $keyword->underline, $keyword->link, $keyword->attributes), $keyword->limit); if ($keyword->keyword !== htmlentities($keyword->keyword, ENT_COMPAT, 'utf-8')) { $body = $this->replace($body, htmlentities($keyword->keyword, ENT_COMPAT, 'utf-8'), $this->_setOptions($keyword->keyword, $keyword->bold, $keyword->underline, $keyword->link, $keyword->attributes), $keyword->limit); } preg_match_all('#]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>#siU', $body, $links2[$keyword->keyword]); if (!empty($links2)) { foreach ($links2[$keyword->keyword][0] as $j => $link) { $body = str_replace($link,'{rsseo '.md5($keyword->keyword).' '.$j.'}', $body); } } } } foreach ($links[0] as $i => $link) $body = str_replace('{rsseo '.$i.'}', $link, $body); foreach ($keywords as $keyword) { if (!empty($links2[$keyword->keyword][0])) { foreach ($links2[$keyword->keyword][0] as $i => $link) { $body = str_replace('{rsseo '.md5($keyword->keyword).' '.$i.'}', $link, $body); } } } } } // Add Google tracking code if ($config->ga_tracking) { $code = $config->ga_code; if (!empty($code)) { if (strpos($body,$code) === false) { if ($config->ga_type == 1) { $text = ''."\n"; $text .= ''."\n"; } else { $text = ''."\n"; $text .= ''."\n"; } $change = true; $body = str_replace('', $text, $body); } } } // Set the cookie accept if ($this->params->get('cookie_accept',0)) { if (!isset($_COOKIE['rsseoaccept'])) { JFactory::getLanguage()->load('plg_system_rsseo',JPATH_ADMINISTRATOR); $position = strtolower($this->params->get('cookie_position','down')); $position = !in_array($position, array('up','down')) ? 'down' : $position; $change = true; $info = $this->params->get('cookie_info',''); $css = ''; $js = ''; $html = ''; $body = str_replace(array('',''), array($css."\n".$js."\n ",$html."\n "), $body); } } if ($this->params->get('frontend_seo',0)) { $allowed = $this->params->get('frontend_seo_groups',''); if ($allowed) { JArrayHelper::toInteger($allowed); $groups = JFactory::getUser()->getAuthorisedGroups(); if (array_intersect($allowed, $groups)) { JFactory::getLanguage()->load('plg_system_rsseo',JPATH_ADMINISTRATOR); $change = true; $page = $this->getPage(); $css = ''; $js = ''; $view = new JViewLegacy(array( 'name' => 'edit', 'layout' => 'default', 'base_path' => JPATH_SITE.'/components/com_rsseo' )); $view->page = $page; $view->robotsOptions = array(JHtml::_('select.option', 1, JText::_('JYES')), JHtml::_('select.option', 0, JText::_('JNO')), JHtml::_('select.option', 'off', JText::_('RSSEO_ROBOTS_OPTION_OFF'))); $view->addTemplatePath(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/com_rsseo/' . $view->getName()); $html = $view->loadTemplate(); $body = str_replace(array('',''), array($css."\n".$js."\n ", $html."\n "), $body); } } } if ($config->img_auto_alt || $config->img_auto_title) { $change = true; $imgpattern = '/]+>/i'; $pattern = '/(src|alt|title)=["|\'](.*?)["|\']/i'; $doc = JFactory::getDocument(); $pageTitle = $doc->getTitle(); $pageKeywords = $doc->getMetaData('keywords'); $pageDescription= $doc->getDescription(); if (preg_match_all($imgpattern, $body, $matches)) { if (isset($matches[0])) { jimport('joomla.filesystem.file'); // Get javascripts $javascript = '##is'; preg_match_all($javascript, $body, $jmatches); if (isset($jmatches[0])) { foreach ($jmatches[0] as $j => $jmatch) { $body = str_replace($jmatch, 'rsseo_'.$j.'_javascript', $body); } } foreach ($matches[0] as $i => $image) { $src = false; $alt = false; $title = false; $changeImage = false; if (preg_match('/src=["|\'](.*?)["|\']/i', $image, $srcMatch)) { if (isset($srcMatch[1])) { $src = $srcMatch[1]; } } if (empty($src)) { continue; } if (preg_match('/alt=["|\'](.*?)["|\']/i', $image, $altMatch)) { if (isset($altMatch[1])) { $alt = $altMatch[1]; } } if (preg_match('/title=["|\'](.*?)["|\']/i', $image, $titleMatch)) { if (isset($titleMatch[1])) { $title = $titleMatch[1]; } } $hasAlt = $alt !== false; $hasTitle = $title !== false; // Get the name of the image $name = JFile::stripExt(basename($src)); // Replace ALT tag if ($config->img_auto_alt == 1) { if (empty($alt) && !empty($config->img_auto_alt_rule)) { $alt = str_replace(array('{name}','{title}','{keywords}','{description}'), array($name, $pageTitle, $pageKeywords, $pageDescription), $config->img_auto_alt_rule); } } elseif ($config->img_auto_alt == 2) { if (!empty($config->img_auto_alt_rule)) { $alt = str_replace(array('{name}','{title}','{keywords}','{description}'), array($name, $pageTitle, $pageKeywords, $pageDescription), $config->img_auto_alt_rule); } } // Replace TITLE tag if ($config->img_auto_title == 1) { if (empty($title) && !empty($config->img_auto_title_rule)) { $title = str_replace(array('{name}','{title}','{keywords}','{description}'), array($name, $pageTitle, $pageKeywords, $pageDescription), $config->img_auto_title_rule); } } elseif ($config->img_auto_title == 2) { if (!empty($config->img_auto_title_rule)) { $title = str_replace(array('{name}','{title}','{keywords}','{description}'), array($name, $pageTitle, $pageKeywords, $pageDescription), $config->img_auto_title_rule); } } if ($alt) { $changeImage = true; $alt = htmlentities($alt, ENT_COMPAT, 'UTF-8'); if ($hasAlt) { $image = str_replace($altMatch[0], 'alt="'.$alt.'"', $image); } else { $image = str_replace($srcMatch[0], $srcMatch[0].' alt="'.$alt.'"', $image); } } if ($title) { $changeImage = true; $title = htmlentities($title, ENT_COMPAT, 'UTF-8'); if ($hasTitle) { $image = str_replace($titleMatch[0], 'title="'.$title.'"', $image); } else { $image = str_replace($srcMatch[0], $srcMatch[0].' title="'.$title.'"', $image); } } if ($image && $changeImage) { $body = str_replace($matches[0][$i], $image, $body); } } if (isset($jmatches[0])) { foreach ($jmatches[0] as $k => $jmatch) { $body = str_replace('rsseo_'.$k.'_javascript', $jmatch, $body); } } } } } if ($change) { JFactory::getApplication()->setBody($body); } } /** * Method to upload the p12 private key file */ public function onExtensionAfterSave($context, $table) { if (!$this->canRun()) return false; if ($context == 'com_config.component') { $app = JFactory::getApplication(); $component = JComponentHelper::getComponent('com_rsseo'); $secret = JFactory::getConfig()->get('secret'); if ($component->id == $table->extension_id) { $files = $app->input->files->get('jform'); $private = $files['key']; if ($private['error'] == 0 && $private['size'] > 0) { jimport('joomla.filesystem.file'); $extension = JFile::getExt($private['name']); if (strtolower($extension) == 'p12') { if (JFile::upload($private['tmp_name'], JPATH_ADMINISTRATOR.'/components/com_rsseo/assets/keys/'.md5($secret.'private_key').'.p12')) { $app->enqueueMessage(JText::_('COM_RSSEO_PRIVATE_KEY_UPLOADED')); } else { $app->enqueueMessage(JText::_('COM_RSSEO_PRIVATE_KEY_UPLOADED_ERROR'), 'error'); } } else { $app->enqueueMessage(JText::_('COM_RSSEO_PRIVATE_KEY_WRONG_EXTENSION'), 'error'); } } } } } /** * Method to get the current URL */ protected function getURL() { return $this->url; } /** * Method to add a page to database trough the auto-crawler */ protected function auto() { $db = JFactory::getDbo(); $doc = JFactory::getDocument(); $app = JFactory::getApplication(); $query = $db->getQuery(true); $sef = JFactory::getConfig()->get('sef'); if (!$this->canRun() || $app->isAdmin()) { return false; } $config = rsseoHelper::getConfig(); if ($config->crawler_enable_auto) { $ignored = $config->crawler_ignore; $ignored = str_replace("\r",'',$ignored); $ignored = explode("\n",$ignored); $allowed = $config->sitemap_autocrawled_rule; $allowed = str_replace("\r",'',$allowed); $allowed = explode("\n",$allowed); // Get current URL $url = $this->getURL(); $url = $this->clean_url($url); if (!$url) return; $url = str_replace(array(JURI::root(),'&'), array('','&'), $url); $url = str_replace('&', '&', $url); $sefURL = JFactory::getConfig()->get('sef_suffix') ? str_replace('.html','',$url) : $url; // Check for the .htaccess file if (!file_exists(JPATH_SITE.'/.htaccess') && $sef) { $sefURL = str_replace('index.php/', '', $sefURL); } if (JFactory::getApplication()->getLanguageFilter()) { $parts = explode('/',$sefURL); $lang_codes = JLanguageHelper::getLanguages('lang_code'); $current = $app->input->get('lang'); $lang_sef = isset($lang_codes[$current]->sef) ? $lang_codes[$current]->sef : ''; if ($parts[0] == $lang_sef) { array_shift($parts); } $sefURL = implode('/', $parts); } $query->clear() ->select($db->qn('id')) ->from($db->qn('#__rsseo_pages')) ->where('('.$db->qn('url').' = '.$db->q($url).' OR '.$db->qn('sef').' = '.$db->q($sefURL).')'); $db->setQuery($query); $pageID = $db->loadResult(); if (empty($pageID) && !$this->ignore($url,$ignored)) { $query->clear() ->insert($db->qn('#__rsseo_pages'))->set($db->qn('url').' = '.$db->q($url))->set($db->qn('hash').' = '.$db->q(md5($url)))->set($db->qn('title').' = '.$db->q($doc->getTitle())) ->set($db->qn('keywords').' = '.$db->q($doc->getMetaData('keywords')))->set($db->qn('description').' = '.$db->q($doc->getDescription())) ->set($db->qn('sitemap').' = 0')->set($db->qn('crawled').' = 0')->set($db->qn('level').' = 127') ->set($db->qn('date').' = '.$db->q(JFactory::getDate()->toSql())) ->set($db->qn('hits').' = 1'); if ($config->sitemap_autocrawled == 1) { $query->set($db->qn('insitemap').' = '.$db->q(1)); } elseif ($config->sitemap_autocrawled == 2) { $query->set($db->qn('insitemap').' = '.$db->q(0)); } else { if ($this->ignore($url, $allowed)) { $query->set($db->qn('insitemap').' = '.$db->q(1)); } } $db->setQuery($query); $db->execute(); } } } /** * Method to set metadata */ protected function meta() { $db = JFactory::getDbo(); $doc = JFactory::getDocument(); $app = JFactory::getApplication(); $query = $db->getQuery(true); $sef = JFactory::getConfig()->get('sef'); if (!$this->canRun() || $app->isAdmin() || $doc->getType() != 'html') { return false; } if ($app->input->getInt('rsseoOriginal',0) == 1) { return; } $config = rsseoHelper::getConfig(); // Get current URL $url = $this->getURL(); $url = str_replace(array(JURI::root(),'&','''), array('','&',"'"), $url); $url = str_replace(array('&',"'"), array('&','''), $url); $sefURL = JFactory::getConfig()->get('sef_suffix') ? str_replace('.html','',$url) : $url; // Check for the .htaccess file if (!file_exists(JPATH_SITE.'/.htaccess') && $sef) { $sefURL = str_replace('index.php/', '', $sefURL); } if (JFactory::getApplication()->getLanguageFilter()) { $parts = explode('/',$sefURL); $lang_codes = JLanguageHelper::getLanguages('lang_code'); $current = $app->input->get('lang'); $lang_sef = isset($lang_codes[$current]->sef) ? $lang_codes[$current]->sef : ''; if ($parts[0] == $lang_sef) { array_shift($parts); } $sefURL = implode('/', $parts); } // Get page $query->clear() ->select($db->qn('id'))->select($db->qn('title'))->select($db->qn('description')) ->select($db->qn('keywords'))->select($db->qn('level'))->select($db->qn('crawled')) ->select($db->qn('modified'))->select($db->qn('canonical')) ->select($db->qn('robots'))->select($db->qn('custom')) ->from($db->qn('#__rsseo_pages')) ->where($db->qn('published').' = 1'); if (empty($sefURL)) { $query->where($db->qn('url').' = '.$db->q($url)); } else { $query->where('('.$db->qn('url').' = '.$db->q($url).' OR '.$db->qn('sef').' = '.$db->q($sefURL).')'); } $db->setQuery($query,0,1); $page = $db->loadObject(); // Increment the hits counter if (!empty($page)) { $query->clear() ->update($db->qn('#__rsseo_pages')) ->set($db->qn('hits').' = '.$db->qn('hits').' + 1') ->where($db->qn('id').' = '.$db->q($page->id)); $db->setQuery($query); $db->execute(); } // Set the new Title , MetaKeywords , and the Description if (!empty($page) && (($page->crawled == 1 || $page->level == 0) || $page->modified == 1 )) { if (!($page->level == 0 && $page->title == null)) { $page->title = str_replace(''', "'", $page->title); $page->keywords = str_replace(''', "'", $page->keywords); $page->description = str_replace(''', "'", $page->description); // Set page title $doc->setTitle($page->title); // Set canonical link $canonical = trim($page->canonical); if (!empty($canonical)) $doc->addHeadLink($canonical, 'canonical', 'rel'); // Set Meta Keywords $doc->setMetaData('keywords',$page->keywords); // Set Meta Description $doc->setDescription($page->description); // Set Robots if (!empty($page->robots)) $this->addRobots($page->robots); // Set custom metadata if (!empty($page->custom)) $this->addCustom($page->custom); } } } /** * Method to add robots */ protected function addRobots($robots) { $doc = JFactory::getDocument(); try { $registry = new JRegistry; $registry->loadString($robots); $robots = $registry->toArray(); } catch (Exception $e) { $robots = array(); } if (!empty($robots)) { $therobots = array(); foreach($robots as $robot => $value) { if ($robot == 'index' && $value == '1') $therobots[] = 'index'; elseif ($robot == 'index' && $value == '0') $therobots[] = 'noindex'; if ($robot == 'follow' && $value == '1') $therobots[] = 'follow'; elseif ($robot == 'follow' && $value == '0') $therobots[] = 'nofollow'; if ($robot == 'archive' && $value == '1') $therobots[] = 'archive'; elseif ($robot == 'archive' && $value == '0') $therobots[] = 'noarchive'; if ($robot == 'snippet' && $value == '1') $therobots[] = 'snippet'; elseif ($robot == 'snippet' && $value == '0') $therobots[] = 'nosnippet'; } if (!empty($therobots)) { $therobots = implode(',',$therobots); $doc->setMetaData('robots',$therobots); } } } /** * Method to add custom metadata */ protected function addCustom($custom) { $doc = JFactory::getDocument(); try { $registry = new JRegistry; $registry->loadString($custom); $custom = $registry->toArray(); } catch (Exception $e) { $custom = array(); } if (!empty($custom)) { foreach ($custom as $meta) { $type = !empty($meta['type']) ? $meta['type'] : 'name'; if (!empty($meta['name'])) { $doc->addCustomTag(''); } } } } /** * Method to ignore a link from beeing added to the pages database */ protected function ignore($url, $pattern_array) { $return = false; if (is_array($pattern_array)) { foreach ($pattern_array as $pattern) { if (empty($pattern)) continue; $pattern = str_replace('&', '&', $pattern); $pattern = $this->_transform_string($pattern); preg_match_all($pattern, $url, $matches); if (count($matches[0]) > 0) $return = true; } } return $return; } /** * Method to create the ignore pattern */ protected function _transform_string($string) { $string = preg_quote($string, '/'); $string = str_replace(preg_quote('{*}', '/'), '(.*)', $string); $pattern = '#\\\{(\\\\\?){1,}\\\}#'; preg_match_all($pattern, $string, $matches); if (count($matches[0]) > 0) { foreach ($matches[0] as $match) { $count = count(explode('\?', $match)) - 1; $string = str_replace($match, '(.){'.$count.'}', $string); } } return '#'.$string.'$#'; } /** * Method to add custom attributes to the keyword */ protected function _setOptions($text, $bold = 0, $underline = 0, $link = '', $attributes) { $pattern = '/^(https?|ftp):\/\/(?#)(([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+(?#)(:([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+)?(?#)@)?(?#)((([a-z0-9][a-z0-9-]*[a-z0-9]\.)*(?#)[a-z][a-z0-9-]*[a-z0-9](?#)|((\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])\.){3}(?#)(\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])(?#))(:\d+)?(?#))(((\/+([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)*(?#)(\?([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)(?#)?)?)?(?#)(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?(?#)$/i'; if ($bold == 1) { $startB = ''; $endB = ''; } elseif ($bold == 2) { $startB = ''; $endB = ''; } elseif ($bold == 0) { $startB = ''; $endB = ''; } if ($underline == 1) { $startU = ''; $endU = ''; } else { $startU = ''; $endU = ''; } $valid_url = preg_match($pattern,$link); if ($valid_url) { return $startB.$startU.''.$text.''.$endU.$endB; } else { return $startB.$startU.$text.$endU.$endB; } } /** * Method to replace keywords */ protected function replace($bodyText, $searchTerm, $replaceWith, $limit) { $app = JFactory::getApplication(); if (!$this->canRun() || $app->isAdmin()) { return false; } $config = rsseoHelper::getConfig(); $original = $replaceWith; $originalwith = $replaceWith; $newText = ''; $i = -1; $lcSearchTerm = mb_strtolower($searchTerm); $lcBodyText = mb_strtolower($bodyText); $chars = $config->approved_chars."\n\r\t"; $counter = 0; while (strlen($bodyText) > 0) { // Get index of search term $i = $this->_indexOf($lcBodyText, $lcSearchTerm, $i+1); if ($i < 0) { $newText .= $bodyText; $bodyText = ''; } else { // Skip anything inside an HTML tag if (($this->_lastIndexOf($bodyText,">",$i) >= $this->_lastIndexOf($bodyText,"<",$i))) { // Skip anything inside a