Plugin Directory

Changeset 3329963


Ignore:
Timestamp:
07/18/2025 12:04:35 AM (8 months ago)
Author:
nomadcoder
Message:

4.40

Fix for reported patchstack security issue
Fix empty settings issue

Location:
guest-author-name/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • guest-author-name/trunk/readme.txt

    r3192715 r3329963  
    44Tags: Guest Author Name, Override Author Name, Author
    55Requires at least: 4.1
    6 Tested up to: 6.7
    7 Stable Tag: 6.7
     6Tested up to: 6.8
     7Stable Tag: 4.40
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414== Description ==
    15 Version 4.36
     15Version 4.40
    1616
    1717Free
     
    1121123. Settings Page
    113113== Changelog ==
     114= 4.40 =
     115Fix for reported patchstack security issue
     116Fix empty settings issue
    114117= 4.36 =
    115118Declare $comment_list
  • guest-author-name/trunk/sfly-guest-author-settings.php

    r2793149 r3329963  
    11<?php
    2     if ( !class_exists( 'guest_author_settings' ) ) {
     2if (!class_exists('guest_author_settings')) {
    33    /**
    44     * guest_author_admin_menu class.
    55     */
    6         class guest_author_settings
    7         {
    8             function __construct()
    9             {
    10 
    11                 add_action( 'admin_menu', array( $this, 'guest_author_name_add_admin_menu' ) );
    12                 add_action( 'admin_init', array( $this, 'guest_author_name_settings_init' ) );
     6    class guest_author_settings
     7    {
     8
     9        function __construct()
     10        {
     11
     12            add_action('admin_menu', array($this, 'guest_author_name_add_admin_menu'));
     13            add_action('admin_init', array($this, 'guest_author_name_settings_init'));
     14
     15        }
     16
     17        /**
     18         * guest_author_name_add_admin_menu function.
     19         *
     20         * @access public
     21         * @return void
     22         */
     23        function guest_author_name_add_admin_menu()
     24        {
     25
     26            add_options_page('Guest Author Name', 'Guest Author Name', 'manage_options', 'guest_author_name', array($this, 'guest_author_name_options_page'));
     27
     28        }
     29
     30
     31        /**
     32         * guest_author_name_settings_init function.
     33         *
     34         * @access public
     35         * @return void
     36         */
     37        function guest_author_name_settings_init()
     38        {
     39
     40            register_setting('guest_author_pluginPage', 'guest_author_name_settings');
     41
     42            add_settings_section(
     43                'guest_author_name_pluginPage_section',
     44                '',
     45                array($this, 'guest_author_name_settings_section_callback'),
     46                'guest_author_pluginPage'
     47            );
     48
     49            add_settings_field(
     50                'guest_author_name_quickedit',
     51                __('Enable Quick Edit for Guest Author Name', 'guest-author-name'),
     52                array($this, 'guest_author_name_quickedit_render'),
     53                'guest_author_pluginPage',
     54                'guest_author_name_pluginPage_section'
     55            );
     56
     57            add_settings_field(
     58                'guest_author_name_admin',
     59                __('Display Guest Author in Author Column in Post list/admin', 'guest-author-name'),
     60                array($this, 'guest_author_name_admin'),
     61                'guest_author_pluginPage',
     62                'guest_author_name_pluginPage_section'
     63            );
     64            add_settings_field(
     65                'guest_author_allow_html',
     66                __('Allow html in guest author description', 'guest-author-name'),
     67                array($this, 'guest_author_allow_html'),
     68                'guest_author_pluginPage',
     69                'guest_author_name_pluginPage_section'
     70            );
     71            add_settings_field(
     72                'guest_author_include_guest',
     73                __('Exclude guest author posts in Author Archives (beta)', 'guest-author-name'),
     74                array($this, 'guest_author_include_guest'),
     75                'guest_author_pluginPage',
     76                'guest_author_name_pluginPage_section'
     77            );
     78            add_settings_field(
     79                'guest_author_disable_for_comments',
     80                __('Disable guest author for comments (beta)', 'guest-author-name'),
     81                array($this, 'guest_author_disable_for_comments'),
     82                'guest_author_pluginPage',
     83                'guest_author_name_pluginPage_section'
     84
     85            );
     86            add_settings_field(
     87                'guest_author_open_new_window',
     88                __('Open Guest Author link in new window (beta)', 'guest-author-name'),
     89                array($this, 'guest_author_open_new_window'),
     90                'guest_author_pluginPage',
     91                'guest_author_name_pluginPage_section'
     92
     93            );
     94            add_settings_field(
     95                'guest_author_remove_link',
     96                __('Remove hyperlink from guest author name  (beta)', 'guest-author-name'),
     97                array($this, 'guest_author_remove_link'),
     98                'guest_author_pluginPage',
     99                'guest_author_name_pluginPage_section'
     100
     101            );
     102
     103            add_settings_field(
     104                'guest_author_url_selector_single',
     105                __('CSS selector for the author on single posts', 'guest-author-name'),
     106                array($this, 'guest_author_url_selector_single'),
     107                'guest_author_pluginPage',
     108                'guest_author_name_pluginPage_section'
     109
     110            );
     111
     112            /*          add_settings_field(
     113                            'guest_author_url_selector_excerpt',
     114                            __( 'CSS selector for the author on archive/home page', 'guest-author-name' ),
     115                            array( $this, 'guest_author_url_selector_excerpt' ),
     116                            'guest_author_pluginPage',
     117                            'guest_author_name_pluginPage_section'
     118
     119                        )*/
     120        }
     121
     122
     123        /**
     124         * guest_author_name_quickedit_render function.
     125         *
     126         * @access public
     127         * @return void
     128         */
     129        function guest_author_name_quickedit_render()
     130        {
     131
     132            $options = get_option('guest_author_name_settings');
     133            $quickedit = isset($options['guest_author_name_quickedit']) ? true : false;
     134            ?>
     135            <input type='checkbox' name='guest_author_name_settings[guest_author_name_quickedit]' <?php checked($quickedit, 1); ?>
     136                value='1'>
     137            <?php
     138
     139        }
     140
     141        /* guest_author_name_admin function.
     142         *
     143         * @access public
     144         * @return void
     145         */
     146        function guest_author_name_admin()
     147        {
     148
     149            $options = get_option('guest_author_name_settings');
     150            $admin = isset($options['guest_author_name_admin']) ? true : false;
     151            ?>
     152            <input type='checkbox' name='guest_author_name_settings[guest_author_name_admin]' <?php checked($admin, 1); ?>
     153                value='1'>
     154            <?php
     155
     156        }
     157
     158        /* guest_author_allow_html function.
     159         *
     160         * @access public
     161         * @return void
     162         */
     163        function guest_author_allow_html()
     164        {
     165
     166            $options = get_option('guest_author_name_settings');
     167            $html = isset($options['guest_author_allow_html']) ? true : false;
     168            ?>
     169            <input type='checkbox' name='guest_author_name_settings[guest_author_allow_html]' <?php checked($html, 1); ?> value='1'>
     170            <?php
     171
     172        }
     173        /* guest_author_include_guest function.
     174         *
     175         * @access public
     176         * @return void
     177         */
     178        function guest_author_include_guest()
     179        {
     180
     181            $options = get_option('guest_author_name_settings');
     182            $include = isset($options['guest_author_include_guest']) ? true : false;
     183            ?>
     184            <input type='checkbox' name='guest_author_name_settings[guest_author_include_guest]' <?php checked($include, 1); ?>
     185                value='1'>
     186            <?php
     187
     188        }
     189
     190        /**
     191         * guest_author_disable_for_comments function.
     192         *
     193         * @access public
     194         * @return void
     195         */
     196        function guest_author_disable_for_comments()
     197        {
     198
     199            $options = get_option('guest_author_name_settings');
     200            $disable = isset($options['guest_author_disable_for_comments']) ? true : false;
     201            ?>
     202            <input type='checkbox' name='guest_author_name_settings[guest_author_disable_for_comments]' <?php checked($disable, 1); ?> value='1'>
     203            <br><label>Check this if the guest author name is displaying in the comments instead of the author name</label>
     204            <?php
     205
     206        }
     207
     208        /**
     209         * guest_author_open_new_window function.
     210         *
     211         * @access public
     212         * @return void
     213         */
     214        function guest_author_open_new_window()
     215        {
     216
     217            $options = get_option('guest_author_name_settings');
     218            $open = isset($options['guest_author_open_new_window']) ? true : false;
     219            ?>
     220            <input type='checkbox' name='guest_author_name_settings[guest_author_open_new_window]' <?php checked($open, 1); ?>
     221                value='1'>
     222            <br><label>The css selector must be entered below</label>
     223            <?php
     224
     225        }
     226        /**
     227         * guest_author_open_remove_link function.
     228         *
     229         * @access public
     230         * @return void
     231         */
     232        function guest_author_remove_link()
     233        {
     234
     235            $options = get_option('guest_author_name_settings');
     236            $open = isset($options['guest_author_remove_link']) ? true : false;
     237            ?>
     238            <input type='checkbox' name='guest_author_name_settings[guest_author_remove_link]' <?php checked($open, 1); ?>
     239                value='1'>
     240            <br><label>The css selector must be entered below</label>
     241            <?php
     242
     243        }
     244        function guest_author_url_selector_single()
     245        {
     246            $options = get_option('guest_author_name_settings');
     247            if (isset($options['guest_author_url_selector_single'])) {
     248                $selector = esc_attr($options['guest_author_url_selector_single']);
     249            } else {
     250                $selector = "";
    13251            }
    14 
    15             /**
    16              * guest_author_name_add_admin_menu function.
    17              *
    18              * @access public
    19              * @return void
    20              */
    21             function guest_author_name_add_admin_menu(  ) {
    22 
    23                 add_options_page( 'Guest Author Name', 'Guest Author Name', 'manage_options', 'guest_author_name', array( $this,  'guest_author_name_options_page' ) );
    24 
    25             }
    26 
    27 
    28             /**
    29              * guest_author_name_settings_init function.
    30              *
    31              * @access public
    32              * @return void
    33              */
    34             function guest_author_name_settings_init(  ) {
    35 
    36                 register_setting( 'guest_author_pluginPage', 'guest_author_name_settings' );
    37 
    38                 add_settings_section(
    39                     'guest_author_name_pluginPage_section',
    40                     '',
    41                     array( $this, 'guest_author_name_settings_section_callback' ),
    42                     'guest_author_pluginPage' );
    43 
    44                 add_settings_field(
    45                     'guest_author_name_quickedit',
    46                     __( 'Enable Quick Edit for Guest Author Name', 'guest-author-name' ),
    47                     array( $this, 'guest_author_name_quickedit_render' ),
    48                     'guest_author_pluginPage',
    49                     'guest_author_name_pluginPage_section'
    50                 );
    51 
    52                 add_settings_field(
    53                     'guest_author_name_admin',
    54                     __( 'Display Guest Author in Author Column in Post list/admin', 'guest-author-name' ),
    55                     array( $this, 'guest_author_name_admin' ),
    56                     'guest_author_pluginPage',
    57                     'guest_author_name_pluginPage_section'
    58                 );
    59                 add_settings_field(
    60                     'guest_author_allow_html',
    61                     __( 'Allow html in guest author description', 'guest-author-name' ),
    62                     array( $this, 'guest_author_allow_html' ),
    63                     'guest_author_pluginPage',
    64                     'guest_author_name_pluginPage_section'
    65                 );
    66                 add_settings_field(
    67                     'guest_author_include_guest',
    68                     __( 'Exclude guest author posts in Author Archives (beta)', 'guest-author-name' ),
    69                     array( $this, 'guest_author_include_guest' ),
    70                     'guest_author_pluginPage',
    71                     'guest_author_name_pluginPage_section'
    72                 );
    73                 add_settings_field(
    74                     'guest_author_disable_for_comments',
    75                     __( 'Disable guest author for comments (beta)', 'guest-author-name' ),
    76                     array( $this, 'guest_author_disable_for_comments' ),
    77                     'guest_author_pluginPage',
    78                     'guest_author_name_pluginPage_section'
    79 
    80                 );
    81                 add_settings_field(
    82                     'guest_author_open_new_window',
    83                     __( 'Open Guest Author link in new window (beta)', 'guest-author-name' ),
    84                     array( $this, 'guest_author_open_new_window' ),
    85                     'guest_author_pluginPage',
    86                     'guest_author_name_pluginPage_section'
    87 
    88                 );
    89                 add_settings_field(
    90                     'guest_author_remove_link',
    91                     __( 'Remove hyperlink from guest author name  (beta)', 'guest-author-name' ),
    92                     array( $this, 'guest_author_remove_link' ),
    93                     'guest_author_pluginPage',
    94                     'guest_author_name_pluginPage_section'
    95 
    96                 );
    97 
    98                 add_settings_field(
    99                     'guest_author_url_selector_single',
    100                     __( 'CSS selector for the author on single posts', 'guest-author-name' ),
    101                     array( $this, 'guest_author_url_selector_single' ),
    102                     'guest_author_pluginPage',
    103                     'guest_author_name_pluginPage_section'
    104 
    105                 );
    106 
    107     /*          add_settings_field(
    108                     'guest_author_url_selector_excerpt',
    109                     __( 'CSS selector for the author on archive/home page', 'guest-author-name' ),
    110                     array( $this, 'guest_author_url_selector_excerpt' ),
    111                     'guest_author_pluginPage',
    112                     'guest_author_name_pluginPage_section'
    113 
    114                 )*/
    115             }
    116 
    117 
    118             /**
    119              * guest_author_name_quickedit_render function.
    120              *
    121              * @access public
    122              * @return void
    123              */
    124             function guest_author_name_quickedit_render(  ) {
    125 
    126                 $options = get_option( 'guest_author_name_settings' );
    127                 $quickedit = isset( $options['guest_author_name_quickedit'] ) ? true : false ;
    128         ?>
    129             <input type='checkbox' name='guest_author_name_settings[guest_author_name_quickedit]' <?php checked( $quickedit, 1 ); ?> value='1'>
    130             <?php
    131 
    132             }
    133 
    134              /* guest_author_name_admin function.
    135              *
    136              * @access public
    137              * @return void
    138              */
    139             function guest_author_name_admin(  ) {
    140 
    141                 $options = get_option( 'guest_author_name_settings' );
    142                 $admin = isset( $options['guest_author_name_admin'] ) ? true : false ;
    143         ?>
    144             <input type='checkbox' name='guest_author_name_settings[guest_author_name_admin]' <?php checked( $admin, 1 ); ?> value='1'>
    145             <?php
    146 
    147             }
    148 
    149             /* guest_author_allow_html function.
    150              *
    151              * @access public
    152              * @return void
    153              */
    154             function guest_author_allow_html(  ) {
    155 
    156                 $options = get_option( 'guest_author_name_settings' );
    157                 $html = isset( $options['guest_author_allow_html'] ) ? true : false ;
    158         ?>
    159             <input type='checkbox' name='guest_author_name_settings[guest_author_allow_html]' <?php checked( $html, 1 ); ?> value='1'>
    160             <?php
    161 
    162             }
    163             /* guest_author_include_guest function.
    164              *
    165              * @access public
    166              * @return void
    167              */
    168             function guest_author_include_guest(  ) {
    169 
    170                 $options = get_option( 'guest_author_name_settings' );
    171                 $include = isset( $options['guest_author_include_guest'] ) ? true : false ;
    172         ?>
    173             <input type='checkbox' name='guest_author_name_settings[guest_author_include_guest]' <?php checked( $include, 1 ); ?> value='1'>
    174             <?php
    175 
    176             }
    177 
    178             /**
    179              * guest_author_disable_for_comments function.
    180              *
    181              * @access public
    182              * @return void
    183              */
    184             function guest_author_disable_for_comments(  ) {
    185 
    186                 $options = get_option( 'guest_author_name_settings' );
    187                 $disable = isset( $options['guest_author_disable_for_comments'] ) ? true : false ;
    188         ?>
    189             <input type='checkbox' name='guest_author_name_settings[guest_author_disable_for_comments]' <?php checked( $disable, 1 ); ?> value='1'>
    190             <br><label>Check this if the guest author name is displaying in the comments instead of the author name</label>
    191             <?php
    192 
    193             }
    194 
    195             /**
    196              * guest_author_open_new_window function.
    197              *
    198              * @access public
    199              * @return void
    200              */
    201             function guest_author_open_new_window(  ) {
    202 
    203                 $options = get_option( 'guest_author_name_settings' );
    204                 $open = isset( $options['guest_author_open_new_window'] ) ? true : false ;
    205         ?>
    206             <input type='checkbox' name='guest_author_name_settings[guest_author_open_new_window]' <?php checked( $open, 1 ); ?> value='1'>
    207             <br><label>The css selector must be entered below</label>
    208             <?php
    209 
    210             }
    211     /**
    212              * guest_author_open_remove_link function.
    213              *
    214              * @access public
    215              * @return void
    216              */
    217             function guest_author_remove_link(  ) {
    218 
    219                 $options = get_option( 'guest_author_name_settings' );
    220                 $open = isset( $options['guest_author_remove_link'] ) ? true : false ;
    221         ?>
    222             <input type='checkbox' name='guest_author_name_settings[guest_author_remove_link]' <?php checked( $open, 1 ); ?> value='1'>
    223             <br><label>The css selector must be entered below</label>
    224             <?php
    225 
    226             }
    227             function guest_author_url_selector_single() {
    228                 $options = get_option( 'guest_author_name_settings' );
    229                 $selector = esc_attr(  $options['guest_author_url_selector_single'] ) ;
    230         ?>
     252            ?>
    231253            <input type='text' name='guest_author_name_settings[guest_author_url_selector_single]' value="<?php echo $selector; ?>">
    232             <br><label>In order  remove the author link or to open the author url in a new window, the css selector must be entered here</label><br><a href="https://www.plugins.shooflysolutions.com/guest-author-name/knowledge-base/enabling-advanced-author-features/ target="_blank">How do I?</a><?php
    233             }
    234             /* guest_author_user_role function.
    235             *
    236             * @access public
    237             * @return void
    238             */     
    239             function guest_author_user_role() {
    240                 $options = get_option( 'guest_author_name_settings ');
    241                 $selected = $options['guest_author_user_role'] ? esc_attr( $options['guest_author_user_role']) : 'author';
    242 
    243                 ?><select id="guest_author_user_role" name="guest_author_name_settings['guest_author_user_role']" >
    244 
    245                 <?php wp_dropdown_roles( $selected );?>
    246                 </select><?php
    247             }
    248             /**
    249              * guest_author_name_settings_section_callback function.
    250              *
    251              * @access public
    252              * @return void
    253              */
    254             function guest_author_name_settings_section_callback(  ) {
    255 
    256                 //echo __( 'This section description', 'guest-author-name' );
    257 
    258             }
    259 
    260 
    261             /**
    262              * guest_author_name_options_page function.
    263              *
    264              * @access public
    265              * @return void
    266              */
    267             function guest_author_name_options_page(  ) {
    268 
    269         ?>
     254            <br><label>In order remove the author link or to open the author url in a new window, the css selector must be entered
     255                here</label><br><a
     256                href="https://www.plugins.shooflysolutions.com/guest-author-name/knowledge-base/enabling-advanced-author-features/ target="
     257                _blank">How do I?</a><?php
     258        }
     259        /* guest_author_user_role function.
     260         *
     261         * @access public
     262         * @return void
     263         */
     264        function guest_author_user_role()
     265        {
     266            $options = get_option('guest_author_name_settings ');
     267            $selected = isset($options['guest_author_user_role']) ? esc_attr($options['guest_author_user_role']) : 'author';
     268
     269            ?><select id="guest_author_user_role" name="guest_author_name_settings['guest_author_user_role']">
     270
     271                <?php wp_dropdown_roles($selected); ?>
     272            </select><?php
     273        }
     274        /**
     275         * guest_author_name_settings_section_callback function.
     276         *
     277         * @access public
     278         * @return void
     279         */
     280        function guest_author_name_settings_section_callback()
     281        {
     282
     283            //echo __( 'This section description', 'guest-author-name' );
     284
     285        }
     286
     287
     288        /**
     289         * guest_author_name_options_page function.
     290         *
     291         * @access public
     292         * @return void
     293         */
     294        function guest_author_name_options_page()
     295        {
     296
     297            ?>
    270298            <form action='options.php' method='post'>
    271299
     
    273301
    274302                <?php
    275                 settings_fields( 'guest_author_pluginPage' );
    276                 do_settings_sections( 'guest_author_pluginPage' );
     303                settings_fields('guest_author_pluginPage');
     304                do_settings_sections('guest_author_pluginPage');
    277305                submit_button();
    278         ?>
     306                ?>
    279307
    280308            </form>
    281                    <div>
    282                         <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
    283                         <h3>Thank you for using our plugin. Donations for extended support are appreciated but never required!</h3>
    284                         <input type="hidden" name="cmd" value="_s-xclick">
    285                         <input type="hidden" name="hosted_button_id" value="FTBD2UDXFJDB6">
    286                         <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!">
    287                         <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    288                         </form>
    289                     </div>
    290                     <div style="text-align:center">
    291                         <a target-"_blank" href="https://plugins.shooflysolutions.com/guest-author-name/" style="font-size:16px;">Try premium for 7 days</a>
    292                     <div style="text-align:center">
    293                         <a target='_blank' href="https://wordpress.org/support/plugin/guest-author-name/reviews/" style="font-size:16px;">You can also help by rating this plugin!</a>
    294                     </div>
    295             <?php
    296 
    297             }
    298 
    299         }
     309            <div>
     310                <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
     311                    <h3>Thank you for using our plugin. Donations for extended support are appreciated but never required!</h3>
     312                    <input type="hidden" name="cmd" value="_s-xclick">
     313                    <input type="hidden" name="hosted_button_id" value="FTBD2UDXFJDB6">
     314                    <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit"
     315                        alt="PayPal - The safer, easier way to pay online!">
     316                    <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
     317                </form>
     318            </div>
     319            <div style="text-align:center">
     320                <a target-"_blank" href="https://plugins.shooflysolutions.com/guest-author-name/" style="font-size:16px;">Try
     321                    premium for 7 days</a>
     322                <div style="text-align:center">
     323                    <a target='_blank' href="https://wordpress.org/support/plugin/guest-author-name/reviews/"
     324                        style="font-size:16px;">You can also help by rating this plugin!</a>
     325                </div>
     326                <?php
     327
     328        }
     329
    300330    }
    301     new guest_author_settings();
     331}
     332new guest_author_settings();
  • guest-author-name/trunk/sfly-guest-author.php

    r3034830 r3329963  
    11<?php
     2/*
    23/*
    34Author: Shoofly Solutions
     
    67Plugin URI: http://plugins.shooflysolutions.com/guest-author-name
    78Description: An ideal plugin for cross posting. Guest Author Name helps you to publish posts by authors without having to add them as users. If the Guest Author field is filled in on the post, the Guest Author name will override the author.  The optional Url link allows you to link to another web site.
    8 Version: 4.36
     9Version: 4.40
    910Author URI: http://www.shooflysolutions.com
    1011Copyright (C) 2015, 2016 Shoofly Solutions
    11 Contact me at http://www.shooflysolutions.com*/
    12 defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
     12Contact me at http://www.shooflysolutions.com
     13Text Domain: sfly_guest_author
     14License:     GPL2
     15 License URI: https://www.gnu.org/licenses/gpl-2.0.html */
     16defined('ABSPATH') or die('No script kiddies please!');
    1317remove_filter('pre_user_description', 'wp_filter_kses');
    1418
     
    1620
    1721
    18     $path = (plugin_dir_path(__FILE__));
    19     require_once( $path . 'guest-author-notices.php' );
    20     require_once( $path . 'sfly-guest-author-settings.php' );
    21 
    22     /**
    23     * sfly_guest_author class.
    24     */
    25      if ( !class_exists( 'sfly_guest_author' ) ):
    26 
    27      class sfly_guest_author
     22$path = (plugin_dir_path(__FILE__));
     23require_once($path . 'guest-author-notices.php');
     24require_once($path . 'sfly-guest-author-settings.php');
     25
     26/**
     27 * sfly_guest_author class.
     28 */
     29if (!class_exists('sfly_guest_author')):
     30
     31    class sfly_guest_author
    2832    {
    2933        /**
     
    3640        function __construct()
    3741        {
    38             $options = get_option( 'guest_author_name_settings' );  //load settings
     42            $options = get_option('guest_author_name_settings');  //load settings
    3943            self::sfly_guest_author_add_filters(); //add filters
    4044            $this->comment_list = false; //flag to let us know if wp is printing comments
    41             add_action('wp_enqueue_scripts', array( $this, 'sfly_guest_author_enqueue_scripts' ) ); //enqueue scripts
    42             add_action( 'get_sidebar', array($this, 'sfly_guest_author_add_filters' )); // action to disable plugin on the sidebar
    43             $disable = isset( $options['guest_author_disable_for_comments'] ) ? true : false ; //disable guest authors for comment section
    44 
    45             if ( $disable ) {
    46                 add_filter( 'wp_list_comments_args', array( $this, 'list_comments' ) ); //manage comments
     45            add_action('wp_enqueue_scripts', array($this, 'sfly_guest_author_enqueue_scripts')); //enqueue scripts
     46            add_action('get_sidebar', array($this, 'sfly_guest_author_add_filters')); // action to disable plugin on the sidebar
     47            $disable = isset($options['guest_author_disable_for_comments']) ? true : false; //disable guest authors for comment section
     48
     49            if ($disable) {
     50                add_filter('wp_list_comments_args', array($this, 'list_comments')); //manage comments
    4751            }
    4852
     
    5256            {
    5357
    54                     add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) ); //meta box settings
    55                     add_action( 'save_post', array( $this, 'save_meta' ), 10, 2 );  //action when saving post
    56                     $quickedit = isset( $options['guest_author_name_quickedit'] ) ? true : false ; //quick edit enabled?
    57                     if ( $quickedit ) //quick edit options
    58                     {
    59                         add_action( 'quick_edit_custom_box', array( $this, 'add_quick_meta_box' ), 10, 2 ) ;
    60                         add_action( 'manage_posts_custom_column', array( $this, 'render_post_columns' ), 10, 2 ) ;
    61                         add_filter( 'manage_edit-post_columns', array( $this, 'change_posttype_columns' ) );
    62                         add_action( 'admin_enqueue_scripts', array( $this, 'guest_admin_scripts' ) );
    63                     }
     58                add_action('add_meta_boxes', array($this, 'add_meta_box')); //meta box settings
     59                add_action('save_post', array($this, 'save_meta'), 10, 2);  //action when saving post
     60                $quickedit = isset($options['guest_author_name_quickedit']) ? true : false; //quick edit enabled?
     61                if ($quickedit) //quick edit options
     62                {
     63                    add_action('quick_edit_custom_box', array($this, 'add_quick_meta_box'), 10, 2);
     64                    add_action('manage_posts_custom_column', array($this, 'render_post_columns'), 10, 2);
     65                    add_filter('manage_edit-post_columns', array($this, 'change_posttype_columns'));
     66                    add_action('admin_enqueue_scripts', array($this, 'guest_admin_scripts'));
     67                }
    6468            }
    6569
     
    7276         * @return void
    7377         */
    74         function sfly_guest_author_open_link( $options, $open=true, $clear = false ){ //set the url to open in a new window
    75 
    76             if ( $open || $clear ) {
    77                 $selector = esc_attr(  $options['guest_author_url_selector_single'] ) ;
    78                 if ( $selector ) {
     78        function sfly_guest_author_open_link($options, $open = true, $clear = false)
     79        { //set the url to open in a new window
     80
     81            if ($open || $clear) {
     82                $selector = esc_attr($options['guest_author_url_selector_single']);
     83                if ($selector) {
    7984                    $script = '';
    80                     if ( $open ) {
    81                         $script="
     85                    if ($open) {
     86                        $script = "
    8287                                (function($) {
    8388                                var url      = window.location.href;
     
    8994                                }
    9095                                })(jQuery);";
    91                                 $success = wp_add_inline_script('guest_author_post_scripts', $script);
     96                        $success = wp_add_inline_script('guest_author_post_scripts', $script);
    9297
    9398
    9499
    95100                    }
    96                     if ( $clear ) {
    97                         $script="
     101                    if ($clear) {
     102                        $script = "
    98103                                (function($) {
    99104
     
    101106                                })(jQuery);";
    102107
    103                                 $success = wp_add_inline_script('guest_author_post_scripts', $script);
     108                        $success = wp_add_inline_script('guest_author_post_scripts', $script);
    104109
    105110                    }
     
    116121         * @return void
    117122         */
    118         function sfly_guest_author_enqueue_scripts() {
    119 
    120             $options = get_option( 'guest_author_name_settings' );
    121             $open = isset( $options['guest_author_open_new_window'] ) ? true : false ;
    122             $clear = isset( $options['guest_author_remove_link'] ) ? true : false ;
    123 
    124             if ( $open  || $clear ) {
    125                     wp_enqueue_script('jquery');
    126 
    127                     wp_enqueue_script( 'guest_author_post_scripts' ,  plugins_url('assets/guest-author-post.js', __FILE__), array('jquery'), '1.10', true);
    128                     $this->sfly_guest_author_open_link( $options, $open, $clear );
     123        function sfly_guest_author_enqueue_scripts()
     124        {
     125
     126            $options = get_option('guest_author_name_settings');
     127            $open = isset($options['guest_author_open_new_window']) ? true : false;
     128            $clear = isset($options['guest_author_remove_link']) ? true : false;
     129
     130            if ($open || $clear) {
     131                wp_enqueue_script('jquery');
     132
     133                wp_enqueue_script('guest_author_post_scripts', plugins_url('assets/guest-author-post.js', __FILE__), array('jquery'), '1.10', true);
     134                $this->sfly_guest_author_open_link($options, $open, $clear);
    129135            }
    130136
     
    138144         * @return void
    139145         */
    140         function sfly_guest_author_add_filters() {
    141             $admin = isset( $options['guest_author_name_admin'] ) ? true : false ;
    142 
    143             if (!is_admin() || $admin || wp_doing_ajax() )
    144             {
    145                 add_filter( 'the_author', array( $this, 'guest_author_name' ), 12 );
    146                 add_filter( 'get_the_author_display_name', array( $this, 'guest_author_name' ), 12 );
    147 
    148             }
    149             if (!is_admin() || wp_doing_ajax() )
    150             {
    151                 add_action ( 'ampforwp_modify_author_name', array( $this, 'guest_author_name' ), 12 );
    152                 add_filter( 'get_the_author_display_name', array( $this, 'guest_author_name' ), 12 ); //10-2-2022
    153 
    154                 add_action( 'the_post', array($this, 'register_author' ), 10);
    155                 add_filter( 'author_link', array( $this, 'guest_author_link' ), 12 );
    156                 add_filter( 'get_the_author_link', array( $this, 'guest_author_link' ), 12 );
    157                 add_filter( 'get_the_author_url', array( $this, 'guest_author_link' ), 21 );
    158                 add_filter( 'ampforwp_author_description', array( $this, 'guest_author_description_amp' ), 12 ) ;
    159                 add_filter( 'author_description', array( $this, 'guest_author_description'), 12) ;
    160                 add_filter( 'get_the_author_description', array( $this,  'guest_author_description' ), 12 ) ;
    161                 add_filter( 'get_the_author_id', array( $this, 'guest_author_id' ), 12 ) ;
    162                 add_filter( 'author_id', array( $this, 'guest_author_id' ), 12 );
    163                 add_filter( 'get_avatar', array( $this, 'guest_author_avatar' ), 40, 5 );
    164                 add_filter( 'get_avatar_url', array( $this, 'guest_avatar_link' ), 40, 3);
    165                 $include = isset( $options['guest_author_include_guest'] ) ? true : false ;
    166 
    167                 add_filter( 'wpseo_canonical', array( $this, 'guest_author_canonical_link') );
    168                 if ( $include )
    169                     add_action( 'pre_get_posts',     array( $this, 'author_query' ) , 50 );   //Fix query for author query without guest posts or guest author
    170 
    171                 add_filter("td_wp_booster_module_constructor", array( $this, 'set_guest_author_ids' ), 10, 2   );
    172                 add_action('comment_form_top', array ($this, 'sfly_guest_author_remove_filters'), 10);  //remove filters before comments form
    173                 add_filter( 'body_class',        array( $this, 'sfly_guest_author_body_class') );            //add some classes to the body class
     146        function sfly_guest_author_add_filters()
     147        {
     148            $admin = isset($options['guest_author_name_admin']) ? true : false;
     149
     150            if (!is_admin() || $admin || wp_doing_ajax()) {
     151                add_filter('the_author', array($this, 'guest_author_name'), 12);
     152                add_filter('get_the_author_display_name', array($this, 'guest_author_name'), 12);
     153
     154            }
     155            if (!is_admin() || wp_doing_ajax()) {
     156                add_action('ampforwp_modify_author_name', array($this, 'guest_author_name'), 12);
     157                add_filter('get_the_author_display_name', array($this, 'guest_author_name'), 12); //10-2-2022
     158
     159                add_action('the_post', array($this, 'register_author'), 10);
     160                add_filter('author_link', array($this, 'guest_author_link'), 12);
     161                add_filter('get_the_author_link', array($this, 'guest_author_link'), 12);
     162                add_filter('get_the_author_url', array($this, 'guest_author_link'), 21);
     163                add_filter('ampforwp_author_description', array($this, 'guest_author_description_amp'), 12);
     164                add_filter('author_description', array($this, 'guest_author_description'), 12);
     165                add_filter('get_the_author_description', array($this, 'guest_author_description'), 12);
     166                add_filter('get_the_author_id', array($this, 'guest_author_id'), 12);
     167                add_filter('author_id', array($this, 'guest_author_id'), 12);
     168                add_filter('get_avatar', array($this, 'guest_author_avatar'), 40, 5);
     169                add_filter('get_avatar_url', array($this, 'guest_avatar_link'), 40, 3);
     170                $include = isset($options['guest_author_include_guest']) ? true : false;
     171
     172                add_filter('wpseo_canonical', array($this, 'guest_author_canonical_link'));
     173                if ($include)
     174                    add_action('pre_get_posts', array($this, 'author_query'), 50);   //Fix query for author query without guest posts or guest author
     175
     176                add_filter("td_wp_booster_module_constructor", array($this, 'set_guest_author_ids'), 10, 2);
     177                add_action('comment_form_top', array($this, 'sfly_guest_author_remove_filters'), 10);  //remove filters before comments form
     178                add_filter('body_class', array($this, 'sfly_guest_author_body_class'));            //add some classes to the body class
    174179
    175180            }
     
    181186         * @return void
    182187         */
    183         function sfly_guest_author_remove_filters() {
    184                 remove_action( 'the_post', array($this, 'register_author') );
    185                 remove_filter( 'author_link', array( $this, 'guest_author_link' ) );
    186                 remove_filter( 'get_the_author_link', array( $this, 'guest_author_link' ) );
    187                 remove_filter( 'get_the_author_url', array( $this, 'guest_author_link' ) );
    188                 remove_filter( 'author_description', array( $this, 'guest_author_description') ) ;
    189                 remove_filter( 'get_the_author_description', array( $this,  'guest_author_description' ) ) ;
    190                 remove_filter( 'get_the_author_id', array( $this, 'guest_author_id' ) ) ;
    191                 remove_filter( 'author_id', array( $this, 'guest_author_id' ) );
    192                 remove_filter( 'get_avatar', array( $this, 'guest_author_avatar' ) );
    193                 remove_filter( 'get_avatar_url', array( $this, 'guest_avatar_link' ) );
    194                 remove_filter( 'wpseo_canonical', array( $this, 'guest_author_canonical_link') );
    195                 remove_action( 'pre_get_posts',     array( $this, 'author_query' )  );   //Fix query for author query without guest posts or guest author
    196                 remove_filter("td_wp_booster_module_constructor", array( $this, 'set_guest_author_ids' )   );
    197                 remove_filter( 'the_author', array( $this, 'guest_author_name' ) );
    198                 remove_filter( 'get_the_author_display_name', array( $this, 'guest_author_name' ) );
    199                 remove_filter( 'body_class',        array( $this, 'sfly_guest_author_body_class') );            //add some classes to the body class
    200         }
    201         function sfly_guest_author_excerpt( $content ) {
     188        function sfly_guest_author_remove_filters()
     189        {
     190            remove_action('the_post', array($this, 'register_author'));
     191            remove_filter('author_link', array($this, 'guest_author_link'));
     192            remove_filter('get_the_author_link', array($this, 'guest_author_link'));
     193            remove_filter('get_the_author_url', array($this, 'guest_author_link'));
     194            remove_filter('author_description', array($this, 'guest_author_description'));
     195            remove_filter('get_the_author_description', array($this, 'guest_author_description'));
     196            remove_filter('get_the_author_id', array($this, 'guest_author_id'));
     197            remove_filter('author_id', array($this, 'guest_author_id'));
     198            remove_filter('get_avatar', array($this, 'guest_author_avatar'));
     199            remove_filter('get_avatar_url', array($this, 'guest_avatar_link'));
     200            remove_filter('wpseo_canonical', array($this, 'guest_author_canonical_link'));
     201            remove_action('pre_get_posts', array($this, 'author_query'));   //Fix query for author query without guest posts or guest author
     202            remove_filter("td_wp_booster_module_constructor", array($this, 'set_guest_author_ids'));
     203            remove_filter('the_author', array($this, 'guest_author_name'));
     204            remove_filter('get_the_author_display_name', array($this, 'guest_author_name'));
     205            remove_filter('body_class', array($this, 'sfly_guest_author_body_class'));            //add some classes to the body class
     206        }
     207        function sfly_guest_author_excerpt($content)
     208        {
    202209            global $authordata;
    203             if ( isset ($authordata) && $authordata->guest_author ) {
     210            if (isset($authordata) && $authordata->guest_author) {
    204211                $content = $content . '<label style="visibility:hidden" class="guest-author-data" data-url="' . $authordata->user_url . '" data-name="' . $authordata->display_name . '">';
    205212            }
    206213            return $content;
    207214        }
    208         function sfly_guest_author_content( $content ) {
     215        function sfly_guest_author_content($content)
     216        {
    209217            global $authordata;
    210             if ( isset ($authordata) && $authordata->guest_author ) {
     218            if (isset($authordata) && $authordata->guest_author) {
    211219                $content = $content . '<label style="visibility:hidden" id="guest-author-data" data-url="' . $authordata->user_url . '" data-name="' . $authordata->display_name . '">';
    212220            }
     
    220228         * @return void
    221229         */
    222         function guest_author_canonical_link ($url)
     230        function guest_author_canonical_link($url)
    223231        {
    224232            global $wp;
     
    226234
    227235            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    228             if ( $paged > 1 ) {
    229 
    230                 $current_url = home_url( add_query_arg( array(), $wp->request ) );
     236            if ($paged > 1) {
     237
     238                $current_url = home_url(add_query_arg(array(), $wp->request));
    231239                if ($url != $current_url)
    232240                    return $current_url;
     
    251259            global $guest_author_post_id;
    252260
    253             if ( $guest_author_post_id != null )
    254             {
    255 
    256                 add_filter( 'get_comment_author', array( $this, 'comment_author' ), 99, 3);
    257                 add_filter( 'get_comment_author_link', array( $this, 'comment_author_link' ), 99, 3 );
     261            if ($guest_author_post_id != null) {
     262
     263                add_filter('get_comment_author', array($this, 'comment_author'), 99, 3);
     264                add_filter('get_comment_author_link', array($this, 'comment_author_link'), 99, 3);
    258265            }
    259266            return $r;
     
    269276         * @return void
    270277         */
    271         function comment_author( $author, $comment_ID, $comment )
    272         {
    273             if ( $author != $comment->author )
     278        function comment_author($author, $comment_ID, $comment)
     279        {
     280            if ($author != $comment->author)
    274281                return $comment->comment_author;
    275282            else
     
    288295         * @return void
    289296         */
    290         function comment_author_link( $return, $author, $comment_ID )
    291         {
    292 
    293            $comment = get_comment( $comment_ID );
    294            if ( $author != $comment->author ) {
    295                $url = $comment->comment_author_url;
    296 
    297 
    298                if ( empty( $url ) || 'http://' == $url ) {
    299                     $return = $author;
    300                } else {
    301                     $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
    302                }
    303            }
    304            return $return;
    305         }
     297        function comment_author_link($return, $author, $comment_ID)
     298        {
     299
     300            $comment = get_comment($comment_ID);
     301            if ($author != $comment->author) {
     302                $url = $comment->comment_author_url;
     303
     304
     305                if (empty($url) || 'http://' == $url) {
     306                    $return = $author;
     307                } else {
     308                    $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
     309                }
     310            }
     311            return $return;
     312        }
    306313        /**
    307314         * is_classic_editor_plugin_active function.
     
    310317         * @return void
    311318         */
    312         function is_classic_editor_plugin_active() {
    313             if ( ! function_exists( 'is_plugin_active' ) ) {
    314                 include_once ABSPATH . 'wp-admin/includes/plugin.php';
    315             }
    316 
    317             if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
    318                 return true;
    319             }
    320 
    321             return false;
     319        function is_classic_editor_plugin_active()
     320        {
     321            if (!function_exists('is_plugin_active')) {
     322                include_once ABSPATH . 'wp-admin/includes/plugin.php';
     323            }
     324
     325            if (is_plugin_active('classic-editor/classic-editor.php')) {
     326                return true;
     327            }
     328
     329            return false;
    322330        }
    323331        /**
     
    328336         * @return void
    329337         */
    330         function sfly_guest_author_body_class ($classes) {
     338        function sfly_guest_author_body_class($classes)
     339        {
    331340            global $post;
    332             if ( is_single() ) {
    333             $author = esc_attr(get_post_meta( $post->ID, 'sfly_guest_author_names', true ));
    334             if ($author)
    335 
    336                 $classes[] = 'sfly_guest-author-post';
    337             }
    338             return $classes;
     341            if (is_single()) {
     342                $author = esc_attr(get_post_meta($post->ID, 'sfly_guest_author_names', true));
     343                if ($author)
     344
     345                    $classes[] = 'sfly_guest-author-post';
     346            }
     347            return $classes;
    339348        }
    340349        /**
     
    344353         * @return void
    345354         */
    346         function register_author() {
     355        function register_author()
     356        {
    347357            $id = $this->get_post_id();
    348             $gauthor = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
     358            $gauthor = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
    349359            $guest_author_post_id = null;
    350             if (!$gauthor)
    351                 return;
     360            if (!$gauthor)
     361                return;
    352362
    353363            global $authordata, $post, $guest_author_post_id;
     
    374384         * @return void
    375385         */
    376         function guest_admin_scripts( $hook )
    377         {
    378 
    379             if ( $hook == 'edit.php' ) {
     386        function guest_admin_scripts($hook)
     387        {
     388
     389            if ($hook == 'edit.php') {
    380390                wp_enqueue_script('guest_author_name_scripts', plugins_url('assets/guest-author.js', __FILE__), array('inline-edit-post'), '1.00');
    381391
     
    390400         * @return the author id or null if it's a guest author
    391401         */
    392         function guest_author_id( $id ) {
     402        function guest_author_id($id)
     403        {
    393404            $id = $this->get_post_id();
    394             $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    395             if ( $author )
     405            $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     406            if ($author)
    396407                $id = NULL;
    397408            return $id;
     
    405416         * @return void
    406417         */
    407         function author_query( $query ) {
    408             if ( $query->is_author )
    409             {
     418        function author_query($query)
     419        {
     420            if ($query->is_author) {
    410421                $meta_query = $query->get('meta_query');
    411                 if ( is_string($meta_query) )
    412                 {
    413                     if ($meta_query == '' )
     422                if (is_string($meta_query)) {
     423                    if ($meta_query == '')
    414424                        $meta_query = array();
    415425                    else
    416                         $meta_query = array ( $meta_query );
     426                        $meta_query = array($meta_query);
    417427                }
    418428                //Add our meta query to the original meta queries
    419429                $meta_query['relation'] = "OR";
    420                 $meta_query[] =  array(
    421                     'key'     => 'sfly_guest_author_names',
     430                $meta_query[] = array(
     431                    'key' => 'sfly_guest_author_names',
    422432                    'compare' => 'NOT EXISTS',
    423433                    'value' => ''
    424434                );
    425                 $meta_query[] =  array(
    426                     'key'     => 'sfly_guest_author_names',
     435                $meta_query[] = array(
     436                    'key' => 'sfly_guest_author_names',
    427437                    'compare' => '=',
    428438                    'value' => ''
    429439                );
    430                 $query->set('meta_query',$meta_query);
     440                $query->set('meta_query', $meta_query);
    431441            }
    432442
     
    442452         * @return name to be displayed as the author name
    443453         */
    444         function guest_author_name( $name ) {
     454        function guest_author_name($name)
     455        {
    445456            $id = $this->get_post_id();
    446457
    447             $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    448             if ( $author ) {
     458            $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     459            if ($author) {
    449460                $name = $author;
    450461
     
    459470         * @return string
    460471         */
    461         function guest_author_link( $link ) {
     472        function guest_author_link($link)
     473        {
    462474            $id = $this->get_post_id();
    463             $author = esc_attr( get_post_meta( $id, 'sfly_guest_author_names', true ));
    464             if ( $author )
    465             {
    466                 $link = get_post_meta( $id, 'sfly_guest_link', true );
     475            $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     476            if ($author) {
     477                $link = get_post_meta($id, 'sfly_guest_link', true);
    467478                if (!$link)
    468479                    $link = "";
     
    477488         * @return string
    478489         */
    479         function guest_author_description( $description ) {
     490        function guest_author_description($description)
     491        {
    480492            $id = $this->get_post_id();
    481             $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    482             if ( $author )
    483             {
    484                 $options = get_option( 'guest_author_name_settings' );
    485                 $allowhtml = isset( $options['guest_author_allow_html'] ) ? true : false ;
    486 
    487                 if ( $allowhtml )
    488                     $description =  wp_kses_post(get_post_meta( $id, 'sfly_guest_author_description', true ) );
     493            $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     494            if ($author) {
     495                $options = get_option('guest_author_name_settings');
     496                $allowhtml = isset($options['guest_author_allow_html']) ? true : false;
     497
     498                if ($allowhtml)
     499                    $description = wp_kses_post(get_post_meta($id, 'sfly_guest_author_description', true));
    489500                else
    490                     $description =   esc_attr(get_post_meta( $id, 'sfly_guest_author_description', true )) ;
     501                    $description = esc_attr(get_post_meta($id, 'sfly_guest_author_description', true));
    491502
    492503                if (!$description)
     
    502513         * @return string
    503514         */
    504         function guest_author_description_amp( $description ) {
     515        function guest_author_description_amp($description)
     516        {
    505517
    506518            $new_description = $this->guest_author_description($description);
     
    508520            $description = preg_replace($pattern, '', $description);
    509521
    510             if ( $new_description != $description ) {
     522            if ($new_description != $description) {
    511523                $description = '<p>' . $new_description . '</p>';
    512524            }
     
    521533         * @return string
    522534         */
    523         function guest_author_email( $email ) {
     535        function guest_author_email($email)
     536        {
    524537            $id = $this->get_post_id();
    525             $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    526             if ( $author )
    527             {
    528                 $email = esc_html(get_post_meta( $id, 'sfly_guest_author_email', true ));
     538            $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     539            if ($author) {
     540                $email = esc_html(get_post_meta($id, 'sfly_guest_author_email', true));
    529541                if (!$email)
    530542                    $email = "";
     
    539551         * @return avatar html
    540552         */
    541         function guest_author_avatar( $avatar, $id_or_email, $size, $default, $alt )
    542 
     553        function guest_author_avatar($avatar, $id_or_email, $size, $default, $alt)
    543554        {
    544555
    545556            global $guest_author_post_id;
    546             if ( (!isset( $guest_author_post_id) ||  $guest_author_post_id <= 0 ) ) {
     557            if ((!isset($guest_author_post_id) || $guest_author_post_id <= 0)) {
    547558                return $avatar;
    548559            }
     
    552563
    553564
    554             if ( isset( $comment ) && $this->comment_list) {
     565            if (isset($comment) && $this->comment_list) {
    555566                $email = $comment->comment_author_email;
    556                 if ( $email ) {
     567                if ($email) {
    557568                    //$image_path = $this->get_guest_gravatar($email);
    558                     $avatar = $this->guest_author_avatar_url_link( $avatar, $email) ; // '<img src="'.$image_path.'" width="'.$size.'" height="'.$size.'" />';
     569                    $avatar = $this->guest_author_avatar_url_link($avatar, $email); // '<img src="'.$image_path.'" width="'.$size.'" height="'.$size.'" />';
    559570                } else {
    560571                    $avatar = $default;
     
    565576                $id = $this->get_post_id();
    566577
    567                 $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    568 
    569                 if ( $author )
    570                 {
    571                     $email = esc_html(get_post_meta( $id, 'sfly_guest_author_email', true ));
    572 
    573 
    574                     if ( $email ) {
    575                     //  $image_path = $this->get_author_avatar($email);
    576                         $avatar =  $this->guest_author_avatar_url_link( $avatar, $email);// '<img src="'.$image_path.'" width="'.$size.'" height="'.$size.'" />';
     578                $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     579
     580                if ($author) {
     581                    $email = esc_html(get_post_meta($id, 'sfly_guest_author_email', true));
     582
     583
     584                    if ($email) {
     585                        //  $image_path = $this->get_author_avatar($email);
     586                        $avatar = $this->guest_author_avatar_url_link($avatar, $email);// '<img src="'.$image_path.'" width="'.$size.'" height="'.$size.'" />';
    577587                    }
    578588
     
    591601         * @return void
    592602         */
    593         function guest_avatar_link( $url, $email, $args = array() ) {
     603        function guest_avatar_link($url, $email, $args = array())
     604        {
    594605
    595606            global $guest_author_post_id;
    596607            global $comment;
    597             if ( isset( $comment ) &&  $this->comment_list ) {
     608            if (isset($comment) && $this->comment_list) {
    598609                $cemail = $comment->comment_author_email;
    599610                if ($cemail) {
    600611                    $url = $this->get_guest_gravatar_link($cemail);
    601612                }
    602             }
    603             else {
     613            } else {
    604614                $id = $this->get_post_id();
    605615
    606                 $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    607 
    608                 if ( $author )
    609                 {
    610                     $email = esc_html(get_post_meta( $id, 'sfly_guest_author_email', true ));
     616                $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     617
     618                if ($author) {
     619                    $email = esc_html(get_post_meta($id, 'sfly_guest_author_email', true));
    611620                    if ($email) {
    612621                        $url = $this->get_guest_gravatar_link($email);
     
    628637         * @return void
    629638         */
    630         function guest_author_avatar_url_link( $url, $email, $args = array() )
    631 
     639        function guest_author_avatar_url_link($url, $email, $args = array())
    632640        {
    633641
    634642            global $guest_author_post_id;
    635643
    636             if ( !isset( $guest_author_post_id ) || $guest_author_post_id <= 0) {
     644            if (!isset($guest_author_post_id) || $guest_author_post_id <= 0) {
    637645                return $url;
    638646            }
    639647            global $comment;
    640648
    641             if ( isset( $comment ) &&  $this->comment_list ) {
     649            if (isset($comment) && $this->comment_list) {
    642650                $cemail = $comment->comment_author_email;
    643651                if ($cemail) {
     
    647655                }
    648656
    649             }
    650             else {
     657            } else {
    651658                $id = $this->get_post_id();
    652659
    653                 $author = esc_attr(get_post_meta( $id, 'sfly_guest_author_names', true ));
    654 
    655                 if ( $author )
    656                 {
    657                     $email = esc_html(get_post_meta( $id, 'sfly_guest_author_email', true ));
     660                $author = esc_attr(get_post_meta($id, 'sfly_guest_author_names', true));
     661
     662                if ($author) {
     663                    $email = esc_html(get_post_meta($id, 'sfly_guest_author_email', true));
    658664
    659665                    if ($email) {
     
    666672            }
    667673
    668             if ( isset ( $avatar_url ) ) {
     674            if (isset($avatar_url)) {
    669675                $avatar_url = "'" . $avatar_url . "'";
    670676
    671                 $html = preg_replace('/<a href="(http:\/\/)?[\w.]+\/([\w]+)"\s?>/',  $avatar_url ,$url);
     677                $html = preg_replace('/<a href="(http:\/\/)?[\w.]+\/([\w]+)"\s?>/', $avatar_url, $url);
    672678
    673679                return $html;
    674             }
    675             else  {
     680            } else {
    676681                return $url;
    677682            }
     
    689694         * @return void
    690695         */
    691         function get_guest_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {
     696        function get_guest_gravatar($email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array())
     697        {
    692698
    693699            $url = 'http://www.gravatar.com/avatar/';
    694             $url .= md5( strtolower( trim( $email ) ) );
     700            $url .= md5(strtolower(trim($email)));
    695701
    696702            $url .= "?s=$s&d=$d&r=$r";
    697             if ( $img ) {
     703            if ($img) {
    698704                $url = '<img src="' . $url . '"';
    699                 foreach ( $atts as $key => $val )
     705                foreach ($atts as $key => $val)
    700706                    $url .= ' ' . $key . '="' . $val . '"';
    701707                $url .= ' />';
     
    705711        }
    706712
    707                 /**
     713        /**
    708714         * get_guest_gravatar_link function.
    709715         *
     
    717723         * @return void
    718724         */
    719         function get_guest_gravatar_link( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {
     725        function get_guest_gravatar_link($email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array())
     726        {
    720727            $link = 'http://www.gravatar.com/avatar/';
    721             $link .= md5( strtolower( trim( $email ) ) );
     728            $link .= md5(strtolower(trim($email)));
    722729
    723730            $link .= "?s=$s&d=$d&r=$r";
     
    754761         * @return void
    755762         */
    756         public function add_meta_box( $post_type ) {
     763        public function add_meta_box($post_type)
     764        {
    757765            $post_types = array('post', 'page');     //limit meta box to certain post types
    758             if ( in_array( $post_type, $post_types )) {
     766            if (in_array($post_type, $post_types)) {
    759767                add_meta_box(
    760768                    'some_meta_box_name'
    761                     ,__( 'Guest Author', 'sfly_guest_author' )
    762                     ,array( $this, 'render_meta_box_content' )
    763                     ,$post_type
    764                     ,'advanced'
    765                     ,'high'
     769                    ,
     770                    __('Guest Author', 'sfly_guest_author')
     771                    ,
     772                    array($this, 'render_meta_box_content')
     773                    ,
     774                    $post_type
     775                    ,
     776                    'advanced'
     777                    ,
     778                    'high'
    766779                );
    767780            }
     
    775788         * @return void
    776789         */
    777         function change_posttype_columns( $cols ) {
     790        function change_posttype_columns($cols)
     791        {
    778792            $cols2 = array(
    779793                'sfly_guest_author' => 'Guest Author',
     
    814828         * @return void
    815829         */
    816         function render_post_columns($column_name, $id) {
    817             $options = get_option( 'guest_author_name_settings' );
    818             $allowhtml = isset( $options['guest_author_allow_html'] ) ? true : false ;
    819 
    820             if ( $allowhtml )
    821                 $description =  wp_kses_post(get_post_meta( $id, 'sfly_guest_author_description', true ) );
     830        function render_post_columns($column_name, $id)
     831        {
     832            $options = get_option('guest_author_name_settings');
     833            $allowhtml = isset($options['guest_author_allow_html']) ? true : false;
     834
     835            if ($allowhtml)
     836                $description = wp_kses_post(get_post_meta($id, 'sfly_guest_author_description', true));
    822837            else
    823                 $description =   esc_attr(get_post_meta( $id, 'sfly_guest_author_description', true )) ;
     838                $description = esc_attr(get_post_meta($id, 'sfly_guest_author_description', true));
    824839
    825840            if (!$description)
     
    827842
    828843            switch ($column_name) {
    829             case 'sfly_guest_author':
    830                 echo sanitize_text_field(get_post_meta( $id, 'sfly_guest_author_names', TRUE));
    831                 break;
    832             case 'sfly_guest_link':
    833                 echo esc_url(get_post_meta( $id, 'sfly_guest_link', TRUE));
    834                 break;
    835             case 'sfly_guest_author_description':
    836                 echo $description;
    837                 break;
    838             case 'sfly_guest_author_email':
    839                 echo esc_html(get_post_meta( $id, 'sfly_guest_author_email', TRUE));
     844                case 'sfly_guest_author':
     845                    echo sanitize_text_field(get_post_meta($id, 'sfly_guest_author_names', TRUE));
     846                    break;
     847                case 'sfly_guest_link':
     848                    echo esc_url(get_post_meta($id, 'sfly_guest_link', TRUE));
     849                    break;
     850                case 'sfly_guest_author_description':
     851                    echo $description;
     852                    break;
     853                case 'sfly_guest_author_email':
     854                    echo esc_html(get_post_meta($id, 'sfly_guest_author_email', TRUE));
    840855
    841856
     
    850865         * @return void
    851866         */
    852         function save_quick_meta( $post_id, $post ) {
     867        function save_quick_meta($post_id, $post)
     868        {
    853869
    854870            $post_types = array('post', 'page');     //limit meta box to certain post types
    855             if ( in_array( $post_type, $post_types )) {
    856                 if ( $printNonce ) {
     871            if (in_array($post_type, $post_types)) {
     872                if ($printNonce) {
    857873                    $printNonce = FALSE;
    858                     wp_nonce_field( plugin_basename( __FILE__ ), 'guest_author_edit_nonce' );
    859                 }
    860                 if ( !current_user_can( 'edit_post', $post_id ) ) {
     874                    wp_nonce_field(plugin_basename(__FILE__), 'guest_author_edit_nonce');
     875                }
     876                if (!current_user_can('edit_post', $post_id)) {
    861877                    return;
    862878                }
    863                 if ( isset( $_REQUEST['sfly_guest_author'] ) ) {
    864                     update_post_meta( $post_id, 'sfly_guest_author', santize_text_field( $_REQUEST['sfly_guest_author'] ) );
    865                 }
    866                 if ( isset( $_REQUEST['sfly_guest_link'] ) ) {
    867                     update_post_meta( $post_id, 'sfly_guest_link', esc_url( $_REQUEST['sfly_guest_link'] ));
    868                 }
    869                 if ( isset( $_REQUEST['sfly_guest_author_description'] ) ) {
    870                     update_post_meta( $post_id, 'sfly_guest_author_description', wp_kses_post($_REQUEST['sfly_guest_author_description'] ));
    871                 }
    872                 if ( isset( $_REQUEST['sfly_guest_author_email'] ) ) {
    873                     update_post_meta( $post_id, 'sfly_guest_author_email', esc_html($_REQUEST['sfly_guest_author_email'] ));
     879                if (isset($_REQUEST['sfly_guest_author'])) {
     880                    update_post_meta($post_id, 'sfly_guest_author', santize_text_field($_REQUEST['sfly_guest_author']));
     881                }
     882                if (isset($_REQUEST['sfly_guest_link'])) {
     883                    update_post_meta($post_id, 'sfly_guest_link', esc_url($_REQUEST['sfly_guest_link']));
     884                }
     885                if (isset($_REQUEST['sfly_guest_author_description'])) {
     886                    update_post_meta($post_id, 'sfly_guest_author_description', wp_kses_post($_REQUEST['sfly_guest_author_description']));
     887                }
     888                if (isset($_REQUEST['sfly_guest_author_email'])) {
     889                    update_post_meta($post_id, 'sfly_guest_author_email', esc_html($_REQUEST['sfly_guest_author_email']));
    874890                }
    875891            }
     
    885901         * @return void
    886902         */
    887         public function add_quick_meta_box( $col,  $post_type ) {
     903        public function add_quick_meta_box($col, $post_type)
     904        {
    888905            static $printNonce = TRUE;
    889906            $post_types = array('post', 'page');     //limit meta box to certain post types
    890             if ( in_array( $post_type, $post_types )) {
    891                 if ( $printNonce ) {
    892                     wp_nonce_field( 'sfly_guest_author_box', 'sfly_guest_author_nonce' );
     907            if (in_array($post_type, $post_types)) {
     908                if ($printNonce) {
     909                    wp_nonce_field('sfly_guest_author_box', 'sfly_guest_author_nonce');
    893910                    $printNonce = FALSE;
    894911                    //  wp_nonce_field( plugin_basename( __FILE__ ), 'guest_author_edit_nonce' );
    895912                }
    896     ?>
    897 
    898 
     913                ?>
     914
     915
     916                <?php
     917
     918                switch ($col) {
     919                    case 'sfly_guest_author':
     920                        ?>
     921                        <fieldset class="inline-edit-col-right inline-edit-book">
     922                            <div class="inline-edit-col column-<?php echo $col; ?>" style="display:block; border:1px;">
     923                                <label class="inline-edit-group">
     924                                    <div style='display:block'><span class="sfly_guest_author" style="width:150px;">Guest Author
     925                                            Name(s)</span><input name="sfly_guest_author" class="widefat" /></div>
     926                                </label><?php
     927                                break;
     928                    case 'sfly_guest_link':
     929                        ?><label class="inline-edit-group">
     930                                    <div style="display:block"><span class="sfly_guest_link" style="width:150px;">Guest URL</span><input
     931                                            name="sfly_guest_link" class="widefat" /></div>
     932                                </label><?php
     933                                break;
     934                    case 'sfly_guest_author_description':
     935                        ?><label class="inline-edit-group">
     936                                    <div style="display:block"><span class="sfly_guest_author_description" style="width:150px;">Author Bio /
     937                                            Description</span><input name="sfly_guest_author_description" class="widefat" /></div>
     938                                </label><?php
     939                                break;
     940                    case 'sfly_guest_author_email':
     941                        ?><label class="inline-edit-group">
     942                                    <div style="display:block"><span class="sfly_guest_author_email" style="width:150px;">Author Gravatar
     943                                            Email</span><input name="sfly_guest_author_email" class="widefat" /></div>
     944                            </div></label>
     945                            </div>
     946                        </fieldset><?php
     947                        break;
     948                }
     949            ?>
    899950            <?php
    900 
    901                 switch ( $col ) {
    902                 case 'sfly_guest_author':
    903                     ?><fieldset class="inline-edit-col-right inline-edit-book">
    904           <div class="inline-edit-col column-<?php echo $col; ?>" style="display:block; border:1px;">
    905             <label class="inline-edit-group"><div style='display:block'><span class="sfly_guest_author" style="width:150px;">Guest Author Name(s)</span><input name="sfly_guest_author" class="widefat" /></div></label><?php
    906                     break;
    907                 case 'sfly_guest_link':
    908                     ?><label  class="inline-edit-group"><div style="display:block"><span class="sfly_guest_link" style="width:150px;">Guest URL</span><input name="sfly_guest_link" class="widefat" /></div></label><?php
    909                     break;
    910                 case 'sfly_guest_author_description':
    911                     ?><label class="inline-edit-group"><div style="display:block"><span class="sfly_guest_author_description" style="width:150px;">Author Bio / Description</span><input name="sfly_guest_author_description" class="widefat" /></div></label><?php
    912                     break;
    913                 case 'sfly_guest_author_email':
    914                     ?><label class="inline-edit-group"><div style="display:block"><span class="sfly_guest_author_email" style="width:150px;">Author Gravatar Email</span><input name="sfly_guest_author_email" class="widefat" /></div>
    915             </div></label>
    916           </div>
    917         </fieldset><?php
    918                     break;
    919                 }
    920     ?>
    921         <?php
    922951            }
    923952        }
     
    934963         * @return void
    935964         */
    936         public function save_meta( $post_id, $post ) {
    937 
    938             if ( ! isset( $_POST['sfly_guest_author_nonce'] ) )
     965        public function save_meta($post_id, $post)
     966        {
     967
     968            if (!isset($_POST['sfly_guest_author_nonce']))
    939969                return $post_id;
    940970            $nonce = $_POST['sfly_guest_author_nonce'];
    941             if ( ! wp_verify_nonce( $nonce, 'sfly_guest_author_box' ) )
     971            if (!wp_verify_nonce($nonce, 'sfly_guest_author_box'))
    942972                return $post_id;
    943973            // If this is an autosave, our form has not been submitted,
    944974            //   so we don't want to do anything.
    945             if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
     975            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
    946976                return $post_id;
    947977            // Check the user's permissions.
    948             if ( 'page' == $_POST['post_type'] ) {
    949                 if ( ! current_user_can( 'edit_page', $post_id ) )
     978            if ('page' == $_POST['post_type']) {
     979                if (!current_user_can('edit_page', $post_id))
    950980                    return $post_id;
    951981            } else {
    952                 if ( ! current_user_can( 'edit_post', $post_id ) )
     982                if (!current_user_can('edit_post', $post_id))
    953983                    return $post_id;
    954984            }
     985
    955986            // Sanitize the user input.
    956             $author = sanitize_text_field( $_POST['sfly_guest_author'] );
     987            $author = $this->strip_to_safe_words(sanitize_text_field($_POST['sfly_guest_author']));
     988
    957989            $link = esc_url($_POST['sfly_guest_link']);
    958990
    959             $options = get_option( 'guest_author_name_settings' );
    960             $allowhtml = isset( $options['guest_author_allow_html'] ) ? true : false ;
     991            $options = get_option('guest_author_name_settings');
     992            $allowhtml = isset($options['guest_author_allow_html']) ? true : false;
    961993
    962994
    963995            if ($allowhtml)
    964             $description = wp_kses_post(  $_POST['sfly_guest_author_description'] );
    965         else
    966             $description = sanitize_text_field( $_POST['sfly_guest_author_description']);
    967 
    968             $email = sanitize_email( $_POST['sfly_guest_author_email'] );
     996                $description = wp_kses_post($_POST['sfly_guest_author_description']);
     997            else
     998                $description = sanitize_text_field($_POST['sfly_guest_author_description']);
     999
     1000            $email = sanitize_email($_POST['sfly_guest_author_email']);
    9691001            // Update the meta field.
    970             update_post_meta( $post_id, 'sfly_guest_author_names', $author );
    971             update_post_meta( $post_id, 'sfly_guest_link', $link);
    972             update_post_meta( $post_id, 'sfly_guest_author_description', $description);
    973             update_post_meta( $post_id, 'sfly_guest_author_email', $email);
    974         }
    975 
    976          /*
     1002            update_post_meta($post_id, 'sfly_guest_author_names', $author);
     1003            update_post_meta($post_id, 'sfly_guest_link', $link);
     1004            update_post_meta($post_id, 'sfly_guest_author_description', $description);
     1005            update_post_meta($post_id, 'sfly_guest_author_email', $email);
     1006        }
     1007        function strip_to_safe_words($input)
     1008        {
     1009
     1010            // Remove anything with non-word characters (like =, (), etc.)
     1011            // This keeps only alphanumeric words, underscores, and hyphens
     1012            preg_match_all('/\b[a-zA-Z0-9_-]+\b/', $input, $matches);
     1013            $input = implode(' ', $matches[0]);
     1014
     1015            return $input;
     1016        }
     1017        /*
    9771018         * render_meta_box_content function.
    9781019         *
     
    9811022         * @return void
    9821023         */
    983         public function render_meta_box_content( $post ) {
     1024        public function render_meta_box_content($post)
     1025        {
    9841026            // Add an nonce field so we can check for it later.
    985             wp_nonce_field( 'sfly_guest_author_box', 'sfly_guest_author_nonce' );
     1027            wp_nonce_field('sfly_guest_author_box', 'sfly_guest_author_nonce');
    9861028            // Use get_post_meta to retrieve an existing values from the database.
    987             $value = sanitize_text_field(get_post_meta( $post->ID, 'sfly_guest_author_names', true ) );
    988             $link = esc_url( get_post_meta( $post->ID, 'sfly_guest_link', true ) );
    989 
    990             $options = get_option( 'guest_author_name_settings' );
    991             $allowhtml = isset( $options['guest_author_allow_html'] ) ? true : false ;
     1029            $value = sanitize_text_field(get_post_meta($post->ID, 'sfly_guest_author_names', true));
     1030            $link = esc_url(get_post_meta($post->ID, 'sfly_guest_link', true));
     1031
     1032            $options = get_option('guest_author_name_settings');
     1033            $allowhtml = isset($options['guest_author_allow_html']) ? true : false;
    9921034            $id = $post->ID;
    993             if ( $allowhtml )
    994                 $description =  wp_kses_post(get_post_meta( $id, 'sfly_guest_author_description', true ) );
     1035            if ($allowhtml)
     1036                $description = wp_kses_post(get_post_meta($id, 'sfly_guest_author_description', true));
    9951037            else
    996                 $description =   esc_attr(get_post_meta( $id, 'sfly_guest_author_description', true ) ) ;
     1038                $description = esc_attr(get_post_meta($id, 'sfly_guest_author_description', true));
    9971039
    9981040            if (!$description)
    9991041                $description = "";
    1000            
    1001             $email = esc_html( get_post_meta( $post->ID, 'sfly_guest_author_email', true ) );
     1042
     1043            $email = esc_html(get_post_meta($post->ID, 'sfly_guest_author_email', true));
    10021044            // Display the form, using the current values.
    10031045            echo '<label for="sfly_guest_author">';
    1004             _e( 'Guest Author Name(s)', 'sfly_guest_author' );
     1046            _e('Guest Author Name(s)', 'sfly_guest_author');
    10051047            echo '</label> ';
    10061048            echo '<input type="text" id="sfly_guest_author" name="sfly_guest_author"';
    1007             echo ' value="' .  $value . '" style="max-width:100%" size="150" class="widefat" />';
     1049            echo ' value="' . $value . '" style="max-width:100%" size="150" class="widefat" />';
    10081050            echo '<br/><label for="sfly_guest_link">';
    1009             _e( 'Guest URL', 'sfly_guest_link' );
     1051            _e('Guest URL', 'sfly_guest_link');
    10101052            echo '</label><br/>';
    10111053            echo '<input type="text" id="sfly_guest_link" name="sfly_guest_link"';
    1012             echo ' value="' .  $link . '" style="max-width:100%" class="widefat"  />';
     1054            echo ' value="' . $link . '" style="max-width:100%" class="widefat"  />';
    10131055            echo '<br/><label for="sfly_guest_description">';
    1014             _e( 'Guest Description', 'sfly_guest_description' );
     1056            _e('Guest Description', 'sfly_guest_description');
    10151057            echo '</label><br/> ';
    10161058            echo '<textarea id="sfly_guest_author_description" name="sfly_guest_author_description" style="width:100%;height:40px;">' . $description . '</textarea>';
    10171059            echo '<label for="sfly_guest_author_email">';
    1018             _e( 'Guest Gravatar Email', 'sfly_guest_author_email' );
     1060            _e('Guest Gravatar Email', 'sfly_guest_author_email');
    10191061            echo '</label> ';
    10201062            echo '<input type="text" id="sfly_guest_author_email" name="sfly_guest_author_email"';
    1021             echo ' value="' .  $email  . '" style="max-width:100%" class="widefat" size="150" />';
    1022         }
    1023             /****Functions for tag_div only ***/
    1024 
    1025 
    1026         function set_guest_author_ids($module, $post) {
    1027                 if ( isset( $post ) ) {
    1028                     global $g_post_id;
    1029                     $g_post_id = $post->ID;
    1030                     add_filter('author_link', array( $this, 'tag_div_author' ), 99);
    1031                     add_filter( 'get_the_author_display_name', array( $this, 'tag_div_display_name' ), 99 );
    1032 
    1033                 }
    1034                 else
    1035                 {
    1036                     $g_post_id = nulll;
    1037                     remove_filter('author_link', array( $this, 'tag_div_author' ), 99);
    1038                     remove_filter( 'get_the_author_display_name', array( $this, 'tag_div_display_name' ), 99 );
    1039                 }
    1040 
    1041             }
    1042         function tag_div_display_name( $name )
     1063            echo ' value="' . $email . '" style="max-width:100%" class="widefat" size="150" />';
     1064        }
     1065        /****Functions for tag_div only ***/
     1066
     1067
     1068        function set_guest_author_ids($module, $post)
     1069        {
     1070            if (isset($post)) {
     1071                global $g_post_id;
     1072                $g_post_id = $post->ID;
     1073                add_filter('author_link', array($this, 'tag_div_author'), 99);
     1074                add_filter('get_the_author_display_name', array($this, 'tag_div_display_name'), 99);
     1075
     1076            } else {
     1077                $g_post_id = nulll;
     1078                remove_filter('author_link', array($this, 'tag_div_author'), 99);
     1079                remove_filter('get_the_author_display_name', array($this, 'tag_div_display_name'), 99);
     1080            }
     1081
     1082        }
     1083        function tag_div_display_name($name)
    10431084        {
    10441085            global $g_post_id;
    1045             if ( isset(  $g_post_id ) &&  $g_post_id > 0 )
    1046             {
    1047             $author = esc_attr(get_post_meta( $g_post_id, 'sfly_guest_author_names', true ));
    1048             if ( $author )
    1049                 $name = $author;
     1086            if (isset($g_post_id) && $g_post_id > 0) {
     1087                $author = esc_attr(get_post_meta($g_post_id, 'sfly_guest_author_names', true));
     1088                if ($author)
     1089                    $name = $author;
    10501090            }
    10511091            return $name;
     
    10541094        }
    10551095
    1056         function tag_div_author($link, $authorid=null)
     1096        function tag_div_author($link, $authorid = null)
    10571097        {
    10581098            global $g_post_id;
    10591099
    1060             if ( isset ( $g_post_id ) && $g_post_id  > 0 ) {
    1061                 $author = esc_attr(get_post_meta( $g_post_id, 'sfly_guest_author_names', true ));
    1062                 if ( $author )
    1063                 {
    1064                     $link = get_post_meta( $g_post_id, 'sfly_guest_link', true );
     1100            if (isset($g_post_id) && $g_post_id > 0) {
     1101                $author = esc_attr(get_post_meta($g_post_id, 'sfly_guest_author_names', true));
     1102                if ($author) {
     1103                    $link = get_post_meta($g_post_id, 'sfly_guest_link', true);
    10651104                    if (!$link)
    10661105                        $link = "";
     
    10741113endif;
    10751114
    1076     // Admin Settings
    1077 
    1078 
    1079 
    1080     new sfly_guest_author();
     1115// Admin Settings
     1116
     1117
     1118
     1119new sfly_guest_author();
Note: See TracChangeset for help on using the changeset viewer.