Plugin Directory

Changeset 2944895


Ignore:
Timestamp:
07/29/2023 12:47:52 PM (3 years ago)
Author:
aihimel
Message:

version 1.3.0

Location:
wc-call-for-price/trunk
Files:
54 added
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • wc-call-for-price/trunk/readme.txt

    r2943297 r2944895  
    11=== WC Call For Price ===
    22Contributors: aihimel, iamasadpolash
    3 Tags: call for price, woocommerce, plugin, customizable, image upload, admin page, feature rich
     3Tags: call for price, woocommerce
    44Requires at least: 4.2.2
    55Tested up to: 6.2.2
     
    5353 * Install and Activate
    5454
    55 Thats all you need to do.
     55That's all you need to do.
    5656
    5757
     
    7575== Changelog ==
    7676
     77= 1.3.0 (29 July, 2023) =
     78* Code refactored
     79* Plugin made translation ready
     80* Admin panel design improved
     81* A new settings link added in plugin list page
     82* Plugin feature activation/deactivation added
     83* Security issue fixes
     84
    7785= 1.2.1 (25 July, 2023) =
    7886* Tested up-to WordPress 6.2.2
  • wc-call-for-price/trunk/wc-call-for-price.php

    r2943295 r2944895  
    33 * Plugin Name: WC Call For Price
    44 * Plugin URI: http://www.wordpress.org/wc-call-for-price
    5  * Version: 1.2.1
     5 * Version: 1.3.0
    66 * Author: Aftabul Islam
    77 * Author URI: https://profiles.wordpress.org/aihimel
     
    3131defined('ABSPATH') || die();
    3232
    33 defined( 'WC_CALL_FOR_PRICE_VERSION' ) || define('WC_CALL_FOR_PRICE_VERSION', '1.2.0');
     33require_once( 'vendor/autoload.php' );
     34
     35// Constants
     36defined( 'WC_CALL_FOR_PRICE_VERSION' ) || define('WC_CALL_FOR_PRICE_VERSION', '1.3.0');
    3437defined('WC_CALL_FOR_PRICE_PATH') || define('WC_CALL_FOR_PRICE_PATH', plugin_basename(__FILE__));
     38defined( 'WC_CALL_FOR_PRICE_ACTIVATION_DEACTIVATION_FILE' ) || define( 'WC_CALL_FOR_PRICE_ACTIVATION_DEACTIVATION_FILE', __DIR__ . '/activation-deactivation.php' );
     39defined('WC_CALL_FOR_PRICE_TEMPLATE_PATH') || define('WC_CALL_FOR_PRICE_TEMPLATE_PATH', plugin_dir_path( __FILE__ ) );
    3540
    36 // Activation and Deactivation Hooks
    37 register_activation_hook(__FILE__, 'wc_call_for_price__activate');
    38 register_deactivation_hook(__FILE__, 'wc_call_for_price__deactivate');
     41// Activation Deactivation
     42register_activation_hook(WC_CALL_FOR_PRICE_ACTIVATION_DEACTIVATION_FILE, 'wc_call_for_price__activate');
     43register_deactivation_hook(WC_CALL_FOR_PRICE_ACTIVATION_DEACTIVATION_FILE, 'wc_call_for_price__deactivate');
    3944
    40 // Loading FrontEnd Assets
    41 add_action('wp_enqueue_scripts', 'wc_call_for_price__frontend_assets');
    42 // WooCommerce Filter
    43 add_filter('woocommerce_empty_price_html', 'wc_call_for_price__call_for_price', 11);
    44 
    45 // Activating the plugin
    46 if( ! function_exists('wc_call_for_price__activate') ) {
    47     /**
    48      * Checking if WooCommerce is installed and activated
    49      * @return void
    50      */
    51     function wc_call_for_price__activate(){
    52 
    53     // Checking if the woocommerce plugin is available
    54     if( ! class_exists('WooCommerce')){
    55 
    56         deactivate_plugins(WC_CALL_FOR_PRICE_PATH);
    57 
    58         // Adding an action to show notice at admin panel
    59         add_action('admin_notices', 'wc_call_for_price__wc_missing_notice');
    60 
    61         return;
    62     }
    63 
    64     // Creating Options
    65     $prefix = 'wc_call_for_price__'; // Prefix for every options
    66     add_option($prefix.'text', 'Call For Price', $deprecated = '', $atuoload = 'yes');
    67     add_option($prefix.'show_image', 'off', $deprecated = '', $atuoload = 'yes');
    68     add_option($prefix.'image', 'cfp_1', $deprecated = '', $atuoload = 'yes');
    69     add_option($prefix.'show_uploaded_image', 'off', $deprecated = '', $atuoload = 'yes');
    70     add_option($prefix.'upload_image', '', $deprecated = '', $atuoload = 'yes');
    71 
    72     // Successful Activation Admin Notice
    73     add_action('admin_notices', 'wc_call_for_price__successful_activation_notice');
    74 }}
    75 
    76 // Deactivating the plugin
    77 if(!function_exists('wc_call_for_price__deactivate')){ function wc_call_for_price__deactivate(){
    78 
    79     // Removing Options
    80     $prefix = 'wc_call_for_price__';
    81     delete_option($prefix.'text');
    82     delete_option($prefix.'show_image');
    83     delete_option($prefix.'image');
    84     delete_option($prefix.'show_uploaded_image');
    85     delete_option($prefix.'upload_image');
    86 
    87 }}
    88 
    89 // Plugin Successful Activation Notice
    90 if(!function_exists('wc_call_for_price__successful_activation_notice')){function wc_call_for_price__successful_activation_notice(){
    91     printf('<div class="success"><p>'.__('WC Call For Price plugin has been successfully activated. Thank you for choosing this plugin.').'</p></div>');
    92 }}
    93 
    94 // WooCommerce Plugin Missing Notice Function
    95 if(!function_exists('wc_call_for_price__wc_missing_notice')){function wc_call_for_price__wc_missing_notice(){
    96 
    97     printf('<div class="error"><p>'.__("The WC Call for Price plugin will not work without WooCommerce plugin.").'</p></div>');
    98 
    99     printf('<div class="updated"><p>'.__('Please install <a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce plugin</a>').'</p></div>');
    100 
    101 }}
    102 
    103 // Loading frontend assets
    104 if(!function_exists('wc_call_for_price__frontend_assets')){function wc_call_for_price__frontend_assets(){
    105 
    106     wp_enqueue_script('jquery');
    107 
    108 }}
    109 
    110 // WC Call For Price Function
    111 if(!function_exists('wc_call_for_price__call_for_price')){function wc_call_for_price__call_for_price($price){
    112     $prefix = 'wc_call_for_price__';
    113 
    114     if(get_option($prefix.'show_uploaded_image') == 'on') return '<img src="'.get_option($prefix.'upload_image').'" />';
    115 
    116     if(get_option($prefix.'show_image') == 'on') return '<img src="'.plugins_url('/wc-call-for-price/images/'.get_option($prefix.'image')).'.png" />';
    117         else {
    118             $temp = get_option($prefix.'text');
    119             if(!empty($temp)) return get_option($prefix.'text');
    120                 else return 'Call For Price';
    121         }
    122 }}
    123 
    124 
    125 
    126 /*--------------------------------------------- ADMIN OPTIONS -----------------------------------------------------*/
    127 add_action('admin_enqueue_scripts', 'wc_call_for_price__admin_assets');
    128 add_action('admin_menu', 'wc_call_for_price__menu');
    129 
    130 // Loading Admin Assets
    131 if(!function_exists('wc_call_for_price__admin_assets')){function wc_call_for_price__admin_assets(){
    132 
    133     wp_enqueue_media();
    134     wp_enqueue_script('jquery');
    135    
    136 }}
    137 
    138 // Admin menu Options
    139 if(!function_exists('wc_call_for_price__menu')){function wc_call_for_price__menu(){
    140 
    141     add_submenu_page('woocommerce', 'WooCommerce Call For Price', 'Call For Price', 'manage_options', 'wc-call-for-price', 'wc_call_for_price__menu_options');
    142 
    143 }}
    144 
    145 // Admin menu Options Page
    146 if(!function_exists('wc_call_for_price__menu_options')){function wc_call_for_price__menu_options(){
    147 
    148     if(!current_user_can('manage_options')) wp_die(__('You don\'t have permission to access this page'));
    149         else require_once('wp_call_for_price__manage_options_form.php');
    150 
    151 }}
    152 ?>
     45// Booting the plugin
     46\WCPress\WCP\Boot::init();
Note: See TracChangeset for help on using the changeset viewer.