Plugin Directory

Changeset 2054055


Ignore:
Timestamp:
03/20/2019 02:34:16 PM (7 years ago)
Author:
rmanaf
Message:

2.3.0

Location:
code-injection/trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • code-injection/trunk/includes/assets-manager.php

    r2051415 r2054055  
    5454 * @author Arman Afzal <rman.afzal@gmail.com>
    5555 * @package WP_Divan_Control_Panel
    56  * @version 2.2.9
    5756 */
    5857
     
    101100            wp_register_style('dcp-tag-editor', plugins_url('assets/jquery.tag-editor.css', $this->plugin), [], $ver, 'all');
    102101           
     102           
     103            wp_register_style('custom-code-editor', plugins_url('assets/code-editor.css', $this->plugin), [], $ver, 'all');
     104           
    103105
    104106        }
  • code-injection/trunk/includes/calendar-heatmap.php

    r2051415 r2054055  
    5454 * @author Arman Afzal <rman.afzal@gmail.com>
    5555 * @package WP_Divan_Control_Panel
    56  * @version 2.2.9
    5756 */
    5857
  • code-injection/trunk/includes/code-metabox.php

    r2051415 r2054055  
    5555 * @author Arman Afzal <rman.afzal@gmail.com>
    5656 * @package WP_Divan_Control_Panel
    57  * @version 2.2.9
    5857 */
    5958
     
    6867                'code_tracking' => true,
    6968                'code_enabled' => true,
     69                'code_is_plugin' => false,
     70                'code_activator_key' => ''
    7071            ];
    7172
     
    184185
    185186                extract( $code_options );
    186 
    187187                wp_nonce_field('code-settings-nonce', 'code_meta_box_nonce');
     188
     189                $ignore_keys = get_option('wp_dcp_unsafe_ignore_keys', false);
     190                $use_php = get_option('wp_dcp_unsafe_widgets_php', false);
    188191
    189192                ?>
     
    201204                        <?php _e("Tracking" , self::$text_domain); ?>
    202205                    </label> 
     206                    <p class="description">
     207                        <?php _e("Plugins are not able to be tracked." , self::$text_domain); ?>
     208                    </p>
    203209                </p>
    204210                <!-- 'tracking' section -->
     211
     212
     213                <!-- 'plugin' section -->
     214                <p>
     215                   
     216                    <label>
     217                        <input <?php checked($code_is_plugin , true); ?> type="checkbox" id="code_is_plugin" name="code_is_plugin" value="1" />
     218                        <?php _e("Is Plugin" , self::$text_domain); ?>
     219                    </label>
     220
     221                    <?php if(!$use_php) : ?>
     222                   
     223                    <p class="description">
     224                        <?php _e("Running PHP codes has disabled by the administrator." , self::$text_domain); ?>
     225                    </p>
     226
     227                    <?php endif; ?>
     228
     229                    <?php if(!$ignore_keys) : ?>
     230                   
     231                    <p><strong><?php _e("Activator Key:" , self::$text_domain); ?></strong></p>
     232 
     233                    <input type="text" style="width:100%;"  id="code_activator_key" name="code_activator_key" value="<?php echo $code_activator_key; ?>" />             
     234                   
     235                    <?php else: ?>
     236                   
     237                    <input type="hidden"  id="code_activator_key" name="code_activator_key" value="<?php echo $code_activator_key; ?>" />             
     238                   
     239                    <?php endif; ?>
     240
     241                </p>
     242                <!-- 'plugin' section -->
     243
    205244
    206245                <!-- 'enable' section -->
     
    213252                <!-- 'enable' section -->
    214253
     254
    215255                <?php
    216256
  • code-injection/trunk/includes/code-type.php

    r2051415 r2054055  
    5555 * @author Arman Afzal <rman.afzal@gmail.com>
    5656 * @package WP_Divan_Control_Panel
    57  * @version 2.2.9
    5857 */
    5958
     
    105104            wp_enqueue_style('dcp-codemirror');
    106105            wp_enqueue_style('dcp-codemirror-dracula');
     106            wp_enqueue_style('custom-code-editor');
    107107
    108108            //codemirror
  • code-injection/trunk/includes/database.php

    r2051415 r2054055  
    5454 * @author Arman Afzal <rman.afzal@gmail.com>
    5555 * @package WP_Divan_Control_Panel
    56  * @version 2.2.9
    5756 */
    5857
  • code-injection/trunk/readme.txt

    r2051415 r2054055  
    33Tags: code, snippets, injection
    44Requires at least: 4.5.0
    5 Tested up to: 5.0.3
     5Tested up to: 5.1.1
    66Requires PHP: 5.2.4
    7 Stable tag: 2.2.8
     7Stable tag: 2.3.0
    88License: Apache License, Version 2.0
    99License URI: http://www.apache.org/licenses/LICENSE-2.0
     
    1313== Changelog ==
    1414
    15  = 2.2.8 =
    16 * [fix] Assets Error
    17 * [feature] Codes Category
     15 = 2.3.0 =
     16* [feature] Code as plugin
    1817
    1918[More](https://github.com/Rmanaf/wp-code-injection/blob/master/CHANGELOG.md)
  • code-injection/trunk/uninstall.php

    r2051415 r2054055  
    5353
    5454/**
     55 * @author Arman Afzal <rman.afzal@gmail.com>
    5556 * @package WP_Divan_Control_Panel
    56  * @version 2.2.9
    5757 */
     58
    5859
    5960if (!defined('WP_UNINSTALL_PLUGIN')) {
  • code-injection/trunk/wp-code-injection-plugin-widget.php

    r2051415 r2054055  
    5555 * @author Arman Afzal <rman.afzal@gmail.com>
    5656 * @package WP_Divan_Control_Panel
    57  * @version 2.2.9
    5857 */
    5958
  • code-injection/trunk/wp-code-injection.php

    r2051415 r2054055  
    5656    Plugin URI: https://wordpress.org/plugins/code-injection
    5757    Description: Allows You to inject code snippets into the pages by just using the Wordpress shortcode
    58     Version: 2.2.9
     58    Version: 2.3.0
    5959    Author: Arman Afzal
    6060    Author URI: https://github.com/Rmanaf
     
    6666 * @author Arman Afzal <rman.afzal@gmail.com>
    6767 * @package WP_Divan_Control_Panel
    68  * @version 2.2.9
    6968 */
    7069
     
    152151            add_action('widgets_init', [$this, 'widgets_init']);   
    153152       
     153            add_action('plugins_loaded', [$this, 'load_extra_plugins'] );
     154           
    154155            add_filter('dcp_shortcodes_list', [&$this, 'add_shortcode_to_list']);
     156
     157
    155158
    156159        }
     
    618621
    619622
     623        /**
     624         * loads codes as plugin
     625         * @since 2.2.9
     626         */
     627        public function load_extra_plugins()
     628        {
     629
     630            global $wpdb;
     631
     632            $instance = $this;
     633
     634            $use_php = get_option('wp_dcp_unsafe_widgets_php', false);
     635
     636            if(!$use_php)
     637            {
     638                return;
     639            }
     640
     641            $ignore_keys = get_option('wp_dcp_unsafe_ignore_keys', false);
     642
     643            $keys = get_option('wp_dcp_unsafe_keys' , '');
     644
     645            $query = "
     646                     SELECT $wpdb->posts.*, $wpdb->postmeta.*
     647                     FROM $wpdb->posts, $wpdb->postmeta
     648                     WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
     649                     AND $wpdb->postmeta.meta_key = 'code_options'
     650                     AND $wpdb->posts.post_status = 'publish'
     651                     AND $wpdb->posts.post_type = 'code'
     652                     AND $wpdb->posts.post_date < NOW()
     653                     ORDER BY $wpdb->posts.post_date DESC
     654                     ";
     655
     656            $codes = $wpdb->get_results($query, OBJECT);
     657
     658
     659            $plugins = array_filter($codes , function($element) use ($instance, $ignore_keys, $keys) {
     660
     661                $options = maybe_unserialize($element->meta_value);
     662
     663                extract($options);
     664
     665                $is_plugin =  isset($code_is_plugin) && $code_is_plugin == '1';
     666
     667                if(!$is_plugin || $code_enabled == false)
     668                {
     669                    return false;
     670                }
     671
     672                if($ignore_keys)
     673                {
     674                    return true;
     675                }
     676               
     677                return isset($code_activator_key) && in_array($code_activator_key , $instance->extract_keys($keys));
     678
     679            });
     680
     681            foreach($plugins as $p)
     682            {   
     683                eval("?" . ">" . $p->post_content );
     684            }
     685
     686        }
     687
     688
     689
    620690
    621691        /**
Note: See TracChangeset for help on using the changeset viewer.