Plugin Directory

Changeset 794422


Ignore:
Timestamp:
10/27/2013 02:00:36 PM (12 years ago)
Author:
lpointet
Message:
  • Removed useless capability check for displaying admin menu / props colouro
  • Allow a pointer to be post_type specific / props colouro
Location:
wordpress-gps/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • wordpress-gps/trunk/README.markdown

    r563449 r794422  
    2727    $pointer_config = array(
    2828        'selector' => '#menu-posts',
     29        'post_type' => 'post',
    2930        'content' => '<h3>title</h3><p>content</p>',
    3031        'position' => array(
     
    4142    (string) The DOM selector of the element on which the pointer will be attached.
    4243      Default: ''
     44
     45**post_type**
     46    (string) The post type slug differenciating some screens on which the pointer will be attached. For example, 'edit.php' hook could be on 'post' or 'page' post types.
     47      Default: '' (every post types)
    4348
    4449**content**
     
    108113    $pointer_config = array(
    109114        'selector' => '#menu-posts',
     115        'post_type' => 'post',
    110116        'content' => '<h3>titre</h3><p>contenu</p>',
    111117        'position' => array(
     
    122128    (string) Le sélecteur DOM de l'élément sur lequel va être attaché le pointer.
    123129      Par défaut : ''
     130
     131**post_type**
     132    (string) Le slug du post type différenciant plusieurs écrans. Par exemple, le hook 'edit.php' peut être sur les post types 'post' ou 'page'.
     133      Par défaut : '' (tous les pos types)
    124134
    125135**content**
  • wordpress-gps/trunk/gb_gps.php

    r580217 r794422  
    44Plugin URI: http://www.globalis-ms.com
    55Description: This plugin Provide an admin screen to WordPress users in which they will choose one scenario to play. That scenario will help them through the WordPress administration thanks to WP-Pointers API
    6 Version: 1.0.11
     6Version: 1.0.13
    77Author: Lionel POINTET, GLOBALIS media systems
    88Author URI: http://www.globalis-ms.com
  • wordpress-gps/trunk/include/api.php

    r563449 r794422  
    8080        'content' => '',
    8181        'position' => '',
     82        'post_type' => '',
    8283    );
    8384
     
    9394            'content' => $content,
    9495            'position' => $position,
     96            'post_type' => $post_type,
    9597        ));
    9698    }
  • wordpress-gps/trunk/include/gb_gps.php

    r564572 r794422  
    8787     */
    8888    public function play_scenario() {
    89         global $pagenow;
     89        global $pagenow, $typenow;
    9090
    9191        // Retrieve the current scenario
     
    9595            return;
    9696
    97         if(GBGPS_Scenario::STOP == $this->scenarios[$id]->process($pagenow)) {
     97        if(GBGPS_Scenario::STOP == $this->scenarios[$id]->process($pagenow, $typenow)) {
    9898            $this->set_active_scenario();
    9999        }
     
    127127    public function admin_menu() {
    128128        $this->handlePost();
    129         add_menu_page( GB_GPS_ADMIN_MENU_PAGE_TITLE, GB_GPS_ADMIN_MENU_MENU_TITLE, 'edit_posts', self::MENU_SLUG, array(&$this, 'display_admin_menu') );
     129        add_menu_page( GB_GPS_ADMIN_MENU_PAGE_TITLE, GB_GPS_ADMIN_MENU_MENU_TITLE, 'read', self::MENU_SLUG, array(&$this, 'display_admin_menu') );
    130130    }
    131131
     
    149149    public function display_admin_menu() {
    150150        // Security check
    151         if(!current_user_can('edit_posts')) {
     151        if(!current_user_can('read')) {
    152152            wp_die(GB_GPS_MESSAGE_CAPABILITY_ERROR);
    153153        }
  • wordpress-gps/trunk/include/gb_gps_pointer.php

    r566940 r794422  
    55    protected $content;
    66    protected $position;
     7    protected $post_type;
    78
    89    /**
     
    1516            'content' => '',
    1617            'position' => '',
     18            'post_type' => '',
    1719        );
    1820
     
    3436            'content' => $this->content,
    3537            'position' => $this->position,
     38            'post_type' => $this->post_type,
    3639        );
    3740    }
     
    4043     * Include the needed JavaScript to show the pointer(s)
    4144     */
    42     public static function process($pointers) {
     45    public static function process($pointers, $post_type) {
    4346        $nonce = wp_create_nonce('gb_gps_ajax_nonce');
    4447
    4548        $args = array();
    4649        foreach($pointers as $pointer) {
    47             $args[] = $pointer->args();
     50            if( empty( $pointer->post_type ) || $post_type == $pointer->post_type )
     51                $args[] = $pointer->args();
    4852        }
     53
     54        if( empty( $args ) )
     55            return FALSE;
    4956
    5057        ?>
     
    9198        </script>
    9299        <?php
     100
     101        return TRUE;
    93102    }
    94103}
  • wordpress-gps/trunk/include/gb_gps_scenario.php

    r566940 r794422  
    2929     * Retrieve the current page hook and decide which pointer to show
    3030     */
    31     public function process($hook) {
     31    public function process($hook, $post_type = NULL) {
    3232        if(empty($this->pointers[$hook])) {
    3333            $hook = 'all';
    3434        }
    3535
     36        $displayed = FALSE;
     37
    3638        if(!empty($this->pointers[$hook])) {
    37             GBGPS_Pointer::process($this->pointers[$hook]);
     39            $displayed = GBGPS_Pointer::process($this->pointers[$hook], $post_type);
    3840        }
    3941
    40         return $this->places[$hook] == $this->nb_pointers - 1 ? self::STOP : 0;
     42        return $displayed && $this->places[$hook] == $this->nb_pointers - 1 ? self::STOP : 0;
    4143    }
    4244
  • wordpress-gps/trunk/readme.txt

    r580217 r794422  
    33Tags: admin, help, tutorial, scenario, pointers, backend, plugin, training
    44Requires at least: 3.3.0
    5 Tested up to: 3.4
    6 Stable tag: 1.0.11
     5Tested up to: 3.6
     6Stable tag: 1.0.13
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4646
    4747== Changelog ==
     48
     49= 1.0.13 =
     50* Removed useless capability check for displaying admin menu / props colouro
     51* Allow a pointer to be post_type specific / props colouro
    4852
    4953= 1.0.11 =
  • wordpress-gps/trunk/scenarios.php

    r580217 r794422  
    2323                array(
    2424                    'selector' => '.add-new-h2',
     25                    'post_type' => 'post',
    2526                    'content' => '<h3>' . GB_GPS_ADD_FROM_LIST_POINTER_TITLE . '</h3><p>' . sprintf(GB_GPS_ADD_FROM_LIST_POINTER_CONTENT, __('post')) . '</p>',
    2627                    'position' => array(
     
    5354                array(
    5455                    'selector' => '#title',
     56                    'post_type' => 'post',
    5557                    'content' => '<h3>' . GB_GPS_ADD_CAT_TO_POST_LIST_POINTER_TITLE . '</h3><p>' . GB_GPS_ADD_CAT_TO_POST_LIST_POINTER_CONTENT . '</p>',
    5658                    'position' => array(
     
    6466                array(
    6567                    'selector' => '#categorydiv',
     68                    'post_type' => 'post',
    6669                    'content' => '<h3>' . GB_GPS_ADD_CAT_TO_POST_CATEGORY_POINTER_TITLE . '</h3><p>' . GB_GPS_ADD_CAT_TO_POST_CATEGORY_POINTER_CONTENT .'</p>',
    6770                    'position' => array(
Note: See TracChangeset for help on using the changeset viewer.