Plugin Directory

Changeset 1633621


Ignore:
Timestamp:
04/09/2017 02:44:20 PM (9 years ago)
Author:
webstartup
Message:

Collection 0.2::
Adding deregister post types

Location:
collection
Files:
6 added
13 edited
18 copied

Legend:

Unmodified
Added
Removed
  • collection/tags/0.1/readme.txt

    r1633562 r1633621  
    55Requires at least: 4.0
    66Tested up to: 4.7
    7 Stable tag: trunk
     7Stable tag: 0.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • collection/trunk/collection.php

    r1633516 r1633621  
    44  Plugin URI: http://web-startup.fr/
    55  Description: Create and manage yourself your own collection by means of a simple generator of custom post types.
    6   Version: 0.1
     6  Version: 0.2
    77  Author: Steeve Lefebvre
    88  Author URI: web-startup.fr/
  • collection/trunk/plugin/admin/assets.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
  • collection/trunk/plugin/admin/form.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
  • collection/trunk/plugin/admin/init.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
  • collection/trunk/plugin/admin/metabox.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
  • collection/trunk/plugin/admin/panel.php

    r1633516 r1633621  
    22/**
    33 * @package Collection
    4  * @version 0.1
     4 * @version 0.2
    55 */
    66
     
    139139        register_setting(
    140140                'slwsu_collection_reglages', 'slwsu_collection_post_type_supports'
     141        );
     142
     143        // ...
     144        add_settings_field(
     145                'slwsu_collection_post_type_deregister', __('Deregister post types', 'coon'), array($this, 'post_type_deregister'), 'slwsu_collection_reglages', 'slwsu_collection_section_reglages'
     146        );
     147        register_setting(
     148                'slwsu_collection_reglages', 'slwsu_collection_post_type_deregister'
    141149        );
    142150
     
    490498                                endforeach;
    491499                            else:
    492                                 echo '<p style="margin-bottom:10px;"><span class="dashicons dashicons-warning"></span>' . __('This collection contains no metabox.', 'coon') . '</p>';
     500                                echo '<p style="margin-bottom:10px;"><span class="dashicons dashicons-warning"></span> ' . __('This collection contains no metabox.', 'coon') . '</p>';
    493501                            endif;
    494502                            ?>
     
    627635    }
    628636
     637    public function post_type_deregister() {
     638        $input = get_option('slwsu_collection_post_type_deregister');
     639        echo '<input id="slwsu_collection_post_type_deregister" name="slwsu_collection_post_type_deregister" value="' . $input . '" type="text" class="regular-text" />';
     640        echo '<p class="description">' . __('Add here the different post types to deregister by separating them with a comma ( , ).', 'coon') . '</p>';
     641    }
     642
    629643    public function delete_options() {
    630644        $input = get_option('slwsu_collection_delete_options');
  • collection/trunk/plugin/front/init.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
  • collection/trunk/plugin/front/shortcode.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
  • collection/trunk/plugin/init.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    7 
    87defined('ABSPATH') or exit();
    98
     
    1110
    1211    public $post_types;
     12    public $del_post_types;
    1313
    1414    /**
     
    1717    public function __construct() {
    1818        $this->post_types = get_option('slwsu_collection_post_types', 'false');
     19        $this->del_post_types = get_option('slwsu_collection_post_type_deregister', '');
    1920        $this->_init();
    2021    }
     
    3132            $this->front_init();
    3233        endif;
     34
     35        if ('' !== $this->del_post_types):
     36            add_action('init', array($this, 'del_post_types'), 20);
     37        endif;
    3338    }
    3439
     
    4348                ${$cpt['name']} = new slwsu_post_types($cpt);
    4449            endforeach;
     50        endif;
     51    }
     52
     53    /**
     54     * ...
     55     */
     56    public function del_post_types() {
     57        global $wp_post_types;
     58        $aCpt = explode(',', $this->del_post_types);
     59        if (is_array($aCpt)):
     60            foreach ($aCpt as $post_type) {
     61                $post_type = trim($post_type);
     62                if (isset($wp_post_types[$post_type]) && '' !== $post_type) {
     63
     64                    unset($wp_post_types[$post_type]);
     65                }
     66            }
     67        else:
     68            $post_type = trim($this->del_post_types);
     69            unset($wp_post_types[$post_type]);
    4570        endif;
    4671    }
  • collection/trunk/plugin/options.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
     
    1919            'flush_rewrite' => 'false',
    2020            'post_types' => 'false',
     21            'post_type_deregister' => '',
    2122            'metaboxs' => 'false',
    2223            'post_type_supports' => 'title, editor, author, thumbnail, excerpt, comments',
  • collection/trunk/plugin/post_types.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    7 
    87class slwsu_post_types {
    98
     
    2928        $this->capability = get_option('slwsu_collection_capability_type', 'post');
    3029        $this->supports = array_map('trim', explode(',', get_option('slwsu_collection_post_type_supports')));
    31        
     30
    3231        $post_types = get_option('slwsu_collection_post_types', 'false');
    3332        $flush = get_option('slwsu_collection_flush_rewrite', 'false');
     
    5554    public function _init() {
    5655        add_action('init', array($this, 'register_post_types'), 10);
     56
    5757        if (true === $this->flush_rewrite):
    5858            add_action('init', array($this, 'flush_rewrite_rules'), 20);
     
    8484            'query_var' => true,
    8585            'rewrite' => array('slug' => $this->slug, 'with_front' => true),
    86             'capability_type' => $this->capability, 
     86            'capability_type' => $this->capability,
    8787            'has_archive' => true,
    8888            'hierarchical' => false,
     
    130130    }
    131131
     132
    132133}
  • collection/trunk/readme.txt

    r1633562 r1633621  
    11=== Collection ===
    22Contributors: webstartup, Benoti
    3 Tags: cllection, post type, post-type, post-types, custom post type, manage post types, metabox, custom metabox, collection, collection post type, divi compatible
     3Tags: post type, post-type, post-types, post types, custom post type, manage post types, metabox, custom metabox, collection, collection post type, divi compatible
    44Donate link: http://web-startup.fr/
    55Requires at least: 4.0
     
    2020* Add metabox dedicated to collections
    2121* Add information to content with shortcode
     22* Remove unnecessary post types
    2223
    2324== Installation ==
     
    6263
    6364== Changelog ==
    64 = v 1.0.0 =
     65= v 0.2 =
     66* Add deletion after unnecessary types
     67
     68= v 0.1 =
    6569* First release!
    6670
    6771== Upgrade Notice ==
    68 = v 1.0.0 =
    69 Initial Version.
     72= v 0.2 =
     73* First release!
     74
     75= v 0.1 =
     76* Initial Version.
  • collection/trunk/uninstall.php

    r1633516 r1633621  
    33/**
    44 * @package Collection
    5  * @version 0.1
     5 * @version 0.2
    66 */
    77
Note: See TracChangeset for help on using the changeset viewer.