Commit a90242e0 authored by Varun Sridharan's avatar Varun Sridharan
parent fedef0a4
<?php
/**
* Format an options array into HTML
* This class has been deprecated
*
* @author Matt Gates <http://mgates.me>
* @package WordPress
*/
if ( !class_exists( 'WooCommerce_Quick_Donation_Format_Options' ) ) {
class WooCommerce_Quick_Donation_Format_Options extends WooCommerce_Quick_Donation_Settings_API
{
/**
* Format an option array into HTML
*
*
* @access public
*
* @param unknown $setting
*
* @return string HTML.
*/
public function settings_options_format( $setting )
{
if ( empty( $setting ) ) return false;
$defaults = apply_filters( $this->id . '_options_defaults', array(
'name' => '',
'desc' => '',
'placeholder' => '',
'class' => '',
'tip' => '',
'id' => '',
'css' => '',
'type' => 'text',
'std' => '',
'select2' => false,
'multiple' => false,
'options' => array(),
'restrict' => array(),
'settings' => array()
) );
// Each to it's own variable for slim-ness' sakes.
$setting = shortcode_atts( $defaults, $setting );
$restrict_defaults = array(
'min' => 0,
'max' => '',
'step' => 'any',
);
$setting[ 'restrict' ] = shortcode_atts( $restrict_defaults, $setting[ 'restrict' ] );
$setting[ 'value' ] = $this->get_option( $setting[ 'id' ] );
$setting[ 'value' ] = $setting[ 'value' ] !== false ? maybe_unserialize( $setting[ 'value' ] ) : false;
$setting[ 'value' ] = WooCommerce_Quick_Donation_Format_Options::sanitize_value( $setting[ 'value' ], $setting );
$setting[ 'title' ] = $setting[ 'name' ];
$setting[ 'name' ] = $this->id . "_options[{$setting['id']}]";
$setting[ 'grouped' ] = !$setting[ 'title' ] ? ' style="padding-top:0px;"' : '';
$setting[ 'tip' ] = WooCommerce_Quick_Donation_Format_Options::get_formatted_tip( $setting[ 'tip' ] );
$header_types = apply_filters( $this->id . '_options_header_types', array( 'heading', 'title' ) );
extract( $setting );
$description = $desc && !$grouped && $type != 'checkbox'
? ' <small>' . $desc . '</small>'
: '<label for="' . $id . '"> ' . $desc . '</label>';
$description = ( ( in_array( $type, $header_types ) || $type == 'radio' ) && !empty( $desc ) )
? '<p>' . $desc . '</p>'
: $description;
?>
<?php if ( !in_array( $type, $header_types ) ) : ?>
<!-- Header of the option. -->
<tr valign="top">
<th scope="row"<?php echo $grouped; ?>>
<?php echo $tip; ?>
<?php if ( !$grouped ) : ?>
<label for="<?php echo $name; ?>" class="description"><?php echo $title; ?></label>
<?php endif; ?>
</th>
<td <?php echo $grouped; ?> >
<?php endif; ?>
<?php foreach ( $header_types as $header ) :
if ( $type != $header ) continue; ?>
<tr>
<th scope="col" colspan="2">
<h3 class="title"><?php echo $title; ?></h3>
<?php echo $description; ?>
</th>
</tr>
<?php endforeach; ?>
<?php switch ( $type ) :
case 'text' :
case 'color' :
case 'number' :
if ( $type == 'color' ) {
$type = 'text';
$class .= ' colorpick';
$description .= '<div id="colorPickerDiv_' . $id . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
}
?>
<input name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
type="<?php echo $type; ?>"
<?php if ( $type == 'number' ): ?>
min="<?php echo $restrict[ 'min' ]; ?>"
max="<?php echo $restrict[ 'max' ]; ?>"
step="<?php echo $restrict[ 'step' ]; ?>"
<?php endif; ?>
class="regular-text <?php echo $class; ?>"
style="<?php echo $css; ?>"
placeholder="<?php echo $placeholder; ?>"
value="<?php echo $value !== false ? $value : $std; ?>"
/>
<?php echo $description;
break;
case 'checkbox':
$selected = ( $value !== false ) ? $value : $std;
if ( $multiple ) :
foreach ( $options as $key => $desc ) : ?>
<input name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
id="<?php echo $id . '_' . $key; ?>"
type="checkbox"
class="<?php echo $class; ?>"
style="<?php echo $css; ?>"
value="<?php echo $key; ?>"
<?php self::checked( $value, $key ); ?>
/>
<label for="<?php echo $id . '_' . $key; ?>">
<?php echo $desc; ?>
</label>
<br/>
<?php
endforeach;
else : ?>
<input name="<?php echo $name; ?>"
id="<?php echo $id ?>"
type="checkbox"
class="<?php echo $class; ?>"
style="<?php echo $css; ?>"
<?php checked( $selected, 1 ); ?>
/>
<?php echo $description;
endif;
break;
case 'radio':
$selected = ( $value !== false ) ? $value : $std;
foreach ( $options as $key => $val ) : ?>
<label class="radio">
<input type="radio"
name="<?php echo $name; ?>"
id="<?php echo $key; ?>"
value="<?php echo $key; ?>"
class="<?php echo $class; ?>"
<?php checked( $selected, $key ); ?>
/>
<?php echo $val; ?>
</label><br/>
<?php endforeach;
echo $description;
break;
case 'single_select_page':
$selected = ( $value !== false ) ? $value : $std;
$args = array(
'name' => $name,
'id' => $id,
'sort_order' => 'ASC',
'echo' => 0,
'selected' => $selected
);
echo str_replace( "'>", "'><option></option>", wp_dropdown_pages( $args ) );
echo $description;
if ( $select2 ) : ?>
<script type="text/javascript">jQuery(function () {
jQuery("#<?php echo $id; ?>").select2({ allowClear: true, placeholder: "<?php _e( 'Select a page...', 'geczy' ); ?>", width: '350px' });
});</script>
<?php endif;
break;
case 'select':
$selected = ( $value !== false ) ? $value : $std;
$options = apply_filters( $this->id . '_select_options', $options, $setting ); ?>
<select id="<?php echo $id; ?>"
class="<?php echo $class; ?>"
style="<?php echo $css; ?>"
name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
<?php echo $multiple ? 'multiple="multiple"' : ''; ?>>
<?php foreach ( $options as $key => $val ) : ?>
<option
value="<?php echo $key; ?>" <?php self::selected( $selected, $key ); ?>><?php echo $val; ?></option>
<?php endforeach; ?>
</select>
<?php echo $description;
if ( $select2 ) : ?>
<script type="text/javascript">jQuery(function () {
jQuery("#<?php echo $id; ?>").select2({ width: '350px' });
});</script>
<?php endif;
break;
case 'textarea':
?>
<textarea name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
class="large-text <?php echo $class; ?>"
style="<?php if ( $css ) echo $css; else echo 'width:300px;'; ?>"
placeholder="<?php echo $placeholder; ?>"
rows="3"
><?php echo ( $value !== false ) ? $value : $std; ?></textarea>
<?php echo $description;
break;
case 'wysiwyg':
wp_editor( $value, $id, array( 'textarea_name' => $name ) );
echo $description;
break;
default :
do_action( $this->id . '_options_type_' . $type, $setting );
break;
endswitch;
/* Footer of the option. */
if ( !in_array( $type, $header_types ) ) echo '</td></tr>';
}
/**
*
*
* @param unknown $haystack
* @param unknown $current
*/
private function selected( $haystack, $current )
{
if ( is_array( $haystack ) && in_array( $current, $haystack ) ) {
$current = $haystack = 1;
}
selected( $haystack, $current );
}
/**
*
*
* @param unknown $haystack
* @param unknown $current
*/
private function checked( $haystack, $current )
{
if ( is_array( $haystack ) && !empty( $haystack[ $current ] ) ) {
$current = $haystack = 1;
}
checked( $haystack, $current );
}
/**
* Format a tooltip given a string
*
* @param string $tip
*
* @return string
*/
private function get_formatted_tip( $tip )
{
return $tip ? sprintf( '<a href="#" title="%s" class="sf-tips" tabindex="99"></a>', $tip ) : '';
}
/**
*
*
* @param unknown $value
* @param unknown $setting
*
* @return unknown
*/
private function sanitize_value( $value, $setting )
{
if ( $value !== false && $setting[ 'type' ] != 'wysiwyg' ) {
if ( is_array( $value ) ) {
foreach ( $value as $key => $output ) {
$value[ $key ] = esc_attr( $output );
}
} else {
$value = esc_attr( $value );
}
}
return apply_filters( $this->id . '_options_sanitize_value', $value, $setting );
}
}
}
<?php
/**
* Sanitize filters
*
* @author Matt Gates <http://mgates.me>
* @package WordPress
*/
if ( !class_exists( 'WooCommerce_Quick_Donation_Sanitize' ) ) {
class WooCommerce_Quick_Donation_Sanitize
{
/**
* Hooks
*/
function __construct()
{
add_filter( 'geczy_sanitize_color', 'sanitize_text_field' );
add_filter( 'geczy_sanitize_text', 'sanitize_text_field' );
add_filter( 'geczy_sanitize_number', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_number_field' ) );
add_filter( 'geczy_sanitize_textarea', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_textarea' ) );
add_filter( 'geczy_sanitize_wysiwyg', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_wysiwyg' ) );
add_filter( 'geczy_sanitize_checkbox', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_checkbox' ), 10, 2 );
add_filter( 'geczy_sanitize_radio', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_enum' ), 10, 2 );
add_filter( 'geczy_sanitize_select', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_enum' ), 10, 2 );
add_filter( 'geczy_sanitize_single_select_page', array( 'WooCommerce_Quick_Donation_Sanitize', 'sanitize_select_pages' ), 10, 2 );
}
/**
* Numeric sanitization
*
* @param int $input
*
* @return int
*/
public static function sanitize_number_field( $input )
{
$output = is_numeric( $input ) ? (float) $input : false;
return $input;
}
/**
* Textarea sanitization
*
* @param string $input
*
* @return string
*/
public static function sanitize_textarea( $input )
{
global $allowedposttags;
$output = wp_kses( $input, $allowedposttags );
return $output;
}
/**
* WYSIWYG sanitization
*
* @param string $input
*
* @return string
*/
public static function sanitize_wysiwyg( $input )
{
return $input;
}
/**
* Checkbox sanitization
*
* @param int $input
* @param unknown $option
*
* @return int
*/
public static function sanitize_checkbox( $input, $option )
{
if ( !empty( $option[ 'multiple' ] ) ) {
$defaults = array_keys( $option[ 'options' ] );
foreach ( $defaults as $value ) {
if ( !is_array( $input ) ) {
$output[ $value ] = 0;
} else {
$output[ $value ] = in_array( $value, $input ) ? 1 : 0;
}
}
$output = serialize( $output );
} else {
$output = $input ? 1 : 0;
}
return $output;
}
/**
* Array sanitization
*
* @param unknown $input
* @param array $option
*
* @return bool
*/
public static function sanitize_enum( $input, $option )
{
$output = $input;
$sfs = new WooCommerce_Quick_Donation_Sanitize();
if ( is_array( $input ) ) {
foreach ( $input as $value ) {
if ( !$sfs->sanitize_enum( $value, $option ) ) {
$output = false;
break;
}
}
$output = $output ? serialize( $output ) : $output;
} else {
$output = array_key_exists( $input, $option[ 'options' ] ) ? $input : false;
}
return $output;
}
/**
* Select box for pages sanitize
*
* @param int $input
* @param int $option
*
* @return int
*/
public static function sanitize_select_pages( $input, $option )
{
$output = get_page( $input ) ? (int) $input : 0;
return $output;
}
}
}
<?php
/**
* WP-Simple-Settings-Framework
*
* Copyright (c) 2012 Matt Gates.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the names of the copyright holders nor the names of the
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* @subpackage WP-Simple-Settings-Framework
* @copyright 2012 Matt Gates.
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://mgates.me
* @version 1.1
* @author Matt Gates <info@mgates.me>
* @package WordPress
*/
if ( !class_exists( 'SF_Settings_API' ) ) {
class WooCommerce_Quick_Donation_Settings_API
{
private $data = array();
/**
* Init
*
* @param string $id
* @param string $title
* @param string $menu (optional)
* @param string $file
*/
public function __construct( $id, $title, $page_title, $menu = '', $file )
{
$this->assets_url = trailingslashit( plugins_url( 'assets/', dirname( __FILE__ ) ) );
$this->id = $id;
$this->title = $title;
$this->page_title = $page_title;
$this->menu = empty( $menu ) ? 'plugins.php' : $menu;
$this->file = $file;
$this->includes();
$this->actions();
}
// ==================================================================
//
// Getter and setter.
//
// ------------------------------------------------------------------
/**
* Setter
*
* @param unknown $name
* @param unknown $value
*/
public function __set( $name, $value )
{
if ( isset ( $this->data[ $name ] ) && is_array( $this->data[ $name ] ) ) {
$this->data[ $name ] = array_merge( $this->data[ $name ], $value );
} else {
$this->data[ $name ] = $value;
}
}
/**
* Getter
*
* @param unknown $name
*
* @return unknown
*/
public function __get( $name )
{
if ( array_key_exists( $name, $this->data ) ) {
return $this->data[ $name ];
}
return null;
}
/**
* Isset
*
* @param unknown $name
*
* @return unknown
*/
public function __isset( $name )
{
return isset( $this->data[ $name ] );
}
/**
* Unset
*
* @param unknown $name
*/
public function __unset( $name )
{
unset( $this->data[ $name ] );
}
/**
* Add a "Settings" link to the plugins.php page
*
* @param array $links
* @param array $file
*
* @return array
*/
public function add_settings_link( $links, $file )
{
$this_plugin = plugin_basename( $this->file );
$page = strpos( $this->menu, '.php' ) ? $this->menu : 'admin.php';
if ( $file == $this_plugin ) {
$settings_link = '<a href="' . $page . '?page=' . $this->id . '">' . __( 'Settings', 'geczy' ) . '</a>';
array_unshift( $links, $settings_link );
}
return $links;
}
// ==================================================================
//
// Begin initialization.
//
// ------------------------------------------------------------------
/**
* Core files
*/
private function includes()
{
require_once dirname( __FILE__ ) . '/class-sanitize.php';
require_once dirname( __FILE__ ) . '/class-format-options.php';
new WooCommerce_Quick_Donation_Sanitize;
}
/**
* Hooks
*/
private function actions()
{
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
add_action( 'admin_init', array( &$this, 'register_options' ) );
add_action( 'admin_menu', array( &$this, 'create_menu' ) );
add_filter( 'plugin_action_links', array( &$this, 'add_settings_link' ), 10, 2 );
}
/**
* Admin scripts and styles
*/
public function admin_enqueue_scripts()
{
wp_register_script( 'bootstrap-tooltip', WC_QD_JS. 'bootstrap-tooltip.js', array( 'jquery' ), '1.0' );
wp_register_script( 'select2', WC_QD_JS. 'select2/select2.min.js', array( 'jquery' ), '3.5.2' );
wp_register_script( 'sf-scripts', WC_QD_JS. 'sf-jquery.js', array( 'jquery' ), '1.0' );
wp_register_style( 'select2', WC_QD_JS. 'select2/select2.css' );
wp_register_style( 'sf-styles', WC_QD_CSS. 'sf-styles.css' );
}
/**
* Admin scripts and styles
*/
public function admin_print_scripts()
{
global $wp_version;
//Check wp version and load appropriate scripts for colorpicker.
if ( 3.5 <= $wp_version ) {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'wp-color-picker' );
} else {
wp_enqueue_style( 'farbtastic' );
wp_enqueue_script( 'farbtastic' );
}
wp_enqueue_script( 'bootstrap-tooltip' );
wp_enqueue_script( 'select2' );
wp_enqueue_script( 'sf-scripts' );
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_style( 'select2' );
wp_enqueue_style( 'sf-styles' );
}
/**
* Register setting
*/
public function register_options()
{
register_setting( $this->id . '_options_nonce', $this->id . '_options', array( &$this, 'validate_options' ) );
}
/**
* Create menu
*/
public function create_menu()
{
$page = add_submenu_page( $this->menu, $this->title, $this->title, apply_filters( $this->id . '_manage_options', 'manage_options' ), $this->id, array( &$this, 'init_settings_page' ) );
add_action( 'admin_print_scripts-' . $page, array( &$this, 'admin_print_scripts' ) );
}
/**
* Parse options into tabbed organization
*
* @return array
*/
private function parse_options()
{
$options = $this->options;
foreach ( $options as $option ) {
if ( $option[ 'type' ] == 'heading' ) {
$tab_name = sanitize_title( $option[ 'name' ] );
$this->tab_headers = array( $tab_name => $option[ 'name' ] );
continue;
}
$option[ 'tab' ] = $tab_name;
$tabs[ $tab_name ][ ] = $option;
}
$this->tabs = $tabs;
return $tabs;
}
/**
* Load the options array from a file
*
* @param string $option_file
*/
public function load_options( $option_file )
{
if ( !empty( $this->options ) ) return;
if ( file_exists( $option_file ) ) {
require $option_file;
$this->options = apply_filters( $this->id . '_options', $options );
$this->parse_options();
$this->current_options = $this->get_current_options();
/* If the option has no saved data, load the defaults. */
/* @TODO: Can prob add this to the activation hook. */
$this->set_defaults( $this->current_options );
} else {
wp_die( __( 'Could not load settings at: ', 'geczy' ) . '<br/><code>' . $option_file . '</code>', __( 'Error - WP Settings Framework', 'geczy' ) );
}
}
/**
*
*
* @return unknown
*/
public function get_current_options()
{
if ( !empty( $this->current_options ) )
return $this->current_options;
$options = get_option( $this->id . '_options' );
if ( $options ) {
$options = array_map( 'maybe_unserialize', $options );
}
return $options;
}
/**
* Sanitize and validate post fields
*
* @param unknown $input
*
* @return unknown
*/
public function validate_options( $input )
{
if ( !isset( $_POST[ 'update' ] ) )
return $this->get_defaults();
$clean = $this->current_options;
$tabname = $_POST[ 'currentTab' ];
foreach ( $this->tabs[ $tabname ] as $option ) :
if ( !isset( $option[ 'id' ] ) )
continue;
if ( !isset( $option[ 'type' ] ) )
continue;
if ( $option[ 'type' ] == 'select' ) {
$option[ 'options' ] = apply_filters( $this->id . '_select_options', $option[ 'options' ], $option );
}
$id = sanitize_text_field( strtolower( $option[ 'id' ] ) );
// Set checkbox to false if it wasn't sent in the $_POST
if ( 'checkbox' == $option[ 'type' ] && !isset( $input[ $id ] ) )
$input[ $id ] = 0;
// For a value to be submitted to database it must pass through a sanitization filter
if ( has_filter( 'geczy_sanitize_' . $option[ 'type' ] ) ) {
$clean[ $id ] = apply_filters( 'geczy_sanitize_' . $option[ 'type' ], $input[ $id ], $option );
}
endforeach;
do_action( $this->id . '_options_updated', $clean, $tabname );
add_settings_error( $this->id, 'save_options', __( 'Settings saved.', 'geczy' ), 'updated' );
return apply_filters( $this->id . '_options_on_update', $clean, $tabname );
}
/**
* Create default options
*
* @param unknown $current_options (optional)
*/
private function set_defaults( $current_options = array() )
{
$options = $this->get_defaults( $current_options );
if ( $options ) {
update_option( $this->id . '_options', $options );
}
}
/**
* Retrieve default options
*
* @param unknown $currents (optional)
*
* @return array
*/
private function get_defaults( $currents = array() )
{
$output = array();
$config = $this->options;
$flag = false;
if ( $currents ) {
foreach ( $config as $value ) {
if ( !isset( $value[ 'id' ] ) || !isset( $value[ 'std' ] ) || !isset( $value[ 'type' ] ) )
continue;
if ( !isset( $currents[ $value[ 'id' ] ] ) ) {
$flag = true;
}
}
}
foreach ( $config as $option ) {
if ( !isset( $option[ 'id' ] ) || !isset( $option[ 'std' ] ) || !isset( $option[ 'type' ] ) )
continue;
if ( $currents && isset( $currents[ $option[ 'id' ] ] ) ) {
$output[ $option[ 'id' ] ] = $currents[ $option[ 'id' ] ];
} else if ( has_filter( 'geczy_sanitize_' . $option[ 'type' ] ) ) {
$output[ $option[ 'id' ] ] = apply_filters( 'geczy_sanitize_' . $option[ 'type' ], $option[ 'std' ], $option );
}
}
if ( $currents ) {
$output = array_merge( $currents, $output );
}
return !$flag && $currents ? array() : $output;
}
/**
* HTML header
*/
private function template_header()
{
?>
<div class="wrap">
<?php if(! empty($this->page_title)){ ?>
<?php screen_icon(); ?><h2><?php echo $this->page_title; ?></h2>
<?php } ?>
<h2 class="nav-tab-wrapper">
<?php echo $this->display_tabs(); ?>
</h2><?php
if ( !empty ( $_REQUEST[ 'settings-updated' ] ) )
settings_errors();
}
/**
* HTML body
*
* @return unknown
*/
private function template_body()
{
if ( empty( $this->options ) ) return false;
$options = $this->options;
$tabs = $this->get_tabs();
$tabname = !empty ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $tabs[ 0 ][ 'slug' ];
$options = apply_filters( $this->id . '_options_tab-' . $tabname, $this->tabs[ $tabname ] ); ?>
<form method="post" action="options.php">
<?php settings_fields( $this->id . '_options_nonce' ); ?>
<table class="form-table">
<?php
foreach ( $options as $value ) :
$this->settings_options_format( $value );
endforeach;
do_action( $this->id . '_options_tab-' . $tabname );
?>
</table>
<p class="submit">
<input type="hidden" name="currentTab" value="<?php echo $tabname; ?>">
<input type="submit" name="update" class="button-primary"
value="<?php echo sprintf( __( 'Save %s changes', 'geczy' ), $this->tab_headers[ $tabname ] ); ?>"/>
</p>
</form> <?php
}
/**
* HTML footer
*/
private function template_footer()
{
echo '</div>';
}
/**
* Create the settings page
*/
public function init_settings_page()
{
$this->template_header();
$this->template_body();
$this->template_footer();
}
/**
* Retrieve tabs
*
* @return array
*/
private function get_tabs()
{
$tabs = array();
foreach ( $this->options as $option ) {
if ( $option[ 'type' ] != 'heading' )
continue;
$option[ 'slug' ] = sanitize_title( $option[ 'name' ] );
unset( $option[ 'type' ] );
$tabs[ ] = $option;
}
return $tabs;
}
/**
* Heading for navigation
*
* @return string
*/
private function display_tabs()
{
$tabs = $this->get_tabs();
$tabname = !empty ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $tabs[ 0 ][ 'slug' ];
$menu = '';
foreach ( $tabs as $tab ) {
$class = $tabname == $tab[ 'slug' ] ? 'nav-tab-active' : '';
$fields = array(
'page' => $this->id,
'tab' => $tab[ 'slug' ],
);
$query = http_build_query( array_merge( $_GET, $fields ) );
$menu .= sprintf( '<a id="%s-tab" class="nav-tab %s" title="%s" href="?%s">%s</a>', $tab[ 'slug' ], $class, $tab[ 'name' ], $query, esc_html( $tab[ 'name' ] ) );
}
return $menu;
}
/**
* Update an option
*
* @param string $name
* @param string $value
*
* @return bool
*/
public function update_option( $name, $value )
{
// Overwrite the key/value pair
$this->current_options = array( $name => $value ) + (array) $this->current_options;
return update_option( $this->id . '_options', $this->current_options );
}
/**
* Get an option
*
* @param string $name
* @param string $default (optional)
*
* @return bool
*/
public function get_option( $name, $default = false )
{
return isset( $this->current_options[ $name ] ) ? maybe_unserialize( $this->current_options[ $name ] ) : $default;
}
public function settings_options_format( $setting )
{
if ( empty( $setting ) ) return false;
$defaults = apply_filters( $this->id . '_options_defaults', array(
'name' => '',
'desc' => '',
'placeholder' => '',
'class' => '',
'tip' => '',
'id' => '',
'css' => '',
'type' => 'text',
'std' => '',
'select2' => false,
'multiple' => false,
'options' => array(),
'restrict' => array(),
'settings' => array()
) );
// Each to it's own variable for slim-ness' sakes.
$setting = shortcode_atts( $defaults, $setting );
$restrict_defaults = array(
'min' => 0,
'max' => '',
'step' => 'any',
);
$setting[ 'restrict' ] = shortcode_atts( $restrict_defaults, $setting[ 'restrict' ] );
$setting[ 'value' ] = $this->get_option( $setting[ 'id' ] );
$setting[ 'value' ] = $setting[ 'value' ] !== false ? maybe_unserialize( $setting[ 'value' ] ) : false;
$setting[ 'value' ] = $this->sanitize_value( $setting[ 'value' ], $setting );
$setting[ 'title' ] = $setting[ 'name' ];
$setting[ 'name' ] = $this->id . "_options[{$setting['id']}]";
$setting[ 'grouped' ] = !$setting[ 'title' ] ? ' style="padding-top:0px;"' : '';
$setting[ 'tip' ] = $this->get_formatted_tip( $setting[ 'tip' ] );
$header_types = apply_filters( $this->id . '_options_header_types', array( 'heading', 'title' ) );
extract( $setting );
$description = $desc && !$grouped && $type != 'checkbox'
? '<br /><small>' . $desc . '</small>'
: '<label for="' . $id . '"> ' . $desc . '</label>';
$description = ( ( in_array( $type, $header_types ) || $type == 'radio' ) && !empty( $desc ) )
? '<p>' . $desc . '</p>'
: $description;
?>
<?php if ( !in_array( $type, $header_types ) ) : ?>
<!-- Header of the option. -->
<tr valign="top">
<th scope="row"<?php echo $grouped; ?>>
<?php echo $tip; ?>
<?php if ( !$grouped ) : ?>
<label for="<?php echo $name; ?>" class="description"><?php echo $title; ?></label>
<?php endif; ?>
</th>
<td <?php echo $grouped; ?> >
<?php endif; ?>
<?php foreach ( $header_types as $header ) :
if ( $type != $header ) continue; ?>
<tr>
<th scope="col" colspan="2">
<h3 class="title"><?php echo $title; ?></h3>
<?php echo $description; ?>
</th>
</tr>
<?php endforeach; ?>
<?php switch ( $type ) :
case 'text' :
case 'color' :
case 'number' :
if ( $type == 'color' ) {
$type = 'text';
$class .= ' colorpick';
$description .= '<div id="colorPickerDiv_' . $id . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
}
?>
<input name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
type="<?php echo $type; ?>"
<?php if ( $type == 'number' ): ?>
min="<?php echo $restrict[ 'min' ]; ?>"
max="<?php echo $restrict[ 'max' ]; ?>"
step="<?php echo $restrict[ 'step' ]; ?>"
<?php endif; ?>
class="regular-text <?php echo $class; ?>"
style="<?php echo $css; ?>"
placeholder="<?php echo $placeholder; ?>"
value="<?php echo $value !== false ? $value : $std; ?>"
/>
<?php echo $description;
break;
case 'checkbox':
$selected = ( $value !== false ) ? $value : $std;
if ( $multiple ) :
foreach ( $options as $key => $desc ) : ?>
<input name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
id="<?php echo $id . '_' . $key; ?>"
type="checkbox"
class="<?php echo $class; ?>"
style="<?php echo $css; ?>"
value="<?php echo $key; ?>"
<?php @checked( $selected[$key], 1 ); ?>
/>
<label for="<?php echo $id . '_' . $key; ?>">
<?php echo $desc; ?>
</label>
<br/>
<?php
endforeach;
else : ?>
<input name="<?php echo $name; ?>"
id="<?php echo $id ?>"
type="checkbox"
class="<?php echo $class; ?>"
style="<?php echo $css; ?>"
<?php checked( $selected, 1 ); ?>
/>
<?php echo $description;
endif;
break;
case 'radio':
$selected = ( $value !== false ) ? $value : $std;
foreach ( $options as $key => $val ) : ?>
<label class="radio">
<input type="radio"
name="<?php echo $name; ?>"
id="<?php echo $key; ?>"
value="<?php echo $key; ?>"
class="<?php echo $class; ?>"
<?php checked( $selected, $key ); ?>
/>
<?php echo $val; ?>
</label><br/>
<?php endforeach;
echo $description;
break;
case 'single_select_page':
$selected = ( $value !== false ) ? $value : $std;
$args = array(
'name' => $name,
'id' => $id,
'sort_order' => 'ASC',
'echo' => 0,
'selected' => $selected
);
echo str_replace( "'>", "'><option></option>", wp_dropdown_pages( $args ) );
echo $description;
if ( $select2 ) : ?>
<script type="text/javascript">jQuery(function () {
jQuery("#<?php echo $id; ?>").select2({ allowClear: true, placeholder: "<?php _e( 'Select a page...', 'geczy' ); ?>", width: '350px' });
});</script>
<?php endif;
break;
case 'select':
$selected = ( $value !== false ) ? $value : $std;
$options = apply_filters( $this->id . '_select_options', $options, $setting ); ?>
<select id="<?php echo $id; ?>"
class="<?php echo $class; ?>"
style="<?php echo $css; ?>"
name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
<?php echo $multiple ? 'multiple="multiple"' : ''; ?>>
<?php foreach ( $options as $key => $val ) : ?>
<option
value="<?php echo $key; ?>" <?php self::selected( $selected, $key ); ?>><?php echo $val; ?></option>
<?php endforeach; ?>
</select>
<?php echo $description;
if ( $select2 ) : ?>
<script type="text/javascript">jQuery(function () {
jQuery("#<?php echo $id; ?>").select2({ width: '350px' });
});</script>
<?php endif;
break;
case 'textarea':
?>
<textarea name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
class="large-text <?php echo $class; ?>"
style="<?php if ( $css ) echo $css; else echo 'width:300px;'; ?>"
placeholder="<?php echo $placeholder; ?>"
rows="3"
><?php echo ( $value !== false ) ? $value : $std; ?></textarea>
<?php echo $description;
break;
case 'wysiwyg':
wp_editor( $value, $id, array( 'textarea_name' => $name ) );
echo $description;
break;
default :
do_action( $this->id . '_options_type_' . $type, $setting );
break;
endswitch;
/* Footer of the option. */
if ( !in_array( $type, $header_types ) ) echo '</td></tr>';
}
/**
*
*
* @param unknown $haystack
* @param unknown $current
*/
private function selected( $haystack, $current )
{
if ( is_array( $haystack ) && in_array( $current, $haystack ) ) {
$current = $haystack = 1;
}
if(is_array($haystack)){
foreach($haystack as $option) {
selected( $option, $current );
}
} else {
selected( $haystack, $current );
}
}
/**
*
*
* @param unknown $haystack
* @param unknown $current
*/
private function checked( $haystack, $current )
{
if ( is_array( $haystack ) && !empty( $haystack[ $current ] ) ) {
$current = $haystack = 1;
}
checked( $haystack, $current );
}
/**
* Format a tooltip given a string
*
* @param string $tip
*
* @return string
*/
private function get_formatted_tip( $tip )
{
return $tip ? sprintf( '<a href="#" title="%s" class="sf-tips" tabindex="99"></a>', $tip ) : '';
}
/**
*
*
* @param unknown $value
* @param unknown $setting
*
* @return unknown
*/
private function sanitize_value( $value, $setting )
{
if ( $value !== false && $setting[ 'type' ] != 'wysiwyg' ) {
if ( is_array( $value ) ) {
foreach ( $value as $key => $output ) {
$value[ $key ] = esc_attr( $output );
}
} else {
$value = esc_attr( $value );
}
}
return apply_filters( $this->id . '_options_sanitize_value', $value, $setting );
}
}
}
<?php
$options = array();
$options[ ] = array( 'name' => __( 'General', 'wcvendors' ), 'type' => 'heading' );
$options[ ] = array( 'name' => __( 'General options', 'wcvendors' ), 'type' => 'title', 'desc' => '' );
$options[ ] = array(
'name' => __( 'Default commission (%)', 'wcvendors' ),
'desc' => __( 'The default rate you pay each vendor for a product sale. If a product has a commission rate already set, this value will be ignored for that product.', 'wcvendors' ),
'id' => 'default_commission',
'css' => 'width:70px;',
'type' => 'number',
'restrict' => array(
'min' => 0,
'max' => 100
)
);
$options[ ] = array(
'name' => __( 'Registration', 'wcvendors' ),
'desc' => __( 'Allow users or guests to apply to become a vendor', 'wcvendors' ),
'tip' => __( 'This will show a checkbox on the My Account page\'s registration form asking if the user would like to apply to be a vendor. Also, on the Vendor Dashboard, users can still apply to become a vendor even if this is disabled.', 'wcvendors' ),
'id' => 'show_vendor_registration',
'type' => 'checkbox',
'std' => true,
);
$options[ ] = array(
'desc' => __( 'Approve vendor applications manually', 'wcvendors' ),
'tip' => __( 'With this unchecked, all vendor applications are automatically accepted. Otherwise, you must approve each manually.', 'wcvendors' ),
'id' => 'manual_vendor_registration',
'type' => 'checkbox',
'std' => true,
);
$options[ ] = array(
'name' => __( 'Taxes', 'wcvendors' ),
'desc' => __( 'Give vendors any tax collected per-product', 'wcvendors' ),
'tip' => __( 'The tax collected on a vendor\'s product will be given in its entirety', 'wcvendors' ),
'id' => 'give_tax',
'type' => 'checkbox',
'std' => false,
);
$options[ ] = array(
'name' => __( 'Shipping', 'wcvendors' ),
'desc' => __( 'Give vendors any shipping collected per-product', 'wcvendors' ),
'tip' => __( 'The shipping collected on a vendor\'s product will be given in its entirety', 'wcvendors' ),
'id' => 'give_shipping',
'type' => 'checkbox',
'std' => true,
);
$options[ ] = array( 'name' => __( 'Shop options', 'wcvendors' ), 'type' => 'title', 'desc' => '' );
$options[ ] = array(
'name' => __( 'Shop HTML', 'wcvendors' ),
'desc' => __( 'Enable HTML for a vendor\'s shop description by default. You can enable or disable this per vendor by editing the vendors username.', 'wcvendors' ),
'id' => 'shop_html_enabled',
'type' => 'checkbox',
'std' => true,
);
$options[ ] = array(
'name' => __( 'Vendor shop page', 'wcvendors' ),
'desc' => __( 'Eg: <code>yoursite.com/[your_setting_here]/[vendor_name_here]</code>', 'wcvendors' ),
'id' => 'vendor_shop_permalink',
'type' => 'text',
'std' => 'vendors/',
);
$options[ ] = array(
'name' => __( 'Shop Headers', 'wcvendors' ),
'desc' => __( 'Enable vendor shop headers', 'wcvendors' ),
'tip' => __( 'This will override the HTML Shop description output on product-archive pages. In order to customize the shop headers visit wcvendors.com and read the article in the Knowledgebase titled Changing the Vendor Templates.', 'wcvendors' ),
'id' => 'shop_headers_enabled',
'type' => 'checkbox',
'std' => false,
);
$options[ ] = array(
'name' => __( 'Vendor Display Name', 'wcvendors' ),
'desc' => __( 'Select what will be displayed for the sold by text throughout the store.', 'wcvendors' ),
'id' => 'vendor_display_name',
'type' => 'select',
'options' => array(
'display_name' => __( 'Display Name', 'wcvendors'),
'shop_name' => __( 'Shop Name', 'wcvendors'),
'user_login' => __( 'User Login', 'wcvendors'),
'user_email' => __( 'User Email', 'wcvendors'),
),
'std' => 'shop_name'
);
...@@ -144,8 +144,10 @@ class WooCommerce_Quick_Donation_Settings { ...@@ -144,8 +144,10 @@ class WooCommerce_Quick_Donation_Settings {
foreach($this->settings_page as $settings){ foreach($this->settings_page as $settings){
$this->settings_key[] = WC_QD_DB.$settings['slug']; $this->settings_key[] = WC_QD_DB.$settings['slug'];
$db_val = get_option(WC_QD_DB.$settings['slug']); $db_val = get_option(WC_QD_DB.$settings['slug']);
unset($db_val['section_id']); if(is_array($db_val)){
$values = array_merge($db_val,$values); unset($db_val['section_id']);
$values = array_merge($db_val,$values);
}
} }
$this->settings_values = $values; $this->settings_values = $values;
......
=== Woocommerce Role Based Price === === WooCommerce Quick Donation ===
Contributors: varunms Contributors: varunms
Author URI: http://varunsridharan.in/ Donate link: http://varunsridharan.in
Plugin URL: https://wordpress.org/plugins/woocommerce-plugin-boiler-plate/ Tags: WooCommerce,Quick Dontion,quick donation,online donation,wordpress donation,simple donation,donation form,WC donation,Online Payment,Payment,Online,Donate,Monthly Goal,affiliate, cart, checkout, commerce, configurable, digital, download, downloadable, e-commerce, ecommerce, inventory, reports, sales, sell, shipping, shop, shopping, stock, store, tax, variable, widgets, woothemes, wordpress ecommerce
Tags: WooCommerce Requires at least: 3.0 or higher
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=36Y7KSYPF7KTU Tested up to: 4.4
Requires at least: 3.0
Tested up to: 4.3
WC requires at least: 1.0 WC requires at least: 1.0
WC tested up to: 2.4.6 WC tested up to: 2.4.8
Stable tag: 2.1 Stable tag: 1.3 Beta
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
A Simple Plugin Boiler Plate for woocommerce Turns WooCommerce Into Online Donation.
== Description == == Description ==
A Simple Plugin Boiler Plate for woocommerce <h1> Dear User I am still trying to make things plugin more stable and prefect if you find any bug / any feature is required please open an issue at <a href="https://github.com/technofreaky/woocomerce-quick-donation/issues">GitHub</a> or <a href="https://wordpress.org/support/plugin/woocommerce-quick-donation">WordPress Support</a> </h1>
WooCommerce Shopping Cart Donation which makes WooComerce to use for online donation purpose.
This plugin will create a new product in the name of **donation**.
<h3> Features </h3>
* Redirect User After Donation Added To Cart [Cart Page / Checkout Page]
* Select Your Preferred Payment Gateway For Donation
* Custom Email Template For Donation Processing
* Custom Email Template For Donation Completed
* Configurable Min & Max Donation Amount Based On Project
* Custom Error Messages
**This Plugin Can called by using the below short code**
`[wc_quick_donation]`
**Shortcode Variables**
1. type : select | radio
2. grouped : true | false
**Modifying Template**
1. Create A folder named *donation* under <code> your-theme/woocommerce/</code>
2. Copy all files from <code>woocommerce-quick-donation/template/</code>
3. Paste in <code> your-theme/woocommerce/donation/</code>
<h3>Plugin Template List</h3>
**Checkout Page Template**
<code>
checkout/donation-cart-errors.php
checkout/donation-form-billing.php
checkout/donation-form-checkout.php
checkout/donation-form-coupon.php
checkout/donation-form-login.php
checkout/donation-form-pay.php
checkout/donation-form-shipping.php
checkout/donation-payment-method.php
checkout/donation-payment.php
checkout/donation-review-order.php
checkout/donation-thankyou.php
</code>
**Email Template**
<code>
emails/donation-customer-invoice.php
emails/plain/donation-customer-invoice.php
</code>
**Plugin Template**
<code>
donation-form.php
fields/field-radio.php
fields/field-select.php
fields/field-text.php
</code>
<h3>Actions Hooks</h3>
<code>
wc_quick_donation_before_doantion_form
wc_quick_donation_after_doantion_form
</code>
<h3> Filter Hooks </h3>
<code>
wcqd_project_name_select_class
wcqd_project_name_select_attribute
wcqd_project_name_radio_class
wcqd_project_name_radio_attribute
wcqd_project_price_text_class
wcqd_project_price_text_attribute
wc_quick_donation_settings_tab
wc_quick_donation_settings_section
wc_quick_donation_settings_fields
</code>
== Upgrade Notice ==
Note this release is in beta and from now this plugin is totally rebuild. it may not work with or like older version's
== Screenshots ==
== Installation == == Installation ==
= Minimum Requirements = = Minimum Requirements =
* WordPress 3.8 or greater * WordPress 3.8 or greater
...@@ -29,25 +106,100 @@ A Simple Plugin Boiler Plate for woocommerce ...@@ -29,25 +106,100 @@ A Simple Plugin Boiler Plate for woocommerce
= Automatic installation = = Automatic installation =
Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't need to leave your web browser. To do an automatic install of WooCommerce Role Based Price, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New. Automatic installation is the easiest option as WordPress handles the file transfers itself and you don't need to leave your web browser. To do an automatic install of WooCommerce Quick Donation, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
In the search field type "WooCommerce Role Based Price" and click Search Plugins. Once you've found our plugin you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking "Install Now" In the search field type "WooCommerce Quick Donation" and click Search Plugins. Once you've found our eCommerce plugin you can view details about it such as the the point release, rating and description. Most importantly of course, you can install it by simply clicking "Install Now"
= Manual installation = = Manual installation =
The manual installation method involves downloading our plugin and uploading it to your Web Server via your favourite FTP application. The WordPress codex contains [instructions on how to do this here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation). The manual installation method involves downloading our plugin and uploading it to your Web Server via your favourite FTP application. The WordPress codex contains [instructions on how to do this here](http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation).
1. Installing alternatives: 1. Installing alternatives:
* via Admin Dashboard: * *via Admin Dashboard:* Go to 'Plugins > Add New', search for "WooCommerce Quick Donation", click "install"
* Go to 'Plugins > Add New', search for "WooCommerce Role Based Price", click "install" * *OR via direct ZIP upload:* Upload the ZIP package via 'Plugins > Add New > Upload' in your WP Admin
* OR via direct ZIP upload: * *OR via FTP upload:* Upload `WooCommerce-quick-donation` folder to the `/wp-content/plugins/` directory
* Upload the ZIP package via 'Plugins > Add New > Upload' in your WP Admin
* OR via FTP upload:
* Upload `woocommerce-quick-buy` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress 2. Activate the plugin through the 'Plugins' menu in WordPress
3. For Settings Look at your `WooCommerce => Settings => WC Quick Donation`
== Frequently Asked Questions ==
**How To Call / Use This Plugin ?**
This Plugin Can Be Called Using `[wc_quick_donation]`
**Can I Modify The Donation Form ?**
Yes. Its Possible By Copying To Your Theme's Folder `wp-content/plugins/wc-quick-donation/template/donation_form.php`
**What Is The Use Of Project Field ?**
Project is like [category / division]. for which you donation. multiple can be entered by `,` separated eg : `Project 1,Project 2`
**Donation Plugin Not Working After Upgrading To 0.2**
As we have updated ***donation-form.php*** template. it may not be working with the old one. so please replace the template if you have modified or contact us.
**How I can get project name in email template**
You can get the name by calling the variable `$project_name`
**Where can I request new features**
Please open an issue at <a href="https://github.com/technofreaky/woocomerce-quick-donation/"> GitHub </a> and we will look into it
**I have an idea for your plugin!**
That's great. We are always open to your input, and we would like to add anything we think will be useful to a lot of people. Please send your comment/idea to varunsridharan23@gmail.com
**I found a bug!**
Oops. Please User github / WordPress to post bugs. <a href="https://github.com/technofreaky/woocomerce-quick-donation/"> Open an Issue </a>
**WooCommerce Quick Donation is awesome! Can I contribute?**
Yes you can! Join in on our <a href="https://github.com/technofreaky/woocomerce-quick-donation/">GitHub repository :)</a>
== Screenshots ==
== Changelog ==
= 1.3 Beta =
* Created Separate Custom Post Type For Donation
* Created Separate Custom Settings Page
* Total Plugin Redeveloped
* Min & Max Donation Amount Based On Project
* Separate Page For Donation Orders
= 1.2 =
* Added Widget For Donation Form
* Added Separate function to get Donation Projects `donation_projects()`
* Added 2 Actions `wc_quick_donation_before_form` & `wc_quick_donation_after_form` for donation form.
* Minor Bug Fix.
= 1.1 =
* Plugin Activation Issue Fixed.
= 1.0 =
* Configurable Min & Max Donation Amount
* Custom Error Messages
* Separate Menu with donation order listings
* Fixed Order Notes And Order Meta Added For All Products
* Fixed Saving Donation Order Id In DB [Before It Stored All Order IDS]
* Minor performance fixes
* Code Clean Up
* Removed Row Action [Quick Edit , Trash & Duplicate] Options For Donation Product In Product Listing
= 0.4 =
* Internal Server Error / php error fixed while adding donation to cart [WP : 4.1 | WC : 2.3.3]
* Added Generator Meta Tag
* Minor Bug Fix
= 0.3 =
* Plugin Activation Issue Fixed.
= 0.2 =
* Redirect User After Donation Added To Cart [Cart Page / Checkout Page]
* Select Your Preferred Payment Gateway For Donation
* Custom Email Template For Donation Processing
* Custom Email Template For Donation Completed
* Some Minor Bug Fix
== Changelog ==
= 0.1 = = 0.1 =
* Base Version * Base Version
\ No newline at end of file
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
/** /**
* Plugin Name: WooCommerce Quick Donation * Plugin Name: WooCommerce Quick Donation
* Plugin URI: https://wordpress.org/plugins/woocommerce-plugin-boiler-plate/ * Plugin URI: https://wordpress.org/plugins/woocommerce-plugin-boiler-plate/
* Description: Sample Plugin For WooCommerce * Description: Turns WooCommerce Into Online Donation
* Version: 3.0 * Version: 1.3 BETA
* Author: Varun Sridharan * Author: Varun Sridharan
* Author URI: http://varunsridharan.in * Author URI: http://varunsridharan.in
* Text Domain: woocommerce-quick-donation * Text Domain: woocommerce-quick-donation
* License: GPL-2.0+ * License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* GitHub Plugin URI: @TODO * GitHub Plugin URI: https://github.com/technofreaky/woocomerce-quick-donation
*/ */
if ( ! defined( 'WPINC' ) ) { die; } if ( ! defined( 'WPINC' ) ) { die; }
...@@ -18,7 +18,7 @@ class WooCommerce_Quick_Donation { ...@@ -18,7 +18,7 @@ class WooCommerce_Quick_Donation {
/** /**
* @var string * @var string
*/ */
public $version = '0.1'; public $version = '1.3';
/** /**
* @var WooCommerce The single instance of the class * @var WooCommerce The single instance of the class
...@@ -93,7 +93,6 @@ class WooCommerce_Quick_Donation { ...@@ -93,7 +93,6 @@ class WooCommerce_Quick_Donation {
*/ */
private function load_required_files(){ private function load_required_files(){
$this->load_files(WC_QD_ADMIN.'wps/*.php'); $this->load_files(WC_QD_ADMIN.'wps/*.php');
//$this->load_files(WC_QD_ADMIN.'wp_settings/class-settings.php');
$this->load_files(WC_QD_INC.'class-admin-notice.php'); $this->load_files(WC_QD_INC.'class-admin-notice.php');
$this->load_files(WC_QD_INC.'class-post-*.php'); $this->load_files(WC_QD_INC.'class-post-*.php');
$this->load_files(WC_QD_INC.'class-quick-donation-db.php'); $this->load_files(WC_QD_INC.'class-quick-donation-db.php');
...@@ -163,7 +162,7 @@ class WooCommerce_Quick_Donation { ...@@ -163,7 +162,7 @@ class WooCommerce_Quick_Donation {
* Gets Settings From DB * Gets Settings From DB
*/ */
public function get_option($key = ''){ public function get_option($key = ''){
var_dump(self::$settings_values); var_dump(self::$settings_values);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment