1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193:
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
class Inbound_Marketing_Button {
public function __construct() {
self::init();
}
public function init() {
add_action('admin_enqueue_scripts', array(__CLASS__, 'load_marketing_button_js'), 101);
add_action( 'media_buttons', array(__CLASS__, 'inbound_marketing_button'), 11);
add_action( 'admin_footer', array(__CLASS__, 'for_popup'));
}
static function load_marketing_button_js() {
wp_enqueue_script('inbound-marketing-button', INBOUNDNOW_SHARED_URLPATH . 'assets/js/admin/marketing-button.js' , array() , null , false );
wp_enqueue_script('maginificient-popup', INBOUNDNOW_SHARED_URLPATH . 'assets/js/global/jquery.magnific-popup.min.js' , array() , null , false );
wp_enqueue_style('maginificient-popup-css', INBOUNDNOW_SHARED_URLPATH . 'assets/css/magnific-popup.css');
}
static function inbound_marketing_button($editor_id) {
global $pagenow, $typenow, $wp_version;
$output = '';
if (in_array($pagenow, array('post.php','page.php','post-new.php','post-edit.php' ))) {
if ( version_compare( $wp_version, '3.5', '<' ) ) {
$img = '<img width="20" height="20" src="'.INBOUNDNOW_SHARED_URLPATH.'assets/images/global/inbound-icon.png" />';
} else {
$img = '<span class="wp-media-buttons-icon" id="inboundnow-media-button"></span>';
}
$output = '<a style="padding-left: 3px;" href="#inbound-marketing-popup" class="open-marketing-button-popup inbound-marketing-button button" data-editor="'.$editor_id.'_ifr" class="button">'.$img.'Marketing</a>';
}
echo $output;
}
static function for_popup() {
global $pagenow, $typenow;
if (in_array($pagenow, array('post.php','page.php','post-new.php','post-edit.php'))) { ?>
<style type="text/css">
min-height: 650px;
}
position: fixed;
bottom: 20px;
width: 100%;
}
.marketing-back-button {
position: absolute;
top: 15px;
left: 20px;
cursor: pointer;
}
text-align: center;
}
height: 607px;
}
.inbound-short-list {
padding: 40px;
}
.inbound-short-list li {
position: relative;
padding-left: 30px;
margin-bottom: 29px;
display: block;
font-size: 19px;
vertical-align: top;
}
.inbound-short-list span.new-sc-icons {
top:-1px;
}
.shortcode-popup-block {
max-height: 660px;
overflow: auto;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
background:
padding: 0px;
text-align: left;
max-width: 85%;
margin: 20px auto;
position: relative;
}
.mfp-bg {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 90000;
overflow: hidden;
position: fixed;
background:
opacity: 0.8;
}
.mfp-wrap {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 100001;
position: fixed;
outline: none !important;
-webkit-backface-visibility: hidden;
}
.mfp-container {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 auto;
text-align: left;
z-index: 100002;
}
z-index: 999999;
width: 100%;
margin: auto;
position: fixed;
}
</style>
<div id="inbound-marketing-popup" class="shortcode-popup-block mfp-hide">
<ul class="inbound-short-list" style="display: block;">
<li class="launch-marketing-shortcode" data-launch-sc="quick-forms">
<span class="new-sc-icons mceIcon mce_editor-icon-quick-forms"></span>
<?php _e('Insert Existing Form' , 'inbound-pro' ); ?>
</li>
<li class="launch-marketing-shortcode" data-launch-sc="button">
<span class="new-sc-icons mceIcon mce_editor-icon-button"></span>
<?php _e('Build a Button' , 'inbound-pro' ); ?>
</li>
<li class="launch-marketing-shortcode" data-launch-sc="call-to-action">
<span class="new-sc-icons mceIcon mce_editor-icon-call-to-action"></span>
<?php _e('Call to Action Shortcodes' , 'inbound-pro' ); ?>
</li>
<li class="launch-marketing-shortcode" data-launch-sc="social-share">
<span class="new-sc-icons mceIcon mce_editor-icon-social-share"></span>
<?php _e('Social Share' , 'inbound-pro' ); ?>
</li>
<li class="launch-marketing-shortcode" data-launch-sc="lists">
<span class="new-sc-icons mceIcon mce_editor-icon-lists"></span>
<?php _e('Insert Icon List' , 'inbound-pro' ); ?>
</li>
<li class="launch-marketing-shortcode" data-launch-sc="columns">
<span class="new-sc-icons mceIcon mce_editor-icon-columns"></span>
<?php _e('Insert Columns' , 'inbound-pro' ); ?>
</li>
</ul>
<div id="iframe-target"></div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery("body").on('click', '.marketing-back-button', function () {
jQuery("#iframe-target").html('');
jQuery('.select2-drop').remove();
jQuery('.inbound-short-list').show();
});
});
</script>
<?php
}
}
}
new Inbound_Marketing_Button();