Plugin Directory

Changeset 3220159


Ignore:
Timestamp:
01/10/2025 11:34:36 AM (15 months ago)
Author:
marcqueralt
Message:

WP 6.7 compatibility

Location:
demomentsomtres-wine-catalog/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • demomentsomtres-wine-catalog/trunk/demomentsomtres-catalog-widgets.php

    r1404400 r3220159  
    55    class ProductsInCategoryWidget extends WP_Widget {
    66
    7         function ProductsInCategoryWidget() {
    8             parent::WP_Widget(false, $name = 'Products in category');
    9         }
    10 
    11         function form($instance) {
    12             $title = esc_attr($instance['title']);
     7        // NT v2.1
     8        public function __construct() {
     9                parent::__construct(
     10                        'products_in_category', // Widget ID
     11                        __('Products in Category', 'demomentsomtres-wine-catalog'), // Widget name
     12                        array('description' => __('Display products from a category', 'demomentsomtres-wine-catalog'))
     13                );
     14        }
     15        // NT v2.1
     16
     17        function form($instance) {
     18            $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; // NT v2.1
     19
    1320            $mode = isset($instance['mode']) ? $instance['mode'] : 'image';
    1421            echo "<p><label for='" . $this -> get_field_id('title') . "'>" . __('Title:', 'demomentsomtres-wine-catalog') . "<input class='widefat' id='" . $this -> get_field_id('title') . "' name='" . $this -> get_field_name('title') . "' type='text' value='" . $title . "' /></label></p>";
     
    3239                if (isset($marks[0])) :
    3340                    echo $before_widget;
    34                     $title = apply_filters('widget_title', $instance['title']);
     41
     42                    $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : ''; // NT v2.1
     43
    3544                    if ($title)
    3645                        echo $before_title . $title . $after_title;
     
    7584    class ProductNameWidget extends WP_Widget {
    7685
    77         function ProductNameWidget() {
    78             parent::WP_Widget(false, $name = 'Product name');
    79         }
    80 
    81         function form($instance) {
    82             $title = esc_attr($instance['title']);
     86        // NT v2.1
     87        public function __construct() {
     88                parent::__construct(
     89                        'product_name_widget', // Widget ID
     90                        __('Product Name', 'demomentsomtres-wine-catalog'), // Widget name
     91                        array('description' => __('Displays the product name', 'demomentsomtres-wine-catalog'))
     92                );
     93        }
     94        // NT v2.1
     95
     96        function form($instance) {
     97            $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; // NT v2.1
    8398        }
    8499
     
    102117     */
    103118    class MarkDescriptionWidget extends WP_Widget {
    104 
    105         function MarkDescriptionWidget() {
    106             parent::WP_Widget(false, $name = 'Mark description');
    107         }
    108 
    109         function form($instance) {
    110             $title = esc_attr($instance['title']);
     119        // NT v2.1
     120        public function __construct() {
     121                parent::__construct(
     122                        'mark_description_widget', // Widget ID
     123                        __('Mark Description', 'demomentsomtres-wine-catalog'), // Widget name
     124                        array('description' => __('Displays the description of a product mark', 'demomentsomtres-wine-catalog'))
     125                );
     126        }
     127        // NT v2.1
     128
     129        function form($instance) {
     130            $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; // NT v2.1
    111131        }
    112132
     
    137157    class MarkLogoWidget extends WP_Widget {
    138158
    139         function MarkLogoWidget() {
    140             parent::WP_Widget(false, $name = 'Mark Logo');
    141         }
    142 
    143         function form($instance) {
    144             $title = esc_attr($instance['title']);
     159        // NT v2.1
     160        public function __construct() {
     161                parent::__construct(
     162                        'mark_logo_widget', // Widget ID
     163                        __('Mark Logo', 'demomentsomtres-wine-catalog'), // Widget name
     164                        array('description' => __('Displays the logo of a product mark', 'demomentsomtres-wine-catalog'))
     165                );
     166        }
     167        // NT v2.1
     168
     169        function form($instance) {
     170            $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; // NT v2.1
     171
    145172        }
    146173
     
    176203    class ProductSalesURLWidget extends WP_Widget {
    177204
    178         function ProductSalesURLWidget() {
    179             parent::WP_Widget(false, $name = 'Product Sales URL');
    180         }
    181 
    182         function form($instance) {
    183             $title = esc_attr($instance['title']);
    184             $label = esc_attr($instance['label']);
     205        // NT v2.1
     206        public function __construct() {
     207                parent::__construct(
     208                        'product_sales_url_widget', // Widget ID
     209                        __('Product Sales URL', 'demomentsomtres-wine-catalog'), // Widget name
     210                        array('description' => __('Display sales URL for the product', 'demomentsomtres-wine-catalog'))
     211                );
     212        }
     213        // NT v2.1
     214
     215        function form($instance) {
     216            $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; // NT v2.1
     217            $label = isset($instance['label']) ? esc_attr($instance['label']) : ''; // NT v2.1
     218
    185219            echo "<p><label for='" . $this -> get_field_id('title') . "'>" . __("Title:", 'demomentsomtres-wine-catalog') . "<input class='widefat' id='" . $this -> get_field_id("title") . "' name='" . $this -> get_field_name('title') . "' type='text' value='" . $title . "' /></label></p>";
    186220            echo "<p><label for='" . $this -> get_field_id('label') . "'>" . __("URL Label:", 'demomentsomtres-wine-catalog') . "<input class='widefat' id='" . $this -> get_field_id("label") . "' name='" . $this -> get_field_name('label') . "' type='text' value='" . $label . "' /></label></p>";
     
    197231            global $post;
    198232            $sales_url = get_post_meta($post -> ID, DeMomentSomTresWineAndCheese::OPTION_SALES_URL, true);
    199             $title = apply_filters('widget_title', $instance['title']);
    200             $label = $instance['label'];
     233
     234            $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : ''; // NT v2.1
     235            $label = isset($instance['label']) ? $instance['label'] : ''; // NT v2.1
     236           
    201237            if ($sales_url != '') :
    202238                echo $before_widget;
  • demomentsomtres-wine-catalog/trunk/demomentsomtres-catalog.php

    r1404440 r3220159  
    44 * Plugin URI: http://www.demomentsomtres.com/en/wordpress-plugins/demomentsomtres-wine-catalog/
    55 * Description: Shows your products in the web based on marks and product types. The shortcode [demomentsomtres-product-mark cols=n] shows all the products in the same mark than the current product. You also can include "echo dmst_catalog_shortcode($attr);" in your template to show the same contents.
    6  * Version: 2.05
     6 * Version: 2.1
    77 * Author: Marc Queralt
    88 * Author URI: http://demomentsomtres.com/
     
    5959                'posttypes'
    6060            ), 0);
    61             add_action('widgets_init', create_function('', 'return register_widget("ProductNameWidget");'));
    62             add_action('widgets_init', create_function('', 'return register_widget("MarkDescriptionWidget");'));
    63             add_action('widgets_init', create_function('', 'return register_widget("ProductNameWidget");'));
    64             add_action('widgets_init', create_function('', 'return register_widget("ProductsInCategoryWidget");'));
    65             add_action('widgets_init', create_function('', 'return register_widget("ProductSalesURLWidget");'));
    66             add_action('widgets_init', create_function('', 'return register_widget("MarkLogoWidget");'));
     61           
     62            // NT v2.1
     63            add_action('widgets_init', function() {
     64                register_widget('ProductsInCategoryWidget');
     65                register_widget('ProductNameWidget');
     66                register_widget('MarkDescriptionWidget');
     67                register_widget('ProductSalesURLWidget');
     68                register_widget('MarkLogoWidget');
     69            });
     70            // NT v2.1
     71           
    6772            add_filter('rwmb_meta_boxes', array(
    6873                $this,
  • demomentsomtres-wine-catalog/trunk/readme.txt

    r3220136 r3220159  
    6565== Changelog ==
    6666= 2.1 =
     67* Compatibility WP 6.7
     68
     69= 2.05 =
    6770* Wine Grape Taxonomy
    6871* 4.5 compatibility
Note: See TracChangeset for help on using the changeset viewer.