Plugin Directory

Changeset 2793234


Ignore:
Timestamp:
10/03/2022 05:24:53 AM (3 years ago)
Author:
lucius0101
Message:

2.0.0 Major Release

Location:
woo-earn-sharing/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • woo-earn-sharing/trunk/README.txt

    r2034418 r2793234  
    44Tags: woocommerce, friend code, referral, affiliate
    55Requires at least: 3.5
    6 Tested up to: 5.0.3
    7 Stable tag: 1.0.1
     6Tested up to: 6.0.2
     7Stable tag: 2.0.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    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
     15Let your users share their own codes to earn discounts!
     16
     17When 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*
    1820
    1921**Feature:**
    20 You can enable returning the money to a user who used your balance but that the purchase was refunded, canceled or failed!
     22You can enable returning the money to a user who used their balance but had the purchase refunded, canceled, or failed.
    2123
    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
     93If 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.
    2494
    2595*Example:*
     
    2999Total purchase: USD 1.00
    30100
    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
     101And then, the user will have a USD 51.00 balance.
    36102
    37103== Installation ==
     
    48114
    49115== Changelog ==
     116= 2.0 =
     117* Many code improvements
     118* Race-condition prevention
    50119= 1.1 =
    51120* Added Max Refund option
  • woo-earn-sharing/trunk/includes/class-woo-earn-sharing-activator.php

    r1973077 r2793234  
    44 * Fired during plugin activation
    55 *
    6  * @link       https://luciusdesenvolvimento.com
     6 * @link       https://lucio.dev
    77 * @since      1.0.0
    88 *
    99 * @package    Woo_Earn_Sharing
    10  * @subpackage Woo_Earn_Sharing/includes
    1110 */
    1211
     
    1413 * Fired during plugin activation.
    1514 *
    16  * This class defines all code necessary to run during the plugin's activation.
     15 * Resaves Permalinks and adds default options.
    1716 *
    1817 * @since      1.0.0
    1918 * @package    Woo_Earn_Sharing
    20  * @subpackage Woo_Earn_Sharing/includes
    21  * @author     Lucius Desenvolvimento <[email protected]>
     19 * @author     Lucio Dev <[email protected]>
    2220 */
    2321class Woo_Earn_Sharing_Activator {
    2422
    2523    /**
    26      *
    2724     * Plugin Activation
    28      * Resave Permalinks
     25     * Checks if WooCommerce is activated, resaves permalinks and adds default options.
    2926     *
    3027     * @since    1.0.0
    3128     */
    3229    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        }
    3644    }
    37 
    3845}
  • woo-earn-sharing/trunk/includes/class-woo-earn-sharing-i18n.php

    r1973077 r2793234  
    11<?php
    22
    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.
     4if ( ! defined( 'WPINC' ) ) {
     5    die;
     6}
    157
    16 /**
    17  * Define the internationalization functionality.
    18  *
    19  * Loads and defines the internationalization files for this plugin
    20  * so that it is ready for translation.
    21  *
    22  * @since      1.0.0
    23  * @package    Woo_Earn_Sharing
    24  * @subpackage Woo_Earn_Sharing/includes
    25  * @author     Lucius Desenvolvimento <[email protected]>
    26  */
    278class Woo_Earn_Sharing_i18n {
    28 
    29 
    309    /**
    3110     * Load the plugin text domain for translation.
     
    3312     * @since    1.0.0
    3413     */
    35     public function load_plugin_textdomain() {
    36 
     14    public static function load_plugin_textdomain() {
    3715        load_plugin_textdomain(
    3816            'woo-earn-sharing',
     
    4220
    4321    }
    44 
    45 
    46 
    4722}
     23add_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  
    11<?php
    22/**
     3 * Removes the plugin's settings.
    34 *
    4  * @link       https://luciusdesenvolvimento.com
     5 * @link       https://lucio.dev
    56 * @since      1.0.0
    67 *
     
    1213    exit;
    1314}
     15
     16delete_option( 'woo_earn_sharing_rewrite' );
     17delete_option( 'woo_earn_sharing_options' );
  • woo-earn-sharing/trunk/woo-earn-sharing.php

    r1973077 r2793234  
    11<?php
    2 
    32/**
    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
    58 * @since             1.0.0
    69 * @package           Woo_Earn_Sharing
    710 *
    8  * @wordpress-plugin
    911 * Plugin Name:       Woo Earn Sharing
    10  * Plugin URI:        https://luciusdesenvolvimento.com/Woo-Earn-Sharing
    11  * Description:       Let your users share their own codes to earn discounts.
    12  * Version:           1.0.0
    13  * Author:            Lucius Desenvolvimento
    14  * Author URI:        https://luciusdesenvolvimento.com
     12 * 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
    1517 * License:           GPL-2.0+
    1618 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     
    2426}
    2527
    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' );
     28define( 'WOOES_VERSION', '2.0.0' );
     29define( 'WOOES_ROOT_DIR', __DIR__ );
     30define( 'WOOES_ROOT_URL', plugin_dir_url( __FILE__ ) );
     31define( 'WOOES_ROOT_FILE', plugin_basename( __FILE__ ) );
    3132
    3233/**
    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
    3537 */
    36 function activate_woo_earn_sharing() {
    37     require_once plugin_dir_path( __FILE__ ) . 'includes/class-woo-earn-sharing-activator.php';
     38function woo_earn_sharing_activate() {
     39    require_once WOOES_ROOT_DIR . '/includes/class-woo-earn-sharing-activator.php';
    3840    Woo_Earn_Sharing_Activator::activate();
    3941}
    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';
     42register_activation_hook( __FILE__, 'woo_earn_sharing_activate' );
    5843
    5944/**
    6045 * Begins execution of the plugin.
    61  *
    6246 *
    6347 * @since    1.0.0
     
    6549function run_woo_earn_sharing() {
    6650
    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';
    6957
     58    new Woo_Earn_Sharing_i18n();
     59    new Woo_Earn_Sharing\Admin();
     60    new Woo_Earn_Sharing\Settings();
     61    new Woo_Earn_Sharing\Common();
    7062}
    7163run_woo_earn_sharing();
Note: See TracChangeset for help on using the changeset viewer.