Webpad 3.0 Personal > Admin / Plugins.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Webpad 3.0 Personal

Download:
webpad-3.0-personal.zip

Category:
Content Management

Archive Content:

Webpad 3.0 Personal

Webpad 3.0 Personal > Admin

Webpad 3.0 Personal > Css

Webpad 3.0 Personal > Dialogs

Webpad 3.0 Personal > Docs

Webpad 3.0 Personal

Webpad 3.0 Personal > Images

Webpad 3.0 Personal

Webpad 3.0 Personal > Js

Webpad 3.0 Personal

Webpad 3.0 Personal > Locations

Webpad 3.0 Personal

Webpad 3.0 Personal > Plugins > Blogging

Webpad 3.0 Personal > Plugins > Blogger

Webpad 3.0 Personal > Plugins > Blosxom

Webpad 3.0 Personal > Plugins > Livejournal

Webpad 3.0 Personal > Plugins > Movabletype

Webpad 3.0 Personal > Plugins > Typepad

Webpad 3.0 Personal > Plugins > Wordpress

Webpad 3.0 Personal

Webpad 3.0 Personal > Templates

Webpad 3.0 Personal

Plugins.php:


<?php
/**
 * @return String
 * @param Int $plugin
 * @param String $name
 * @param String $value
 * @param String $type [text|password|textarea|checkbox|radio|select]
 * @param Array $opts
 * @desc Creates the HTML required for a plugin input field. Needs the $plugin for field naming,  and other values control the details of the element which is output.
*/
function plugin_html_field($plugin,  $name,  $value,  $type,  $opts false) {
    switch (
$type) {
        case 
'text' :
            
$str '<input type="text" name="plugin_' $plugin '[' $name ']" id="plugin_' $plugin '[' $name ']" value="' $value '" class="long" />';
            break;
        case 
'password' :
            
$str '<input type="password" name="plugin_' $plugin '[' $name ']" id="plugin_' $plugin '[' $name ']" value="' $value '" class="long" />';
            break;
        case 
'textarea' :
            
$str '<textarea name="plugin_' $plugin '[' $name ']" id="plugin_' $plugin '[' $name ']">' $value '</textarea>';
            break;
        case 
'checkbox' :
            
$str '';
            foreach (
$opts as $opt=>$label) {
                
$str .= '<input type="checkbox" name="plugin_' $plugin '[' $name ']" id="plugin_' $plugin '[' $name ']" value="' $opt '" class="auto"' . ($opt == $value ' checked="checked"' '') . ' /> <label for="plugin_' $plugin '[' $name ']" class="inline"><small>' $label '</small></label> ';
            }
            break;
        case 
'radio' :
            
$str '';
            foreach (
$opts as $opt=>$label) {
                
$str .= '<input type="radio" name="plugin_' $plugin '[' $name ']" id="plugin_' $plugin '[' $name '][' $opt ']" value="' $opt '" class="auto"' . ($opt == $value ' checked="checked"' '') . ' /> <label for="plugin_' $plugin '[' $name '][' $opt ']" class="inline"><small>' $label '</small></label> ';
            }
            break;
        case 
'select' :
            
$str '<select name="plugin_' $plugin '[' $name ']" id="plugin_' $plugin '[' $name ']" class="auto">';
            foreach (
$opts as $opt=>$label) {
                
$str .= '<option value="' $opt '"' . ($opt == $value ' selected="selected"' '') . '>' $label '</option>';
            }
            
$str .= '</select>';
    }
    
    return 
$str;
}

/**
 * @return String
 * @desc Returns the HTML required for a SELECT box containing all available plugins in the /plugins/ directory.
*/
function plugin_available_select() {
    global 
$config;
    
    if (!
function_exists('read_dir_to_array')) {
        include_once(
'../locations/common.php');
    }
    
$plugins read_dir_to_array('../plugins/');
    
    if (
is_array($plugins) && sizeof($plugins)) {
        
$str '<select name="new_plugin" id="new_plugin"' . ($config['allow_plugins'] === true '' ' disabled="true"') . '>';
        
        foreach (
$plugins as $plugin) {
            if (
substr($plugin,  0,  1) != '_' && is_dir('../plugins/' $plugin)) {
                
$str .= '<option value="' $plugin '">' ucfirst($plugin) . '</option>';
            }
        }
        
$str .= '</select>';
    }
    else {
        
$str false;
    }
    
    return 
$str;
}
?>


Other Content Management Scripts:

WebMaster Resources Home

©RingsWorld.com