Plugin Directory

Changeset 2716683

Timestamp:
04/30/2022 03:53:31 PM (2 years ago)
Author:
mahfuz01
Message:

Tagging version trunk

Location:
product-quotation-for-woocommerce/trunk
Files:
30 added
5 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • product-quotation-for-woocommerce/trunk/README.txt

    r2716244 r2716683  
    44Requires at least: 4.0
    55Tested up to: 5.9
    6 Stable tag: 1.2.5
     6Stable tag:
    77License: GPLv3 or later
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    6868== Changelog ==
    6969
     70
     71
     72
     73
     74
     75
     76
     77
    7078= 1.2.5- 28-04-2022 =
    7179* Fixed: Quotation Cart page issue
  • product-quotation-for-woocommerce/trunk/assets/css/pqfw-admin.css

    r2709540 r2716683  
    131131    transition: 0.4s;
    132132}
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
  • product-quotation-for-woocommerce/trunk/assets/css/pqfw-frontend.css

    r2711510 r2716683  
    131131}
    132132
    133 a.button.pqfw-button.pqfw-add-to-quotation {font-size: 14px;margin: 10px 0;display: inline-block;}
     133a.button.pqfw-button.pqfw-add-to-quotation {
     134    font-size: 14px;
     135    margin: 10px 0;
     136    display: inline-block;
     137    transition: all 0.3s ease-in-out;
     138}
    134139
    135140a.pqfw-view-quotation-cart {font-size: 14px;display: block;text-decoration: underline;}
  • product-quotation-for-woocommerce/trunk/assets/js/pqfw-frontend.js

    r2711510 r2716683  
    5757        },
    5858        getVariationDetails : function () {
    59             var variation
    60                 = $("form.variations_form input[name='variation_id']").val(),
    61                 details = {};
     59            var variation  = $("form.variations_form input[name='variation_id']").val(),
     60                details    = {};
    6261
    6362            if (typeof variation != "undefined" && variation != 0) {
     
    9998                emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
    10099                errors = null,
    101                 resposneStatus = f.find('.pqfw-form-response-status');
     100                resposneStatus = ('.pqfw-form-response-status');
    102101
    103102            t.on( "click", "#rsrfqfwc_submit", function ( ev ) {
     
    137136                            }
    138137                        }
    139                         if( $input.attr( "type" ) === "email" ) {
    140 
     138                        if ( $input.attr( "type" ) === "email" ) {
    141139                            if( $input.prop( "required" ) ) {
    142140                                if( $input.val() !== '' && emailReg.test( $input.val() ) ) {
     
    148146                                }
    149147                            }
    150 
    151148                        }
    152149                    }
    153150                });
    154151
    155 
    156                 if( !errors ) {
     152                if ( ! errors ) {
    157153                    // preparing data
    158154                    var data = {};
     
    198194                                    });
    199195
     196
     197
     198
     199
     200
    200201                                    setTimeout(function() {
    201202                                        window.pqfwCart.initialize();
    202                                     }, 2000);
    203 
     203                                    }, 1000);
    204204                                }else {
    205205                                    resposneStatus.removeClass('success');
  • product-quotation-for-woocommerce/trunk/includes/Classes/class-admin.php

    r2709540 r2716683  
    4040     */
    4141    public function menus() {
     42
     43
    4244        add_submenu_page(
    4345            'edit.php?post_type=pqfw_quotations',
    44             __( 'Old backed up entries', 'PQFW' ),
    45             __( 'Backup', 'PQFW' ),
     46            __( '', 'PQFW' ),
     47            ,
    4648            'manage_options',
    47             'pqfw-entries-page',
    48             [ $this, 'display' ]
    49         );
     49            'pqfw-help',
     50            [ $this, 'displayHelp' ]
     51        );
     52
     53        if ( isset( $_GET['post_type'] ) && 'pqfw_quotations' === $_GET['post_type'] ) {
     54            // We don't want any plugin adding notices to our screens. Let's clear them out here.
     55            add_action( 'admin_footer_text', [ $this, 'addFooterText' ] );
     56        }
     57    }
     58
     59    /**
     60     * Add footer text to the WordPress admin screens.
     61     *
     62     * @since  4.0.0
     63     * @return void
     64     */
     65    public function addFooterText() {
     66        $linkText = esc_html__( 'Give us a 5-star rating!', 'PQFW' );
     67        $href     = 'https://wordpress.org/support/plugin/product-quotation-for-woocommerce/reviews/#new-post';
     68
     69        $link1 = sprintf(
     70            '<a href="%1$s" target="_blank" title="%2$s">&#9733;&#9733;&#9733;&#9733;&#9733;</a>',
     71            $href,
     72            $linkText
     73        );
     74
     75        $link2 = sprintf(
     76            '<a href="%1$s" target="_blank" title="%2$s">WordPress.org</a>',
     77            $href,
     78            $linkText
     79        );
     80
     81        printf(
     82            // Translators: 1 - The plugin name ("PageSpeed Optimizer for Elementor"), - 2 - This placeholder will be replaced with star icons.
     83            esc_html__( 'Please rate %1$s %2$s on %3$s to help us spread the word. Thank you!', 'PQFW' ),
     84            sprintf( '<strong>%1$s</strong>', esc_html( PQFW_PLUGIN_NAME ) ),
     85            wp_kses_post( $link1 ),
     86            wp_kses_post( $link2 )
     87        );
     88    }
     89
     90    /**
     91     * Displaying the 'Help' page.
     92     *
     93     * @since 1.2.6
     94     */
     95    public function displayHelp() {
     96        require_once PQFW_PLUGIN_PATH . 'includes/Views/help.php';
    5097    }
    5198
     
    66113        }
    67114
    68         if ( 'pqfw_quotations_page_pqfw-settings' === $screen->id || 'pqfw_quotations_page_pqfw-entries-page' === $screen->id ) {
     115        if ( 'pqfw_quotations_page_pqfw-settings' === $screen->id || 'pqfw_quotations_page_pqfw-entries-page' === $screen->id ) {
    69116            wp_enqueue_style(
    70117                'pqfw-admin',
     
    73120            );
    74121        }
    75     }
    76 
    77     /**
    78      * Loading layout page tamplate.
    79      *
    80      * @since 1.0.0
    81      */
    82     public function display() {
    83         include PQFW_PLUGIN_VIEWS . 'layout.php';
    84122    }
    85123
     
    165203     */
    166204    public function displayQuotationDetail( $quotation ) {
    167         include_once PQFW_PLUGIN_PATH . 'includes/Views/partials/quotation-detail.php';
     205        include_once PQFW_PLUGIN_quotation-detail.php';
    168206    }
    169207
     
    176214     */
    177215    public function displayQuotationProductsDetail( $quotation ) {
    178         include_once PQFW_PLUGIN_PATH . 'includes/Views/partials/quotation-products-detail.php';
     216        include_once PQFW_PLUGIN_quotation-products-detail.php';
    179217    }
    180218
  • product-quotation-for-woocommerce/trunk/includes/Classes/class-form.php

    r2716244 r2716683  
    3535    public function __construct() {
    3636
    37         $this->quotationButtonPosition = 'woocommerce_after_shop_loop_item';
    38 
    39         add_action( 'woocommerce_single_product_summary', [ $this, 'addButtonOnSinglePage' ] );
     37        $this->quotationButtonPosition = pqfw()->settings->get( 'button_position' );
     38        $this->quotationButtonPositionInSingleProduct = pqfw()->settings->get( 'button_position_single_product' );
     39
     40        add_action( $this->quotationButtonPositionInSingleProduct, [ $this, 'addButtonOnSinglePage' ] );
    4041        add_action( $this->quotationButtonPosition, [ $this, 'addButton' ] );
    4142
     
    9091            'all'
    9192        );
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
    92141    }
    93142
     
    104153        global $product;
    105154
    106         if ( $product->is_type( 'variable' ) ) {
    107             echo '<a class="button pqfw-button pqfw-add-to-quotation pqfw-add-to-quotation-variable" href="' . esc_url( $product->get_permalink() ) . '">
    108             ' . esc_html__( 'Add to Quotation', 'pqfw' ) . '
    109             </a>';
    110         } else {
    111             echo '<a class="button pqfw-button pqfw-add-to-quotation pqfw-add-to-quotation-single" href="javascript:void(0)" data-id="' . absint( $product->get_id() ) . '">'
    112             . esc_html__( 'Add to Quotation', 'pqfw' ) .
    113             '</a>';
     155        $buttonText = pqfw()->settings->get( 'button_text' );
     156
     157        if ( ! empty( $buttonText ) ) {
     158            if ( $product->is_type( 'variable' ) ) {
     159                echo '<a class="button pqfw-button pqfw-add-to-quotation pqfw-add-to-quotation-variable" href="' . esc_url( $product->get_permalink() ) . '">
     160                ' . esc_html( $buttonText ) . '
     161                </a>';
     162            } else {
     163                echo '<a class="button pqfw-button pqfw-add-to-quotation pqfw-add-to-quotation-single" href="javascript:void(0)" data-id="' . absint( $product->get_id() ) . '">'
     164                . esc_html( $buttonText ) .
     165                '</a>';
     166            }
    114167        }
    115168    }
     
    125178        }
    126179
    127         global $product;
    128         echo '<a class="button pqfw-button pqfw-add-to-quotation pqfw-add-to-quotation-single" href="javascript:void(0)" data-id="' . absint( $product->get_id() ) . '">'
    129         . esc_html__( 'Add to Quotation', 'pqfw' ) .
    130         '</a>';
     180        $buttonText = pqfw()->settings->get( 'button_text' );
     181
     182        if ( ! empty( $buttonText ) ) {
     183            global $product;
     184            echo '<a class="button pqfw-button pqfw-add-to-quotation pqfw-add-to-quotation-single" href="javascript:void(0)" data-id="' . absint( $product->get_id() ) . '">'
     185            . esc_html( $buttonText ) .
     186            '</a>';
     187        }
    131188    }
    132189
  • product-quotation-for-woocommerce/trunk/includes/Classes/class-mailer.php

    r2709540 r2716683  
    8484        $this->blogname = esc_attr( get_option( 'blogname' ) );
    8585        $this->subject  = sprintf( '%s - %s', $this->args['fullname'], $this->args['subject'] );
    86         $this->email    = sanitize_email( get_option( 'admin_email' ) );
     86        $recipient      = sanitize_email( pqfw()->settings->get( 'recipient' ) );
     87        $this->email    = $recipient ? $recipient : sanitize_email( get_option( 'admin_email' ) );
    8788
    8889        $this->prepare_message();
  • product-quotation-for-woocommerce/trunk/includes/Classes/class-settings.php

    r2709540 r2716683  
    6969            'manage_options',
    7070            'pqfw-settings',
    71             [ $this, 'display_pqfw_settings_page' ],
     71            [ $this, 'display' ],
    7272            null
    7373        );
     
    7575
    7676    /**
    77      * Renders settings tabs.
    78      *
    79      * @since 1.0.0
    80      * @return array Settings tabs list.
    81      */
    82     public function tabs() {
    83         return apply_filters(
    84             'pqfw_elements_lite_admin_settings_tabs',
    85             [
    86                 'button'  => [
    87                     'title'      => esc_html__( 'Button', 'powerpack' ),
    88                     'show'       => true,
    89                     'capability' => 'edit_posts',
    90                     'file'       => PQFW_PLUGIN_VIEWS . 'pages/settings/button.php',
    91                     'priority'   => 150,
    92                 ],
    93                 'form'    => [
    94                     'title'      => esc_html__( 'Form', 'powerpack' ),
    95                     'show'       => true,
    96                     'capability' => 'edit_posts',
    97                     'file'       => PQFW_PLUGIN_VIEWS . 'pages/settings/form.php',
    98                     'priority'   => 200,
    99                 ],
    100                 'email'   => [
    101                     'title'      => esc_html__( 'Email', 'powerpack' ),
    102                     'show'       => true,
    103                     'capability' => 'edit_posts',
    104                     'file'       => PQFW_PLUGIN_VIEWS . 'pages/settings/email.php',
    105                     'priority'   => 300,
    106                 ],
    107                 'advance' => [
    108                     'title'      => esc_html__( 'Advance', 'powerpack' ),
    109                     'show'       => true,
    110                     'capability' => 'edit_posts',
    111                     'file'       => PQFW_PLUGIN_VIEWS . 'pages/settings/advance.php',
    112                     'priority'   => 400,
    113                 ]
    114             ]
    115         );
    116     }
    117 
    118     /**
    119      * Returns the form action type.
    120      *
    121      * @since 1.0.0
    122      *
    123      * @param string $type The action type.
    124      * @return string      The admin url with action type.
    125      */
    126     public function getFormAction( $type = '' ) {
    127         return admin_url( '/admin.php?page=pqfw-settings&tab=' . $type );
    128     }
    129 
    130     /**
    131      * Displays settings tabs.
    132      *
    133      * @since 1.0.0
    134      *
    135      * @param string $activeTab The active tab.
    136      */
    137     public function displayTabs( $activeTab ) {
    138         $sortedTabs = [];
    139 
    140         foreach ( $this->tabs() as $index => $tab ) {
    141             $tab['key'] = $index;
    142             $sortedTabs[ $tab['priority'] ] = $tab;
    143         }
    144 
    145         ksort( $sortedTabs );
    146 
    147         foreach ( $sortedTabs as $tab ) {
    148             if ( $tab['show'] ) {
    149                 if ( isset( $tab['cap'] ) && ! current_user_can( $tab['capability'] ) ) {
    150                     continue;
    151                 }
    152                 printf(
    153                     '<a href="%s" class="nav-tab%s"><span>%s</span></a>',
    154                     esc_attr( $this->getFormAction( $tab['key'] ) ),
    155                     ( $activeTab == $tab['key'] ? ' nav-tab-active' : '' ),
    156                     esc_html( $tab['title'] )
    157                 );
    158             }
    159         }
    160     }
    161 
    162     /**
    163      * Displays settings page.
    164      *
    165      * @since 1.0.0
    166      *
    167      * @param string $activeTab The active tab.
    168      * @return void
    169      */
    170     public function displaySettingsPage( $activeTab ) {
    171         $tabs = $this->tabs();
    172 
    173         if ( isset( $tabs[ $activeTab ] ) ) {
    174 
    175             if ( ! isset( $tabs[ $activeTab ]['file'] ) || empty( $tabs[ $activeTab ]['file'] ) || ! file_exists( $tabs[ $activeTab ]['file'] ) ) {
    176                 echo esc_html__( 'Setting page file could not be located.', 'powerpack' );
    177                 return;
    178             }
    179 
    180             $show = ! isset( $tabs[ $activeTab ]['show'] ) ? true : $tabs[ $activeTab ]['show'];
    181             $cap  = 'manage_options';
    182 
    183             if ( ! empty( $tabs[ $activeTab ]['capability'] ) ) {
    184                 $cap = $tabs[ $activeTab ]['capability'];
    185             } else {
    186                 $cap = ! is_network_admin() ? 'manage_options' : 'manage_network_plugins';
    187             }
    188 
    189             if ( ! $show || ! current_user_can( $cap ) ) {
    190                 esc_html_e( 'You do not have permission to view this setting.', 'powerpack' );
    191                 return;
    192             }
    193 
    194             include $tabs[ $activeTab ]['file'];
    195         }
    196     }
    197 
    198     /**
    19977     * Loading settings page tamplate.
    20078     *
    20179     * @since 1.0.0
    20280     */
    203     public function display_pqfw_settings_page() {
    204         $settings = $this->getAll();
    205         include PQFW_PLUGIN_VIEWS . 'pages/settings/index.php';
     81    public function display() {
     82        echo '<div id="pqfw-app" class="wrap-pqfw-app"></div>';
    20683    }
    20784
     
    21491    protected function getAll() {
    21592        $this->default = [
    216             'pqfw_form_default_design',
    217             'pqfw_floating_form',
    218             'pqfw_shop_page_button',
    219             'pqfw_product_page_button',
    220             'pqfw_form_send_mail'
     93            'pqfw_form_default_design'       => true,
     94            'pqfw_floating_form'             => true,
     95            'pqfw_shop_page_button'          => true,
     96            'pqfw_product_page_button'       => true,
     97            'pqfw_form_send_mail'            => true,
     98            'recipient'                      => sanitize_email( get_option( 'admin_email' ) ),
     99            'button_hover_color'             => '',
     100            'button_hover_bg_color'          => '',
     101            'button_normal_color'            => '',
     102            'button_normal_bg_color'         => '',
     103            'button_font_size'               => '',
     104            'button_width'                   => '',
     105            'button_text'                    => __( 'Add to Quote', 'pqfw' ),
     106            'hide_add_to_cart_button'        => false,
     107            'hide_product_prices'            => false,
     108            'button_position'                => 'woocommerce_after_shop_loop_item',
     109            'button_position_single_product' => 'woocommerce_after_add_to_cart_quantity',
    221110        ];
    222111
    223         $this->default = array_fill_keys( $this->default, true );
    224         $this->saved   = get_option( 'pqfw_settings', $this->default );
    225 
    226         $this->all = wp_parse_args( $this->saved, $this->default );
     112        $this->saved = get_option( 'pqfw_settings', $this->default );
     113        $this->all   = wp_parse_args( $this->saved, $this->default );
     114
    227115        return $this->all;
    228116    }
     
    239127
    240128        if ( 'pqfw_quotations_page_pqfw-settings' === $screen->id ) {
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
    241141            wp_enqueue_script(
    242142                'pqfw-options-handler', PQFW_PLUGIN_URL . 'assets/js/pqfw-settings.js',
     
    244144            );
    245145
     146
     147
     148
     149
     150
     151
     152
     153
    246154            wp_localize_script(
    247                 'pqfw-options-handler',
     155                'pqfw-',
    248156                'PQFW_OBJECT',
    249157                [
    250                     'ajaxurl' => admin_url( 'admin-ajax.php' ),
    251                     'actions' => [
     158                    'ajaxurl'  => admin_url( 'admin-ajax.php' ),
     159                    'settings' => $this->getAll(),
     160                    'nonce'    => wp_create_nonce( 'pqfw-app-ui' ),
     161                    'actions'  => [
    252162                        'save_settings' => 'pqrf_save_settings'
    253163                    ]
     
    264174     */
    265175    public function save() {
    266         if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'pqfw_settings_form_action' ) ) {
    267             die( esc_html__( 'Unauthorized Action', 'pqfw' ) );
    268         }
    269 
    270         $name     = sanitize_text_field( $_REQUEST['name'] );
    271         $status   = filter_var( $_REQUEST['status'], FILTER_VALIDATE_BOOLEAN );
    272         $settings = $this->getAll();
    273 
    274         if ( array_key_exists( $name, $settings ) ) {
    275             $settings[ $name ] = $status;
    276             update_option( 'pqfw_settings', $settings );
    277 
    278             wp_send_json_success( __( 'Settings Saved', 'pqfw' ) );
    279         }
    280 
    281         wp_send_json_error( __( 'Error while saving settings', 'pqfw' ) );
    282 
    283         die;
     176        if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'pqfw-app-ui' ) ) {
     177            wp_send_json_error([
     178                'message' => esc_html__( 'Unauthorized Action', 'pqfw' )
     179            ], 400 );
     180        }
     181
     182        $settings = isset( $_POST['settings'] ) ? (array) json_decode( wp_unslash( $_POST['settings'] ) ) : false;
     183
     184        if ( ! is_array( $settings ) ) {
     185            wp_send_json_error([
     186                'message' => esc_html__( 'Invalid Settings.', 'pqfw' )
     187            ], 400 );
     188        }
     189
     190        $allowed   = $this->getAll();
     191        $sanitized = array_filter( $settings, function( $key ) use ( $allowed ) {
     192            return array_key_exists( $key, $allowed );
     193        }, ARRAY_FILTER_USE_KEY );
     194
     195        update_option( 'pqfw_settings', $sanitized );
     196
     197        wp_send_json_success([
     198            'message' => esc_html__( 'Settings has been updated.', 'pqfw' )
     199        ], 200 );
    284200    }
    285201
  • product-quotation-for-woocommerce/trunk/includes/Classes/class-shortcode.php

    r2709540 r2716683  
    5151        ob_start();
    5252            $products = pqfw()->quotations->getProducts();
    53                 include PQFW_PLUGIN_VIEWS . 'partials/pqfw-cart-shortcode.php';
     53                include PQFW_PLUGIN_VIEWS . 'pqfw-cart-shortcode.php';
    5454            $output = ob_get_contents();
    5555        ob_end_clean();
  • product-quotation-for-woocommerce/trunk/includes/PQFW.php

    r2709540 r2716683  
    9696         */
    9797        private function loader() {
     98
    9899            $this->form            = new \PQFW\Classes\Form();
    99100            $this->admin           = new \PQFW\Classes\Admin();
     
    101102            $this->request         = new \PQFW\Classes\Request();
    102103            $this->form_handler    = new \PQFW\Classes\Form_Handler();
    103             $this->settings        = new \PQFW\Classes\Settings();
    104104            $this->quotations      = new \PQFW\Classes\Quotations();
    105105            $this->shortcode       = new \PQFW\Classes\Shortcode();
    106106            $this->utils           = new \PQFW\Classes\Utils();
    107107            $this->table           = new \PQFW\Classes\Table();
     108
    108109            $this->controlsManager = new \PQFW\Classes\Controls_Manager();
    109110            $this->product         = new \PQFW\Classes\Product();
  • product-quotation-for-woocommerce/trunk/product-quotation-for-woocommerce.php

    r2716244 r2716683  
    11<?php
    22/**
    3  * Plugin Name: Product Quotation For WooCommerce
     3 * Plugin Name: Product Quotation For WooCommerce
    44 * Plugin URI: https://github.com/mahafuz/product-quotation-for-woocommerce
    55 * Description: Removes the 'Add to cart' button from WooCommerce and adds a simple 'Request for quotation' form on all product pages instead of it.
    6  * Version: 1.2.5
     6 * Version:
    77 * Author: Mahafuz <m.mahfuz.me@gmail.com>
    88 * Author URI: https://github.com/mahafuz/
     
    2222 */
    2323define( 'PQFW_PLUGIN_FILE', __FILE__ );
     24
    2425define( 'PQFW_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
    2526define( 'PQFW_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
    2627define( 'PQFW_PLUGIN_VIEWS', trailingslashit( plugin_dir_path( __FILE__ ) . 'includes/Views' ) );
    2728define( 'PQFW_PLUGIN_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
    28 define( 'PQFW_PLUGIN_VERSION', '1.2.5' );
     29define( 'PQFW_PLUGIN_VERSION', '' );
    2930
    3031/**
     
    4344});
    4445
    45 require __DIR__ . '/vendor/autoload.php';
    46 
    4746/**
    4847 * Initialize the plugin tracker
     
    5352function appsero_init_tracker_product_quotation_for_woocommerce() {
    5453    if ( ! class_exists( 'Appsero\Client' ) ) {
    55         require_once __DIR__ . '/appsero/src/Client.php';
     54        require/src/Client.php';
    5655    }
    5756
    58     $client = new Appsero\Client( 'e806fe7d-f314-425d-8be4-9f62fdaf71cf', 'Product Quotation &#8211; Product Quotation For WooCommerce', __FILE__ );
     57    $client = new Appsero\Client(
     58        'e806fe7d-f314-425d-8be4-9f62fdaf71cf',
     59        'Product Quotation - Product Quotation For WooCommerce',
     60        __FILE__
     61    );
    5962
    6063    // Active insights.
Note: See TracChangeset for help on using the changeset viewer.