Initial release

This commit is contained in:
Alexander
2014-09-08 02:23:45 +02:00
parent 4e68d189ef
commit 834b715086
23 changed files with 1254 additions and 0 deletions
@@ -0,0 +1,64 @@
/**
* vendocrat Payment Methods styles
*
* @package vendocrat
* @subpackage Payment Methods/Assets
*
* @since 2014-09-08
* @version 2014-09-08
*
* @author Poellmann Alexander Manfred <alex@vendocr.at>
* @copyright Copyright 2014 vendocrat. All Rights Reserved.
* @link http://vendocr.at/
*/
.payment-methods {
padding-left:0;
list-style:none;
margin-left:-2px;}
.payment-methods > li {
display:inline-block;
padding:2px;
vertical-align:top;}
.payment-methods > li > b,
.payment-methods > li > i {
display:block !important;
cursor:default;
padding:4px;
border-radius:4px;
color:#fff;
background:#333;
border:1px solid #333;}
.payment-methods-inverse > li > b,
.payment-methods-inverse > li > i {
color:#333;
background:#fff;
border-color:#fff;}
.payment-methods-outline > li > b,
.payment-methods-outline > li > i,
.payment-methods-o > li > b,
.payment-methods-o > li > i {
color:#333;
background:none;}
.payment-methods > li > b {
padding-left:8px;
padding-right:8px;
font-size:0.9em;font-weight:300;
line-height:1.6;}
.payment-methods > li > i {
font-size:1.5em;
line-height:1;}
/*
* NO MORE LOVE TO GIVE
*/
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 237 KiB

@@ -0,0 +1,149 @@
<?php
/**
* vendocrat Payment Methods widget
*
* @package vendocrat
* @subpackage Payment Methods/Classes
*
* @since 2014-09-08
* @version 2014-09-08
*
* @author Poellmann Alexander Manfred <alex@vendocr.at>
* @copyright Copyright 2014 vendocrat. All Rights Reserved.
* @link http://vendocr.at/
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class vendocrat_Widget_Payment_Methods extends WP_Widget {
public $slug;
public $name;
public $desc;
public $title;
/**
* Construct Widget
*
* @since 2014-09-08
* @version 2014-09-08
**************************************************/
function __construct() {
$this->slug = 'vendocrat_widget_payment_methods';
$this->name = __( 'Payment Methods', 'vendocrat-payment-methods' );
$this->desc = __( 'Easily display your accepted payment methods', 'vendocrat-payment-methods' );
$this->title = __( 'Accepted Payment Methods', 'vendocrat-payment-methods' );
parent::__construct(
$this->slug,
'vendocrat: '. $this->name,
array(
'description' => $this->desc,
)
);
}
/**
* Front-end display of widget
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
* @return void
*
* @since 2014-09-08
* @version 2014-09-08
**************************************************/
public function widget( $args, $instance ) {
$title = apply_filters( 'widget_title', $instance['title'] );
$tooltip = ($instance['tooltip'] != 'true') ? false : true;
$style = $instance['style'];
$xclass = $instance['xclass'];
echo $tooltip;
extract($args);
echo $before_widget;
if ( $title ) {
echo $before_title . $title . $after_title;
}
global $vendocrat_woo_payment_methods;
$atts = array(
'style' => $style,
'tooltip' => $tooltip,
'xclass' => $xclass,
);
echo $vendocrat_woo_payment_methods->get_payment_methods( $atts );
echo $after_widget;
}
/**
* Back-end widget form
*
* @param array $instance Previously saved values from database.
*
* @since 2014-09-08
* @version 2014-09-08
**************************************************/
public function form( $instance ) {
$defaults = array(
'title' => $this->title,
'style' => 'default',
'tooltip' => 'false',
'xclass' => '',
);
$instance = wp_parse_args( (array) $instance, $defaults );
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title', 'vendocrat-payment-methods' ); ?>:</label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id( 'style' ); ?>"><?php _e( 'Style', 'vendocrat-payment-methods' ); ?>:</label>
<select name="<?php echo $this->get_field_name( 'style' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'style' ); ?>">
<option value="default"<?php selected( $instance['style'], 'default' ); ?>><?php _e( 'Default', 'vendocrat-payment-methods' ); ?></option>
<option value="inverse"<?php selected( $instance['style'], 'inverse' ); ?>><?php _e( 'Inverse', 'vendocrat-payment-methods' ); ?></option>
<option value="o"<?php selected( $instance['style'], 'o' ); ?>><?php _e( 'Outline', 'vendocrat-payment-methods' ); ?></option>
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id( 'tooltip' ); ?>"><?php _e( 'Add Tooltip markup?', 'vendocrat-payment-methods' ); ?></label>
<select name="<?php echo $this->get_field_name( 'tooltip' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'tooltip' ); ?>">
<option value="false"<?php selected( $instance['tooltip'], 'false' ); ?>><?php _e( 'No', 'vendocrat-payment-methods' ); ?></option>
<option value="true"<?php selected( $instance['tooltip'], 'true' ); ?>><?php _e( 'Yes', 'vendocrat-payment-methods' ); ?></option>
</select>
</p>
<p>
<label for="<?php echo $this->get_field_id('xclass'); ?>"><?php _e( 'Extra classes', 'vendocrat-payment-methods' ); ?>:</label>
<input class="widefat" id="<?php echo $this->get_field_id('xclass'); ?>" name="<?php echo $this->get_field_name('xclass'); ?>" type="text" value="<?php echo esc_attr( $instance['xclass'] ); ?>" />
</p>
<?php
}
/**
* Sanitize widget form values as they are saved
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
* @return array Updated safe values to be saved.
**************************************************/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['style'] = esc_attr( $new_instance['style'] );
$instance['tooltip'] = esc_attr( $new_instance['tooltip'] );
$instance['xclass'] = esc_attr( $new_instance['xclass'] );
return $instance;
}
} // END Class
/*
* NO MORE LOVE TO GIVE
*/
Binary file not shown.
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Payment Methods\n"
"POT-Creation-Date: 2014-09-08 01:40+0100\n"
"PO-Revision-Date: 2014-09-08 01:44+0100\n"
"Last-Translator: \n"
"Language-Team: vendocrat <hello@vendocr.at>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"Language: de\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../classes/class-widget-payment-methods.php:33
msgid "Payment Methods"
msgstr "Zahlungsmethoden"
#: ../classes/class-widget-payment-methods.php:34
msgid "Easily display your accepted payment methods"
msgstr "Spielend leicht alle akzeptierten Zahlungsmethoden anzeigen"
#: ../classes/class-widget-payment-methods.php:35
msgid "Accepted Payment Methods"
msgstr "Akzeptierte Zahlungsmethoden"
#: ../classes/class-widget-payment-methods.php:102
msgid "Title"
msgstr "Titel"
#: ../classes/class-widget-payment-methods.php:106
msgid "Style"
msgstr "Stil"
#: ../classes/class-widget-payment-methods.php:108
msgid "Default"
msgstr "Standard"
#: ../classes/class-widget-payment-methods.php:109
msgid "Inverse"
msgstr "Inverse"
#: ../classes/class-widget-payment-methods.php:110
msgid "Outline"
msgstr "Kontur"
#: ../classes/class-widget-payment-methods.php:114
msgid "Add Tooltip markup?"
msgstr "Tooltip-Markup hinzufügen?"
#: ../classes/class-widget-payment-methods.php:116
msgid "No"
msgstr "Nein"
#: ../classes/class-widget-payment-methods.php:117
msgid "Yes"
msgstr "Ja"
#: ../classes/class-widget-payment-methods.php:121
msgid "Extra classes"
msgstr "Zusätzliche Klassen"
#: ../payment-methods.php:220 ../payment-methods.php:260
#: ../payment-methods.php:266 ../payment-methods.php:271
msgid "Bank Transfer"
msgstr "Bank-Überweisung"
#: ../payment-methods.php:224
msgid "Pay with Cheque"
msgstr "Mit Scheck bezahlen"
#: ../payment-methods.php:292
msgid "Cash on Delivery"
msgstr "Nachname"
Binary file not shown.
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Payment Methods\n"
"POT-Creation-Date: 2014-09-08 01:40+0100\n"
"PO-Revision-Date: 2014-09-08 01:44+0100\n"
"Last-Translator: \n"
"Language-Team: vendocrat <hello@vendocr.at>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"Language: de\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../classes/class-widget-payment-methods.php:33
msgid "Payment Methods"
msgstr "Zahlungsmethoden"
#: ../classes/class-widget-payment-methods.php:34
msgid "Easily display your accepted payment methods"
msgstr "Spielend leicht alle akzeptierten Zahlungsmethoden anzeigen"
#: ../classes/class-widget-payment-methods.php:35
msgid "Accepted Payment Methods"
msgstr "Akzeptierte Zahlungsmethoden"
#: ../classes/class-widget-payment-methods.php:102
msgid "Title"
msgstr "Titel"
#: ../classes/class-widget-payment-methods.php:106
msgid "Style"
msgstr "Stil"
#: ../classes/class-widget-payment-methods.php:108
msgid "Default"
msgstr "Standard"
#: ../classes/class-widget-payment-methods.php:109
msgid "Inverse"
msgstr "Inverse"
#: ../classes/class-widget-payment-methods.php:110
msgid "Outline"
msgstr "Kontur"
#: ../classes/class-widget-payment-methods.php:114
msgid "Add Tooltip markup?"
msgstr "Tooltip-Markup hinzufügen?"
#: ../classes/class-widget-payment-methods.php:116
msgid "No"
msgstr "Nein"
#: ../classes/class-widget-payment-methods.php:117
msgid "Yes"
msgstr "Ja"
#: ../classes/class-widget-payment-methods.php:121
msgid "Extra classes"
msgstr "Zusätzliche Klassen"
#: ../payment-methods.php:220 ../payment-methods.php:260
#: ../payment-methods.php:266 ../payment-methods.php:271
msgid "Bank Transfer"
msgstr "Bank-Überweisung"
#: ../payment-methods.php:224
msgid "Pay with Cheque"
msgstr "Mit Scheck bezahlen"
#: ../payment-methods.php:292
msgid "Cash on Delivery"
msgstr "Nachname"
Binary file not shown.
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Payment Methods\n"
"POT-Creation-Date: 2014-09-08 01:40+0100\n"
"PO-Revision-Date: 2014-09-08 01:41+0100\n"
"Last-Translator: \n"
"Language-Team: vendocrat <hello@vendocr.at>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"Language: en\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../classes/class-widget-payment-methods.php:33
msgid "Payment Methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:34
msgid "Easily display your accepted payment methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:35
msgid "Accepted Payment Methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:102
msgid "Title"
msgstr ""
#: ../classes/class-widget-payment-methods.php:106
msgid "Style"
msgstr ""
#: ../classes/class-widget-payment-methods.php:108
msgid "Default"
msgstr ""
#: ../classes/class-widget-payment-methods.php:109
msgid "Inverse"
msgstr ""
#: ../classes/class-widget-payment-methods.php:110
msgid "Outline"
msgstr ""
#: ../classes/class-widget-payment-methods.php:114
msgid "Add Tooltip markup?"
msgstr ""
#: ../classes/class-widget-payment-methods.php:116
msgid "No"
msgstr ""
#: ../classes/class-widget-payment-methods.php:117
msgid "Yes"
msgstr ""
#: ../classes/class-widget-payment-methods.php:121
msgid "Extra classes"
msgstr ""
#: ../payment-methods.php:220 ../payment-methods.php:260
#: ../payment-methods.php:266 ../payment-methods.php:271
msgid "Bank Transfer"
msgstr ""
#: ../payment-methods.php:224
msgid "Pay with Cheque"
msgstr ""
#: ../payment-methods.php:292
msgid "Cash on Delivery"
msgstr ""
Binary file not shown.
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Payment Methods\n"
"POT-Creation-Date: 2014-09-08 01:40+0100\n"
"PO-Revision-Date: 2014-09-08 01:41+0100\n"
"Last-Translator: \n"
"Language-Team: vendocrat <hello@vendocr.at>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"Language: en\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../classes/class-widget-payment-methods.php:33
msgid "Payment Methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:34
msgid "Easily display your accepted payment methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:35
msgid "Accepted Payment Methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:102
msgid "Title"
msgstr ""
#: ../classes/class-widget-payment-methods.php:106
msgid "Style"
msgstr ""
#: ../classes/class-widget-payment-methods.php:108
msgid "Default"
msgstr ""
#: ../classes/class-widget-payment-methods.php:109
msgid "Inverse"
msgstr ""
#: ../classes/class-widget-payment-methods.php:110
msgid "Outline"
msgstr ""
#: ../classes/class-widget-payment-methods.php:114
msgid "Add Tooltip markup?"
msgstr ""
#: ../classes/class-widget-payment-methods.php:116
msgid "No"
msgstr ""
#: ../classes/class-widget-payment-methods.php:117
msgid "Yes"
msgstr ""
#: ../classes/class-widget-payment-methods.php:121
msgid "Extra classes"
msgstr ""
#: ../payment-methods.php:220 ../payment-methods.php:260
#: ../payment-methods.php:266 ../payment-methods.php:271
msgid "Bank Transfer"
msgstr ""
#: ../payment-methods.php:224
msgid "Pay with Cheque"
msgstr ""
#: ../payment-methods.php:292
msgid "Cash on Delivery"
msgstr ""
Binary file not shown.
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Payment Methods\n"
"POT-Creation-Date: 2014-09-08 01:40+0100\n"
"PO-Revision-Date: 2014-09-08 02:12+0100\n"
"Last-Translator: \n"
"Language-Team: vendocrat <hello@vendocr.at>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"Language: it\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../classes/class-widget-payment-methods.php:33
msgid "Payment Methods"
msgstr "Metodi di pagamento"
#: ../classes/class-widget-payment-methods.php:34
msgid "Easily display your accepted payment methods"
msgstr "Mostra con facilità i tuoi metodi di pagamento accettati"
#: ../classes/class-widget-payment-methods.php:35
msgid "Accepted Payment Methods"
msgstr "Metodi di pagamento accettati"
#: ../classes/class-widget-payment-methods.php:102
msgid "Title"
msgstr "Titolo"
#: ../classes/class-widget-payment-methods.php:106
msgid "Style"
msgstr "Stile"
#: ../classes/class-widget-payment-methods.php:108
msgid "Default"
msgstr "Predefinito"
#: ../classes/class-widget-payment-methods.php:109
msgid "Inverse"
msgstr "Inverso"
#: ../classes/class-widget-payment-methods.php:110
msgid "Outline"
msgstr "Contorno"
#: ../classes/class-widget-payment-methods.php:114
msgid "Add Tooltip markup?"
msgstr "Aggiungere Tooltip markup?"
#: ../classes/class-widget-payment-methods.php:116
msgid "No"
msgstr "No"
#: ../classes/class-widget-payment-methods.php:117
msgid "Yes"
msgstr "Si"
#: ../classes/class-widget-payment-methods.php:121
msgid "Extra classes"
msgstr "Classi extra"
#: ../payment-methods.php:220 ../payment-methods.php:260
#: ../payment-methods.php:266 ../payment-methods.php:271
msgid "Bank Transfer"
msgstr "Trasferimento bancario"
#: ../payment-methods.php:224
msgid "Pay with Cheque"
msgstr "Paga con assegno"
#: ../payment-methods.php:292
msgid "Cash on Delivery"
msgstr "Pagamento con contrassegno"
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Project-Id-Version: WooCommerce Payment Methods\n"
"POT-Creation-Date: 2014-09-08 01:40+0100\n"
"PO-Revision-Date: 2014-09-08 01:40+0100\n"
"Last-Translator: \n"
"Language-Team: vendocrat <hello@vendocr.at>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.7\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../classes/class-widget-payment-methods.php:33
msgid "Payment Methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:34
msgid "Easily display your accepted payment methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:35
msgid "Accepted Payment Methods"
msgstr ""
#: ../classes/class-widget-payment-methods.php:102
msgid "Title"
msgstr ""
#: ../classes/class-widget-payment-methods.php:106
msgid "Style"
msgstr ""
#: ../classes/class-widget-payment-methods.php:108
msgid "Default"
msgstr ""
#: ../classes/class-widget-payment-methods.php:109
msgid "Inverse"
msgstr ""
#: ../classes/class-widget-payment-methods.php:110
msgid "Outline"
msgstr ""
#: ../classes/class-widget-payment-methods.php:114
msgid "Add Tooltip markup?"
msgstr ""
#: ../classes/class-widget-payment-methods.php:116
msgid "No"
msgstr ""
#: ../classes/class-widget-payment-methods.php:117
msgid "Yes"
msgstr ""
#: ../classes/class-widget-payment-methods.php:121
msgid "Extra classes"
msgstr ""
#: ../payment-methods.php:220 ../payment-methods.php:260
#: ../payment-methods.php:266 ../payment-methods.php:271
msgid "Bank Transfer"
msgstr ""
#: ../payment-methods.php:224
msgid "Pay with Cheque"
msgstr ""
#: ../payment-methods.php:292
msgid "Cash on Delivery"
msgstr ""
@@ -0,0 +1,339 @@
<?php
/**
/* Plugin Name: WooCommerce Payment Methods (by vendocrat)
* Plugin URI: http://vendocr.at/
* Description: <strong>Easily display your accepted payment methods from WooCommerce.</strong> Handcrafted with &hearts; by <a href='http://vendocr.at/'>vendocrat</a> in Vienna.
* Version: 0.1.0
* Author: vendocrat
* Author URI: http://vendocr.at/
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) )
return;
if ( ! class_exists( 'vendocrat_Woo_Payment_Methods' ) ) :
class vendocrat_Woo_Payment_Methods {
/**
* Constructor
*
* @since 2014-08-15
* @version 2014-08-15
**************************************************/
function __construct() {
define( 'PAYMENT_METHODS_DIR', plugin_dir_path( __FILE__ ) );
define( 'PAYMENT_METHODS_URI', plugin_dir_url( __FILE__ ) );
define( 'PAYMENT_METHODS_CSS_URI', trailingslashit( PAYMENT_METHODS_URI . 'assets/css' ) );
define( 'PAYMENT_METHODS_IMG_URI', trailingslashit( PAYMENT_METHODS_URI . 'assets/img' ) );
$this->load_functions();
$this->load_classes();
// load text domain
add_action( 'plugins_loaded', array( &$this, 'load_plugin_textdomain' ) );
// scripts and styles
if ( ! is_admin() ) :
add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_styles' ) );
add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
endif;
// register widgets
add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
// add shortcode
add_shortcode( 'v_woo_payment_methods', array( &$this, 'get_payment_methods' ) );
}
/**
* Load theme textdomain
*
* @return void
*
* @since 2014-09-08
* @version 2014-09-08
**************************************************/
static function load_plugin_textdomain() {
load_plugin_textdomain( 'vendocrat-payment-methods', PAYMENT_METHODS_DIR .'languages' );
}
/**
* Override some WooCommerce plugin functionality
*
* @return void
*
* @since 2014-09-07
* @version 2014-09-07
**************************************************/
function load_functions() {}
/**
* Override some WooCommerce plugin functionality
*
* @return void
*
* @since 2014-09-07
* @version 2014-09-07
**************************************************/
function load_classes() {}
/**
* Enqueue Styles
*
* @return void
*
* @since 2014-09-07
* @version 2014-09-07
**************************************************/
function enqueue_styles() {
if ( ! wp_style_is( 'vendocrat-payment-webfont', 'registered' ) ) {
wp_register_style( 'vendocrat-payment-webfont', PAYMENT_METHODS_CSS_URI .'payment-webfont.min.css', array(), false, 'all' );
}
wp_enqueue_style( 'vendocrat-payment-webfont' );
wp_register_style( 'vendocrat-payment-methods', PAYMENT_METHODS_CSS_URI .'payment-methods.css', array(), false, 'all' );
wp_enqueue_style( 'vendocrat-payment-methods' );
}
/**
* Enqueue Scripts
*
* @return void
*
* @since 2014-09-07
* @version 2014-09-07
**************************************************/
function enqueue_scripts() {}
/**
* Register Widgets
*
* @return void
*
* @since 2014-09-07
* @version 2014-09-08
**************************************************/
function register_widgets() {
require_once PAYMENT_METHODS_DIR .'classes/class-widget-payment-methods.php';
register_widget( 'vendocrat_Widget_Payment_Methods' );
}
/**
* Woo Accepted Payment Methods
*
* @since 2014-09-07
* @version 2014-09-08
**************************************************/
function get_payment_methods( $atts = array(), $content = null ) {
extract(
shortcode_atts(
array(
'methods' => array(), // keys are the gateway slugs (lowercase) for the icon class, values are the title attributes
'style' => 'default', // default, inverse, o/outline
'tooltip' => false, // adds data attributes to icon to be used for diplaying tooltips (made for Bootstrap)
'xclass' => false, // add any extra classes, seperated by a space
), $atts
)
);
$class = 'payment-methods';
$class.= ($style) ? ' payment-methods-'. $style : '';
$class.= ($xclass) ? ' '. $xclass : '';
$output = '<ul';
$output.= ($class) ? ' class="'. esc_attr( trim($class) ) .'"' : '';
$output.= '>';
// use the passed methods array if it's not empty, otherwhise use available gateways/methods
if ( empty( $methods ) ) {
$gateways = $this->get_available_gateways();
$methods = $gateways['methods'];
}
// sort array
ksort($methods);
// let the magic happen
foreach ( $methods as $key => $value ) {
$id = $key;
$title = $value;
$icon = '';
switch ( $key ) {
case 'bank-transfer' :
case 'cheque' :
case 'paybox' :
case 'cash-on-delivery' :
case 'quick' :
case 'wirecard' :
// currently no font icons available, so we spare them
//$icon = '<b class="'. esc_attr( trim($id) ) .'" title="'. esc_attr( trim($title) ) .'">'. $title .'</b>';
break;
default :
$class = 'pw pw-'. $id .' '. $id;
$icon = '<i';
$icon.= ($class) ? ' class="'. esc_attr( trim($class) ) .'"' : '';
$icon.= ($title) ? ' title="'. esc_attr( trim($title) ) .'"' : '';
$icon.= ($tooltip) ? ' data-toggle="tooltip" data-placement="bottom"' : '';
$icon.= '></i>';
break;
}
if ( $icon )
$output.= '<li>'. $icon .'</li>';
}
$output.= '</ul>';
return $output;
}
/**
* Get available gateways
*
* @since 2014-09-07
* @version 2014-09-08
**************************************************/
function get_available_gateways() {
$gateways = array();
$methods = array();
if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateways() ) {
foreach ( $available_gateways as $gateway ) {
$gateway_id = $gateway->id;
$gateway_title = $gateway->get_title();
$gateway_desc = $gateway->get_description();
$gateway_icon = $gateway->get_icon();
switch ( $gateway_id ) {
case 'bacs' :
$methods['bank-transfer'] = __( 'Bank Transfer', 'vendocrat-payment-methods' );
break;
case 'cheque' :
$methods['cheque'] = __( 'Pay with Cheque', 'vendocrat-payment-methods' );
break;
case 'paypal' :
$methods['paypal'] = 'PayPal';
$methods['visa'] = 'Visa';
$methods['mastercard'] = 'MasterCard';
$methods['american-express'] = 'American Express';
$methods['discover'] = 'Discover';
$methods['diners'] = 'Diners Club';
$methods['jcb'] = 'JCB';
break;
case 'stripe' :
$methods['stripe'] = 'Stripe';
$methods['visa'] = 'Visa';
$methods['mastercard'] = 'MasterCard';
$methods['american-express'] = 'American Express';
$methods['discover'] = 'Discover';
$methods['diners'] = 'Diners Club';
$methods['jcb'] = 'JCB';
break;
case 'wirecard' :
$methods['wirecard'] = 'WireCard';
$methods['paypal'] = 'PayPal';
$methods['visa'] = 'Visa';
$methods['mastercard'] = 'MasterCard';
$methods['american-express'] = 'American Express';
$methods['discover'] = 'Discover';
$methods['diners'] = 'Diners Club';
$methods['jcb'] = 'JCB';
$methods['maestro'] = 'Maestro';
$methods['quick'] = 'Quick';
$methods['paybox'] = 'paybox';
$methods['paysafecard'] = 'paysafecard';
$methods['bank-transfer'] = __( 'Bank Transfer', 'vendocrat-payment-methods' );
break;
case 'ClickAndBuy' :
case 'clickandbuy' :
$methods['clickandbuy'] = 'ClickAndBuy';
$methods['bank-transfer'] = __( 'Bank Transfer', 'vendocrat-payment-methods' );
break;
case 'sofortgateway' :
$methods['clickandbuy'] = 'SofortÜberweisung';
$methods['bank-transfer'] = __( 'Bank Transfer', 'vendocrat-payment-methods' );
break;
case 'amazon' :
case 'amazon-fps' :
$methods['amazon'] = 'Amazon';
break;
case 'google' :
case 'wallet' :
case 'google-wallet' :
$methods['clickandbuy'] = 'Google Wallet';
break;
case 'bitpay' :
case 'coinbase' :
case 'bitcoin' :
$methods['bitcoin'] = 'Bitcoin';
break;
case 'cash_on_delivery' :
$methods['cash-on-delivery'] = __( 'Cash on Delivery', 'vendocrat-payment-methods' );
break;
default :
break;
}
$gateways[$gateway_id] = array(
'id' => $gateway_id,
'title' => $gateway_title,
'desc' => $gateway_desc,
'icon' => $gateway_icon,
);
}
}
// remove duplicate methods
$methods = array_unique($methods);
// add methods array to gateways array
$gateways['methods'] = $methods;
return $gateways;
}
} // END Class
global $vendocrat_woo_payment_methods;
$vendocrat_woo_payment_methods = new vendocrat_Woo_Payment_Methods();
/**
* Output payment methods
*
* @since 2014-09-08
* @version 2014-09-08
**************************************************/
function v_woo_payment_methods( $atts = array() ) {
global $vendocrat_woo_payment_methods;
echo $vendocrat_woo_payment_methods->get_payment_methods( $atts = array() );
}
endif;
/*
* NO MORE LOVE TO GIVE
*/
+48
View File
@@ -0,0 +1,48 @@
=== WooCommerce Payment Methods ===
Contributors: vendocrat, AlexanderPoellmann
Donate link: http://example.com/
Tags: woocommerce, credit card, logo, payment
Requires at least: 3.5
Tested up to: 4.1
Stable tag: 0.1.0
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Easily display your accepted payment methods from WooCommerce via shortcode, widget or template tag.
== Description ==
WooCommerce Payment Methods allows you to display your accepted payment methods. By default the plugin shows all available payment methods, but you can also specify them manually.
You can display them via shortcode, widget or template tag in three available styles (default, inverse and outline). We've added several classes, so you can easily style the output to your pleasure.
You are using the famous Bootstrap framework? Awesome, cause we've added the markup for tooltips, so that users can see the payment methods name on hover.
All icons are displayed using the truly awesome icon font <a href="https://github.com/orlandotm/payment-webfont">Payment Webfont</a> by @orlandotm, making them look good on every screen.
Contributions are warmly welcome via <a href="https://github.com/vendocrat/WooComerce-Payment-Methods"><strong>GitHub</strong></a>.
== Installation ==
1. Upload 'woocommerce-accepted-payment-methods' to the '/wp-content/plugins/' directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Display your accepted methods via: Shortcode [v_woo_payment_methods], Widget or template tag '<?php v_woo_payment_methods(); ?>.
4. Done!
== Frequently Asked Questions ==
= Why is payment method {XYZ} missing? =
Please report any missing payment methods via <a href="https://github.com/vendocrat/WooComerce-Payment-Methods"><strong>GitHub's issues system</strong></a> or hit us at <a href="http://twitter.com/vendocrat">@vendocrat</a>.
Note: As we're using a webfont called <a href="https://github.com/orlandotm/payment-webfont">Payment Webfont</a> by @orlandotm, it may be possible that there is just no icon available for your desired payment method. Open an issue at their GitHub repo and ask for it to be added!
== Screenshots ==
1. WooCommerce Payment Methods Shortcodes
2. WooCommerce Payment Methods Widgets
== Changelog ==
= 0.1.0 =
Initial release.
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB