function deleteEmptyReal($where) { if (!($urls = MijoDatabase::loadResultArray("SELECT url_sef FROM #__mijosef_metadata {$where}"))) { return false; } foreach ($urls as $url) { $url_real = MijoDatabase::loadObject("SELECT url_real FROM #__mijosef_urls WHERE url_sef = '{$url}'"); if (!is_object($url_real)) { MijoDatabase::query("DELETE FROM #__mijosef_metadata WHERE url_sef = '{$url}'"); } } return true; }
function onAfterDispatch() { if (!self::_systemCheckup(true)) { return; } $url_1 = "index.php?option=com_content"; // Get item id $item_id = JRequest::getInt('id'); $url_2 = "id={$item_id}&view=article"; $url_3 = "format=pdf"; // Get row $url = MijoDatabase::loadResult("SELECT url_sef FROM #__mijosef_urls WHERE url_real LIKE '{$url_1}%' AND url_real LIKE '%{$url_2}%' AND url_real NOT LIKE '%{$url_3}%'"); if ($url && !Mijosef::get('utility')->JoomFishInstalled()) { $row = MijoDatabase::loadObject("SELECT id, url_sef, title, description, keywords, lang, robots, googlebot FROM #__mijosef_metadata WHERE url_sef = '{$url}'"); if (!$row) { $row = new stdClass(); $row->id = 0; $row->url_sef = $url; $row->title = ''; $row->description = ''; $row->keywords = ''; $row->lang = ''; $row->robots = ''; $row->googlebot = ''; } $mainframe = JFactory::getApplication(); $mainframe->setUserState('com_mijosef.metadata', $row); $language = JFactory::getLanguage(); $language->load('com_mijosef'); // Render output $output = Mijosef::get('utility')->render(JPATH_ROOT . '/plugins/system/mijosefmetacontent/mijosefmetacontent_tmpl.php'); $document = JFactory::getDocument(); $document->setBuffer($document->getBuffer('component') . $output, 'component'); } return true; }
function getMenuTitle($Itemid, $start_level = 0, $length_level = 0) { if (empty($Itemid)) { return array(); } static $menus = array(); $id = $Itemid; if (!isset($menus[$id])) { $joomfish = $this->MijosefConfig->joomfish_trans_url ? ', id' : ''; // Title or Alias $part = 'title'; if ($this->MijosefConfig->menu_url_part == 'alias') { $part = 'alias'; } $menus[$id] = array(); while ($Itemid > 0) { $row = MijoDatabase::loadObject("SELECT {$part} AS name, parent_id{$joomfish} FROM #__menu WHERE id = '{$Itemid}' AND published > 0 AND id > 1"); if (is_null($row)) { break; } array_unshift($menus[$id], $row->name); $Itemid = $row->parent_id; if ($this->MijosefConfig->parent_menus == '0') { break; // Only last one } } } if ($this->MijosefConfig->parent_menus == '1' && ($start_level != 0 || $length_level != 0) && !empty($menus[$id])) { if ($length_level != 0) { return array_slice($menus[$id], $start_level, $length_level); } else { return array_slice($menus[$id], $start_level); } } return $menus[$id]; }
function _getCategory16($id) { $cats = $this->params->get('category_inc', '1'); if ($cats == '1') { return array(); } static $cache = array(); if (!isset($cache[$id])) { $joomfish = $this->MijosefConfig->joomfish_trans_url ? ', id' : ''; $categories = array(); $cat_title = array(); $cat_desc = array(); while ($id > 1 && $id != 4 && $id != 11) { $row = MijoDatabase::loadObject("SELECT title, alias, parent_id, description{$joomfish} FROM #__categories WHERE id = '{$id}' AND extension = 'com_contact'"); if (!is_object($row)) { break; } $name = $this->params->get('categoryid_inc', '1') != '1' ? $id . ' ' : ''; if (parent::urlPart($this->params->get('category_part', 'global')) == 'title') { $name .= $row->title; } else { $name .= $row->alias; } array_unshift($categories, $name); $cat_title[] = $row->title; $cat_desc[] = $row->description; $id = $row->parent_id; if ($cats == '2') { break; // Only last cat } } $cache[$id]['name'] = $categories; $cache[$id]['meta_title'] = $cat_title; $cache[$id]['meta_desc'] = $cat_desc; } $this->meta_title = $cache[$id]['meta_title']; if (!empty($cache[$id]['meta_desc'])) { $this->meta_desc = $cache[$id]['meta_desc'][0]; } return $cache[$id]['name']; }
function checkTags($tag, $all = false) { static $tags = array(); static $tags_db; if ($this->MijosefConfig->cache_tags == 1) { $cache = Mijosef::getCache(); $tags_cached = $cache->load('tags'); if ($all && !empty($tags_cached)) { return $tags_cached; } elseif (!empty($tags_cached[$tag])) { return $tags_cached[$tag]; } } if ($this->MijosefConfig->cache_instant == 1 || $this->MijosefConfig->cache_instant == 0 && $all) { if (!isset($tags_db)) { $tags_db = MijoDatabase::loadObjectList("SELECT * FROM #__mijosef_tags WHERE published = '1' ORDER BY {$this->MijosefConfig->tags_order}", "title"); } if ($all) { if ($this->MijosefConfig->cache_tags == 1) { $cache->save($tags_db, 'tags'); } return $tags_db; } elseif (isset($tags_db[$tag])) { if ($this->MijosefConfig->cache_tags == 1) { $tags_cached[$tag] = $tags_db[$tag]; $cache->save($tags_cached, 'tags'); } return $tags_db[$tag]; } } if (!$all) { if (!isset($tags[$tag])) { $t = MijoDatabase::quote($tag); $row = MijoDatabase::loadObject("SELECT * FROM #__mijosef_tags WHERE title = {$t} AND published = '1'"); if (is_object($row)) { $tags[$tag] = $row; } } if (isset($tags[$tag])) { if ($this->MijosefConfig->cache_instant == 1) { $tags[$tag] = $tags[$tag]; } if ($this->MijosefConfig->cache_tags == 1) { $tags_cached[$tag] = $tags[$tag]; $cache->save($tags_cached, 'tags'); } return $tags[$tag]; } } return false; }
function getLists() { JLoader::register('JHtmlSelect', JPATH_MIJOSEF_ADMIN . '/library/joomla/select.php'); $lists = array(); // Affected Area $areas = array(); $areas[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_AREA_1')); $areas[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_AREA_2')); $areas[] = JHTML::_('select.option', '3', JText::_('COM_MIJOSEF_CONFIG_AREA_3')); /* // // Main // */ $lists['mode'] = JHTML::_('select.booleanlist', 'mode', null, $this->MijosefConfig->mode); $lists['generate_sef'] = JHTML::_('select.booleanlist', 'generate_sef', null, $this->MijosefConfig->generate_sef); $lists['version_checker'] = JHTML::_('select.booleanlist', 'version_checker', null, $this->MijosefConfig->version_checker); $lists['jquery_mode'] = JHTML::_('select.booleanlist', 'jquery_mode', null, $this->MijosefConfig->jquery_mode); $lists['seo_nofollow'] = JHTML::_('select.booleanlist', 'seo_nofollow', null, $this->MijosefConfig->seo_nofollow); $lists['cache_instant'] = JHTML::_('select.booleanlist', 'cache_instant', null, $this->MijosefConfig->cache_instant); $lists['cache_versions'] = JHTML::_('select.booleanlist', 'cache_versions', null, $this->MijosefConfig->cache_versions); $lists['cache_extensions'] = JHTML::_('select.booleanlist', 'cache_extensions', null, $this->MijosefConfig->cache_extensions); $lists['cache_urls'] = JHTML::_('select.booleanlist', 'cache_urls', null, $this->MijosefConfig->cache_urls); $lists['cache_urls_moved'] = JHTML::_('select.booleanlist', 'cache_urls_moved', null, $this->MijosefConfig->cache_urls_moved); $lists['cache_metadata'] = JHTML::_('select.booleanlist', 'cache_metadata', null, $this->MijosefConfig->cache_metadata); $lists['cache_sitemap'] = JHTML::_('select.booleanlist', 'cache_sitemap', null, $this->MijosefConfig->cache_sitemap); $lists['cache_tags'] = JHTML::_('select.booleanlist', 'cache_tags', null, $this->MijosefConfig->cache_tags); $lists['cache_ilinks'] = JHTML::_('select.booleanlist', 'cache_ilinks', null, $this->MijosefConfig->cache_ilinks); // 404 Page $page404 = array(); $page404[] = JHTML::_('select.option', 'home', JText::_('COM_MIJOSEF_CONFIG_MAIN_404_HOME')); $page404[] = JHTML::_('select.option', 'custom', JText::_('COM_MIJOSEF_CONFIG_MAIN_404_CUSTOM')); $page404[] = JHTML::_('select.option', 'joomla', JText::_('COM_MIJOSEF_CONFIG_MAIN_404_JOOMLA')); $lists['page404'] = JHTML::_('select.genericlist', $page404, 'page404', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->page404); // Custom 404 Page $row = MijoDatabase::loadObject("SELECT `id`, `introtext` FROM `#__content` WHERE `title` = '404'"); $lists['custom404'] = isset($row->introtext) ? $row->introtext : JText::_('<h1>404: Not Found</h1><h4>Sorry, but the content you requested could not be found</h4>'); /* // // URL // */ $lists['url_lowercase'] = JHTML::_('select.booleanlist', 'url_lowercase', null, $this->MijosefConfig->url_lowercase); $lists['global_smart_itemid'] = JHTML::_('select.booleanlist', 'global_smart_itemid', null, $this->MijosefConfig->global_smart_itemid); $lists['ignore_multi_itemid'] = JHTML::_('select.booleanlist', 'ignore_multi_itemid', null, $this->MijosefConfig->ignore_multi_itemid); $lists['numeral_duplicated'] = JHTML::_('select.booleanlist', 'numeral_duplicated', null, $this->MijosefConfig->numeral_duplicated); $lists['record_duplicated'] = JHTML::_('select.booleanlist', 'record_duplicated', null, $this->MijosefConfig->record_duplicated); $lists['parent_menus'] = JHTML::_('select.booleanlist', 'parent_menus', null, $this->MijosefConfig->parent_menus); $lists['append_itemid'] = JHTML::_('select.booleanlist', 'append_itemid', null, $this->MijosefConfig->append_itemid); $lists['remove_trailing_slash'] = JHTML::_('select.booleanlist', 'remove_trailing_slash', null, $this->MijosefConfig->remove_trailing_slash); $lists['tolerant_to_trailing_slash'] = JHTML::_('select.booleanlist', 'tolerant_to_trailing_slash', null, $this->MijosefConfig->tolerant_to_trailing_slash); $lists['source_tracker'] = JHTML::_('select.booleanlist', 'source_tracker', null, $this->MijosefConfig->source_tracker); $lists['insert_active_itemid'] = JHTML::_('select.booleanlist', 'insert_active_itemid', null, $this->MijosefConfig->insert_active_itemid); $lists['remove_sid'] = JHTML::_('select.booleanlist', 'remove_sid', null, $this->MijosefConfig->remove_sid); $lists['set_query_string'] = JHTML::_('select.booleanlist', 'set_query_string', null, $this->MijosefConfig->set_query_string); $lists['append_non_sef'] = JHTML::_('select.booleanlist', 'append_non_sef', null, $this->MijosefConfig->append_non_sef); $lists['prevent_dup_error'] = JHTML::_('select.booleanlist', 'prevent_dup_error', null, $this->MijosefConfig->prevent_dup_error); $lists['show_db_errors'] = JHTML::_('select.booleanlist', 'show_db_errors', null, $this->MijosefConfig->show_db_errors); $lists['check_url_by_id'] = JHTML::_('select.booleanlist', 'check_url_by_id', null, $this->MijosefConfig->check_url_by_id); $lists['db_404_errors'] = JHTML::_('select.booleanlist', 'db_404_errors', null, $this->MijosefConfig->db_404_errors); $lists['log_404_errors'] = JHTML::_('select.booleanlist', 'log_404_errors', null, $this->MijosefConfig->log_404_errors); $lists['sent_headers_error'] = JHTML::_('select.booleanlist', 'sent_headers_error', null, $this->MijosefConfig->sent_headers_error); $lists['utf8_url'] = JHTML::_('select.booleanlist', 'utf8_url', null, $this->MijosefConfig->utf8_url); $lists['redirect_to_sef'] = JHTML::_('select.booleanlist', 'redirect_to_sef', null, $this->MijosefConfig->redirect_to_sef); $lists['redirect_to_sef_gen'] = JHTML::_('select.booleanlist', 'redirect_to_sef_gen', null, $this->MijosefConfig->redirect_to_sef_gen); $lists['jsef_to_mijosef'] = JHTML::_('select.booleanlist', 'jsef_to_mijosef', null, $this->MijosefConfig->jsef_to_mijosef); $lists['force_ssl'] = JHTML::_('select.booleanlist', 'force_ssl', null, $this->MijosefConfig->force_ssl); $lists['url_append_limit'] = JHTML::_('select.booleanlist', 'url_append_limit', null, $this->MijosefConfig->url_append_limit); $lists['purge_ext_urls'] = JHTML::_('select.booleanlist', 'purge_ext_urls', null, $this->MijosefConfig->purge_ext_urls); $lists['delete_other_sef'] = JHTML::_('select.booleanlist', 'delete_other_sef', null, $this->MijosefConfig->delete_other_sef); // Title-Alias $url_part = array(); $url_part[] = JHTML::_('select.option', 'title', JText::_('COM_MIJOSEF_COMMON_TITLE_FIELD')); $url_part[] = JHTML::_('select.option', 'alias', JText::_('COM_MIJOSEF_COMMON_ALIAS_FIELD')); // Extensions' title-alias field $lists['title_alias'] = JHTML::_('select.genericlist', $url_part, 'title_alias', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->title_alias); // Menu URL part $lists['menu_url_part'] = JHTML::_('select.genericlist', $url_part, 'menu_url_part', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->menu_url_part); // Base href value $base_href = array(); $base_href[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_URL_BASEHREF_ORG')); $base_href[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_URL_BASEHREF_URL')); $base_href[] = JHTML::_('select.option', '3', JText::_('COM_MIJOSEF_CONFIG_URL_BASEHREF_HOME')); $base_href[] = JHTML::_('select.option', '4', JText::_('COM_MIJOSEF_CONFIG_URL_BASEHREF_DISABLE')); $lists['base_href'] = JHTML::_('select.genericlist', $base_href, 'base_href', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->base_href); // JoomFish $lists['multilang'] = JHTML::_('select.booleanlist', 'multilang', null, $this->MijosefConfig->multilang); $lists['joomfish_main_lang_del'] = JHTML::_('select.booleanlist', 'joomfish_main_lang_del', null, $this->MijosefConfig->joomfish_main_lang_del); $lists['joomfish_lang_code'] = JHTML::_('select.booleanlist', 'joomfish_lang_code', null, $this->MijosefConfig->joomfish_lang_code); $lists['joomfish_trans_url'] = JHTML::_('select.booleanlist', 'joomfish_trans_url', null, $this->MijosefConfig->joomfish_trans_url); $lists['joomfish_cookie'] = JHTML::_('select.booleanlist', 'joomfish_cookie', null, $this->MijosefConfig->joomfish_cookie); $lists['joomfish_browser'] = JHTML::_('select.booleanlist', 'joomfish_browser', null, $this->MijosefConfig->joomfish_browser); $lang_list = array(); $lang_list[] = JHTML::_('select.option', '0', JText::_('COM_MIJOSEF_CONFIG_URL_JF_MAINLANG_NONE')); $lang_list = array_merge($lang_list, Mijosef::get('utility')->getLanguages()); $lists['joomfish_main_lang'] = JHTML::_('select.genericlist', $lang_list, 'joomfish_main_lang', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->joomfish_main_lang); // www redirect $www = array(); $www[] = JHTML::_('select.option', '0', JText::_('COM_MIJOSEF_CONFIG_URL_WWW_NOACTION')); $www[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_URL_WWW_WITH')); $www[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_URL_WWW_WHITHOUT')); $lists['redirect_to_www'] = JHTML::_('select.genericlist', $www, 'redirect_to_www', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->redirect_to_www); // Force SSL $force_ssl = JHTML::_('menu.linkoptions', true, true); $lists['force_ssl'] = JHTML::_('select.genericlist', $force_ssl, 'force_ssl[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $this->MijosefConfig->force_ssl); /* // // Meta Tags // */ $lists['meta_core'] = JHTML::_('select.booleanlist', 'meta_core', null, $this->MijosefConfig->meta_core); $lists['meta_title'] = JHTML::_('select.booleanlist', 'meta_title', null, $this->MijosefConfig->meta_title); $lists['meta_title_tag'] = JHTML::_('select.booleanlist', 'meta_title_tag', null, $this->MijosefConfig->meta_title_tag); $lists['meta_generator_rem'] = JHTML::_('select.booleanlist', 'meta_generator_rem', null, $this->MijosefConfig->meta_generator_rem); // Meta Tags list $meta = array(); $meta[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_META_TDK_ALWAYS')); $meta[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_META_TDK_NEVER')); $meta[] = JHTML::_('select.option', '3', JText::_('COM_MIJOSEF_CONFIG_META_TDK_EMPTY')); // Meta Description $lists['meta_desc'] = JHTML::_('select.genericlist', $meta, 'meta_desc', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->meta_desc); // Meta Keywords $lists['meta_key'] = JHTML::_('select.genericlist', $meta, 'meta_key', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->meta_key); // Use sitename $sitename = array(); $sitename[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_META_T_USE_SITENAME_1')); $sitename[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_META_T_USE_SITENAME_2')); $sitename[] = JHTML::_('select.option', '3', JText::_('COM_MIJOSEF_CONFIG_META_T_USE_SITENAME_3')); $lists['meta_t_usesitename'] = JHTML::_('select.genericlist', $sitename, 'meta_t_usesitename', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->meta_t_usesitename); /* // // Sitemap // */ $lists['sm_ping'] = JHTML::_('select.booleanlist', 'sm_ping', null, $this->MijosefConfig->sm_ping); $lists['sm_xml_date'] = JHTML::_('select.booleanlist', 'sm_xml_date', null, $this->MijosefConfig->sm_xml_date); $lists['sm_xml_freq'] = JHTML::_('select.booleanlist', 'sm_xml_freq', null, $this->MijosefConfig->sm_xml_freq); $lists['sm_xml_prior'] = JHTML::_('select.booleanlist', 'sm_xml_prior', null, $this->MijosefConfig->sm_xml_prior); $lists['sm_dot_tree'] = JHTML::_('select.booleanlist', 'sm_dot_tree', null, $this->MijosefConfig->sm_dot_tree); $lists['sm_freq'] = JHTML::_('select.genericlist', Mijosef::get('sitemap')->getFrequencyList(), 'sm_freq', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->sm_freq); $lists['sm_priority'] = JHTML::_('select.genericlist', Mijosef::get('sitemap')->getPriorityList(), 'sm_priority', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->sm_priority); $lists['sm_auto_mode'] = JHTML::_('select.booleanlist', 'sm_auto_mode', null, $this->MijosefConfig->sm_auto_mode); $lists['sm_auto_components'] = JHTML::_('select.genericlist', Mijosef::get('utility')->getComponents(), 'sm_auto_components[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $this->MijosefConfig->sm_auto_components); $lists['sm_auto_enable_cats'] = JHTML::_('select.booleanlist', 'sm_auto_enable_cats', null, $this->MijosefConfig->sm_auto_enable_cats); $lists['sm_auto_cron_mode'] = JHTML::_('select.booleanlist', 'sm_auto_cron_mode', null, $this->MijosefConfig->sm_auto_cron_mode); $lists['sm_auto_xml'] = JHTML::_('select.booleanlist', 'sm_auto_xml', null, $this->MijosefConfig->sm_auto_xml); $lists['sm_auto_ping_c'] = JHTML::_('select.booleanlist', 'sm_auto_ping_c', null, $this->MijosefConfig->sm_auto_ping_c); $lists['sm_auto_ping_s'] = JHTML::_('select.booleanlist', 'sm_auto_ping_s', null, $this->MijosefConfig->sm_auto_ping_s); // Ping Type $ping_type = array(); $ping_type[] = JHTML::_('select.option', 'link', JText::_('COM_MIJOSEF_CONFIG_SITEMAP_XML_URL')); $ping_type[] = JHTML::_('select.option', 'file', JText::_('COM_MIJOSEF_CONFIG_SITEMAP_FILE')); $lists['sm_ping_type'] = JHTML::_('select.genericlist', $ping_type, 'sm_ping_type', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->sm_ping_type); // Cron Frequency $cron_freq = array(); $cron_freq[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_COMMON_SEF') . ' ' . JText::_('COM_MIJOSEF_COMMON_URL')); $cron_freq[] = JHTML::_('select.option', '4', '4 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_HOURS')); $cron_freq[] = JHTML::_('select.option', '8', '8 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_HOURS')); $cron_freq[] = JHTML::_('select.option', '12', '12 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_HOURS')); $cron_freq[] = JHTML::_('select.option', '24', '1 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_DAYS')); $cron_freq[] = JHTML::_('select.option', '48', '2 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_DAYS')); $cron_freq[] = JHTML::_('select.option', '168', '1 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_WEEKS')); $cron_freq[] = JHTML::_('select.option', '720', '1 ' . JText::_('COM_MIJOSEF_CONFIG_SITEMAP_AUTO_CRON_FREQ_MONTHS')); $lists['sm_auto_cron_freq'] = JHTML::_('select.genericlist', $cron_freq, 'sm_auto_cron_freq', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->sm_auto_cron_freq); /* // // Tags // */ $lists['tags_mode'] = JHTML::_('select.booleanlist', 'tags_mode', null, $this->MijosefConfig->tags_mode); $lists['tags_area'] = JHTML::_('select.genericlist', $areas, 'tags_area', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->tags_area); $lists['tags_components'] = JHTML::_('select.genericlist', Mijosef::get('utility')->getComponents(), 'tags_components[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $this->MijosefConfig->tags_components); $lists['tags_enable_cats'] = JHTML::_('select.booleanlist', 'tags_enable_cats', null, $this->MijosefConfig->tags_enable_cats); $lists['tags_in_cats'] = JHTML::_('select.booleanlist', 'tags_in_cats', null, $this->MijosefConfig->tags_in_cats); $lists['tags_show_tag_desc'] = JHTML::_('select.booleanlist', 'tags_show_tag_desc', null, $this->MijosefConfig->tags_show_tag_desc); $lists['tags_show_prefix'] = JHTML::_('select.booleanlist', 'tags_show_prefix', null, $this->MijosefConfig->tags_show_prefix); $lists['tags_show_item_desc'] = JHTML::_('select.booleanlist', 'tags_show_item_desc', null, $this->MijosefConfig->tags_show_item_desc); $lists['tags_exp_item_desc'] = JHTML::_('select.booleanlist', 'tags_exp_item_desc', null, $this->MijosefConfig->tags_exp_item_desc); $lists['tags_published'] = JHTML::_('select.booleanlist', 'tags_published', null, $this->MijosefConfig->tags_published); $lists['tags_auto_mode'] = JHTML::_('select.booleanlist', 'tags_auto_mode', null, $this->MijosefConfig->tags_auto_mode); $lists['tags_auto_components'] = JHTML::_('select.genericlist', Mijosef::get('utility')->getComponents(), 'tags_auto_components[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $this->MijosefConfig->tags_auto_components); // Order $order = array(); $order[] = JHTML::_('select.option', 'ordering', JText::_('COM_MIJOSEF_CONFIG_TAGS_ORDER_1')); $order[] = JHTML::_('select.option', 'ordering DESC', JText::_('COM_MIJOSEF_CONFIG_TAGS_ORDER_2')); $order[] = JHTML::_('select.option', 'title', JText::_('COM_MIJOSEF_CONFIG_TAGS_ORDER_3')); $order[] = JHTML::_('select.option', 'title DESC', JText::_('COM_MIJOSEF_CONFIG_TAGS_ORDER_4')); $order[] = JHTML::_('select.option', 'hits', JText::_('COM_MIJOSEF_CONFIG_TAGS_ORDER_5')); $order[] = JHTML::_('select.option', 'hits DESC', JText::_('COM_MIJOSEF_CONFIG_TAGS_ORDER_6')); $lists['tags_order'] = JHTML::_('select.genericlist', $order, 'tags_order', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->tags_order); // Position $pos = array(); $pos[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_POSITION_1')); $pos[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_POSITION_2')); $lists['tags_position'] = JHTML::_('select.genericlist', $pos, 'tags_position', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->tags_position); /* // // Internal Links // */ $lists['ilinks_mode'] = JHTML::_('select.booleanlist', 'ilinks_mode', null, $this->MijosefConfig->ilinks_mode); $lists['ilinks_area'] = JHTML::_('select.genericlist', $areas, 'ilinks_area', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->ilinks_area); $lists['ilinks_components'] = JHTML::_('select.genericlist', Mijosef::get('utility')->getComponents(), 'ilinks_components[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $this->MijosefConfig->ilinks_components); $lists['ilinks_enable_cats'] = JHTML::_('select.booleanlist', 'ilinks_enable_cats', null, $this->MijosefConfig->ilinks_enable_cats); $lists['ilinks_in_cats'] = JHTML::_('select.booleanlist', 'ilinks_in_cats', null, $this->MijosefConfig->ilinks_in_cats); $lists['ilinks_case'] = JHTML::_('select.booleanlist', 'ilinks_case', null, $this->MijosefConfig->ilinks_case); $lists['ilinks_published'] = JHTML::_('select.booleanlist', 'ilinks_published', null, $this->MijosefConfig->ilinks_published); $lists['ilinks_nofollow'] = JHTML::_('select.booleanlist', 'ilinks_nofollow', null, $this->MijosefConfig->ilinks_nofollow); $lists['ilinks_blank'] = JHTML::_('select.booleanlist', 'ilinks_blank', null, $this->MijosefConfig->ilinks_blank); /* // // Social Bookmarks // */ $lists['bookmarks_mode'] = JHTML::_('select.booleanlist', 'bookmarks_mode', null, $this->MijosefConfig->bookmarks_mode); $lists['bookmarks_area'] = JHTML::_('select.genericlist', $areas, 'bookmarks_area', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->bookmarks_area); $lists['bookmarks_components'] = JHTML::_('select.genericlist', Mijosef::get('utility')->getComponents(), 'bookmarks_components[]', 'class="inputbox" size="10" multiple="multiple"', 'value', 'text', $this->MijosefConfig->bookmarks_components); $lists['bookmarks_enable_cats'] = JHTML::_('select.booleanlist', 'bookmarks_enable_cats', null, $this->MijosefConfig->bookmarks_enable_cats); $lists['bookmarks_in_cats'] = JHTML::_('select.booleanlist', 'bookmarks_in_cats', null, $this->MijosefConfig->bookmarks_in_cats); $lists['bookmarks_published'] = JHTML::_('select.booleanlist', 'bookmarks_published', null, $this->MijosefConfig->bookmarks_published); // Icons $icons = array(); $icons[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_POSITION_1')); $icons[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_POSITION_2')); $icons[] = JHTML::_('select.option', '3', JText::_('COM_MIJOSEF_CONFIG_POSITION_3')); $lists['bookmarks_icons_pos'] = JHTML::_('select.genericlist', $icons, 'bookmarks_icons_pos', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->bookmarks_icons_pos); // Type Filter $type_list[] = JHTML::_('select.option', 'icon', JText::_('COM_MIJOSEF_BOOKMARKS_TYPE_1')); $type_list[] = JHTML::_('select.option', 'iconset', JText::_('COM_MIJOSEF_BOOKMARKS_TYPE_2')); $type_list[] = JHTML::_('select.option', 'badge', JText::_('COM_MIJOSEF_BOOKMARKS_TYPE_3')); $lists['bookmarks_type'] = JHTML::_('select.genericlist', $type_list, 'bookmarks_type', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->bookmarks_type); /* // // User Interface // */ $lists['ui_sef_language'] = JHTML::_('select.booleanlist', 'ui_sef_language', null, $this->MijosefConfig->ui_sef_language); $lists['ui_sef_published'] = JHTML::_('select.booleanlist', 'ui_sef_published', null, $this->MijosefConfig->ui_sef_published); $lists['ui_sef_used'] = JHTML::_('select.booleanlist', 'ui_sef_used', null, $this->MijosefConfig->ui_sef_used); $lists['ui_sef_locked'] = JHTML::_('select.booleanlist', 'ui_sef_locked', null, $this->MijosefConfig->ui_sef_locked); $lists['ui_sef_blocked'] = JHTML::_('select.booleanlist', 'ui_sef_blocked', null, $this->MijosefConfig->ui_sef_blocked); $lists['ui_sef_cached'] = JHTML::_('select.booleanlist', 'ui_sef_cached', null, $this->MijosefConfig->ui_sef_cached); $lists['ui_sef_date'] = JHTML::_('select.booleanlist', 'ui_sef_date', null, $this->MijosefConfig->ui_sef_date); $lists['ui_sef_hits'] = JHTML::_('select.booleanlist', 'ui_sef_hits', null, $this->MijosefConfig->ui_sef_hits); $lists['ui_sef_id'] = JHTML::_('select.booleanlist', 'ui_sef_id', null, $this->MijosefConfig->ui_sef_id); $lists['ui_moved_published'] = JHTML::_('select.booleanlist', 'ui_moved_published', null, $this->MijosefConfig->ui_moved_published); $lists['ui_moved_hits'] = JHTML::_('select.booleanlist', 'ui_moved_hits', null, $this->MijosefConfig->ui_moved_hits); $lists['ui_moved_clicked'] = JHTML::_('select.booleanlist', 'ui_moved_clicked', null, $this->MijosefConfig->ui_moved_clicked); $lists['ui_moved_cached'] = JHTML::_('select.booleanlist', 'ui_moved_cached', null, $this->MijosefConfig->ui_moved_cached); $lists['ui_moved_id'] = JHTML::_('select.booleanlist', 'ui_moved_id', null, $this->MijosefConfig->ui_moved_id); $lists['ui_metadata_keys'] = JHTML::_('select.booleanlist', 'ui_metadata_keys', null, $this->MijosefConfig->ui_metadata_keys); $lists['ui_metadata_published'] = JHTML::_('select.booleanlist', 'ui_metadata_published', null, $this->MijosefConfig->ui_metadata_published); $lists['ui_metadata_cached'] = JHTML::_('select.booleanlist', 'ui_metadata_cached', null, $this->MijosefConfig->ui_metadata_cached); $lists['ui_metadata_id'] = JHTML::_('select.booleanlist', 'ui_metadata_id', null, $this->MijosefConfig->ui_metadata_id); $lists['ui_sitemap_title'] = JHTML::_('select.booleanlist', 'ui_sitemap_title', null, $this->MijosefConfig->ui_sitemap_title); $lists['ui_sitemap_published'] = JHTML::_('select.booleanlist', 'ui_sitemap_published', null, $this->MijosefConfig->ui_sitemap_published); $lists['ui_sitemap_id'] = JHTML::_('select.booleanlist', 'ui_sitemap_id', null, $this->MijosefConfig->ui_sitemap_id); $lists['ui_sitemap_parent'] = JHTML::_('select.booleanlist', 'ui_sitemap_parent', null, $this->MijosefConfig->ui_sitemap_parent); $lists['ui_sitemap_order'] = JHTML::_('select.booleanlist', 'ui_sitemap_order', null, $this->MijosefConfig->ui_sitemap_order); $lists['ui_sitemap_date'] = JHTML::_('select.booleanlist', 'ui_sitemap_date', null, $this->MijosefConfig->ui_sitemap_date); $lists['ui_sitemap_frequency'] = JHTML::_('select.booleanlist', 'ui_sitemap_frequency', null, $this->MijosefConfig->ui_sitemap_frequency); $lists['ui_sitemap_priority'] = JHTML::_('select.booleanlist', 'ui_sitemap_priority', null, $this->MijosefConfig->ui_sitemap_priority); $lists['ui_sitemap_cached'] = JHTML::_('select.booleanlist', 'ui_sitemap_cached', null, $this->MijosefConfig->ui_sitemap_cached); $lists['ui_tags_published'] = JHTML::_('select.booleanlist', 'ui_tags_published', null, $this->MijosefConfig->ui_tags_published); $lists['ui_tags_ordering'] = JHTML::_('select.booleanlist', 'ui_tags_ordering', null, $this->MijosefConfig->ui_tags_ordering); $lists['ui_tags_cached'] = JHTML::_('select.booleanlist', 'ui_tags_cached', null, $this->MijosefConfig->ui_tags_cached); $lists['ui_tags_hits'] = JHTML::_('select.booleanlist', 'ui_tags_hits', null, $this->MijosefConfig->ui_tags_hits); $lists['ui_tags_id'] = JHTML::_('select.booleanlist', 'ui_tags_id', null, $this->MijosefConfig->ui_tags_id); $lists['ui_ilinks_published'] = JHTML::_('select.booleanlist', 'ui_ilinks_published', null, $this->MijosefConfig->ui_ilinks_published); $lists['ui_ilinks_nofollow'] = JHTML::_('select.booleanlist', 'ui_ilinks_nofollow', null, $this->MijosefConfig->ui_ilinks_nofollow); $lists['ui_ilinks_blank'] = JHTML::_('select.booleanlist', 'ui_ilinks_blank', null, $this->MijosefConfig->ui_ilinks_blank); $lists['ui_ilinks_limit'] = JHTML::_('select.booleanlist', 'ui_ilinks_limit', null, $this->MijosefConfig->ui_ilinks_limit); $lists['ui_ilinks_cached'] = JHTML::_('select.booleanlist', 'ui_ilinks_cached', null, $this->MijosefConfig->ui_ilinks_cached); $lists['ui_ilinks_id'] = JHTML::_('select.booleanlist', 'ui_ilinks_id', null, $this->MijosefConfig->ui_ilinks_id); $lists['ui_bookmarks_published'] = JHTML::_('select.booleanlist', 'ui_bookmarks_published', null, $this->MijosefConfig->ui_bookmarks_published); $lists['ui_bookmarks_id'] = JHTML::_('select.booleanlist', 'ui_bookmarks_id', null, $this->MijosefConfig->ui_bookmarks_id); // Control Panel Layout $ui_cpanel = array(); $ui_cpanel[] = JHTML::_('select.option', '1', JText::_('COM_MIJOSEF_CONFIG_UI_CP_1')); $ui_cpanel[] = JHTML::_('select.option', '2', JText::_('COM_MIJOSEF_CONFIG_UI_CP_2')); $lists['ui_cpanel'] = JHTML::_('select.genericlist', $ui_cpanel, 'ui_cpanel', 'class="inputbox" size="1"', 'value', 'text', $this->MijosefConfig->ui_cpanel); return $lists; }
function parseURI($uri, $old_uri) { $mainframe = JFactory::getApplication(); $route = $uri->getPath(); $lang = $uri->getVar('lang'); // Get the variables from the uri $vars = $uri->getQuery(true); // Handle an empty URL (special case) if (empty($route)) { self::determineLanguage(JRequest::getVar('lang')); $menu = Mijosef::get('utility')->getMenu(); // if route is empty AND option is set in the query, assume it's non-sef url, and parse apropriately if (isset($vars['option']) || isset($vars['Itemid'])) { return self::_parseRawRoute($uri); } $item = self::getDefaultMenuItem(); //Set the information in the request $vars = $item->query; //Get the itemid $vars['Itemid'] = $item->id; // Set the active menu item $menu->setActive($vars['Itemid']); // Set mainframe vars $row = Mijosef::get('cache')->checkURL('', true); if (is_object($row) && Mijosef::get('utility')->getParam($row->params, 'published') == '1') { $mainframe->set('mijosef.url.id', $row->id); $mainframe->set('mijosef.url.sef', $row->url_sef); $mainframe->set('mijosef.url.real', $row->url_real); $mainframe->set('mijosef.url.params', $row->params); $meta = Mijosef::get('cache')->checkMetadata($row->url_sef); if (is_object($meta)) { if (!empty($meta->title)) { $mainframe->set('mijosef.meta.title', $meta->title); } if (!empty($meta->description)) { $mainframe->set('mijosef.meta.desc', $meta->description); } if (!empty($meta->keywords)) { $mainframe->set('mijosef.meta.key', $meta->keywords); } if (!empty($meta->lang)) { $mainframe->set('mijosef.meta.lang', $meta->lang); } if (!empty($meta->robots)) { $mainframe->set('mijosef.meta.robots', $meta->robots); } if (!empty($meta->google)) { $mainframe->set('mijosef.meta.google', $meta->google); } if (!empty($meta->canonical)) { $mainframe->set('mijosef.link.canonical', $meta->canonical); } } } return $vars; } $q = $uri->getQuery(); $new_vars = self::_newVars($old_uri, $route, $q, $lang); // Joomfish $lang = isset($new_vars['lang']) ? $new_vars['lang'] : (isset($vars['lang']) ? $vars['lang'] : null); self::determineLanguage($lang); if (!empty($new_vars) && !empty($vars)) { // If this was SEF url, consider the vars in query as nonsef $non_sef_vars = array_diff_key($vars, $new_vars); if (!empty($non_sef_vars)) { $mainframe->set('mijosef.global.nonsefvars', $non_sef_vars); } } if (!empty($vars)) { // append the original query string because some components // (like SMF Bridge and SOBI2) use it $vars = array_merge($vars, $new_vars); } else { $vars = $new_vars; } if (!empty($new_vars)) { self::sendHeader('HTTP/1.0 200 OK'); } else { $menu = Mijosef::get('utility')->getMenu(); // set nonsef vars $mainframe->set('mijosef.global.nonsefvars', $vars); // Check if 404 records should be saved in DB if ($this->MijosefConfig->db_404_errors == 1) { $routee = MijoDatabase::quote($route); $found = MijoDatabase::loadObject("SELECT url_sef FROM #__mijosef_urls WHERE url_sef = {$routee} AND params LIKE '%\"notfound\":1%' LIMIT 1"); if ($found) { // Found, update hits MijoDatabase::query("UPDATE #__mijosef_urls SET hits = (hits+1) WHERE url_sef = {$routee}"); } else { // Save 404 URL $prms = array(); $prms['custom'] = 0; $prms['published'] = 0; $prms['locked'] = 0; $prms['blocked'] = 0; $prms['trashed'] = 0; $prms['notfound'] = 1; $prms['tags'] = 0; $prms['ilinks'] = 0; $prms['bookmarks'] = 0; $prms['visited'] = 0; $prms['notes'] = ''; $reg = new JRegistry($prms); $params = $reg->toString(); MijoDatabase::query("INSERT IGNORE INTO #__mijosef_urls (url_sef, url_real, cdate, params) VALUES ({$routee}, {$routee}, '" . date('Y-m-d H:i:s') . "', '{$params}')"); } } // Check if should be written to a logfile if ($this->MijosefConfig->log_404_errors == '1') { Mijosef::get('utility')->import('library.error'); MijosefError::logNotFoundURL($route); } if ($this->MijosefConfig->page404 == 'custom') { if ($url = Mijosef::get('cache')->checkURL('404' . $this->MijosefConfig->url_suffix, true)) { $url_real = str_replace('&', '&', $url->url_real); $QUERY_STRING = str_replace('index.php?', '', $url_real); parse_str($QUERY_STRING, $vars); if (!empty($vars['Itemid'])) { $menu->setActive($vars['Itemid']); } } elseif ($id = MijoDatabase::loadResult("SELECT id FROM #__content WHERE title = '404' AND state = '1'")) { $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['id'] = $id; $vars['Itemid'] = 99999; } else { die(JText::_('ERROR_DEFAULT_404') . ' PAGE NOT FOUND: ' . $route . "<br />URI:" . $_SERVER['REQUEST_URI']); } } elseif ($this->MijosefConfig->page404 == 'home') { $item = self::getDefaultMenuItem(); //Get the vars $vars = $item->query; $vars['Itemid'] = $item->id; $menu->setActive($vars['Itemid']); } elseif ($this->MijosefConfig->page404 == 'joomla') { JError::raiseError(404, JText::_("THE REQUESTED RESOURCE WAS NOT FOUND")); } self::sendHeader('HTTP/1.0 404 NOT FOUND'); } // Set QUERY_STRING if set to if ($this->MijosefConfig->set_query_string == 1) { $qs = array(); foreach ($vars as $name => $val) { if (is_array($val)) { foreach ($val as $k => $v) { $qs[] = $name . '[' . $k . ']=' . urlencode($v); } } else { $qs[] = $name . '=' . urlencode($val); } } $qs = implode('&', $qs); if (!empty($qs)) { $_SERVER['QUERY_STRING'] = $qs; } } return $vars; }
function getSitemap($url) { $empty = new stdClass(); $empty->id = ""; $empty->published = "0"; $empty->sdate = date('Y-m-d'); $empty->frequency = $this->MijosefConfig->sm_freq; $empty->priority = $this->MijosefConfig->sm_priority; $empty->sparent = ""; $empty->sorder = ""; $task = JRequest::getWord('task'); if ($task == 'add') { return $empty; } $sitemap = MijoDatabase::loadObject("SELECT * FROM #__mijosef_sitemap WHERE url_sef = '{$url}'"); if (!is_object($sitemap)) { return $empty; } return $sitemap; }
function _getArticleWP($id) { static $cache = array(); if (!isset($cache[$id])) { $joomfish = $this->MijosefConfig->joomfish_trans_url ? ', id' : ''; $row = MijoDatabase::loadObject("SELECT title, alias, catid, introtext, metadesc, sectionid, publish_up, created_by{$joomfish} FROM #__content WHERE id = {$id}"); if (!empty($row) && is_object($row)) { $name = array(); $structure = $this->params->get('url_structure', 'daytitle'); $date = explode('-', JFactory::getDate($row->publish_up)->toFormat('%Y-%m-%d')); $year = $date[0]; $month = $date[1]; $day = $date[2]; switch ($structure) { case 'daytitle': $name[] = $year; $name[] = $month; $name[] = $day; $name[] = ($this->params->get('articleid_inc', '1') != '1' ? $id . ' ' : '') . $row->title; $meta_title = $row->title; break; case 'monthtitle': $name[] = $year; $name[] = $month; $name[] = ($this->params->get('articleid_inc', '1') != '1' ? $id . ' ' : '') . $row->title; $meta_title = $row->title; break; case 'numeric': $name[] = 'archives'; $name[] = $id; $meta_title = $row->title; break; case 'custom': $custom_structure = $this->params->get('custom_structure', 'category/article'); $array_structure = explode('/', $custom_structure); $category = $author = ''; $article = ($this->params->get('articleid_inc', '1') != '1' ? $id . ' ' : '') . $row->title; if (in_array('{category}', $array_structure) && !empty($row->catid)) { $category = self::_getCategory(intval($row->catid), true, 'article'); if (self::_is16()) { $category = $category[0]; } } if (in_array('{author}', $array_structure) && !empty($row->created_by)) { $author = self::_getUser(intval($row->created_by)); } $search = array('{category}', '{article}', '{author}', '{year}', '{month}', '{day}'); $replace = array($category, $article, $author, $year, $month, $day); $name[] = str_replace($search, $replace, $custom_structure); $meta_title = $row->title; break; } $cache[$id]['name'] = $name; $cache[$id]['meta_title'] = $meta_title; if ($this->params->get('item_desc', '1') == '1') { $cache[$id]['meta_desc'] = $row->introtext; } else { $cache[$id]['meta_desc'] = $row->metadesc; } } else { $cache[$id]['name'] = array(); $cache[$id]['meta_title'] = $cache[$id]['meta_desc'] = ""; } } array_unshift($this->meta_title, $cache[$id]['meta_title']); $this->meta_desc = $cache[$id]['meta_desc']; return $cache[$id]['name']; }
function _getMijosefLine($vars) { $f = "url_sef, url_real, mdate, used, source, params"; $url_real = $vars['url_real']; $notfound = 0; if ($url_real == "") { $url_real = $vars['url_sef']; $notfound = 1; } $found = MijoDatabase::loadObject("SELECT url_sef FROM #__mijosef_urls WHERE url_real = '{$url_real}'"); if (is_object($found)) { return ""; } $custom = 0; if ($vars['mdate'] != '0000-00-00') { $custom = 1; } switch ($vars['used']) { case 10: $used = 2; break; case 0: $used = 1; break; case 5: $used = 0; break; default: $used = 0; break; } $trashed = 0; if (isset($vars['trashed'])) { $trashed = $vars['trashed']; } $prms = array(); $prms['custom'] = (int) $custom; $prms['published'] = (int) $vars['published']; $prms['locked'] = (int) $vars['locked']; $prms['blocked'] = (int) $vars['blocked']; $prms['trashed'] = (int) $trashed; $prms['notfound'] = (int) $notfound; $prms['tags'] = 0; $prms['ilinks'] = 0; $prms['bookmarks'] = 0; $prms['visited'] = 0; $prms['notes'] = $vars['notes']; $reg = new JRegistry($prms); $params = $reg->toString(); $v = "'{$vars['url_sef']}', '{$url_real}', '{$vars['mdate']} 00:00:00', '{$used}', '{$vars['source']}', '{$params}'"; $line = "INSERT INTO {$this->_dbprefix}mijosef_urls ({$f}) VALUES ({$v});"; return $line; }