Plugin Directory

Changeset 2298285

Timestamp:
05/05/2020 08:24:30 AM (4 years ago)
Author:
mehedi_csit
Message:

fix coding standards and added donation link

Location:
front-end-product-edit-for-woocommerce/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • front-end-product-edit-for-woocommerce/trunk/forntend-product-edit.php

    r2222021 r2298285  
    33Plugin Name: Front End Product Edit For Woocommerce
    44Description: Front End Product Edit for Woocommerce will help you to edit or update the product in frontend.
    5 Plugin URI: https://www.code4webs.com
    6 Version: 1.0.0
     5Plugin URI: https://
     6Version: 1..0
    77Author: Mehedi Hasan
    8 Author URI: https://www.facebook.com/mehedicsit
     8Author URI: https://
    99License: GPL-2.0+
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    2323        require 'inc/fpde-media-upload.php';
    2424        //Init action
    25         add_action('init', array($this, 'fpde_init'));
     25        add_action('init', array($this, 'fpde_init'));
    2626        //Product update
    27         add_action('wp_ajax_fpde_popup_submit', array($this, 'fpde_popup_submit'));
     27        add_action('wp_ajax_fpde_popup_submit', array();
    2828        // use ajax to query product by id to popup
    29         add_action('wp_ajax_nopriv_fpde_get_product_by_id', array($this, 'fpde_get_product_by_id'));
    30         add_action('wp_ajax_fpde_get_product_by_id', array($this, 'fpde_get_product_by_id'));
     29        add_action('wp_ajax_nopriv_fpde_get_product_by_id', array();
     30        add_action('wp_ajax_fpde_get_product_by_id', array();
    3131    }
    3232   
    33     public function fpde_init(){
     33    public function fpde_init(){
    3434        if( current_user_can('edit_posts') ) {
    3535            //Enqueue css and js
     
    3838            add_action('wp_footer', array($this, 'fpde_ajax_data_render_popup'));
    3939            //Adding edit button
    40             add_action('woocommerce_before_shop_loop_item', array($this, 'fpde_product_edit_btn'));
     40            add_action('woocommerce_before_shop_loop_item', array($this, 'fpde_product_edit_btn'));
    4141        }
    4242    }
    4343   
    4444    // enqueue scripts
    45     public function fpde_scripts_register(){
     45    public function fpde_scripts_register(){
    4646        wp_enqueue_style( 'fpde_custom_css', plugins_url('assets/css/fpde-ajax-popup.css', __FILE__) );
    47         wp_enqueue_script( 'fpde_popup_js', plugins_url('assets/js/fpde-ajax-popup.js', __FILE__), array('jquery'),null,true);
     47        wp_enqueue_script( 'fpde_popup_js', plugins_url('assets/js/fpde-ajax-popup.js', __FILE__), array('jquery'),);
    4848        wp_localize_script( 'fpde_popup_js', 'fpde_object', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'ajax_nonce' => wp_create_nonce('fpde_ajax_nonce') ) );
    4949        wp_enqueue_editor();
     
    7474    }
    7575   
    76     public function fpde_get_product_by_id(){
     76    public function fpde_get_product_by_id(){
    7777       
    7878        $fpdepid = sanitize_text_field($_POST['fpdepid']);
     
    8686   
    8787    //Ajax loading
    88     public function fpde_ajax_data_render_popup(){
     88    public function fpde_ajax_data_render_popup(){
    8989        ?>
    9090        <div id="fpde-popup-wrapper"></div>
     
    9393    }
    9494   
    95     public function fpde_product_edit_btn(){
     95    public function fpde_product_edit_btn(){
    9696        ?>
    9797        <a class="fpde-popup-trigger" fpde-pid="<?php the_id(); ?>" href="#"><span class="dashicons dashicons-edit"></span></a>
     
    108108}
    109109else{
    110     add_action('admin_notices', function(){
     110    add_action('admin_notices', function(){
    111111        echo '<div class="notice notice-error"><p>'.esc_html__('Front End Product Edit For Woocommerce requires WooCommerce to be installed and active. You can download', 'fpde').' <a href="https://woocommerce.com/" target="_blank">WooCommerce</a> '.esc_html__('here.','fpde').'</p></div>';
    112112    });
  • front-end-product-edit-for-woocommerce/trunk/inc/fpde-popup.php

    r2222021 r2298285  
    1414                <p id="fde-update-featured-image"><span class="dashicons dashicons-edit"></span></p>
    1515                <?php
    16                   $fpde_p_img = !empty(wp_get_attachment_url( $product->get_image_id() )) ? wp_get_attachment_url( $product->get_image_id() ) : plugins_url('../assets/woocommerce-placeholder-300x300.png', __FILE__);
     16                  $fpde_p_img = !empty() ? wp_get_attachment_url( $product->get_image_id() ) : plugins_url('../assets/woocommerce-placeholder-300x300.png', __FILE__);
    1717                  ?>
    1818                <img src="<?php echo esc_attr($fpde_p_img); ?>" alt="Image" />
     
    7979                                    $top_term_tax = $category->taxonomy;
    8080
    81                                     $term_children = get_term_children($category->term_id, 'product_cat');
     81                                    $term_children = get_term_children($category->term_id, 'product_cat');
    8282                                    ?>
    8383                              <li>
    84                                 <input type="checkbox" name="fpde-categories" id="fpde-category-<?php echo esc_attr( $category->term_id ) ?>" class="fpde-catageory" value="<?php echo esc_attr( $category->term_id ) ?>" <?php if( in_array($category->term_id, $termsids) ){ echo 'checked'; } ?>> <label for="fpde-category-<?php echo esc_attr( $category->term_id ) ?>"><?php echo esc_html( $category->name ); ?></label>
     84                                <input type="checkbox" name="fpde-categories" id="fpde-category-<?php echo esc_attr( $category->term_id ) ?>" class="fpde-catageory" value="<?php echo esc_attr( $category->term_id ) ?>" <?php if( in_array() ){ echo 'checked'; } ?>> <label for="fpde-category-<?php echo esc_attr( $category->term_id ) ?>"><?php echo esc_html( $category->name ); ?></label>
    8585
    8686                                <?php
     
    9797                                    echo '<ul class="second-level-terms">';
    9898
    99                                     foreach ($second_level_terms as $second_level_term) {
     99                                    foreach () {
    100100
    101101                                        echo '<li>';
    102102                                        ?>
    103                                         <input type="checkbox" id="fpde-category-<?php echo esc_attr( $second_level_term->term_id ) ?>" name="fpde-categories" class="fpde-catageory fpde-child" value="<?php echo esc_html( $second_level_term->term_id ) ?>" <?php if( in_array($second_level_term->term_id, $termsids) ){ echo 'checked'; } ?>> <label for="fpde-category-<?php echo esc_attr( $second_level_term->term_id ) ?>"><?php echo esc_html( $second_level_term->name ); ?></label>
     103                                        <input type="checkbox" id="fpde-category-<?php echo esc_attr( $second_level_term->term_id ) ?>" name="fpde-categories" class="fpde-catageory fpde-child" value="<?php echo esc_html( $second_level_term->term_id ) ?>" <?php if( in_array() ){ echo 'checked'; } ?>> <label for="fpde-category-<?php echo esc_attr( $second_level_term->term_id ) ?>"><?php echo esc_html( $second_level_term->name ); ?></label>
    104104                                        <?php
    105105                                        echo '</li>';
     
    122122                          <div class="form-field">
    123123                              <label for="fpde_sku"><span class="fpde-title"><?php echo esc_html('SKU'); ?></span>
    124                               <input type="text" class="short" name="_sku" id="fpde_sku" value="<?php echo esc_attr($product->get_sku()); ?>">
     124                              <input type="text" class="short" name="_sku" id="fpde_sku" value="<?php echo esc_attr(); ?>">
    125125                              </label>
    126126                          </div>
     
    129129                            <?php
    130130                            $manageStock = $product->get_manage_stock();
    131                             if($manageStock == 1){
     131                            if(){
    132132
    133133                                $manageStock = "checked";
     
    140140                            }
    141141                            ?>
    142                             <input type="checkbox" class="fpde-checkbox" name="_manage_stock" id="fpde_manage_stock" value="<?php echo esc_attr($manageStock); ?>" <?php echo esc_attr($manageStock); ?>> <label for="fpde_manage_stock"><?php echo esc_html('Manage stock?'); ?></label>
     142                            <input type="checkbox" class="fpde-checkbox" name="_manage_stock" id="fpde_manage_stock" value="<?php echo esc_attr($manageStock); ?>" <?php echo esc_attr(); ?>> <label for="fpde_manage_stock"><?php echo esc_html('Manage stock?'); ?></label>
    143143                          </div>
    144144
     
    167167                                    'tabindex' => 4,
    168168                                );
    169                                 wp_editor( $product->get_short_description(),$short_desc_id,$settings);
     169                                wp_editor( $product->get_short_description(),);
    170170                                ?>
    171171                              </label>
     
    181181                                      'tabindex' => 4,
    182182                                  );
    183                                   wp_editor( $product->get_description(),$long_desc_id,$settings);
     183                                  wp_editor( $product->get_description(),);
    184184                                  ?>
    185185                              </label>
  • front-end-product-edit-for-woocommerce/trunk/inc/fpde-product-update.php

    r2222021 r2298285  
    44}
    55
    6 if(isset($_POST['productTitle'])){
    7     $productTitle = sanitize_text_field($_POST['productTitle']);
    8     $product_update->set_name($productTitle);
     6if({
     7    $productTitle = sanitize_text_field();
     8    $product_update->set_name();
    99}
    10 if(isset($_POST['productRegPrice'])){
    11     $product_Reg_Price = sanitize_text_field($_POST['productRegPrice']);
    12     $product_update->set_regular_price($product_Reg_Price);
     10if({
     11    $product_Reg_Price = sanitize_text_field();
     12    $product_update->set_regular_price();
    1313}
    14 if(isset($_POST['productSalePrice'])){
    15     $product_Sale_Price = sanitize_text_field($_POST['productSalePrice']);
    16     $product_update->set_sale_price($product_Sale_Price);
     14if({
     15    $product_Sale_Price = sanitize_text_field();
     16    $product_update->set_sale_price();
    1717}
    18 if(isset($_POST['productShortDesc'])){
    19     $productShortDesc = wp_kses_post($_POST['productShortDesc']); 
    20     $product_update->set_short_description($productShortDesc);
     18if(isset({
     19    $productShortDesc = wp_kses_post(); 
     20    $product_update->set_short_description();
    2121}
    22 if(isset($_POST['productLongDesc'])){
    23     $productLongDesc = wp_kses_post($_POST['productLongDesc']);
    24     $product_update->set_description($productLongDesc);
     22if(isset({
     23    $productLongDesc = wp_kses_post();
     24    $product_update->set_description();
    2525}
    26 if(isset($_POST['productSku'])){
    27     $productSku = sanitize_text_field($_POST['productSku']);
    28     $product_update->set_sku($productSku);
     26if({
     27    $productSku = sanitize_text_field();
     28    $product_update->set_sku();
    2929}
    30 if(isset($_POST['manageStock'])){
    31     $enable_stock = sanitize_text_field($_POST['manageStock']);
    32     $product_update->set_manage_stock($enable_stock);
     30if(isset({
     31    $enable_stock = sanitize_text_field();
     32    $product_update->set_manage_stock();
    3333}
    34 if($_POST['manageStock'] == 1){
    35     if(isset($_POST['stockQuantity'])){
    36         $stock_quantity = sanitize_text_field($_POST['stockQuantity']);
    37         $product_update->set_stock_quantity($stock_quantity);
     34if({
     35    if({
     36        $stock_quantity = sanitize_text_field();
     37        $product_update->set_stock_quantity();
    3838    }
    3939}
    40 if(isset($_POST['stockStatus'])){
    41     $stock_status = sanitize_text_field($_POST['stockStatus']);
    42     $product_update->set_stock_status($stock_status);
     40if({
     41    $stock_status = sanitize_text_field();
     42    $product_update->set_stock_status();
    4343}
    44 if(isset($_POST['catIds'])){
     44if({
    4545    $product_cat_ids = array_map( 'sanitize_text_field', wp_unslash( $_POST['catIds'] ) );
    46     $product_update->set_category_ids($product_cat_ids);
     46    $product_update->set_category_ids();
    4747}
    48 if(!empty(trim($_POST['attachmentID']))){
    49     $popup_attachment_ID = sanitize_text_field($_POST['attachmentID']);
    50     $product_update->set_image_id($popup_attachment_ID);
     48if({
     49    $popup_attachment_ID = sanitize_text_field();
     50    $product_update->set_image_id();
    5151}
    52 if(isset($_POST['galleryIds'])) {
     52if() {
    5353    $gallery_ids = array_map( 'sanitize_text_field', wp_unslash( $_POST['galleryIds'] ) );
    54     $product_update->set_gallery_image_ids($gallery_ids);
     54    $product_update->set_gallery_image_ids();
    5555   
    5656}
  • front-end-product-edit-for-woocommerce/trunk/readme.txt

    r2222041 r2298285  
    11=== Front End Product Edit For Woocommerce ===
    2 Contributors: mehedi_csit, raihan143
    3 Tags: woocommerce product edit, frontend product edit, woocommerce, edit, product, add product, update product, update, popup edit, ajax edit
     2Contributors: mehedi_csit
     3Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ANJRBFTXBUE8Q&source=url
     4Tags: woocommerce,product manager, product edit, frontend edit, woocommerce, edit, product, add product, update product, update, popup edit, ajax edit
    45Requires at least: 4.2
    5 Tested up to: 5.2.4
    6 Requires PHP: 5.4
     6Tested up to: 5.
     7Requires PHP: 5.
    78Stable tag: 1.0.0
    89License: GPL-2.0+
Note: See TracChangeset for help on using the changeset viewer.