WordPress.org

Plugin Directory

Changeset 761226


Ignore:
Timestamp:
08/23/13 12:43:18 (8 months ago)
Author:
eskapism
Message:

deploy from git

Location:
ep-admin-messages/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ep-admin-messages/trunk/config-example.json

    r759747 r761226  
    22  "messages": [ 
    33    { 
    4       "message": "Detta meddelande syns överst överallt, för alla användare" 
     4      "message": "This message is visible on all screens, for all users." 
    55    }, 
    66    { 
    7       "message": "Jag syns bara på <strong>sidor</strong> eller på <strong>js error logs</strong>", 
    8       "location": "post_type:page, post_type:js_error_log" 
     7      "message": "This message is visible when someone edits a <strong>page</strong> or a post of type </strong>custom post type called <strong>custom_post_type</strong>.", 
     8      "location": "post_type:page, post_type:custom_post_type" 
    99    }, 
    1010    { 
    1111      "message": [ 
    12         "<p>Jag syns bara på <strong>sidor</strong> eller på <strong>js error logs</strong></p>", 
    13         "<p>Dessutom visas jag i en metabox i högerspalten</p>", 
    14         "<p>Och jag har en massa html-kod i mig + jag är uppdelad på flera rader i JSON-filen, för ökad läsbarhet.</p>", 
     12        "<p>This message is visible when a user edits a <strong>page</strong> or a post type with the name <strong>custom_post_type</strong>.</p>", 
     13        "<p>The message is shown in a metbox in the right column", 
     14        "and is also has a lot of HTML-code in it.</p>", 
    1515        "<h2>Here comes a definition list</h2>", 
    1616        "<dl>", 
    17         "<dt>Term one</dt>", 
    18         "<dd>Data text for the above term</dd>", 
     17        "<dt>Definition term one</dt>", 
     18        "<dd>Data description for the above term</dd>", 
    1919        "<dt>Another term comes here</dt>", 
    20         "<dd>Some text for this term: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas, reiciendis, autem, incidunt nemo magnam cupiditate sequi quo aperiam dignissimos fuga minus facere ducimus sunt quos similique. Officiis ad sunt recusandae.</dd>", 
     20        "<dd>Some text for this term: Lorem ipsum dolor sit amet, consectetur adipisicing elit.</dd>", 
    2121        "</dl>", 
    22         "<h2>Unordered lists work fine too</h2>", 
    23         "<ul>", 
    24         "<li>First list item</li>", 
    25         "<li>Second list item</li>", 
    26         "<li>List item <em>n</em>", 
    27         "</ul>", 
    28         "<h2>And ordered lists too</h2>", 
     22        "<h2>Ordered lists can be used</h2>", 
    2923        "<ol>", 
    3024        "<li>First list item</li>", 
    3125        "<li>Second list item</li>", 
    3226        "<li>List item <em>n</em></li>", 
    33         "</ol>" 
     27        "</ol>", 
     28        "<h2>Images work fine too</h2>", 
     29        "<p><img src='http://lorempixel.com/95/95/' alt='Dummy image from lorempixel.com' widht=100 height=100>" 
    3430      ], 
    35       "location": "post_type_metabox:page, post_type_metabox:js_error_log" 
     31      "location": "post_type_metabox:page, post_type_metabox:custom_post_type" 
    3632    }, 
    3733    { 
    38       "message": "Jag syns bara på <em>översikttsidan</em> för <strong>sidor</strong> eller <strong>js error logs</strong>", 
    39       "location": "post_type_overview:page, post_type_overview:js_error_log" 
     34      "message": "This message if visible on the <em>posts overview page</em> for <strong>pages</strong> and the custom post type with name <strong>custom_post_type</strong>.", 
     35      "location": "post_type_overview:page, post_type_overview:custom_post_type" 
    4036    }, 
    4137    { 
    42       "message": "På dashboard syns jag, för alla användare", 
     38      "message": "This message is shown at the top of the dashboard, for all users.", 
    4339      "location": "dashboard" 
    4440    }, 
    4541    { 
    46       "message": "På dashboard syns jag, för alla användare, fast i en metabox", 
     42      "message": [ 
     43        "<p>This message is shown on the dashboard in a metabox. It is shown to all users.</p>", 
     44        "<p>This is a good place to add some HTML to a message.</p>", 
     45        "<p>You can use all <strong>kinds</strong> of <em>HTML</em> is <a href='#'>ok to have</a>.", 
     46        "<p>Even images are ok:<br><img src='http://lorempixel.com/95/95/' alt='Dummy image from lorempixel.com' widht=100 height=100>" 
     47      ], 
    4748      "location": "dashboard_metabox" 
    4849    }, 
    4950    { 
    50       "message": "This will be shown on <strong>plugins overview page</strong>", 
    51       "location": "plugins" 
     51      "message": "This message is shown on the plugins, users and profile screens.", 
     52      "location": "plugins, users, profile" 
    5253    }, 
    5354    { 
    54       "message": "This text will be visible on users overview screen", 
    55       "location": "users" 
    56     }, 
    57     { 
    58       "message": "This text will be visible on a single user profile page", 
    59       "location": "profile" 
    60     }, 
    61     { 
    62       "message": "Denna post type används för att ... kort info på översiktssidan för en post type", 
    63       "location": "my_post_type-overview" 
    64     }, 
    65     { 
    66       "message": "Jag syns på sidor som har en slug/permalänk som börjar med footer- eller header-", 
    67       "location": "page", 
     55      "message": "This message is shown only when a user edits a page, and that page has a slug/permalink that begins with <code>footer-</code> or <code>header-</code>.", 
     56      "location": "post_type:page", 
    6857      "post_slug": "footer-*, header-*" 
    6958    }, 
    7059    { 
    71       "message": "Information kan äves visas bara för vissa användare, beroende på capability. Jag syns bara på dashboard och för användare med capability <em>manage_options</em>", 
     60      "message": "This message is shown on the dasboard, but only for users that has capability <code>manage_options</code>.", 
    7261      "capability": "manage_options", 
    7362      "location": "dashboard" 
     
    7564    { 
    7665      "message": [ 
    77         "Detta meddelande syns bara på poster av typen page eller my_custom_post_type.", 
    78         "Det syns på höger sida, och är synlig bara för användare som får redigera sidor eller hantera inställningar. ", 
    79         "Dock är meddelandet begränsat så det bara syns på sidor som har slug my_slug eller en slug som börjar med texts-header" 
     66        "<p>This message is shown when editing pages. It is shown in a metabox in the right column.</p>", 
     67        "<p>It's only visible for users who has capability <code>edit_posts</code> or <code>manage_options</code>.</p>", 
     68        "<p>And finally it's also only visible for posts that have a slug/permalink that begins with <code>header-</code>.</p>" 
    8069      ], 
    81       "location": "post_type_metabox:page, post_type:my_custom_post_type", 
    82       "capability": "edit_posts,manage_options", 
    83       "post_slug": "my-slug,texts-header-*" 
     70      "location": "post_type_metabox:page", 
     71      "capability": "edit_posts, manage_options", 
     72      "post_slug": "header-*" 
    8473    }, 
    8574    { 
    86       "message": "I will be shown on pages or posts with a slug that begins with text-*", 
    87       "post_slug": "text-*" 
    88     }, 
    89     { 
     75      "_Not done yet": "This section is not done yet.", 
    9076      "message_en-US": "This message will be shown only to admin users with en-US as their admin language", 
    9177      "message_sv-SE": "Detta meddelande syns endast för admins med svenska som språk" 
  • ep-admin-messages/trunk/ep-admin-messages.class.php

    r759747 r761226  
    66class Ep_Admin_Messages { 
    77 
    8     private $config_file = "ep-config.json"; 
     8    private $config_file = ".ep-config.json"; 
    99    private $config = array(); 
    1010    private $plugin_name = "EP Admin Messages"; 
     
    3232        if ( "post" === $current_screen->base ) { 
    3333             
    34             $post_id = 0; 
    35             if ( isset( $_GET['post'] ) ) 
    36                 $post_id = $post_ID = (int) $_GET['post']; 
    37             elseif ( isset( $_POST['post_ID'] ) ) 
     34             
     35            // Get post type and possibly post name 
     36            if ( isset( $_GET['post'] ) ) { 
     37                $post_id = $post_ID = (int) $_GET['post']; 
     38                $post = get_post($post_id); 
     39            } elseif ( isset( $_POST['post_ID'] ) ) { 
    3840                $post_id = $post_ID = (int) $_POST['post_ID']; 
    39  
    40              $post = get_post($post_id); 
     41                $post = get_post($post_id); 
     42            } elseif ( "post" === $current_screen->base && "add" === $current_screen->action ) { 
     43                // Creating new post. Post ID not set yet. 
     44                // Create a stdClass with just post_type added 
     45                $post = new stdClass; 
     46                $post->post_type = $_GET["post_type"]; 
     47            } 
    4148 
    4249         } 
     
    186193                    $do_show_post_slug = false; 
    187194 
    188                     if ( ! empty( $post ) ) { 
     195                    if ( ! empty( $post ) && isset( $post->post_name ) ) { 
    189196                     
    190197                        foreach ( $post_slugs as $one_slug ) { 
  • ep-admin-messages/trunk/ep-admin-messages.php

    r759747 r761226  
    44Plugin URI: http://earthpeople.se/ 
    55Description: Show custom messages in the admin area 
    6 Version: 0.1 
     6Version: 0.1.1 
    77Author: Earth People 
    88Author URI: http://earthpeople.se/ 
  • ep-admin-messages/trunk/readme.txt

    r759748 r761226  
    44License: GPLv3 
    55License URI: http://www.gnu.org/licenses/gpl.html 
    6 Tags: admin, wp admin, wordpress admin, messages, notices, information, client, help 
     6Tags: admin, wp admin, wordpress admin, messages, notices, information, client, help, admin notice, admin notices, metabox 
    77Requires at least: 3.6 
    88Tested up to: 3.6 
    9 Stable tag: 0.1 
     9Stable tag: 0.1.1 
    1010 
    1111Show messages in WP Admin. Different messages can be shown at different places, for different people. 
     
    4242 
    4343All settings are made with a config file that you put in the theme directory. 
     44 
    4445This means that there are no settings for the user to change. This also means that you can add messages using your regular deploy method. Just upload an updated config file and you're done. No database syncing needed; hooray! 
    4546 
     
    4849To give you an idea what this plugin may be used for, I'll give you a list of what I do with it. 
    4950 
    50 I'm using EP Simple Messags to: 
     51EP Simple Messages can be used to… 
    5152 
    52 * ... write documentation for users and developers. 
    53 * ... show editors what [Mustache tags](http://mustache.github.io/) are available for a specific post (controlled by post slug). You know, things like `{{user.firstname}}` or `{{campaign.name}}`, that there is no way that they (or I!) will ever remember. 
    54 * ... show a message on the dashboard with support info, like who made the site and who they should contact for support questions. 
    55 * ... let the user know what shortcodes that are available for all posts. 
     53* write documentation for users and developers. 
     54* … show users what [Mustache tags](http://mustache.github.io/) are available for a specific post. You know, things like `{{user.firstname}}` or `{{campaign.name}}`. 
     55* show a message on the dashboard with support info, like who made the site and who they should contact for support questions. 
     56* let the user know what shortcodes that are available for all posts. 
    5657 
    5758 
    5859== Installation == 
    5960 
    60 1. Upload the plugin folder to your `/wp-content/plugins/` directory 
    61 1. Activate the plugin through the 'Plugins' menu in WordPress 
    62 1. Add a file called `ep-config.json` to your theme directory. This file contains your config in JSON-format.  
     611. Upload the plugin folder to your `/wp-content/plugins/` directory. 
     621. Activate the plugin through the 'Plugins' menu in WordPress. 
     631. Add a file called `.ep-config.json` to your theme directory. This file contains your config in JSON-format.  
     641. Optional: update your `.htaccess` to disable access to the config file used by this plugin (if you don't do this everyone with access to your site can read your messages): 
     65 
     66``` 
     67# Forbid access to all files beginning with a dot (.). 
     68RedirectMatch 403 /\..*$ 
     69 
     70# Or forbid access to only .ep-config.json 
     71# RedirectMatch 403 /\.ep-config\.json$ 
     72``` 
    6373 
    6474== Screenshots == 
    6575 
    66 1. .... 
    67 2. .... 
     761. Three messages being shown on the edit post screen. Notice that you can add HTML to your messages and add headlines, links, images, and so on. 
     772. Four messages being shown on the dashboard. 
    6878 
    6979== Changelog == 
     80 
     81= 0.1.1 = 
     82 
     83* Use `.ep-config.json` instead of `ep-config.json` for configuration file. Makes it a bit more secure, since dot-files often are hidden by default. 
     84* Example config `config-example.json` updated with better examples and is now in english. 
     85* Fixed bug with notice warning when creating new posts. 
     86* Added screenshots. 
    7087 
    7188= 0.1 = 
Note: See TracChangeset for help on using the changeset viewer.