Changeset 2716683
- Timestamp:
- 04/30/2022 03:53:31 PM (2 years ago)
- 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 4 4 Requires at least: 4.0 5 5 Tested up to: 5.9 6 Stable tag: 1.2.56 Stable tag: 7 7 License: GPLv3 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 68 68 == Changelog == 69 69 70 71 72 73 74 75 76 77 70 78 = 1.2.5- 28-04-2022 = 71 79 * Fixed: Quotation Cart page issue -
product-quotation-for-woocommerce/trunk/assets/css/pqfw-admin.css
r2709540 r2716683 131 131 transition: 0.4s; 132 132 } 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 131 131 } 132 132 133 a.button.pqfw-button.pqfw-add-to-quotation {font-size: 14px;margin: 10px 0;display: inline-block;} 133 a.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 } 134 139 135 140 a.pqfw-view-quotation-cart {font-size: 14px;display: block;text-decoration: underline;} -
product-quotation-for-woocommerce/trunk/assets/js/pqfw-frontend.js
r2711510 r2716683 57 57 }, 58 58 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 = {}; 62 61 63 62 if (typeof variation != "undefined" && variation != 0) { … … 99 98 emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, 100 99 errors = null, 101 resposneStatus = f.find('.pqfw-form-response-status');100 resposneStatus = ('.pqfw-form-response-status'); 102 101 103 102 t.on( "click", "#rsrfqfwc_submit", function ( ev ) { … … 137 136 } 138 137 } 139 if( $input.attr( "type" ) === "email" ) { 140 138 if ( $input.attr( "type" ) === "email" ) { 141 139 if( $input.prop( "required" ) ) { 142 140 if( $input.val() !== '' && emailReg.test( $input.val() ) ) { … … 148 146 } 149 147 } 150 151 148 } 152 149 } 153 150 }); 154 151 155 156 if( !errors ) { 152 if ( ! errors ) { 157 153 // preparing data 158 154 var data = {}; … … 198 194 }); 199 195 196 197 198 199 200 200 201 setTimeout(function() { 201 202 window.pqfwCart.initialize(); 202 }, 2000); 203 203 }, 1000); 204 204 }else { 205 205 resposneStatus.removeClass('success'); -
product-quotation-for-woocommerce/trunk/includes/Classes/class-admin.php
r2709540 r2716683 40 40 */ 41 41 public function menus() { 42 43 42 44 add_submenu_page( 43 45 'edit.php?post_type=pqfw_quotations', 44 __( ' Old backed up entries', 'PQFW' ),45 __( 'Backup', 'PQFW' ),46 __( '', 'PQFW' ), 47 , 46 48 '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">★★★★★</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'; 50 97 } 51 98 … … 66 113 } 67 114 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 ) { 69 116 wp_enqueue_style( 70 117 'pqfw-admin', … … 73 120 ); 74 121 } 75 }76 77 /**78 * Loading layout page tamplate.79 *80 * @since 1.0.081 */82 public function display() {83 include PQFW_PLUGIN_VIEWS . 'layout.php';84 122 } 85 123 … … 165 203 */ 166 204 public function displayQuotationDetail( $quotation ) { 167 include_once PQFW_PLUGIN_ PATH . 'includes/Views/partials/quotation-detail.php';205 include_once PQFW_PLUGIN_quotation-detail.php'; 168 206 } 169 207 … … 176 214 */ 177 215 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'; 179 217 } 180 218 -
product-quotation-for-woocommerce/trunk/includes/Classes/class-form.php
r2716244 r2716683 35 35 public function __construct() { 36 36 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' ] ); 40 41 add_action( $this->quotationButtonPosition, [ $this, 'addButton' ] ); 41 42 … … 90 91 'all' 91 92 ); 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 92 141 } 93 142 … … 104 153 global $product; 105 154 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 } 114 167 } 115 168 } … … 125 178 } 126 179 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 } 131 188 } 132 189 -
product-quotation-for-woocommerce/trunk/includes/Classes/class-mailer.php
r2709540 r2716683 84 84 $this->blogname = esc_attr( get_option( 'blogname' ) ); 85 85 $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' ) ); 87 88 88 89 $this->prepare_message(); -
product-quotation-for-woocommerce/trunk/includes/Classes/class-settings.php
r2709540 r2716683 69 69 'manage_options', 70 70 'pqfw-settings', 71 [ $this, 'display _pqfw_settings_page' ],71 [ $this, 'display' ], 72 72 null 73 73 ); … … 75 75 76 76 /** 77 * Renders settings tabs.78 *79 * @since 1.0.080 * @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.0122 *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.0134 *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.0166 *167 * @param string $activeTab The active tab.168 * @return void169 */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 /**199 77 * Loading settings page tamplate. 200 78 * 201 79 * @since 1.0.0 202 80 */ 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>'; 206 83 } 207 84 … … 214 91 protected function getAll() { 215 92 $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', 221 110 ]; 222 111 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 227 115 return $this->all; 228 116 } … … 239 127 240 128 if ( 'pqfw_quotations_page_pqfw-settings' === $screen->id ) { 129 130 131 132 133 134 135 136 137 138 139 140 241 141 wp_enqueue_script( 242 142 'pqfw-options-handler', PQFW_PLUGIN_URL . 'assets/js/pqfw-settings.js', … … 244 144 ); 245 145 146 147 148 149 150 151 152 153 246 154 wp_localize_script( 247 'pqfw- options-handler',155 'pqfw-', 248 156 'PQFW_OBJECT', 249 157 [ 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' => [ 252 162 'save_settings' => 'pqrf_save_settings' 253 163 ] … … 264 174 */ 265 175 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 ); 284 200 } 285 201 -
product-quotation-for-woocommerce/trunk/includes/Classes/class-shortcode.php
r2709540 r2716683 51 51 ob_start(); 52 52 $products = pqfw()->quotations->getProducts(); 53 include PQFW_PLUGIN_VIEWS . 'p artials/pqfw-cart-shortcode.php';53 include PQFW_PLUGIN_VIEWS . 'pqfw-cart-shortcode.php'; 54 54 $output = ob_get_contents(); 55 55 ob_end_clean(); -
product-quotation-for-woocommerce/trunk/includes/PQFW.php
r2709540 r2716683 96 96 */ 97 97 private function loader() { 98 98 99 $this->form = new \PQFW\Classes\Form(); 99 100 $this->admin = new \PQFW\Classes\Admin(); … … 101 102 $this->request = new \PQFW\Classes\Request(); 102 103 $this->form_handler = new \PQFW\Classes\Form_Handler(); 103 $this->settings = new \PQFW\Classes\Settings();104 104 $this->quotations = new \PQFW\Classes\Quotations(); 105 105 $this->shortcode = new \PQFW\Classes\Shortcode(); 106 106 $this->utils = new \PQFW\Classes\Utils(); 107 107 $this->table = new \PQFW\Classes\Table(); 108 108 109 $this->controlsManager = new \PQFW\Classes\Controls_Manager(); 109 110 $this->product = new \PQFW\Classes\Product(); -
product-quotation-for-woocommerce/trunk/product-quotation-for-woocommerce.php
r2716244 r2716683 1 1 <?php 2 2 /** 3 * Plugin Name: Product Quotation For WooCommerce3 * Plugin Name: Product Quotation For WooCommerce 4 4 * Plugin URI: https://github.com/mahafuz/product-quotation-for-woocommerce 5 5 * 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.56 * Version: 7 7 * Author: Mahafuz <m.mahfuz.me@gmail.com> 8 8 * Author URI: https://github.com/mahafuz/ … … 22 22 */ 23 23 define( 'PQFW_PLUGIN_FILE', __FILE__ ); 24 24 25 define( 'PQFW_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); 25 26 define( 'PQFW_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) ); 26 27 define( 'PQFW_PLUGIN_VIEWS', trailingslashit( plugin_dir_path( __FILE__ ) . 'includes/Views' ) ); 27 28 define( 'PQFW_PLUGIN_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) ); 28 define( 'PQFW_PLUGIN_VERSION', ' 1.2.5' );29 define( 'PQFW_PLUGIN_VERSION', '' ); 29 30 30 31 /** … … 43 44 }); 44 45 45 require __DIR__ . '/vendor/autoload.php';46 47 46 /** 48 47 * Initialize the plugin tracker … … 53 52 function appsero_init_tracker_product_quotation_for_woocommerce() { 54 53 if ( ! class_exists( 'Appsero\Client' ) ) { 55 require _once __DIR__ . '/appsero/src/Client.php';54 require/src/Client.php'; 56 55 } 57 56 58 $client = new Appsero\Client( 'e806fe7d-f314-425d-8be4-9f62fdaf71cf', 'Product Quotation – 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 ); 59 62 60 63 // Active insights.
Note: See TracChangeset
for help on using the changeset viewer.