PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.4.6
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.4.6
2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 2.6.1 2.7.0 2.7.1 All 27 releases
← All changes | insert_php.php +219 -48 1.32.4.6 View file →
@@ -1,60 +1,231 @@
1 1 <?php
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 -*/
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.6
8 + * Text Domain: insert-php
9 + * Domain Path: /languages/
10 + * Author URI: https://cm-wp.com
11 + */
11 12
12 -/*
13 - Copyright 2012,2013,2015 Will Bontrager Software LLC (email: will@willmaster.com)
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 + */
14 61
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
62 +// Exit if accessed directly
63 +if ( ! defined( 'ABSPATH' ) ) {
64 + exit;
65 +}
66 +// @formatter:off
19 67
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 -*/
25 68
26 -/*
27 -Note: This plugin requires WordPress version 3.3.1 or higher.
28 69
29 -Information about the Insert PHP plugin can be found here:
30 -http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin
70 +/**
71 + * -----------------------------------------------------------------------------
72 + * CHECK REQUIREMENTS
73 + * Check compatibility with php and wp version of the user's site. As well as checking
74 + * compatibility with other plugins from Webcraftic.
75 + * -----------------------------------------------------------------------------
76 + */
31 77
32 -Instructions and examples can be found here:
33 -http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin
34 -*/
78 +require_once dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php';
35 79
80 +$plugin_info = [
81 + 'prefix' => 'wbcr_inp_',
82 + 'plugin_name' => 'wbcr_insert_php',
83 + 'plugin_title' => __( 'Woody Code Snippets', 'insert-php' ),
84 + 'plugin_text_domain' => 'insert-php',
36 85
37 -if( ! function_exists('will_bontrager_insert_php') )
38 -{
86 + // PLUGIN SUPPORT
87 + 'support_details' => [
88 + 'url' => 'https://r.freemius.com/3465/1916966/https://woodysnippet.com',
89 + 'affiliate_url' => 'https://r.freemius.com/3465/1916966/',
90 + 'pages_map' => [
91 + 'features' => 'premium-features', // {site}/premium-features
92 + 'pricing' => 'pricing', // {site}/prices
93 + 'support' => 'support', // {site}/support
94 + 'docs' => 'getting-started-with-woody-ad-snippets', // {site}/docs
95 + ],
96 + ],
39 97
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()
98 + // PLUGIN ADVERTS
99 + 'render_adverts' => true,
100 + 'adverts_settings' => [
101 + 'dashboard_widget' => true, // show dashboard widget (default: false)
102 + 'right_sidebar' => true, // show adverts sidebar (default: false)
103 + 'notice' => true, // show notice message (default: false)
104 + ],
56 105
57 - add_filter( 'the_content', 'will_bontrager_insert_php', 9 );
106 + // PLUGIN UPDATED SETTINGS
107 + /*
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 + ),*/
58 117
59 -} # if( ! function_exists('will_bontrager_insert_php') )
60 -?>
118 + // PLUGIN PREMIUM SETTINGS
119 + 'has_premium' => true,
120 + 'license_settings' => [
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' => [
128 + 'maybe_rollback' => true,
129 + 'rollback_settings' => [
130 + 'prev_stable_version' => '0.0.0',
131 + ],
132 + ],
133 + ],
134 +
135 + // FRAMEWORK MODULES
136 + 'load_factory_modules' => [
137 + [ 'libs/factory/bootstrap', 'factory_bootstrap_458', 'admin' ],
138 + [ 'libs/factory/forms', 'factory_forms_454', 'admin' ],
139 + [ 'libs/factory/pages', 'factory_pages_456', 'admin' ],
140 + [ 'libs/factory/types', 'factory_types_413' ],
141 + [ 'libs/factory/taxonomies', 'factory_taxonomies_333' ],
142 + [ 'libs/factory/metaboxes', 'factory_metaboxes_413', 'admin' ],
143 + [ 'libs/factory/viewtables', 'factory_viewtables_413', 'admin' ],
144 + [ 'libs/factory/shortcodes', 'factory_shortcodes_333', 'all' ],
145 + [ 'libs/factory/freemius', 'factory_freemius_144', 'all' ],
146 + [ 'libs/factory/adverts', 'factory_adverts_134', 'admin' ],
147 + [ 'libs/factory/feedback', 'factory_feedback_117', 'admin' ],
148 + ],
149 +];
150 +
151 +/**
152 + * Checks compatibility with WordPress, php and other plugins.
153 + */
154 +$wbcr_compatibility = new Wbcr_Factory457_Requirements( __FILE__, array_merge( $plugin_info, [
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, [
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