| @@ -3,135 +3,226 @@ | ||
| 3 | 3 | * Plugin Name: Woody ad snippets (PHP snippets | Insert PHP) |
| 4 | 4 | * Plugin URI: http://woody-ad-snippets.webcraftic.com/ |
| 5 | 5 | * Description: Executes PHP code, uses conditional logic to insert ads, text, media content and external service’s code. Ensures no content duplication. |
| 6 | 6 | * Author: Will Bontrager Software, LLC <will@willmaster.com>, Webcraftic <wordpress.webraftic@gmail.com> |
| 7 | - * Version: 2.1.91 | |
| 7 | + * Version: 2.2.7 | |
| 8 | 8 | * Text Domain: insert-php |
| 9 | 9 | * Domain Path: /languages/ |
| 10 | - * Author URI: http://woody-ad-snippets.webcraftic.com/ | |
| 10 | + * Author URI: http://webcraftic.com | |
| 11 | 11 | */ |
| 12 | 12 | |
| 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 ad 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 | + * Alexander Teshabaev | |
| 54 | + * --------------------------------------------------------------------------------- | |
| 55 | + * 2.0.6v. - 2.2.1v - Development snippets library and block for the Guttenberg editor. | |
| 56 | + * | |
| 57 | + * Personal repo: https://github.com/bologer | |
| 58 | + * --------------------------------------------------------------------------------- | |
| 59 | + * | |
| 60 | + * All development rights belong to @webcraftic studio. | |
| 61 | + * http://webcraftic.com | |
| 62 | + */ | |
| 63 | + | |
| 13 | 64 | // Exit if accessed directly |
| 14 | 65 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | 66 | exit; |
| 16 | 67 | } |
| 17 | 68 | |
| 69 | +// @formatter:off | |
| 18 | 70 | |
| 19 | 71 | |
| 20 | -require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class.requirements.php' ); | |
| 21 | 72 | |
| 22 | -$wbcr_inp_plugin_info = array( | |
| 23 | - 'prefix' => 'wbcr_inp_', | |
| 24 | - 'plugin_name' => 'wbcr_insert_php', | |
| 25 | - 'plugin_title' => __( 'Woody ad snippets', 'insert-php' ), | |
| 26 | - 'plugin_build' => 'free', | |
| 27 | - 'updates' => dirname( __FILE__ ) . '/migrations/' | |
| 73 | +/** | |
| 74 | + * ----------------------------------------------------------------------------- | |
| 75 | + * CHECK REQUIREMENTS | |
| 76 | + * Check compatibility with php and wp version of the user's site. As well as checking | |
| 77 | + * compatibility with other plugins from Webcraftic. | |
| 78 | + * ----------------------------------------------------------------------------- | |
| 79 | + */ | |
| 80 | + | |
| 81 | +require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' ); | |
| 82 | + | |
| 83 | +$plugin_info = array( | |
| 84 | + 'prefix' => 'wbcr_inp_', | |
| 85 | + 'plugin_name' => 'wbcr_insert_php', | |
| 86 | + 'plugin_title' => __( 'Woody ad snippets', 'insert-php' ), | |
| 87 | + 'plugin_text_domain' => 'insert-php', | |
| 88 | + | |
| 89 | + // PLUGIN SUPPORT | |
| 90 | + 'support_details' => array( | |
| 91 | + 'url' => 'https://r.freemius.com/3465/1916966/http://woody-ad-snippets.webcraftic.com', | |
| 92 | + 'affiliate_url' => 'https://r.freemius.com/3465/1916966/', | |
| 93 | + 'pages_map' => array( | |
| 94 | + 'features' => 'premium-features', // {site}/premium-features | |
| 95 | + 'pricing' => 'pricing', // {site}/prices | |
| 96 | + 'support' => 'support', // {site}/support | |
| 97 | + 'docs' => 'getting-started-with-woody-ad-snippets', // {site}/docs | |
| 98 | + ), | |
| 99 | + ), | |
| 100 | + | |
| 101 | + // PLUGIN UPDATED SETTINGS | |
| 102 | + /*'has_updates' => false, | |
| 103 | + 'updates_settings' => array( | |
| 104 | + 'repository' => 'wordpress', | |
| 105 | + 'slug' => 'woody-ad-snippets', | |
| 106 | + 'maybe_rollback' => true, | |
| 107 | + 'rollback_settings' => array( | |
| 108 | + 'prev_stable_version' => '0.0.0', | |
| 109 | + ), | |
| 110 | + ),*/ | |
| 111 | + | |
| 112 | + // PLUGIN PREMIUM SETTINGS | |
| 113 | + 'has_premium' => true, | |
| 114 | + 'license_settings' => array( | |
| 115 | + 'provider' => 'freemius', | |
| 116 | + 'slug' => 'woody-ad-snippets-premium', | |
| 117 | + 'plugin_id' => '3465', | |
| 118 | + 'public_key' => 'pk_fc5703fe4f4fbc3e87f17fce5e0b8', | |
| 119 | + 'price' => 19, | |
| 120 | + 'has_updates' => true, | |
| 121 | + 'updates_settings' => array( | |
| 122 | + 'maybe_rollback' => true, | |
| 123 | + 'rollback_settings' => array( | |
| 124 | + 'prev_stable_version' => '0.0.0', | |
| 125 | + ), | |
| 126 | + ), | |
| 127 | + ), | |
| 128 | + | |
| 129 | + // FRAMEWORK MODULES | |
| 130 | + 'load_factory_modules' => array( | |
| 131 | + array( 'libs/factory/bootstrap', 'factory_bootstrap_420', 'admin' ), | |
| 132 | + array( 'libs/factory/forms', 'factory_forms_417', 'admin' ), | |
| 133 | + array( 'libs/factory/pages', 'factory_pages_419', 'admin' ), | |
| 134 | + array( 'libs/factory/types', 'factory_types_410' ), | |
| 135 | + array( 'libs/factory/taxonomies', 'factory_taxonomies_330' ), | |
| 136 | + array( 'libs/factory/metaboxes', 'factory_metaboxes_409', 'admin' ), | |
| 137 | + array( 'libs/factory/viewtables', 'factory_viewtables_410', 'admin' ), | |
| 138 | + array( 'libs/factory/shortcodes', 'factory_shortcodes_329', 'all' ), | |
| 139 | + array( 'libs/factory/freemius', 'factory_freemius_108', 'all' ), | |
| 140 | + ), | |
| 28 | 141 | ); |
| 29 | 142 | |
| 30 | 143 | /** |
| 31 | - * Checks compatibility with Wordpress, php and other plugins. | |
| 144 | + * Checks compatibility with WordPress, php and other plugins. | |
| 32 | 145 | */ |
| 33 | -$wbcr_inp_plugin_requirements = new Wbcr_Factory410_Requirements( __FILE__, array_merge( $wbcr_inp_plugin_info, array( | |
| 34 | - 'plugin_last_version' => '2.0.6', | |
| 146 | +$wbcr_compatibility = new Wbcr_Factory419_Requirements( __FILE__, array_merge( $plugin_info, array( | |
| 35 | 147 | 'plugin_already_activate' => defined( 'WINP_PLUGIN_ACTIVE' ), |
| 36 | - 'required_php_version' => '5.2', | |
| 37 | - 'required_wp_version' => '4.2.0' | |
| 148 | + 'required_php_version' => '5.4', | |
| 149 | + 'required_wp_version' => '4.2.0', | |
| 38 | 150 | ) ) ); |
| 39 | 151 | |
| 40 | 152 | /** |
| 41 | 153 | * If the plugin is compatible, it will continue its work, otherwise it will be stopped and the user will receive a warning. |
| 42 | 154 | */ |
| 43 | -if ( $wbcr_inp_plugin_requirements->check() ) { | |
| 44 | - global $wbcr_inp_safe_mode; | |
| 45 | - | |
| 46 | - $wbcr_inp_safe_mode = false; | |
| 47 | - | |
| 48 | - // Set the constant that the plugin is activated | |
| 49 | - define( 'WINP_PLUGIN_ACTIVE', true ); | |
| 50 | - | |
| 51 | - define( 'WINP_PLUGIN_VERSION', $wbcr_inp_plugin_requirements->getPluginVersion() ); | |
| 52 | - | |
| 53 | - // Root directory of the plugin | |
| 54 | - define( 'WINP_PLUGIN_DIR', dirname( __FILE__ ) ); | |
| 55 | - | |
| 56 | - // Absolute url of the root directory of the plugin | |
| 57 | - define( 'WINP_PLUGIN_URL', plugins_url( null, __FILE__ ) ); | |
| 58 | - | |
| 59 | - // Relative url of the plugin | |
| 60 | - define( 'WINP_PLUGIN_BASE', plugin_basename( __FILE__ ) ); | |
| 61 | - | |
| 62 | - // The type of posts used for snippets types | |
| 63 | - define( 'WINP_SNIPPETS_POST_TYPE', 'wbcr-snippets' ); | |
| 64 | - | |
| 65 | - // The taxonomy used for snippets types | |
| 66 | - define( 'WINP_SNIPPETS_TAXONOMY', 'wbcr-snippet-tags' ); | |
| 67 | - | |
| 68 | - // The snippets types | |
| 69 | - define( 'WINP_SNIPPET_TYPE_PHP', 'php' ); | |
| 70 | - define( 'WINP_SNIPPET_TYPE_TEXT', 'text' ); | |
| 71 | - define( 'WINP_SNIPPET_TYPE_UNIVERSAL', 'universal' ); | |
| 72 | - | |
| 73 | - // The snippet automatic insertion locations | |
| 74 | - define( 'WINP_SNIPPET_AUTO_HEADER', 'header' ); | |
| 75 | - define( 'WINP_SNIPPET_AUTO_FOOTER', 'footer' ); | |
| 76 | - define( 'WINP_SNIPPET_AUTO_BEFORE_POST', 'before_post' ); | |
| 77 | - define( 'WINP_SNIPPET_AUTO_BEFORE_CONTENT', 'before_content' ); | |
| 78 | - define( 'WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH', 'before_paragraph' ); | |
| 79 | - define( 'WINP_SNIPPET_AUTO_AFTER_PARAGRAPH', 'after_paragraph' ); | |
| 80 | - define( 'WINP_SNIPPET_AUTO_AFTER_CONTENT', 'after_content' ); | |
| 81 | - define( 'WINP_SNIPPET_AUTO_AFTER_POST', 'after_post' ); | |
| 82 | - define( 'WINP_SNIPPET_AUTO_BEFORE_EXCERPT', 'before_excerpt' ); | |
| 83 | - define( 'WINP_SNIPPET_AUTO_AFTER_EXCERPT', 'after_excerpt' ); | |
| 84 | - define( 'WINP_SNIPPET_AUTO_BETWEEN_POSTS', 'between_posts' ); | |
| 85 | - define( 'WINP_SNIPPET_AUTO_BEFORE_POSTS', 'before_posts' ); | |
| 86 | - define( 'WINP_SNIPPET_AUTO_AFTER_POSTS', 'after_posts' ); | |
| 87 | - | |
| 88 | - require_once( WINP_PLUGIN_DIR . '/libs/factory/core/boot.php' ); | |
| 89 | - require_once( WINP_PLUGIN_DIR . '/includes/class.helpers.php' ); | |
| 90 | - require_once( WINP_PLUGIN_DIR . '/includes/class.plugin.php' ); | |
| 91 | - | |
| 92 | - try { | |
| 93 | - new WINP_Plugin( __FILE__, array_merge( $wbcr_inp_plugin_info, array( | |
| 94 | - 'plugin_version' => WINP_PLUGIN_VERSION | |
| 95 | - ) ) ); | |
| 96 | - } catch( Exception $exception ) { | |
| 97 | - throw new Exception( $exception->getMessage() ); | |
| 98 | - } | |
| 155 | +if ( ! $wbcr_compatibility->check() ) { | |
| 156 | + return; | |
| 99 | 157 | } |
| 100 | 158 | |
| 101 | -/* | |
| 102 | -Note: This plugin requires WordPress version 3.3.1 or higher. | |
| 159 | +global $wbcr_inp_safe_mode; | |
| 103 | 160 | |
| 104 | -Information about the Insert PHP plugin can be found here: | |
| 105 | -http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin | |
| 161 | +$wbcr_inp_safe_mode = false; | |
| 106 | 162 | |
| 107 | -Instructions and examples can be found here: | |
| 108 | -http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin | |
| 109 | -*/ | |
| 163 | +// Set the constant that the plugin is activated | |
| 164 | +define( 'WINP_PLUGIN_ACTIVE', true ); | |
| 110 | 165 | |
| 111 | -// todo: This is the code of the old version of the plugin, left unchanged for compatibility. Delete in the new major version of the plugin | |
| 112 | -if ( ! function_exists( 'will_bontrager_insert_php' ) ) { | |
| 113 | - | |
| 114 | - function will_bontrager_insert_php( $content ) { | |
| 115 | - | |
| 116 | - if ( WINP_Helper::is_safe_mode() ) { | |
| 117 | - return $content; | |
| 118 | - } | |
| 119 | - | |
| 120 | - $will_bontrager_content = $content; | |
| 121 | - preg_match_all( '!\[insert_php[^\]]*\](.*?)\[/insert_php[^\]]*\]!is', $will_bontrager_content, $will_bontrager_matches ); | |
| 122 | - $will_bontrager_nummatches = count( $will_bontrager_matches[0] ); | |
| 123 | - for ( $will_bontrager_i = 0; $will_bontrager_i < $will_bontrager_nummatches; $will_bontrager_i ++ ) { | |
| 124 | - ob_start(); | |
| 125 | - eval( $will_bontrager_matches[1][ $will_bontrager_i ] ); | |
| 126 | - $will_bontrager_replacement = ob_get_contents(); | |
| 127 | - ob_clean(); | |
| 128 | - ob_end_flush(); | |
| 129 | - $will_bontrager_content = preg_replace( '/' . preg_quote( $will_bontrager_matches[0][ $will_bontrager_i ], '/' ) . '/', $will_bontrager_replacement, $will_bontrager_content, 1 ); | |
| 130 | - } | |
| 131 | - | |
| 132 | - return $will_bontrager_content; | |
| 133 | - } # function will_bontrager_insert_php() | |
| 134 | - | |
| 135 | - add_filter( 'the_content', 'will_bontrager_insert_php', 9 ); | |
| 136 | -} # if( ! function_exists('will_bontrager_insert_php') ) | |
| 166 | +define( 'WINP_PLUGIN_VERSION', $wbcr_compatibility->get_plugin_version() ); | |
| 137 | 167 | |
| 168 | +// Root directory of the plugin | |
| 169 | +define( 'WINP_PLUGIN_DIR', dirname( __FILE__ ) ); | |
| 170 | + | |
| 171 | +// Absolute url of the root directory of the plugin | |
| 172 | +define( 'WINP_PLUGIN_URL', plugins_url( null, __FILE__ ) ); | |
| 173 | + | |
| 174 | +// Relative url of the plugin | |
| 175 | +define( 'WINP_PLUGIN_BASE', plugin_basename( __FILE__ ) ); | |
| 176 | + | |
| 177 | +// The type of posts used for snippets types | |
| 178 | +define( 'WINP_SNIPPETS_POST_TYPE', 'wbcr-snippets' ); | |
| 179 | + | |
| 180 | +// The taxonomy used for snippets types | |
| 181 | +define( 'WINP_SNIPPETS_TAXONOMY', 'wbcr-snippet-tags' ); | |
| 182 | + | |
| 183 | +// The snippets types | |
| 184 | +define( 'WINP_SNIPPET_TYPE_PHP', 'php' ); | |
| 185 | +define( 'WINP_SNIPPET_TYPE_TEXT', 'text' ); | |
| 186 | +define( 'WINP_SNIPPET_TYPE_UNIVERSAL', 'universal' ); | |
| 187 | +define( 'WINP_SNIPPET_TYPE_CSS', 'css' ); | |
| 188 | +define( 'WINP_SNIPPET_TYPE_JS', 'js' ); | |
| 189 | +define( 'WINP_SNIPPET_TYPE_HTML', 'html' ); | |
| 190 | + | |
| 191 | +// The snippet automatic insertion locations | |
| 192 | +define( 'WINP_SNIPPET_AUTO_HEADER', 'header' ); | |
| 193 | +define( 'WINP_SNIPPET_AUTO_FOOTER', 'footer' ); | |
| 194 | +define( 'WINP_SNIPPET_AUTO_BEFORE_POST', 'before_post' ); | |
| 195 | +define( 'WINP_SNIPPET_AUTO_BEFORE_CONTENT', 'before_content' ); | |
| 196 | +define( 'WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH', 'before_paragraph' ); | |
| 197 | +define( 'WINP_SNIPPET_AUTO_AFTER_PARAGRAPH', 'after_paragraph' ); | |
| 198 | +define( 'WINP_SNIPPET_AUTO_AFTER_CONTENT', 'after_content' ); | |
| 199 | +define( 'WINP_SNIPPET_AUTO_AFTER_POST', 'after_post' ); | |
| 200 | +define( 'WINP_SNIPPET_AUTO_BEFORE_EXCERPT', 'before_excerpt' ); | |
| 201 | +define( 'WINP_SNIPPET_AUTO_AFTER_EXCERPT', 'after_excerpt' ); | |
| 202 | +define( 'WINP_SNIPPET_AUTO_BETWEEN_POSTS', 'between_posts' ); | |
| 203 | +define( 'WINP_SNIPPET_AUTO_BEFORE_POSTS', 'before_posts' ); | |
| 204 | +define( 'WINP_SNIPPET_AUTO_AFTER_POSTS', 'after_posts' ); | |
| 205 | + | |
| 206 | +require_once( WINP_PLUGIN_DIR . '/libs/factory/core/boot.php' ); | |
| 207 | +require_once( WINP_PLUGIN_DIR . '/includes/compat.php' ); | |
| 208 | +require_once( WINP_PLUGIN_DIR . '/includes/class.helpers.php' ); | |
| 209 | +require_once( WINP_PLUGIN_DIR . '/includes/class.plugin.php' ); | |
| 210 | + | |
| 211 | +try { | |
| 212 | + new WINP_Plugin( __FILE__, array_merge( $plugin_info, array( | |
| 213 | + 'plugin_version' => WINP_PLUGIN_VERSION, | |
| 214 | + 'plugin_text_domain' => $wbcr_compatibility->get_text_domain(), | |
| 215 | + ) ) ); | |
| 216 | +} catch ( Exception $exception ) { | |
| 217 | + // Plugin wasn't initialized due to an error | |
| 218 | + define( 'WINP_PLUGIN_THROW_ERROR', true ); | |
| 219 | + | |
| 220 | + $wbcr_plugin_error_func = function () use ( $exception ) { | |
| 221 | + $error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Woody Ad Snippets', $exception->getMessage(), $exception->getCode() ); | |
| 222 | + echo '<div class="notice notice-error"><p>' . $error . '</p></div>'; | |
| 223 | + }; | |
| 224 | + | |
| 225 | + add_action( 'admin_notices', $wbcr_plugin_error_func ); | |
| 226 | + add_action( 'network_admin_notices', $wbcr_plugin_error_func ); | |
| 227 | +} | |
| 228 | +// @formatter:on | |