=== Woody ad snippets - Insert Header Footer Code, AdSense Ads ===
Contributors: WillBontrager, webcraftic, creativemotion, alexkovalevv
Donate link: http://www.willmaster.com/plugindonate.php
Tags: adsense, ads, Header, Footer, code snippets, run PHP, insert PHP, use PHP, PHP plugin, ads, ad rotation, shortcoder, ad inserter, Header, Footer, ad manager, amp ads, amazon, ad blocking detection, header code, banner, banners, advert, adverts, sticky fixed widgets
Requires at least: 4.7
Tested up to: 5.3
Requires PHP: 5.4
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Insert Headers and Footers, executes PHP code, uses conditional logic to insert ads, text, media content and external service’s code.

== Description ==

### Need professional support? ###
[Get starting FREE support](http://forum.webcraftic.com/forums/problems-and-solutions.3/ "Get starting free support")
[Get starting PREMIUM support](https://webcraftic.com/premium-support/ "Get starting premium support")

- Stop re-using the same content over and over again!
- Stop inserting PHP code to function.php!
- Stop adding google analytics, yandex metrics and external code to header and footer php files!
- Stop wasting time on changing 100 pages with repeated content!

Woody ad snippets will make your life so much easier. The plugin helps to create and store code snippets or duplicated text in a special library at the admin bar of your website. Use the shortcode to add a snippet anywhere on your website. Or do it automatically, for example: head, footer and post injections.  You can show or hide code snippets using conditional logic.

### Why do you need this plugin? ###

- Insert Headers and Footers
- Insert Google AdSense Ads, Amazon Native Shopping Contextual Ads, Yandex Direct Ads, Media.net on your website.
- Insert Google Analytic Tracking code, Yandex Metrica Tracking Code, Yandex Counter to Header, Footer.
- Insert PHP Code Snippets and execute on your website. Register PHP functions, classes, global variables everywhere.
- Insert Social media widgets, add any external resources widgets.
- Insert Facebook Pixels, Facebook Scripts, Facebook og:image Tag, Google Conversion Pixels, Vk Pixels.
- Show or hide code snippets based on conditional logic.
- You can save templates of posts or page builders, quotes, and galleries to re-use them on your website.

### How It Works? ###

#### Example #1 ####
 You create a new javascript snippet and add a code you’d like to place on a website. Html snippet editor provides you with tooltips and highlights errors in syntax. Now you need to define where to put a code. For example, you can place the code in header, footer of all pages. This works great for Google Analytics. Create an additional condition: do not show this code to the administrator. It will prevent from tracking user role.

#### Example #2 ####
You create a text snippet and add a repeated text or a template. You can add a shortcode for the contact form, in case it’s universal for all website pages. Now you can add conditions to show this content to registered users only. Save the text snippet and go to editing pages.  If you use the Gutenberg editor, you need to select a special unit. For the classic editor, click the icon of our plugin and add a shortcode of your new snippet.
As you can see, working with snippets is super easy!

https://youtu.be/FNoNsl_jy2k

### All Plugin Features:###
* Header footer code manager
* User-friendly code editor with syntax highlighter.
* Create rich text ads using a classic WordPress editor TinyMCE.
* Use shortcodes to place a snippet anywhere on a website.
* Use a special unit to add a snippet in Gutenberg Editor.
* You can send content and additional attributes to a snippet using a shortcode or a special unit (Gutenberg Editor).
* Place post snippets automatically on all pages.
* Run PHP code everywhere or for a certain shortcode.
* Use JavaScript, CSS, and HTML code to create code snippets.
* The Unlimited number of code snippets.
* Use shortcodes of other plugins.
* Show or hide code snippets based on conditional logic.
* Export/Import of code snippets.

### Where Can You Place a Snippet Automatically? ###

**All website:**

**Insert Headers and Footers on all pages:**

* Insert Header — code snippet is added to the source code in header before the &lt;/head&gt; tag.
* Insert Footer — code snippet is added to the source code in footer before the &lt;/body&gt; tag.

**Insert to Posts, pages, custom posts:**

* Insert ads Before Post — post snippets is added to the source code before the &lt;/head&gt; tag.
* Insert ads Before Content — page snippets is added before the post/page content.
* Insert ads Before Paragraph — post snippets is added before a certain paragraph. A paragraph number is listed in the Location number field.
* Insert ads After Paragraph — post snippets is added after a certain paragraph. A paragraph number is listed in the Location number field.
* Insert ads After Content — page snippets is added after the post/page content.
* Insert ads After Post — post snippets is added after the post/page.

**Insert to Categories, archives, tags, taxonomy:**

* Insert AdSense Before Excerpt — snippet is added before the post/page preview.
* Insert AdSense After Excerpt — snippet is added after the post/page preview.
* Insert AdSense Between Posts — snippet is added between posts.
* Insert AdSense Before post — snippet is added before a certain post. A post number is listed in the Location number field.
* Insert AdSense After post — snippet is added after a certain post. A post number is listed in the Location number field.

### What Are Conditional Logic Options to Show a Snippet? ###

* Page types;
* Device types;
* Post types;
* Taxonomy;
* User role;
* Contains cookies;
* Where a user came from;
* User’s registration date.

#### Recommended our plugins ####
* [Clearfy - all in one optimization tools](https://wordpress.org/plugins/clearfy/ "Download Clearfy")
* [Robin Image Optimizer - save money on image compression](https://wordpress.org/plugins/robin-image-optimizer/ "Download Robin Image Optimizer")

#### NEED SUPPORT, WE GOT YOU COVERED ####
We provide free support for this plugin. If you are pushed with a problem, just create a new ticket. We will definitely help you!

1. **[Get starting free support](http://forum.webcraftic.com)**
2. **[Documentation](http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/)**

We are very need for your help with [translating Woody ad snippets plugin](https://translate.wordpress.org/projects/wp-plugins/insert-php) into your native language. We want to make it international and understandable for everyone. Please contact us via email inside the plugin, or create a topic on our [support forum](http://forum.webcraftic.com) if you can help with the translations. In exchange for your help, we will give you better support and our premium plugins absolutely free!

### History, Developers, Credits ###

If you are a long-term user, you may be confused about the new plugin update. You’ve been using an old plugin – Insert php 1.3.0, and now got an extended product – Woody ad snippets. Insert php was the first plugin version to work with PHP code. It was created by Will Bontrager Software, LLC. In 2018, the Webcraftic studio started to actively develop the plugin. We’ve created a roadmap and released several powerful updates that help you to use PHP code more comfortable and secure. Now plugin supports not only PHP but other snippet types as well. We’ve decided to rename the plugin as Woody ad snippets. This name is more suitable for new and powerful plugin features.

More information about the Insert PHP plugin can be found here:
http://www.willmaster.com/software/WPplugins/go/iphphome_iphplugin

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/plugin-name` directory, or install the plugin through the WordPress plugins screen directly.

2. Activate the plugin through the 'Plugins' screen in WordPress

3. Use the PHP Snippets -> Add snippet, to create a new snippet

== Frequently Asked Questions ==

= How to pass attributes to a snippet using a shortcode? =

Add a new attribute “simple” to the shortcode [wbcr_php_snippet id=”xx” simple=”example”].

The attribute “simple” is available in the snippet as the $simple variable. The attribute name can contain Latin letters and lowercase digits. You can also use underscore.

= The snippet code executed with an error and I cannot change it, what should I do? =

Do not despair! Even an experienced person can make mistakes. We created a secure mode for this case. Go into it and your snippets code will not be executed.

1. Go to the safe mode by this link: http://your-site-name.dev/wp-admin/?wbcr-php-snippets-safe-mode
2. Edit the snippet in which you made a mistake;
3. Leave safe mode by clicking the link: http://your-site-name.dev/wp-admin/?wbcr-php-snippets-disable-safe-mode

Great, now you should not have any issues!

= How to pass page content to a snippet? =

Pretty often we’d like to hide a part of a text or a form on particular pages and set up display conditions. You need to wrap the content you’d like to pass to a snippet with shortcodes [wbcr_php_snippet id=”xx” simple=”example”]page content[/wbcr_php_snippet]. Page content in a snippet is located in the $content variable.

= Does plugin support Gutenberg editor? =

Yes, it does. You can add there special blocks from our plugin.

= I used the old plugin Insert php 1.3.0. What should I expect in 2.x.x version? =

The old version of Insert php 1.3.0 worked this way: you wrapped PHP code with shortcodes [insert_php]php code[/insert_php]. Starting from version 2.x.x and higher, you need to create special snippets to place PHP code. Use a snippet shortcode [wbcr_php_snippetid=”xx”] instead of shortcodes  [insert_php][/insert_php] to execute PHP code on pages.

We recommend you to move all your code from the post editor to snippets.

Important! TinyMCE converts double quotes to special characters. So if you place this code on the snippet editor, it may not work. To avoid this problem, replace all special symbols of double quotes in your PHP code with classic double quotes.

= How long are you planning to support the old version 1.3.0? =

60% users have already downloaded 2.x.x version. We are trying to reach the number of 80%. The deadline for support is scheduled for March 1, 2019.

You can download the old plugin version from [here](https://downloads.wordpress.org/plugin/insert-php.1.3.zip).

= I don’t like the new plugin version. How can I roll back to 1.3.0 and don’t get updates? =

First of all, please, take some time to actually go through the new version. Usually, it takes a week to see how useful this version may be for you. If you’ve faced any problems or found some bugs, feel free to contact us at our [support forum](http://forum.webcraftic.com).

You can always download the old version (1.3.0) from [here](https://downloads.wordpress.org/plugin/insert-php.1.3.zip).

To avoid getting updates, open the PHP file wp-content/plugins/insert-php/insert_php.php and change the plugin version to 9.9.9.

= Is there any plugin documentation? =

You can find the detailed documentation in [here](http://woody-ad-snippets.webcraftic.com/getting-started-with-woody-ad-snippets/).

= Is plugin compatible with GDPR? =

Yes, the plugin is fully compatible with GDPR.

= Can the plugin be completely uninstalled? =

Go to the settings page and enable the "Complete uninstall" option. Than, when you delete Woody ad snippets using the ‘Plugins’ menu in WordPress it will clean up the database table and a few other bits of data. Be careful not to remove Woody ad snippets by deleting it from the Plugins menu unless you want this to happen.

= How to remove plugin via ftp client? =

You have to delete the folder with the plugin, which is located here: wp-content/plugins/insert-php

This will not clear the plugin data from the database. You have to remove the plugin through the admin panel with the "Full Uninstall" option enabled in order to completely clear the plugin data.

= Will I lose my snippets if I change the theme or upgrade WordPress? =

No, the snippets are stored in the WordPress database and are independent of the theme and unaffected by WordPress upgrades.

= Does plugin work with multisite? =

The plugin doesn’t support multi-sites.

We will definitely add multisite support in the future. You can speed up this process by leaving a request on our [support forum](http://forum.webcraftic.com).

== Screenshots ==

1. Snippets list
2. Edit php snippet
3. Edit text snippet
3. Setting up automatic placement of snippets
4. Setting conditional logic to display a snippet
5. Creating a Snippet for Gutenberg Editor
6. Adding a snippet shortcode to a text widget

== Changelog ==
= 2.3.1 (26.11.2019) =
* Fixed: Bug with images on the about page.

= 2.3.0 (19.11.2019) =
* Fixed: Minor bugs
* Fixed: Import/Export. When user selected some files and clicked to submit, he could be get error "No files selected!"
* Added: Video preview for every snippets in the library.

= 2.2.9 (16.09.2019) =
* Fixed: Due to a problem with WPML, we were forced to cancel the added WPML compatibility in the previous version.
* Fixed: Security issue

= 2.2.8 (13.09.2019) =
* Added: Compatibility with WPML proposed in the support [forum](https://wpml.org/forums/topic/header-and-foster-scripts-translation/)
* Fixed: Security issue
* Fixed: Some users saw the code in the plugin description column. This could lead to JavaScript execution, which led to problems using the plugin [Issue #1](http://forum.webcraftic.com/threads/script-tags-execute-from-description-list.282/), [Issue #2](http://forum.webcraftic.com/threads/insert-php-code-appears-in-description-column.407/#post-1377).
* Fixed: Conditional logic for taxonomies worked only inside singular posts. In taxonomies, tags, and categories, this did not work [Issue #3](http://forum.webcraftic.com/threads/kak-propisat-vyvod-snipeta-na-konkretnoj-stranice.399/)

= 2.2.7 =
* Fixed: Critical php errors

= 2.2.6 =
* Fixed: Some issues with plugin security.
* Fixed: After save JS snippets, the html tags in javascript code were cut out in compiled code.
* Fixed: Minor bugs

= 2.2.5 =
* Fixed: Some issues with plugin security.
* Fixed: When you save the php snippet (running everywhere), there is a conflict with himself.
* Fixed: A notification to install the premium version did not hidden, even if the premium plugin was installed.
* Fixed: Removed spaces in beginning and end of the universal snippets. Please make fix your snippets if you have missing spaces at the beginning and end of the universal snippet.

= 2.2.4 =
* Fixed: Php error (Cannot declare class Post)
* Fixed: Some hooks did not work, when using php snippet with space to run everywhere.
* Fixed: Slashes removed in css snippet: \f058 becomes f058

= 2.2.2 =
- Fixed: Disabled wpautop for snippets
- Fixed: Added compatibility with plugin Robin image optimizer

= 2.2.1 =
- Warning: Support for the old shortcodes ([insert_php]) has been discontinued for new users. Users who have upgraded from version 1.3.0 still have support [insert_php].
- Fixed: Removed warnings about support for old shortcodes for new users.
- Fixed: Сkeditor editor over the code editor, the issue is related to The Rex theme
- Fixed: Warning Invalid argument supplied for foreach(). (It’s the warning in plugin insert-php (method getMetaOption) because get_post_meta could return non-array value if $single is true.)
- Fixed: Some users lost the code editor
- Fixed: Infinite redirect after updating or installing a plugin
- Fixed: Infinite redirect on multisites
- Added: New snippet type: Html. Perfect for you if you do not use php code.
- Added: New snippet type: JavaScript
- Added: New snippet type: Css
- Added: JS and CSS snippets can be asset as external files
- Added: Compatible with Wordpress 5.2
- Added: Multisite support
- Added: Premium plugin support added
- Added: Added setting: "Complete Uninstall". When the plugin is deleted from the Plugins menu, also delete all snippets and plugin settings.- Added: Added setting: "Complete Uninstall". When the plugin is deleted from the Plugins menu, also delete all snippets and plugin settings.
- Added: Added setting: "Support old shortcodes [insert_php]". If you used our plugin from version 1.3.0, then you could use the old shortcodes [insert_php][/insert_php]; from version 2.2.0 we disabled this type of shortcodes by default, as their use is not safe. If you still want to execute your php code via [insert_php][/insert_php] shortcodes, you can enable this option.
- Added: Added setting: "Keep the HTML entities, don't convert to its character". If you want to use an HTML entity in your code (for example > or "), but the editor keeps on changing them to its equivalent character (> and " for the previous example), then you might want to enable this option.

= 2.1.91 =
- Fixed: some users were redirected to about page an infinite number of times
- Fixed: safe mode did not work, since it could be started only after the snippet
- Added: php lint for code editor
- Added: hook wbcr/factory/bootstrap/cache_enable to disable caching of Woody assets. Some users use cdn, it may be useful to them.

= 2.1.9 =
- Fixed: demo snippets were created several times, because of which it could bring a headache
- Fixed: it was impossible to hide metaboxing with ads
- Fixed: some users were redirected to about page an infinite number of times

= 2.1.7 =
- Fixed: Multisite minor bug

= 2.1.6 =
- Fixed: shortcodes don't work in No Cache Ajax Widgets plugin
- Fixed: in Gutenberg when creating a block, the drop-down list is not saved the state of selected option
- Fixed: menu was not displayed in multisite
- Fixed: fixed php bug with import_upload_size_limit function in multisite

= 2.1.5 =
- Fixed: It was impossible to change theme style for code editor
- Fixed: After updating plugin, formatting for code editor was destroyed
- Fixed: Safe mode doesn't work for scripts running with shortcode [insert_php]

= 2.1.4 =
- Fixed: plugin tries to process shortcodes in php code, which causes conflict with do_shortcode
- Fixed: visual composer compatibility added

= 2.1.3 =
- Fixed: bug with escape html code in snippets editor, if you entered the textarea tag, it could destroy the editor.

= 2.1.2 =
- Added: 3 new snippet types. You can use PHP, text, and universal snippets.
- Added: Snippet export/import.
- Added: Conditional logic for text and universal plugins. You can show/hide snippets based on certain conditions.
- Added: Gutenberg support. A new unit for Gutenberg has been added. There you can select available snippets. You can also send content from the editor to a snippet.
- Improved: Support of attributes that are sent to snippets through shortcodes. Now you can use shortcode attributes to send additional values inside snippets. You can limit the number of supported attributes.
- Added: WordPress 5.x.x support.
- Improved: The code editor support. Now it has an inbuilt syntax checker and auto-complete.
- Added: TinyMCE rich-text editor for text snippets.
- Added: Snippet auto-placement on all website. You can automatically place the code to head or footer on all pages. Or you can insert the ad code to all posts (check out the documentation to learn more).
- Added: demo snippet auto-creation on plugin installation.
- Added: special feature to uninstall the plugin. If enabled, all snippets and plugin data will be removed along with the plugin.
- Fixed: error in values sent through shortcode attributes.
- Fixed: error in visual unit preview in Gutenberg editor.
- Fixed: snippet counter for tags.
- Changed: plugin name.
- Changed: plugin icons.
- Changed: plugin description.

= 2.0.6 =
* Changed the way to safely save snippets. Now in case of an error, you will not lose the snippet changes. And also now there is no verification for snippets created for shortcodes, because of what many users had a problem with saving their old code.
* You can get the values of the variables from the shortcode attributes. For example, if you set the my_type attribute for the shortcode [wbcr_php_snippet id="2864" my_type="button"], you can get the value of the my_type attribute in the snippet by calling $my_type var.
* Added feature to set tags for snippets
* Added an instruction on how to export and import your own snippets
* Some bugs fixed.

= 2.0.4 =
* Fixed critical bug with $wp_query. It was a conflict with some plugins that overwritten the global variable $wp_query.
* All created and updated snippets by default, are now active.

= 2.0.2 =
Fixed a bug where you do not have enough permissions to view the page.

= 2.0.1 =
Attention! This new 2.0 plugin version, we added the ability to insert php code using snippets. This is a more convenient and secure way than using shortcodes [insert_php] code execute [/ insert_php]. However, for compatibility reasons, we left support for [insert_php] shortcodes, but we will depreciate them in the next versions of the plugin.

We strongly recommend you to transfer your php code to snippets and call them in your posts/pages and widgets using [wbcr_php_snippet id = "000"] shortcodes.

= 1.3 =
Fixed issue with str_replace() when haystack contained a slash character.

= 1.2 =
Changed handling of content.

= 1.1 =
Bug fix. Added ob_end_flush(); and changed variable names to remove opportunity for conflict with user-provided PHP code.

= 1.0 =
First public distribution version.
