PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.2.4
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.2.4
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 +175 -60 1.32.2.4 View file →
@@ -1,60 +1,175 @@
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 -*/
11 -
12 -/*
13 - Copyright 2012,2013,2015 Will Bontrager Software LLC (email: will@willmaster.com)
14 -
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
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 -*/
25 -
26 -/*
27 -Note: This plugin requires WordPress version 3.3.1 or higher.
28 -
29 -Information about the Insert PHP plugin can be found here:
30 -http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin
31 -
32 -Instructions and examples can be found here:
33 -http://www.willmaster.com/software/WPplugins/go/iphpinstructions_iphplugin
34 -*/
35 -
36 -
37 -if( ! function_exists('will_bontrager_insert_php') )
38 -{
39 -
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()
56 -
57 - add_filter( 'the_content', 'will_bontrager_insert_php', 9 );
58 -
59 -} # if( ! function_exists('will_bontrager_insert_php') )
60 -?>
1 +<?php
2 +/**
3 + * Plugin Name: Woody ad snippets (PHP snippets | Insert PHP)
4 + * Plugin URI: http://woody-ad-snippets.webcraftic.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: Will Bontrager Software, LLC <will@willmaster.com>, Webcraftic <wordpress.webraftic@gmail.com>
7 + * Version: 2.2.4
8 + * Text Domain: insert-php
9 + * Domain Path: /languages/
10 + * Author URI: http://webcraftic.com
11 + */
12 +
13 +// Exit if accessed directly
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit;
16 +}
17 +
18 +// @formatter:off
19 +
20 +
21 +/**
22 + * -----------------------------------------------------------------------------
23 + * CHECK REQUIREMENTS
24 + * Check compatibility with php and wp version of the user's site. As well as checking
25 + * compatibility with other plugins from Webcraftic.
26 + * -----------------------------------------------------------------------------
27 + */
28 +
29 +require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' );
30 +
31 +$plugin_info = array(
32 + 'prefix' => 'wbcr_inp_',
33 + 'plugin_name' => 'wbcr_insert_php',
34 + 'plugin_title' => __( 'Woody ad snippets', 'insert-php' ),
35 + 'plugin_text_domain' => 'insert-php',
36 +
37 + // PLUGIN SUPPORT
38 + 'support_details' => array(
39 + 'url' => 'https://r.freemius.com/3465/1916966/http://woody-ad-snippets.webcraftic.com',
40 + 'pages_map' => array(
41 + 'features' => 'premium-features', // {site}/premium-features
42 + 'pricing' => 'pricing', // {site}/prices
43 + 'support' => 'support', // {site}/support
44 + 'docs' => 'docs', // {site}/docs
45 + ),
46 + ),
47 +
48 + // PLUGIN UPDATED SETTINGS
49 + /*'has_updates' => false,
50 + 'updates_settings' => array(
51 + 'repository' => 'wordpress',
52 + 'slug' => 'woody-ad-snippets',
53 + 'maybe_rollback' => true,
54 + 'rollback_settings' => array(
55 + 'prev_stable_version' => '0.0.0',
56 + ),
57 + ),*/
58 +
59 + // PLUGIN PREMIUM SETTINGS
60 + 'has_premium' => true,
61 + 'license_settings' => array(
62 + 'provider' => 'freemius',
63 + 'slug' => 'woody-ad-snippets',
64 + 'plugin_id' => '3465',
65 + 'public_key' => 'pk_fc5703fe4f4fbc3e87f17fce5e0b8',
66 + 'price' => 19,
67 + 'has_updates' => true,
68 + 'updates_settings' => array(
69 + 'maybe_rollback' => true,
70 + 'rollback_settings' => array(
71 + 'prev_stable_version' => '0.0.0',
72 + ),
73 + ),
74 + ),
75 +
76 + // FRAMEWORK MODULES
77 + 'load_factory_modules' => array(
78 + array( 'libs/factory/bootstrap', 'factory_bootstrap_413', 'admin' ),
79 + array( 'libs/factory/forms', 'factory_forms_413', 'admin' ),
80 + array( 'libs/factory/pages', 'factory_pages_413', 'admin' ),
81 + array( 'libs/factory/types', 'factory_types_406' ),
82 + array( 'libs/factory/taxonomies', 'factory_taxonomies_326' ),
83 + array( 'libs/factory/metaboxes', 'factory_metaboxes_405', 'admin' ),
84 + array( 'libs/factory/viewtables', 'factory_viewtables_406', 'admin' ),
85 + array( 'libs/factory/shortcodes', 'factory_shortcodes_325', 'all' ),
86 + array( 'libs/factory/freemius', 'factory_freemius_102', 'all' ),
87 + ),
88 +);
89 +
90 +/**
91 + * Checks compatibility with WordPress, php and other plugins.
92 + */
93 +$wbcr_compatibility = new Wbcr_Factory413_Requirements( __FILE__, array_merge( $plugin_info, array(
94 + 'plugin_already_activate' => defined( 'WINP_PLUGIN_ACTIVE' ),
95 + 'required_php_version' => '5.4',
96 + 'required_wp_version' => '4.2.0',
97 +) ) );
98 +
99 +/**
100 + * If the plugin is compatible, it will continue its work, otherwise it will be stopped and the user will receive a warning.
101 + */
102 +if ( ! $wbcr_compatibility->check() ) {
103 + return;
104 +}
105 +
106 +global $wbcr_inp_safe_mode;
107 +
108 +$wbcr_inp_safe_mode = false;
109 +
110 +// Set the constant that the plugin is activated
111 +define( 'WINP_PLUGIN_ACTIVE', true );
112 +
113 +define( 'WINP_PLUGIN_VERSION', $wbcr_compatibility->get_plugin_version() );
114 +
115 +// Root directory of the plugin
116 +define( 'WINP_PLUGIN_DIR', dirname( __FILE__ ) );
117 +
118 +// Absolute url of the root directory of the plugin
119 +define( 'WINP_PLUGIN_URL', plugins_url( null, __FILE__ ) );
120 +
121 +// Relative url of the plugin
122 +define( 'WINP_PLUGIN_BASE', plugin_basename( __FILE__ ) );
123 +
124 +// The type of posts used for snippets types
125 +define( 'WINP_SNIPPETS_POST_TYPE', 'wbcr-snippets' );
126 +
127 +// The taxonomy used for snippets types
128 +define( 'WINP_SNIPPETS_TAXONOMY', 'wbcr-snippet-tags' );
129 +
130 +// The snippets types
131 +define( 'WINP_SNIPPET_TYPE_PHP', 'php' );
132 +define( 'WINP_SNIPPET_TYPE_TEXT', 'text' );
133 +define( 'WINP_SNIPPET_TYPE_UNIVERSAL', 'universal' );
134 +define( 'WINP_SNIPPET_TYPE_CSS', 'css' );
135 +define( 'WINP_SNIPPET_TYPE_JS', 'js' );
136 +define( 'WINP_SNIPPET_TYPE_HTML', 'html' );
137 +
138 +// The snippet automatic insertion locations
139 +define( 'WINP_SNIPPET_AUTO_HEADER', 'header' );
140 +define( 'WINP_SNIPPET_AUTO_FOOTER', 'footer' );
141 +define( 'WINP_SNIPPET_AUTO_BEFORE_POST', 'before_post' );
142 +define( 'WINP_SNIPPET_AUTO_BEFORE_CONTENT', 'before_content' );
143 +define( 'WINP_SNIPPET_AUTO_BEFORE_PARAGRAPH', 'before_paragraph' );
144 +define( 'WINP_SNIPPET_AUTO_AFTER_PARAGRAPH', 'after_paragraph' );
145 +define( 'WINP_SNIPPET_AUTO_AFTER_CONTENT', 'after_content' );
146 +define( 'WINP_SNIPPET_AUTO_AFTER_POST', 'after_post' );
147 +define( 'WINP_SNIPPET_AUTO_BEFORE_EXCERPT', 'before_excerpt' );
148 +define( 'WINP_SNIPPET_AUTO_AFTER_EXCERPT', 'after_excerpt' );
149 +define( 'WINP_SNIPPET_AUTO_BETWEEN_POSTS', 'between_posts' );
150 +define( 'WINP_SNIPPET_AUTO_BEFORE_POSTS', 'before_posts' );
151 +define( 'WINP_SNIPPET_AUTO_AFTER_POSTS', 'after_posts' );
152 +
153 +require_once( WINP_PLUGIN_DIR . '/libs/factory/core/boot.php' );
154 +require_once( WINP_PLUGIN_DIR . '/includes/compat.php' );
155 +require_once( WINP_PLUGIN_DIR . '/includes/class.helpers.php' );
156 +require_once( WINP_PLUGIN_DIR . '/includes/class.plugin.php' );
157 +
158 +try {
159 + new WINP_Plugin( __FILE__, array_merge( $plugin_info, array(
160 + 'plugin_version' => WINP_PLUGIN_VERSION,
161 + 'plugin_text_domain' => $wbcr_compatibility->get_text_domain(),
162 + ) ) );
163 +} catch ( Exception $exception ) {
164 + // Plugin wasn't initialized due to an error
165 + define( 'WINP_PLUGIN_THROW_ERROR', true );
166 +
167 + $wbcr_plugin_error_func = function () use ( $exception ) {
168 + $error = sprintf( "The %s plugin has stopped. <b>Error:</b> %s Code: %s", 'Woody Ad Snippets', $exception->getMessage(), $exception->getCode() );
169 + echo '<div class="notice notice-error"><p>' . $error . '</p></div>';
170 + };
171 +
172 + add_action( 'admin_notices', $wbcr_plugin_error_func );
173 + add_action( 'network_admin_notices', $wbcr_plugin_error_func );
174 +}
175 +// @formatter:on