Forums / Cotonti / Extensions / [RELEASE] Not a Plugin

...but a configurator to start a new plugin

urlkiller
#1 2010-07-22 06:57
http://www.blackboxmedia.org/_projects/_cotgen/

ok here is the link. click on it do your entrys and download a ready made plugin package ready for you to edit it. i thought its pretty stupid starting hughe plugins everytime from scratch.

if you find some errors or something else that could be included just write something here...

maybe somebody have some use of it.

it features a header, ajax and main start file, some icons and something here and there... download a test plugin an take a look at the files inside.
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
ven7ura
#2 2010-07-22 07:58
Haha nice release!

I hate to modify all that info when I start a plugin from scratch!

Thanks!
urlkiller
#3 2010-07-22 09:26
that was the idea behind that. i got bored of that filesetup some time ago...
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>
ez
#4 2010-07-22 13:51
Nice... saves me time

You could post the source.. ( as a plugin :) )
==- I say: Keep it EZ -==
Kort
#5 2010-07-22 14:18

Most weird plugin structure I've ever seen. Deleting the "extrafiles" takes same time as creating them anew. Why not adding package options? myplugin.sql is definitely obsolete. Imho, useless thing for serious plugin makers.
SED.by - создание сайтов, разработка плагинов и тем для Котонти
tensh
#6 2010-07-22 14:40
Good initiative!
I was thinking of creating something like this as well, and in addition a little database tool to set up the tables, and link to the tables the basic "add, edit, delete" parts of the plugin.
urlkiller
#7 2010-07-23 05:17
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 ;)
// *****************************************************************************
if($_POST['action']=='build')
	{
		read_folders('./source');
		exec("tar cfv ./tars/".$pluginCode.".tar ./plugin/".$pluginCode);
		echo '<fieldset name="field"><legend style="font-weight:normal;letter-spacing:-2px;font-size:48px;">Download Plugin</legend>Download preconfigured Plugin-File here: <a href="./tars/'.$pluginCode.'.tar">'.$pluginCode.'.tar</a></fieldset>';
	}
?>
<style>
html {text-align:center;background:black;color:white;font-family:verdana;}
input {padding:5px;font-size:14px;width:98%;}
textarea {padding:5px;font-size:14px;width:98%;height:100px;}
table td {vertical-align:middle;padding:3px;font-weight:normal;font-family:verdana;}
legend {font-size:48px;font-family:times;}
a {color:#fff;background:#12C1E3;text-decoration:none;padding:3px;-moz-border-radius: 5px; -webkit-border-radius: 5px;border:3px solid transparent;}
a:hover {border:3px solid #118DA5;}
fieldset {width:600px;margin:0 auto;-moz-border-radius: 15px; -webkit-border-radius: 15px;border: 4px solid #323232; background: #222222;margin-bottom:20px;}
</style>

<fieldset name="field">
<legend style="font-weight:normal;letter-spacing:-2px;font-size:48px;">Preconfigured Plugin's</legend>
<form action="index.php" method="post">
	<input type="hidden" name="action" value="build">
	<table style="border:0px;width:100%;">
		<tr>
		  <td style="width:200px;">plugin Code:</td>
		  <td><input type="text" name="pluginCode" value="<?php echo $pluginCode; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Name:</td>
		  <td><input type="text" name="pluginName" value="<?php echo $pluginName; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Version:</td>
		  <td><input type="text" name="pluginVersion" value="<?php echo $pluginVersion; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Updated:</td>
		  <td><input type="text" name="pluginUpdated" value="<?php echo $pluginUpdated; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Type:</td>
		  <td><input type="text" name="pluginType" value="<?php echo $pluginType; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Author:</td>
		  <td><input type="text" name="pluginAuthor" value="<?php echo $pluginAuthor; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Description:</td>
		  <td><input type="text" name="pluginDesc" value="<?php echo $pluginDesc; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Hooks:</td>
		  <td><input type="text" name="pluginHooks" value="<?php echo $pluginHooks; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Date:</td>
		  <td><input type="text" name="pluginDate" value="<?php echo $pluginDate; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Notes:</td>
		  <td><input type="text" name="pluginNotes" value="<?php echo $pluginNotes; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Copyright:</td>
		  <td><input type="text" name="pluginCopyright" value="<?php echo $pluginCopyright; ?>"></td>
		</tr>
		<tr>
		  <td>plugin Language:</td>
		  <td><input type="text" name="pluginLang" value="<?php echo $pluginLang; ?>"></td>
		</tr>
		<tr>
		  <td style="text-align:center;" colspan="2"><br /><br /></td>
		</tr>
		<tr>
		  <td style="text-align:center;" colspan="2"><input type="submit" value="Create preconfigured Plugin" class="submit"></td>
		</tr>
	</table>
</form>
</fieldset>
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>