Initial Commit
This commit is contained in:
22
.gitattributes
vendored
Normal file
22
.gitattributes
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
31
.gitignore
vendored
Normal file
31
.gitignore
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<<<<<<< HEAD
|
||||
#Dreamweaver .TMP files
|
||||
*.TMP
|
||||
*.tmp
|
||||
|
||||
# Log Files
|
||||
*_log
|
||||
*.log
|
||||
|
||||
# Backup files
|
||||
*.bak
|
||||
*.lwbak
|
||||
|
||||
# Cache
|
||||
cache
|
||||
cache_off
|
||||
cache_disabled
|
||||
backups
|
||||
_notes
|
||||
.ftpquota
|
||||
|
||||
# DW File
|
||||
dw_php_codehinting.config
|
||||
|
||||
# OS Files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
=======
|
||||
wp-content/uploads
|
||||
|
||||
>>>>>>> 734f97bb1f6b82815b03f904a4b519112724d44c
|
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
||||
wordpress-content-warning-v3
|
||||
============================
|
||||
|
||||
A WordPress Plugin to warn users of possibly offensive content.
|
193
class/main.class.php
Normal file
193
class/main.class.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?
|
||||
|
||||
class CWV3{
|
||||
|
||||
function CWV3(){
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
public function __construct(){
|
||||
// Styling and such
|
||||
add_action('init', array( &$this, 'register_frontend_data') );
|
||||
add_action('wp_enqueue_scripts', array(&$this, 'load_dependancies') );
|
||||
|
||||
add_action('wp_footer', array(&$this, 'renderDialog'));
|
||||
|
||||
// Post Meta Box for this.
|
||||
add_action('add_meta_boxes', array(&$this, 'cw_meta'));
|
||||
add_action('save_post', array(&$this, 'cwv3_meta_save'));
|
||||
|
||||
// AJAX Handle
|
||||
add_action('wp_ajax_cwv3_ajax', array(&$this, 'handle_ajax'));
|
||||
add_action('wp_ajax_nopriv_cwv3_ajax', array(&$this, 'handle_ajax'));
|
||||
}
|
||||
|
||||
public function cw_meta(){
|
||||
$scr = array('post', 'page');
|
||||
foreach($scr as $screen){
|
||||
add_meta_box('cwv3_meta_section',
|
||||
__('CWV3 Security'),
|
||||
array(&$this, 'render_metabox'),
|
||||
$screen,
|
||||
'side',
|
||||
'high'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function cwv3_meta_save($post_id){
|
||||
if('page' == $_POST['post_type'])
|
||||
if(!current_user_can('edit_page', $post_id) )
|
||||
return;
|
||||
else
|
||||
if(!current_user_can('edit_post', $post_id) )
|
||||
return;
|
||||
|
||||
if(!isset($_POST['cwv3_meta'] ) || ! wp_verify_nonce($_POST['cwv3_meta'], plugin_basename(__FILE__) ) )
|
||||
return;
|
||||
|
||||
$mydata = sanitize_text_field($_POST['cwv3_auth']);
|
||||
update_post_meta($post_id, 'cwv3_auth', $mydata);
|
||||
|
||||
}
|
||||
|
||||
public function handle_ajax(){
|
||||
$post_id = intval($_POST['id']);
|
||||
|
||||
check_ajax_referer('cwv3_ajax_'.$post_id, 'nonce');
|
||||
|
||||
$sw = get_option('cwv3_sitewide') == 'enabled' ? true : false;
|
||||
$cData = json_decode($_COOKIE['cwv3_auth']);
|
||||
$time = get_option('cwv3_death');
|
||||
$time = time()+($time['multiplier']*$time['time']);
|
||||
if($_POST['method'] == 'exit'){
|
||||
if(get_option('cwv3_denial') == 'enabled'){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
die;
|
||||
}
|
||||
|
||||
public function load_dependancies(){
|
||||
global $post;
|
||||
|
||||
wp_enqueue_style('cwv3_css');
|
||||
wp_enqueue_script('cwv3_js');
|
||||
|
||||
$elink = get_option('cwv3_enter_link');
|
||||
$exlink = get_option('cwv3_exit_link');
|
||||
$p_ID = (is_home()) ? -1 : (is_attachment() ? $post->post_parent : (is_archive() || is_search()) ? -2 : $post->ID);
|
||||
|
||||
wp_localize_script('cwv3_js', 'cwv3_params', array(
|
||||
'action' => 'cwv3_ajax',
|
||||
'nonce' => wp_create_nonce('cwv3_ajax_'.$p_ID),
|
||||
'admin_url' => admin_url( 'admin-ajax.php' ),
|
||||
'id' => $p_ID,
|
||||
'sd' => ($this->check_data() !== true) ? true : false,
|
||||
'enter' => !empty($elink) ? $elink : '#',
|
||||
'exit' => !empty($exlink) ? $exlink : 'http://google.com'
|
||||
));
|
||||
}
|
||||
|
||||
public function register_frontend_data(){
|
||||
// Colorbox w/ MIT License
|
||||
wp_register_style('colorbox', plugins_url('js/colorbox.1.4.14/colorbox.css', dirname(__FILE__)), '', '1.4.14', 'ALL');
|
||||
wp_register_script('colorbox_js', plugins_url('js/colorbox.1.4.14/jquery.colorbox-min.js', dirname(__FILE__)), array('jquery'), '1.4.14', true);
|
||||
|
||||
// Main data
|
||||
wp_register_script('cwv3_js', plugins_url('js/cwv3.js', dirname(__FILE__)), array('colorbox_js'), '1.0', true);
|
||||
wp_register_style('cwv3_css', plugins_url('css/cwv3.css', dirname(__FILE__)), array('colorbox'), '1.0');
|
||||
}
|
||||
|
||||
public function set_cookie($id, $action){
|
||||
$cData = json_decode($_COOKIE['cwv3_auth']);
|
||||
$cData[$id] = $action;
|
||||
|
||||
$time = get_option('cwv3_death');
|
||||
setcookie('cwv3_auth', json_encode($cData), ($time['multiplier'] * $time['time'])+time(),'/', COOKIE_DOMAIN, false);
|
||||
}
|
||||
|
||||
public function check_data(){
|
||||
global $post;
|
||||
|
||||
if(is_feed()){
|
||||
//Don't want to hender the feed, just in case.
|
||||
return true;
|
||||
}
|
||||
|
||||
$cData = json_decode($_COOKIE['cwv3_auth']);
|
||||
$sw = get_option('cwv3_sitewide');
|
||||
$hm = get_option('cwv3_homepage');
|
||||
$mi = get_option('cwv3_misc');
|
||||
|
||||
if($sw[0] == 'enabled'){
|
||||
return (!empty($cData['sitewide']) ? $cData['sitewide'] : false);
|
||||
}
|
||||
|
||||
if(is_home() && $hm[0] == 'enabled'){
|
||||
return (!empty($cData['-1']) ? $cData['-1'] : false);
|
||||
}
|
||||
|
||||
if((is_archive() || is_search()) && $mi[0] == 'enabled'){
|
||||
// Protect misc pages aswell
|
||||
return (!empty($cData['-2']) ? $cData['-2'] : false);
|
||||
}
|
||||
|
||||
if(is_page()){
|
||||
$c = $cData['pages'][$post->ID];
|
||||
return(!empty($c) ? $c : false);
|
||||
}
|
||||
|
||||
$id = (is_attachment() ? $post->post_parent : $post->ID);
|
||||
// First see if categories are setup in the admin side.
|
||||
$catData = get_option("cwv3_cat_list");
|
||||
$curCat = get_the_category($id);
|
||||
if(in_array($curCat, $catData)){
|
||||
// If the current category is selected in the admin page, that means the administrator wishes to protect it.
|
||||
// respect the admin's wishes and do it.
|
||||
return(!empty($cData['categories'][$post->id]) ? $cData['categories'][$id] : false );
|
||||
}
|
||||
// Since that's not the case, we need to check post_meta data and see if this post is protected.
|
||||
if(get_post_meta($post->ID, 'cwv3_auth', true) == 'yes'){
|
||||
return(!empty($cData['posts'][$post->ID]) ? $cData['posts'][$id] : false );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function renderDialog(){
|
||||
|
||||
$dtype = $this->check_data();
|
||||
$etxt = get_option('cwv3_enter_txt');
|
||||
$extxt = get_option('cwv3_exit_txt');
|
||||
?>
|
||||
<!-- CWV3 Dialog -->
|
||||
<div style="display: none">
|
||||
<div id="cwv3_auth">
|
||||
<div id="cwv3_title"><? if($dtype === 'denial'): ?><? echo get_option('cwv3_den_title'); ?><? else: ?><? echo get_option('cwv3_d_title'); ?><? endif; ?></div>
|
||||
<div id="cwv3_content"><? if($dtype === 'denial'): ?><? echo get_option('cwv3_den_msg'); ?><? else: ?><? echo get_option('cwv3_d_msg'); ?><? endif; ?></div>
|
||||
<div id="cwv3_btns"><? if($dtype !== 'denial'): ?><div id="cwv3_enter"><a href="javascript:;" id="cw_enter_link"><? echo (!empty($etxt) ? $etxt : 'Enter'); ?></a></div><? endif; ?><div id="cwv3_exit"><a href="javascript:;" id="cw_exit_link"><? echo (!empty($extxt) ? $extxt : 'Exit'); ?></a></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CWV3 Dialog -->
|
||||
<?
|
||||
}
|
||||
|
||||
public function render_metabox($post){
|
||||
wp_nonce_field(plugin_basename(__FILE__), 'cwv3_meta');
|
||||
|
||||
$curval = get_post_meta($post->ID, 'cwv3_auth', true);?>
|
||||
<? //wp_die(print_r($curval), true); ?>
|
||||
<label for="cwv3_auth">Use authorization for this content:</label>
|
||||
<input type="checkbox" id="cwv3_auth" name="cwv3_auth" <? checked('yes', $curval, true); ?> value="yes"/>
|
||||
<?
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
new CWV3;
|
||||
|
||||
?>
|
18
content-warning-v3.php
Normal file
18
content-warning-v3.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?
|
||||
/*
|
||||
Plugin Name: Content Warning v3
|
||||
Plugin URI: http://plugish.com/plugins/content-warning-v3
|
||||
Description: A plugin based on my v2 code, while drastically deviating from the original. Used mainly for NSFW websites, this plugin provides a dialog popup to warn viewers of it's possible content.
|
||||
Author: Jerry Wood Jr.
|
||||
Version: 3.46
|
||||
Author URI: http://plugish.com
|
||||
*/
|
||||
|
||||
require_once (dirname(__FILE__).'/inc/options.inc.php');
|
||||
require_once (dirname(__FILE__).'/lib/jw_simple_options/simple_options.php');
|
||||
require_once (dirname(__FILE__).'/class/main.class.php');
|
||||
|
||||
$cwv3_options = new JW_SIMPLE_OPTIONS($cwv3_op_data);
|
||||
register_uninstall_hook(__FILE__, $cwv3_options->uninstall() );
|
||||
|
||||
?>
|
2
css/admin_style.css
Normal file
2
css/admin_style.css
Normal file
@ -0,0 +1,2 @@
|
||||
/* CSS Document */
|
||||
|
15
css/cwv3.css
Normal file
15
css/cwv3.css
Normal file
@ -0,0 +1,15 @@
|
||||
/* CSS Document */
|
||||
.cwv3_box{background: transparent;}
|
||||
|
||||
/* Undocumented cBox colors */
|
||||
#cboxLoadingOverlay, #cboxContent, #cboxLoadedContent{background-color: #FFF !important;}
|
||||
|
||||
#cwv3_auth{border: 3px solid #ccc; background: #FFF;}
|
||||
#cwv3_auth div{padding: 0.25em}
|
||||
#cwv3_title{color: #FFF; font-weight: bold; text-align:center; background: #f00;}
|
||||
#cwv3_btns{overflow:hidden;}
|
||||
#cwv3_btns div a{ display: block; width: 100%; text-align:center; color: #FFF; font-weight:bold; text-decoration:none;}
|
||||
#cwv3_enter{float:left; width: 40%;}
|
||||
#cwv3_enter a{background-color: #0C3;}
|
||||
#cwv3_exit{float:right; width: 40%;}
|
||||
#cwv3_exit a{background-color: #F00;}
|
2
css/cwv3_admin.css
Normal file
2
css/cwv3_admin.css
Normal file
@ -0,0 +1,2 @@
|
||||
/* CSS Document */
|
||||
|
154
inc/options.inc.php
Normal file
154
inc/options.inc.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?
|
||||
|
||||
// Get categories
|
||||
$cat_list = get_categories();
|
||||
$final_cat_list = array();
|
||||
foreach($cat_list as $cw_cat){
|
||||
$termID = $cw_cat->term_id;
|
||||
$termName = $cw_cat->name;
|
||||
|
||||
$final_cat_list[$termID] = $termName;
|
||||
}
|
||||
$cwv3_op_data = array(
|
||||
'plugin_title' => 'Content Warning v3',
|
||||
'prefix' => 'cwv3_',
|
||||
'menu_title' => 'CWv3 Options',
|
||||
'slug' => 'cwv3_options',
|
||||
'opData' => array(
|
||||
'sitewide' => array(
|
||||
'name' => 'Sitewide',
|
||||
'type' => 'check',
|
||||
'desc' => 'Takes priority over category, page, and post, home, and misc. pages/posts.',
|
||||
'fields' => array(
|
||||
'enabled' => 'Enable'
|
||||
),
|
||||
'def' => 'enabled'
|
||||
),
|
||||
'homepage' => array(
|
||||
'name' => 'Home Page',
|
||||
'type' => 'check',
|
||||
'desc' => 'Toggle the home page dialog, useful if you have not set a static page for your front-page in Settings -> Reading.',
|
||||
'fields' => array(
|
||||
'enabled' => 'Enable'
|
||||
),
|
||||
'def' => 'enabled'
|
||||
|
||||
),
|
||||
'misc' => array(
|
||||
'name' => 'Misc. Pages',
|
||||
'type' => 'check',
|
||||
'desc' => 'Enable this to protect search, archive, and other such pages.',
|
||||
'fields' => array(
|
||||
'enabled' => 'Enable'
|
||||
),
|
||||
'def' => 'enabled'
|
||||
|
||||
),
|
||||
'death' => array(
|
||||
'name' => 'Cookie Life',
|
||||
'desc' => 'How long before the cookie expires.',
|
||||
'type' => 'timeframe',
|
||||
'def' => array('multiplier'=>1, 'time'=>60*60*24)
|
||||
),
|
||||
// Dialog Options
|
||||
'd_title' => array(
|
||||
'name' => 'Dialog Title',
|
||||
'desc' => '',
|
||||
'type' => 'text',
|
||||
'def' => 'WARNING: Explicit Content'
|
||||
),
|
||||
'd_msg' => array(
|
||||
'name' => 'Dialog Message',
|
||||
'type' => 'editor',
|
||||
'desc' => 'A message shown to your visitor.',
|
||||
'def' => 'The content you are about to view may be considered offensive and/or inappropriate. Furthermore, this content may be considered adult content, if you are not of legal age or are easily offended, you are required to click the exit button.',
|
||||
'settings' => array(
|
||||
'teeny' => true,
|
||||
'media_buttons' => false
|
||||
)
|
||||
),
|
||||
'exit_txt' => array(
|
||||
'name' => 'Exit Text',
|
||||
'type' => 'text',
|
||||
'desc' => 'The text for the exit button.',
|
||||
'def' => 'Exit'
|
||||
),
|
||||
'exit_link' => array(
|
||||
'name' => 'Exit Link',
|
||||
'type' => 'text',
|
||||
'desc' => 'The full URL a user should be directed to upon clicking the exit button.',
|
||||
'def' => 'http://google.com'
|
||||
),
|
||||
'enter_txt' => array(
|
||||
'name' => 'Enter Text',
|
||||
'type' => 'text',
|
||||
'desc' => 'The text for the enter button.',
|
||||
'def' => 'Enter'
|
||||
),
|
||||
'enter_link' => array(
|
||||
'name' => 'Enter Link',
|
||||
'type' => 'text',
|
||||
'desc' => 'The full URL a user should be directed to upon clicking the enter button. Leave blank to just close the dialog.',
|
||||
'def' => '#'
|
||||
),
|
||||
// Denial Options
|
||||
'denial' => array(
|
||||
'name' => 'Toggle Denial Option',
|
||||
'desc' => '',
|
||||
'type' => 'check',
|
||||
'fields' => array('enabled' => 'Enable denial handling.')
|
||||
),
|
||||
'method' => array(
|
||||
'name' => 'Denial Handling Method',
|
||||
'desc' => '',
|
||||
'type' => 'radio',
|
||||
'fields' => array(
|
||||
'redirect' => 'Redirect the user.',
|
||||
'show' => 'Show the denial dialog.'
|
||||
),
|
||||
'def' => 'redirect'
|
||||
),
|
||||
'den_title' => array(
|
||||
'name' => 'Dialog Title',
|
||||
'desc' => '',
|
||||
'type' => 'text',
|
||||
'def' => 'Access Denied'
|
||||
),
|
||||
'den_msg' => array(
|
||||
'name' => 'Denial Message',
|
||||
'desc' => '',
|
||||
'type' => 'editor',
|
||||
'def' => 'You have been denied access to this content. If you feel this is in error, please contact a site administrator.',
|
||||
'settings' => array(
|
||||
'media_buttons' => false,
|
||||
'teeny' => true
|
||||
)
|
||||
),
|
||||
// Advanced Options
|
||||
//// Styling Options
|
||||
'bg_image' => array(
|
||||
'name' => 'Background Image',
|
||||
'desc' => 'If not empty, the dialog will use this instead of the background opacity and color.',
|
||||
'type' => 'media'
|
||||
),
|
||||
'bg_opacity' => array(
|
||||
'name' => 'Background Opacity',
|
||||
'desc' => 'Input a number from 0-100, the latter being completely opaque.',
|
||||
'type' => 'text',
|
||||
'def' => 75
|
||||
),
|
||||
'bg_color' => array(
|
||||
'name' => 'Background Color',
|
||||
'desc' => 'The Overlay color.',
|
||||
'type' => 'color',
|
||||
'fields' => array('color'=>'#000000')
|
||||
),
|
||||
'cat_list' => array(
|
||||
'name' => 'Category restrictions',
|
||||
'desc' => 'Select categories that you would like to restrict with the dialog.',
|
||||
'type' => 'check',
|
||||
'fields' => $final_cat_list
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
1
js/admin_script.js
Normal file
1
js/admin_script.js
Normal file
@ -0,0 +1 @@
|
||||
// JavaScript Document
|
49
js/colorbox.1.4.14/colorbox.css
Normal file
49
js/colorbox.1.4.14/colorbox.css
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Colorbox Core Style:
|
||||
The following CSS is consistent between example themes and should not be altered.
|
||||
*/
|
||||
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
|
||||
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
||||
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
||||
#cboxContent{position:relative;}
|
||||
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
||||
#cboxTitle{margin:0;}
|
||||
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
||||
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
||||
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
|
||||
.cboxIframe{width:100%; height:100%; display:block; border:0;}
|
||||
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
||||
|
||||
/*
|
||||
User Style:
|
||||
Change the following styles to modify the appearance of Colorbox. They are
|
||||
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
||||
*/
|
||||
#cboxOverlay{background:#fff;}
|
||||
#colorbox{outline:0;}
|
||||
#cboxContent{margin-top:32px; overflow:visible; background:#000;}
|
||||
.cboxIframe{background:#fff;}
|
||||
#cboxError{padding:50px; border:1px solid #ccc;}
|
||||
#cboxLoadedContent{background:#000; padding:1px;}
|
||||
#cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
|
||||
#cboxLoadingOverlay{background:#000;}
|
||||
#cboxTitle{position:absolute; top:-22px; left:0; color:#000;}
|
||||
#cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;}
|
||||
|
||||
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
||||
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;}
|
||||
|
||||
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
||||
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
|
||||
|
||||
#cboxPrevious{background-position:0px 0px; right:44px;}
|
||||
#cboxPrevious:hover{background-position:0px -25px;}
|
||||
#cboxNext{background-position:-25px 0px; right:22px;}
|
||||
#cboxNext:hover{background-position:-25px -25px;}
|
||||
#cboxClose{background-position:-50px 0px; right:0;}
|
||||
#cboxClose:hover{background-position:-50px -25px;}
|
||||
.cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;}
|
||||
.cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
|
||||
.cboxSlideshow_on #cboxSlideshow:hover{background-position:-100px -25px;}
|
||||
.cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
|
||||
.cboxSlideshow_off #cboxSlideshow:hover{background-position:-75px -25px;}
|
BIN
js/colorbox.1.4.14/images/controls.png
Normal file
BIN
js/colorbox.1.4.14/images/controls.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 570 B |
BIN
js/colorbox.1.4.14/images/loading.gif
Normal file
BIN
js/colorbox.1.4.14/images/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
6
js/colorbox.1.4.14/jquery.colorbox-min.js
vendored
Normal file
6
js/colorbox.1.4.14/jquery.colorbox-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1026
js/colorbox.1.4.14/jquery.colorbox.js
Normal file
1026
js/colorbox.1.4.14/jquery.colorbox.js
Normal file
File diff suppressed because it is too large
Load Diff
40
js/cwv3.js
Normal file
40
js/cwv3.js
Normal file
@ -0,0 +1,40 @@
|
||||
// JavaScript Document
|
||||
jQuery(document).ready(function($) {
|
||||
var wpdata = cwv3_params;
|
||||
|
||||
var enter = $('cw_enter_link');
|
||||
var exit = $('cw_exit_link');
|
||||
|
||||
if(wpdata.sd == true){
|
||||
var cboxObj = $.colorbox(
|
||||
{
|
||||
scrolling: false,
|
||||
overlayClose: false,
|
||||
escKey: false,
|
||||
inline: true,
|
||||
href: '#cwv3_auth',
|
||||
initialWidth: '50%',
|
||||
maxWidth: '600px',
|
||||
loop: false,
|
||||
onLoad: function(){
|
||||
$('#cboxClose').remove();
|
||||
},
|
||||
className: 'cwv3_box'
|
||||
}
|
||||
);
|
||||
|
||||
enter.click(function(e){
|
||||
$.post(wpdata.admin_url, {action: wpdata.action, nonce: wpdata.nonce, id: wpdata.id, method: 'enter'}, function(e){
|
||||
// Deal with the response from the 'entry' handler.
|
||||
});
|
||||
});
|
||||
|
||||
exit.click(function(e){
|
||||
$.post(wpdata.admin_url, {action: wpdata.action, nonce: wpdata.nonce, id: wpdata.id, method: 'exit'}, function(e){
|
||||
// Deal with the response from the 'exit' handler.
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
1
js/cwv3_admin.js
Normal file
1
js/cwv3_admin.js
Normal file
@ -0,0 +1 @@
|
||||
// JavaScript Document
|
16
lib/jw_simple_options/css/jw_simple_options.css
Normal file
16
lib/jw_simple_options/css/jw_simple_options.css
Normal file
@ -0,0 +1,16 @@
|
||||
/* CSS Document */
|
||||
|
||||
a.addrow{color: #0C0; text-decoration: none;}
|
||||
a.addrow:hover{color: #0F9; text-decoration:underline;}
|
||||
|
||||
a.removerow{color:#C00; text-decoration: none;}
|
||||
a.removerow:hover{color:#c55; text-decoration: underline;}
|
||||
|
||||
label.jw_check_fields{margin-left: 5px; min-width: 128px; display: block; float: left;}
|
||||
label.jw_radio_fields{display: block; width: 225px;}
|
||||
|
||||
table.dataArrayFields thead td{text-align: center;}
|
||||
.form-table td{padding: 4px 5px;}
|
||||
|
||||
/* Color Picker */
|
||||
.sp-replacer{margin-right: 10px;}
|
477
lib/jw_simple_options/css/spectrum.css
Normal file
477
lib/jw_simple_options/css/spectrum.css
Normal file
@ -0,0 +1,477 @@
|
||||
/***
|
||||
Spectrum Colorpicker v1.0.9
|
||||
https://github.com/bgrins/spectrum
|
||||
Author: Brian Grinstead
|
||||
License: MIT
|
||||
***/
|
||||
|
||||
.sp-container {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
display:inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
z-index: 2147483647;
|
||||
overflow: hidden;
|
||||
}
|
||||
.sp-container.sp-flat {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
|
||||
.sp-top {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
display:inline-block;
|
||||
}
|
||||
.sp-top-inner {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:0;
|
||||
}
|
||||
.sp-color {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
bottom:0;
|
||||
right:20%;
|
||||
}
|
||||
.sp-hue {
|
||||
position: absolute;
|
||||
top:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
left:84%;
|
||||
height: 100%;
|
||||
}
|
||||
.sp-fill {
|
||||
padding-top: 80%;
|
||||
}
|
||||
.sp-sat, .sp-val {
|
||||
position: absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
.sp-alpha-enabled .sp-top
|
||||
{
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.sp-alpha-enabled .sp-alpha
|
||||
{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.sp-alpha-handle
|
||||
{
|
||||
position:absolute;
|
||||
top:-4px;
|
||||
bottom: -4px;
|
||||
width: 6px;
|
||||
left: 50%;
|
||||
cursor: pointer;
|
||||
border: 1px solid black;
|
||||
background: white;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
.sp-alpha
|
||||
{
|
||||
display: none;
|
||||
position: absolute;
|
||||
bottom: -14px;
|
||||
right: 0;
|
||||
left: 0;
|
||||
height: 8px;
|
||||
}
|
||||
.sp-alpha-inner{
|
||||
border: solid 1px #333;
|
||||
}
|
||||
|
||||
/* Don't allow text selection */
|
||||
.sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
|
||||
-webkit-user-select:none;
|
||||
-moz-user-select: -moz-none;
|
||||
-o-user-select:none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sp-container.sp-input-disabled .sp-input-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-container.sp-buttons-disabled .sp-button-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-palette-only .sp-picker-container {
|
||||
display: none;
|
||||
}
|
||||
.sp-palette-disabled .sp-palette-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sp-initial-disabled .sp-initial {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
|
||||
.sp-sat {
|
||||
background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
|
||||
background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
|
||||
background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
|
||||
background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
|
||||
filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
|
||||
}
|
||||
.sp-val {
|
||||
background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
|
||||
background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
|
||||
background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
|
||||
background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
|
||||
filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
|
||||
}
|
||||
|
||||
.sp-hue {
|
||||
background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
|
||||
background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
|
||||
}
|
||||
|
||||
/* IE filters do not support multiple color stops.
|
||||
Generate 6 divs, line them up, and do two color gradients for each.
|
||||
Yes, really.
|
||||
*/
|
||||
|
||||
.sp-1 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
|
||||
}
|
||||
.sp-2 {
|
||||
height:16%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
|
||||
}
|
||||
.sp-3 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
|
||||
}
|
||||
.sp-4 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
|
||||
}
|
||||
.sp-5 {
|
||||
height:16%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
|
||||
}
|
||||
.sp-6 {
|
||||
height:17%;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
|
||||
}
|
||||
|
||||
/* Clearfix hack */
|
||||
.sp-cf:before, .sp-cf:after { content: ""; display: table; }
|
||||
.sp-cf:after { clear: both; }
|
||||
.sp-cf { *zoom: 1; }
|
||||
|
||||
/* Mobile devices, make hue slider bigger so it is easier to slide */
|
||||
@media (max-device-width: 480px) {
|
||||
.sp-color { right: 40%; }
|
||||
.sp-hue { left: 63%; }
|
||||
.sp-fill { padding-top: 60%; }
|
||||
}
|
||||
|
||||
.sp-dragger {
|
||||
border-radius: 5px;
|
||||
height: 5px;
|
||||
width: 5px;
|
||||
border: 1px solid #fff;
|
||||
background: #000;
|
||||
cursor: pointer;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left: 0;
|
||||
}
|
||||
.sp-slider {
|
||||
position: absolute;
|
||||
top:0;
|
||||
cursor:pointer;
|
||||
height: 3px;
|
||||
left: -1px;
|
||||
right: -1px;
|
||||
border: 1px solid #000;
|
||||
background: white;
|
||||
opacity: .8;
|
||||
}
|
||||
|
||||
/* Basic display options (colors, fonts, global widths) */
|
||||
.sp-container {
|
||||
border-radius: 0;
|
||||
background-color: #ECECEC;
|
||||
border: solid 1px #f0c49B;
|
||||
padding: 0;
|
||||
}
|
||||
.sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue
|
||||
{
|
||||
font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.sp-top
|
||||
{
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.sp-color, .sp-hue
|
||||
{
|
||||
border: solid 1px #666;
|
||||
}
|
||||
|
||||
/* Input */
|
||||
.sp-input-container {
|
||||
float:right;
|
||||
width: 100px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sp-initial-disabled .sp-input-container {
|
||||
width: 100%;
|
||||
}
|
||||
.sp-input {
|
||||
font-size: 12px !important;
|
||||
border: 1px inset;
|
||||
padding: 4px 5px;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
background:transparent;
|
||||
border-radius: 3px;
|
||||
color: #222;
|
||||
}
|
||||
.sp-input:focus {
|
||||
border: 1px solid orange;
|
||||
}
|
||||
.sp-input.sp-validation-error
|
||||
{
|
||||
border: 1px solid red;
|
||||
background: #fdd;
|
||||
}
|
||||
.sp-picker-container , .sp-palette-container
|
||||
{
|
||||
float:left;
|
||||
position: relative;
|
||||
padding: 10px;
|
||||
padding-bottom: 300px;
|
||||
margin-bottom: -290px;
|
||||
}
|
||||
.sp-picker-container
|
||||
{
|
||||
width: 172px;
|
||||
border-left: solid 1px #fff;
|
||||
}
|
||||
|
||||
/* Palettes */
|
||||
.sp-palette-container
|
||||
{
|
||||
border-right: solid 1px #ccc;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-el {
|
||||
display: block;
|
||||
position:relative;
|
||||
float:left;
|
||||
width: 24px;
|
||||
height: 15px;
|
||||
margin: 3px;
|
||||
cursor: pointer;
|
||||
border:solid 2px transparent;
|
||||
}
|
||||
.sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
|
||||
border-color: orange;
|
||||
}
|
||||
.sp-thumb-el
|
||||
{
|
||||
position:relative;
|
||||
}
|
||||
|
||||
/* Initial */
|
||||
.sp-initial
|
||||
{
|
||||
float: left;
|
||||
border: solid 1px #333;
|
||||
}
|
||||
.sp-initial span {
|
||||
width: 30px;
|
||||
height: 25px;
|
||||
border:none;
|
||||
display:block;
|
||||
float:left;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.sp-button-container {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Replacer (the little preview div that shows up instead of the <input>) */
|
||||
.sp-replacer {
|
||||
margin:0;
|
||||
overflow:hidden;
|
||||
cursor:pointer;
|
||||
padding: 4px;
|
||||
display:inline-block;
|
||||
*zoom: 1;
|
||||
*display: inline;
|
||||
border: solid 1px #91765d;
|
||||
background: #eee;
|
||||
color: #333;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.sp-replacer:hover, .sp-replacer.sp-active {
|
||||
border-color: #F0C49B;
|
||||
color: #111;
|
||||
}
|
||||
.sp-replacer.sp-disabled {
|
||||
cursor:default;
|
||||
border-color: silver;
|
||||
color: silver;
|
||||
}
|
||||
.sp-dd {
|
||||
padding: 2px 0;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
float:left;
|
||||
font-size:10px;
|
||||
}
|
||||
.sp-preview
|
||||
{
|
||||
position:relative;
|
||||
width:25px;
|
||||
height: 20px;
|
||||
border: solid 1px #222;
|
||||
margin-right: 5px;
|
||||
float:left;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.sp-palette
|
||||
{
|
||||
*width: 220px;
|
||||
max-width: 220px;
|
||||
}
|
||||
.sp-palette .sp-thumb-el
|
||||
{
|
||||
width:16px;
|
||||
height: 16px;
|
||||
margin:2px 1px;
|
||||
border: solid 1px #d0d0d0;
|
||||
}
|
||||
|
||||
.sp-container
|
||||
{
|
||||
padding-bottom:0;
|
||||
}
|
||||
|
||||
|
||||
/* Buttons: http://hellohappy.org/css3-buttons/ */
|
||||
.sp-container button {
|
||||
background-color: #eeeeee;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
|
||||
background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
|
||||
border: 1px solid #ccc;
|
||||
border-bottom: 1px solid #bbb;
|
||||
border-radius: 3px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
padding: 5px 4px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #eee;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.sp-container button:hover {
|
||||
background-color: #dddddd;
|
||||
background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
|
||||
background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
|
||||
border: 1px solid #bbb;
|
||||
border-bottom: 1px solid #999;
|
||||
cursor: pointer;
|
||||
text-shadow: 0 1px 0 #ddd;
|
||||
}
|
||||
.sp-container button:active {
|
||||
border: 1px solid #aaa;
|
||||
border-bottom: 1px solid #888;
|
||||
-webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
-o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
|
||||
}
|
||||
.sp-cancel
|
||||
{
|
||||
font-size: 11px;
|
||||
color: #d93f3f !important;
|
||||
margin:0;
|
||||
padding:2px;
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
text-decoration:none;
|
||||
|
||||
}
|
||||
.sp-cancel:hover
|
||||
{
|
||||
color: #d93f3f !important;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
.sp-palette span:hover, .sp-palette span.sp-thumb-active
|
||||
{
|
||||
border-color: #000;
|
||||
}
|
||||
|
||||
.sp-preview, .sp-alpha, .sp-thumb-el
|
||||
{
|
||||
position:relative;
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
|
||||
}
|
||||
.sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner
|
||||
{
|
||||
display:block;
|
||||
position:absolute;
|
||||
top:0;left:0;bottom:0;right:0;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-inner
|
||||
{
|
||||
background-position: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner
|
||||
{
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
|
||||
}
|
||||
|
||||
.sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner
|
||||
{
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
|
||||
}
|
84
lib/jw_simple_options/js/jquery.jw_simple_options.js
Normal file
84
lib/jw_simple_options/js/jquery.jw_simple_options.js
Normal file
@ -0,0 +1,84 @@
|
||||
/* Javascript Document */
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
var addRow = $('.addrow');
|
||||
var delRow = $('.removerow');
|
||||
|
||||
addRow.click(function(e){
|
||||
var theID = $(this).attr('data_id');
|
||||
var curBlock = $('table#'+theID+' tbody');
|
||||
var curNum = curBlock.children('tr').length;
|
||||
var newRow = $('.data_row.'+theID).last().clone(true);
|
||||
|
||||
newRow.attr('id', 'data_row_'+(curNum+1));
|
||||
newRow.children('td').each(function(index){
|
||||
if( $(this).has('input') ){
|
||||
var name = $(this).children('input').first().attr('name');
|
||||
if(name != undefined){
|
||||
var nName = name.replace(/\[[0-9]\]/, '['+curNum+1+']');
|
||||
//console.log(nName);
|
||||
}
|
||||
$(this).children('input').first().attr('name', nName);
|
||||
$(this).children('input').first().attr('value', '');
|
||||
$(this).children('.removerow').attr('id', (curNum+1));
|
||||
$(this).children('.removerow').addClass(theID);
|
||||
}
|
||||
});
|
||||
|
||||
curBlock.append(newRow);
|
||||
});
|
||||
|
||||
|
||||
delRow.click(function(e){
|
||||
var id = $(this).attr('id');
|
||||
var blockID = $(this).attr('curBlock');
|
||||
var curBlock = $('table#'+blockID+' tbody');
|
||||
var len = curBlock.children('tr').length;
|
||||
console.log(len);
|
||||
if( len != 1 ){
|
||||
$('#data_row_'+id+'.'+blockID).fadeOut(250,function(e){
|
||||
$('#data_row_'+id+'.'+blockID).remove();
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('.color_select').spectrum({
|
||||
showButtons: false,
|
||||
showInput: true,
|
||||
preferredFormat: "hex6"
|
||||
});
|
||||
|
||||
// Uploading files
|
||||
var file_frame, uploadID;
|
||||
|
||||
$('.upload_image_button').live('click', function( event ){
|
||||
event.preventDefault();
|
||||
uploadID = $(this).attr('data-id');
|
||||
console.log(event);
|
||||
|
||||
if ( file_frame ) {
|
||||
file_frame.open();
|
||||
return;
|
||||
}
|
||||
|
||||
file_frame = wp.media.frames.file_frame = wp.media({
|
||||
title: jQuery( this ).data( 'uploader_title' ),
|
||||
button: {
|
||||
text: jQuery( this ).data( 'uploader_button_text' ),
|
||||
},
|
||||
multiple: false
|
||||
});
|
||||
|
||||
file_frame.on( 'select', function() {
|
||||
attachment = file_frame.state().get('selection').first().toJSON();
|
||||
|
||||
$('#'+uploadID).val(attachment.url);
|
||||
});
|
||||
|
||||
file_frame.open();
|
||||
});
|
||||
//END UPLOAD FUNCTIONS
|
||||
|
||||
|
||||
|
||||
});
|
1749
lib/jw_simple_options/js/spectrum.js
Normal file
1749
lib/jw_simple_options/js/spectrum.js
Normal file
File diff suppressed because it is too large
Load Diff
504
lib/jw_simple_options/simple_options.php
Normal file
504
lib/jw_simple_options/simple_options.php
Normal file
@ -0,0 +1,504 @@
|
||||
<?
|
||||
/**********************************************************************************
|
||||
JW Simple Options
|
||||
Author: Jerry Wood Jr.
|
||||
Email: jay@plugish.com
|
||||
WWW: http://plugish.com
|
||||
|
||||
This sofware is provided free of charge. I use this in my own projects and
|
||||
it's ideal for small options pages when you don't feel like writing the
|
||||
HTML to accompany it. This work is Licensed under the Creative Commons
|
||||
Attribution Share-Alike 3.0 License. All I ask, is you don't sell the
|
||||
software as is. You're more than welcome to include it in a package
|
||||
as long as you give the appropriate credit.
|
||||
**********************************************************************************/
|
||||
|
||||
class JW_SIMPLE_OPTIONS{
|
||||
|
||||
/**
|
||||
* @access private
|
||||
* @var string Class version number.
|
||||
*/
|
||||
private $ver = '1.1';
|
||||
|
||||
/**
|
||||
* @access private
|
||||
* @var array() A map of the options data.
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* Location of the plugin/theme menu.
|
||||
*
|
||||
* Accepts: page, link, comment, management, option, theme, plugin, user, dashboard, post, or media.
|
||||
* @access private
|
||||
* @var string Default: 'new'
|
||||
*/
|
||||
private $menu_type = 'new';
|
||||
|
||||
/**
|
||||
* Used in options saving/gathering and menu data.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: 'jw_'
|
||||
*/
|
||||
private $prefix = 'jw_';
|
||||
|
||||
/**
|
||||
* Reader friendly menu name.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: 'JW Options'
|
||||
*/
|
||||
private $menu_title = 'JW Options';
|
||||
|
||||
/**
|
||||
* Capability needed by users to see this menu.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: manage_options
|
||||
* @see add_menu_page()
|
||||
*/
|
||||
private $cap = 'manage_options';
|
||||
|
||||
/**
|
||||
* URL friendly name of the menu, ie. 'options_page'
|
||||
*
|
||||
* Will be prefixed by prefix variable.
|
||||
* @access private
|
||||
* @var string Default: 'options_page'
|
||||
*/
|
||||
private $slug = 'options_page';
|
||||
|
||||
/**
|
||||
* Icon of the top-level menu. Absolute URL.
|
||||
*
|
||||
* @access private
|
||||
* @var string Default: NULL
|
||||
*/
|
||||
private $icon = NULL;
|
||||
|
||||
/**
|
||||
* Menu position of the top-level menu. Used only if menu_type is 'new'.
|
||||
*
|
||||
* @access private
|
||||
* @var integer Default: NULL
|
||||
*/
|
||||
private $pos = NULL;
|
||||
|
||||
/**
|
||||
* Used in menu pages and throughout the plugin
|
||||
*
|
||||
* @access private
|
||||
* @var string Defaults to "JW Options Panel"
|
||||
*/
|
||||
private $plugin_title = 'JW Options Panel';
|
||||
|
||||
/**
|
||||
* Used in menu generation and hooks.
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $hook;
|
||||
|
||||
function JW_SIMPLE_OPTIONS($ops){
|
||||
$this->__construct($ops);
|
||||
}
|
||||
|
||||
function __construct(array $ops){
|
||||
// Setup variables
|
||||
$this->plugin_title = empty($ops['plugin_title']) ? $this->plugin_title : $ops['plugin_title'];
|
||||
$this->menu_title = empty($ops['menu_title']) ? $this->menu_title : $ops['menu_title'];
|
||||
$this->cap = empty($ops['capability']) ? $this->cap : $ops['capability'];
|
||||
$this->slug = empty($ops['slug']) ? $this->prefix.$this->slug : $ops['slug'];
|
||||
$this->options = empty($ops['opData']) ? $this->options : $ops['opData'];
|
||||
$this->icon = empty($ops['icon_url']) ? $this->icon : $ops['icon_url'];
|
||||
$this->pos = empty($ops['menu_pos']) ? $this->pos : $ops['menu_pos'];
|
||||
$this->prefix = empty($ops['prefix']) ? $this->prefix : $ops['prefix'];
|
||||
|
||||
add_action('admin_init', array(&$this, 'register_admin_deps') );
|
||||
add_action('admin_menu', array(&$this, 'load_admin_menu') );
|
||||
add_action('admin_enqueue_scripts', array(&$this, 'load_admin_deps') );
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of check boxes.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of data to display.
|
||||
*/
|
||||
public function buildCheckFields($key, $data, $def = false){
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
?>
|
||||
<fieldset>
|
||||
<? foreach($data as $k => $v): ?>
|
||||
<label for="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" class="jw_check_fields">
|
||||
<input id="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" type="checkbox" name="<? echo $this->prefix.$key; ?>[]" <? $this->jop_checked($opData, $k, true); ?> value="<? echo $k; ?>"/> <? echo $v; ?>
|
||||
</label>
|
||||
<? endforeach; ?>
|
||||
</fieldset>
|
||||
<?
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of data, comparable to a matrix.
|
||||
*
|
||||
* Also provides neat javascript functionality such as adding/removing rows.
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $fields A regular array of data identifiers, ie. array('field1', 'field2').
|
||||
*/
|
||||
public function buildDataArrayFields($key, $fields, $showhead = false){
|
||||
$opData = get_option($this->prefix.$key);
|
||||
?>
|
||||
<a href="javascript:;" class="addrow" data_id="<? echo $key; ?>">[+] Add Row</a>
|
||||
<table class="dataArrayFields" id="<? echo $key; ?>">
|
||||
<? $rowBase = 1; ?>
|
||||
<? if($showhead): ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<? foreach($fields as $k => $v): ?>
|
||||
<td><? echo $v; ?></td>
|
||||
<? endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<? endif; ?>
|
||||
<? if(!empty($opData) && is_array($opData)) :?>
|
||||
<? foreach ($opData as $row): ?>
|
||||
<tr id="data_row_<? echo $rowBase; ?>" class="data_row <? echo $key; ?>">
|
||||
<? foreach ($fields as $colName => $colLabel): ?>
|
||||
<td class="data_col <? echo $colName; ?>"><input type="text" name="<? echo $this->prefix.$key ?>[<? echo $rowBase; ?>][<? echo $colName; ?>]" value="<? echo $row[$colName]; ?>"/></td>
|
||||
<? endforeach; ?>
|
||||
<td><a href="javascript:;" id="<? echo $rowBase; ?>" class="removerow" curBlock="<? echo $key; ?>">[X]</a></td>
|
||||
</tr>
|
||||
<? $rowBase++; ?>
|
||||
<? endforeach; ?>
|
||||
<? else: ?>
|
||||
<tr id="data_row_<? echo $rowBase; ?>" class="data_row <? echo $key; ?>">
|
||||
<? foreach ($fields as $colName => $colLabel): ?>
|
||||
<td class="data_col <? echo $colName; ?>"><input type="text" name="<? echo $this->prefix.$key ?>[<? echo $rowBase; ?>][<? echo $colName; ?>]" /></td>
|
||||
<? endforeach; ?>
|
||||
<td><a href="javascript:;" id="<? echo $rowBase; ?>" class="removerow <? echo $key; ?>" curBlock="<? echo $key; ?>">[X]</a></td>
|
||||
</tr>
|
||||
<? endif; ?>
|
||||
</table>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* WordPress 3.5 media upload functionality.
|
||||
*
|
||||
* @param string Option identifier minus prefix.
|
||||
*/
|
||||
public function buildMediaOption($key){
|
||||
|
||||
$opData = get_option($this->prefix.$key);
|
||||
|
||||
$output = '<div class="uploader">';
|
||||
$output .= '<input type="text" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" class="regular-text" value="'.$opData.'" />';
|
||||
$output .= '<input type="button" id="'.$this->prefix.$key.'_upload" value="Upload" class="button upload_image_button" data-id="'.$this->prefix.$key.'" />';
|
||||
$output .= '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an array of radio buttons.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of data to display.
|
||||
* @param boolean $def If not false, provide a default value if no option exists.
|
||||
*/
|
||||
public function buildRadioFields($key, $data, $def = false){
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
?>
|
||||
<fieldset>
|
||||
<? foreach($data as $k => $v): ?>
|
||||
<label for="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" class="jw_radio_fields">
|
||||
<input id="<? echo $this->prefix.$key; ?>_<? echo $k; ?>" type="radio" name="<? echo $this->prefix.$key; ?>" <? checked($opData, $k, true); ?> value="<? echo $k; ?>"/> <? echo $v; ?>
|
||||
</label>
|
||||
<? endforeach; ?>
|
||||
</fieldset>
|
||||
<?
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds dropdown menu.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of data to display.
|
||||
* @param boolean $def If not false, provide a default value if no option exists.
|
||||
*/
|
||||
public function buildSelectOptions($key, $data, $def = false){
|
||||
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
|
||||
$output = '<select name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'">';
|
||||
foreach($data as $k => $v){
|
||||
$output .= '<option value="'.$k.'" '.selected($opData, $k, false).'>'.$v.'</option>';
|
||||
}
|
||||
$output .= '</select>';
|
||||
$output .= '<!-- '.print_r($opData, true).'-->';
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
/**
|
||||
* Builds a timeframe selection that consists of one text input, and one dropdown.
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param mixed $def If not false, provide a default value if no option exists.
|
||||
*/
|
||||
public function buildTimeframe($key, $def = false){
|
||||
// Should be two fields, one input text, one dropdown.
|
||||
$opData = get_option($this->prefix.$key, $def);
|
||||
|
||||
if(empty($opData['multiplier'])) $opData['mulitplier'] = $def['multiplier'];
|
||||
if(empty($opData['time'])) $opData['time'] = $def['time'];
|
||||
|
||||
?>
|
||||
<input type="text" name="<? echo $this->prefix.$key; ?>[multiplier]" value="<? echo $opData['multiplier']; ?>" class="jw_multiplier"/><select name="<? echo $this->prefix.$key; ?>[time]">
|
||||
<option value="60" <? selected($opData['time'], 60, true); ?>>Minutes</option>
|
||||
<option value="<? echo 60*60; ?>" <? selected($opData['time'], 60*60, true); ?>>Hours</option>
|
||||
<option value="<? echo 60*60*24; ?>" <? selected($opData['time'], 60*60*24, true); ?>>Days</option>
|
||||
<option value="<? echo 60*60*24*30; ?>" <? selected($opData['time'], 60*60*24*30, true); ?>>Months</option>
|
||||
<option value="<? echo 60*60*24*365; ?>" <? selected($opData['time'], 60*60*24*365, true); ?>>Years</option>
|
||||
</select>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom Checked
|
||||
*
|
||||
* Allows using arrays in checked variables
|
||||
* @return boolean
|
||||
*/
|
||||
function jop_checked($haystack, $cur, $show = FALSE){
|
||||
if(is_array($haystack) && in_array($cur, $haystack)){
|
||||
$cur = $haystack = 1;
|
||||
}
|
||||
return checked($haystack, $cur, $show);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the admin menu with user-defined flags.
|
||||
*/
|
||||
function load_admin_menu(){
|
||||
switch($this->menu_type){
|
||||
case 'page':
|
||||
$hook = add_pages_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'link':
|
||||
$hook = add_links_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'comment':
|
||||
$hook = add_comments_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'management':
|
||||
$hook = add_management_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'option':
|
||||
$hook = add_options_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'theme':
|
||||
$hook = add_theme_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'plugin':
|
||||
$hook = add_plugins_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'user':
|
||||
$hook = add_users_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'dashboard':
|
||||
$hook = add_dashboard_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'post':
|
||||
$hook = add_posts_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
case 'media':
|
||||
$hook = add_media_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'));
|
||||
break;
|
||||
default:
|
||||
$hook = add_menu_page($this->plugin_title, $this->menu_title, $this->cap, $this->slug, array(&$this, 'render_options_page'), $this->icon, $this->menu_pos);
|
||||
break;
|
||||
}
|
||||
$this->hook = $hook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load up admin dependancies for functionality
|
||||
*/
|
||||
public function load_admin_deps($hook = false){
|
||||
if($hook == $this->hook && $hook != false){
|
||||
|
||||
if(function_exists('wp_enqueue_media')) wp_enqueue_media();
|
||||
|
||||
wp_enqueue_style('spectrum');
|
||||
wp_enqueue_script('spectrum');
|
||||
|
||||
wp_enqueue_style($this->prefix.'admin_css');
|
||||
wp_enqueue_script($this->prefix.'admin_js');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registering Admin information.
|
||||
*/
|
||||
public function register_admin_deps(){
|
||||
foreach($this->options as $k => $v) register_setting($this->prefix.'options', $this->prefix.$k);
|
||||
|
||||
|
||||
if(preg_match('/\/themes\//i', $this->file_data)){
|
||||
$type = 'theme';
|
||||
}elseif(preg_match('/\/plugins\//i', $this->file_data)){
|
||||
$type = 'plugin';
|
||||
}
|
||||
|
||||
if('theme' == $type){
|
||||
$stylesheetDir = get_bloginfo('stylesheet_directory');
|
||||
$urls = array(
|
||||
$stylesheetDir.'/'.basename( dirname( dirname(__FILE__) ) ).'/jw-simple-options/css',
|
||||
$stylesheetDir.'/'.basename( dirname( dirname(__FILE__) ) ).'/jw-simple-options/js',
|
||||
);
|
||||
}else{
|
||||
$urls = array(
|
||||
'css' => plugins_url('css', __FILE__),
|
||||
'js' => plugins_url('js', __FILE__)
|
||||
);
|
||||
}
|
||||
|
||||
wp_register_style('spectrum', $urls['css'].'/spectrum.css', '', '1.0.9');
|
||||
wp_register_script('spectrum', $urls['js'].'/spectrum.js', array('jquery'), '1.0.9' );
|
||||
|
||||
wp_register_style( $this->prefix.'admin_css', $urls['css'].'/jw_simple_options.css', '', '1.0');
|
||||
wp_register_script( $this->prefix.'admin_js', $urls['js'].'/jquery.jw_simple_options.js' , '', '1.0');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display user-end options page
|
||||
*/
|
||||
public function render_options_page(){
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div id="icon-options-general" class="icon32"><br /></div>
|
||||
<h2><? echo $this->plugin_title; ?></h2>
|
||||
<p class="description">Options page powered by: <a href="https://github.com/JayWood/jw_simple_options" title="A simple, easy to configure, flexible, and open-source framework to make options pages on the fly.">JW Simple Options</a></p>
|
||||
<form method="post" action="options.php">
|
||||
<? settings_fields($this->prefix.'options'); ?>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<?
|
||||
foreach ($this->options as $k => $v){
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row"><label for="<? echo $this->prefix.$k; ?>"><? echo $v['name']; ?></label></th>
|
||||
<td><? echo $this->render_option_field($k, $v); ?>
|
||||
<? if( isset( $v['desc'] ) ): ?>
|
||||
<p class="description"><? echo $v['desc']; ?></p>
|
||||
<? endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Spectrum color selection
|
||||
*
|
||||
* @param string $key Option identifier minus prefix.
|
||||
* @param array $data Associative array of field data with value in hex6 format. ie. array('colorID' => '#FFFFFF')
|
||||
*/
|
||||
public function render_color_select($key, $data){
|
||||
|
||||
$opData = get_option($this->prefix.$key, $data);
|
||||
|
||||
$output = '<!-- Color Selects -->';
|
||||
foreach($opData as $k => $v){
|
||||
$output .= '<input type="text" id="'.$key.'_'.$k.'" name="'.$this->prefix.$key.'['.$k.']" value="'.$v.'" class="color_select">';
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch between options data types and display them.
|
||||
*
|
||||
* Offload rendering where necessary.
|
||||
*/
|
||||
public function render_option_field($key, $data){
|
||||
switch($data['type']){
|
||||
case 'text':
|
||||
$output = '<input type="text" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" value="'.get_option($this->prefix.$key, $data['def']).'" class="regular-text" />';
|
||||
break;
|
||||
case 'password':
|
||||
$output = '<input type="password" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" value="'.get_option($this->prefix.$key).'" class="regular-text" />';
|
||||
break;
|
||||
case 'number':
|
||||
$output = '<input type="number" name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" value="'.get_option($this->prefix.$key, $data['def']).'" />';
|
||||
break;
|
||||
case 'data_array':
|
||||
$output = $this->buildDataArrayFields($key, $data['fields'], $data['showhead']);
|
||||
break;
|
||||
case 'select':
|
||||
$output = $this->buildSelectOptions($key, $data['fields'], $data['def']);
|
||||
break;
|
||||
case 'color':
|
||||
$output = $this->render_color_select($key, $data['fields']);
|
||||
break;
|
||||
case 'media':
|
||||
if(function_exists('wp_enqueue_media')) $output = $this->buildMediaOption($key);
|
||||
break;
|
||||
case 'check':
|
||||
$output = $this->buildCheckFields($key, $data['fields'], $data['def']);
|
||||
break;
|
||||
case 'radio':
|
||||
$output = $this->buildRadioFields($key, $data['fields'], $data['def']);
|
||||
break;
|
||||
case 'textbox':
|
||||
$output = '<textarea name="'.$this->prefix.$key.'" id="'.$this->prefix.$key.'" rows="10" cols="50" class="large-text code" >'.get_option($this->prefix.$key, $data['def']).'</textarea>';
|
||||
break;
|
||||
case 'timeframe':
|
||||
$output = $this->buildTimeframe($key, $data['def']);
|
||||
break;
|
||||
case 'editor':
|
||||
$opData = get_option($this->prefix.$key, $data['def']);
|
||||
$output = wp_editor($opData, $this->prefix.$key, $data['settings']);
|
||||
default:
|
||||
$output = '<!-- Option ID: '.$key.'.'.$data['type'].' is not a valid option type. -->';
|
||||
break;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstalls any options.
|
||||
*
|
||||
* Needs to be called from functions.php
|
||||
* @see register_uninstall_hook()
|
||||
*/
|
||||
public function uninstall(){
|
||||
if( !defined( 'WP_UNINSTALL_PLUGIN' ) ) return false;
|
||||
// Remove options
|
||||
foreach ($this->options as $k => $v) delete_option($this->prefix.$k);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user