Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:joomla/joomla-cms into com_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Aug 29, 2017
2 parents ab8b4b5 + 6ae4f32 commit 0066026
Show file tree
Hide file tree
Showing 18 changed files with 374 additions and 151 deletions.
1 change: 1 addition & 0 deletions administrator/components/com_admin/script.php
Expand Up @@ -1659,6 +1659,7 @@ public function deleteUnexistingFiles()
'/libraries/cms/helper/route.php',
'/libraries/cms/helper/tags.php',
'/libraries/cms/helper/usergroups.php',
'/libraries/cms/html/html.php',
'/libraries/cms/installer/adapter.php',
'/libraries/cms/installer/extension.php',
'/libraries/cms/installer/helper.php',
Expand Down
Expand Up @@ -145,7 +145,7 @@ protected function getOptions()
$user = JFactory::getUser();

$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text, a.level, a.published, a.lft')
->select('a.id AS value, a.title AS text, a.level, a.published, a.lft, a.language')
->from('#__categories AS a');

// Filter by the extension type
Expand Down Expand Up @@ -232,16 +232,6 @@ protected function getOptions()
}
}

// Displays language code if not set to All
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('language'))
->where($db->quoteName('id') . '=' . (int) $options[$i]->value)
->from($db->quoteName('#__categories'));

$db->setQuery($query);
$language = $db->loadResult();

if ($options[$i]->level != 0)
{
$options[$i]->level = $options[$i]->level -1;
Expand All @@ -256,9 +246,10 @@ protected function getOptions()
$options[$i]->text = str_repeat('- ', $options[$i]->level) . '[' . $options[$i]->text . ']';
}

if ($language !== '*')
// Displays language code if not set to All
if ($options[$i]->language !== '*')
{
$options[$i]->text = $options[$i]->text . ' (' . $language . ')';
$options[$i]->text = $options[$i]->text . ' (' . $options[$i]->language . ')';
}
}

Expand Down
Expand Up @@ -424,7 +424,7 @@ protected function tokenizeToDb($input, $context, $lang, $format)
$string = substr($buffer, 0, $ls);

// Adjust the buffer based on the last space for the next iteration and trim.
$buffer = JString::trim(substr($buffer, $ls));
$buffer = StringHelper::trim(substr($buffer, $ls));
}
// No space character was found.
else
Expand Down
4 changes: 2 additions & 2 deletions administrator/language/en-GB/en-GB.plg_sampledata_blog.ini
Expand Up @@ -4,7 +4,7 @@
; Note : All ini files need to be saved as UTF-8

PLG_SAMPLEDATA_BLOG="Sample Data - Blog"
PLG_SAMPLEDATA_BLOG_OVERVIEW_DESC="Sample data which will set up a blog site."
PLG_SAMPLEDATA_BLOG_OVERVIEW_DESC="Sample data which will set up a blog site.<br>If the site is multilingual, the data will be tagged to the active backend language."
PLG_SAMPLEDATA_BLOG_OVERVIEW_TITLE="Blog Sample data"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_0_FULLTEXT=""
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_0_INTROTEXT="<p>This tells you a bit about this blog and the person who writes it. </p><p>When you are logged in you will be able to edit this page by clicking on the edit icon.</p>"
Expand All @@ -26,7 +26,7 @@ PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_5_INTROTEXT="<p>Templates control
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_ARTICLE_5_TITLE="Your Template"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_CATEGORY_0_TITLE="Blog"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_CONTENT_CATEGORY_1_TITLE="Help"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_0_TITLE="Blog Home"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_0_TITLE="Blog"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_1_TITLE="About"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_2_TITLE="Author Login"
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_ITEM_3_TITLE="Create a Post"
Expand Down
2 changes: 1 addition & 1 deletion administrator/manifests/files/joomla.xml
Expand Up @@ -6,7 +6,7 @@
<authorUrl>www.joomla.org</authorUrl>
<copyright>(C) 2005 - 2017 Open Source Matters. All rights reserved</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.8.0-beta4-dev</version>
<version>3.8.0-beta5-dev</version>
<creationDate>August 2017</creationDate>
<description>FILES_JOOMLA_XML_DESCRIPTION</description>

Expand Down
4 changes: 2 additions & 2 deletions administrator/modules/mod_menu/menu.php
Expand Up @@ -36,7 +36,7 @@ class JAdminCssMenu
*
* @var Registry
*
* @since __DEPLOY_VERSION__
* @since 3.8.0
*/
protected $params;

Expand All @@ -45,7 +45,7 @@ class JAdminCssMenu
*
* @var bool
*
* @since __DEPLOY_VERSION__
* @since 3.8.0
*/
protected $enabled;

Expand Down
2 changes: 1 addition & 1 deletion administrator/modules/mod_sampledata/tmpl/default.php
Expand Up @@ -37,7 +37,7 @@
</div>
<div class="span6">
<small>
<?php echo htmlspecialchars($item->description); ?>
<?php echo $item->description; ?>
</small>
</div>
</div>
Expand Down
Expand Up @@ -33,7 +33,7 @@
<?php endif; ?>

<?php // Display the 'no results' message and exit the template. ?>
<?php if ($this->total === 0) : ?>
<?php if (($this->total === 0) || ($this->total === null)) : ?>
<div id="search-result-empty">
<h2><?php echo JText::_('COM_FINDER_SEARCH_NO_RESULTS_HEADING'); ?></h2>
<?php $multilang = JFactory::getApplication()->getLanguageFilter() ? '_MULTILANG' : ''; ?>
Expand Down
23 changes: 22 additions & 1 deletion installation/controller/setdefaultlanguage.php
Expand Up @@ -130,7 +130,19 @@ public function execute()
continue;
}

if (!$tableMenuItem = $model->addMenuItem($siteLang))
if (!$data['installLocalisedContent'])
{
if (!$tableMenuItem = $model->addFeaturedMenuItem($siteLang))
{
$app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name), 'warning');

continue;
}

$groupedAssociations['com_menus.item'][$siteLang->language] = $tableMenuItem->id;
}

if (!$tableMenuItem = $model->addAllCategoriesMenuItem($siteLang))
{
$app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name), 'warning');

Expand All @@ -157,6 +169,15 @@ public function execute()

$groupedAssociations['com_categories.item'][$siteLang->language] = $tableCategory->id;

if (!$tableMenuItem = $model->addBlogMenuItem($siteLang, $tableCategory->id))
{
$app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name), 'warning');

continue;
}

$groupedAssociations['com_menus.item'][$siteLang->language] = $tableMenuItem->id;

if (!$tableArticle = $model->addArticle($siteLang, $tableCategory->id))
{
$app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE', $frontend_lang), 'warning');
Expand Down
4 changes: 2 additions & 2 deletions installation/language/en-GB/en-GB.ini
Expand Up @@ -123,8 +123,8 @@ INSTL_EMAIL_NOT_SENT="Email could not be sent."
;Complete view
INSTL_COMPLETE_ADMINISTRATION_LOGIN_DETAILS="Administration Login Details"
INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED="The &quot;%s&quot; folder has already been deleted."
INSTL_COMPLETE_ERROR_FOLDER_DELETE="&quot;%s&quot; folder could not be deleted. Please manually delete the folder."
INSTL_COMPLETE_FOLDER_REMOVED="&quot;%s&quot; folder removed."
INSTL_COMPLETE_ERROR_FOLDER_DELETE="\"%s\" folder could not be deleted. Please manually delete the folder."
INSTL_COMPLETE_FOLDER_REMOVED="\"%s\" folder removed."
INSTL_COMPLETE_LANGUAGE_1="Joomla! in your own language and/or automatic basic native multilingual site creation"
INSTL_COMPLETE_LANGUAGE_DESC="Before removing the &quot;%s&quot; folder you can install extra languages. If you want to add extra languages to your Joomla! application select the following button."
INSTL_COMPLETE_LANGUAGE_DESC2="Note: you will need internet access for Joomla! to download and install the new languages. <br />Some server configurations won't allow Joomla! to install the languages. If this is your case, don't worry, you will be able to install them later using the Joomla! Administrator."
Expand Down
162 changes: 160 additions & 2 deletions installation/model/languages.php
Expand Up @@ -872,15 +872,15 @@ public function addMenuGroup($itemLanguage)
}

/**
* Add Menu Item.
* Add Featured Menu Item.
*
* @param stdClass $itemLanguage Language Object.
*
* @return JTable|boolean Menu Item Object. False otherwise.
*
* @since 3.2
*/
public function addMenuItem($itemLanguage)
public function addFeaturedMenuItem($itemLanguage)
{
// Add Menu Item.
$tableItem = JTable::getInstance('Menu', 'MenusTable');
Expand Down Expand Up @@ -943,6 +943,86 @@ public function addMenuItem($itemLanguage)
return $tableItem;
}

/**
* Add AllCategories Menu Item for new router.
*
* @param stdClass $itemLanguage Language Object.
*
* @return JTable|boolean Menu Item Object. False otherwise.
*
* @since 3.8.0
*/

public function addAllCategoriesMenuItem($itemLanguage)
{
// Add Menu Item.
$tableItem = JTable::getInstance('Menu', 'MenusTable');

$newlanguage = new JLanguage($itemLanguage->language, false);
$newlanguage->load('joomla', JPATH_ADMINISTRATOR, $itemLanguage->language, true);
$title = $newlanguage->_('JCATEGORIES');
$alias = 'allcategories_' . $itemLanguage->language;

$menuItem = array(
'title' => $title,
'alias' => $alias,
'menutype' => 'mainmenu-' . strtolower($itemLanguage->language),
'type' => 'component',
'link' => 'index.php?option=com_content&view=categories&id=0',
'component_id' => 22,
'published' => 1,
'parent_id' => 1,
'level' => 1,
'home' => 0,
'params' => '{"show_base_description":"","categories_description":"","maxLevelcat":"",'
. '"show_empty_categories_cat":"","show_subcat_desc_cat":"","show_cat_num_articles_cat":"",'
. '"show_category_title":"","show_description":"","show_description_image":"","maxLevel":"",'
. '"show_empty_categories":"","show_no_articles":"","show_subcat_desc":"","show_cat_num_articles":"",'
. '"num_leading_articles":"","num_intro_articles":"","num_columns":"","num_links":"",'
. '"multi_column_order":"","show_subcategory_content":"","orderby_pri":"","orderby_sec":"",'
. '"order_date":"","show_pagination_limit":"","filter_field":"","show_headings":"",'
. '"list_show_date":"","date_format":"","list_show_hits":"","list_show_author":"","display_num":"10",'
. '"show_pagination":"","show_pagination_results":"","show_title":"","link_titles":"",'
. '"show_intro":"","show_category":"","link_category":"","show_parent_category":"",'
. '"link_parent_category":"","show_author":"","link_author":"","show_create_date":"",'
. '"show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_vote":"",'
. '"show_readmore":"","show_readmore_title":"","show_icons":"","show_print_icon":"",'
. '"show_email_icon":"","show_hits":"","show_noauth":"","show_feed_link":"","feed_summary":"",'
. '"menu-anchor_title":"","menu-anchor_css":"","menu_image":"","menu_image_css":"","menu_text":1,'
. '"menu_show":0,"page_title":"","show_page_heading":"","page_heading":"","pageclass_sfx":"",'
. '"menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}',
'language' => $itemLanguage->language,
);

// Bind the data.
if (!$tableItem->bind($menuItem))
{
return false;
}

$tableItem->setLocation($menuItem['parent_id'], 'last-child');

// Check the data.
if (!$tableItem->check())
{
return false;
}

// Store the data.
if (!$tableItem->store())
{
return false;
}

// Rebuild the tree path.
if (!$tableItem->rebuildPath($tableItem->id))
{
return false;
}

return $tableItem;
}

/**
* Add Module Menu.
*
Expand Down Expand Up @@ -1218,6 +1298,84 @@ public function addArticle($itemLanguage, $categoryId)
return $article;
}

/**
* Add Blog Menu Item.
*
* @param stdClass $itemLanguage Language Object.
* @param int $categoryId The id of the category displayed by the blog.
*
* @return JTable|boolean Menu Item Object. False otherwise.
*
* @since 3.8.0
*/
public function addBlogMenuItem($itemLanguage, $categoryId)
{
// Add Menu Item.
$tableItem = JTable::getInstance('Menu', 'MenusTable');

$newlanguage = new JLanguage($itemLanguage->language, false);
$newlanguage->load('com_languages', JPATH_ADMINISTRATOR, $itemLanguage->language, true);
$title = $newlanguage->_('COM_LANGUAGES_HOMEPAGE');
$alias = 'home_' . $itemLanguage->language;

$menuItem = array(
'title' => $title,
'alias' => $alias,
'menutype' => 'mainmenu-' . strtolower($itemLanguage->language),
'type' => 'component',
'link' => 'index.php?option=com_content&view=category&layout=blog&id=' . $categoryId,
'component_id' => 22,
'published' => 1,
'parent_id' => 1,
'level' => 1,
'home' => 1,
'params' => '{"layout_type":"blog","show_category_heading_title_text":"","show_category_title":"",'
. '"show_description":"","show_description_image":"","maxLevel":"","show_empty_categories":"",'
. '"show_no_articles":"","show_subcat_desc":"","show_cat_num_articles":"","show_cat_tags":"",'
. '"page_subheading":"","num_leading_articles":"1","num_intro_articles":"3","num_columns":"3",'
. '"num_links":"0","multi_column_order":"1","show_subcategory_content":"","orderby_pri":"",'
. '"orderby_sec":"front","order_date":"","show_pagination":"2","show_pagination_results":"1",'
. '"show_featured":"","show_title":"","link_titles":"","show_intro":"","info_block_position":"",'
. '"info_block_show_title":"","show_category":"","link_category":"","show_parent_category":"",'
. '"link_parent_category":"","show_associations":"","show_author":"","link_author":"",'
. '"show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"",'
. '"show_vote":"","show_readmore":"","show_readmore_title":"","show_icons":"","show_print_icon":"",'
. '"show_email_icon":"","show_hits":"","show_tags":"","show_noauth":"","show_feed_link":"1",'
. '"feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"",'
. '"menu_image_css":"","menu_text":1,"menu_show":1,"page_title":"","show_page_heading":"1",'
. '"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":""}',
'language' => $itemLanguage->language,
);

// Bind the data.
if (!$tableItem->bind($menuItem))
{
return false;
}

$tableItem->setLocation($menuItem['parent_id'], 'last-child');

// Check the data.
if (!$tableItem->check())
{
return false;
}

// Store the data.
if (!$tableItem->store())
{
return false;
}

// Rebuild the tree path.
if (!$tableItem->rebuildPath($tableItem->id))
{
return false;
}

return $tableItem;
}

/**
* Create the language associations.
*
Expand Down
2 changes: 2 additions & 0 deletions libraries/classmap.php
Expand Up @@ -419,3 +419,5 @@
JLoader::registerAlias('JObject', '\\Joomla\\CMS\\Object\\CMSObject', '5.0');

JLoader::registerAlias('JExtensionHelper', '\\Joomla\\CMS\\Extension\\ExtensionHelper', '5.0');

JLoader::registerAlias('JHtml', '\\Joomla\\CMS\\HTML\\HTMLHelper', '5.0');

0 comments on commit 0066026

Please sign in to comment.