Plugin Directory

Changeset 3402937


Ignore:
Timestamp:
11/26/2025 01:12:56 AM (3 weeks ago)
Author:
NodleRedoy
Message:

Release version 2.2.7

Location:
simple-post-template
Files:
62 added
13 edited

Legend:

Unmodified
Added
Removed
  • simple-post-template/trunk/admin/class-advanced-content-templates-admin.php

    r2806059 r3402937  
    11<?php
     2
     3// Prevent direct access
     4if ( ! defined( 'ABSPATH' ) ) {
     5    exit;
     6}
    27
    38/**
     
    5459     *
    5560     * @since    1.0.0
    56      * @param      string    $plugin_name       The name of this plugin.
    57      * @param      string    $version    The version of this plugin.
     61     * @param      string $plugin_name       The name of this plugin.
     62     * @param      string $version    The version of this plugin.
    5863     */
    5964    public function __construct( $plugin_name, $version, $plugin ) {
    6065
    61         $this->plugin_name  = $plugin_name;
    62         $this->version = $version;
    63         $this->plugin = $plugin;
    64 
     66        $this->plugin_name = $plugin_name;
     67        $this->version     = $version;
     68        $this->plugin      = $plugin;
    6569    }
    6670
     
    8488         */
    8589
    86         //wp_enqueue_style( $this->plugin_name , plugin_dir_url( __FILE__ ) . 'css/advanced-content-templates-admin.css', array(), $this->version, 'all' );
    87 
     90        // wp_enqueue_style( $this->plugin_name , plugin_dir_url( __FILE__ ) . 'css/advanced-content-templates-admin.css', array(), $this->version, 'all' );
    8891    }
    8992
     
    107110         */
    108111
    109         //wp_enqueue_script( $this->plugin_name , plugin_dir_url( __FILE__ ) . 'js/advanced-content-templates-admin.js', array( 'jquery' ), $this->version, false );
    110 
     112        // wp_enqueue_script( $this->plugin_name , plugin_dir_url( __FILE__ ) . 'js/advanced-content-templates-admin.js', array( 'jquery' ), $this->version, false );
    111113    }
    112114
     
    121123        global $wp_tabbed_navigation;
    122124
    123         add_submenu_page( "edit.php?post_type={$this->plugin->post_type}", "Simple Content Templates Settings", "Settings", "manage_options", "sct-settings", array($this, 'admin_settings_page') );
    124         add_submenu_page("edit.php?post_type={$this->plugin->post_type}", "Simple Content Templates Upgrade", "Upgrade", "manage_options", "sct-upgrade", array($this, 'admin_upgrade_page') );
    125 
    126         $wp_tabbed_navigation = new WP_Tabbed_Navigation('Simple Content Templates Settings');
    127 
    128         $wp_tabbed_navigation->add_tab('Settings', menu_page_url('sct-settings', false) );
    129         $wp_tabbed_navigation->add_tab('Upgrade', menu_page_url('sct-upgrade', false ) );
     125        add_submenu_page( 'edit.php?post_type=' . sanitize_key( $this->plugin->post_type ), 'Simple Content Templates Settings', 'Settings', 'manage_options', 'sct-settings', array( $this, 'admin_settings_page' ) );
     126        add_submenu_page( 'edit.php?post_type=' . sanitize_key( $this->plugin->post_type ), 'Simple Content Templates Upgrade', 'Upgrade', 'manage_options', 'sct-upgrade', array( $this, 'admin_upgrade_page' ) );
     127
     128        $wp_tabbed_navigation = new WP_Tabbed_Navigation( 'Simple Content Templates Settings' );
     129
     130        $wp_tabbed_navigation->add_tab( 'Settings', menu_page_url( 'sct-settings', false ) );
     131        $wp_tabbed_navigation->add_tab( 'Upgrade', menu_page_url( 'sct-upgrade', false ) );
    130132    }
    131133
     
    137139     */
    138140    function admin_settings_page() {
    139         include_once('partials/advanced-content-templates-admin-display.php');
     141        include_once 'partials/advanced-content-templates-admin-display.php';
    140142    }
    141143
    142144    /**
    143145     * admin_upgrade_page function
     146     *
    144147     * @return void
    145148     */
    146149    function admin_upgrade_page() {
    147         include_once('partials/advanced-content-templates-admin-upgrade.php');
     150        include_once 'partials/advanced-content-templates-admin-upgrade.php';
    148151    }
    149152
     
    155158     */
    156159    function boxes() {
    157         $settings = $this->plugin->get_setting('act_post_type_settings');
    158 
    159         if ( empty($settings) || ! is_array($settings) ) return;
    160 
    161         foreach($settings as $post_type => $s) {
    162             if( isset($s['show_ui']) && $s['show_ui'] == "true") {
    163                 add_meta_box( 'act_side_car_' . $post_type, 'Simple Content Templates', array($this, 'render_side_car'), $post_type, 'side', 'high');
     160        $settings = $this->plugin->get_setting( 'act_post_type_settings' );
     161
     162        if ( empty( $settings ) || ! is_array( $settings ) ) {
     163return;
     164        }
     165
     166        foreach ( $settings as $post_type => $s ) {
     167            if ( isset( $s['show_ui'] ) && $s['show_ui'] == 'true' ) {
     168                add_meta_box( 'act_side_car_' . sanitize_key( $post_type ), 'Simple Content Templates', array( $this, 'render_side_car' ), sanitize_key( $post_type ), 'side', 'high' );
    164169            }
    165170        }
     
    173178     */
    174179    function render_side_car() {
    175         include_once('partials/advanced-content-templates-admin-sidecar.php');
     180        include_once 'partials/advanced-content-templates-admin-sidecar.php';
    176181    }
    177182
     
    182187     * @return void
    183188     */
    184     function page_template_box()  {
     189    function page_template_box() {
    185190        global $post;
    186191
    187         if($post->post_type == $this->plugin->post_type)
    188             add_meta_box( 'act_template_side_car', 'Template', array($this, 'render_template_side_car'), $this->plugin->post_type, 'side', 'high');
     192        if ( $post->post_type == $this->plugin->post_type ) {
     193            add_meta_box( 'act_template_side_car', 'Template', array( $this, 'render_template_side_car' ), sanitize_key( $this->plugin->post_type ), 'side', 'high' );
     194        }
    189195    }
    190196
     
    198204        global $post;
    199205
    200         if ( 0 != count( get_page_templates() ) ):
    201             $template = get_post_meta($post->ID, '_wp_page_template', true);
    202             if( empty($template) ) $template = false;
    203             ?>
     206        if ( 0 != count( get_page_templates() ) ) :
     207            $template = get_post_meta( $post->ID, '_wp_page_template', true );
     208            if ( empty( $template ) ) {
     209$template = false;
     210            }
     211            ?>
    204212
    205213            <select name="page_template" id="page_template">
    206                 <option value='default'><?php _e('Default Template'); ?></option>
    207                 <?php page_template_dropdown($template); ?>
     214                <option value="default"><?php esc_html_e( 'Default Template', 'simple-post-template' ); ?></option>
     215                <?php page_template_dropdown( $template ); ?>
    208216            </select>
    209217
     
    220228     * @return void
    221229     */
    222     function save_template($post_id) {
    223         if ($parent_id = wp_is_post_revision($post_id))
     230    function save_template( $post_id ) {
     231        if ( $parent_id = wp_is_post_revision( $post_id ) ) {
    224232            $post_id = $parent_id;
    225 
    226         $template = get_post($parent_id);
    227 
    228         if ( !is_object($template) ) return;
    229 
    230         if( $template->post_type == $this->plugin->post_type && isset($_REQUEST['page_template']) ) {
    231 
    232             if($_REQUEST['page_template'] !== 'default' ) {
    233                 update_post_meta($parent_id, '_wp_page_template', $_REQUEST['page_template']);
    234             } else {
    235                 delete_post_meta($parent_id, '_wp_page_template');
    236             }
     233        }
     234
     235        $template = get_post( $parent_id );
     236
     237        if ( ! is_object( $template ) ) {
     238return;
     239        }
     240
     241        // Check if we should process page template (use POST consistently)
     242        if ( $template->post_type != $this->plugin->post_type || ! isset( $_POST['page_template'] ) ) {
     243            return;
     244        }
     245
     246        // Verify nonce before saving page template
     247        if ( ! isset( $_POST['act_page_template_nonce'] ) ||
     248             ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['act_page_template_nonce'] ) ), 'act_save_page_template' ) ) {
     249            return; // Silently fail to maintain compatibility
     250        }
     251
     252        // Sanitize and process page template
     253        $page_template = sanitize_text_field( wp_unslash( $_POST['page_template'] ) );
     254
     255        if ( $page_template !== 'default' ) {
     256            update_post_meta( $parent_id, '_wp_page_template', $page_template );
     257        } else {
     258            delete_post_meta( $parent_id, '_wp_page_template' );
     259        }
     260    }
     261
     262    /**
     263     * Add nonce field for page template saving
     264     *
     265     * @access public
     266     * @return void
     267     */
     268    public function add_template_nonce_field() {
     269        global $post;
     270        if ( $post && $post->post_type == $this->plugin->post_type ) {
     271            wp_nonce_field( 'act_save_page_template', 'act_page_template_nonce' );
    237272        }
    238273    }
     
    246281     */
    247282    function redirect_on_first_activate() {
    248         if( $this->plugin->get_setting('act_first_activate', false) ) {
    249             $this->plugin->delete_setting('act_first_activate');
    250             wp_redirect( admin_url("edit.php?post_type={$this->plugin->post_type}&page=sct-settings") );
     283        if ( $this->plugin->get_setting( 'act_first_activate', false ) ) {
     284            $this->plugin->delete_setting( 'act_first_activate' );
     285            wp_safe_redirect( admin_url( 'edit.php?post_type=' . sanitize_key( $this->plugin->post_type ) . '&page=sct-settings' ) );
    251286            exit;
    252287        }
     
    262297     * @return void
    263298     */
    264     function template_load($excerpt, $post) {
     299    function template_load( $excerpt, $post ) {
    265300        global $editing;
    266         if( ! current_user_can('edit_posts') || $editing !== true ) return $excerpt;
     301        if ( ! current_user_can( 'edit_posts' ) || $editing !== true ) {
     302return $excerpt;
     303        }
     304
     305        // Verify nonce for manual template loading
     306        if ( isset( $_REQUEST['act_template_load'] ) &&
     307            ( ! isset( $_REQUEST['act_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['act_nonce'] ) ), 'act_load_template' ) ) ) {
     308            wp_die( 'Security check failed. Please try again.', 'Security Error', array( 'response' => 403 ) );
     309        }
    267310
    268311        $post_type = $post->post_type;
    269         $settings = $this->plugin->get_setting('act_post_type_settings');
     312        $settings  = $this->plugin->get_setting( 'act_post_type_settings' );
    270313
    271314        // If there are no configured post types, bail
    272         if ( empty($settings) ) return;
     315        if ( empty( $settings ) ) {
     316return;
     317        }
    273318
    274319        // Load the template
    275320        $template = false;
    276         if( ! empty($settings[$post_type]['auto_load']) && is_numeric($settings[$post_type]['auto_load']) ) {
    277             $template = get_post( $settings[$post_type]['auto_load'] );
    278         } elseif( isset($_REQUEST['act_template_load']) && is_numeric($_REQUEST['act_template_load']) ) {
    279             $template = get_post( $_REQUEST['act_template_load'] );
     321        if ( ! empty( $settings[ $post_type ]['auto_load'] ) && is_numeric( $settings[ $post_type ]['auto_load'] ) ) {
     322            $template = get_post( $settings[ $post_type ]['auto_load'] );
     323        } elseif ( isset( $_REQUEST['act_template_load'] ) && is_numeric( $_REQUEST['act_template_load'] ) ) {
     324            $template = get_post( absint( wp_unslash( $_REQUEST['act_template_load'] ) ) );
    280325        }
    281326
    282327        // Only proceed if we have a template
    283         if( $template !== false) {
     328        if ( $template !== false ) {
    284329            ob_start();
    285330
    286             if( isset($_REQUEST['post_id']) ) {
    287                 $post_id = $_REQUEST['post_id'];
    288             } else $post_id = $post->ID;
     331            // Get and sanitize post_id
     332            $post_id = isset( $_REQUEST['post_id'] ) ? absint( wp_unslash( $_REQUEST['post_id'] ) ) : $post->ID;
     333
     334            // Verify edit permissions if using custom post_id
     335            if ( isset( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post', $post_id ) ) {
     336                wp_die( 'You do not have permission to edit this post.', 'Permission Error', array( 'response' => 403 ) );
     337            }
    289338
    290339            if ( $post_id > 0 ) {
    291                 $target_post = get_post($post_id);
     340                $target_post = get_post( $post_id );
    292341            }
    293342
    294             $properties = get_object_vars($template);
     343            $properties          = get_object_vars( $template );
    295344            $excluded_properties = array(
    296345                'ID',
     
    307356            );
    308357
    309             $temp_post = array();
    310             $temp_post['ID'] = $post_id;
    311             $temp_post['post_status'] = "draft";
    312             $empty_only_properties = apply_filters('act_protected_properties', array() );
    313 
    314             foreach($properties as $property => $value) {
    315                 if ( ! in_array($property, $excluded_properties) ) {
    316                     // Exclude post_title, if title already set on target post
    317                     if ( ( in_array($property, $empty_only_properties) && ! empty($target_post) && ! empty($target_post->$property) ) && $target_post->$property != "Auto Draft" ) continue;
    318 
    319                     /**
    320                      * act_template_property
    321                      *
    322                      * Filter template property before it is loaded.
    323                      *
    324                      * @since 2.0.0
    325                      *
    326                      * @param string $value The template property value
    327                      * @param string $property The template property being filtered
    328                      */
    329                     $value = apply_filters('act_template_property', $value, $property);
    330 
    331                     $temp_post[$property] = iconv( mb_detect_encoding($value), "UTF-8//IGNORE", $value );
     358            $temp_post                = array();
     359            $temp_post['ID']          = $post_id;
     360            $temp_post['post_status'] = 'draft';
     361            $empty_only_properties    = apply_filters( 'act_protected_properties', array() );
     362
     363            foreach ( $properties as $property => $value ) {
     364                // Skip excluded properties
     365                if ( in_array( $property, $excluded_properties ) ) {
     366                    continue;
    332367                }
     368
     369                // Skip if property should be empty-only and already has value
     370                if ( ( in_array( $property, $empty_only_properties ) && ! empty( $target_post ) && ! empty( $target_post->$property ) ) && $target_post->$property != 'Auto Draft' ) {
     371                    continue;
     372                }
     373
     374                /**
     375                 * act_template_property
     376                 *
     377                 * Filter template property before it is loaded.
     378                 *
     379                 * @since 2.0.0
     380                 *
     381                 * @param string $value The template property value
     382                 * @param string $property The template property being filtered
     383                 */
     384                $value = apply_filters( 'act_template_property', $value, $property );
     385
     386                $temp_post[ $property ] = iconv( mb_detect_encoding( $value ), 'UTF-8//IGNORE', $value );
    333387            }
    334388
    335             // Dynamic Fields
    336             if( $this->plugin->get_php_enabled() == "true" ) {
    337                 $dynamic_fields = array('post_title','post_content','post_excerpt');
    338 
    339                 foreach($dynamic_fields as $df) {
    340                     // Exclude post_title, if title already set on target post
    341                     if ( ( in_array($df, $empty_only_properties) && ! empty($target_post) && ! empty($target_post->$df) ) && $target_post->$df != "Auto Draft" ) continue;
    342 
    343                     ob_start();
    344                     eval('?>'. html_entity_decode($temp_post[$df]));
    345                     $new =  ob_get_clean();
    346                     $temp_post[$df] = iconv( mb_detect_encoding($new), "UTF-8//IGNORE", $new );
    347                 }
    348             }
    349 
    350             $temp_post = apply_filters('act_load_template', $temp_post);
    351 
    352             wp_update_post($temp_post);
     389            $temp_post = apply_filters( 'act_load_template', $temp_post );
     390
     391            wp_update_post( $temp_post );
    353392
    354393            ob_end_clean();
    355394
    356             do_action_ref_array('act_template_loaded', $post_id);
    357 
    358             wp_redirect( get_edit_post_link($post_id, '') );
     395            do_action_ref_array( 'act_template_loaded', $post_id );
     396
     397            wp_safe_redirect( get_edit_post_link( $post_id, '' ) );
    359398            exit();
    360399        }
     
    364403
    365404    function get_templates() {
    366         return get_posts( array(
    367             'posts_per_page' => -1,
    368             'post_type'      => $this->plugin->post_type,
    369             'orderby'        => 'post_title',
    370             'order'          => 'ASC',
    371             'post_status'    => array(
     405        return get_posts(
     406            array(
     407                'posts_per_page' => -1,
     408                'post_type'      => $this->plugin->post_type,
     409                'orderby'        => 'post_title',
     410                'order'          => 'ASC',
     411                'post_status'    => array(
    372412                    'publish',
    373413                    'pending',
    374414                    'future',
    375415                    'private',
    376                 )
     416                ),
    377417            )
    378418        );
  • simple-post-template/trunk/admin/partials/advanced-content-templates-admin-display.php

    r2970365 r3402937  
    1313 */
    1414
    15 $post_type_objects = $this->plugin->get_post_types();
    16 $templates = $this->get_templates();
    17 $act_post_type_settings = $this->plugin->get_setting('act_post_type_settings');
     15$post_type_objects      = $this->plugin->get_post_types();
     16$templates              = $this->get_templates();
     17$act_post_type_settings = $this->plugin->get_setting( 'act_post_type_settings' );
    1818?>
    1919<div class="wrap">
     
    2222    <?php $wp_tabbed_navigation->display_tabs(); ?>
    2323
    24     <h3><?php _e('Settings'); ?></h3>
     24    <h3><?php esc_html_e( 'Settings', 'simple-post-template' ); ?></h3>
    2525    <p>Do you like Simple Content Templates? Help us out by <a target="_blank" href="https://wordpress.org/plugins/simple-post-template/">leaving us a review</a>!</p>
    2626
    27     <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
     27    <form method="post" action="<?php echo esc_url( isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '' ); ?>">
    2828        <?php $this->plugin->the_nonce(); ?>
    2929
    3030        <table class="form-table">
    3131            <tbody>
    32                 <?php foreach($post_type_objects as $pto): if ( ! in_array( $pto->name, array( 'post','page' ) ) ) continue; ?>
     32                <?php
     33                foreach ( $post_type_objects as $pto ) :
     34                    if ( ! in_array( $pto->name, array( 'post', 'page' ) ) ) {
     35                    continue;}
     36                    ?>
    3337                    <tr>
    34                         <th scope="row" valign="top"><?php echo $pto->labels->name; ?></th>
     38                        <th scope="row" valign="top"><?php echo esc_html( $pto->labels->name ); ?></th>
    3539                        <td>
    36                             <label><input type="checkbox" name="<?php echo $this->plugin->get_field_name('act_post_type_settings'); ?>[<?php echo $pto->name; ?>][show_ui]" value="true" <?php if( isset($act_post_type_settings[$pto->name]['show_ui']) && $act_post_type_settings[$pto->name]['show_ui'] == "true" ) echo 'checked="checked"'; ?> /> Show UI</label><br />
     40                            <label><input type="checkbox" name="<?php echo esc_attr( $this->plugin->get_field_name( 'act_post_type_settings' ) ); ?>[<?php echo esc_attr( $pto->name ); ?>][show_ui]" value="true"
     41                            <?php
     42                            if ( isset( $act_post_type_settings[ $pto->name ]['show_ui'] ) && $act_post_type_settings[ $pto->name ]['show_ui'] == 'true' ) {
     43                            checked( $act_post_type_settings[ $pto->name ]['show_ui'], 'true' );
     44                        }
     45                            ?>
     46                            /> Show UI</label><br />
    3747                            <label>Auto Load Template:
    38                             <select name="<?php echo $this->plugin->get_field_name('act_post_type_settings'); ?>[<?php echo $pto->name; ?>][auto_load]">
     48                            <select name="<?php echo esc_attr( $this->plugin->get_field_name( 'act_post_type_settings' ) ); ?>[<?php echo esc_attr( $pto->name ); ?>][auto_load]">
    3949                                <option value="false">None</option>
    40                                 <?php foreach($templates as $t): ?>
    41                                     <?php
    42                                         $key_exists = $act_post_type_settings[$pto->name] ?? false;
    43                                         $auto_load_id = $act_post_type_settings[$pto->name]['auto_load'] ?? false;
    44                                         $auto_load_current = $auto_load_id == $t->ID;
     50                                <?php foreach ( $templates as $t ) : ?>
     51                                    <?php
     52                                        $key_exists        = $act_post_type_settings[ $pto->name ] ?? false;
     53                                        $auto_load_id      = $act_post_type_settings[ $pto->name ]['auto_load'] ?? false;
     54                                        $auto_load_current = $auto_load_id == $t->ID;
    4555
    46                                         $selected_text = "";
    47                                         if ($key_exists && $auto_load_id && $auto_load_current) {
    48                                             $selected_text = "selected";
    49                                         }
    50                                     ?>
    51                                     <option value="<?php echo $t->ID; ?>" <?php echo $selected_text ?>><?php echo $t->post_title; ?></option>
     56                                        $selected_text = '';
     57                                    if ( $key_exists && $auto_load_id && $auto_load_current ) {
     58                                        $selected_text = 'selected';
     59                                    }
     60                                    ?>
     61                                    <option value="<?php echo esc_attr( $t->ID ); ?>" <?php echo esc_attr( $selected_text ); ?>><?php echo esc_html( $t->post_title ); ?></option>
    5262                                <?php endforeach; ?>
    5363                            </select>
     
    5767                <?php endforeach; ?>
    5868
    59                 <?php do_action_ref_array('act_admin_page_after_row', array($this->plugin) ); ?>
     69                <?php do_action_ref_array( 'act_admin_page_after_row', array( $this->plugin ) ); ?>
    6070            </tbody>
    6171        </table>
    6272
    63             <p class="submit"><input type="submit" class="button-primary" name="save" value="<?php _e('Save Changes','act_templates'); ?>" /></p>
     73            <p class="submit"><input type="submit" class="button-primary" name="save" value="<?php esc_attr_e( 'Save Changes', 'simple-post-template' ); ?>" /></p>
    6474        <div style="clear:both"></div>
    6575    </form>
  • simple-post-template/trunk/admin/partials/advanced-content-templates-admin-sidecar.php

    r2970365 r3402937  
    44
    55if ( empty( $templates ) ) {
    6     echo "You don't have any content templates.";
     6    echo esc_html( "You don't have any content templates." );
    77    return;
    8 };
     8}
    99?>
    1010<div>
     
    1313        <option disabled selected value="nada">Choose one</option>
    1414        <?php foreach ( $templates as $template ) : ?>
    15             <option value="<?php echo $template->ID; ?>"><?php echo $template->post_title; ?></option>
     15            <option value="<?php echo esc_attr( $template->ID ); ?>"><?php echo esc_html( $template->post_title ); ?></option>
    1616        <?php endforeach; ?>
    1717    </select>
    1818
    1919    <input class="button-primary" style="margin-top: 10px;" name="act_load_template" id="act_load_template" type="button" value="Load Template" />
     20    <input type="hidden" id="act_template_nonce_value" value="<?php echo esc_attr( wp_create_nonce('act_load_template') ); ?>" />
     21    <input type="hidden" id="act_post_id" value="<?php echo esc_attr($post->ID); ?>" />
    2022</div>
    2123
    2224<div class="" style="padding: 12px; border-radius: 4px; background-color:#ffe01a; margin-top: 12px;">
    23     <h4 style="margin-bottom: 4px; margin-top: 0px;">Advanced Content Templates</h4>
    24     <p>Want more powerful features like custom fields, featured images, and taxonomies? Upgrade today!</p>
    25     <p style="font-style: italic;">P.S. You can save 25% on your pro upgrade with code <b>LITE25</b></p>
    26     <a class="button-secondary" target="_blank" href="https://www.advancedcontenttemplates.com/?utm_campaign=free&utm_source=wprepo">Check Out ACT</a>
     25    <h4 style="margin-bottom: 4px; margin-top: 0px;">Advanced Content Templates</h4>
     26    <p>Want more powerful features like custom fields, featured images, and taxonomies? Upgrade today!</p>
     27    <p style="font-style: italic;">P.S. You can save 25% on your pro upgrade with code <b>LITE25</b></p>
     28    <a class="button-secondary" target="_blank" href="https://www.advancedcontenttemplates.com/?utm_campaign=free&utm_source=wprepo">Check Out ACT</a>
    2729</div>
    2830
     
    3335
    3436        var template = jQuery("#act_template option:selected").val();
     37        var nonce = jQuery('#act_template_nonce_value').val();
     38        var post_id = jQuery('#act_post_id').val();
    3539
    3640        if ( 'nada' === template ) {
    37             alert( "You need to actually select a content template to load, otherwise we would just be guessing!")
    38         } else {
    39             if( confirm('Are you sure? Loading this template may wipe out existing changes.') ) {
    40                 window.location = 'post-new.php?post_id=<?php echo $post->ID; ?>&act_template_load=' + template;
    41             }
     41            alert( "You need to actually select a content template to load, otherwise we would just be guessing!");
     42            return;
     43        }
     44
     45        if ( confirm('Are you sure? Loading this template may wipe out existing changes.') ) {
     46            window.location = 'post-new.php?post_id=' + post_id + '&act_template_load=' + template + '&act_nonce=' + encodeURIComponent(nonce);
    4247        }
    4348
  • simple-post-template/trunk/admin/partials/advanced-content-templates-admin-upgrade.php

    r2970365 r3402937  
    1313 */
    1414
    15 $post_type_objects = $this->plugin->get_post_types();
    16 $templates = $this->get_templates();
    17 $act_post_type_settings = $this->plugin->get_setting('act_post_type_settings');
     15$post_type_objects      = $this->plugin->get_post_types();
     16$templates              = $this->get_templates();
     17$act_post_type_settings = $this->plugin->get_setting( 'act_post_type_settings' );
    1818?>
    1919<div class="wrap">
    20     <?php global $wp_tabbed_navigation; ?>
    21     <?php $wp_tabbed_navigation->display_tabs(); ?>
     20    <?php global $wp_tabbed_navigation; ?>
     21    <?php $wp_tabbed_navigation->display_tabs(); ?>
    2222
    23     <div class="" style="padding: 20px; border-radius: 4px; background-color:#ffe01a; margin-top: 20px; max-width: 500px;">
    24         <h2 style="font-size: 22px; margin-top: 0px;">You're missing out!</h2>
    25         <p style="font-size: 18px;">Advanced Content Templates has tons of bonus features, and it's growing all the time. Join over 600 other pro users and receive:</p>
    26         <ol style="font-size: 18px;">
    27             <li>Premium Support</li>
    28             <li>Featured Images</li>
    29             <li>Categories, Tags, and Custom Taxonomies</li>
    30             <li>Custom Fields</li>
    31             <li>Custom Post Type Support</li>
    32             <li>And much more!</li>
    33         </ol>
    34    
    35         <p style="font-size: 18px; font-style: italic;">P.S. You can save 25% on your pro upgrade with code <b>LITE25</b></p>
     23    <div class="" style="padding: 20px; border-radius: 4px; background-color:#ffe01a; margin-top: 20px; max-width: 500px;">
     24        <h2 style="font-size: 22px; margin-top: 0px;">You're missing out!</h2>
     25        <p style="font-size: 18px;">Advanced Content Templates has tons of bonus features, and it's growing all the time. Join over 600 other pro users and receive:</p>
     26        <ol style="font-size: 18px;">
     27            <li>Premium Support</li>
     28            <li>Featured Images</li>
     29            <li>Categories, Tags, and Custom Taxonomies</li>
     30            <li>Custom Fields</li>
     31            <li>Custom Post Type Support</li>
     32            <li>And much more!</li>
     33        </ol>
     34   
     35        <p style="font-size: 18px; font-style: italic;">P.S. You can save 25% on your pro upgrade with code <b>LITE25</b></p>
    3636
    37         <a class="button-secondary" style="font-size: 18px;" target="_blank" href="https://www.advancedcontenttemplates.com/?utm_campaign=free&utm_source=wprepo">Check Out Advanced Content Templates!</a>
    38     </div>
     37        <a class="button-secondary" style="font-size: 18px;" target="_blank" href="https://www.advancedcontenttemplates.com/?utm_campaign=free&utm_source=wprepo">Check Out Advanced Content Templates!</a>
     38    </div>
    3939</div>
  • simple-post-template/trunk/includes/class-advanced-content-templates-i18n.php

    r1620485 r3402937  
    4444
    4545        load_plugin_textdomain(
    46             'advanced-content-templates',
     46            'simple-post-template',
    4747            false,
    4848            dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
    4949        );
    50 
    5150    }
    5251}
  • simple-post-template/trunk/includes/class-advanced-content-templates-loader.php

    r1620485 r3402937  
    5151        $this->actions = array();
    5252        $this->filters = array();
    53 
    5453    }
    5554
     
    5857     *
    5958     * @since    1.0.0
    60      * @param      string               $hook             The name of the WordPress action that is being registered.
    61      * @param      object               $component        A reference to the instance of the object on which the action is defined.
    62      * @param      string               $callback         The name of the function definition on the $component.
    63      * @param      int      Optional    $priority         The priority at which the function should be fired.
    64      * @param      int      Optional    $accepted_args    The number of arguments that should be passed to the $callback.
     59     * @param      string            $hook             The name of the WordPress action that is being registered.
     60     * @param      object            $component        A reference to the instance of the object on which the action is defined.
     61     * @param      string            $callback         The name of the function definition on the $component.
     62     * @param      int      Optional $priority         The priority at which the function should be fired.
     63     * @param      int      Optional $accepted_args    The number of arguments that should be passed to the $callback.
    6564     */
    6665    public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
     
    7271     *
    7372     * @since    1.0.0
    74      * @param      string               $hook             The name of the WordPress filter that is being registered.
    75      * @param      object               $component        A reference to the instance of the object on which the filter is defined.
    76      * @param      string               $callback         The name of the function definition on the $component.
    77      * @param      int      Optional    $priority         The priority at which the function should be fired.
    78      * @param      int      Optional    $accepted_args    The number of arguments that should be passed to the $callback.
     73     * @param      string            $hook             The name of the WordPress filter that is being registered.
     74     * @param      object            $component        A reference to the instance of the object on which the filter is defined.
     75     * @param      string            $callback         The name of the function definition on the $component.
     76     * @param      int      Optional $priority         The priority at which the function should be fired.
     77     * @param      int      Optional $accepted_args    The number of arguments that should be passed to the $callback.
    7978     */
    8079    public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
     
    8887     * @since    1.0.0
    8988     * @access   private
    90      * @param      array                $hooks            The collection of hooks that is being registered (that is, actions or filters).
    91      * @param      string               $hook             The name of the WordPress filter that is being registered.
    92      * @param      object               $component        A reference to the instance of the object on which the filter is defined.
    93      * @param      string               $callback         The name of the function definition on the $component.
    94      * @param      int      Optional    $priority         The priority at which the function should be fired.
    95      * @param      int      Optional    $accepted_args    The number of arguments that should be passed to the $callback.
     89     * @param      array             $hooks            The collection of hooks that is being registered (that is, actions or filters).
     90     * @param      string            $hook             The name of the WordPress filter that is being registered.
     91     * @param      object            $component        A reference to the instance of the object on which the filter is defined.
     92     * @param      string            $callback         The name of the function definition on the $component.
     93     * @param      int      Optional $priority         The priority at which the function should be fired.
     94     * @param      int      Optional $accepted_args    The number of arguments that should be passed to the $callback.
    9695     * @return   type                                   The collection of actions and filters registered with WordPress.
    9796     */
     
    103102            'callback'      => $callback,
    104103            'priority'      => $priority,
    105             'accepted_args' => $accepted_args
     104            'accepted_args' => $accepted_args,
    106105        );
    107106
    108107        return $hooks;
    109 
    110108    }
    111109
     
    124122            add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
    125123        }
    126 
    127124    }
    128 
    129125}
  • simple-post-template/trunk/includes/class-advanced-content-templates.php

    r1746168 r3402937  
    3939     * @access public
    4040     */
    41     var $post_type = "act_template";
     41    var $post_type = 'act_template';
    4242
    4343
     
    5050     * @access public
    5151     */
    52     var $prefix = "Simple_Content_Templates";
     52    var $prefix = 'Simple_Content_Templates';
    5353
    5454
     
    6161     * @access public
    6262     */
    63     var $short_prefix = "act_";
     63    var $short_prefix = 'act_';
    6464
    6565    /**
     
    103103
    104104        parent::__construct();
    105         $this->plugin_name  = 'advanced-content-templates';
    106         $this->version = CGD_SCT_VERSION;
     105        $this->plugin_name = 'advanced-content-templates';
     106        $this->version     = CGD_SCT_VERSION;
    107107
    108108        $this->load_dependencies();
     
    134134         * core plugin.
    135135         */
    136         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-content-templates-loader.php';
     136        require_once plugin_dir_path( __DIR__ ) . 'includes/class-advanced-content-templates-loader.php';
    137137
    138138        /**
     
    140140         * of the plugin.
    141141         */
    142         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-content-templates-i18n.php';
     142        require_once plugin_dir_path( __DIR__ ) . 'includes/class-advanced-content-templates-i18n.php';
    143143
    144144        /**
    145145         * The class responsible for defining all actions that occur in the Dashboard.
    146146         */
    147         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-advanced-content-templates-admin.php';
     147        require_once plugin_dir_path( __DIR__ ) . 'admin/class-advanced-content-templates-admin.php';
    148148
    149149        /**
     
    151151         * side of the site.
    152152         */
    153         require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-advanced-content-templates-public.php';
     153        require_once plugin_dir_path( __DIR__ ) . 'public/class-advanced-content-templates-public.php';
    154154
    155155        $this->loader = new Simple_Content_Templates_Loader();
     
    170170
    171171        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
    172 
    173172    }
    174173
     
    188187
    189188        // The admin menus
    190         $this->loader->add_action('admin_menu', $act_plugin_admin, 'admin_menus', 11);
     189        $this->loader->add_action( 'admin_menu', $act_plugin_admin, 'admin_menus', 11 );
    191190
    192191        // Template Selector Metabox
    193         $this->loader->add_action('add_meta_boxes', $act_plugin_admin, 'boxes' );
     192        $this->loader->add_action( 'add_meta_boxes', $act_plugin_admin, 'boxes' );
    194193
    195194        // Save page template on template save (confusing wording I know)
    196         $this->loader->add_action('save_post', $act_plugin_admin, 'save_template', 10, 1 );
     195        $this->loader->add_action( 'save_post', $act_plugin_admin, 'save_template', 10, 1 );
     196
     197        // Add nonce field for page template saving
     198        $this->loader->add_action( 'post_submitbox_misc_actions', $act_plugin_admin, 'add_template_nonce_field' );
    197199
    198200        // Redirect to settings on first activate
    199         $this->loader->add_action('admin_init', $act_plugin_admin, 'redirect_on_first_activate' );
     201        $this->loader->add_action( 'admin_init', $act_plugin_admin, 'redirect_on_first_activate' );
    200202
    201203        // Actually load templates, yo
    202         $this->loader->add_filter('default_excerpt', $act_plugin_admin, 'template_load', 1, 2);
    203 
    204         $this->loader->add_action('admin_init', $this, 'sct_upgrade', 1, 1);
     204        $this->loader->add_filter( 'default_excerpt', $act_plugin_admin, 'template_load', 1, 2 );
     205
     206        $this->loader->add_action( 'admin_init', $this, 'sct_upgrade', 1, 1 );
    205207    }
    206208
     
    217219
    218220        // Register Post Type
    219         $this->loader->add_action('init', $plugin_public, 'register_post_type', 0 );
    220 
     221        $this->loader->add_action( 'init', $plugin_public, 'register_post_type', 0 );
    221222    }
    222223
     
    229230        $this->loader->run();
    230231
    231         do_action('act_loaded');
     232        do_action( 'act_loaded' );
    232233    }
    233234
     
    271272     */
    272273    function activate() {
    273         if (  get_option('spt_version', false) === false ) {
    274             $this->update_setting('act_first_activate', true);
     274        if ( get_option( 'spt_version', false ) === false ) {
     275            $this->update_setting( 'act_first_activate', true );
    275276
    276277            // Default Post Setting
    277             $this->add_setting('act_post_type_settings', array(
    278                 'post' => array(
    279                     'show_ui' => true,
     278            $this->add_setting(
     279                'act_post_type_settings',
     280                array(
     281                    'post' => array(
     282                        'show_ui' => true,
     283                    ),
    280284                )
    281             ));
    282         }
    283 
    284         update_option('spt_version', CGD_SCT_VERSION);
     285            );
     286        }
     287
     288        update_option( 'spt_version', CGD_SCT_VERSION );
    285289    }
    286290
     
    295299
    296300        // Make sure we have a table from the old version
    297         if ( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}simple_post_templates'") !== "{$wpdb->prefix}simple_post_templates" ) return;
    298 
    299         // Make sure user is an admin
    300         if ( isset($_GET['force_act_convert']) && ! current_user_can('manage_options') ) return;
    301 
    302         $old_templates = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}simple_post_templates");
    303 
    304         foreach($old_templates as $ot) {
    305             $post = array();
    306             $post['post_type'] = $this->post_type;
    307             $post['post_status'] = 'publish';
    308             $post['post_title'] = $ot->title;
     301        if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}simple_post_templates'" ) !== "{$wpdb->prefix}simple_post_templates" ) {
     302return;
     303        }
     304
     305        $old_templates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}simple_post_templates" );
     306
     307        foreach ( $old_templates as $ot ) {
     308            $post                 = array();
     309            $post['post_type']    = $this->post_type;
     310            $post['post_status']  = 'publish';
     311            $post['post_title']   = $ot->title;
    309312            $post['post_content'] = $ot->content;
    310313            $post['post_excerpt'] = $ot->excerpt;
    311314
    312             $result = wp_insert_post($post);
    313         }
    314 
    315         $this->update_setting('act_converted_spt', true);
     315            $result = wp_insert_post( $post );
     316        }
     317
     318        $this->update_setting( 'act_converted_spt', true );
    316319    }
    317320
     
    333336     */
    334337    public function get_php_enabled() {
    335         return apply_filters('act_enable_php_in_templates', false);
     338        return apply_filters( 'act_enable_php_in_templates', false );
    336339    }
    337340
     
    344347    public function get_post_types() {
    345348        $post_type_objects = array();
    346         $post_types = get_post_types( array('show_ui' => true) );
    347         unset($post_types['attachment']);
    348 
    349         foreach($post_types as $pt) {
    350             if ( $pt == $this->post_type ) continue;
    351             $post_type_objects[] = get_post_type_object($pt);
     349        $post_types        = get_post_types( array( 'show_ui' => true ) );
     350        unset( $post_types['attachment'] );
     351
     352        foreach ( $post_types as $pt ) {
     353            if ( $pt == $this->post_type ) {
     354continue;
     355            }
     356            $post_type_objects[] = get_post_type_object( $pt );
    352357        }
    353358
     
    357362    /**
    358363     * Upgrade SCT <= 2.0.x to 2.1.x
     364     *
    359365     * @return void
    360366     */
     
    363369
    364370        // If table doesn't exist, bail
    365         if ( $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}simple_post_templates'") !== "{$wpdb->prefix}simple_post_templates" ) return;
    366 
    367         // Force ACT convert
    368         if ( isset($_GET['force_act_convert']) ) {
    369             $this->convert_sct_to_act();
    370         }
    371 
    372         if( $this->get_setting('act_converted_spt') === false && get_option('spt_version', false) !== false ) {
    373             $old_templates = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}simple_post_templates");
    374 
    375             if ( ! empty($old_templates) ) {
    376                 $this->convert_sct_to_act();
     371        if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}simple_post_templates'" ) !== "{$wpdb->prefix}simple_post_templates" ) {
     372return;
     373        }
     374
     375        // Check if force conversion not requested - handle automatic conversion
     376        if ( ! isset( $_GET['force_act_convert'] ) ) {
     377            // Automatic conversion check
     378            if ( $this->get_setting( 'act_converted_spt' ) === false && get_option( 'spt_version', false ) !== false ) {
     379                $old_templates = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}simple_post_templates" );
     380
     381                if ( ! empty( $old_templates ) ) {
     382                    $this->convert_sct_to_act();
     383                }
    377384            }
    378         }
     385            return;
     386        }
     387
     388        // Force ACT convert requested - verify nonce and admin permissions
     389        if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'force_act_convert' ) ) {
     390            wp_die( 'Security check failed. Please try again.', 'Security Error', array( 'response' => 403 ) );
     391        }
     392
     393        if ( ! current_user_can( 'manage_options' ) ) {
     394            wp_die( 'You do not have permission to perform this action. Admin access required.', 'Permission Error', array( 'response' => 403 ) );
     395        }
     396
     397        // Perform conversion
     398        $this->convert_sct_to_act();
     399
     400        // Redirect after conversion to prevent re-triggering
     401        wp_safe_redirect( admin_url( 'edit.php?post_type=act_template&converted=1' ) );
     402        exit;
    379403    }
    380404}
  • simple-post-template/trunk/lib/wordpress-simple-settings.php

    r1620485 r3402937  
    2424    public function __construct() {
    2525        // Set a default prefix
    26         if( function_exists('get_called_class') && empty($this->prefix) ) $this->prefix = get_called_class();
     26        if ( function_exists( 'get_called_class' ) && empty( $this->prefix ) ) {
     27$this->prefix = get_called_class();
     28        }
    2729
    2830        $this->settings = $this->get_settings_obj( $this->prefix );
    29         add_action('admin_init', array($this, 'save_settings') );
     31        add_action( 'admin_init', array( $this, 'save_settings' ) );
    3032    }
    3133
     
    4042     * @return boolean True if successful, false otherwise
    4143     **/
    42     public function add_setting ( $setting = false, $value ) {
    43         if($setting === false ) return false;
    44 
    45         if ( ! isset($this->settings[$setting]) ) {
    46             return $this->update_setting($setting, $value);
    47         } else return false;
     44    public function add_setting( $setting = false, $value ) {
     45        if ( $setting === false ) {
     46return false;
     47        }
     48
     49        if ( ! isset( $this->settings[ $setting ] ) ) {
     50            return $this->update_setting( $setting, $value );
     51        } else {
     52return false;
     53        }
    4854    }
    4955
     
    5864     * @return boolean True if successful, false if not
    5965     **/
    60     public function update_setting ( $setting = false, $value ) {
    61         if( $setting === false ) return false;
    62 
    63         $this->settings = $this->get_settings_obj($this->prefix);
    64         $this->settings[$setting] = $value;
    65 
    66         return $this->set_settings_obj($this->settings);
     66    public function update_setting( $setting = false, $value ) {
     67        if ( $setting === false ) {
     68return false;
     69        }
     70
     71        $this->settings             = $this->get_settings_obj( $this->prefix );
     72        $this->settings[ $setting ] = $value;
     73
     74        return $this->set_settings_obj( $this->settings );
    6775    }
    6876
     
    7684     * @return boolean True if successful, false if not
    7785     **/
    78     public function delete_setting ( $setting = false ) {
    79         if( $setting === false ) return false;
    80 
    81         $this->settings = $this->get_settings_obj($this->prefix);
    82         unset($this->settings[$setting]);
    83 
    84         return $this->set_settings_obj($this->settings);
     86    public function delete_setting( $setting = false ) {
     87        if ( $setting === false ) {
     88return false;
     89        }
     90
     91        $this->settings = $this->get_settings_obj( $this->prefix );
     92        unset( $this->settings[ $setting ] );
     93
     94        return $this->set_settings_obj( $this->settings );
    8595    }
    8696
     
    95105     * @return mixed The value of the setting
    96106     **/
    97     public function get_setting ( $setting = false, $type = 'string' ) {
    98         if($setting === false || ! isset($this->settings[$setting]) ) return false;
    99 
    100         $value = $this->settings[$setting];
    101 
    102         if( strtolower($type) == 'array' && ! empty($value) ) {
    103             $value = (array)explode(";", $value);
    104         }
    105 
    106         return apply_filters($this->prefix . '_get_setting', $value, $setting);
     107    public function get_setting( $setting = false, $type = 'string' ) {
     108        if ( $setting === false || ! isset( $this->settings[ $setting ] ) ) {
     109return false;
     110        }
     111
     112        $value = $this->settings[ $setting ];
     113
     114        if ( strtolower( $type ) == 'array' && ! empty( $value ) ) {
     115            $value = (array) explode( ';', $value );
     116        }
     117
     118        return apply_filters( $this->prefix . '_get_setting', $value, $setting );
    107119    }
    108120
     
    117129     * @return string The name of the field
    118130     **/
    119     public function get_field_name($setting, $type = 'string') {
     131    public function get_field_name( $setting, $type = 'string' ) {
    120132        return "{$this->prefix}_setting[$setting][$type]";
    121133    }
     
    142154     **/
    143155    public function save_settings() {
    144         if( isset($_REQUEST["{$this->prefix}_setting"]) && check_admin_referer("save_{$this->prefix}_settings","{$this->prefix}_save") ) {
    145             $new_settings = $_REQUEST["{$this->prefix}_setting"];
    146 
    147             foreach( $new_settings as $setting_name => $setting_value  ) {
    148                 foreach( $setting_value as $type => $value ) {
    149                     if( $type == "array" ) {
    150                         if ( ! is_array($value) && ! empty($value) ) $value = (array)explode(";", $value);
    151 
    152                         $this->update_setting($setting_name, $value);
     156        if ( isset( $_REQUEST[ "{$this->prefix}_setting" ] ) && check_admin_referer( "save_{$this->prefix}_settings", "{$this->prefix}_save" ) ) {
     157            $new_settings = map_deep( wp_unslash( $_REQUEST[ "{$this->prefix}_setting" ] ), 'sanitize_text_field' );
     158
     159            foreach ( $new_settings as $setting_name => $setting_value ) {
     160                foreach ( $setting_value as $type => $value ) {
     161                    if ( $type == 'array' ) {
     162                        if ( ! is_array( $value ) && ! empty( $value ) ) {
     163$value = (array) explode( ';', $value );
     164                        }
     165
     166                        $this->update_setting( $setting_name, $value );
    153167                    } else {
    154                         $this->update_setting($setting_name, $value);
     168                        $this->update_setting( $setting_name, $value );
    155169                    }
    156170                }
    157171            }
    158172
    159             do_action("{$this->prefix}_settings_saved");
     173            do_action( "{$this->prefix}_settings_saved" );
    160174        }
    161175    }
     
    169183     * @return void
    170184     **/
    171     public function get_settings_obj () {
    172         return get_option("{$this->prefix}_settings", false);
     185    public function get_settings_obj() {
     186        return get_option( "{$this->prefix}_settings", false );
    173187    }
    174188
     
    182196     * @return boolean True if successful, false otherwise
    183197     **/
    184     public function set_settings_obj ( $newobj ) {
    185         return update_option("{$this->prefix}_settings", $newobj);
     198    public function set_settings_obj( $newobj ) {
     199        return update_option( "{$this->prefix}_settings", $newobj );
    186200    }
    187201}
  • simple-post-template/trunk/public/class-advanced-content-templates-public.php

    r2970366 r3402937  
    2121 * @author     Clifton Griffin <[email protected]>
    2222 */
    23 class Simple_Content_Templates_Public
    24 {
     23class Simple_Content_Templates_Public {
    2524
    26     /**
    27      * The ID of this plugin.
    28      *
    29      * @since    1.0.0
    30      * @access   private
    31      * @var      string    $Simple_Content_Templates    The ID of this plugin.
    32      */
    33     private $plugin_name;
    3425
    35     /**
    36      * The version of this plugin.
    37     *
    38     * @since    1.0.0
    39     * @access   private
    40      * @var      string    $version    The current version of this plugin.
    41     */
    42     private $version;
     26    /**
     27     * The ID of this plugin.
     28    *
     29    * @since    1.0.0
     30    * @access   private
     31     * @var      string    $Simple_Content_Templates    The ID of this plugin.
     32    */
     33    private $plugin_name;
    4334
    44     /**
    45      * Main instance of this plugin.
    46     *
    47     * @since    1.0.0
    48     * @access   private
    49      * @var      string    $plugin_name    The ID of this plugin.
    50     */
    51     private $plugin;
     35    /**
     36     * The version of this plugin.
     37    *
     38    * @since    1.0.0
     39    * @access   private
     40     * @var      string    $version    The current version of this plugin.
     41    */
     42    private $version;
    5243
    53     /**
    54      * Initialize the class and set its properties.
    55      *
    56      * @since    1.0.0
    57      * @param      string    $Simple_Content_Templates       The name of the plugin.
    58      * @param      string    $version    The version of this plugin.
    59      */
    60     public function __construct($Simple_Content_Templates, $version, $plugin)
    61     {
     44    /**
     45     * Main instance of this plugin.
     46     *
     47     * @since    1.0.0
     48     * @access   private
     49     * @var      string    $plugin_name    The ID of this plugin.
     50     */
     51    private $plugin;
    6252
    63         $this->plugin_name  = $Simple_Content_Templates;
    64         $this->version = $version;
    65         $this->plugin = $plugin;
    66     }
     53    /**
     54     * Initialize the class and set its properties.
     55     *
     56     * @since    1.0.0
     57     * @param      string $Simple_Content_Templates       The name of the plugin.
     58     * @param      string $version    The version of this plugin.
     59     */
     60    public function __construct( $Simple_Content_Templates, $version, $plugin ) {
    6761
    68     /**
    69      * Registers the post type
    70      *
    71      * @access public
    72      * @return void
    73      */
    74     function register_post_type()
    75     {
     62        $this->plugin_name = $Simple_Content_Templates;
     63        $this->version     = $version;
     64        $this->plugin      = $plugin;
     65    }
    7666
    77         // Register Post Type
    78         $menu_icon = "dashicons-welcome-write-blog";
     67    /**
     68     * Registers the post type
     69     *
     70     * @access public
     71     * @return void
     72     */
     73    function register_post_type() {
    7974
    80         register_post_type(
    81             $this->plugin->post_type,
    82             array(
    83                 'label' => 'Simple Content Templates',
    84                 'description' => '',
    85                 'public' => false,
    86                 'publicly_queryable' => false,
    87                 'has_archive' => false,
    88                 'show_ui' => true,
    89                 'show_in_menu' => true,
    90                 'capability_type' => 'post',
    91                 'menu_icon' => $menu_icon,
    92                 'hierarchical' => false,
    93                 'rewrite' => array('slug' => ''),
    94                 'query_var' => true,
    95                 'exclude_from_search' => true,
    96                 'show_in_nav_menus' => false,
    97                 'supports' =>
    98                     array(
    99                         'title',
    100                         'editor',
    101                         'excerpt',
    102                         'comments',
    103                         'revisions'
    104                     ),
    105                 'labels' =>
    106                     array (
    107                         'name' => 'Simple Content Templates',
    108                         'singular_name' => 'Content Template',
    109                         'menu_name' => 'Content Templates',
    110                         'add_new' => 'Add Template',
    111                         'add_new_item' => 'Add New Template',
    112                         'edit' => 'Edit',
    113                         'edit_item' => 'Edit Template',
    114                         'new_item' => 'New Template',
    115                         'view' => 'View Template',
    116                         'view_item' => 'View Template',
    117                         'search_items' => 'Search Templates',
    118                         'not_found' => 'No Templates Found',
    119                         'not_found_in_trash' => 'No Templates Found in Trash',
    120                         'parent' => 'Parent Template',
    121                     ),
    122             )
    123         );
    124     }
     75        // Register Post Type
     76        $menu_icon = 'dashicons-welcome-write-blog';
     77
     78        register_post_type(
     79            $this->plugin->post_type,
     80            array(
     81                'label'               => 'Simple Content Templates',
     82                'description'         => '',
     83                'public'              => false,
     84                'publicly_queryable'  => false,
     85                'has_archive'         => false,
     86                'show_ui'             => true,
     87                'show_in_menu'        => true,
     88                'capability_type'     => 'post',
     89                'menu_icon'           => $menu_icon,
     90                'hierarchical'        => false,
     91                'rewrite'             => array( 'slug' => '' ),
     92                'query_var'           => true,
     93                'exclude_from_search' => true,
     94                'show_in_nav_menus'   => false,
     95                'supports'            =>
     96                    array(
     97                        'title',
     98                        'editor',
     99                        'excerpt',
     100                        'comments',
     101                        'revisions',
     102                    ),
     103                'labels'              =>
     104                    array(
     105                        'name'               => 'Simple Content Templates',
     106                        'singular_name'      => 'Content Template',
     107                        'menu_name'          => 'Content Templates',
     108                        'add_new'            => 'Add Template',
     109                        'add_new_item'       => 'Add New Template',
     110                        'edit'               => 'Edit',
     111                        'edit_item'          => 'Edit Template',
     112                        'new_item'           => 'New Template',
     113                        'view'               => 'View Template',
     114                        'view_item'          => 'View Template',
     115                        'search_items'       => 'Search Templates',
     116                        'not_found'          => 'No Templates Found',
     117                        'not_found_in_trash' => 'No Templates Found in Trash',
     118                        'parent'             => 'Parent Template',
     119                    ),
     120            )
     121        );
     122    }
    125123}
  • simple-post-template/trunk/readme.txt

    r3279407 r3402937  
    11=== Simple Content Templates for Blog Posts & Pages ===
    22Contributors: clifgriffin, nodleredoy
    3 Tags: post template, content template, post from template, templates, copy, clone, duplicate
     3Tags: post template, template, copy, clone, duplicate post
    44Requires at least: 3.6
    55Tested up to: 6.8
    6 Stable tag: 2.2.61
     6Stable tag: 2.2.7
     7License: GPL-2.0+
     8License URI: http://www.gnu.org/licenses/gpl-2.0.txt
    79
    810Create content templates for your posts and pages. When creating a new post or page use one of your content templates as the starting point!
     
    3739== Changelog ==
    3840
     41**Version 2.2.7**
     42
     43* Fixes a possible - though highly unlikely CSRF security issue
     44* Fixes a couple small warnings that were showing up with the plugin-check
     45* Bump version
     46* Update dependencies
     47
    3948**Version 2.2.61**
    4049
  • simple-post-template/trunk/simple-content-template.php

    r3279405 r3402937  
    1717 * Plugin URI:        https://www.advancedcontenttemplates.com/
    1818 * Description:       A simple to use content template system. Create similarly structured posts & pages with ease.
    19  * Version:           2.2.61
     19 * Version:           2.2.7
    2020 * Author:            Clifton Griffin
    2121 * Author URI:        https://objectiv.co
    2222 * License:           GPL-2.0+
    2323 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
    24  * Text Domain:       advanced-content-templates
     24 * Text Domain:       simple-post-template
    2525 * Domain Path:       /languages
    2626 * Tested up to:      6.8
     
    2828
    2929// If this file is called directly, abort.
    30 if (! defined('WPINC')) {
    31     die;
     30if ( ! defined( 'WPINC' ) ) {
     31    die;
    3232}
    3333
    34 define('CGD_SCT_VERSION', '2.2.61');
    35 define('CGD_SCT_NAME', 'Simple Content Templates');
     34define( 'CGD_SCT_VERSION', '2.2.7' );
     35define( 'CGD_SCT_NAME', 'Simple Content Templates' );
    3636
    3737/**
    3838 * Composer Include
    3939 */
    40 require dirname(__FILE__) . '/vendor/autoload.php';
     40require __DIR__ . '/vendor/autoload.php';
    4141
    4242/**
     
    4444 * dashboard-specific hooks, and public-facing site hooks.
    4545 */
    46 require plugin_dir_path(__FILE__) . 'includes/class-advanced-content-templates.php';
     46require plugin_dir_path( __FILE__ ) . 'includes/class-advanced-content-templates.php';
    4747
    4848$Simple_Content_Templates = new Simple_Content_Templates();
    4949$Simple_Content_Templates->run();
    5050
    51 register_activation_hook(__FILE__, array( $Simple_Content_Templates, 'activate' ));
    52 register_deactivation_hook(__FILE__, array( $Simple_Content_Templates, 'deactivate' ));
     51register_activation_hook( __FILE__, array( $Simple_Content_Templates, 'activate' ) );
     52register_deactivation_hook( __FILE__, array( $Simple_Content_Templates, 'deactivate' ) );
  • simple-post-template/trunk/vendor/composer/installed.php

    r3279405 r3402937  
    22    'root' => array(
    33        'name' => '__root__',
    4         'pretty_version' => 'dev-master',
    5         'version' => 'dev-master',
    6         'reference' => '0e563f6f3ef30738836d5debf315112a080163fc',
     4        'pretty_version' => 'dev-develop',
     5        'version' => 'dev-develop',
     6        'reference' => '8471f3bd401852fdef19f93344449d5f5e2f4e5b',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1212    'versions' => array(
    1313        '__root__' => array(
    14             'pretty_version' => 'dev-master',
    15             'version' => 'dev-master',
    16             'reference' => '0e563f6f3ef30738836d5debf315112a080163fc',
     14            'pretty_version' => 'dev-develop',
     15            'version' => 'dev-develop',
     16            'reference' => '8471f3bd401852fdef19f93344449d5f5e2f4e5b',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • simple-post-template/trunk/vendor/composer/platform_check.php

    r2970365 r3402937  
    2020        }
    2121    }
    22     trigger_error(
    23         'Composer detected issues in your platform: ' . implode(' ', $issues),
    24         E_USER_ERROR
     22    throw new \RuntimeException(
     23        'Composer detected issues in your platform: ' . implode(' ', $issues)
    2524    );
    2625}
Note: See TracChangeset for help on using the changeset viewer.