mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
Expanding the plugin-builder to generate addons. (work-in-progress)
This commit is contained in:
@@ -2178,9 +2178,16 @@ class pluginBuilder
|
|||||||
var $tableCount = 0;
|
var $tableCount = 0;
|
||||||
var $tableList = array();
|
var $tableList = array();
|
||||||
var $createFiles = false;
|
var $createFiles = false;
|
||||||
|
private $debug = false;
|
||||||
|
|
||||||
function __construct()
|
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['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);
|
$this->special['options'] = array( 'title'=> 'LAN_OPTIONS', 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced'=>TRUE, 'fieldpref'=>true);
|
||||||
|
|
||||||
@@ -2348,6 +2355,11 @@ class pluginBuilder
|
|||||||
}
|
}
|
||||||
$text .= "<li><a data-toggle='tab' href='#preferences'>".LAN_PREFS."</a></li>";
|
$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>";
|
$text .= "</ul>";
|
||||||
|
|
||||||
$text .= "<div class='tab-content'>\n";
|
$text .= "<div class='tab-content'>\n";
|
||||||
@@ -2370,6 +2382,14 @@ class pluginBuilder
|
|||||||
$text .= $this->prefs();
|
$text .= $this->prefs();
|
||||||
$text .= "</div>";
|
$text .= "</div>";
|
||||||
|
|
||||||
|
|
||||||
|
if($this->debug == true)
|
||||||
|
{
|
||||||
|
$text .= "<div class='tab-pane' id='addons'>\n";
|
||||||
|
$text .= $this->addons();
|
||||||
|
$text .= "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
if(empty($ret['tables']))
|
if(empty($ret['tables']))
|
||||||
{
|
{
|
||||||
$text .= $frm->hidden($this->pluginName.'_ui[mode]','main');
|
$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()
|
function prefs()
|
||||||
{
|
{
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
@@ -2422,15 +2478,19 @@ class pluginBuilder
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$text = "<table class='table table-striped'>";
|
||||||
|
|
||||||
for ($i=0; $i < 10; $i++)
|
for ($i=0; $i < 10; $i++)
|
||||||
{
|
{
|
||||||
$text .= "<div class='form-inline'>".
|
$text .= "<tr><td>".
|
||||||
$frm->text("pluginPrefs[".$i."][index]", '',40,'placeholder='.EPL_ADLAN_129)." ".
|
$frm->text("pluginPrefs[".$i."][index]", '',40,'placeholder='.EPL_ADLAN_129)."</td><td>".
|
||||||
$frm->text("pluginPrefs[".$i."][value]", '',40,'placeholder='.EPL_ADLAN_130)." ".
|
$frm->text("pluginPrefs[".$i."][value]", '',50,'placeholder='.EPL_ADLAN_130)."</td><td>".
|
||||||
$frm->select("pluginPrefs[".$i."][type]", $options, '', 'class=null', EPL_ADLAN_131).
|
$frm->select("pluginPrefs[".$i."][type]", $options, '', 'class=null', EPL_ADLAN_131)."</td><td>".
|
||||||
"</div>";
|
$frm->text("pluginPrefs[".$i."][help]", '',80,'size=xxlarge&placeholder='.EPL_ADLAN_174)."</td>".
|
||||||
|
"</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$text .= "</table>";
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ class e107plugin
|
|||||||
'e_frontpage',
|
'e_frontpage',
|
||||||
'e_latest', // @Deprecated - see e_dashboard
|
'e_latest', // @Deprecated - see e_dashboard
|
||||||
'e_status', //@Deprecated - see e_dashboard
|
'e_status', //@Deprecated - see e_dashboard
|
||||||
'e_menu', // experimental.
|
'e_menu',
|
||||||
'e_search',
|
'e_search',
|
||||||
'e_shortcode',
|
'e_shortcode',
|
||||||
'e_module',
|
'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(
|
var $disAllowed = array(
|
||||||
'theme',
|
'theme',
|
||||||
'core'
|
'core'
|
||||||
@@ -2868,6 +2914,26 @@ class e107plugin
|
|||||||
return;
|
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.
|
// return a list of available plugin addons for the specified plugin. e_xxx etc.
|
||||||
// $debug = TRUE - prints diagnostics
|
// $debug = TRUE - prints diagnostics
|
||||||
// $debug = 'check' - checks each file found for php tags - prints 'pass' or 'fail'
|
// $debug = 'check' - checks each file found for php tags - prints 'pass' or 'fail'
|
||||||
@@ -2878,6 +2944,7 @@ class e107plugin
|
|||||||
|
|
||||||
$p_addons = array();
|
$p_addons = array();
|
||||||
|
|
||||||
|
|
||||||
foreach ($this->plugin_addons as $addon) //Find exact matches only.
|
foreach ($this->plugin_addons as $addon) //Find exact matches only.
|
||||||
{
|
{
|
||||||
// if(preg_match("#^(e_.*)\.php$#", $f['fname'], $matches))
|
// 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).")(,|$)'";
|
$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";
|
$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(
|
$fbox[] = array(
|
||||||
'title' => $row['news_title'],
|
'title' => $row['news_title'],
|
||||||
|
Reference in New Issue
Block a user