Changeset 2793234
- Timestamp:
- 10/03/2022 05:24:53 AM (3 years ago)
- Location:
- woo-earn-sharing/trunk
- Files:
-
- 7 edited
-
README.txt (modified) (4 diffs)
-
includes/class-woo-earn-sharing-activator.php (modified) (2 diffs)
-
includes/class-woo-earn-sharing-i18n.php (modified) (3 diffs)
-
includes/index.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
uninstall.php (modified) (2 diffs)
-
woo-earn-sharing.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-earn-sharing/trunk/README.txt
r2034418 r2793234 4 4 Tags: woocommerce, friend code, referral, affiliate 5 5 Requires at least: 3.5 6 Tested up to: 5.0.37 Stable tag: 1.0.16 Tested up to: 6.0.2 7 Stable tag: 2.0.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 Automatically generate codes for your users to be able to share with friends 16 When a code is used, and the request is given as "Completed", the code owner will receive a percentage (set in the dashboard admin of Wordpress), which will be in your balance 17 The balance will be used on the next purchase 15 Let your users share their own codes to earn discounts! 16 17 When someone uses a referral code when purchasing in your shop and the order is "Completed", the code owner will receive a percentage (set in the dashboard admin of WordPress), which will be added to their balance. The balance can then be used on the next purchase. 18 19 *See the FAQ for more details* 18 20 19 21 **Feature:** 20 You can enable returning the money to a user who used your balance but that the purchase was refunded, canceled or failed!22 You can enable returning the money to a user who used their balance but had the purchase refunded, canceled, or failed. 21 23 22 *Note:* 23 If a user makes a purchase that is less than their balance, ie their balance is greater than what they are trying to buy, the purchase amount will be 1, to avoid problems with payment methods when trying to finalize a purchase costing 0.00. 24 **Shortcodes!** 25 [wooes_user_balance] - Shows the current user balance 26 [wooes_user_code] - Shows the current user code 27 28 29 **Filters!** 30 #### wooes_user_balance 31 ##### Filters the user's balance 32 33 - $balance float The user's balance. 34 - $user_id integer The user ID. 35 36 <br> 37 38 #### wooes_get_user_code 39 ##### Filters the user's code 40 41 - $code string The code fetched from the user. 42 - $user_id integer The user ID. 43 - $format boolean Whether or not the code should be formatted. 44 45 <br> 46 47 #### wooes_get_user_by_code 48 ##### Filters the user by the code 49 50 - $user \WP_User|false The fetched user of false if none. 51 - $code string The code used to search the user. 52 53 <br> 54 55 #### wooes_new_balance 56 ##### Filters the new user's balance 57 58 - $new_balance float The new balance value. 59 - $money float The money being added. 60 - $old_balance float The previous value. 61 - $giving_back boolean Whether it's giving the money back or not. 62 63 <br> 64 65 #### wooes_new_balance 66 ##### Filters the new user's balance 67 68 - $new_balance float The new balance value. 69 - $money float The money being added. 70 - $old_balance float The previous value. 71 - $giving_back float Whether it's giving the money back or not. 72 73 <br> 74 75 #### wooes_generate_new_referral_code 76 ##### Filters the newly generated code 77 78 - $code string The randomly generated code. 79 - $length integer The length of the code, from settings. 80 - $alphanumeric boolean Whether it's an alphanumeric code, from settings. 81 82 <br> 83 84 #### wooes_format_code 85 ##### Filters the formatted code 86 87 - $code string The code. 88 89 == Frequently Asked Questions == 90 91 = How is the balance used? = 92 93 If a user makes a purchase that is less than their balance, i.e., their balance is greater than what they are trying to buy, the purchase amount will be 1, to avoid problems with payment methods when trying to finalize a purchase costing 0.00. 24 94 25 95 *Example:* … … 29 99 Total purchase: USD 1.00 30 100 31 And then the user will have a USD 51.00 balance. 32 33 **Shortcodes!** 34 [wooes_user_balance] - Show current user balance 35 [wooes_user_code] - Show current user code 101 And then, the user will have a USD 51.00 balance. 36 102 37 103 == Installation == … … 48 114 49 115 == Changelog == 116 = 2.0 = 117 * Many code improvements 118 * Race-condition prevention 50 119 = 1.1 = 51 120 * Added Max Refund option -
woo-earn-sharing/trunk/includes/class-woo-earn-sharing-activator.php
r1973077 r2793234 4 4 * Fired during plugin activation 5 5 * 6 * @link https://luci usdesenvolvimento.com6 * @link https://lucio.dev 7 7 * @since 1.0.0 8 8 * 9 9 * @package Woo_Earn_Sharing 10 * @subpackage Woo_Earn_Sharing/includes11 10 */ 12 11 … … 14 13 * Fired during plugin activation. 15 14 * 16 * This class defines all code necessary to run during the plugin's activation.15 * Resaves Permalinks and adds default options. 17 16 * 18 17 * @since 1.0.0 19 18 * @package Woo_Earn_Sharing 20 * @subpackage Woo_Earn_Sharing/includes 21 * @author Lucius Desenvolvimento <[email protected]> 19 * @author Lucio Dev <[email protected]> 22 20 */ 23 21 class Woo_Earn_Sharing_Activator { 24 22 25 23 /** 26 *27 24 * Plugin Activation 28 * Resave Permalinks25 * Checks if WooCommerce is activated, resaves permalinks and adds default options. 29 26 * 30 27 * @since 1.0.0 31 28 */ 32 29 public static function activate() { 33 if ( ! get_option( 'wooes_flush_rewrite_rules_flag' ) ) { 34 add_option( 'wooes_flush_rewrite_rules_flag', true ); 35 } 30 if ( ! get_option( 'woo_earn_sharing_rewrite' ) ) { 31 add_option( 'woo_earn_sharing_rewrite', true ); 32 } 33 34 if ( ! get_option( 'woo_earn_sharing_options' ) ) { 35 $options = array( 36 'wooes_reward_percentage' => 10, 37 'wooes_code_length' => 9, 38 'wooes_money_back' => true, 39 'wooes_code_alphanumeric' => true, 40 'wooes_page_html' => '<p>[wooes_user_balance]<br>[wooes_user_code]</p>', 41 ); 42 add_option( 'woo_earn_sharing_options', $options ); 43 } 36 44 } 37 38 45 } -
woo-earn-sharing/trunk/includes/class-woo-earn-sharing-i18n.php
r1973077 r2793234 1 1 <?php 2 2 3 /** 4 * Define the internationalization functionality 5 * 6 * Loads and defines the internationalization files for this plugin 7 * so that it is ready for translation. 8 * 9 * @link https://luciusdesenvolvimento.com 10 * @since 1.0.0 11 * 12 * @package Woo_Earn_Sharing 13 * @subpackage Woo_Earn_Sharing/includes 14 */ 3 // If this file is called directly, abort. 4 if ( ! defined( 'WPINC' ) ) { 5 die; 6 } 15 7 16 /**17 * Define the internationalization functionality.18 *19 * Loads and defines the internationalization files for this plugin20 * so that it is ready for translation.21 *22 * @since 1.0.023 * @package Woo_Earn_Sharing24 * @subpackage Woo_Earn_Sharing/includes25 * @author Lucius Desenvolvimento <[email protected]>26 */27 8 class Woo_Earn_Sharing_i18n { 28 29 30 9 /** 31 10 * Load the plugin text domain for translation. … … 33 12 * @since 1.0.0 34 13 */ 35 public function load_plugin_textdomain() { 36 14 public static function load_plugin_textdomain() { 37 15 load_plugin_textdomain( 38 16 'woo-earn-sharing', … … 42 20 43 21 } 44 45 46 47 22 } 23 add_action( 'plugins_loaded', array( 'Woo_Earn_Sharing_i18n', 'load_plugin_textdomain' ) ); -
woo-earn-sharing/trunk/includes/index.php
r1973077 r2793234 1 <?php // Silence is golden 1 <?php // phpcs:ignore PEAR.Commenting.FileComment.Missing 2 // Silence is golden. -
woo-earn-sharing/trunk/index.php
r1973077 r2793234 1 <?php // Silence is golden 1 <?php // phpcs:ignore PEAR.Commenting.FileComment.Missing 2 // Silence is golden. -
woo-earn-sharing/trunk/uninstall.php
r1973077 r2793234 1 1 <?php 2 2 /** 3 * Removes the plugin's settings. 3 4 * 4 * @link https://luci usdesenvolvimento.com5 * @link https://lucio.dev 5 6 * @since 1.0.0 6 7 * … … 12 13 exit; 13 14 } 15 16 delete_option( 'woo_earn_sharing_rewrite' ); 17 delete_option( 'woo_earn_sharing_options' ); -
woo-earn-sharing/trunk/woo-earn-sharing.php
r1973077 r2793234 1 1 <?php 2 3 2 /** 4 * @link https://luciusdesenvolvimento.com 3 * The plugin main file 4 * 5 * The plugin creates referral codes for users, that can be used when a new order is made, given the code's owner a defined comission. 6 * 7 * @link https://lucio.dev 5 8 * @since 1.0.0 6 9 * @package Woo_Earn_Sharing 7 10 * 8 * @wordpress-plugin9 11 * Plugin Name: Woo Earn Sharing 10 * Plugin URI: https://luci usdesenvolvimento.com/Woo-Earn-Sharing11 * Description: Let your users share their own codes toearn discounts.12 * Version: 1.0.013 * Author: Luci us Desenvolvimento14 * Author URI: https://luci usdesenvolvimento.com12 * Plugin URI: https://lucio.dev/Woo-Earn-Sharing 13 * Description: Let your users share their own codes and earn discounts. 14 * Version: 2.0.0 15 * Author: Lucio Dev 16 * Author URI: https://lucio.dev 15 17 * License: GPL-2.0+ 16 18 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 24 26 } 25 27 26 /** 27 * Currently plugin version. 28 * Start at version 1.0.0 and use SemVer - https://semver.org 29 */ 30 define( 'WOOES_VERSION', '1.0.0' ); 28 define( 'WOOES_VERSION', '2.0.0' ); 29 define( 'WOOES_ROOT_DIR', __DIR__ ); 30 define( 'WOOES_ROOT_URL', plugin_dir_url( __FILE__ ) ); 31 define( 'WOOES_ROOT_FILE', plugin_basename( __FILE__ ) ); 31 32 32 33 /** 33 * The code that runs during plugin activation. 34 * This action is documented in includes/class-woo-earn-sharing-activator.php 34 * The activation hook function. 35 * 36 * @return void 35 37 */ 36 function activate_woo_earn_sharing() {37 require_once plugin_dir_path( __FILE__ ) . 'includes/class-woo-earn-sharing-activator.php';38 function woo_earn_sharing_activate() { 39 require_once WOOES_ROOT_DIR . '/includes/class-woo-earn-sharing-activator.php'; 38 40 Woo_Earn_Sharing_Activator::activate(); 39 41 } 40 41 /** 42 * The code that runs during plugin deactivation. 43 * This action is documented in includes/class-woo-earn-sharing-deactivator.php 44 */ 45 function deactivate_woo_earn_sharing() { 46 require_once plugin_dir_path( __FILE__ ) . 'includes/class-woo-earn-sharing-deactivator.php'; 47 Woo_Earn_Sharing_Deactivator::deactivate(); 48 } 49 50 register_activation_hook( __FILE__, 'activate_woo_earn_sharing' ); 51 register_deactivation_hook( __FILE__, 'deactivate_woo_earn_sharing' ); 52 53 /** 54 * The core plugin class that is used to define internationalization, 55 * admin-specific hooks, and public-facing site hooks. 56 */ 57 require plugin_dir_path( __FILE__ ) . 'includes/class-woo-earn-sharing.php'; 42 register_activation_hook( __FILE__, 'woo_earn_sharing_activate' ); 58 43 59 44 /** 60 45 * Begins execution of the plugin. 61 *62 46 * 63 47 * @since 1.0.0 … … 65 49 function run_woo_earn_sharing() { 66 50 67 $plugin = new Woo_Earn_Sharing(); 68 $plugin->run(); 51 require_once WOOES_ROOT_DIR . '/includes/class-woo-earn-sharing-i18n.php'; 52 require_once WOOES_ROOT_DIR . '/class/class-woo-earn-sharing-util.php'; 53 require_once WOOES_ROOT_DIR . '/class/class-woo-earn-sharing-race-condition.php'; 54 require_once WOOES_ROOT_DIR . '/class/class-woo-earn-sharing-admin.php'; 55 require_once WOOES_ROOT_DIR . '/class/class-woo-earn-sharing-settings.php'; 56 require_once WOOES_ROOT_DIR . '/class/class-woo-earn-sharing-common.php'; 69 57 58 new Woo_Earn_Sharing_i18n(); 59 new Woo_Earn_Sharing\Admin(); 60 new Woo_Earn_Sharing\Settings(); 61 new Woo_Earn_Sharing\Common(); 70 62 } 71 63 run_woo_earn_sharing();
Note: See TracChangeset
for help on using the changeset viewer.