Skip to content

Commit

Permalink
Merge branch 'release/5.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
w00fz committed Jul 17, 2015
2 parents 4966908 + cb8ca99 commit d9aff6f
Show file tree
Hide file tree
Showing 56 changed files with 1,319 additions and 242 deletions.
89 changes: 89 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 5.0.1
## 07/16/2015

1. [](#new)
* Custom CSS / JS Atom now supports JavaScript to be dropped before `</body>` as well as inline scripting (thanks @adi8i)
* Menu Items can now be set to only display the Icon or Image from the Menu Editor (#574)
2. [](#improved)
* Added version number to Theme selector and Theme Configuration header (#560)
* Custom CSS / JS Atom now allows to pick a CSS or JS file via filepicker as well as upload them directly from the picker
* Minor CSS fixes for Joomla admin when in tablet and smaller viewport (#585)
3. [](#bugfix)
* Fixed regression with the style of Collections in admin and supporting long strings (#569)
* Fixed Assignments filtering failing with empty Menus (#578)
* Fixed UTF8 special characters being stripped out of Module Gantry 5 Particle causing the value to be lost (#570)
* Fixed initial load of Module Particle not updating the link to the Joomla Module Manager instance (#582)
* Fixed Menu Item subtitles in Menu Editor, causing any subtitle to get lost (#579)
* Fixed Menu Item target not getting synched up between Joomla and Gantry (#584)
* Fixed dropdowns on frontend not working when Offcanvas was disabled (#583)
* Fixed edge case where resizing the browser wouldn't properly recalculate the Particles Picker size (#585)
* Fixed issue in Menu Editor where it was possible to create more than one empty Columns (#585)

# 5.0.0
## 07/13/2015

1. [](#new)
* Menu:
- Particles and Modules can be now dropped in non-parent Menu Items (click on a Menu Item in the Menu Editor to get the virtual sublevel)
- Implemented the option for menu items to append an Hash value (ie, http://yourcustomlink.com/page#hash)
* Layout Manager:
- UI/UX enhancements in the Particles Picker. It is now fixed and follows the scrolling of the page, making dragging and dropping particles to the bottom of a Layout much easier
- When loading a new Layout while keeping the Particles, a warning will pop up in case some of the particles could get lost
* Particles:
- You can now load Particles via Joomla `{loadposition}`
- Social Particle: now includes a Title parameter
- Menu Particle:
- It is now possible to choose the - Active - menu from the dropdown
- Prevent from rendering empty Menu on frontend
- Fixed Menu Start Level
- To Top: Scrolling to the top is now smooth
* Global and generic changes:
- Added a new Development / Production toggle under the Extras tab which allows to toggle between the two states from within Gantry 5 admin
- Production / Development now compile different CSS output. In Production mode, everything is compressed, in Development mode CSS is expanded and Line Numbers are added to easily reference the files (This only applies for the Styles Panel and custom.scss)
- Enhanched Filepicker, it now uses streams, supports drag&drop from desktop for upload and allows to delete files (if they are overridden files)
- Initial work on the multi language support
- More body classes added:
- Menu Item page suffix
- Print-mode if previewing a print page
2. [](#improved)
* Menu:
- Subtitles are now displaying in the interface
* Assignments:
- Introduced a new filter to display only the active assignments
- You can now assign to a different Language
* Styles:
- Less aggressive box-sizing to automatically support, out of the box, Joomla and 3rd parties implementations.
* Particles:
- Menu Particle:
- Accessibility improvements
* Global and generic changes:
- Updated Google Fonts library (+15 fonts)
- Use Protocol less urls for loading Google Fonts (so it is http and https compatible)
- In Joomla Module Manager, Gantry 5 Particle Modules will now display a badge with their type
- Improved RTL support and automatic detection
3. [](#bugfix)
* Menu:
- Many bug fixes to synchronize Joomla with Gantry 5
- Fixed cases where Particles / Modules wouldn't be deletable
- Preventing disabled Particles from showing up on frontend when they are disabled
* Outlines:
- Preventing Default and non-deletable outlines from being deleted (UI adjusted accordingly)
- Fixed case where an outline wouldn't be deletable due to a wrong flag set
* Gantry 5 Particle Module:
- Prevent Joomla from stripping out HTML content
- You can now reset the value and change the Particle type
* Layout Manager:
- Fixed the preset informations when using history and jumping between different presets
- History session fixes
* Layout (frontend):
- Fixed cases where the cumulative sum of side by side sections wouldn't be 100% as expected
- Fixed issue where side by side sections (sidebars/main) would have the main overflowing in one of the sidebars
* Particles:
- Menu Particle:
- Fixed Menu Start Level
- Fixed Offcanvas menu height calculations
* Global and generic changes:
- System Plugin and Particle Module are now PHP 5.3 compatible and won't fail with the error "Parse error: syntax error, unexpected '[' in ..."
- Fixed "Cache path not defined for compiled files"
- Fixed untranslated positions string in the Joomla Module Editor on frontend
- Fixed Page Heading not displaying in the Gantry 5 Custom View page
4 changes: 2 additions & 2 deletions assets/common/application/offcanvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ var Offcanvas = new prime({
this.panel = $('#g-page-surround');
this.offcanvas = $('#g-offcanvas');

if (!this.panel || !this.offcanvas) { return false; }

var swipe = this.offcanvas.data('g-offcanvas-swipe');
this.setOptions({ touch: !!(swipe !== null ? parseInt(swipe) : 1) });

if (!this.panel || !this.offcanvas) { return false; }

if (!this.options.padding) {
this.offcanvas[0].style.display = 'block';
var width = this.offcanvas[0].getBoundingClientRect().width;
Expand Down
4 changes: 2 additions & 2 deletions assets/common/js/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

269 changes: 269 additions & 0 deletions bin/language_convert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
#!/usr/bin/env php
<?php
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2015 RocketTheme, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
* http://opensource.org/licenses/MIT
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Gantry Framework code that extends GPL code is considered GNU/GPLv2 and later
*/

/**
* The main .po to .mo function
*/
function phpmo_convert($input, $output = false)
{
if (!$output) {
$output = str_replace('.po', '.mo', $input);
}

$hash = phpmo_parse_po_file($input);
if ($hash === false) {
return false;
}

phpmo_write_mo_file($hash, $output);
return true;
}

function phpmo_clean_helper($x)
{
if (is_array($x)) {
foreach ($x as $k => $v) {
$x[$k] = phpmo_clean_helper($v);
}
} else {
if ($x[0] == '"') {
$x = substr($x, 1, -1);
}
$x = str_replace("\"\n\"", '', $x);
$x = str_replace('$', '\\$', $x);
}
return $x;
}

/* Parse gettext .po files. */
/* @link http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files */
function phpmo_parse_po_file($in)
{
// read .po file
$fh = fopen($in, 'r');
if ($fh === false) {
// Could not open file resource
return false;
}

// results array
$hash = [];
// temporary array
$temp = [];
// state
$state = null;
$fuzzy = false;

// iterate over lines
while(($line = fgets($fh, 65536)) !== false) {
$line = trim($line);
if ($line === '') {
continue;
}

list ($key, $data) = preg_split('/\s/', $line, 2);

switch ($key) {
case '#,': // flag...
$fuzzy = in_array('fuzzy', preg_split('/,\s*/', $data));
case '#': // translator-comments
case '#.': // extracted-comments
case '#:': // reference...
case '#|': // msgid previous-untranslated-string
// start a new entry
if (sizeof($temp) && array_key_exists('msgid', $temp) && array_key_exists('msgstr', $temp)) {
if (!$fuzzy) {
$hash[] = $temp;
}
$temp = [];
$state = null;
$fuzzy = false;
}
break;
case 'msgctxt' :
// context
case 'msgid' :
// untranslated-string
case 'msgid_plural' :
// untranslated-string-plural
$state = $key;
$temp[$state] = $data;
break;
case 'msgstr' :
// translated-string
$state = 'msgstr';
$temp[$state][] = $data;
break;
default :
if (strpos($key, 'msgstr[') !== false) {
// translated-string-case-n
$state = 'msgstr';
$temp[$state][] = $data;
} else {
// continued lines
switch ($state) {
case 'msgctxt' :
case 'msgid' :
case 'msgid_plural' :
$temp[$state] .= "\n" . $line;
break;
case 'msgstr' :
$temp[$state][sizeof($temp[$state]) - 1] .= "\n" . $line;
break;
default :
// parse error
fclose($fh);
return false;
}
}
break;
}
}
fclose($fh);

// add final entry
if ($state == 'msgstr') {
$hash[] = $temp;
}

// Cleanup data, merge multiline entries, reindex hash for ksort
$temp = $hash;
$hash = [];
foreach ($temp as $entry) {
foreach ($entry as & $v) {
$v = phpmo_clean_helper($v);
if ($v === false) {
// parse error
return false;
}
}
$hash[$entry['msgid']] = $entry;
}

return $hash;
}

/* Write a GNU gettext style machine object. */
/* @link http://www.gnu.org/software/gettext/manual/gettext.html#MO-Files */
function phpmo_write_mo_file($hash, $out)
{
// sort by msgid
ksort($hash, SORT_STRING);
// our mo file data
$mo = '';
// header data
$offsets = [];
$ids = '';
$strings = '';

foreach ($hash as $entry) {
$id = $entry['msgid'];
if (isset($entry['msgid_plural']))
$id .= "\x00" . $entry['msgid_plural'];
// context is merged into id, separated by EOT (\x04)
if (array_key_exists('msgctxt', $entry))
$id = $entry['msgctxt'] . "\x04" . $id;
// plural msgstrs are NUL-separated
$str = implode("\x00", $entry['msgstr']);
// keep track of offsets
$offsets[] = [strlen($ids), strlen($id), strlen($strings), strlen($str)];
// plural msgids are not stored (?)
$ids .= $id . "\x00";
$strings .= $str . "\x00";
}

// keys start after the header (7 words) + index tables ($#hash * 4 words)
$key_start = 7 * 4 + sizeof($hash) * 4 * 4;
// values start right after the keys
$value_start = $key_start + strlen($ids);
// first all key offsets, then all value offsets
$key_offsets = [];
$value_offsets = [];
// calculate
foreach ($offsets as $v) {
list ($o1, $l1, $o2, $l2) = $v;
$key_offsets[] = $l1;
$key_offsets[] = $o1 + $key_start;
$value_offsets[] = $l2;
$value_offsets[] = $o2 + $value_start;
}
$offsets = array_merge($key_offsets, $value_offsets);

// write header
$mo .= pack('Iiiiiii', 0x950412de, // magic number
0, // version
sizeof($hash), // number of entries in the catalog
7 * 4, // key index offset
7 * 4 + sizeof($hash) * 8, // value index offset,
0, // hashtable size (unused, thus 0)
$key_start // hashtable offset
);
// offsets
foreach ($offsets as $offset) {
$mo .= pack('i', $offset);
}

// ids
$mo .= $ids;
// strings
$mo .= $strings;

file_put_contents($out, $mo);
}

$parameters = array(
'i:' => 'input:',
'o:' => 'output:',
'c' => 'compile',
);
$options = getopt(implode('', array_keys($parameters)), $parameters);

$input_file = $options['input'];
$output_file = $options['output'];
$compile = isset($options['compile']);

if (!file_exists($input_file) || !is_file($input_file)) {
echo sprintf("No file %s exists\n", $input_file);
die;
}
if (file_exists($output_file) && !is_writable($output_file)) {
echo sprintf("Unable to write to file %s\n", $output_file);
die;
}

$ini_values = parse_ini_file($input_file);
$pot_output = ['msgid ""
msgstr ""
"Project-Id-Version: Gantry 5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: ' . date('Y-m-d H:i:sO') . '\n"
"PO-Revision-Date: ' . date('Y-m-d H:i:sO') . '\n"
"Last-Translator: Gantry 5 Team\n"
"Language-Team: Gantry 5 Team\n"
"Language: English\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"'];
foreach($ini_values as $msgid => $msgstr) {
$pot_output[] = sprintf('msgid "%s"', $msgid) . "\n" . sprintf('msgstr "%s"', $msgstr);
}

file_put_contents($output_file, implode("\n\n", $pot_output));
if ($compile) {
phpmo_convert($output_file, false);
}

0 comments on commit d9aff6f

Please sign in to comment.