Plugin Directory

Changeset 814888


Ignore:
Timestamp:
12/04/2013 02:06:02 PM (12 years ago)
Author:
v-media
Message:

Update Foodlist to v 1.2

Location:
foodlist/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Controller/ActivationController.php

    r792818 r814888  
    1919    public function init()
    2020    {
     21        // in fact it should be always true, it's just for making sure
     22        if (did_action('init')) {
     23            // because init was called before the plugin started, we need to prepare some structures
     24            // so that the plugin could install the demo data
     25            add_image_size('fl-menu-tag-icon', 16, 16, true);
     26            add_image_size('fl-menu-item-thumb', 100, 100, true);
     27
     28            fl_setup_wpdb_meta_table();
     29            $this->loadTaxonomies();
     30            $this->loadCustomPosts();
     31        }
     32
    2133        if (get_option('foodlist_first_start', 1)) {
    22             // in fact it should be always true, it's just for making sure
    23             if (did_action('init')) {
    24                 // because init was called before the plugin started, we need to prepare some structures
    25                 // so that the plugin could install the demo data
    26                 add_image_size('fl-menu-tag-icon', 16, 16, true);
    27                 add_image_size('fl-menu-item-thumb', 100, 100, true);
    28 
    29 
    30                 fl_setup_wpdb_meta_table();
    31                 $this->loadTaxonomies();
    32             }
    3334            $this->createDBTables();
    3435            $this->setupDemoData();
     
    3637            update_option('foodlist_first_start', 0);
    3738        }
     39
     40        // register taxonomies/post types here
     41        flush_rewrite_rules();
     42
    3843        return $this;
    3944    }
     
    4651    {
    4752        $taxonomies = $this->getManager()->get('taxonomies', array());
     53
    4854        foreach ($taxonomies as $taxonomy) {
    4955            $taxonomy->onInit();
    5056        }
    5157    }
    52    
     58
     59    /**
     60     * Explicitly calls onInit for all the plugin's registered posts
     61     * this is normally called at 'init' action, but is not during the activation process
     62     */
     63    private function loadCustomPosts()
     64    {
     65        $posts = $this->getManager()->get('custom_posts', array());
     66
     67        foreach ($posts as $post) {
     68            $post->onInit();
     69        }
     70    }
     71
    5372    /**
    5473     * Prepare custom tables
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Controller/CommonController.php

    r792818 r814888  
    5151    private function registerPostTypes()
    5252    {
    53         $menu = new MenuItemPost();
     53        $customPosts = array();
     54        $customPosts['menu-item'] = $menu = new MenuItemPost();
    5455        $menu->setupRegistrationHook();
    55         $menu = new MenuSectionPost();
     56        $customPosts['menu-section'] = $menu = new MenuSectionPost();
    5657        $menu->setupRegistrationHook();
    57         $menu = new MenuPost();
     58        $customPosts['menu'] = $menu = new MenuPost();
    5859        $menu->setupRegistrationHook();
     60        $this->getManager()->set('custom_posts', $customPosts);
    5961        return $this;
    6062    }
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Generic/Post/BasePost.php

    r792818 r814888  
    2828        return $this;
    2929    }
    30    
     30
     31    private function getTheExcerpt() {
     32        $post = get_post();
     33
     34        if (post_password_required()) {
     35            return __('There is no excerpt because this is a protected post.', 'foodlist');
     36        }
     37
     38        return $post->post_excerpt;
     39    }
     40
     41
    3142    public function preparePostData()
    3243    {
     
    3546        //$price = $this->getPrice();
    3647        //$tags = $this->getTags();
    37         $excerpt = get_the_excerpt();
     48        $excerpt = $this->getTheExcerpt();
    3849        $content = get_the_content();
    3950           
  • foodlist/trunk/lib/Foodlist/Project/WordPress/Plugin/Foodlist/Generic/Post/MenuPostFactory.php

    r792818 r814888  
    2929        if ($query->have_posts()) {
    3030            $query->the_post();
    31            
     31
    3232            $menuItem = new MenuPost(get_the_ID());
    3333            $menuItem->preparePostData();
  • foodlist/trunk/plugin.php

    r793602 r814888  
    1212Author: Artprima
    1313Author URI: http://artprima.eu/
    14 Version: 1.1
     14Version: 1.2
    1515*/
    1616
    17 define('FOODLIST_VERSION', '1.1');
     17define('FOODLIST_VERSION', '1.2');
    1818define('FOODLIST_MIN_PHP_VERSION', '5.3.0');
    1919define('FOODLIST_MIN_WP_VERSION', '3.4.0');
  • foodlist/trunk/readme.txt

    r793602 r814888  
    4747== ChangeLog ==
    4848
     49= Version 1.2 =
     50
     51* Fixed empty menu excerpt issue
     52* Added `flush_rewrite_rules()` call on plugin activation
     53
    4954= Version 1.1 =
    5055
Note: See TracChangeset for help on using the changeset viewer.