WordPress.org

Plugin Directory

Changeset 1733627


Ignore:
Timestamp:
09/21/17 11:10:33 (5 months ago)
Author:
cardiganmedia
Message:

V.2.0.0 release

Location:
staffer
Files:
10 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • staffer/trunk/languages/staffer.pot

    r1032751 r1733627  
     1# Copyright (C) 2017 Staffer 
     2# This file is distributed under the same license as the Staffer package. 
    13msgid "" 
    24msgstr "" 
    3 "Project-Id-Version: Staffer 1.3\n" 
    4 "POT-Creation-Date: 2014-11-25 15:58-0500\n" 
    5 "PO-Revision-Date: 2014-11-25 16:00-0500\n" 
    6 "Last-Translator: \n" 
    7 "Language-Team: Edward R. Jenkins <edward@edwardrjenkins.com>\n" 
    8 "Language: English\n" 
     5"Project-Id-Version: Staffer 2.0.0\n" 
     6"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/staffer\n" 
     7"POT-Creation-Date: 2017-09-21 10:48:04+00:00\n" 
    98"MIME-Version: 1.0\n" 
    109"Content-Type: text/plain; charset=UTF-8\n" 
    1110"Content-Transfer-Encoding: 8bit\n" 
    12 "X-Generator: Poedit 1.5.4\n" 
    13 "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n" 
    14 "X-Poedit-Basepath: /home/edward/Desktop/staffer\n" 
    15 "X-Poedit-SourceCharset: UTF-8\n" 
    16 "X-Poedit-SearchPath-0: .\n" 
     11"PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n" 
     12"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     13"Language-Team: LANGUAGE <LL@li.org>\n" 
    1714 
    18 #: single-staff.php:43 
    19 msgid "Home" 
     15#: admin/class-staffer-admin.php:65 
     16msgid "Profile Details" 
    2017msgstr "" 
    2118 
    22 #: single-staff.php:59 
    23 msgid "Department: " 
     19#: admin/class-staffer-admin.php:106 
     20msgid "Staff ID" 
    2421msgstr "" 
    2522 
    26 #: single-staff.php:93 
    27 msgid "Contact from " 
     23#: admin/class-staffer-admin.php:111 
     24msgid "Title" 
    2825msgstr "" 
    2926 
    30 #: load-staffer.php:28 
     27#: admin/class-staffer-admin.php:116 
     28msgid "Facebook" 
     29msgstr "" 
     30 
     31#: admin/class-staffer-admin.php:121 
     32msgid "Google+" 
     33msgstr "" 
     34 
     35#: admin/class-staffer-admin.php:126 
     36msgid "Twitter" 
     37msgstr "" 
     38 
     39#: admin/class-staffer-admin.php:131 
     40msgid "LinkedIn" 
     41msgstr "" 
     42 
     43#: admin/class-staffer-admin.php:136 
     44msgid "Instagram" 
     45msgstr "" 
     46 
     47#: admin/class-staffer-admin.php:141 
     48msgid "YouTube" 
     49msgstr "" 
     50 
     51#: admin/class-staffer-admin.php:146 
     52msgid "Github" 
     53msgstr "" 
     54 
     55#: admin/class-staffer-admin.php:151 
     56msgid "Website" 
     57msgstr "" 
     58 
     59#: admin/class-staffer-admin.php:156 
     60msgid "Email" 
     61msgstr "" 
     62 
     63#: admin/class-staffer-admin.php:161 
     64msgid "Phone Number" 
     65msgstr "" 
     66 
     67#: admin/class-staffer-admin.php:228 
     68msgid "View Staff Page" 
     69msgstr "" 
     70 
     71#: admin/class-staffer-admin.php:253 
     72msgid "Options" 
     73msgstr "" 
     74 
     75#: admin/class-staffer-admin.php:268 
    3176msgid "For paid support or customizations, please contact me at" 
    3277msgstr "" 
    3378 
    34 #: load-staffer.php:31 
     79#: admin/class-staffer-admin.php:273 
    3580msgid "Staffer Options Panel" 
    3681msgstr "" 
    3782 
    38 #: load-staffer.php:36 
     83#: admin/class-staffer-admin.php:279 
     84msgid "Staff Page ID" 
     85msgstr "" 
     86 
     87#: admin/class-staffer-admin.php:281 
     88msgid "" 
     89"The ID of the main staff page. Do not change this unless you know what you " 
     90"are doing." 
     91msgstr "" 
     92 
     93#: admin/class-staffer-admin.php:287 
    3994msgid "Staff Layout" 
    4095msgstr "" 
    4196 
    42 #: load-staffer.php:38 
    43 msgid "Check this to use the staff grid layout." 
    44 msgstr "" 
    45  
    46 #: load-staffer.php:42 
    47 msgid "Excerpt Style" 
    48 msgstr "" 
    49  
    50 #: load-staffer.php:46 
    51 msgid "Excerpt" 
    52 msgstr "" 
    53  
    54 #: load-staffer.php:47 
    55 msgid "Full" 
    56 msgstr "" 
    57  
    58 #: load-staffer.php:48 
    59 msgid "Disabled" 
    60 msgstr "" 
    61  
    62 #: load-staffer.php:50 
    63 msgid "Choose your staff listing excerpt style." 
    64 msgstr "" 
    65  
    66 #: load-staffer.php:54 
    67 msgid "Staffer Main Page Description" 
    68 msgstr "" 
    69  
    70 #: load-staffer.php:59 
    71 msgid "" 
    72 "Add a description for the Staffer directory, which will appear below the " 
    73 "main directory title." 
    74 msgstr "" 
    75  
    76 #: load-staffer.php:62 
    77 msgid "Listings per page" 
    78 msgstr "" 
    79  
    80 #: load-staffer.php:64 
    81 msgid "" 
    82 "Set the number of staff members per page. Leave blank to inherit the " 
    83 "Settings->Reading." 
    84 msgstr "" 
    85  
    86 #: load-staffer.php:67 
    87 msgid "Staffer Page Title" 
    88 msgstr "" 
    89  
    90 #: load-staffer.php:69 
    91 msgid "" 
    92 "Set a custom Staffer page title, if desired. The default title is " 
    93 "<code>Staff</code>. This title will be used as the archive page title and " 
    94 "within breadcrumbs. Leave blank to use the default." 
    95 msgstr "" 
    96  
    97 #: load-staffer.php:72 
    98 msgid "Staffer Label" 
    99 msgstr "" 
    100  
    101 #: load-staffer.php:74 
    102 msgid "" 
    103 "Set a custom label, if desired. This is shown in the admin panel and is used " 
    104 "in the <code>title</code> tag. The default label is <code>Staff</code>. " 
    105 "Leave blank to use the default." 
    106 msgstr "" 
    107  
    108 #: load-staffer.php:77 
    109 msgid "Staffer URL slug" 
    110 msgstr "" 
    111  
    112 #: load-staffer.php:79 
    113 msgid "" 
    114 "Set a custom URL slug, if desired. The default slug is <code>staff</code>." 
    115 "<strong>Notice:</strong> Use lowercase only, and use no spaces, i.e., " 
    116 "instead of using <code>Staff Pages</code>, use <code>staff-pages</code>. " 
    117 "Leave blank to use the default." 
    118 msgstr "" 
    119  
    120 #: load-staffer.php:82 
    121 msgid "Disable CSS" 
    122 msgstr "" 
    123  
    124 #: load-staffer.php:84 
    125 msgid "Check this box to disable all Staffer CSS." 
    126 msgstr "" 
    127  
    128 #: load-staffer.php:87 
    129 msgid "Use custom wrappers" 
    130 msgstr "" 
    131  
    132 #: load-staffer.php:89 
    133 msgid "" 
    134 "Check this box and enter your wrappers below to use custom content wrappers. " 
    135 "See the documentation for details. You may need to use custom wrappers if " 
    136 "Staffer pages do not flow well with your theme." 
    137 msgstr "" 
    138  
    139 #: load-staffer.php:92 
    140 msgid "Custom start wrapper" 
    141 msgstr "" 
    142  
    143 #: load-staffer.php:94 
    144 msgid "Enter your custom start wrapper." 
    145 msgstr "" 
    146  
    147 #: load-staffer.php:97 
    148 msgid "Custom end wrapper" 
    149 msgstr "" 
    150  
    151 #: load-staffer.php:99 
    152 msgid "" 
    153 "Enter your custom ending wrapper. This should close out the wrapper started " 
    154 "above." 
    155 msgstr "" 
    156  
    157 #: load-staffer.php:102 
    158 msgid "Custom CSS" 
    159 msgstr "" 
    160  
    161 #: load-staffer.php:105 
    162 msgid "Input your custom style rules here." 
    163 msgstr "" 
    164  
    165 #: load-staffer.php:110 
     97#: admin/class-staffer-admin.php:310 
    16698msgid "Save Changes" 
    16799msgstr "" 
    168100 
    169 #: load-staffer.php:168 
     101#: admin/class-staffer-admin.php:314 
     102msgid "" 
     103"Thank you for using Staffer. A lot of time went into development. Donations " 
     104"small or large are always appreciated." 
     105msgstr "" 
     106 
     107#: includes/class-staffer.php:228 includes/class-staffer.php:237 
     108msgid "Staff" 
     109msgstr "" 
     110 
     111#: includes/class-staffer.php:236 
     112msgid "staff" 
     113msgstr "" 
     114 
     115#: public/class-staffer-public.php:88 
     116msgid "Profile" 
     117msgstr "" 
     118 
     119#: public/class-staffer-public.php:89 
     120msgid "Add New Profile" 
     121msgstr "" 
     122 
     123#: public/class-staffer-public.php:90 
     124msgid "Edit Profile" 
     125msgstr "" 
     126 
     127#: public/class-staffer-public.php:91 
     128msgid "New Profile" 
     129msgstr "" 
     130 
     131#: public/class-staffer-public.php:92 
     132msgid "All Profiles" 
     133msgstr "" 
     134 
     135#: public/class-staffer-public.php:93 
     136msgid "View Profile" 
     137msgstr "" 
     138 
     139#: public/class-staffer-public.php:94 
     140msgid "Search Profiles" 
     141msgstr "" 
     142 
     143#: public/class-staffer-public.php:95 public/class-staffer-public.php:96 
     144msgid "Nothing Found" 
     145msgstr "" 
     146 
     147#: public/class-staffer-public.php:134 
    170148msgid "Departments" 
    171149msgstr "" 
    172150 
    173 #: load-staffer.php:197 
    174 msgid "Staff Member" 
     151#. Description of the plugin/theme 
     152msgid "Staff profile management for WordPress" 
    175153msgstr "" 
    176  
    177 #: load-staffer.php:198 
    178 msgid "Add New Staff Member" 
    179 msgstr "" 
    180  
    181 #: load-staffer.php:236 
    182 msgid "Staff Member Details" 
    183 msgstr "" 
    184  
    185 #: load-staffer.php:376 
    186 msgid "View Staff Page" 
    187 msgstr "" 
  • staffer/trunk/load-staffer.php

    r1085275 r1733627  
    11<?php 
    2 /* 
    3     Plugin Name: Staffer 
    4     Plugin URI: https://www.edwardrjenkins.com/wordpress-plugins/staffer/ 
    5     Description: A WordPress plugin that adds staff management and custom staff profile pages. 
    6     Author: Edward R. Jenkins 
    7     Version: 1.3.3 
    8     Author URI: https://www.edwardrjenkins.com/ 
    9     Text Domain: staffer 
    10     Domain Path: /languages 
     2 
     3/** 
     4 * The plugin bootstrap file 
     5 * 
     6 * This file is read by WordPress to generate the plugin information in the plugin 
     7 * admin area. This file also includes all of the dependencies used by the plugin, 
     8 * registers the activation and deactivation functions, and defines a function 
     9 * that starts the plugin. 
     10 * 
     11 * @link              https://codewrangler.io 
     12 * @since             2.0.0 
     13 * @package           Staffer 
     14 * 
     15 * @wordpress-plugin 
     16 * Plugin Name:       Staffer 
     17 * Plugin URI:        https://wordpress.org/plugins/staffer/ 
     18 * Description:       Staff profile management for WordPress 
     19 * Version:           2.0.0 
     20 * Author:            codeWrangler, Inc. 
     21 * Author URI:        https://codewrangler.io 
     22 * License:           GPL-2.0+ 
     23 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt 
     24 * Text Domain:       staffer 
     25 * Domain Path:       /languages 
    1126 */ 
    1227 
    13 // loads language pack 
    14 function staffer_load_textdomain() { 
    15   load_plugin_textdomain( 'staffer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );  
    16 } 
    17 add_action( 'init', 'staffer_load_textdomain' ); 
    18  
    19 // staffer init 
    20 function staffer_init(){ 
    21     if (delete_transient('staffer_flush_rules')) { 
    22          flush_rewrite_rules(); 
    23         } 
    24     register_setting( 'staffer_options', 'staffer', 'staffer_validate' ); 
    25 } 
    26 add_action('admin_init', 'staffer_init' ); 
    27  
    28 // adds menu page 
    29 function staffer_add_page() { 
    30     add_options_page('Staffer Options', 'Staffer Options', 'manage_options', 'staffer', 'staffer_do_page'); 
    31 } 
    32 add_action('admin_menu', 'staffer_add_page'); 
    33  
    34 // writes the menu page 
    35 function staffer_do_page() { 
    36     $supportsite = 'https://www.edwardrjenkins.com'; 
    37         echo '<h4>'; 
    38         _e('For paid support or customizations, please contact me at', 'staffer' ); 
    39         echo ' <a href="'.$supportsite.'" target="_blank">edwardrjenkins.com</a>'; 
    40         echo '</h4>'; 
    41         ?> 
    42         <div class="wrap"> 
    43             <h2><?php _e ('Staffer Options Panel', 'staffer'); ?></h2> 
    44             <form method="post" action="options.php"> 
    45                 <?php settings_fields('staffer_options'); ?> 
    46                 <?php $stafferoptions = get_option('staffer'); ?> 
    47                 <table class="form-table"> 
    48                     <tr valign="top"><th scope="row"><?php _e ('Staff Layout', 'staffer'); ?></th> 
    49                     <td><input name="staffer[gridlayout]" type="checkbox" value="1" <?php checked(true, $stafferoptions['gridlayout']); ?> /> 
    50                         <p class="description"><?php _e('Check this to use the staff grid layout.', 'staffer'); ?></p> 
    51                     </td> 
    52                     </tr> 
    53  
    54                     <tr valign="top"><th scope="row"><?php _e ('Manual Mode', 'staffer'); ?></th> 
    55                     <td><input name="staffer[manual_mode]" type="checkbox" value="1" <?php checked(true, $stafferoptions['manual_mode']); ?> /> 
    56                         <p class="description"><?php _e('Check to disable the main Staffer archive page. Useful if you want to solely use shortcodes to display lists of staff members. For more information on shortcodes, please read the <a href="https://www.edwardrjenkins.com/wordpress-plugins/staffer/">Staffer documentation</a>.', 'staffer'); ?></p> 
    57                     </td> 
    58                     </tr> 
    59  
    60                     <tr valign="top"><th scope="row"><?php _e ('Excerpt Style', 'staffer'); ?></th> 
    61                     <td> 
    62                     <?php $staffer_estyle = $stafferoptions['estyle']; ?> 
    63                     <select name="staffer[estyle]"> 
    64                         <option value="excerpt" <?php if ($staffer_estyle == "excerpt") echo ('selected="selected"'); ?> ><?php _e ('Excerpt', 'staffer' ); ?></option> 
    65                         <option value="full" <?php if ($staffer_estyle == "full") echo ('selected="selected"'); ?> ><?php _e ('Full', 'staffer' ); ?></option> 
    66                         <option value="none" <?php if ($staffer_estyle == "none") echo ('selected="selected"'); ?> ><?php _e ('Disabled', 'staffer' ); ?></option> 
    67                     </select> 
    68                         <p class="description"><?php _e('Choose your staff listing excerpt style.', 'staffer'); ?></p> 
    69                     </td> 
    70                     </tr> 
    71  
    72                     <tr valign="top"><th scope="row"><?php _e ('Staffer Main Page Description', 'staffer'); ?></th> 
    73                     <td> 
    74                     <?php  
    75                         $text =  $stafferoptions['sdesc']; 
    76                         wp_editor( $text, 'sdesc', array( 'textarea_name' => 'sdesc', 'media_buttons' => true, 'textarea_rows' => '10' ) ); ?> 
    77                         <p class="description"><?php _e('Add a description for the Staffer directory, which will appear below the main directory title.', 'staffer'); ?></p> 
    78                     </td> 
    79                     </tr> 
    80                     <tr valign="top"><th scope="row"><?php _e ('Listings per page', 'staffer'); ?></th> 
    81                     <td><input type="number" size="80" max="99" name="staffer[perpage]" value='<?php echo $stafferoptions['perpage']; ?>' /> 
    82                         <p class="description"><?php _e('Set the number of staff members per page. Leave blank to inherit the Settings->Reading.', 'staffer'); ?></p> 
    83                     </td> 
    84                     </tr> 
    85                     <tr valign="top"><th scope="row"><?php _e ('Staffer Page Title', 'staffer'); ?></th> 
    86                     <td><input type="text" size="80" name="staffer[ptitle]" value='<?php echo $stafferoptions['ptitle']; ?>' /> 
    87                         <p class="description"><?php _e('Set a custom Staffer page title, if desired. The default title is <code>Staff</code>. This title will be used as the archive page title and within breadcrumbs. Leave blank to use the default.', 'staffer'); ?></p> 
    88                     </td> 
    89                     </tr> 
    90                     <tr valign="top"><th scope="row"><?php _e ('Staffer Label', 'staffer'); ?></th> 
    91                     <td><input type="text" size="80" name="staffer[label]" value='<?php if ( isset ($stafferoptions['label'] ) ) { echo $stafferoptions['label']; } ?>' /> 
    92                         <p class="description"><?php _e('Set a custom label, if desired. This is shown in the admin panel and is used in the <code>title</code> tag. The default label is <code>Staff</code>. Leave blank to use the default.', 'staffer'); ?></p> 
    93                     </td> 
    94                     </tr>                
    95                     <tr valign="top"><th scope="row"><?php _e ('Staffer URL slug', 'staffer'); ?></th> 
    96                     <td><input type="text" size="80" name="staffer[slug]" value='<?php echo $stafferoptions['slug']; ?>' /> 
    97                         <p class="description"><?php _e('Set a custom URL slug, if desired. The default slug is <code>staff</code>.<strong>Notice:</strong> Use lowercase only, and use no spaces, i.e., instead of using <code>Staff Pages</code>, use <code>staff-pages</code>. Leave blank to use the default.', 'staffer'); ?></p> 
    98                     </td> 
    99                     </tr> 
    100                     <tr valign="top"><th scope="row"><?php _e ('Disable CSS', 'staffer'); ?></th> 
    101                     <td><input name="staffer[disablecss]" type="checkbox" value="1" <?php checked(true, $stafferoptions['disablecss']); ?> /> 
    102                         <p class="description"><?php _e('Check this box to disable all Staffer CSS.', 'staffer'); ?></p> 
    103                     </td> 
    104                     </tr> 
    105                     <tr valign="top"><th scope="row"><?php _e ('Use custom wrappers', 'staffer'); ?></th> 
    106                     <td><input name="staffer[customwrapper]" type="checkbox" value="1" <?php checked(true, $stafferoptions['customwrapper']); ?> /> 
    107                         <p class="description"><?php _e('Check this box and enter your wrappers below to use custom content wrappers. See the documentation for details. You may need to use custom wrappers if Staffer pages do not flow well with your theme.', 'staffer'); ?></p> 
    108                     </td> 
    109                     </tr> 
    110                     <tr valign="top"><th scope="row"><?php _e ('Custom start wrapper', 'staffer'); ?></th> 
    111                     <td><input type="text" size="80" name="staffer[startwrapper]" value='<?php echo $stafferoptions['startwrapper']; ?>' /> 
    112                         <p class="description"><?php _e('Enter your custom start wrapper.', 'staffer'); ?></p> 
    113                     </td> 
    114                     </tr> 
    115                     <tr valign="top"><th scope="row"><?php _e ('Custom end wrapper', 'staffer'); ?></th> 
    116                     <td><input type="text" size="80" name="staffer[endwrapper]" value='<?php echo $stafferoptions['endwrapper']; ?>' /> 
    117                         <p class="description"><?php _e('Enter your custom ending wrapper. This should close out the wrapper started above.', 'staffer'); ?></p> 
    118                     </td> 
    119                     </tr> 
    120                     <tr valign="top"><th scope="row"><?php _e ('Custom CSS'); ?></th> 
    121                     <td> 
    122                     <textarea rows="20" class="large-text" type="text" name="staffer[customcss]" cols="50" rows="10" /><?php echo $stafferoptions['customcss']; ?></textarea> 
    123                     <p class="description"><?php _e('Input your custom style rules here.', 'staffer'); ?></p> 
    124                     </td> 
    125                     </tr> 
    126                 </table> 
    127                 <p class="submit"> 
    128                 <input type="submit" class="button-primary" value="<?php _e('Save Changes', 'staffer') ?>" /> 
    129                 </p> 
    130             </form> 
    131  
    132             <?php esc_attr_e('Thank you for using Staffer. A lot of time went into development. Donations small or large are always appreciated.' , 'staffer'); ?></p> 
    133             <form action="https://www.paypal.com/cgi-bin/webscr" target="_blank" method="post"> 
    134                 <input type="hidden" name="cmd" value="_s-xclick"> 
    135                 <input type="hidden" name="hosted_button_id" value="QD8ECU2CY3N8J"> 
    136                 <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> 
    137                 <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> 
    138             </form> 
    139         </div> 
    140     <?php    
    141     } 
    142  
    143 // sanitize and validate input 
    144 function staffer_validate($input) { 
    145     // Our first value is either 0 or 1 
    146     if ( ! isset( $input['disablecss'] ) ) 
    147     $input['disablecss'] = null; 
    148     if ( ! isset( $input['label'] ) ) 
    149     $input['label'] = 'Staff'; 
    150     if ( ! isset ($input['customwrapper']) ) 
    151     $input['customwrapper'] = null; 
    152     if ( ! isset ($input['gridlayout']) ) 
    153     $input['gridlayout'] = null; 
    154     if ( ! isset ($input['manual_mode'] ) ) 
    155     $input['manual_mode'] = null; 
    156     if ( ! isset ($input['estyle']) ) 
    157     $input['estyle'] = 'excerpt'; 
    158     // Say our second option must be safe text with no HTML tags 
    159     $input['perpage'] =  esc_html( $input['perpage'] ); 
    160     //if ( ! isset ($input['slug'] ) ) { 
    161     $input['slug'] = sanitize_title_with_dashes ($input['slug']); 
    162     $input['ptitle'] = ucfirst ($input['ptitle']); 
    163     $input['label'] = ucfirst ($input['label']); 
    164     $input['sdesc'] = stripslashes ( $_POST['sdesc'] ); 
    165     //} else { 
    166     //$input['slug'] = 'staff'; 
    167     //} 
    168     $input['startwrapper'] =  wp_kses_post( $input['startwrapper'] ); 
    169     $input['endwrapper'] =  wp_kses_post ( $input['endwrapper'] ); 
    170     $input['customcss'] = wp_kses_post ( $input['customcss'] ); 
    171     // in case of slug change 
    172     set_transient('staffer_flush_rules', true); 
    173         return $input; 
     28// If this file is called directly, abort. 
     29if ( ! defined( 'WPINC' ) ) { 
     30    die; 
    17431} 
    17532 
    176 // sets up the taxonomy 
    177 function staffer_taxonomy () { 
    178     $stafferoptions = get_option ('staffer'); 
    179     if ( $stafferoptions['slug'] == '' ) { 
    180         $stafferslug = 'staff'; 
    181     } else { 
    182         $stafferslug = $stafferoptions['slug']; 
    183     } 
    184     $taxslug = $stafferslug . '/department'; 
    185  
    186     register_taxonomy( 
    187         'department', 
    188         'staff', 
    189         array( 
    190             'hierarchical' => true, 
    191             'label' => __( 'Departments' ), 
    192             'rewrite' => array( 'slug' => $taxslug, 'hierarchical' => true), 
    193             'query_var'    => 'department', 
    194             'public' => true, 
    195         ) 
    196     ); 
    197     } 
    198 add_action ('init', 'staffer_taxonomy'); 
    199  
    200 // custom post type for staff 
    201 function create_staff_cpt_staffer() { 
    202     $stafferoptions = get_option ('staffer'); 
    203     $stafferslug = $stafferoptions['slug']; 
    204     // fixes title tag issue and adds label option 
    205     if ( !empty ($stafferoptions['label'] ) ) { 
    206     $stafferlabel = $stafferoptions['label']; 
    207     } else { 
    208     $stafferlabel = 'Staff'; 
    209     } 
    210     $rewrite = array( 
    211     'slug'                => $stafferslug, 
    212     'with_front'          => true, 
    213     'pages'               => true, 
    214     'feeds'               => true, 
    215     ); 
    216  
    217     if ( isset( $stafferoptions['manual_mode'] ) ) { 
    218         $archive = false; 
    219     } else { 
    220         $archive = true; 
    221     } 
    222     register_post_type('staff', array( 
    223         'labels' => array( 
    224         'name' => $stafferlabel, 
    225         // future release 'taxonomy' => 'department', 
    226         'singular_name' => __('Staff Member'), 
    227         'add_new_item' => __('Add New Staff Member'), 
    228         'edit_item' => 'Edit Staff Member', 
    229         'new_item' => 'New Staff Member', 
    230         'all_items' => 'All Staff Members', 
    231         'view_item' => 'View Staff Member', 
    232         'search_items' => 'Search Staff Members', 
    233         'not_found' => 'No Staff Members Found', 
    234         'not_found_in_trash' => 'No Staff Members in Trash', 
    235         ), 
    236         'public' => true, 
    237         'has_archive' => $archive, 
    238         'show_in_menu' => true, 
    239         'menu_order' => '4', 
    240         'rewrite' => $rewrite, 
    241         'menu_icon' => 'dashicons-id', 
    242         'supports' => array( 
    243             'title', 
    244             'editor', 
    245             'revisions', 
    246             'custom-fields', 
    247             'thumbnail', 
    248             'excerpt' 
    249             ) 
    250             )); 
    251             } 
    252 add_action ('init', 'create_staff_cpt_staffer' ); 
    253  
    254 // adds meta box to member post types 
    255 function staffer_staff_meta_box() { 
    256                 $post_types = array( 
    257                     'staff', 
    258                 ); 
    259                 foreach ($post_types as $post_type) { 
    260                                 add_meta_box('staffer_details', __('Staff Member Details', 'staffer'), 'staffer_staff_role_box', $post_type, 'side', 'high', $post_types); 
    261                         } 
    262         } 
    263 add_action('add_meta_boxes', 'staffer_staff_meta_box', 0); 
    264  
    265 // prints the staffer post type boxes 
    266 function staffer_staff_role_box($post) { 
    267     // Use nonce for verification 
    268     wp_nonce_field(plugin_basename(__FILE__), 'cpt_noncename'); 
    269     // Use get_post_meta to retrieve an existing value from the database and use the value for the form 
    270     $value = get_post_meta($post->ID, 'staffer_staff_title', true); 
    271     echo '<label for="staffer_staff_title"><strong>Title</strong></label>'; 
    272     echo '<input id="staffer_staff_title" name="staffer_staff_title" size="28" value="' . esc_attr($value) . '"><br>'; 
    273     $value = get_post_meta($post->ID, 'staffer_staff_fb', true); 
    274     echo '<label for="staffer_staff_fb"><strong>Facebook</strong></label>'; 
    275     echo '<input id="staffer_staff_fb" name="staffer_staff_fb" size="28" value="' . esc_attr($value) . '"><br>'; 
    276     $value = get_post_meta($post->ID, 'staffer_staff_gplus', true); 
    277     echo '<label for="staffer_staff_gplus"><strong>Google+</strong></label>'; 
    278     echo '<input id="staffer_staff_gplus" name="staffer_staff_gplus" size="28" value="' . esc_attr($value) . '"><br>'; 
    279     $value = get_post_meta($post->ID, 'staffer_staff_twitter', true); 
    280     echo '<label for="staffer_staff_twitter"><strong>Twitter</strong></label>'; 
    281     echo '<input id="staffer_staff_twitter" name="staffer_staff_twitter" size="28" value="' . esc_attr($value) . '"><br>'; 
    282     $value = get_post_meta($post->ID, 'staffer_staff_linkedin', true); 
    283     echo '<label for="staffer_staff_linkedin"><strong>LinkedIn</strong></label>'; 
    284     echo '<input id="staffer_staff_linkedin" name="staffer_staff_linkedin" size="28" value="' . esc_attr($value) . '"><br>'; 
    285     $value = get_post_meta($post->ID, 'staffer_staff_website', true); 
    286     echo '<label for="staffer_staff_website"><strong>Website</strong></label>'; 
    287     echo '<input id="staffer_staff_website" name="staffer_staff_website" size="28" value="' . esc_attr($value) . '"><br>'; 
    288     $value = get_post_meta($post->ID, 'staffer_staff_email', true); 
    289     echo '<label for="staffer_staff_email"><strong>Email</strong></label>'; 
    290     echo '<input id="staffer_staff_email" name="staffer_staff_email" size="28" value="' . esc_attr($value) . '"><br>'; 
    291     $value = get_post_meta($post->ID, 'staffer_staff_phone', true); 
    292     echo '<label for="staffer_staff_phone"><strong>Phone Number</strong></label>'; 
    293     echo '<input id="staffer_staff_phone" name="staffer_staff_phone" size="28" value="' . esc_attr($value) . '"><br>'; 
    294         } 
    295 // saves the staffer post type details 
    296 function staffer_staff_save_postdata($post_id) { 
    297     if (!current_user_can('edit_page', $post_id)) { 
    298                     return; 
    299             } 
    300     else { 
    301                     if (!current_user_can('edit_post', $post_id)) 
    302                                     return; 
    303             } 
    304     if (!isset($_POST['cpt_noncename']) || !wp_verify_nonce($_POST['cpt_noncename'], plugin_basename(__FILE__))) 
    305                     return; 
    306     // get ID and save data 
    307     $post_ID      = $_POST['post_ID']; 
    308     //sanitize user input 
    309     $title = ($_POST['staffer_staff_title']); 
    310     $fb = ($_POST['staffer_staff_fb']); 
    311     $gplus = ($_POST['staffer_staff_gplus']); 
    312     $twitter = ($_POST['staffer_staff_twitter']); 
    313     $linkedin = ($_POST['staffer_staff_linkedin']); 
    314     $website = ($_POST['staffer_staff_website']); 
    315     $email = ($_POST['staffer_staff_email']); 
    316     $phone = ($_POST['staffer_staff_phone']); 
    317     update_post_meta($post_ID, 'staffer_staff_title', $title); 
    318     update_post_meta($post_ID, 'staffer_staff_fb', $fb); 
    319     update_post_meta($post_ID, 'staffer_staff_gplus', $gplus); 
    320     update_post_meta($post_ID, 'staffer_staff_twitter', $twitter); 
    321     update_post_meta($post_ID, 'staffer_staff_linkedin', $linkedin); 
    322     update_post_meta($post_ID, 'staffer_staff_website', $website); 
    323     update_post_meta($post_ID, 'staffer_staff_email', $email); 
    324     update_post_meta($post_ID, 'staffer_staff_phone', $phone); 
    325 } 
    326 add_action('save_post_staff', 'staffer_staff_save_postdata'); 
    327  
    328 // sets template override for custom template use 
    329 function staffer_staff_templates( $template ) { 
    330     $post_types = array( 'staff' ); 
    331     $staff_tax = 'department'; 
    332     if ( is_post_type_archive( $post_types ) && ! file_exists( get_stylesheet_directory() . '/archive-staff.php' ) ) { 
    333         $template = plugin_dir_path (__FILE__) . 'archive-staff.php'; 
    334     } 
    335     if ( is_singular( $post_types ) && ! file_exists( get_stylesheet_directory() . '/single-staff.php' ) ) { 
    336         $template = plugin_dir_path (__FILE__) . 'single-staff.php'; 
    337     } 
    338  
    339     $staffer_options = get_option ('staffer'); 
    340  
    341     if ( !isset ( $staffer_options['manual_mode'] ) ) { 
    342         if ( is_tax( $staff_tax ) && ! file_exists( get_stylesheet_directory() . '/taxonomy-staffer-department.php' ) ) { 
    343             $template = plugin_dir_path (__FILE__) . 'taxonomy-staffer-department.php'; 
    344         } 
    345     } 
    346     return $template; 
    347 } 
    348 add_filter( 'template_include', 'staffer_staff_templates' ); 
    349  
    350 // loads the default css 
    351 function staffer_load_css() { 
    352     wp_register_style ('staffer-style', plugins_url( 'styles/staffer-styles.css', __FILE__) ); 
    353     wp_register_style ('staffer-font-awesome', plugins_url( 'styles/font-awesome.min.css', __FILE__) ); 
    354     $stafferoptions = get_option('staffer'); 
    355     if ($stafferoptions['disablecss'] != '1') { 
    356     wp_enqueue_style ('staffer-style'); 
    357     } 
    358     wp_enqueue_style ('staffer-font-awesome'); 
    359     } 
    360 add_action ('wp_enqueue_scripts','staffer_load_css'); 
    361  
    362 // loads up any custom css 
    363 function staffer_custom_styles() { 
    364     $stafferoptions = get_option ('staffer'); 
    365         if ($stafferoptions['customcss'] != '' ) { 
    366             $staffercustomcss = $stafferoptions['customcss']; 
    367             print ( '<!-- Staffer Custom CSS --><style>' . $staffercustomcss . '</style>'); 
    368                         } 
    369                         } 
    370 add_action ('wp_head', 'staffer_custom_styles' ); 
    371  
    372 // flush rewrite rules on activation and deactivation 
    373 function staffer_activate() { 
    374     create_staff_cpt_staffer(); 
    375     // flush rewrite rules to prevent 404s 
    376     flush_rewrite_rules(); 
    377 } 
    378 register_activation_hook( __FILE__, 'staffer_activate' ); 
    379  
    380 function staffer_deactivate() { 
    381     flush_rewrite_rules(); 
    382 } 
    383 register_deactivation_hook( __FILE__, 'staffer_deactivate' ); 
    384  
    385 //enables thumbnail support if the theme does not 
    386 function staffer_thumbnail_check() { 
    387     if ( ! current_theme_supports ('post-thumbnails') ) { 
    388         add_theme_support ('post-thumbnails' ); 
    389         } 
    390         } 
    391 add_action ('after_setup_theme', 'staffer_thumbnail_check' ); 
    392   
    393 // adds link to main staff archive 
    394 // too many people confused about accessing the page 
    395 function staffer_admin_menu() { 
    396     $stafferoptions = get_option ('staffer'); 
    397     if ( ! isset( $stafferoptions['manual_mode'] ) ) { 
    398  
    399         global $submenu; 
    400         $url = home_url('/'); 
    401         $stafferoptions = get_option('staffer'); 
    402         if ( $stafferoptions['slug'] == '' ) { 
    403             $slug = 'staff'; 
    404         } else { 
    405             $slug = $stafferoptions['slug']; 
    406         } 
    407         if ( get_option ('permalink_structure') ) { 
    408         $url = $url . $slug; 
    409         } else { 
    410             $url = $url . '?post_type=staff'; 
    411         } 
    412         $submenu['edit.php?post_type=staff'][] = array(__('View Staff Page', 'staffer'), 'manage_options', $url); 
    413  
    414     } else { 
    415         // nah 
    416     } 
    417 } 
    418 add_action('admin_menu', 'staffer_admin_menu'); 
    419  
    420 // pre get posts allows modification of posts per page without affecting non-staffer pages 
    421 function staffer_per_page_mod($query) { 
    422     $stafferoptions = get_option ('staffer'); 
    423     $perpage = $stafferoptions['perpage']; 
    424     $post_type = 'staff'; 
    425     $taxonomy = 'department'; 
    426         if ( $query->is_main_query() && !is_admin() && is_post_type_archive( $post_type ) ) { 
    427                 $query->set( 'posts_per_page', $perpage ); 
    428             } elseif ( $query->is_main_query() && !is_admin() && is_tax ($taxonomy) ) { 
    429                 $query->set( 'posts_per_page', $perpage ); 
    430         } 
    431  
    432     } 
    433  
    434 $stafferoptions = get_option ('staffer'); 
    435 $perpage = $stafferoptions['perpage']; 
    436  
    437 // if per page option is set, hooks into pre get posts 
    438 if ($perpage != '' ) { 
    439     add_action ('pre_get_posts', 'staffer_per_page_mod' ); 
     33/** 
     34 * The code that runs during plugin activation. 
     35 * This action is documented in includes/class-staffer-activator.php 
     36 */ 
     37function activate_staffer() { 
     38    require_once plugin_dir_path( __FILE__ ) . 'includes/class-staffer-activator.php'; 
     39    Staffer_Activator::activate(); 
    44040} 
    44141 
    442 // adds staff shortcode 
    443 function staffer_shortcode( $atts ) { 
    444     ob_start(); 
    445     extract( shortcode_atts( array ( 
    446         'order' => 'DESC', 
    447         'orderby' => 'date', 
    448         'number' => -1, 
    449         'department' => '', 
    450     ), $atts ) ); 
     42/** 
     43 * The code that runs during plugin deactivation. 
     44 * This action is documented in includes/class-staffer-deactivator.php 
     45 */ 
     46function deactivate_staffer() { 
     47    require_once plugin_dir_path( __FILE__ ) . 'includes/class-staffer-deactivator.php'; 
     48    Staffer_Deactivator::deactivate(); 
     49} 
    45150 
    452     if ( $department != '' ) {  
    453         $tax_query = array (  
    454             array ( 
    455                 'taxonomy'  => 'department', 
    456                 'field'     => 'slug', 
    457                 'terms'     => $department, 
    458                 ), 
    459             ); 
    460     } else { 
    461         $tax_query = null; 
    462     } 
    463     $args = array( 
    464         'post_type' => 'staff', 
    465         'order' => $order, 
    466         'orderby' => $orderby, 
    467         'posts_per_page' => $number, 
    468         'tax_query' => $tax_query, 
    469     ); 
    470     $staff_query = new WP_Query( $args ); 
    471     if ( $staff_query->have_posts() ) {  
    472         global $post; 
    473         $stafferoptions = get_option ( 'staffer' ); 
     51register_activation_hook( __FILE__, 'activate_staffer' ); 
     52register_deactivation_hook( __FILE__, 'deactivate_staffer' ); 
    47453 
    475     if (isset ($stafferoptions['gridlayout']) ) { ?> 
    476         <ul class="staffer-archive-grid"> 
    477             <?php } else { ?> 
    478                 <ul class="staffer-archive-list"> 
    479                 <?php } 
     54/** 
     55 * The core plugin class that is used to define internationalization, 
     56 * admin-specific hooks, and public-facing site hooks. 
     57 */ 
     58require plugin_dir_path( __FILE__ ) . 'includes/class-staffer.php'; 
    48059 
    481             while ( $staff_query->have_posts() ) : $staff_query->the_post(); ?> 
    482             <li> 
    483                 <header class="staffer-staff-header"> 
    484                 <h3 class="staffer-staff-title"><a href="<?php the_permalink(); ?>"> 
    485                     <?php echo the_title(); ?> 
    486                     </a> 
    487                 </h3> 
    488                 <?php 
    489                 if ( get_post_meta ($post->ID,'staffer_staff_title', true) != '' ) { 
    490                     echo '<em>'; 
    491                     echo get_post_meta ($post->ID,'staffer_staff_title', true) . '</em><br>'; 
    492                     } 
    493                     ?> 
    494                  
    495                 </header> 
    496                     <div class="staff-content"> 
    497                 <?php if (isset ($stafferoptions['gridlayout']) ) { ?> 
    498                     <?php the_post_thumbnail ( 'medium', array ('class' => 'aligncenter') ); ?> 
    499                         <?php } else { ?> 
    500                         <?php the_post_thumbnail ( 'medium', array ('class' => 'alignleft') ); ?> 
    501                         <?php } 
    502                         if ($stafferoptions['estyle'] == null or $stafferoptions['estyle'] == 'excerpt' ) { 
    503                             the_excerpt(); 
    504                         } elseif ($stafferoptions['estyle'] == 'full' ) { 
    505                             the_content(); 
    506                         } elseif ($stafferoptions['estyle'] == 'none' ) { 
    507                             // nothing to see here 
    508                         }  
    509                         ?> 
    510                     </div> 
    511                 </li> 
    512             <?php endwhile; 
    513             wp_reset_postdata(); ?> 
    514         </ul> 
    515     <?php $output = ob_get_clean(); 
    516     return $output; 
    517     }    
     60/** 
     61 * Begins execution of the plugin. 
     62 * 
     63 * Since everything within the plugin is registered via hooks, 
     64 * then kicking off the plugin from this point in the file does 
     65 * not affect the page life cycle. 
     66 * 
     67 * @since    1.0.0 
     68 */ 
     69function run_staffer() { 
     70 
     71    $plugin = new Staffer(); 
     72    $plugin->run(); 
     73 
    51874} 
    519 add_shortcode( 'staffer', 'staffer_shortcode' ); 
     75run_staffer(); 
Note: See TracChangeset for help on using the changeset viewer.