Exemplo n.º 1
0
<?php

/*
Plugin Name: List Page Generator
Description: Adds "List Page" to Code Generator
Version: 1.00
Requires at least: 2.15
*/
// Note: This library is automatically included by /lib/menus/_codeGenerator/actionHandler.php
// ... but can be duplicated and added to the /plugins/ folder to create a new code generator.
// ... Just be sure to change the function names or you'll get errors about duplicate functions.
// register generator
addGenerator('cg2_listpage', 'List Page', 'Show many records.');
// dispatch function
function cg2_listpage($function, $name, $description, $type)
{
    // show options menu, and errors on submit
    cg2_listpage_getOptions($function, $name, $description, $type);
    // show code
    $instructions = array();
    // show as bullet points
    $filenameSuffix = 'list';
    // eg: tablename-FILENAMESUFFIX.php
    $code = cg2_listpage_getCode();
    cg2_showCode($function, $name, $instructions, $filenameSuffix, $code);
    exit;
}
// user specified options
function cg2_listpage_getOptions($function, $name, $description, $type)
{
    // error checking
Exemplo n.º 2
0
<?php

/*
Plugin Name: Combo Page Generator
Description: Adds "Combo Page" to Code Generator
Version: 1.00
Requires at least: 2.15
*/
// Note: This library is automatically included by /lib/menus/_codeGenerator/actionHandler.php
// ... but can be duplicated and added to the /plugins/ folder to create a new code generator.
// ... Just be sure to change the function names or you'll get errors about duplicate functions.
// register generator
addGenerator('cg2_combopage', 'Combo Page', 'Combination List and Detail Page, show links to many records and full details on one record.');
// dispatch function
function cg2_combopage($function, $name, $description, $type)
{
    // call ajax code
    cg2_combopage_ajaxPhpCode();
    // show options menu, and errors on submit
    cg2_combopage_getOptions($function, $name, $description, $type);
    // show code
    $instructions = array();
    // show as bullet points
    $filenameSuffix = 'combo';
    // eg: tablename-FILENAMESUFFIX.php
    $code = cg2_combopage_getCode();
    cg2_showCode($function, $name, $instructions, $filenameSuffix, $code);
    exit;
}
// user specified options
function cg2_combopage_getOptions($function, $name, $description, $type)
function getGenerators($type)
{
    // get generator list
    $generators = addGenerator();
    // filter list by type
    if ($type == 'all') {
        $generators = $generators;
    } elseif ($type == 'public') {
        $generators = array_where($generators, array('type' => 'public'));
    } elseif ($type == 'private') {
        $generators = array_where($generators, array('type' => 'private'));
    } else {
        dieAsCaller(__FUNCTION__ . ": Unknown type argument '" . htmlencode($type) . "'!");
    }
    // sort 'public' generators by 'name'
    if ($type == 'public') {
        array_multisort(array_pluck($generators, 'name'), SORT_ASC, $generators);
    }
    //
    return $generators;
}
Exemplo n.º 4
0
<?php

/*
Plugin Name: Detail Page Generator
Description: Adds "Detail Page" to Code Generator
Version: 1.00
Requires at least: 2.15
*/
// Note: This library is automatically included by /lib/menus/_codeGenerator/actionHandler.php
// ... but can be duplicated and added to the /plugins/ folder to create a new code generator.
// ... Just be sure to change the function names or you'll get errors about duplicate functions.
// register generator
addGenerator('cg2_detailpage', 'Detail Page', 'Show one record on the page.');
// dispatch function
function cg2_detailpage($function, $name, $description, $type)
{
    // show options menu, and errors on submit
    cg2_detailpage_getOptions($function, $name, $description, $type);
    // show code
    $instructions = array();
    // show as bullet points
    $filenameSuffix = 'detail';
    // eg: tablename-FILENAMESUFFIX.php
    $code = cg2_detailpage_getCode();
    cg2_showCode($function, $name, $instructions, $filenameSuffix, $code);
    exit;
}
//
function cg2_detailpage_getOptions($function, $name, $description, $type)
{
    // error checking
Exemplo n.º 5
0
<?php

/*
Plugin Name: RSS Feed Generator
Description: Adds "RSS Feed" to Code Generator
Version: 1.00
Requires at least: 2.15
*/
// Note: This library is automatically included by /lib/menus/_codeGenerator/actionHandler.php
// ... but can be duplicated and added to the /plugins/ folder to create a new code generator.
// ... Just be sure to change the function names or you'll get errors about duplicate functions.
// register generator
addGenerator('cg2_rssfeed', 'RSS Feed', 'Generate an RSS Feed for vistors to subscribe to.');
// dispatch function
function cg2_rssfeed($function, $name, $description, $type)
{
    // call ajax code
    cg2_rssfeed_ajaxPhpCode();
    // show options menu, and errors on submit
    cg2_rssfeed_getOptions($function, $name, $description, $type);
    // show code
    $instructions = array();
    // show as bullet points
    $filenameSuffix = 'rss';
    // eg: tablename-FILENAMESUFFIX.php
    $code = cg2_rssfeed_getCode();
    cg2_showCode($function, $name, $instructions, $filenameSuffix, $code);
    exit;
}
// user specified options
function cg2_rssfeed_getOptions($function, $name, $description, $type)
<?php

/*
 Plugin Name: List Page Generator
 Description: Adds "List Page" to Code Generator
 Version: 1.00
 Requires at least: 2.61
*/
// Note: This library is automatically included by /lib/menus/_codeGenerator/actionHandler.php
// ... but can be duplicated and added to the /plugins/ folder to create a new code generator.
// ... Just be sure to change the function names or you'll get errors about duplicate functions.
// register generator
addGenerator('cg2_categorypage', 'Category Menu', 'Show a hierarchy of records from a category section.');
// dispatch function
function cg2_categorypage($function, $name, $description, $type)
{
    // security/error checking
    if (@$_REQUEST['tableName'] && !loadSchema($_REQUEST['tableName'])) {
        die("Invalid tablename!");
    }
    // call ajax code
    cg2_categorypage_ajaxPhpCode();
    // show options menu, and errors on submit
    cg2_categorypage_getOptions($function, $name, $description, $type);
    // show code
    $instructions = array();
    // show as bullet points
    $filenameSuffix = 'list';
    // eg: tablename-FILENAMESUFFIX.php
    $code = cg2_categorypage_getCode();
    cg2_showCode($function, $name, $instructions, $filenameSuffix, $code);