Plugin Directory

Changeset 2713270

Timestamp:
04/22/2022 10:48:58 AM (2 years ago)
Author:
husobj
Message:

Version 3.4.1.1

Location:
wp-subtitle/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • wp-subtitle/trunk/plugin/admin/admin.php

    r2712645 r2713270  
    4848            $position = self::subtitle_field_position( $post_type );
    4949
    50             if ( 'after_title' == $position ) {
     50            if ( 'after_title' == $position ) {
    5151                add_action( 'admin_head', array( 'WPSubtitle_Admin', '_add_admin_styles' ) );
    5252                add_action( 'edit_form_after_title', array( 'WPSubtitle_Admin', '_add_subtitle_field' ) );
    53             } elseif ( 'before_title' == $position ) {
     53            } elseif ( 'before_title' == $position ) {
    5454                add_action( 'admin_head', array( 'WPSubtitle_Admin', '_add_admin_styles' ) );
    5555                add_action( 'edit_form_top', array( 'WPSubtitle_Admin', '_add_subtitle_field' ) );
     
    7676
    7777        if ( isset( $_REQUEST['post_type'] ) ) {
    78             return sanitize_text_field( $_REQUEST['post_type'] );
     78            return sanitize_text_field( );
    7979        } elseif ( isset( $_GET['post'] ) ) {
    8080            return get_post_type( absint( $_GET['post'] ) );
    81         } elseif ( in_array( $pagenow, array( 'post-new.php', 'edit.php' ) ) ) {
     81        } elseif ( in_array( $pagenow, array( 'post-new.php', 'edit.php' ) ) ) {
    8282            return 'post';
    8383        }
     
    9494     * @uses  add_action( 'quick_edit_custom_box' )
    9595     *
    96      * @param  string  $column_name  Column name.
    97      * @param  string  $post_type    Post type
     96     * @param  string $column_name  Column name.
     97     * @param  string Post type
    9898     */
    9999    public static function quick_edit_custom_box( $column_name, $post_type ) {
    100100
    101         if ( $column_name !== 'wps_subtitle' ) {
     101        if ( ) {
    102102            return;
    103103        }
     
    107107        ?>
    108108        <fieldset class="inline-edit-col-left inline-edit-col-left-wps-subtitle">
    109             <div class="inline-edit-col column-<?php echo $column_name; ?>">
     109            <div class="inline-edit-col column-">
    110110                <label>
    111111                    <span class="title"><?php esc_html_e( 'Subtitle', 'wp-subtitle' ); ?></span>
     
    123123     * @since  2.4
    124124     *
    125      * @param   array  $columns  A columns
     125     * @param   array $columns  A columns
    126126     * @return  array            Updated columns.
    127127     */
     
    149149        foreach ( $columns as $column => $value ) {
    150150            $new_columns[ $column ] = $value;
    151             if ( $after_column == $column ) {
     151            if ( $after_column == $column ) {
    152152                $new_columns['wps_subtitle'] = $column_name;
    153153            }
     
    163163     * @since  2.4
    164164     *
    165      * @param  string  $column_name  Column name.
    166      * @param  int     $post_id      Post ID
     165     * @param  string $column_name  Column name.
     166     * @param  int    $post_id      Post ID
    167167     */
    168168    public static function manage_subtitle_columns_content( $column_name, $post_id ) {
    169169
    170         if ( $column_name == 'wps_subtitle' ) {
     170        if ( ) {
    171171
    172172            $subtitle = new WP_Subtitle( $post_id );
     
    185185    public static function _add_admin_scripts( $hook ) {
    186186
    187         if ( 'edit.php' != $hook ) {
     187        if ( 'edit.php' != $hook ) {
    188188            return;
    189189        }
    190190
    191         wp_enqueue_script( 'wps_subtitle', plugins_url( 'js/admin-edit.js', __FILE__ ), false, null, true );
     191        wp_enqueue_script( 'wps_subtitle', plugins_url( 'js/admin-edit.js', __FILE__ ), false, , true );
    192192
    193193    }
     
    199199     * @internal
    200200     *
    201      * @param  array  $fields  Revision fields.
     201     * @param  array $fields  Revision fields.
    202202     */
    203203    public static function _wp_post_revision_fields( $fields ) {
     
    214214     * @since  2.9
    215215     *
    216      * @param  int  $post_id      Post ID.
    217      * @param  int  $revision_id  Revision ID.
     216     * @param  int $post_id      Post ID.
     217     * @param  int $revision_id  Revision ID.
    218218     */
    219219    public static function wp_restore_post_revision( $post_id, $revision_id ) {
     
    293293            $positiom = self::gutenberg_supported( $post_type ) ? 'side' : 'normal';
    294294
    295             add_meta_box( 'wps_subtitle_panel',  self::get_meta_box_title( $post_type ), array( 'WPSubtitle_Admin', '_add_subtitle_meta_box' ), $post_type, $positiom, 'high' );
     295            add_meta_box( 'wps_subtitle_panel', self::get_meta_box_title( $post_type ), array( 'WPSubtitle_Admin', '_add_subtitle_meta_box' ), $post_type, $positiom, 'high' );
    296296
    297297        }
     
    313313        $value = self::get_admin_subtitle_value( $post );
    314314
    315         echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . wp_create_nonce( 'wp-subtitle' ) . '" />';
     315        echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . ) . '" />';
    316316
    317317        // As of WordPress 4.3 no need to esc_attr() AND htmlentities().
     
    319319        echo '<input type="text" id="wpsubtitle" name="wps_subtitle" value="' . esc_attr( $value ) . '" autocomplete="off" placeholder="' . esc_attr( apply_filters( 'wps_subtitle_field_placeholder', __( 'Enter subtitle here', 'wp-subtitle' ), $post ) ) . '" style="width:99%;" />';
    320320
    321         echo apply_filters( 'wps_subtitle_field_description', '', $post );
     321        echo );
    322322
    323323    }
     
    338338        $value = self::get_admin_subtitle_value( $post );
    339339
    340         echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . wp_create_nonce( 'wp-subtitle' ) . '" />';
     340        echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . ) . '" />';
    341341        echo '<div id="subtitlediv" class="top">';
    342342        echo '<div id="subtitlewrap">';
     
    351351        $description = apply_filters( 'wps_subtitle_field_description', '', $post );
    352352        if ( ! empty( $description ) ) {
    353             echo '<div id="subtitledescription">' . $description . '</div>';
     353            echo '<div id="subtitledescription">' . . '</div>';
    354354        }
    355355        echo '</div>';
     
    362362     * @internal
    363363     *
    364      * @param   WP_Post  $post  Post object.
     364     * @param   WP_Post $post  Post object.
    365365     * @return  string          Subtitle value.
    366366     */
     
    374374        if ( function_exists( 'get_current_screen' ) && empty( $value ) ) {
    375375            $screen = get_current_screen();
    376             if ( isset( $screen->action ) && 'add' == $screen->action ) {
     376            if ( isset( $screen->action ) && 'add' == $screen->action ) {
    377377                $value = $subtitle->get_default_subtitle( $post );
    378378            }
     
    391391     * @uses  WPSubtitle::get_supported_post_types()
    392392     *
    393      * @param  int  $post_id  Post ID or object.
     393     * @param  int $post_id  Post ID or object.
    394394     */
    395395    public static function _save_post( $post_id ) {
    396396
    397         // Verify if this is an auto save routine. 
     397        // Verify if this is an auto save routine.
    398398        // If it is our form has not been submitted, so we dont want to do anything
    399399        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
     
    409409        if ( isset( $_POST['wps_subtitle'] ) ) {
    410410
    411             $new_value = wp_kses_post( $_POST['wps_subtitle'] );
     411            $new_value = wp_kses_post( );
    412412
    413413            $subtitle = new WP_Subtitle( $post_id );
     
    421421                $subtitle->update_subtitle( $new_value );
    422422            }
    423 
    424423        }
    425424
     
    433432     * @internal
    434433     *
    435      * @param   int  $post_id  Post ID.
     434     * @param   int $post_id  Post ID.
    436435     * @return  bool
    437436     */
     
    452451     * @internal
    453452     *
    454      * @param   string  $nonce   Posted nonce name.
    455      * @param   string  $action  Nonce action.
     453     * @param   string $nonce   Posted nonce name.
     454     * @param   string $action  Nonce action.
    456455     * @return  bool
    457456     */
    458457    private static function _verify_posted_nonce( $nonce, $action ) {
    459         if ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( $_POST[ $nonce ], $action ) ) {
     458        if ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( , $action ) ) {
    460459            return true;
    461460        }
     
    468467     * @since  2.2
    469468     *
    470      * @param   string  $post_type  Post type.
     469     * @param   string $post_type  Post type.
    471470     * @return  bool
    472471     */
     
    485484     * @since  3.1
    486485     *
    487      * @param   string  $post_type  Post type.
     486     * @param   string $post_type  Post type.
    488487     * @return  bool
    489488     */
     
    503502     * @since  3.1
    504503     *
    505      * @param  string $post_type  Post type.
    506      * @param  string              Position.
     504     * @param  $post_type  Post type.
     505     * @  string              Position.
    507506     */
    508507    private static function subtitle_field_position( $post_type = '' ) {
  • wp-subtitle/trunk/plugin/admin/js/admin-edit.js

    r2151217 r2713270  
    99    // propagation to all other event handlers; swap it out.
    1010    inlineEditPost.editPreWpSubtitle = inlineEditPost.edit;
    11     inlineEditPost.edit = function ( id ) {
     11    inlineEditPost.edit = function ( id ) {
    1212
    1313        // Invoke original edit event handler.
     
    3636    }
    3737
    38 } ) ( jQuery, inlineEditPost );
     38} )( jQuery, inlineEditPost );
  • wp-subtitle/trunk/plugin/admin/js/pointers.js

    r2151217 r2713270  
    1 
    21/**
    32 * @package     WP Subtitle
     
    54 */
    65
    7 jQuery( document ).ready( function( $ ) {
     6jQuery( document ).ready(
     7    function( $ ) {
    88
    9     function wps_subtitle_open_pointer( i ) {
    10         pointer = wpsSubtitlePointer.pointers[ i ];
    11         options = $.extend( pointer.options, {
    12             close : function() {
    13                 $.post( ajaxurl, {
    14                     pointer : pointer.pointer_id,
    15                     action  : 'dismiss-wp-pointer'
    16                 } );
    17             }
    18         });
     9        function wps_subtitle_open_pointer( i ) {
     10            pointer = wpsSubtitlePointer.pointers[ i ];
     11            options = $.extend(
     12                pointer.options,
     13                {
     14                    close : function() {
     15                        $.post(
     16                            ajaxurl,
     17                            {
     18                                pointer : pointer.pointer_id,
     19                                action  : 'dismiss-wp-pointer'
     20                            }
     21                        );
     22                    }
     23                }
     24            );
    1925
    20         $( pointer.target ).pointer( options ).pointer( 'open' );
     26            $( pointer.target ).pointer( options ).pointer( 'open' );
     27        }
     28
     29        wps_subtitle_open_pointer( 0 );
     30
    2131    }
    22 
    23     wps_subtitle_open_pointer( 0 );
    24 
    25 } );
     32);
  • wp-subtitle/trunk/plugin/admin/pointers.php

    r2151217 r2713270  
    3232     * @internal
    3333     *
    34      * @param   string  $hook_suffix  Page hook.
     34     * @param   string $hook_suffix  Page hook.
    3535     */
    3636    public static function _pointer_load( $hook_suffix ) {
     
    5555        // Enqueue pointer scripts and styles.
    5656        wp_enqueue_style( 'wp-pointer' );
    57         wp_enqueue_script( 'wps-subtitle-pointer', plugins_url( 'js/pointers.js', __FILE__ ), array( 'wp-pointer' ) );
     57        wp_enqueue_script( 'wps-subtitle-pointer', plugins_url( 'js/pointers.js', __FILE__ ), array( 'wp-pointer' ) );
    5858        wp_localize_script( 'wps-subtitle-pointer', 'wpsSubtitlePointer', $valid_pointers );
    5959
     
    7272    private static function get_current_pointers() {
    7373
    74         $screen = get_current_screen();
     74        $screen = get_current_screen();
    7575        $pointers = apply_filters( 'wps_subtitle_admin_pointers-' . $screen->id, array() );
    7676
     
    9090     * @internal
    9191     *
    92      * @param   array  $pointers  Pointers.
     92     * @param   array $pointers  Pointers.
    9393     * @return  array             Active pointers.
    9494     */
    9595    private static function remove_dismissed_pointers( $pointers ) {
    9696
    97         $dismissed = self::get_dismissed_pointers();
     97        $dismissed = self::get_dismissed_pointers();
    9898        $valid_pointers = array();
    9999
     
    102102
    103103            // Sanity check
    104             if ( in_array( $pointer_id, $dismissed ) || empty( $pointer )  || empty( $pointer_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) {
     104            if ( in_array( $pointer_id, $dismissed ) || empty( $pointer ) || empty( $pointer_id ) || empty( $pointer['target'] ) || empty( $pointer['options'] ) ) {
    105105                continue;
    106106            }
     
    137137     * @internal
    138138     *
    139      * @param   array  $pointers  Pointers.
     139     * @param   array $pointers  Pointers.
    140140     * @return  array             Pointers.
    141141     */
     
    146146            'target'  => '#subtitlewrap',
    147147            'options' => array(
    148                 'content' => sprintf( '<h3>%s</h3><p>%s</p>',
     148                'content'  => sprintf(
     149                    '<h3>%s</h3><p>%s</p>',
    149150                    sprintf( __( '%s Field', 'wp-subtitle' ), WPSubtitle_Admin::get_meta_box_title( get_post_type( get_queried_object_id() ) ) ),
    150151                    __( 'This field has moved from a meta box to below the post title.', 'wp-subtitle' )
     
    152153                'position' => array(
    153154                    'edge'  => 'top',
    154                     'align' => 'middle'
    155                 )
    156             )
     155                    'align' => 'middle'
     156                )
     157            )
    157158        );
    158159
  • wp-subtitle/trunk/plugin/includes/class-api.php

    r2151217 r2713270  
    2323 */
    2424
    25 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     25if ( ! defined( 'ABSPATH' ) ) {
     26    exit; // Exit if accessed directly
     27}
    2628
    2729class WP_Subtitle_API {
     
    4042     * The Subtitle
    4143     *
    42      * @param  array  $args  Display args.
     44     * @param  array $args  Display args.
    4345     *
    4446     * @internal  Private. Called via the `the_subtitle` action.
     
    4850        $default_value = isset( $args['default_value'] ) ? $args['default_value'] : '';
    4951
    50         echo $this->get_subtitle( $default_value, $args );
     52        echo );
    5153
    5254    }
     
    5557     * Get Subtitle
    5658     *
    57      * @param   string  $default_subtitle  Default/fallback subtitle.
    58      * @param   array   $args              Display args.
     59     * @param   string $default_subtitle  Default/fallback subtitle.
     60     * @param   array  $args              Display args.
    5961     * @return  string                     The subtitle.
    6062     *
     
    6365    public function get_subtitle( $default_subtitle, $args = '' ) {
    6466
    65         $args = wp_parse_args( $args, array(
    66             'post_id' => get_the_ID(),  // Post ID
    67             'before'  => '',            // Before subtitle HTML output
    68             'after'   => ''             // After subtitle HTML output
    69         ) );
     67        $args = wp_parse_args(
     68            $args,
     69            array(
     70                'post_id' => get_the_ID(),  // Post ID
     71                'before'  => '',            // Before subtitle HTML output
     72                'after'   => '',             // After subtitle HTML output
     73            )
     74        );
    7075
    7176        $subtitle_obj = new WP_Subtitle( $args['post_id'] );
    72         $subtitle = $subtitle_obj->get_subtitle( $args );
     77        $subtitle = $subtitle_obj->get_subtitle( $args );
    7378
    7479        if ( ! empty( $subtitle ) ) {
  • wp-subtitle/trunk/plugin/includes/compat/seopress.php

    r2240907 r2713270  
    5151     * @since  3.4
    5252     *
    53      * @param    array  $replacements  SEO replacements variables.
     53     * @param    array $replacements  SEO replacements variables.
    5454     * @return   array                 Filtered replacements variables.
    5555     *
     
    7171     * @since  3.4
    7272     *
    73      * @param    array  $replacements  SEO replacements values.
     73     * @param    array $replacements  SEO replacements values.
    7474     * @return   array                 Filtered replacements values.
    7575     *
     
    8181
    8282        $wp_subtitle = new WP_Subtitle( $post );
    83         $subtitle = $wp_subtitle->get_subtitle();
     83        $subtitle = $wp_subtitle->get_subtitle();
    8484
    8585        $replacements[] = $subtitle;
     
    8888
    8989        $before_sep = '';
    90         $after_sep = '';
     90        $after_sep = '';
    9191
    9292        if ( ! empty( $subtitle ) ) {
    9393
    9494            $before_sep = apply_filters( 'wps_subtitle_seo_before_sep', $sep );
    95             $after_sep = apply_filters( 'wps_subtitle_seo_after_sep', $sep );
     95            $after_sep = apply_filters( 'wps_subtitle_seo_after_sep', $sep );
    9696
    9797        }
  • wp-subtitle/trunk/plugin/includes/compat/woocommerce.php

    r2235496 r2713270  
    2222    public function __construct() {
    2323
    24         if ( 'yes' == get_option( 'wp_subtitle_woocommerce_enabled' ) ) {
     24        if ( 'yes' == get_option( 'wp_subtitle_woocommerce_enabled' ) ) {
    2525
    2626            add_action( 'init', array( $this, 'add_product_post_type_support' ) );
    2727
    28             if ( 'yes' == get_option( 'wp_subtitle_woocommerce_show_on_single' ) ) {
    29                 add_action( 'woocommerce_single_product_summary' , array( $this, 'single_product_summary' ), 6 );
     28            if ( 'yes' == get_option( 'wp_subtitle_woocommerce_show_on_single' ) ) {
     29                add_action( 'woocommerce_single_product_summary', array( $this, 'single_product_summary' ), 6 );
    3030            }
    3131
    32             if ( 'yes' == get_option( 'wp_subtitle_woocommerce_show_in_loop' ) ) {
    33                 add_action( 'woocommerce_shop_loop_item_title' , array( $this, 'shop_loop_item_title' ) );
     32            if ( 'yes' == get_option( 'wp_subtitle_woocommerce_show_in_loop' ) ) {
     33                add_action( 'woocommerce_shop_loop_item_title', array( $this, 'shop_loop_item_title' ) );
    3434            }
    35 
    3635        }
    3736
    38         add_filter( 'woocommerce_product_settings' , array( $this, 'product_settings' ) );
     37        add_filter( 'woocommerce_product_settings', array( $this, 'product_settings' ) );
    3938
    4039    }
     
    6261    public function single_product_summary() {
    6362
    64         do_action( 'plugins/wp_subtitle/the_subtitle', array(
    65             'before' => '<h2 class="product_subtitle entry-subtitle wp-subtitle">',
    66             'after'  => '</h2>'
    67         ) );
     63        do_action(
     64            'plugins/wp_subtitle/the_subtitle',
     65            array(
     66                'before' => '<h2 class="product_subtitle entry-subtitle wp-subtitle">',
     67                'after'  => '</h2>',
     68            )
     69        );
    6870
    6971    }
     
    7880    public function shop_loop_item_title() {
    7981
    80         do_action( 'plugins/wp_subtitle/the_subtitle', array(
    81             'before' => '<p class="woocommerce-loop-product__subtitle wp-subtitle">',
    82             'after'  => '</p>'
    83         ) );
     82        do_action(
     83            'plugins/wp_subtitle/the_subtitle',
     84            array(
     85                'before' => '<p class="woocommerce-loop-product__subtitle wp-subtitle">',
     86                'after'  => '</p>',
     87            )
     88        );
    8489
    8590    }
     
    9095     * @since  3.1
    9196     *
    92      * @param   array  $settings  Settings.
     97     * @param   array $settings  Settings.
    9398     * @return  array             Settings.
    9499     *
     
    103108                'type'  => 'title',
    104109                'desc'  => '',
    105                 'id'    => 'wp_subtitle_options'
     110                'id'    => 'wp_subtitle_options'
    106111            ),
    107112
     
    120125                'default'       => 'yes',
    121126                'type'          => 'checkbox',
    122                 'checkboxgroup' => 'start'
     127                'checkboxgroup' => 'start'
    123128            ),
    124129
     
    128133                'default'       => 'yes',
    129134                'type'          => 'checkbox',
    130                 'checkboxgroup' => 'end'
     135                'checkboxgroup' => 'end'
    131136            ),
    132137
    133138            array(
    134139                'type' => 'sectionend',
    135                 'id'   => 'wp_subtitle_options'
    136             )
     140                'id'   => 'wp_subtitle_options'
     141            )
    137142
    138143        );
  • wp-subtitle/trunk/plugin/includes/compat/wordpress-seo.php

    r2151217 r2713270  
    5050     * @since  3.1
    5151     *
    52      * @param    array  $replacements  SEO replacements.
     52     * @param    array $replacements  SEO replacements.
    5353     * @return   array                 Filtered replacements.
    5454     *
     
    6060
    6161        $wp_subtitle = new WP_Subtitle( $post );
    62         $subtitle = $wp_subtitle->get_subtitle();
     62        $subtitle = $wp_subtitle->get_subtitle();
    6363
    64         $replacements['%%wps_subtitle%%'] = $subtitle;
     64        $replacements['%%wps_subtitle%%'] = $subtitle;
    6565        $replacements['%%wps_subtitle_before_sep%%'] = '';
    66         $replacements['%%wps_subtitle_after_sep%%'] = '';
     66        $replacements['%%wps_subtitle_after_sep%%'] = '';
    6767
    6868        if ( ! empty( $subtitle ) ) {
     
    7171
    7272            $replacements['%%wps_subtitle_before_sep%%'] = apply_filters( 'wps_subtitle_seo_before_sep', $sep );
    73             $replacements['%%wps_subtitle_after_sep%%'] = apply_filters( 'wps_subtitle_seo_after_sep', $sep );
     73            $replacements['%%wps_subtitle_after_sep%%'] = apply_filters( 'wps_subtitle_seo_after_sep', $sep );
    7474
    7575        }
  • wp-subtitle/trunk/plugin/includes/deprecated.php

    r2151217 r2713270  
    1414 * @uses  WP_Subtitle::get_subtitle()
    1515 *
    16  * @param   string  $before  Before the subtitle.
    17  * @param   string  $after   After the subtitle.
    18  * @param   bool    $echo    Output if true, return if false.
     16 * @param   string $before  Before the subtitle.
     17 * @param   string $after   After the subtitle.
     18 * @param   bool   $echo    Output if true, return if false.
    1919 * @return  string           The subtitle string.
    2020 */
     
    2323    if ( ! $echo ) {
    2424
    25         return apply_filters( 'plugins/wp_subtitle/get_subtitle', '', array(
    26             'before' => $before,
    27             'after'  => $after
    28         ) );
     25        return apply_filters(
     26            'plugins/wp_subtitle/get_subtitle',
     27            '',
     28            array(
     29                'before' => $before,
     30                'after'  => $after,
     31            )
     32        );
    2933
    3034    }
    3135
    32     do_action( 'plugins/wp_subtitle/the_subtitle', array(
    33         'before' => $before,
    34         'after'  => $after
    35     ) );
     36    do_action(
     37        'plugins/wp_subtitle/the_subtitle',
     38        array(
     39            'before' => $before,
     40            'after'  => $after,
     41        )
     42    );
    3643
    3744}
     
    4552 * @uses  WP_Subtitle::get_subtitle()
    4653 *
    47  * @param   int|object  $post    Post ID or object.
    48  * @param   string      $before  Before the subtitle.
    49  * @param   string      $after   After the subtitle.
    50  * @param   bool        $echo    Output if true, return if false.
     54 * @param   int|object $post    Post ID or object.
     55 * @param   string     $before  Before the subtitle.
     56 * @param   string     $after   After the subtitle.
     57 * @param   bool       $echo    Output if true, return if false.
    5158 * @return  string               The subtitle string.
    5259 */
    5360function get_the_subtitle( $post = 0, $before = '', $after = '', $echo = true ) {
    5461
    55     $output = apply_filters( 'plugins/wp_subtitle/get_subtitle', '', array(
    56         'post_id' => is_a( $post, 'WP_Post' ) ? $post->ID : $post,
    57         'before' => $before,
    58         'after'  => $after
    59     ) );
     62    $output = apply_filters(
     63        'plugins/wp_subtitle/get_subtitle',
     64        '',
     65        array(
     66            'post_id' => is_a( $post, 'WP_Post' ) ? $post->ID : $post,
     67            'before'  => $before,
     68            'after'   => $after,
     69        )
     70    );
    6071
    6172    if ( ! $echo ) {
     
    6374    }
    6475
    65     echo $output;
     76    echo ;
    6677
    6778}
     
    128139 * @since  1.0
    129140 * @deprecated  2.0  Legacy function.
     141
     142
    130143 */
    131144function wps_saveSubtitle( $post_id ) {
  • wp-subtitle/trunk/plugin/includes/rest.php

    r2240907 r2713270  
    3636        foreach ( $post_types as $post_type ) {
    3737
    38             register_rest_field( $post_types, 'wps_subtitle', array(
    39                 'get_callback'    => array( $this, 'get_rest_field' ),
    40                 'update_callback' => array( $this, 'update_rest_field' ),
    41                 'schema'          => null
    42             ) );
     38            register_rest_field(
     39                $post_types,
     40                'wps_subtitle',
     41                array(
     42                    'get_callback'    => array( $this, 'get_rest_field' ),
     43                    'update_callback' => array( $this, 'update_rest_field' ),
     44                    'schema'          => null,
     45                )
     46            );
    4347
    4448        }
     
    5357     * @internal  Called via register_rest_field() callback.
    5458     *
    55      * @param   array            $object      Current post details.
    56      * @param   string           $field_name  Name of field.
    57      * @param   WP_REST_Request  $request     Current request.
     59     * @param   array           $object      Current post details.
     60     * @param   string          $field_name  Name of field.
     61     * @param   WP_REST_Request $request     Current request.
    5862     * @return  string                        Subtitle
    5963     */
     
    7377     * @internal  Called via register_rest_field() callback.
    7478     *
    75      * @param  string  $value   New value for the field.
    76      * @param  array   $object  Current post details.
     79     * @param  string $value   New value for the field.
     80     * @param  array  $object  Current post details.
    7781     */
    7882    public function update_rest_field( $value, $object ) {
  • wp-subtitle/trunk/plugin/includes/shortcode.php

    r2151217 r2713270  
    1616     * e.g. [wp_subtitle]Fallback Subtitle[/wp_subtitle]
    1717     *
    18      * @param   array   $atts     Shortcode attributes.
    19      * @param   string  $content  Fallback content (content between the shortcode tags).
     18     * @param   array  $atts     Shortcode attributes.
     19     * @param   string $content  Fallback content (content between the shortcode tags).
    2020     * @return  string            Subtitle HTML.
    2121     */
     
    2424        global $post;
    2525
    26         $atts = shortcode_atts( array(
    27             'tag'    => self::get_default_tag(),
    28             'before' => '',
    29             'after'  => ''
    30         ), $atts, 'wp_subtitle' );
     26        $atts = shortcode_atts(
     27            array(
     28                'tag'    => self::get_default_tag(),
     29                'before' => '',
     30                'after'  => '',
     31            ),
     32            $atts,
     33            'wp_subtitle'
     34        );
    3135
    3236        // Get HTML tag
    3337        if ( ! empty( $atts['tag'] ) ) {
    34             $tag = self::validate_tag( $atts['tag'] );
     38            $tag = self::validate_tag( $atts['tag'] );
    3539            $before = sprintf( '<%s class="wp-subtitle">', $tag );
    36             $after = sprintf( '</%s>', $tag );
     40            $after = sprintf( '</%s>', $tag );
    3741        } else {
    3842            $before = '';
    39             $after = '';
     43            $after = '';
    4044        }
    4145
    4246        // Add before/after content
    4347        $before .= self::format_subtitle_content( $atts['before'], 'before' );
    44         $after = self::format_subtitle_content( $atts['after'], 'after' ) . $after;
     48        $after = self::format_subtitle_content( $atts['after'], 'after' ) . $after;
    4549
    4650        $subtitle = new WP_Subtitle( $post );
    4751
    48         return $subtitle->get_subtitle( array(
    49             'before' => $before,
    50             'after'  => $after
    51         ) );
     52        return $subtitle->get_subtitle(
     53            array(
     54                'before' => $before,
     55                'after'  => $after,
     56            )
     57        );
    5258
    5359    }
     
    8995     * @internal
    9096     *
    91      * @param   string  $tag  Tag to validate.
     97     * @param   string $tag  Tag to validate.
    9298     * @return  string        Validated tag.
    9399     */
    94100    private static function validate_tag( $tag ) {
    95101
    96         if ( ! in_array( $tag, self::get_allowed_tags() ) ) {
     102        if ( ! in_array( $tag, self::get_allowed_tags() ) ) {
    97103            $tag = self::get_default_tag();
    98104        }
     
    108114     * @internal
    109115     *
    110      * @param   string  $content  Content.
    111      * @param   string  $type     Content type.
     116     * @param   string $content  Content.
     117     * @param   string $type     Content type.
    112118     * @return  string            HTML formatted content.
    113119     */
  • wp-subtitle/trunk/plugin/includes/subtitle.php

    r2151217 r2713270  
    1818     * Constructor
    1919     *
    20      * @param  int|WP_Post  $post  Post object or ID.
     20     * @param  int|WP_Post $post  Post object or ID.
    2121     */
    2222    public function __construct( $post ) {
     
    3434     * The Subtitle
    3535     *
    36      * @param  array  $args  Display parameters.
     36     * @param  array $args  Display parameters.
    3737     */
    3838    public function the_subtitle( $args = '' ) {
    3939
    40         echo $this->get_subtitle( $args );
     40        echo );
    4141
    4242    }
     
    4747     * @uses  apply_filters( 'wps_subtitle' )
    4848     *
    49      * @param   array   $args  Display parameters.
     49     * @param   array $args  Display parameters.
    5050     * @return  string         The filtered subtitle meta value.
    5151     */
     
    5454        if ( $this->post_id && $this->is_supported_post_type() ) {
    5555
    56             $args = wp_parse_args( $args, array(
    57                 'before' => '',
    58                 'after'  => ''
    59             ) );
     56            $args = wp_parse_args(
     57                $args,
     58                array(
     59                    'before' => '',
     60                    'after'  => '',
     61                )
     62            );
    6063
    6164            $subtitle = apply_filters( 'wps_subtitle', $this->get_raw_subtitle(), get_post( $this->post_id ) );
     
    8386
    8487            if ( isset( $_GET['preview_id'] ) ) {
    85                 $p =  wp_get_post_autosave( $this->post_id );
     88                $p = wp_get_post_autosave( $this->post_id );
    8689                return get_post_meta( $p->ID, $this->get_post_meta_key(), true );
    8790            }
    8891
    89             if ( $revisions = wp_get_post_revisions( $this->post_id ) ) {
     92            $revisions = wp_get_post_revisions( $this->post_id );
     93
     94            if ( $revisions ) {
    9095                $p = array_shift( $revisions );
    9196                return get_post_meta( $p->ID, $this->get_post_meta_key(), true );
    9297            }
    93 
    9498        }
    9599
     
    114118     * Update Subtitle
    115119     *
    116      * @param   string    $subtitle  Subtitle.
     120     * @param   string $subtitle  Subtitle.
    117121     * @return  int|bool             Meta ID if new entry. True if updated, false if not updated or the same as current value.
    118122     */
     
    129133     * @since  2.9
    130134     *
    131      * @param   string   $subtitle  Subtitle value.
     135     * @param   string $subtitle  Subtitle value.
    132136     * @return  boolean
    133137     */
    134138    public function is_current_subtitle( $subtitle ) {
    135139
    136         return $subtitle === get_metadata( 'post', $this->post_id, 'wps_subtitle', true );
     140        return ;
    137141
    138142    }
     
    156160     * @since  2.9
    157161     *
    158      * @param  int  $revision_id  Revision ID.
     162     * @param  int $revision_id  Revision ID.
    159163     */
    160164    public function restore_post_revision( $revision_id ) {
     
    179183        $post_types = $this->get_supported_post_types();
    180184
    181         return in_array( get_post_type( $this->post_id ), $post_types );
     185        return in_array( get_post_type( $this->post_id ), $post_types );
    182186
    183187    }
     
    192196    private function get_supported_post_types() {
    193197
    194         $post_types = (array) get_post_types( array(
    195             '_builtin' => false
    196         ) );
     198        $post_types = (array) get_post_types(
     199            array(
     200                '_builtin' => false,
     201            )
     202        );
    197203
    198204        $post_types = array_merge( $post_types, array( 'post', 'page', 'revision' ) );
     
    223229
    224230            $post_type = get_post_type( $this->post_id );
    225 
    226             if ( $revision = wp_is_post_revision( $this->post_id ) ) {
     231            $revision  = wp_is_post_revision( $this->post_id );
     232
     233            if ( $revision ) {
    227234                $post_type = get_post_type( $revision );
    228235            }
     
    241248                // ... edit other post type
    242249                default:
    243 
    244                     $post_types = (array) get_post_types( array(
    245                         '_builtin' => false
    246                     ), 'objects' );
     250                    $post_types = (array) get_post_types(
     251                        array(
     252                            '_builtin' => false,
     253                        ),
     254                        'objects'
     255                    );
    247256
    248257                    return current_user_can( $post_types[ $post_type ]->cap->edit_post, $this->post_id );
    249258
    250259            }
    251 
    252260        }
    253261
  • wp-subtitle/trunk/plugin/plugin.php

    r2240907 r2713270  
    1313
    1414// Includes
    15 include_once( WPSUBTITLE_DIR . 'includes/class-api.php' );
    16 include_once( WPSUBTITLE_DIR . 'includes/subtitle.php' );
    17 include_once( WPSUBTITLE_DIR . 'includes/deprecated.php' );
    18 include_once( WPSUBTITLE_DIR . 'includes/shortcode.php' );
    19 include_once( WPSUBTITLE_DIR . 'includes/rest.php' );
    20 include_once( WPSUBTITLE_DIR . 'includes/compat/wordpress-seo.php' );
    21 include_once( WPSUBTITLE_DIR . 'includes/compat/seopress.php' );
    22 include_once( WPSUBTITLE_DIR . 'includes/compat/woocommerce.php' );
     15;
     16;
     17;
     18;
     19;
     20;
     21;
     22;
    2323
    2424// Include admin-only functionality
    2525if ( is_admin() ) {
    26     require_once( WPSUBTITLE_DIR . 'admin/admin.php' );
     26    require_once;
    2727    if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
    2828        // Load AJAX functions here if required...
    2929    } else {
    30         require_once( WPSUBTITLE_DIR . 'admin/pointers.php' );
     30        require_once;
    3131    }
    3232}
     
    9191    public static function load() {
    9292
    93         self::$api = new WP_Subtitle_API();
    94         self::$rest = new WPSubtitle_REST();
    95         self::$wpseo = new WPSubtitle_WPSEO();
    96         self::$seopress = new WPSubtitle_SEOPress();
     93        self::$api = new WP_Subtitle_API();
     94        self::$rest = new WPSubtitle_REST();
     95        self::$wpseo = new WPSubtitle_WPSEO();
     96        self::$seopress = new WPSubtitle_SEOPress();
    9797        self::$woocommerce = new WPSubtitle_WooCommerce();
    9898
     
    123123     */
    124124    public static function get_supported_post_types() {
    125         $post_types = (array) get_post_types( array(
    126             '_builtin' => false
    127         ) );
     125        $post_types = (array) get_post_types(
     126            array(
     127                '_builtin' => false,
     128            )
     129        );
    128130        $post_types = array_merge( $post_types, array( 'post', 'page', 'revision' ) );
    129         $supported = array();
     131        $supported = array();
    130132        foreach ( $post_types as $post_type ) {
    131133            if ( post_type_supports( $post_type, 'wps_subtitle' ) ) {
     
    141143     * @since  2.3
    142144     *
    143      * @param   string   $post_type  Post Type.
     145     * @param   string $post_type  Post Type.
    144146     * @return  boolean
    145147     */
    146148    public static function is_supported_post_type( $post_type ) {
    147149        $post_types = self::get_supported_post_types();
    148         if ( in_array( $post_type, $post_types ) ) {
     150        if ( in_array( $post_type, $post_types ) ) {
    149151            return true;
    150152        }
     
    159161     * @uses  WP_Subtitle::get_subtitle()
    160162     *
    161      * @param   int|object  $post  Post ID or object.
     163     * @param   int|object $post  Post ID or object.
    162164     * @return  string             The filtered subtitle meta value.
    163165     */
     
    178180     * @uses  WP_Subtitle::get_raw_subtitle()
    179181     *
    180      * @param   int|object  $post  Post ID or object.
     182     * @param   int|object $post  Post ID or object.
    181183     * @return  string             The subtitle meta value.
    182184     */
     
    195197     * @internal
    196198     *
    197      * @param   int     $post  Post ID.
     199     * @param   int   Post ID.
    198200     * @return  string         The subtitle meta key.
    199201     */
  • wp-subtitle/trunk/wp-subtitle.php

    r2712645 r2713270  
    3232*/
    3333
    34 require_once( plugin_dir_path( __FILE__ ) . 'plugin/plugin.php' );
     34require_once;
Note: See TracChangeset for help on using the changeset viewer.