Plugin Directory

Changeset 1675683


Ignore:
Timestamp:
06/10/2017 09:55:14 PM (9 years ago)
Author:
RobertGillmer
Message:

Integrated option for Page Template descriptions.
Integrated status notification for network-enabled plugins for multisites.
Plugin now calls out "built-in" post types.
Integrated success message for save.
Styling changes comma lots of.

Location:
wp-documentor/trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • wp-documentor/trunk/assets/css/wpdoc-main-style.css

    r1659019 r1675683  
     1.wp-documentor-notice {
     2    color: #f00;
     3}
     4
     5.wp-documentor-panel-no-labels .form-table th {
     6    display: none;
     7}
     8
     9.wp-documentor-panel-no-labels .form-table label {
     10    display: inline-block;
     11    font-weight: 600;
     12    line-height: 1.3;
     13    padding: 20px 10px 20px 0;
     14    text-align: left;
     15    vertical-align: top;
     16    width: 200px;
     17}
     18
     19.wp-documentor-panel-no-labels .form-table textarea {
     20    margin: 15px 0;
     21}
  • wp-documentor/trunk/readme.txt

    r1659019 r1675683  
    88
    99== Description ==
    10 Ever start working on a site and wonder to yourself \"Why is that plugin installed, what does it do?\"  Yeah, me too.  This plugin enumerates the plugins and custom post types on a site, with a description blank for each.  You can then output the descriptions to a PDF to give to your clients, so they know what\'s installed and why.
     10Ever start working on a site and wonder to yourself "Why is that plugin installed, what does it do?"  Yeah, me too.  This plugin enumerates the plugins and custom post types on a site, with a description blank for each.  You can then output the descriptions to a PDF to give to your clients, so they know what's installed and why.
    1111
    1212== Installation ==
    13131. Upload the plugin files to the `/wp-content/plugins/wp-documentor` directory, or install the plugin through the WordPress plugins screen directly.
    14 1. Activate the plugin through the \'Plugins\' screen in WordPress.
     141. Activate the plugin through the 'Plugins' screen in WordPress.
    1515
    1616== Changelog ==
  • wp-documentor/trunk/submenus/cpts.php

    r1659019 r1675683  
    4848function wpdoc_cpt_description_render() {
    4949    $options = get_option( 'wpdoc_cpt_descriptions' );
     50    $built_in_cpts_objects = get_post_types(
     51        array(
     52            '_builtin'  => true,
     53        ),
     54        'objects'
     55    );
     56    $built_in_cpts_slugs = array_keys( $built_in_cpts_objects );
     57
    5058    $all_public_cpts = get_post_types(
    5159        array(
     
    5765    foreach( $all_public_cpts as $slug => $cpt_data ) {
    5866        $label = $cpt_data->label;
     67        $status = '';
     68
     69        if( in_array( $slug, $built_in_cpts_slugs ) ) {
     70            $status = ' <span class="wp-documentor-notice">(Built-In)</span>';
     71        }
    5972
    6073        if( isset( $options[ $slug ][ 'description' ] ) ) {
     
    6578        ?>
    6679
    67         <label><?php echo $label; ?></label><br />
     80        <label><?php echo $label; echo $status; ?></label>
    6881        <textarea cols='40' rows='5' name='wpdoc_cpt_descriptions[<?php echo $slug; ?>]'><?php echo $value; ?></textarea>
    6982        <br />
     
    122135// That form callback function we alluded to earlier?  Wait no longer, here it is!
    123136
    124 function wpdoc_cpts_form_output() { ?>
    125     <form action='options.php' method='post'>
     137function wpdoc_cpts_form_output() {
     138    settings_errors(); ?>
     139    <form class="wp-documentor-panel wp-documentor-panel-no-labels"  action='options.php' method='post'>
    126140        <h1>WP Documentor - Custom Post Types</h1>
    127141        <p>You can add descriptions for the custom post types which have been created for this site.  You can also add descriptions for the built-in WordPress post types Posts, Pages, and Media.</p>
  • wp-documentor/trunk/submenus/pdf-settings.php

    r1659019 r1675683  
    129129
    130130function wpdoc_pdf_settings_form_output() {
    131     $secret_key = get_option( 'wpdoc_secret_key' ); ?>
    132     <form action='options.php' method='post'>
     131    settings_errors();
     132    $secret_key = get_option( 'wpdoc_secret_key' );
     133    ?>
     134    <form class="wp-documentor-panel" action='options.php' method='post'>
    133135        <h1>WP Documentor - PDF Settings</h1>
    134136        <p>You can set the defaults for your PDF below.</p>
  • wp-documentor/trunk/submenus/plugins.php

    r1659019 r1675683  
    5353    foreach( $all_installed_plugins as $slug => $plugin_data ) {
    5454        $plugin_name = $plugin_data[ 'Name' ];
     55        $status = '';
    5556
    56         if( in_array( $slug, $active_plugins ) ) {
    57             $status = ' (Active)';
    58         } else {
    59             $status = ' (Inactive)';
     57        if( ! in_array( $slug, $active_plugins ) ) {
     58            $status = ' <span class="wp-documentor-notice">(Inactive)</span>';
     59        }
     60
     61        if( is_multisite() ) {
     62            if( is_plugin_active_for_network( $slug ) ) {
     63                $status = ' (Network Activated)';
     64            }
    6065        }
    6166
     
    6772        ?>
    6873
    69         <label><?php echo $plugin_name; echo $status; ?></label><br />
     74        <label><?php echo $plugin_name; echo $status; ?></label>
    7075        <textarea cols='40' rows='5' name='wpdoc_plugin_descriptions[<?php echo $slug; ?>]'><?php echo $value; ?></textarea>
    7176        <br />
     
    120125
    121126function wpdoc_plugins_form_output() {
    122     do_action( 'before_testing_facade' ); ?>
    123     <form action='options.php' method='post'>
     127    settings_errors(); ?>
     128    <form class="wp-documentor-panel wp-documentor-panel-no-labels" action='options.php' method='post'>
    124129        <h1>WP Documentor - Plugins</h1>
    125130        <p>You can add descriptions for each plugin installed on this site.  Plugins which are inactive are noted below.</p>
     
    135140    <?php
    136141}
     142
     143// Success message on save
     144
     145function wpdoc_plugins_update_notice() { ?>
     146    <div class="notice notice-success is-dismissible">
     147        <p><?php _e( 'Done!', 'sample-text-domain' ); ?></p>
     148    </div>
     149<?php }
     150
     151// add_action( 'admin_notices', 'wpdoc_plugins_update_notice' );/
  • wp-documentor/trunk/wpdoc-activation.php

    r1659019 r1675683  
    11<?php
    2 
    3 // Time being, let's save this stuff to the options table.
    42
    53function wpdoc_activation() {
    64    add_option( 'wpdoc_plugin_descriptions', array(), '', false );
    75    add_option( 'wpdoc_cpt_descriptions', array(), '', false );
     6    add_option( 'wpdoc_page_template_descriptions', array(), '', false );
    87    add_option( 'wpdoc_pdf_settings', array(), '', false );
    98
  • wp-documentor/trunk/wpdoc-main.php

    r1659019 r1675683  
    99 * Author:      Robert Gillmer
    1010 * Author URI:  http://www.robertgillmer.com
    11  * Version:     1.0.0
     11 * Version:     1.1.0
    1212 * Text Domain: wpdoc
    1313 * Domain Path: languages
  • wp-documentor/trunk/wpdoc-options-page-main.php

    r1659019 r1675683  
    2424include_once( __DIR__ . '/submenus/plugins.php' );
    2525include_once( __DIR__ . '/submenus/cpts.php' );
     26include_once( __DIR__ . '/submenus/page-templates.php' );
    2627include_once( __DIR__ . '/submenus/pdf-settings.php' );
    2728
  • wp-documentor/trunk/wpdoc-pdf-generator.php

    r1659019 r1675683  
    1818    $plugin_descriptions = get_option( 'wpdoc_plugin_descriptions' );
    1919    $cpt_descriptions = get_option( 'wpdoc_cpt_descriptions' );
     20    $page_template_descriptions = get_option( 'wpdoc_page_template_descriptions' );
    2021
    2122    $site_url_with_protocol = get_bloginfo( 'url' );
     
    7374                </div> <?php
    7475            }
    75         } ?>
     76        }
     77
     78        if( isset( $page_template_descriptions ) && ! empty( $page_template_descriptions ) ) {
     79            if( is_array( $page_template_descriptions ) ) { // It should always be an array, but just in case... ?>
     80                <div class="wpdoc-section-wrapper">
     81                    <h2>Custom Post Type Descriptions</h2>
     82                    <?php foreach( $page_template_descriptions as $page_template ) { ?>
     83                        <strong><?php echo $page_template[ 'name' ]; ?></strong><br />
     84                        <p class="page-template-description"><?php echo $page_template[ 'description' ]; ?></p>
     85                    <?php } ?>
     86                </div> <?php
     87            }
     88        }
     89
     90         ?>
    7691    </body><?php
    7792    $contents = ob_get_clean();
Note: See TracChangeset for help on using the changeset viewer.