/** * Register all the meta boxes for the Popup custom post type * * @since 1.0 * @return void */ function popmake_add_popup_meta_box() { /** Display Meta **/ add_meta_box('popmake_popup_display', __('Display Settings', 'popup-maker'), 'popmake_render_popup_display_meta_box', 'popup', 'normal', 'high'); /** Close Meta **/ add_meta_box('popmake_popup_close', __('Close Settings', 'popup-maker'), 'popmake_render_popup_close_meta_box', 'popup', 'normal', 'high'); /** Loading Meta **/ add_meta_box('popmake_popup_targeting_condition', __('Targeting Conditions', 'popup-maker'), 'popmake_render_popup_targeting_condition_meta_box', 'popup', 'side', 'high'); /** Theme Meta **/ add_meta_box('popmake_popup_themes', __('Theme Settings', 'popup-maker'), 'popmake_render_popup_themes_meta_box', 'popup', 'side', 'high'); /** Click Open Meta **/ add_meta_box('popmake_popup_click_open', __('Click Open Settings', 'popup-maker'), 'popmake_render_popup_click_open_meta_box', 'popup', 'side', 'default'); /** Auto Open Popups Meta **/ add_meta_box('popmake_popup_auto_open', __('Auto Open Settings', 'popup-maker'), 'popmake_render_popup_auto_open_meta_box', 'popup', 'normal', 'high'); /** Admin Debug **/ add_meta_box('popmake_popup_admin_debug', __('Admin Debug Settings', 'popup-maker'), 'popmake_render_popup_admin_debug_meta_box', 'popup', 'normal', 'low'); if (!popmake_get_option('disable_admin_support_widget', false)) { /** Support Meta **/ add_meta_box('popmake_popup_support', __('Support', 'popup-maker'), 'popmake_render_support_meta_box', 'popup', 'side', 'default'); } if (!popmake_get_option('disable_admin_share_widget', false)) { /** Share Meta **/ add_meta_box('popmake_popup_share', __('Share', 'popup-maker'), 'popmake_render_share_meta_box', 'popup', 'side', 'default'); } }
/** * Register all the meta boxes for the Theme custom post type * * @since 1.0 * @return void */ function popmake_add_popup_theme_meta_box() { $singular = popmake_get_label_singular('popup_theme'); $plural = popmake_get_label_plural('popup_theme'); /** Preview Window **/ add_meta_box('popmake_popup_theme_preview', __('Theme Preview', 'popup-maker'), 'popmake_render_popup_theme_preview_meta_box', 'popup_theme', 'side', 'high'); /** Overlay Meta **/ add_meta_box('popmake_popup_theme_overlay', __('Overlay Settings', 'popup-maker'), 'popmake_render_popup_theme_overlay_meta_box', 'popup_theme', 'normal', 'high'); /** Container Meta **/ add_meta_box('popmake_popup_theme_container', __('Container Settings', 'popup-maker'), 'popmake_render_popup_theme_container_meta_box', 'popup_theme', 'normal', 'high'); /** Title Meta **/ add_meta_box('popmake_popup_theme_title', __('Title Settings', 'popup-maker'), 'popmake_render_popup_theme_title_meta_box', 'popup_theme', 'normal', 'high'); /** Content Meta **/ add_meta_box('popmake_popup_theme_content', __('Content Settings', 'popup-maker'), 'popmake_render_popup_theme_content_meta_box', 'popup_theme', 'normal', 'high'); /** Close Meta **/ add_meta_box('popmake_popup_theme_close', __('Close Settings', 'popup-maker'), 'popmake_render_popup_theme_close_meta_box', 'popup_theme', 'normal', 'high'); if (!popmake_get_option('disable_admin_support_widget', false)) { /** Support Meta **/ add_meta_box('popmake_popup_support', __('Support', 'popup-maker'), 'popmake_render_support_meta_box', 'popup_theme', 'side', 'default'); } if (!popmake_get_option('disable_admin_share_widget', false)) { /** Share Meta **/ add_meta_box('popmake_popup_share', __('Share', 'popup-maker'), 'popmake_render_share_meta_box', 'popup_theme', 'side', 'default'); } }
function popmake_render_popup_theme_styles() { if (current_action() == 'wp_head' && popmake_get_option('disable_popup_theme_styles', false) || current_action() == 'admin_head' && !popmake_is_admin_popup_page()) { return; } $styles = get_transient('popmake_theme_styles'); if (!$styles) { $styles = ''; $google_fonts = array(); foreach (popmake_get_all_popup_themes() as $theme) { $theme_styles = popmake_render_theme_styles($theme->ID); $google_fonts = array_merge($google_fonts, popmake_get_popup_theme_google_fonts($theme->ID)); if ($theme_styles != '') { $styles .= "/* Popup Theme " . $theme->ID . ": " . $theme->post_title . " */\r\n"; $styles .= $theme_styles; } } if (!empty($google_fonts)) { $link = "//fonts.googleapis.com/css?family="; foreach ($google_fonts as $font_family => $variants) { if ($link != "//fonts.googleapis.com/css?family=") { $link .= "|"; } $link .= $font_family; if (!empty($variants)) { $link .= ":"; $link .= implode(',', $variants); } } $styles = "/* Popup Google Fonts */\r\n@import url('{$link}');\r\n\r\n" . $styles; } set_transient('popmake_theme_styles', $styles, 7 * DAY_IN_SECONDS); } echo '<style id="popup-maker-themes" type="text/css">' . $styles . '</style>'; }
function popmake_get_license($key = null) { $license = popmake_get_option(POPMAKE_SLUG . '-license'); if (!$license) { $license = array('valid' => false, 'key' => '', 'status' => array('code' => null, 'message' => null, 'expires' => null, 'domains' => null)); popmake_update_option(POPMAKE_SLUG . '-license', $license); } return $license && $key ? emresolve($license, $key) : $license; }
/** * Class constructor * * @param string $_file * @param string $_item_name * @param string $_version * @param string $_author * @param string $_api_url */ function __construct($_file, $_item_name, $_version, $_author, $_api_url = null) { $this->file = $_file; $this->item_name = $_item_name; $this->item_shortname = 'popmake_' . preg_replace('/[^a-zA-Z0-9_\\s]/', '', str_replace(' ', '_', strtolower($this->item_name))); $this->version = $_version; $this->license = trim(popmake_get_option($this->item_shortname . '_license_key', '')); $this->author = $_author; $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url; // Setup hooks $this->includes(); $this->hooks(); }
function popmake_render_popup_theme_styles() { if (current_action() == 'wp_head' && popmake_get_option('disable_popup_theme_styles', false) || current_action() == 'admin_head' && !popmake_is_admin_popup_page()) { return; } $styles = get_transient('popmake_theme_styles'); if (!$styles) { $styles = ''; foreach (popmake_get_all_popup_themes() as $theme) { $theme_styles = popmake_render_theme_styles($theme->ID); if ($theme_styles != '') { $styles .= "/* Popup Theme " . $theme->ID . ": " . $theme->post_title . " */\r\n"; $styles .= $theme_styles; } } set_transient('popmake_theme_styles', $styles, 7 * DAY_IN_SECONDS); } // echo '<style id="popup-maker-themes" type="text/css">' . $styles . '</style>'; }
/** * Load Styles * * Loads the Popup Maker stylesheet. * * @since 1.0 * @return void */ function popmake_load_site_styles() { global $popmake_needed_google_fonts; $css_dir = POPMAKE_URL . '/assets/styles/'; $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.css' : '.min.css'; wp_register_style('popup-maker-site', $css_dir . 'popup-maker-site' . $suffix, false, POPMAKE_VERSION); if (!empty($popmake_needed_google_fonts) && !popmake_get_option('disable_google_font_loading', false)) { $link = "//fonts.googleapis.com/css?family="; foreach ($popmake_needed_google_fonts as $font_family => $variants) { if ($link != "//fonts.googleapis.com/css?family=") { $link .= "|"; } $link .= $font_family; if (!empty($variants)) { $link .= ":"; $link .= implode(',', $variants); } } wp_register_style('popup-maker-google-fonts', $link); } }
function popmake_tools_page() { $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], popmake_get_tools_tabs()) ? $_GET['tab'] : 'system_info'; ob_start(); ?> <div class="wrap"> <h2><?php esc_html_e(__('Popup Maker Tools', 'popup-maker')); ?> </h2> <?php if (isset($_GET['imported'])) { ?> <div class="updated"> <p><?php _e('Successfully Imported your themes & modals from Easy Modal.'); ?> </p> </div> <?php } ?> <h2 id="popmake-tabs" class="nav-tab-wrapper"><?php foreach (popmake_get_tools_tabs() as $tab_id => $tab_name) { $tab_url = add_query_arg(array('tools-updated' => false, 'tab' => $tab_id)); $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; echo '<a href="' . esc_url($tab_url) . '" title="' . esc_attr($tab_name) . '" class="nav-tab' . $active . '">'; echo esc_html($tab_name); echo '</a>'; } ?> </h2> <form id="popmake-tools-editor" method="post" action=""> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div id="tab_container"> <?php do_action('popmake_tools_page_tab_' . $active_tab); ?> </div> <!-- #tab_container--> </div> <div id="postbox-container-1" class="postbox-container"> <div class="postbox " id="submitdiv"> <h3 class="hndle"><span><?php _e('Save', 'popup-maker'); ?> </span></h3> <div class="inside"> <div id="submitpost" class="submitbox"> <div id="major-publishing-actions" class="submitbox"> <div id="publishing-action"> <span class="spinner"></span> <input type="submit" accesskey="p" value="<?php _e('Save', 'popup-maker'); ?> " class="button button-primary button-large" id="publish" name="publish"> </div> <div class="clear"></div> </div> </div> <div class="clear"></div> </div> </div> <?php if (!popmake_get_option('disable_admin_support_widget', false)) { ?> <div class="postbox " id="supportdiv"> <h3 class="hndle"><span><?php _e('Support', 'popup-maker'); ?> </span></h3> <div class="inside"> <?php popmake_render_support_meta_box(); ?> <div class="clear"></div> </div> </div> <?php } ?> <?php do_action('popmake_admin_sidebar'); ?> </div> </div> <br class="clear"/> </div> </form> </div><?php echo ob_get_clean(); }
/** * Display the admin notice to users that have not opted-in or out * * @access public * @return void */ public function admin_notice() { $hide_notice = get_option('popmake_tracking_notice'); if ($hide_notice) { return; } if (popmake_get_option('allow_tracking', false)) { return; } if (!current_user_can('manage_options')) { return; } if (stristr(network_site_url('/'), 'dev') !== false || stristr(network_site_url('/'), 'localhost') !== false || stristr(network_site_url('/'), ':8888') !== false) { update_option('popmake_tracking_notice', '1'); } else { $optin_url = add_query_arg('popmake_action', 'opt_into_tracking'); $optout_url = add_query_arg('popmake_action', 'opt_out_of_tracking'); echo '<div class="updated"><p>'; echo __('Allow Popup Maker to track plugin usage? Opt-in to tracking and our newsletter and we will immediately e-mail you a 20% discount which you can use on any of our extensions. No sensitive data is tracked.', 'popup-maker'); echo '</p><p>'; echo ' <a href="' . esc_url($optin_url) . '" class="button-primary">' . __('Allow tracking', 'popup-maker') . '</a>'; echo ' <a style="opacity:0.7;" href="' . esc_url($optout_url) . '" class="button-secondary">' . __('Do not allow tracking', 'popup-maker') . '</a>'; echo '</p></div>'; } }
function popmake_settings_page() { $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], popmake_get_settings_tabs()) ? $_GET['tab'] : 'general'; ob_start(); ?> <div class="wrap"> <h2><?php esc_html_e(__('Popup Maker Settings', 'popup-maker')); ?> </h2> <h2 id="popmake-tabs" class="nav-tab-wrapper"><?php foreach (popmake_get_settings_tabs() as $tab_id => $tab_name) { $tab_url = add_query_arg(array('settings-updated' => false, 'tab' => $tab_id)); $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; echo '<a href="' . esc_url($tab_url) . '" title="' . esc_attr($tab_name) . '" class="nav-tab' . $active . '">'; echo esc_html($tab_name); echo '</a>'; } ?> </h2> <form id="popmake-settings-editor" method="post" action="options.php"> <?php do_action('popmake_form_nonce'); ?> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div id="tab_container"> <table class="form-table"><?php settings_fields('popmake_settings'); do_settings_fields('popmake_settings_' . $active_tab, 'popmake_settings_' . $active_tab); ?> </table> <?php submit_button(); ?> </div><!-- #tab_container--> </div> <div id="postbox-container-1" class="postbox-container"> <div class="postbox " id="submitdiv"> <h3 class="hndle"><span><?php _e('Save', 'popup-maker'); ?> </span></h3> <div class="inside"> <div id="submitpost" class="submitbox"> <div id="major-publishing-actions" class="submitbox"> <div id="publishing-action"> <span class="spinner"></span> <input type="submit" accesskey="p" value="<?php _e('Save', 'popup-maker'); ?> " class="button button-primary button-large" id="publish" name="publish"> </div> <div class="clear"></div> </div> </div> <div class="clear"></div> </div> </div> <?php if (!popmake_get_option('disable_admin_support_widget', false)) { ?> <div class="postbox " id="supportdiv"> <h3 class="hndle"><span><?php _e('Support', 'popup-maker'); ?> </span></h3> <div class="inside"> <?php popmake_render_support_meta_box(); ?> <div class="clear"></div> </div> </div> <?php } ?> <?php if (!popmake_get_option('disable_admin_share_widget', false)) { ?> <div id="sharediv"> <div class="inside"> <?php popmake_render_share_meta_box(); ?> <div class="clear"></div> </div> </div> <?php } ?> <?php do_action('popmake_admin_sidebar'); ?> </div> </div> <br class="clear"/> </div> </form> </div><?php echo ob_get_clean(); }