...but a configurator to start a new plugin
urlkiller |
|
---|---|
the idea was to create a fast and almost identical plugin structure.
the folders that may seem wierd are the parts folder. the plugin loads the representative part and the tpl with the same name. @Kort Dont know how you delete files but i delete files much faster then opening every single file and change the header part. so what files are obsolete except the sql file? ok maybe i add a feature to create a "small" plugin to choose which files should be included... @tensh & ez but i will do something like a js config part where you could select most used jquery plugs or define your own java includes and a read/write rights option maybe. I dont want to make it too specialised. its more of a toy for me... ![]() @all that was about 5 minutes of time coding this simple tool. Added 2 minutes later: ==== FOR EZ REQUEST ==== function.php
// Search Folders and Copy Files
// *****************************************************************************
function read_folders($mainpath)
{
global $filetypes,
$search,
$replace,
$pluginName,
$pluginVersion,
$pluginUpdated,
$pluginType,
$pluginHooks,
$pluginDesc,
$pluginName,
$Auth_guests,
$Lock_guests,
$Auth_members,
$Lock_members,
$pluginRights,
$pluginLang,
$pluginAuthor,
$pluginDate,
$pluginCopyright,
$pluginNotes,
$pluginFile,
$pluginCode,
$pluginSQL;
@mkdir('./plugin/'.$pluginCode, 0777);
$handle = opendir($mainpath);
while ($file = readdir ($handle))
{
if($file != "." && $file != "..")
{
if(is_dir($mainpath."/".$file))
{
@mkdir(str_replace('./source','./plugin/'.$pluginCode,$mainpath)."/".$file, 0777);
@read_folders($mainpath."/".$file);
}
else
{
$filehandle = @fopen(str_replace('./source','./plugin/'.$pluginCode,$mainpath)."/".str_replace('placeholder',$pluginCode,$file), 'w+') or die("can't open file, invalid file handle!");
foreach($filetypes AS $type)
{
if(strpos($file,$type))
{
@fwrite($filehandle, file_tags($mainpath."/".$file));
}
}
@fclose($filehandle);
}
}
}
closedir($handle);
}
// Replace Tags in Files and Save a Copy with the new names
// *****************************************************************************
function file_tags($mainpath)
{
global $filetypes,
$search,
$replace,
$pluginName,
$pluginVersion,
$pluginUpdated,
$pluginType,
$pluginHooks,
$pluginDesc,
$pluginName,
$Auth_guests,
$Lock_guests,
$Auth_members,
$Lock_members,
$pluginRights,
$pluginLang,
$pluginAuthor,
$pluginDate,
$pluginCopyright,
$pluginNotes,
$pluginFile,
$pluginCode,
$pluginSQL;
$lines = file($mainpath);
foreach ($lines as $line_num => $line){$out .= str_replace($search,$replace,$line);}
return $out;
}
!!- PLEASE VIEW PLAIN SOME ERRORS HERE IN THE HIGHLIGHT -!! index.php
include('./function.php');
$pluginName = $_POST['pluginName'];
$pluginCode = $_POST['pluginCode'];
$pluginVersion = $_POST['pluginVersion'];
$pluginUpdated = $_POST['pluginUpdated'];
$pluginType = $_POST['pluginType'];
$pluginHooks = $_POST['pluginHooks'];
$pluginDesc = $_POST['pluginDesc'];
$pluginName = $_POST['pluginName'];
$pluginRights = 'RIGHTS CONFIG BLOCK';
$pluginLang = $_POST['pluginLang'];
$pluginAuthor = $_POST['pluginAuthor'];
$pluginDate = $_POST['pluginDate'];
$pluginCopyright = $_POST['pluginCopyright'];
$pluginNotes = $_POST['pluginNotes'];
$pluginFile = 'plugins/'.$pluginCode.'/';
$pluginSQL = $pluginCode.'.sql';
$Auth_guests = 'RWA1234';
$Lock_guests = 'RWA1234';
$Auth_members = 'RWA1234';
$Lock_members = 'RWA1234';
$search = array('[{Rights}]' ,'[{Lang}]' ,'[{Hooks}]' ,'[{File}]' ,'[{Updated}]' ,'[{Type}]' ,'[{Author}]' ,'[{Description}]' ,'[{Code}]' ,'[{Name}]' ,'[{Version}]' ,'[{Author}]' ,'[{Date}]' ,'[{Copyright}]' ,'[{Notes}]' ,'[{SQL}]' ,'[{Auth_guests}]' ,'[{Lock_guests}]' ,'[{Auth_members}]' ,'[{Lock_members}]');
$replace = array($pluginRights ,$pluginLang ,$pluginHooks ,$pluginFile ,$pluginUpdated ,$pluginType ,$pluginAuthor ,$pluginDesc ,$pluginCode ,$pluginName ,$pluginVersion ,$pluginAuthor ,$pluginDate ,$pluginCopyright ,$pluginNotes ,$pluginSQL ,$Auth_guests ,$Lock_guests ,$Auth_members ,$Lock_members);
$filetypes = array('.php','.css','.js','.tpl','.png','.gif','.jpg','.sql');
if($pluginType=='') {$pluginType = 'plugin';}
if($pluginHooks=='') {$pluginHooks = 'standalone';}
if($pluginLang=='') {$pluginLang = 'en';}
if($pluginAuthor=='') {$pluginAuthor = 'John Doe';}
if($pluginVersion=='') {$pluginVersion = '1.0';}
if($pluginUpdated=='') {$pluginUpdated = date('d.m.Y',mktime());}
if($pluginNotes=='') {$pluginNotes = 'Your Notes are going here...';}
if($pluginCopyright=='') {$pluginCopyright = '(c) '.date('Y',mktime()).' by '.$pluginAuthor;}
if($pluginDate=='') {$pluginDate = date('d.m.Y',mktime());}
if($pluginDesc=='') {$pluginDesc = 'Your Descriptions are going here...';}
if($pluginCode=='') {$pluginCode = 'myplugin';}
if($pluginName=='') {$pluginName = 'My Plugin Name';}
// Run everything and start working URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
|