mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
Expanding the plugin-builder to generate addons. (work-in-progress)
This commit is contained in:
parent
8ff02d9aa9
commit
5e862682be
@ -2177,10 +2177,17 @@ class pluginBuilder
|
||||
var $special = array();
|
||||
var $tableCount = 0;
|
||||
var $tableList = array();
|
||||
var $createFiles = false;
|
||||
var $createFiles = false;
|
||||
private $debug = false;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
|
||||
if(e_DEBUG == true)
|
||||
{
|
||||
$this->debug = true;
|
||||
}
|
||||
|
||||
$this->special['checkboxes'] = array('title'=> '','type' => null, 'data' => null, 'width'=>'5%', 'thclass' =>'center', 'forced'=> TRUE, 'class'=>'center', 'toggle' => 'e-multiselect', 'fieldpref'=>true);
|
||||
$this->special['options'] = array( 'title'=> 'LAN_OPTIONS', 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced'=>TRUE, 'fieldpref'=>true);
|
||||
|
||||
@ -2347,6 +2354,11 @@ class pluginBuilder
|
||||
$this->tableList[] = $table;
|
||||
}
|
||||
$text .= "<li><a data-toggle='tab' href='#preferences'>".LAN_PREFS."</a></li>";
|
||||
|
||||
if($this->debug == true)
|
||||
{
|
||||
$text .= "<li><a data-toggle='tab' href='#addons'>Addons</a></li>";
|
||||
}
|
||||
|
||||
$text .= "</ul>";
|
||||
|
||||
@ -2369,7 +2381,15 @@ class pluginBuilder
|
||||
$text .= "<div class='tab-pane' id='preferences'>\n";
|
||||
$text .= $this->prefs();
|
||||
$text .= "</div>";
|
||||
|
||||
|
||||
|
||||
if($this->debug == true)
|
||||
{
|
||||
$text .= "<div class='tab-pane' id='addons'>\n";
|
||||
$text .= $this->addons();
|
||||
$text .= "</div>";
|
||||
}
|
||||
|
||||
if(empty($ret['tables']))
|
||||
{
|
||||
$text .= $frm->hidden($this->pluginName.'_ui[mode]','main');
|
||||
@ -2395,6 +2415,42 @@ class pluginBuilder
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private function addons()
|
||||
{
|
||||
$plg = e107::getPlugin();
|
||||
|
||||
$list = $plg->getAddonsList();
|
||||
$frm = e107::getForm();
|
||||
$text = "<table class='table table-striped' >";
|
||||
|
||||
$setupDiz = "Create default table data during install, upgrade, uninstall etc";
|
||||
|
||||
array_unshift($list,$this->pluginName.'_setup');
|
||||
|
||||
foreach($list as $v)
|
||||
{
|
||||
|
||||
$diz = ($v == $this->pluginName.'_setup') ? $setupDiz : $plg->getAddonsDiz($v);
|
||||
|
||||
$text .= "<tr>";
|
||||
$text .= "<td>".$frm->checkbox('addons[]',$v,false, $v)."</td>";
|
||||
$text .= "<td><label for='".$frm->name2id('addons-'.$v)."'>".$diz."</label></td>";
|
||||
$text .= "</tr>";
|
||||
}
|
||||
|
||||
$text .= "</table>";
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function prefs()
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
@ -2421,16 +2477,20 @@ class pluginBuilder
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
$text = "<table class='table table-striped'>";
|
||||
|
||||
for ($i=0; $i < 10; $i++)
|
||||
{
|
||||
$text .= "<div class='form-inline'>".
|
||||
$frm->text("pluginPrefs[".$i."][index]", '',40,'placeholder='.EPL_ADLAN_129)." ".
|
||||
$frm->text("pluginPrefs[".$i."][value]", '',40,'placeholder='.EPL_ADLAN_130)." ".
|
||||
$frm->select("pluginPrefs[".$i."][type]", $options, '', 'class=null', EPL_ADLAN_131).
|
||||
"</div>";
|
||||
$text .= "<tr><td>".
|
||||
$frm->text("pluginPrefs[".$i."][index]", '',40,'placeholder='.EPL_ADLAN_129)."</td><td>".
|
||||
$frm->text("pluginPrefs[".$i."][value]", '',50,'placeholder='.EPL_ADLAN_130)."</td><td>".
|
||||
$frm->select("pluginPrefs[".$i."][type]", $options, '', 'class=null', EPL_ADLAN_131)."</td><td>".
|
||||
$frm->text("pluginPrefs[".$i."][help]", '',80,'size=xxlarge&placeholder='.EPL_ADLAN_174)."</td>".
|
||||
"</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
$text .= "</table>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
@ -2514,7 +2514,7 @@ class e_form
|
||||
|
||||
$include = (deftrue("FONTAWESOME")) ? "data-loading-icon='fa-spinner' data-disable='true'" : "";
|
||||
|
||||
|
||||
|
||||
return "
|
||||
<button ".$include." type='{$btype}' name='{$name}' value='{$value}'".$this->get_attributes($options, $name)."><span>{$label}</span></button>
|
||||
";
|
||||
|
@ -39,7 +39,7 @@ class e107plugin
|
||||
'e_frontpage',
|
||||
'e_latest', // @Deprecated - see e_dashboard
|
||||
'e_status', //@Deprecated - see e_dashboard
|
||||
'e_menu', // experimental.
|
||||
'e_menu',
|
||||
'e_search',
|
||||
'e_shortcode',
|
||||
'e_module',
|
||||
@ -65,6 +65,52 @@ class e107plugin
|
||||
);
|
||||
|
||||
|
||||
/** Deprecated or non-v2.x standards */
|
||||
private $plugin_addons_deprecated = array(
|
||||
'e_bb', // @deprecated
|
||||
'e_list',
|
||||
'e_meta', // @deprecated
|
||||
'e_latest', // @deprecated
|
||||
'e_status', // @deprecated
|
||||
'e_tagwords',
|
||||
'e_sql.php',
|
||||
'e_linkgen',
|
||||
'e_frontpage',
|
||||
'e_tohtml', // @deprecated rename to e_parser ?
|
||||
'e_sql',
|
||||
'e_emailprint',
|
||||
);
|
||||
|
||||
|
||||
|
||||
private $plugin_addons_diz = array(
|
||||
'e_admin' => "Add form elements to existing core admin areas.",
|
||||
'e_cron' => "Include your plugin's cron in the 'Scheduled Tasks' admin area.",
|
||||
'e_notify' => "Include your plugin's notification to the Notify admin area.",
|
||||
'e_linkgen' => "Add link generation into the sitelinks area.",
|
||||
'e_frontpage' => "Add your plugin as a frontpage option.",
|
||||
'e_menu' => "Gives your plugin's menu(s) configuration options in the Menu Manager.",
|
||||
'e_featurebox' => "Allow your plugin to generate content for the featurebox plugin.",
|
||||
'e_search' => "Add your plugin to the search page.",
|
||||
'e_shortcode' => "Add a global shortcode which can be used site-wide. (use sparingly)",
|
||||
'e_module' => "Include a file within class2.php (every page of the site).",
|
||||
'e_event' => "Hook into core events and process them with custom functions.",
|
||||
'e_comment' => "Override the core commenting system.",
|
||||
'e_dashboard' => "Add something to the default admin dashboard panel.", // Admin Front-Page addon.
|
||||
'e_header' => "Have your plugin include code in the head of every page of the site. eg. css", // loaded in header prior to javascript manager.
|
||||
'e_footer' => "Have your plugin include code in the foot of every page of the site. eg. javascript", // Loaded in footer prior to javascript manager.
|
||||
'e_url' => "Give your plugin search-engine-friendly URLs", // simple mod-rewrite.
|
||||
'e_mailout' => "Allow the mailing engine to use data from your plugin's database tables.",
|
||||
'e_sitelink' => "Create dynamic navigation links for your plugin.", // sitelinks generator.
|
||||
'e_related' => "Allow your plugin to be included in the 'related' links.",
|
||||
'e_rss' => "Give your plugin an rss feed.",
|
||||
'e_upload' => "Use data from your plugin in the user upload form.",
|
||||
'e_user' => "Have your plugin include data on the user-profile page.",
|
||||
'e_library' => "Include a third-party library"
|
||||
|
||||
);
|
||||
|
||||
|
||||
var $disAllowed = array(
|
||||
'theme',
|
||||
'core'
|
||||
@ -2868,6 +2914,26 @@ class e107plugin
|
||||
return;
|
||||
}
|
||||
|
||||
public function getAddonsList()
|
||||
{
|
||||
$list = array_diff($this->plugin_addons,$this->plugin_addons_deprecated);
|
||||
sort($list);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getAddonsDiz($v)
|
||||
{
|
||||
if(!empty($this->plugin_addons_diz[$v]))
|
||||
{
|
||||
return $this->plugin_addons_diz[$v];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// return a list of available plugin addons for the specified plugin. e_xxx etc.
|
||||
// $debug = TRUE - prints diagnostics
|
||||
// $debug = 'check' - checks each file found for php tags - prints 'pass' or 'fail'
|
||||
@ -2878,6 +2944,7 @@ class e107plugin
|
||||
|
||||
$p_addons = array();
|
||||
|
||||
|
||||
foreach ($this->plugin_addons as $addon) //Find exact matches only.
|
||||
{
|
||||
// if(preg_match("#^(e_.*)\.php$#", $f['fname'], $matches))
|
||||
|
@ -42,9 +42,9 @@ class news_featurebox // include plugin-folder in the name.
|
||||
$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||
$query = "SELECT * FROM #news WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND FIND_IN_SET(5,news_render_type) ORDER BY news_datestamp DESC LIMIT 10";
|
||||
|
||||
if($sql->db_Select_gen($query))
|
||||
if($sql->gen($query))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
while($row = $sql->fetch())
|
||||
{
|
||||
$fbox[] = array(
|
||||
'title' => $row['news_title'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user