1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 10:04:35 +02:00

Modification to plugin.xml and theme.xml spec. 'lan=' instead of 'lang='.

Added <summary> and <keywords>
Plugin builder enhanced to match these changes
This commit is contained in:
Cameron
2012-12-05 16:43:53 -08:00
parent 4a5d8a4a90
commit 04ea1f46d0
5 changed files with 191 additions and 124 deletions

View File

@@ -1305,6 +1305,7 @@ class pluginBuilder
var $table = ''; var $table = '';
var $pluginName = ''; var $pluginName = '';
var $special = array(); var $special = array();
var $tableCount = 0;
function __construct() function __construct()
{ {
@@ -1449,14 +1450,16 @@ class pluginBuilder
$text = $frm->open('newplugin-step3','post', e_SELF.'?mode=create&newplugin='.$newplug.'&step=3'); $text = $frm->open('newplugin-step3','post', e_SELF.'?mode=create&newplugin='.$newplug.'&step=3');
$text .= "<div class='admintabs' id='tab-container'>\n"; $text .= "<div class='admintabs' id='tab-container'>\n";
$text .= "<ul class='e-tabs' id='core-emote-tabs'>\n"; $text .= "<ul class='e-tabs' id='core-emote-tabs'>\n";
$text .= "<li id='tab-xml'><a href='#xml'>Basic Info.</a></li>";
$this->tableCount = count($ret['tables']);
foreach($ret['tables'] as $key=>$table) foreach($ret['tables'] as $key=>$table)
{ {
$text .= "<li id='tab-".$table."'><a href='#".$table."'>Table: ".$table."</a></li>"; $text .= "<li id='tab-".$table."'><a href='#".$table."'>Table: ".$table."</a></li>";
} }
$text .= "<li id='tab-preferences'><a href='#preferences'>Preferences</a></li>"; $text .= "<li id='tab-preferences'><a href='#preferences'>Preferences</a></li>";
$text .= "<li id='tab-xml'><a href='#xml'>Meta Info.</a></li>";
$text .= "</ul>"; $text .= "</ul>";
foreach($ret['tables'] as $key=>$table) foreach($ret['tables'] as $key=>$table)
@@ -1490,10 +1493,8 @@ class pluginBuilder
$mes->addInfo("Review all fields and modify if necessary."); $mes->addInfo("Review all fields and modify if necessary.");
if(count($ret['tables']) > 1) $mes->addInfo("Review ALL tabs before clicking 'Generate'.");
{
$mes->addInfo("Review ALL tables before clicking 'Generate'.");
}
$ns->tablerender("Plugin Builder", $mes->render() . $text); $ns->tablerender("Plugin Builder", $mes->render() . $text);
} }
@@ -1513,9 +1514,11 @@ class pluginBuilder
//TODO Plugin.xml Form Fields. . //TODO Plugin.xml Form Fields. .
$data = array( $data = array(
'main' => array('name','lang','version','date', 'compatibility','installRequired'), 'main' => array('name','lang','version','date', 'compatibility'),
'author' => array('name','url'), 'author' => array('name','url'),
'summary' => array('summary'),
'description' => array('description'), 'description' => array('description'),
'keywords' => array('one','two'),
'category' => array('category'), 'category' => array('category'),
'copyright' => array('copyright'), 'copyright' => array('copyright'),
// 'languageFile' => array('type','path'), // 'languageFile' => array('type','path'),
@@ -1602,10 +1605,26 @@ class pluginBuilder
return "Installation required: ".$frm->radio_switch($name,'',LAN_YES, LAN_NO); return "Installation required: ".$frm->radio_switch($name,'',LAN_YES, LAN_NO);
break; break;
case 'description-description': case 'summary-summary':
$help = "A short description of the plugin<br />(Must be written in English)"; $help = "A short one-line description of the plugin<br />(Must be written in English)";
$required = true; $required = true;
$size = 100; $size = 100;
$placeholder= " ";
break;
case 'keywords-one':
case 'keywords-two':
$help = "Keyword/Tag for this plugin<br />(Must be written in English)";
$required = true;
$size = 20;
$placeholder= " ";
break;
case 'description-description':
$help = "A full description of the plugin<br />(Must be written in English)";
$required = true;
$size = 100;
$placeholder = " ";
break; break;
@@ -1621,13 +1640,19 @@ class pluginBuilder
} }
$req = ($required == true) ? "&required=1" : ""; $req = ($required == true) ? "&required=1" : "";
$placeholder = (varset($placeholder)) ? $placeholder : $type;
if($type == 'date') switch ($type)
{ {
case 'date':
$text = $frm->datepicker($name,time(),'dateformat=yy-mm-dd'.$req); $text = $frm->datepicker($name,time(),'dateformat=yy-mm-dd'.$req);
} break;
elseif($type == 'category')
{ case 'description':
$text = $frm->textarea($name,$default, 3, 80, $req);
break;
case 'category':
$options = array( $options = array(
'settings' => 'settings', 'settings' => 'settings',
'users' => 'users', 'users' => 'users',
@@ -1640,20 +1665,23 @@ class pluginBuilder
); );
$text = $frm->selectbox($name, $options,'','required=1', true); $text = $frm->selectbox($name, $options,'','required=1', true);
break;
default:
$text = $frm->text($name, $default, $size, 'placeholder='.$placeholder . $req);
break;
} }
else
{
$text = $frm->text($name, $default, $size, 'placeholder='.$type.$req);
}
$text .= ($help) ? "<span class='field-help'>".$help."</span>" : ""; $text .= ($help) ? "<span class='field-help'>".$help."</span>" : "";
return $text; return $text;
} }
function processXml($data) function createXml($data)
{ {
//print_a($_POST);
$ns = e107::getRender(); $ns = e107::getRender();
$mes = e107::getMessage(); $mes = e107::getMessage();
@@ -1669,9 +1697,14 @@ class pluginBuilder
$template = <<<TEMPLATE $template = <<<TEMPLATE
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<e107Plugin name="{MAIN_NAME}" version="{MAIN_VERSION}" date="{MAIN_DATE}" compatibility="{MAIN_COMPATIBILITY}" installRequired="{MAIN_INSTALLREQUIRED}" > <e107Plugin name="{MAIN_NAME}" lan="" version="{MAIN_VERSION}" date="{MAIN_DATE}" compatibility="{MAIN_COMPATIBILITY}" installRequired="true" >
<author name="{AUTHOR_NAME}" url="{AUTHOR_URL}" /> <author name="{AUTHOR_NAME}" url="{AUTHOR_URL}" />
<description lang="">{DESCRIPTION_DESCRIPTION}</description> <summary lan="">{SUMMARY_SUMMARY}</summary>
<description lan="">{DESCRIPTION_DESCRIPTION}</description>
<keywords>
<word>{KEYWORDS_ONE}</word>
<word>{KEYWORDS_TWO}</word>
</keywords>
<category>{CATEGORY_CATEGORY}</category> <category>{CATEGORY_CATEGORY}</category>
<copyright>{COPYRIGHT_COPYRIGHT}</copyright> <copyright>{COPYRIGHT_COPYRIGHT}</copyright>
<adminLinks> <adminLinks>
@@ -1724,26 +1757,31 @@ TEMPLATE;
$modes = array("main"=>"Main Area","cat"=>"Categories"); $modes = array("main"=>"Main Area","cat"=>"Categories");
// echo "TABLE COUNT= ".$this->tableCount ;
$this->table = $table."_ui"; $this->table = $table."_ui";
$text .= $frm->hidden($this->table.'[pluginName]', $this->pluginName, 15).
$frm->hidden($this->table.'[table]', $table, 15);
if($this->tableCount > 1)
{
$text .= "<table class='table adminform'>\n"; $text .= "<table class='table adminform'>\n";
$text .= " $text .= "
<tr>
<td>Plugin Title</td>
<td>".$frm->text($this->table.'[pluginTitle]', $newplug, '', 'required=1').
$frm->hidden($this->table.'[pluginName]', $this->pluginName, 15).
$frm->hidden($this->table.'[table]', $table, 15).
"</td>
</tr>
<tr> <tr>
<td>Mode</td> <td>Mode</td>
<td>".$frm->selectbox($this->table."[mode]",$modes, '', 'required=1', true)."</td> <td>".$frm->selectbox($this->table."[mode]",$modes, '', 'required=1', true)."</td>
</tr> </tr>
"; ";
}
else
{
$text .= $frm->hidden($this->table.'[mode]','main');
}
$text .= "</table>".$this->special('checkboxes'); $text .= "</table>".$this->special('checkboxes');
@@ -1901,9 +1939,10 @@ TEMPLATE;
case 'id': case 'id':
$ret['title'] = 'LAN_ID'; $ret['title'] = 'LAN_ID';
// $ret['type'] = 'datestamp'; $ret['type'] = 'boolean';
$ret['batch'] = false; $ret['batch'] = false;
$ret['filter'] = false; $ret['filter'] = false;
$ret['width'] = '5%';
break; break;
case 'start': case 'start':
@@ -2005,7 +2044,7 @@ TEMPLATE;
$ret['batch'] = false; $ret['batch'] = false;
$ret['filter'] = false; $ret['filter'] = false;
$ret['thclass'] = 'center'; $ret['thclass'] = 'center';
$ret['width'] = '5%'; $ret['width'] = 'auto';
break; break;
} }
@@ -2045,9 +2084,11 @@ TEMPLATE;
function step3() function step3()
{ {
$pluginTitle = $_POST['xml']['main-name'] ;
if($_POST['xml']) if($_POST['xml'])
{ {
$xmlText = $this->processXml($_POST['xml']); $xmlText = $this->createXml($_POST['xml']);
} }
@@ -2179,7 +2220,7 @@ $text .=
class ".$table." extends e_admin_ui class ".$table." extends e_admin_ui
{ {
protected \$pluginTitle = '".$vars['pluginTitle']."'; protected \$pluginTitle = '".$pluginTitle."';
protected \$pluginName = '".$vars['pluginName']."'; protected \$pluginName = '".$vars['pluginName']."';
protected \$table = '".$vars['table']."'; protected \$table = '".$vars['table']."';
protected \$pid = '".$vars['pid']."'; protected \$pid = '".$vars['pid']."';

View File

@@ -67,7 +67,7 @@ class convert
break; break;
case 'forum': // DEPRECATED - temporary here from BC reasons only case 'forum': // DEPRECATED - temporary here from BC reasons only
default: // default:
//BC - old 'forum' call //BC - old 'forum' call
if(strpos($mask, '%') === FALSE) if(strpos($mask, '%') === FALSE)
{ {
@@ -97,6 +97,99 @@ class convert
/**
* Converts from one date function mask to the other and vice-versa.
*/
function toMask($mask)
{
$convert = array(
'%Y' => 'yy',
'%d' => 'dd',
'%m' => 'mm',
'%B' => 'MM', // Full month name, based on the locale
'%A' => 'DD', // A full textual representation of the day
'%y' => 'y',
'%a' => 'D', // An abbreviated textual representation of the day
'%b' => 'M', // Abbreviated month name, based on the locale
'%h' => 'M', // Abbreviated month name, based on the locale (an alias of %b)
'%l' => 'h', // 12 hour format - no leading zero
'%I' => 'hh', // 12 hour format - leading zero
'%H' => 'hh', // 24 hour format - leading zero
'%M' => 'mm',
'%S' => 'ss',
'%p' => 'TT', // %p UPPER-CASE 'AM' or 'PM' based on the given time
'%P' => 'tt', // %P lower-case 'am' or 'pm' based on the given time
'%T' => 'hh:mm:ss',
'%r' => "hh:mmm:ss TT" // 12 hour format
);
$s = array_keys($convert);
$r = array_values($convert);
if(strpos($mask, '%') === FALSE)
{
return str_replace($r, $s,$mask);
}
return str_replace($s,$r, $mask);
// Keep this info here:
/*
* $options allowed keys:
*
* d - day of month (no leading zero)
dd - day of month (two digit)
o - day of the year (no leading zeros)
oo - day of the year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
anything else - literal text
ATOM - 'yy-mm-dd' (Same as RFC 3339/ISO 8601)
COOKIE - 'D, dd M yy'
ISO_8601 - 'yy-mm-dd'
RFC_822 - 'D, d M y' (See RFC 822)
RFC_850 - 'DD, dd-M-y' (See RFC 850)
RFC_1036 - 'D, d M y' (See RFC 1036)
RFC_1123 - 'D, d M yy' (See RFC 1123)
RFC_2822 - 'D, d M yy' (See RFC 2822)
RSS - 'D, d M y' (Same as RFC 822)
TICKS - '!'
TIMESTAMP - '@'
W3C - 'yy-mm-dd' (Same as ISO 8601)
*
* h Hour with no leading 0
* hh Hour with leading 0
* m Minute with no leading 0
* mm Minute with leading 0
* s Second with no leading 0
* ss Second with leading 0
* l Milliseconds always with leading 0
* t a or p for AM/PM
* T A or P for AM/PM
* tt am or pm for AM/PM
* TT AM or PM for AM/PM
*/
}
/** /**
* Convert date string back to integer (unix timestamp) * Convert date string back to integer (unix timestamp)
* NOTE: after some tests, strptime (compat mode) is adding +1 sec. after parsing to time, investigate! * NOTE: after some tests, strptime (compat mode) is adding +1 sec. after parsing to time, investigate!

View File

@@ -540,6 +540,7 @@ class e_form
* @param array or str * @param array or str
* @example $frm->datepicker('my_field',time(),'type=date'); * @example $frm->datepicker('my_field',time(),'type=date');
* @example $frm->datepicker('my_field',time(),'type=datetime&inline=1'); * @example $frm->datepicker('my_field',time(),'type=datetime&inline=1');
* @example $frm->datepicker('my_field',time(),'type=date&dateformat=yy-mm-dd');
* *
* @url http://trentrichardson.com/examples/timepicker/ * @url http://trentrichardson.com/examples/timepicker/
*/ */
@@ -559,35 +560,8 @@ class e_form
$ampm = (preg_match("/%l|%I|%p|%P/",$timeFormat)) ? 'true' : 'false'; $ampm = (preg_match("/%l|%I|%p|%P/",$timeFormat)) ? 'true' : 'false';
$convert = array( $dformat = e107::getDate()->toMask($dateFormat);
'%d' => 'dd', $tformat = e107::getDate()->toMask($timeFormat);
'%m' => 'mm',
'%y' => 'y',
'%Y' => 'yy',
'%a' => 'D', // An abbreviated textual representation of the day
'%A' => 'DD', // A full textual representation of the day
'%B' => 'MM', // Full month name, based on the locale
'%b' => 'M', // Abbreviated month name, based on the locale
'%h' => 'M', // Abbreviated month name, based on the locale (an alias of %b)
'%l' => 'h', // 12 hour format - no leading zero
'%I' => 'hh', // 12 hour format - leading zero
'%H' => 'hh', // 24 hour format - leading zero
'%M' => 'mm',
'%S' => 'ss',
'%p' => 'TT', // %p UPPER-CASE 'AM' or 'PM' based on the given time
'%P' => 'tt', // %P lower-case 'am' or 'pm' based on the given time
'%T' => 'hh:mm:ss',
'%r' => "hh:mmm:ss TT" // 12 hour format
);
$s = array_keys($convert);
$r = array_values($convert);
$dformat = str_replace($s,$r,$dateFormat);
$tformat = str_replace($s,$r,$timeFormat);
$id = $this->name2id($name); $id = $this->name2id($name);
@@ -604,6 +578,7 @@ class e_form
); );
$defdisp = (isset($def[$type])) ? $def[$type] : $def['date']; $defdisp = (isset($def[$type])) ? $def[$type] : $def['date'];
$defdisp = e107::getDate()->toMask($defdisp);
if ($datestamp) if ($datestamp)
{ {
@@ -611,6 +586,7 @@ class e_form
} }
$text = ""; $text = "";
// $text .= 'dformat='.$dformat.' defdisp='.$defdisp;
$class = (isset($classes[$type])) ? $classes[$type] : "tbox e-date"; $class = (isset($classes[$type])) ? $classes[$type] : "tbox e-date";
$size = vartrue($options['size']) ? intval($options['size']) : 40; $size = vartrue($options['size']) ? intval($options['size']) : 40;
@@ -628,55 +604,7 @@ class e_form
} }
return $text; return $text;
// Keep this info here:
/*
* $options allowed keys:
*
* d - day of month (no leading zero)
dd - day of month (two digit)
o - day of the year (no leading zeros)
oo - day of the year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
anything else - literal text
ATOM - 'yy-mm-dd' (Same as RFC 3339/ISO 8601)
COOKIE - 'D, dd M yy'
ISO_8601 - 'yy-mm-dd'
RFC_822 - 'D, d M y' (See RFC 822)
RFC_850 - 'DD, dd-M-y' (See RFC 850)
RFC_1036 - 'D, d M y' (See RFC 1036)
RFC_1123 - 'D, d M yy' (See RFC 1123)
RFC_2822 - 'D, d M yy' (See RFC 2822)
RSS - 'D, d M y' (Same as RFC 822)
TICKS - '!'
TIMESTAMP - '@'
W3C - 'yy-mm-dd' (Same as ISO 8601)
*
* h Hour with no leading 0
* hh Hour with leading 0
* m Minute with no leading 0
* mm Minute with leading 0
* s Second with no leading 0
* ss Second with leading 0
* l Milliseconds always with leading 0
* t a or p for AM/PM
* T A or P for AM/PM
* tt am or pm for AM/PM
* TT AM or PM for AM/PM
*/
} }

View File

@@ -257,7 +257,7 @@ class e107plugin
{ {
if ($plug_info['@attributes']['name']) if ($plug_info['@attributes']['name'])
{ {
$pName = vartrue($plug_info['@attributes']['lang']) ? $plug_info['@attributes']['lang'] : $plug_info['@attributes']['name'] ; $pName = vartrue($plug_info['@attributes']['lan']) ? $plug_info['@attributes']['lan'] : $plug_info['@attributes']['name'] ;
$_installed = ($plug_info['@attributes']['installRequired'] == 'true' || $plug_info['@attributes']['installRequired'] == 1 ? 0 : 1); $_installed = ($plug_info['@attributes']['installRequired'] == 'true' || $plug_info['@attributes']['installRequired'] == 1 ? 0 : 1);

View File

@@ -2,7 +2,12 @@
<!-- $Id: plugin.xml,v 1.5 2009-12-08 17:21:34 secretr Exp $ --> <!-- $Id: plugin.xml,v 1.5 2009-12-08 17:21:34 secretr Exp $ -->
<e107Plugin name="Banners" version="1.0" date="2012-08-01" compatibility="0.8" installRequired="true"> <e107Plugin name="Banners" version="1.0" date="2012-08-01" compatibility="0.8" installRequired="true">
<author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" /> <author name="e107 Inc." url="http://e107.org" email="jalist@e107.org" />
<summary>Add advertising banners to your e107 website</summary>
<description lang="BNRLAN_100">Add advertising banners to your e107 website</description> <description lang="BNRLAN_100">Add advertising banners to your e107 website</description>
<keywords>
<word>banners</word>
<word>advertise</word>
</keywords>
<languageFiles> <languageFiles>
<file type='log' path='languages/--LAN--_admin_banner.php' /> <file type='log' path='languages/--LAN--_admin_banner.php' />
<file type='install' path='languages/--LAN--_admin_banner.php' /> <file type='install' path='languages/--LAN--_admin_banner.php' />