| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Insert HTML Snippet |
| 4 |
Plugin URI: http://xyzscripts.com/wordpress-plugins/insert-html-snippet/ |
| 5 |
Description: Add HTML code to your pages and posts easily using shortcodes. This plugin lets you create a shortcode corresponding to any random HTML code such as ad codes, javascript, video embedding, etc. and use the same in your posts, pages or widgets.It also includes flexible snippet placement options: Automatic and Manual Shortcode. |
| 6 |
Version: 1.4.3 |
| 7 |
Author: xyzscripts.com |
| 8 |
Author URI: http://xyzscripts.com/ |
| 9 |
Text Domain: insert-html-snippet |
| 10 |
License: GPLv2 or later |
| 11 |
*/ |
| 12 |
|
| 13 |
/* |
| 14 |
This program is free software; you can redistribute it and/or |
| 15 |
modify it under the terms of the GNU General Public License |
| 16 |
as published by the Free Software Foundation; either version 2 |
| 17 |
of the License, or (at your option) any later version. |
| 18 |
|
| 19 |
This program is distributed in the hope that it will be useful, |
| 20 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
GNU General Public License for more details. |
| 23 |
|
| 24 |
You should have received a copy of the GNU General Public License |
| 25 |
along with this program; if not, write to the Free Software |
| 26 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 27 |
*/ |
| 28 |
|
| 29 |
if ( ! defined( 'ABSPATH' ) ) |
| 30 |
exit; |
| 31 |
|
| 32 |
|
| 33 |
// error_reporting(E_ALL); |
| 34 |
|
| 35 |
define('XYZ_INSERT_HTML_PLUGIN_FILE',__FILE__); |
| 36 |
|
| 37 |
require( dirname( __FILE__ ) . '/xyz-functions.php' ); |
| 38 |
|
| 39 |
require( dirname( __FILE__ ) . '/add_shortcode_tynimce.php' ); |
| 40 |
|
| 41 |
require( dirname( __FILE__ ) . '/admin/install.php' ); |
| 42 |
|
| 43 |
require( dirname( __FILE__ ) . '/admin/menu.php' ); |
| 44 |
|
| 45 |
require( dirname( __FILE__ ) . '/shortcode-handler.php' ); |
| 46 |
|
| 47 |
require( dirname( __FILE__ ) . '/ajax-handler.php' ); |
| 48 |
|
| 49 |
require( dirname( __FILE__ ) . '/admin/uninstall.php' ); |
| 50 |
|
| 51 |
require( dirname( __FILE__ ) . '/widget.php' ); |
| 52 |
|
| 53 |
require( dirname( __FILE__ ) . '/direct_call.php' ); |
| 54 |
|
| 55 |
require( dirname( __FILE__ ) . '/admin/admin-notices.php' ); |
| 56 |
|
| 57 |
if(get_option('xyz_credit_link')=="ihs"){ |
| 58 |
|
| 59 |
add_action('wp_footer', 'xyz_ihs_credit'); |
| 60 |
|
| 61 |
} |
| 62 |
function xyz_ihs_credit() { |
| 63 |
$content = '<div style="width:100%;text-align:center; font-size:11px; clear:both"><a target="_blank" title="Insert HTML Snippet Wordpress Plugin" href="http://xyzscripts.com/wordpress-plugins/insert-html-snippet/">HTML Snippets</a> Powered By : <a target="_blank" title="PHP Scripts & Wordpress Plugins" href="http://www.xyzscripts.com" >XYZScripts.com</a></div>'; |
| 64 |
echo $content; |
| 65 |
} |
| 66 |
add_action('admin_init', 'xyz_ihs_check_and_upgrade_plugin_version'); |
| 67 |
|
| 68 |
function xyz_ihs_check_and_upgrade_plugin_version() { |
| 69 |
$current_version = xyz_ihs_plugin_get_version(); |
| 70 |
$saved_version = get_option('xyz_ihs_free_version'); |
| 71 |
if ($saved_version === false) { |
| 72 |
xyz_ihs_run_upgrade_routines(); |
| 73 |
add_option('xyz_ihs_free_version', $current_version); |
| 74 |
} elseif (version_compare($current_version, $saved_version, '>')) { |
| 75 |
xyz_ihs_run_upgrade_routines(); |
| 76 |
update_option('xyz_ihs_free_version', $current_version); |
| 77 |
} |
| 78 |
} |
| 79 |
add_filter('plugin_action_links_' . plugin_basename(XYZ_INSERT_HTML_PLUGIN_FILE), 'xyz_ihs_plugin_action_links'); |
| 80 |
function xyz_ihs_plugin_action_links($links) { |
| 81 |
if (isset($links['deactivate'])) { |
| 82 |
if (preg_match('/href=[\'"]([^\'"]+)[\'"]/', $links['deactivate'], $matches)) { |
| 83 |
$ihs_deactivation_url = esc_url($matches[1]); |
| 84 |
$links['deactivate'] = '<a href="' . $ihs_deactivation_url . '" class="xyz-ihs-deactivate-link">Deactivate</a>'; |
| 85 |
} |
| 86 |
} |
| 87 |
return $links; |
| 88 |
} |
| 89 |
add_action('admin_enqueue_scripts', 'xyz_ihs_enqueue_modal_assets'); |
| 90 |
function xyz_ihs_enqueue_modal_assets($hook) { |
| 91 |
if ($hook !== 'plugins.php') return; |
| 92 |
add_action('admin_footer', 'xyz_ihs_modal_html'); |
| 93 |
} |
| 94 |
function xyz_ihs_modal_html() { |
| 95 |
?> |
| 96 |
<div id="xyz-ihs-modal" class="xyz-ihs-modal-overlay" style="display:none;"> |
| 97 |
<div class="xyz-ihs-modal-box"> |
| 98 |
<h2>Are you sure you want to deactivate?</h2> |
| 99 |
<p> |
| 100 |
<span class="dashicons dashicons-warning" style="color: #d63638; font-size: 20px; vertical-align: middle;"></span> |
| 101 |
<strong> <u>Deleting</u> Insert HTML Snippet <u>afterward</u> will permanently remove all saved snippets. Shortcodes using them will stop working.</strong> |
| 102 |
</p> |
| 103 |
<div class="xyz-ihs-modal-buttons"> |
| 104 |
<button id="xyz-ihs-proceed-deactivate" class="button button-primary">Proceed to Deactivate</button> |
| 105 |
<button id="xyz-ihs-cancel-deactivate" class="button">Cancel</button> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
<?php |
| 110 |
} |
| 111 |
?> |
| 112 |
|