Plugin Directory

Changeset 1414781


Ignore:
Timestamp:
05/11/2016 01:59:46 PM (10 years ago)
Author:
v-media
Message:

Added new hooks, added new WP as a compatible version

Location:
foodlist/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Ajax/Manager/Base.php

    r1094156 r1414781  
    104104                    $query->the_post();
    105105
     106                    $note = apply_filters('foodlist_admin_ajax_metabox_menu_post_note', get_post_meta($post->ID, '_fl_menu_section_note', true), $post->ID, $type);
     107                    $text = get_the_title($post);
    106108                    $result[] = array(
    107109                        'id' => $post->ID,
    108                         'text' => get_the_title($post),
    109                         'note' => get_post_meta($post->ID, '_fl_menu_section_note', true),
     110                        'text' => $text,
     111                        'note' => $note,
    110112                    );
    111113                }
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Menu/MenuManager.php

    r1094156 r1414781  
    5757        }
    5858
    59         $note = get_post_meta($postId, '_fl_menu_section_note', true);
     59        $note = apply_filters('foodlist_admin_ajax_metabox_menu_post_note', get_post_meta($postId, '_fl_menu_section_note', true), $postId, get_post_type($postId));
    6060        if ($note) {
    6161            $note = '('.esc_html($note).')';
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Menu/SectionManager.php

    r1277844 r1414781  
    5656            $multi_number = '1';
    5757        }
    58        
     58
     59        $note = apply_filters('foodlist_admin_ajax_metabox_menu_post_note', get_post_meta($postId, '_fl_menu_section_note', true), $postId, get_post_type($postId));
     60        if ($note) {
     61            $note = '('.esc_html($note).')';
     62        }
     63
    5964        $item = '
    6065            <div class="widget ui-draggable" id="widget-post-'.$postId.'-'.$instanceId.'">
    6166                <div class="widget-top">
    6267                    <div class="widget-title">
    63                         <h4>'.esc_attr(strip_tags(get_the_title())).'<span class="in-widget-title"></span></h4>
     68                        <h4>'.esc_attr(strip_tags(get_the_title())).' <span class="in-widget-title">'.$note.'</span></h4>
    6469                    </div>
    6570                </div>
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Admin/Metabox/MenuSection/ItemsMetabox.php

    r1094156 r1414781  
    8787        }
    8888
    89         $template = '
     89        $template = apply_filters('foodlist_admin_metabox_menu_item_template', '
    9090            <li class="widget-top fl-menu-sortable-item">
    9191                    <div class="widget-title"><h4>%s</h4></div>
     
    9393                    <input type="hidden" name="fl_menu_section[items][]" value="%s" />
    9494            </li>
    95         ';
     95        ');
    9696
    97         echo '<ul id="fl-menu-sortable-list" class="widget ui-draggable" data-template="'.esc_attr(sprintf($template, '__title__', '__id__')).'" data-context="items" data-nonce="fl_menu_section[items_nonce]">';
     97        $jsTemplate = apply_filters('foodlist_admin_metabox_menu_item_jstemplate', '', $template);
     98
     99        echo sprintf(
     100            '<ul id="fl-menu-sortable-list" class="widget ui-draggable" data-template="%s" data-context="items" data-nonce="fl_menu_section[items_nonce]">',
     101            esc_attr($jsTemplate ? $jsTemplate : sprintf($template, '__title__', '__id__'))
     102        );
    98103        if (!empty($items) && is_array($items)) {
    99104            foreach ($items as $instance) {
    100105                list($postId, $instanceId) = $this->parseInstanceStr($instance);
    101                 $title = get_the_title($postId);
    102                 echo sprintf($template, esc_html($title), (int)$postId);
     106                $title = apply_filters('foodlist_admin_metabox_menu_item_title', get_the_title($postId), $postId, $instanceId);
     107                $html = apply_filters('foodlist_admin_metabox_menu_item_html', '', $postId, $title, $template);
     108                if (!trim($html)) {
     109                    $html = sprintf($template, esc_html($title), (int)$postId);
     110                }
     111                echo $html;
    103112            }
    104113        }
  • foodlist/trunk/plugin.php

    r1379934 r1414781  
    66Author: Artprima
    77Author URI: http://artprima.eu/
    8 Version: 1.11.1
     8Version: 1.12
    99*/
    1010
    11 define('FOODLIST_VERSION', '1.11.1');
     11define('FOODLIST_VERSION', '1.12');
    1212define('FOODLIST_MIN_PHP_VERSION', '5.3.3');
    1313define('FOODLIST_MIN_WP_VERSION', '3.6.0');
  • foodlist/trunk/readme.txt

    r1379934 r1414781  
    22Contributors: v-media
    33Tags: restaurant menu, café menu, restaurant, eatery, menus, bar, list
    4 Requires at least: 3.8
    5 Tested up to: 4.4.2
     4Requires at least: 4.0
     5Tested up to: 4.5.2
    66Stable tag: trunk
    77
     
    4646
    4747== ChangeLog ==
     48
     49= Version 1.12 =
     50* Tested up to WordPress 4.5.2, minimal WP version is set to 4.0 (although might still work with the older WP versions)
     51* New hooks: `foodlist_admin_ajax_metabox_menu_post_note`, `foodlist_admin_metabox_menu_item_template`, `foodlist_admin_metabox_menu_item_html` and `foodlist_admin_metabox_menu_item_jstemplate` (for an example, check this thread: https://wordpress.org/support/topic/managing-multiple-menus-with-same-menu-item-names?replies=3#post-8390143)
    4852
    4953= Version 1.11.1 =
Note: See TracChangeset for help on using the changeset viewer.