Skip to content

Commit

Permalink
Fix object error in ied_plugin_textpacks tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloke committed Aug 18, 2017
1 parent 623213f commit 209159d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 54 deletions.
67 changes: 38 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# Changelog

## 1.2.1 - 2017-08-18

* Fixed illegal use of object context in ied_plugin_textpacks tag.

## 1.2.0 - 2017-06-29

* Added ability to install the plugin composer via Composer :-\ (thanks, philwareham).
* Adopted semver versioning model.

## 1.1.1 - 2016-11-14

* Fixed multi-edit widget functionality.
* Fixed multiple constants in plugin templates (thanks, testdeputy)
* Fixed saving of checkbox values during meta_save
* Fixed multiple constants in plugin templates (thanks, testdeputy).
* Fixed saving of checkbox values during meta_save.
* Added owner for Textpack strings, taken from the designated plugin prefix.

## 1.1.0 - 2016-09-10
Expand All @@ -18,31 +27,31 @@
* Restructured internals for performance.
* Layout and workflow improvements.

## 1.06 - 2014-07-25
## 1.0.6 - 2014-07-25

* Added @escape@ attribute to ied_plugin_download_link tag.

## 1.05 - 2013-10-21
## 1.0.5 - 2013-10-21

* More sensible default for lang export from ied_plugin_download_link tag.

## 1.04 - 2013-10-15
## 1.0.4 - 2013-10-15

* Fixed bug preventing help being packaged in downloaded plugin from public side.

## 1.03 - 2013-09-28
## 1.0.3 - 2013-09-28

* Added public tags ied_plugin_download, ied_plugin_download_link.

## 1.02 - 2013-09-27
## 1.0.2 - 2013-09-27

* Added public tags ied_plugin_list (from DB only for now), ied_plugin_info, ied_plugin_download, ied_plugin_download_link, ied_plugin_textpacks.

## 1.01 - 2013-09-25
## 1.0.1 - 2013-09-25

* Fixed textpack display string bug on admin side.

## 1.00 - 2013-05-09
## 1.0.0 - 2013-05-09

* Added Textpack support and management.
* Permitted more installation / creation options.
Expand All @@ -53,46 +62,46 @@
* Supports the two new AJAX plugin types introduced in Txp 4.5.0.
* More options for multi edit changestatus.

## 0.93 - 2010-11-23
## 0.9.3 - 2010-11-23

* Fixed setup screen 'undefined' bug (thanks MarcoK).

## 0.92 - 2010-11-03
## 0.9.2 - 2010-11-03

* Fixed Options link for plugins from cache dir and fixed escaping of exported php files (both thanks maniqui).
* Fixed escaping when importing from PHP file.
* Cosmetic tweaks (plugin_cache_dir section only displayed if there are valid PHP files, and View Help link adjusted).
* Fixed jQuery on setup panel. Extended resizer cookie to one year expiry.

## 0.91 - 2010-02-11
## 0.9.1 - 2010-02-11

* Added Jump To Line capability, in most browsers (thanks thebombsite).

## 0.90 - 2009-08-29
## 0.9.0 - 2009-08-29

* Requires Txp 4.2.0+.
* Added support for plugin prefs/lifecycle and larger plugin code.
* Fixed CSS delimiter for backwards compatibility.
* New plugin template details used.

## 0.83 - 2009-04-11
## 0.8.3 - 2009-04-11

* Fixed help file CSS output so it validates.
* Uses @$prefs@ instead of @$GLOBALS@ internally.
* Checks if plugin_cache_dir exists before trying to use it on the list panel.

## 0.82 - 2009-02-23
## 0.8.2 - 2009-02-23

* Can now create new template files on the fly (thanks azw).
* Fixed Textile limit on large help files.
* Fixed database calls for MySQL strict mode (thanks Gocom / azw).

## 0.81 - 2009-01-03
## 0.8.1 - 2009-01-03

* Added textile cacheing to improve performance with large help files.
* Profiled code and improved speed in various functions.

## 0.80 - 2008-11-03
## 0.8.0 - 2008-11-03

* Added support for recommended plugin load order.
* Added Admin-only plugin type.
Expand All @@ -103,35 +112,35 @@
* Sped up export/save routines.
* Fixed a few corner case bugs (e.g. empty plugin name, missing quotes in template options).

## 0.75 - 2008-05-28
## 0.7.5 - 2008-05-28

* Added 'modified' to the Version column (thanks uli).
* Added ability to rename files in the plugin cache dir when the version changes.

## 0.74 - 2008-03-28
## 0.7.4 - 2008-03-28

* Fixed empty plugin code if Style block left blank.
* Fixed strip/slash/encoding errors (thanks the_ghost/ruud).
* Fixed crlf newlines in code block (thanks hakjoon/ruud).

## 0.73 - 2008-01-11
## 0.7.3 - 2008-01-11

* Added support for _reading_ an optional revision from the template parser and appending it to the version (thanks net-carver).
* More gTxt() strings converted.

## 0.72 - 2008-01-10
## 0.7.2 - 2008-01-10

* Fixed bug if plugin has no help.
* Style section no longer stored/exported if it's not in use (thanks the_ghost / iblastoff).

## 0.71 - 2008-01-09
## 0.7.1 - 2008-01-09

* Textarea width can now be controlled from prefs, and height from a drag bar.
* Default width increased to 110 chars.
* Publish plugins from the list panel.
* Install button removed when prefs all correctly installed (all thanks variaas / iblastoff).

## 0.70 - 2008-01-08
## 0.7.0 - 2008-01-08

* Re-importing plugins now retains style block.
* Added 'admin side plugin with public-side type' warning.
Expand All @@ -141,30 +150,30 @@
* 'don't textile HTML' check.
* Minor bugfixes.

## 0.60 - 2008-01-07
## 0.6.0 - 2008-01-07

Built-in help viewer (thanks net-carver). Support for Edit Area & CodePress(ish) (thanks variaas). Help block/Code block position switchable on export. Added Setup prefs page. Line break/style bugfixes.

## 0.50 - 2008-01-04
## 0.5.0 - 2008-01-04

* Full support for standard template.
* Compressed plugins.
* Library plugins.
* Textile help and styling.
* Integration with net-carver's Plugin Help Viewer.

## 0.40 - 2006-04-10
## 0.4.0 - 2006-04-10

* Added support for plugin_cache_dir.

## 0.30 - 2006-03-17
## 0.3.0 - 2006-03-17

* Added 'save as php'.

## 0.20 - 2006-02-25
## 0.2.0 - 2006-02-25

* Added 'save as' option.

## 0.10 - 2006-02-25
## 0.1.0 - 2006-02-25

* Initial release
49 changes: 25 additions & 24 deletions ied_plugin_composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// 1 = Plugin help is in raw HTML. Not recommended.
# $plugin['allow_html_help'] = 1;

$plugin['version'] = '1.2.0';
$plugin['version'] = '1.2.1';
$plugin['author'] = 'Yura Linnyk, Stef Dawson, Steve Dickinson';
$plugin['author_uri'] = 'http://stefdawson.com/';
$plugin['description'] = 'Create, publish and edit plugins from within Textpattern CMS';
Expand Down Expand Up @@ -459,7 +459,7 @@ function ied_plugin_textpacks($atts, $thing = null)
$tp_prefixes = unserialize(get_pref('ied_plugin_tp_prefix', ''));

if (isset($tp_prefixes[$theName])) {
$strings = $this->textpack_grab($lang, $tp_prefixes[$theName]);
$strings = ied_plugin_textpack_grab($lang, $tp_prefixes[$theName]);
foreach ($strings as $row) {
if (array_search($row['lang'], $langs) === false) {
$langs[] = $row['lang'];
Expand Down Expand Up @@ -1432,7 +1432,7 @@ public function edit($message = '', $newfile = '')
$op_langs[] = '</select>';

$tp_strings = array();
$tp_rows = $this->textpack_grab($dflt_lang, $tp_pfx);
$tp_rows = ied_plugin_textpack_grab($dflt_lang, $tp_pfx);
foreach ($tp_rows as $tp_string) {
$apsel = selectInput('ied_plugin_tp_event', array('admin' => gTxt('admin'), 'public' => gTxt('public'), 'common' => gTxt('both')), ($tp_string['event'] == 'public' ? 'public' : ($tp_string['event'] == 'common' ? 'common' : 'admin')) );
$tp_strings[] = '<li>'.fInput('text', 'textpack_'.$tp_string['name'], $tp_string['data']).' '.$apsel.' <label>'.$tp_string['name'].'</label>'.'</li>';
Expand Down Expand Up @@ -3502,7 +3502,7 @@ public function textpack_build($name, $force_all = 0)

$tp_pfx = unserialize(get_pref('ied_plugin_tp_prefix', '', 1));
$tp_pfx = isset($tp_pfx[$name]) ? $tp_pfx[$name] : '';
$tp_rows = $this->textpack_grab($fetch_lang, $tp_pfx);
$tp_rows = ied_plugin_textpack_grab($fetch_lang, $tp_pfx);

if ($tp_rows) {
$ctr = 0;
Expand Down Expand Up @@ -3566,26 +3566,6 @@ public function textpack_build($name, $force_all = 0)
return implode(n, $tpout);
}

/**
* Read textpack strings with the given prefix from the database.
*
* @param string $lang Language of strings to fetch
* @param string $prefix Prefix to find
* @return array Record set of matching strings
*/
public function textpack_grab($lang, $prefix)
{
if ($lang === 'IED_ALL') {
$lang_query = '';
} else {
$lang = (empty($lang)) ? get_pref('language', 'en-gb') : $lang;
$langs = quote_list(do_list($lang));
$lang_query = "lang IN (".implode(', ', $langs).") AND ";
}

return ($prefix) ? safe_rows('name, data, lang, event', 'txp_lang', $lang_query."name LIKE '".doSlash($prefix)."%' ORDER BY event,lang,name") : array();
}

/**
* Set the current Textpack language from which to display strings in the interface.
*
Expand Down Expand Up @@ -4377,6 +4357,27 @@ function ied_plugin_lang_default($name, $val = '')
return selectInput($name, $langs, $val, false);
}
}

/**
* Read textpack strings with the given prefix from the database.
*
* @param string $lang Language of strings to fetch
* @param string $prefix Prefix to find
* @return array Record set of matching strings
*/
function ied_plugin_textpack_grab($lang, $prefix)
{
if ($lang === 'IED_ALL') {
$lang_query = '';
} else {
$lang = (empty($lang)) ? get_pref('language', 'en-gb') : $lang;
$langs = quote_list(do_list($lang));
$lang_query = "lang IN (".implode(', ', $langs).") AND ";
}

return ($prefix) ? safe_rows('name, data, lang, event', 'txp_lang', $lang_query."name LIKE '".doSlash($prefix)."%' ORDER BY event,lang,name") : array();
}

# --- END PLUGIN CODE ---
if (0) {
?>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ied_plugin_composer",
"description": "Create, publish and edit plugins from within Textpattern CMS",
"version": "1.2.0",
"version": "1.2.1",
"type": 5,
"author": "Yura Linnyk, Stef Dawson, Steve Dickinson",
"author_uri": "http://stefdawson.com/",
Expand Down

0 comments on commit 209159d

Please sign in to comment.