public static function getJoomlaVersion()
 {
     if (MetatagsContainerFactory::$version == null) {
         jimport("joomla.version");
         $version = new JVersion();
         MetatagsContainerFactory::$version = $version->RELEASE;
     }
     return MetatagsContainerFactory::$version;
 }
 public function isAvailable()
 {
     require_once dirname(__FILE__) . "/MetatagsContainerFactory.php";
     $version = MetatagsContainerFactory::getJoomlaVersion();
     return in_array($version, array("1.6", "1.7", "2.5"));
 }
 public function isAvailable()
 {
     require_once dirname(__FILE__) . "/MetatagsContainerFactory.php";
     return MetatagsContainerFactory::componentExists("com_joomsport");
 }
Example #4
0
 function disablefeature()
 {
     $id = JRequest::getVar("id");
     require_once dirname(__FILE__) . "/classes/MetatagsContainerFactory.php";
     MetatagsContainerFactory::disableFeature($id);
     $this->setRedirect('index.php?option=com_seoboss&task=settings');
 }
 public function isAvailable()
 {
     require_once dirname(__FILE__) . "/MetatagsContainerFactory.php";
     return MetatagsContainerFactory::getJoomlaVersion() == "1.5";
 }
Example #6
0
function jb_com_install()
{
    $db =& JFactory::getDBO();
    //Check that database schema is consistent
    // seoboss_metadata
    $db->setQuery("SHOW COLUMNS FROM #__seoboss_metadata WHERE name LIKE 'title_tag'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_metadata ADD `title_tag` text NOT NULL');
        $db->query();
    }
    // seoboss_keywords_items
    $db->setQuery("SHOW INDEX FROM #__keywords_items WHERE Key_name LIKE 'item_id_2'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE  `#__seoboss_keywords_items` ADD INDEX  `item_id_2` (  `item_id`, `item_type_id` )');
        $db->query();
    }
    $db->setQuery("SHOW INDEX FROM #__keywords_items WHERE Key_name LIKE 'keyword_id'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE  `#__seoboss_keywords_items` ADD INDEX  `keyword_id` (  `keyword_id` )');
        $db->query();
    }
    // seoboss_urls
    $db->setQuery("SHOW TABLES LIKE '#__seoboss_urls'");
    if (!$db->loadAssoc()) {
        $db->setQuery('CREATE TABLE  IF NOT EXISTS `#__seoboss_urls` (
                      `id` INT NOT NULL AUTO_INCREMENT ,
                      `url` VARCHAR( 255 ) NOT NULL ,
                      PRIMARY KEY (  `id` )
                  )');
        $db->query();
    }
    $db->setQuery("SHOW TABLES LIKE '#__seoboss_meta_extensions'");
    if (!$db->loadAssoc()) {
        $db->setQuery('CREATE TABLE  IF NOT EXISTS `#__seoboss_meta_extensions` (
          `component` VARCHAR( 50 ) NOT NULL ,
          `name` VARCHAR( 50 ) NOT NULL ,
          `description` VARCHAR( 255 ) NOT NULL ,
          `enabled` TINYINT NOT NULL ,
          `available` TINYINT NOT NULL ,
          PRIMARY KEY (  `component` )
          )');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_meta_extensions' WHERE name LIKE 'description'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_meta_extensions ADD `description` VARCHAR( 255 ) NOT NULL');
        $db->query();
    }
    $db->setQuery("INSERT IGNORE INTO `#__seoboss_meta_extensions` VALUES\n        ('com_content-1.5','Joomla 1.5 Articles', 'Manage metadata for standard Joomla Articles and Categories',1,0), \n        ('com_content','Joomla Articles', 'Manage metadata for standard Joomla Articles and Categories',1,0),\n        ('com_menu','Menu Items','Manage metadata for Menu Items. Be careful with this plugin, because it can override the metadata from other components.',0,0),\n        ('com_k2','K2', 'K2 content items',1,0),\n        ('com_virtuemart','VirtueMart', 'VirtueMart products and categories.',1,0),\n        ('com_virtuemart2','VirtueMart2', 'VirtueMart products and categories.',1,0),\n        ('com_mt','Mosets Tree','Mosets Tree Categories and Links.',1,0),\n        ('com_joomsport','JoomSport','JoomSport content items.',1,0),\n        ('com_cobalt','Cobalt CCK','Cobalt CCK content items.',1,0),\n        ('com_hikashop','Hikashop','Hikashop items.',1,0)");
    $db->query();
    //seoboss_settings check
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'frontpage_meta'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `frontpage_meta` TINYINT NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'frontpage_title'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `frontpage_title` VARCHAR( 255 ) NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'frontpage_keywords'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `frontpage_keywords` VARCHAR( 255 ) NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'frontpage_description'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `frontpage_description` VARCHAR( 255 ) NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'frontpage_meta_title'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `frontpage_meta_title` VARCHAR( 255 ) NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'sa_enable'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `sa_enable` tinyint(4) NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'sa_users'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `sa_users` VARCHAR( 255 ) NOT NULL');
        $db->query();
    }
    $db->setQuery("SHOW COLUMNS FROM '#__seoboss_settings' WHERE name LIKE 'max_description_length'");
    if (!$db->loadResult()) {
        $db->setQuery('ALTER TABLE #__seoboss_settings ADD `max_description_length` int(11) NOT NULL default \'255\'');
        $db->query();
    }
    //Update Core version
    $db->setQuery("insert into `#__seoboss_client_features` \n                    (`name`, `version`, `build`) \n                    VALUES \n                    ('SEOBoss', '1.4r11', '21') \n                   ON DUPLICATE KEY \n                    UPDATE `version`='1.4r11', `build`='21';");
    $db->query('');
    //Update Host Name
    $uri = JURI::getInstance();
    $host = $uri->getHost();
    $db->setQuery("UPDATE #__seoboss_settings SET domain=" . $db->quote($host));
    $db->query();
    //Populate keywords
    //Commented this out due to performance issues.
    /*require_once("classes/MetatagsContainerFactory.php");
    $cc = MetatagsContainerFactory::getContainer("com_content:Article", false);
    
    $db->setQuery("SELECT id, metakey from #__content ");
    $rows = $db->loadObjectList();
    foreach($rows as $row){
        $cc->saveKeywords($row->metakey, $row->id);
    } 
    */
    //Enable plugins - for Joomla 2.5:
    jimport("joomla.version");
    $version = new JVersion();
    if ($version->RELEASE == "2.5" || $version->RELEASE == "1.7") {
        $db->setQuery("UPDATE #__extensions set enabled='1' WHERE `element`='seoboss_render' AND `type`='plugin'");
        $db->query();
        $db->setQuery("UPDATE #__extensions set enabled='1' WHERE `element`='seoboss_content' AND `type`='plugin'");
        $db->query();
    }
    require_once JPATH_BASE . "/components/com_seoboss/classes/MetatagsContainerFactory.php";
    MetatagsContainerFactory::refreshFeatures();
    ?>
<div class="header"><?php 
    echo JText::_('SEO_INSTALL_CONGRATULATION_TITLE');
    ?>
</div>
<p>
<?php 
    echo JText::_('SEO_INSTALL_CONGRATULATION_DESC');
    ?>
</p>
<?php 
    return true;
}
Example #7
0
function pluginSeoBossRender()
{
    $app =& JFactory::getApplication();
    if ($app->getName() != 'site') {
        return true;
    }
    $queryData = $_GET;
    ksort($queryData);
    $url = http_build_query($queryData);
    $buffer = JResponse::getBody();
    //Metatags processing
    require_once JPATH_ADMINISTRATOR . DS . "components" . DS . "com_seoboss" . DS . "classes" . DS . "MetatagsContainerFactory.php";
    $buffer = MetatagsContainerFactory::processBody($buffer, $url);
    $db =& JFactory::getDBO();
    $db->setQuery("SELECT sa_enable, sa_users from  #__seoboss_settings ");
    $settings =& $db->loadObject();
    if ($settings->sa_enable == "1") {
        $user =& JFactory::getUser();
        $sa_users = explode(",", $settings->sa_users);
        if (in_array($user->username, $sa_users)) {
            $metadata = MetatagsContainerFactory::getMetadata($url);
            //insert the SEO Boss Metatags Anywhere feature
            $buffer = preg_replace("/<\\/head[^>]*>/i", '<link rel="stylesheet" href="' . JURI::base() . 'components/com_seoboss/css/anywhere.css" type="text/css" />$0', $buffer);
            $buffer = preg_replace("/<body[^>]*>/i", '$0
        <script language="javascript">
        function toggleSeobossAnywhere(){
        if( document.getElementById("seobossAnywhereForm").style.display==\'none\'){
          document.getElementById("seobossAnywhereForm").style.display = \'block\';
        }else{
        document.getElementById("seobossAnywhereForm").style.display = \'none\';
        }
        }
        </script>
                <div id="seobossAnywhereForm">
        <strong>SEO Boss Anywhere is fully available in Pro version only :(</strong>
        <form method="POST" action="' . JURI::base() . '">
        <ol>
        <li>
          <label for="seoboss_title">Title</label>
          <input type="text" name="seoboss_title" id="seoboss_title" value="' . (isset($metadata['title_tag']) ? htmlspecialchars($metadata['title_tag']) : '') . '"
        disabled="true"
        />
        </li>
        <li>
          <label for="seoboss_meta_title">Meta Title</label>
          <input type="text" name="seoboss_meta_title" id="seoboss_meta_title" value="' . (isset($metadata['metatitle']) ? htmlspecialchars($metadata['metatitle']) : '') . '"
        disabled="true"
        />
        </li>
        <li>
          <label for="seoboss_meta_keywords">Meta Keywords</label>
          <input type="text" name="seoboss_meta_keywords" id="seoboss_meta_keywords" value="' . (isset($metadata['metakeywords']) ? htmlspecialchars($metadata['metakeywords']) : '') . '"
        disabled="true"
        />
        </li>
        <li>
          <label for="seoboss_meta_description">Meta Description</label>
          <input type="text" name="seoboss_meta_description" id="seoboss_meta_description" value="' . (isset($metadata['metadescription']) ? htmlspecialchars($metadata['metadescription']) : '') . '"
        disabled="true"
        />
        </li>
        <li>
      <input type="submit" value="Save" />
      <input type="submit" value="Cancel" onclick="toggleSeobossAnywhere();return false;" />    
   </li>
</ol>     
        <input type="hidden" name="option" value="com_seoboss"/>
        <input type="hidden" name="task" value="saveMetadata"/>
        <input type="hidden" name="url" value="' . $url . '"/>
        </form>   
        </div>
        <a id="seoboss_anywhere_toggle_link" href="#" onclick="toggleSeobossAnywhere();return false;">SEO Boss Anywhere</a>
', $buffer);
        }
    }
    //Redirect processing
    require_once JPATH_ADMINISTRATOR . "/components/com_seoboss/classes/RedirectFactory.php";
    $redirect = new RedirectFactory();
    $buffer = $redirect->Redirect($buffer);
    //
    $db =& JFactory::getDBO();
    //set default metatags
    $db->setQuery("SELECT `name`, `value` from  #__seoboss_default_tags");
    $defaultMetaTags =& $db->loadObjectList();
    foreach ($defaultMetaTags as $metaTag) {
        preg_match("/<meta[\\s]+name[\\s]*=[\\s]*\"" . $metaTag->name . "\"[\\s]+content[\\s]*=[\\s]*\"[^\"]*\"[\\s]*\\/>/i", $buffer, $match);
        if ($match && isset($match[0])) {
            $buffer = str_replace($match[0], "<meta name=\"" . $metaTag->name . "\" content=\"" . $metaTag->value . "\"/>", $buffer);
        } else {
            $buffer = str_replace("<head>", "<head>\n" . "<meta name=\"" . $metaTag->name . "\" content=\"" . $metaTag->value . "\"/>", $buffer);
        }
    }
    //Retreive settings
    $db->setQuery("SELECT hilight_keywords, hilight_tag, hilight_class, hilight_skip from  #__seoboss_settings ");
    $settings =& $db->loadObject();
    if ($settings->hilight_keywords) {
        preg_match("/<meta\\sname=\"keywords\"\\scontent=\"([^\"]*)\"/i", $buffer, $match);
        if ($match && isset($match[1])) {
            $keywords = explode(",", $match[1]);
            require_once JPATH_ADMINISTRATOR . "/components/com_seoboss/algorithm/DFA.php";
            $dfa = new DFA();
            $omitTags = array('title', 'textarea', 'style', 'script');
            if ($settings->hilight_skip) {
                $omitTags = array_merge($omitTags, explode(",", $settings->hilight_skip));
            }
            $buffer =& $dfa->hilight($buffer, $keywords, $omitTags, $settings->hilight_tag, $settings->hilight_class);
        }
    }
    JResponse::setBody($buffer);
}