Plugin Directory

Changeset 1368099


Ignore:
Timestamp:
03/10/2016 08:02:50 AM (10 years ago)
Author:
The.Missing.Code
Message:

Couple of bug fixes, see readme.txt

Location:
php-code-for-posts
Files:
37 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • php-code-for-posts/trunk/Classes/Menu.php

    r1367869 r1368099  
    7171    }
    7272
    73     public function show_menu_page()
     73    public static function show_menu_page()
    7474    {
    7575        $action = isset( $_GET['action'] ) ? $_GET['action'] : '';
     
    9292    }
    9393
    94     public function show_menu_page_default()
     94    public static function show_menu_page_default()
    9595    {
     96        if(! PhpCodeForPosts_Install::check_plugin_table_exists() ) {
     97            PhpCodeForPosts_Install::upgrade_table();
     98        }
    9699        include PhpCodeForPosts::directory_path_it( 'templates/admin-index-default.tpl' );
    97100    }
    98101
    99     public function show_menu_page_edit()
     102    public static function show_menu_page_edit()
    100103    {
    101104        if(! PhpCodeForPosts::check_nonce( $_REQUEST['actioncode'], $_REQUEST['item'], $_REQUEST['action'] ) ) {
  • php-code-for-posts/trunk/Classes/Options.php

    r1368087 r1368099  
    2020            'sidebar_filter'            => 1,
    2121            'table_version'             => 0,
     22            'ajaxible'                  => 1,
    2223        );
    2324    }
  • php-code-for-posts/trunk/Classes/PhpCodeForPosts.php

    r1367869 r1368099  
    11<?php
    2 
    32class PhpCodeForPosts {
    43
     
    240239            self::__input_name( $key ),
    241240            self::__input_id( $key ),
    242             __( $label, PhpCodeforPosts::TEXTDOMAIN ),
     241            $label,
    243242            checked( self::$options->get_option( $key ), 1, false ) ? : ''
    244243        );
     
    259258            '<label for="%1$s">%2$s</label> <input type="text" name="%3$s" value="%4$s" id="%1$s" />',
    260259            self::__input_id( $key ),
    261             esc_html__( $label, PhpCodeforPosts::TEXTDOMAIN ),
     260            esc_html( $label, PhpCodeforPosts::TEXTDOMAIN ),
    262261            self::__input_name( $key ),
    263262            esc_attr( $value )
  • php-code-for-posts/trunk/Classes/Shortcode.php

    r1367869 r1368099  
    44    const DEFAULT_SHORTCODE = 'php';
    55
    6     public function get_shortcode()
     6    public static function get_shortcode()
    77    {
    88        $option_value = PhpCodeForPosts::$options->get_option( 'shortcode' );
  • php-code-for-posts/trunk/Classes/Snippet.php

    r1367869 r1368099  
    143143        $snippet = $snippet_id > 0 ? PhpCodeForPosts_Database::load_single_snippet( $snippet_id ) : new static;
    144144
    145         $snippet->set_name( $post_fields['name'] );
    146         $snippet->set_code( $post_fields['code'] );
    147         $snippet->set_description( $post_fields['description'] );
     145        $snippet->set_name( stripslashes($post_fields['name']) );
     146        $snippet->set_code( stripslashes($post_fields['code']) );
     147        $snippet->set_description( stripcslashes($post_fields['description']) );
    148148
    149149        PhpCodeForPosts_Snippet::$last_saved_snippet = $snippet;
  • php-code-for-posts/trunk/php-code-for-posts.php

    r1368087 r1368099  
    33 * Plugin Name: PHP Code For Posts
    44 * Description: Insert and Execute PHP Code in WordPress Content.  This plugin also enables shortcodes for the text widget.
    5  * Version: 2.0.1
     5 * Version: 2.0.2
    66 * Author: Jamie Fraser
    77 * Author uri: http://www.jamiefraser.co.uk/?utm-campaign=PHPCodeForPosts
     
    1010**/
    1111
     12if (function_exists('session_status')) {
     13    if (session_status() == PHP_SESSION_NONE) {
     14        session_start();
     15    }
     16} else {
     17    if(session_id() == '') {
     18        session_start();
     19    }
     20}
    1221global $PHPPC;
    1322include('Classes/PhpCodeForPosts.php');
  • php-code-for-posts/trunk/readme.txt

    r1368087 r1368099  
    55Requires at least: 3.3.1
    66Tested up to: 4.4.2
    7 Stable tag: 2.0.1
     7Stable tag: 2.0.2
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9393= 2.0.1 =
    9494* Fixed issue in options class with incompatibility with array accessing a function return i.e. foo()['bar']
     95= 2.0.2 =
     96* Based on support queries, i have added in an option to disable ajax saving for snippets
    9597
    9698== Upgrade Notice ==
     
    110112= 2.0.1 =
    111113* Bug fix
     114= 2.0.2 =
     115* Based on support queries, i have added in an option to disable ajax saving for snippets
     116* Re-added creating the table if it was missing
    112117
    113118== Screenshots ==
  • php-code-for-posts/trunk/templates/admin-index-default.tpl

    r1367869 r1368099  
    4747            <?php echo PhpCodeForPosts::get_hidden_field( 'item', '' ) ?>
    4848            <?php wp_nonce_field( 'updateoptions', PhpCodeForPosts::POSTFIELD_PREFIX . '[actioncode]' ) ?>
    49             <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'complete_deactivation', 'Remove all options and tables on uninstall' ); ?></p>
    50             <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'content_filter', 'Parse inline plugin shortcode tags inside post content (HTML Editor Only)' ); ?></p>
    51             <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'sidebar_filter', 'Parse inline plugin shortcode tags inside sidebar text widgets' ); ?></p>
    52             <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'enable_richeditor', 'Enable Codemirror\'s rich editor for code snippets' ); ?></p>
    53             <p class='formlabel'><?php echo PhpCodeForPosts::get_input_field( 'shortcode', PhpCodeForPosts::$options->get_option('shortcode'), 'Change the shortcode for the plugin (not recommended if you already have snippets!)' ); ?></p>
     49            <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'complete_deactivation', __('Remove all options and tables on uninstall', PhpCodeforPosts::TEXTDOMAIN ) ); ?></p>
     50            <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'content_filter', __('Parse inline plugin shortcode tags inside post content (HTML Editor Only)', PhpCodeforPosts::TEXTDOMAIN ) ); ?></p>
     51            <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'sidebar_filter', __('Parse inline plugin shortcode tags inside sidebar text widgets', PhpCodeforPosts::TEXTDOMAIN ) ); ?></p>
     52            <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'enable_richeditor', __('Enable Codemirror\'s rich editor for code snippets', PhpCodeforPosts::TEXTDOMAIN ) ); ?></p>
     53            <p class='formlabel'><?php echo PhpCodeForPosts::get_checkbox_field( 'ajaxible', __('Use Ajax to save snippets', PhpCodeforPosts::TEXTDOMAIN ) ); ?></p>
     54            <p class='formlabel'><?php echo PhpCodeForPosts::get_input_field( 'shortcode', PhpCodeForPosts::$options->get_option('shortcode'), __('Change the shortcode for the plugin (not recommended if you already have snippets!)', PhpCodeforPosts::TEXTDOMAIN ) ); ?></p>
    5455            <div class='clearall'></div>
    5556            <p><input type='submit' class='button-primary' value='<?php _e( 'Save Options', PhpCodeforPosts::TEXTDOMAIN ) ?>' /></p>
  • php-code-for-posts/trunk/templates/admin-index-edit.tpl

    r1367869 r1368099  
    88        }
    99        ?></h3>
    10         <form action="?page=<?php echo PhpCodeForPosts_Menu::MENU_SLUG?>" method="post" id="codeform" <?php if ($snippet->get_id()) { echo 'class="ajaxible"'; }?>>
     10        <form action="?page=<?php echo PhpCodeForPosts_Menu::MENU_SLUG?>" method="post" id="codeform" <?php if ($snippet->get_id() && PhpCodeforPosts::$options->get_option('ajaxible') == 1) { echo 'class="ajaxible"'; }?>>
    1111            <?php
    1212                echo PhpCodeForPosts::get_hidden_field( 'action', 'save');
Note: See TracChangeset for help on using the changeset viewer.