📄 plugincreate.php
字号:
<?phpdefined('WikyBlog') or die("Not an entry point...");/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// PLUGIN CREATOR (pre-alpha)/* For a complete plugin we need 1) A way to create the sql, dbinfo, and the class 2) The class needs a number of elements - display - editing Column Types -------------------------------------------------------------------- Must have `title` text `keywords` list Can Have Types text 0-56k url's emails dates/times enum/sets integer ..need unsigned/signed? .. length decimals for double/float.. !!! NEED TO COME BACK TO -------------------------------------------------- - $dbInfo['searchTitle'] .. - need types like email, editors list*///global $page,$dbInfo,$pageOwner,$jsNum,$dbObject;$dbObject->links['Create Plugin'] = '/Admin/'.$pageOwner['username'].'/CreatePlugin';$dbObject->links['Data Types'] = '/Admin/'.$pageOwner['username'].'/ManageTypes';$dbObject->links['?'] = 'Create Plugin';$page->displayTitle = 'Create Plugin';if( $_SESSION['userlevel'] !== 4){ $page->contentA[$page->displayTitle] = 'You must be an administrator to access this page.'; return;}includeFile('admin/PluginCreateTool.php');class createPlugin extends createPluginTool{ var $types = array(); //used for checking var $existingVars = array(); var $usedCols = array(); //resulting files var $sqlFile, $infoFile, $classFile; function createPlugin(){ global $page; $this->createPluginTool(); $empty = array(); $empty['plugin'] = ''; $empty['title']['len'] = '20'; $empty['keywords']['type'] = 'ENUM'; $empty['keywords']['len'] = ''; $empty['add'] = array(); $_POST += $empty; $addNow = true; switch($page->userCmd){ case 'check': if( $this->checkAll() ){ message('Your plugin is ready for creation.'); } $this->createForm($_POST); break; case 'show code': $addNow = false; case 'add plugin': $this->addPlugin($addNow); if( !isset($_GET['wb']) ){ $this->createForm($_POST); } break; default: $this->createForm($_POST); break; } } /////////////////////////////////////////////////////////////// // // The interface for creating a plugin // function createForm($args){ global $page,$dbObject,$dbInfo; $page->formAction = $dbObject->links['Create Plugin']; ob_start(); echo '<table style="width:100%" cellspacing="0" border="0" class="tableRows">'; echo '<tr>'; echo '<td>'; echo 'Plugin Name: '; echo '</td>'; echo '<td colspan="2">'; echo '<input type="text" name="plugin" value="'.$args['plugin'].'" /> '; echo ' <input type="submit" name="cmd" value="Check" />'; echo '</td>'; echo '</tr>'; $this->form($args); echo '<div style="text-align:right">'; echo ' <input type="submit" name="cmd" value="Check" />'; echo ' '; echo '<input type="submit" name="cmd" value="Add Plugin" />'; echo ' '; echo '<input type="submit" name="cmd" value="Show Code" />'; echo '</div>'; $this->formFooter(); $page->contentA['Create Plugin'] = wb::get_clean(); } /////////////////////////////////////////////////////////////// // // extending functions // function addPlugin($addNow=true){ if( !$this->checkAll() ){ return; } $plugin = parent::createScripts(); // create class.. oh boy! if( $addNow ){ $this->addToDB($plugin); }else{ $this->modify($plugin); } } }new createPlugin();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -