| @@ -1,231 +1,60 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Plugin Name: Woody code snippets (PHP snippets | Insert PHP) | |
| 4 | - * Plugin URI: https://woodysnippet.com/ | |
| 5 | - * Description: Executes PHP code, uses conditional logic to insert ads, text, media content and external service’s code. Ensures no content duplication. | |
| 6 | - * Author: Creative Motion, Will Bontrager Software, LLC <will@willmaster.com> | |
| 7 | - * Version: 2.4.4 | |
| 8 | - * Text Domain: insert-php | |
| 9 | - * Domain Path: /languages/ | |
| 10 | - * Author URI: http://cm-wp.com | |
| 11 | - */ | |
| 2 | +/* | |
| 3 | +Plugin Name: Insert PHP | |
| 4 | +Plugin URI: http://www.willmaster.com/software/WPplugins/ | |
| 5 | +Description: Run PHP code inserted into WordPress posts and pages. | |
| 6 | +Version: 1.3 | |
| 7 | +Date: 29 September 2015 | |
| 8 | +Author: Will Bontrager Software, LLC <will@willmaster.com> | |
| 9 | +Author URI: http://www.willmaster.com/contact.php | |
| 10 | +*/ | |
| 12 | 11 | |
| 13 | -/** | |
| 14 | - * Developers who contributions in the development plugin: | |
| 15 | - * | |
| 16 | - * Will Bontrager | |
| 17 | - * --------------------------------------------------------------------------------- | |
| 18 | - * 1.0.0v - 1.3.0v Developed the first plugin version, which was named Insert php. | |
| 19 | - * This was the founder of this plugin. | |
| 20 | - * | |
| 21 | - * If you are a long-term user, you may be confused about the new plugin update. | |
| 22 | - * You’ve been using an old plugin – Insert php 1.3.0, and now got an extended | |
| 23 | - * product – Woody Code Snippets. Insert php was the first plugin version to work | |
| 24 | - * with PHP code. It was created by Will Bontrager Software, LLC. In 2018, the | |
| 25 | - * Webcraftic studio started to actively develop the plugin. We’ve created a | |
| 26 | - * roadmap and released several powerful updates that help you to use PHP code | |
| 27 | - * more comfortable and secure. Now plugin supports not only PHP but other | |
| 28 | - * snippet types as well. We’ve decided to rename the plugin as Woody ad | |
| 29 | - * snippets. This name is more suitable for new and powerful plugin features. | |
| 30 | - * | |
| 31 | - * More information about the Insert PHP plugin can be found here: | |
| 32 | - * http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin | |
| 33 | - * --------------------------------------------------------------------------------- | |
| 34 | - * | |
| 35 | - * Alexander Kovalev | |
| 36 | - * --------------------------------------------------------------------------------- | |
| 37 | - * 1.3.0v - 2.0.6v. - Developed framework, plugin interface and plugin development. | |
| 38 | - * 2.0.6v. - 2.2.5v - Fix bugs, improvement some code parts for the plugin. | |
| 39 | - * | |
| 40 | - * Email: alex.kovalevv@gmail.com | |
| 41 | - * Personal card: https://alexkovalevv.github.io | |
| 42 | - * Personal repo: https://github.com/alexkovalevv | |
| 43 | - * --------------------------------------------------------------------------------- | |
| 44 | - * | |
| 45 | - * Alexander Vitkalov | |
| 46 | - * --------------------------------------------------------------------------------- | |
| 47 | - * 2.0.6v. - 2.2.5v - Development conditional logic for some snippets, added new snippets types, | |
| 48 | - * development snippets library, development import/export. | |
| 49 | - * | |
| 50 | - * Personal repo: https://github.com/nechin | |
| 51 | - * --------------------------------------------------------------------------------- | |
| 52 | - * | |
| 53 | - * Artem Prihodko | |
| 54 | - * --------------------------------------------------------------------------------- | |
| 55 | - * 2.3.2v - current | |
| 56 | - * | |
| 57 | - * Email: webtemyk@yandex.ru | |
| 58 | - * Personal repo: https://github.com/temyk | |
| 59 | - * --------------------------------------------------------------------------------- | |
| 60 | - * | |
| 61 | - */ | |
| 12 | +/* | |
| 13 | + Copyright 2012,2013,2015 Will Bontrager Software LLC (email: will@willmaster.com) | |
| 62 | 14 | |
| 63 | -// Exit if accessed directly | |
| 64 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 65 | - exit; | |
| 66 | -} | |
| 67 | -// @formatter:off | |
| 15 | + This program is free software; you can redistribute it and/or modify | |
| 16 | + it under the terms of the GNU General Public License, version 2, as | |
| 17 | + published by the Free Software Foundation. A copy of the license is at | |
| 18 | + http://www.gnu.org/licenses/gpl-2.0.html | |
| 68 | 19 | |
| 20 | + This program is distributed in the hope that it will be useful, | |
| 21 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 22 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 23 | + GNU General Public License for more details. | |
| 24 | +*/ | |
| 69 | 25 | |
| 26 | +/* | |
| 27 | +Note: This plugin requires WordPress version 3.3.1 or higher. | |
| 70 | 28 | |
| 71 | -/** | |
| 72 | - * ----------------------------------------------------------------------------- | |
| 73 | - * CHECK REQUIREMENTS | |
| 74 | - * Check compatibility with php and wp version of the user's site. As well as checking | |
| 75 | - * compatibility with other plugins from Webcraftic. | |
| 76 | - * ----------------------------------------------------------------------------- | |
| 77 | - */ | |
| 29 | +Information about the Insert PHP plugin can be found here: | |
| 30 | +http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin | |
| 78 | 31 | |
| 79 | -require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' ); | |
| 32 | +Instructions and examples can be found here: | |
| 33 | +http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin | |
| 34 | +*/ | |
| 80 | 35 | |
| 81 | -$plugin_info = array( | |
| 82 | - 'prefix' => 'wbcr_inp_', | |
| 83 | - 'plugin_name' => 'wbcr_insert_php', | |
| 84 | - 'plugin_title' => __( 'Woody Code Snippets', 'insert-php' ), | |
| 85 | - 'plugin_text_domain' => 'insert-php', | |
| 86 | 36 | |
| 87 | - // PLUGIN SUPPORT | |
| 88 | - 'support_details' => array( | |
| 89 | - 'url' => 'https://r.freemius.com/3465/1916966/http://woody-ad-snippets.webcraftic.com', | |
| 90 | - 'affiliate_url' => 'https://r.freemius.com/3465/1916966/', | |
| 91 | - 'pages_map' => array( | |
| 92 | - 'features' => 'premium-features', // {site}/premium-features | |
| 93 | - 'pricing' => 'pricing', // {site}/prices | |
| 94 | - 'support' => 'support', // {site}/support | |
| 95 | - 'docs' => 'getting-started-with-woody-ad-snippets', // {site}/docs | |
| 96 | - ), | |
| 97 | - ), | |
| 37 | +if( ! function_exists('will_bontrager_insert_php') ) | |
| 38 | +{ | |
| 98 | 39 | |
| 99 | - // PLUGIN ADVERTS | |
| 100 | - 'render_adverts' => true, | |
| 101 | - 'adverts_settings' => array( | |
| 102 | - 'dashboard_widget' => true, // show dashboard widget (default: false) | |
| 103 | - 'right_sidebar' => true, // show adverts sidebar (default: false) | |
| 104 | - 'notice' => true, // show notice message (default: false) | |
| 105 | - ), | |
| 40 | + function will_bontrager_insert_php($content) | |
| 41 | + { | |
| 42 | + $will_bontrager_content = $content; | |
| 43 | + preg_match_all('!\[insert_php[^\]]*\](.*?)\[/insert_php[^\]]*\]!is',$will_bontrager_content,$will_bontrager_matches); | |
| 44 | + $will_bontrager_nummatches = count($will_bontrager_matches[0]); | |
| 45 | + for( $will_bontrager_i=0; $will_bontrager_i<$will_bontrager_nummatches; $will_bontrager_i++ ) | |
| 46 | + { | |
| 47 | + ob_start(); | |
| 48 | + eval($will_bontrager_matches[1][$will_bontrager_i]); | |
| 49 | + $will_bontrager_replacement = ob_get_contents(); | |
| 50 | + ob_clean(); | |
| 51 | + ob_end_flush(); | |
| 52 | + $will_bontrager_content = preg_replace('/'.preg_quote($will_bontrager_matches[0][$will_bontrager_i],'/').'/',$will_bontrager_replacement,$will_bontrager_content,1); | |
| 53 | + } | |
| 54 | + return $will_bontrager_content; | |
| 55 | + } # function will_bontrager_insert_php() | |
| 106 | 56 | |
| 107 | - // PLUGIN UPDATED SETTINGS | |
| 108 | - /*'has_updates' => false, | |
| 109 | - 'updates_settings' => array( | |
| 110 | - 'repository' => 'wordpress', | |
| 111 | - 'slug' => 'woody-ad-snippets', | |
| 112 | - 'maybe_rollback' => true, | |
| 113 | - 'rollback_settings' => array( | |
| 114 | - 'prev_stable_version' => '0.0.0', | |
| 115 | - ), | |
| 116 | - ),*/ | |
| 57 | + add_filter( 'the_content', 'will_bontrager_insert_php', 9 ); | |
| 117 | 58 | |
| 118 | - // PLUGIN PREMIUM SETTINGS | |
| 119 | - 'has_premium' => true, | |
| 120 | - 'license_settings' => array( | |
| 121 | - 'provider' => 'freemius', | |
| 122 | - 'slug' => 'woody-ad-snippets-premium', | |
| 123 | - 'plugin_id' => '3465', | |
| 124 | - 'public_key' => 'pk_fc5703fe4f4fbc3e87f17fce5e0b8', | |
| 125 | - 'price' => 19, | |
| 126 | - 'has_updates' => true, | |
| 127 | - 'updates_settings' => array( | |
| 128 | - 'maybe_rollback' => true, | |
| 129 | - 'rollback_settings' => array( | |
| 130 | - 'prev_stable_version' => '0.0.0', | |
| 131 | - ), | |
| 132 | - ), | |
| 133 | - ), | |
| 134 | - | |
| 135 | - // FRAMEWORK MODULES | |
| 136 | - 'load_factory_modules' => array( | |
| 137 | - array( 'libs/factory/bootstrap', 'factory_bootstrap_454', 'admin' ), | |
| 138 | - array( 'libs/factory/forms', 'factory_forms_450', 'admin' ), | |
| 139 | - array( 'libs/factory/pages', 'factory_pages_452', 'admin' ), | |
| 140 | - array( 'libs/factory/types', 'factory_types_410' ), | |
| 141 | - array( 'libs/factory/taxonomies', 'factory_taxonomies_330' ), | |
| 142 | - array( 'libs/factory/metaboxes', 'factory_metaboxes_409', 'admin' ), | |
| 143 | - array( 'libs/factory/viewtables', 'factory_viewtables_410', 'admin' ), | |
| 144 | - array( 'libs/factory/shortcodes', 'factory_shortcodes_329', 'all' ), | |
| 145 | - array( 'libs/factory/freemius', 'factory_freemius_140', 'all' ), | |
| 146 | - array( 'libs/factory/adverts', 'factory_adverts_130', 'admin' ), | |
| 147 | - array( 'libs/factory/feedback', 'factory_feedback_114', 'admin' ) | |
| 148 | - ), | |
| 149 | -); | |
| 150 | - | |
| 151 | -/** | |
| 152 | - * Checks compatibility with WordPress, php and other plugins. | |
| 153 | - */ | |
| 154 | -$wbcr_compatibility = new Wbcr_Factory453_Requirements( __FILE__, array_merge( $plugin_info, array( | |
| 155 | - 'plugin_already_activate' => defined( 'WINP_PLUGIN_ACTIVE' ), | |
| 156 | - 'required_php_version' => '7.0', | |
| 157 | - 'required_wp_version' => '4.8.0', | |
| 158 | -) ) ); | |
| 159 | - | |
| 160 | -/** | |
| 161 | - * If the plugin is compatible, it will continue its work, otherwise it will be stopped and the user will receive a warning. | |
| 162 | - */ | |
| 163 | -if ( ! $wbcr_compatibility->check() ) { | |
| 164 | - return; | |
| 165 | -} | |
| 166 | - | |
| 167 | -global $wbcr_inp_safe_mode; | |
| 168 | - | |
| 169 | -$wbcr_inp_safe_mode = false; | |
| 170 | - | |
| 171 | -// Set the constant that the plugin is activated | |
| 172 | -define( 'WINP_PLUGIN_ACTIVE', true ); | |
| 173 | - | |
| 174 | -define( 'WINP_PLUGIN_VERSION', $wbcr_compatibility->get_plugin_version() ); | |
| 175 | - | |
| 176 | -// Root directory of the plugin | |
| 177 | -define( 'WINP_PLUGIN_DIR', dirname( __FILE__ ) ); | |
| 178 | - | |
| 179 | -// Absolute url of the root directory of the plugin | |
| 180 | -define( 'WINP_PLUGIN_URL', plugins_url( null, __FILE__ ) ); | |
| 181 | - | |
| 182 | -// Relative url of the plugin | |
| 183 | -define( 'WINP_PLUGIN_BASE', plugin_basename( __FILE__ ) ); | |
| 184 | - | |
| 185 | -// The type of posts used for snippets types | |
| 186 | -define( 'WINP_SNIPPETS_POST_TYPE', 'wbcr-snippets' ); | |
| 187 | - | |
| 188 | -// The taxonomy used for snippets types | |
| 189 | -define( 'WINP_SNIPPETS_TAXONOMY', 'wbcr-snippet-tags' ); | |
| 190 | - | |
| 191 | -// The snippets types | |
| 192 | -define( 'WINP_SNIPPET_TYPE_PHP', 'php' ); | |
| 193 | -define( 'WINP_SNIPPET_TYPE_TEXT', 'text' ); | |
| 194 | -define( 'WINP_SNIPPET_TYPE_UNIVERSAL', 'universal' ); | |
| 195 | -define( 'WINP_SNIPPET_TYPE_CSS', 'css' ); | |
| 196 | -define( 'WINP_SNIPPET_TYPE_JS', 'js' ); | |
| 197 | -define( 'WINP_SNIPPET_TYPE_HTML', 'html' ); | |
| 198 | -define( 'WINP_SNIPPET_TYPE_AD', 'advert' ); | |
| 199 | - | |
| 200 | -require_once( WINP_PLUGIN_DIR . '/libs/factory/core/boot.php' ); | |
| 201 | -require_once( WINP_PLUGIN_DIR . '/includes/compat.php' ); | |
| 202 | -require_once( WINP_PLUGIN_DIR . '/includes/class.insertion.locations.php' ); | |
| 203 | -require_once( WINP_PLUGIN_DIR . '/includes/class.helpers.php' ); | |
| 204 | -require_once( WINP_PLUGIN_DIR . '/includes/class.plugin.php' ); | |
| 205 | - | |
| 206 | -/* | |
| 207 | - * Woocommerce Insertion location | |
| 208 | - * @since 2.4 | |
| 209 | - * */ | |
| 210 | - | |
| 211 | -global $winp_snippets_locations; | |
| 212 | -$winp_snippets_locations = new WINP_Insertion_Locations(); | |
| 213 | - | |
| 214 | -try { | |
| 215 | - new WINP_Plugin( __FILE__, array_merge( $plugin_info, array( | |
| 216 | - 'plugin_version' => WINP_PLUGIN_VERSION, | |
| 217 | - 'plugin_text_domain' => $wbcr_compatibility->get_text_domain(), | |
| 218 | - ) ) ); | |
| 219 | -} catch ( Exception $exception ) { | |
| 220 | - // Plugin wasn't initialized due to an error | |
| 221 | - define( 'WINP_PLUGIN_THROW_ERROR', true ); | |
| 222 | - | |
| 223 | - $wbcr_plugin_error_func = function () use ( $exception ) { | |
| 224 | - $error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Woody Ad Snippets', $exception->getMessage(), $exception->getCode() ); | |
| 225 | - echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; | |
| 226 | - }; | |
| 227 | - | |
| 228 | - add_action( 'admin_notices', $wbcr_plugin_error_func ); | |
| 229 | - add_action( 'network_admin_notices', $wbcr_plugin_error_func ); | |
| 230 | -} | |
| 231 | -// @formatter:on | |
| 59 | +} # if( ! function_exists('will_bontrager_insert_php') ) | |
| 60 | +?> | |