public static function print_ajax_scripts($keep = '')
 {
     self::enqueue_footer_js();
     if ($keep != 'all') {
         if ($keep == 'none') {
             $keep_scripts = $keep_styles = array();
         } else {
             $keep_scripts = array('recaptcha-api', 'jquery-frm-rating', 'jquery-chosen', 'google_jsapi', 'flashcanvas', 'jquery-signaturepad', 'frm-signature');
             $keep_styles = array('dashicons', 'jquery-theme');
             if (is_array($keep)) {
                 $keep_scripts = array_merge($keep_scripts, $keep);
             }
         }
         global $wp_scripts, $wp_styles;
         $keep_scripts = apply_filters('frm_ajax_load_scripts', $keep_scripts);
         $registered_scripts = (array) $wp_scripts->registered;
         $registered_scripts = array_diff(array_keys($registered_scripts), $keep_scripts);
         $wp_scripts->done = array_merge($wp_scripts->done, $registered_scripts);
         $keep_styles = apply_filters('frm_ajax_load_styles', $keep_styles);
         $registered_styles = (array) $wp_styles->registered;
         $registered_styles = array_diff(array_keys($registered_styles), $keep_styles);
         if (!empty($registered_styles)) {
             $wp_styles->done = array_merge($wp_styles->done, $registered_styles);
         }
     }
     wp_print_footer_scripts();
     self::footer_js();
 }
Example #2
0
function snp_run_camp($POST_META)
{
    global $snp_ignore_cookies, $wp_scripts;
    $snp_ignore_cookies = true;
    snp_run_popup($POST_META['snp_camp_popup'], $POST_META['snp_camp_use']);
    echo '<!DOCTYPE html>';
    echo '<html><head>';
    echo '<style> body, html { height: 100%; width: 100%;} ';
    echo 'body { display: block;margin: 0;padding: 0;} </style>';
    snp_init();
    //wp_head();
    wp_enqueue_scripts();
    foreach ($wp_scripts->registered as $k => $v) {
        //print_r($v);
        if (!in_array($v->handle, array('jquery', 'jquery-core', 'fancybox2', 'jquery-ui-core', 'jquery-migrate', 'js-ninjapopups', 'jquery-np-cookie', 'jquery-np-placeholder'))) {
            wp_deregister_script($v->handle);
        }
    }
    wp_print_styles();
    print_admin_styles();
    wp_print_head_scripts();
    echo '</head><body>';
    echo '<iframe src="' . $POST_META['snp_camp_dest_url'] . '" style="width: 100%; height: 100%; border: 0; padding: 0; margin: 0; line-height: 0; display: block;"></iframe>';
    snp_footer();
    wp_print_footer_scripts();
    echo '</body></html>';
    die('');
}
 /**
  * When PHP has finished, we output the footer scripts and closing tags
  */
 function output_buffer($in_shutdown = FALSE)
 {
     // If the footer scripts haven't been outputted, then
     // we need to take action - as they're required
     if (!$this->wrote_footer) {
         // If W3TC is installed and activated, we can't output the
         // scripts and manipulate the buffer, so we can only provide a warning
         if (defined('W3TC') && defined('WP_DEBUG') && WP_DEBUG && !is_admin()) {
             if (!defined('DONOTCACHEPAGE')) {
                 define('DONOTCACHEPAGE', TRUE);
             }
             if (!did_action('wp_footer')) {
                 error_log("We're sorry, but your theme's page template didn't make a call to wp_footer(), which is required by NextGEN Gallery. Please add this call to your page templates.");
             } else {
                 error_log("We're sorry, but your theme's page template didn't make a call to wp_print_footer_scripts(), which is required by NextGEN Gallery. Please add this call to your page templates.");
             }
         } elseif (strpos($this->buffer, '</body>') === FALSE) {
             $this->valid_request = FALSE;
         }
         // The output_buffer() function has been called in the PHP shutdown callback
         // This will allow us to print the scripts ourselves and manipulate the buffer
         if ($in_shutdown === TRUE) {
             if ($this->valid_request) {
                 ob_start();
                 if (!did_action('wp_footer')) {
                     wp_footer();
                 } else {
                     wp_print_footer_scripts();
                 }
                 $this->other_output = ob_get_clean();
                 $this->buffer = str_ireplace('</body>', $this->marker . '</body>', $this->buffer);
             }
         } else {
             $this->run_shutdown = TRUE;
             return '';
         }
     }
     // Once we have the footer scripts, we can modify the buffer and
     // move the resources around
     if ($this->wrote_footer) {
         $this->move_resources();
     }
     return $this->buffer;
 }
Example #4
0
/**
 * Sending output to an iframe
 */
function pte_init_iframe()
{
    global $title, $pte_iframe;
    $pte_iframe = true;
    // Provide the base framework/HTML for the editor.
    require_once ABSPATH . WPINC . '/script-loader.php';
    // Check the input parameters and create the HTML
    pte_edit_setup();
    print "<!DOCTYPE html>\n<html><head><title>{$title}</title>\n";
    print_head_scripts();
    print_admin_styles();
    print '</head><body class="wp-core-ui pte-iframe">';
    // Simply echo the created HTML
    pte_edit_page();
    wp_print_footer_scripts();
    print '</body></html>';
}
Example #5
0
						<?php 
    echo_h($tab_params['title']);
    ?>
					</a>
				</li>
			<?php 
}
?>
			</ul>
			<?php 
reset($tabs);
foreach ($tabs as $id => $tab_params) {
    ?>
			<div class="main_menu_tab" id="<?php 
    echo esc_attr($id);
    ?>
"><?php 
    echo $tab_params['content'];
    ?>
</div>
			<?php 
}
?>
		</div>

		<?php 
wp_print_footer_scripts();
?>
	</body>
</html>
Example #6
0
        function preview_cta()
        {
            if (isset(self::$instance->obj->post_type) && self::$instance->obj->post_type != 'wp-call-to-action' || !isset(self::$instance->obj->post_type) && !isset($_GET['wp-cta-variation-id'])) {
                return;
            }
            self::$instance->is_preview = true;
            self::$instance->setup_cta(true);
            $cta_id = self::$instance->obj->ID;
            if (!isset(self::$instance->selected_cta)) {
                return;
            }
            echo '<html style="margin-top:0px !important;">';
            echo '<head>';
            $template_path = get_stylesheet_directory_uri();
            $site_url = site_url();
            echo '<link rel="stylesheet" href="' . $template_path . '/style.css">';
            echo '<link rel="stylesheet" href="' . $site_url . '/wp-content/plugins/cta/shared/shortcodes/css/frontend-render.css">';
            do_action('wp_head');
            wp_print_styles();
            echo '</head>';
            !isset($_GET['live-preview-area']) ? $margin = 'margin-top:100px' : '';
            echo '<body style="background-color:#fff;">';
            echo '<div id="cta-preview-container" style="margin:auto;">';
            if (isset($_GET['post_id']) || isset($_GET['wp-cta-variation-id'])) {
                echo do_shortcode('[cta id="' . $cta_id . '" vid="' . $_GET['wp-cta-variation-id'] . '"]');
            } else {
                echo do_shortcode('[cta id="' . $cta_id . '"]');
            }
            echo "</div>";
            do_action('wp_footer');
            wp_print_footer_scripts();
            if (!isset($_GET['live-preview-area']) && is_user_logged_in()) {
                ?>
			<style type="text/css">
			body {
				background-color: #eee !important;
				background-image: linear-gradient(45deg, rgb(213, 213, 213) 25%, transparent 25%, transparent 75%, rgb(213, 213, 213) 75%, rgb(213, 213, 213)), linear-gradient(45deg, rgb(213, 213, 213) 25%, transparent 25%, transparent 75%, rgb(213, 213, 213) 75%, rgb(213, 213, 213)) !important;
				background-size: 60px 60px !important;
				background-position: 0 0, 30px 30px !important;
				padding-top: 25px;
			}
			.slider {
				width: 510px;
				text-align: center;
			}

			.custom-input {
				-webkit-appearance: none;
				vertical-align: middle;
				width: 500px;
				height: 5px;
				border-radius: 25px;
				border: 5px solid #868686;

			}

			.custom-input::-webkit-slider-thumb,
			.custom-input::slider-thumb {
				-webkit-appearance: none;
				border-radius: 20px;
				width: 20px;
				height: 20px;
				border: 5px solid #868686;
				cursor: pointer;
				background: #797979;


			}
			input.custom-input:focus, textarea.custom-input:focus {
			border: 5px solid #868686;
			outline: none;
			}
			.custom-input:active::-webkit-slider-thumb,
			.custom-input:active::slider-thumb {
				border-width: 5px;
			}

			.result {
				margin: 30px 0 0;
			}
			.slider-text {
				font-size: 20px;
			}
			</style>
			<script type="text/javascript">
			jQuery(document).ready(function($) {
				jQuery('.custom-input').change(function() {
					var barValue = $(this).val(),
					result = Math.round(barValue * 10) / 10;
					jQuery("#cta-preview-container").width(result + '%');
					jQuery('.result').text(result + '%');
				});

				jQuery('#cta-preview-container').cta_center();
			});

			/* add jquery function to center cta in preview mode */
			jQuery.fn.cta_center = function () {
				this.css("position","absolute");
				this.css("top", Math.max(0, ((jQuery(window).height() - jQuery(this).outerHeight()) / 2) +
															jQuery(window).scrollTop()) + "px");
				this.css("left", Math.max(0, ((jQuery(window).width() - jQuery(this).outerWidth()) / 2) +
															jQuery(window).scrollLeft()) + "px");
				return this;
			}
			</script>
			<?php 
            }
            echo '</body>';
            echo '</html>';
            exit;
        }
 public function enqueue_rich_text_editor_scripts()
 {
     //have to print scripts/styles to footer for the editor to work on the preview page
     wp_print_footer_scripts();
 }
 public static function ajax_create()
 {
     global $frm_entry;
     $frm_form = new FrmForm();
     $form = $frm_form->getOne($_POST['form_id']);
     if (!$form) {
         echo false;
         die;
     }
     $no_ajax_fields = array('file');
     $errors = $frm_entry->validate($_POST, $no_ajax_fields);
     if (empty($errors)) {
         global $wpdb;
         $where = $wpdb->prepare("form_id=%d", $form->id);
         if (isset($_POST['frm_page_order_' . $form->id])) {
             $where .= $wpdb->prepare(" AND field_order < %d", $_POST['frm_page_order_' . $form->id]);
         }
         $ajax = isset($form->options['ajax_submit']) ? $form->options['ajax_submit'] : 0;
         //ajax submit if no file, rte, captcha
         if ($ajax) {
             $no_ajax = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}frm_fields WHERE type in ('" . implode("','", $no_ajax_fields) . "') AND {$where} LIMIT 1");
             if ($no_ajax) {
                 $ajax = false;
             }
         }
         if ($ajax) {
             global $frm_vars;
             $frm_vars['ajax'] = true;
             $frm_vars['css_loaded'] = true;
             if (!isset($_POST['frm_page_order_' . $form->id]) && !FrmProFormsHelper::going_to_prev($form->id) || FrmProFormsHelper::saving_draft($form->id)) {
                 $processed = true;
                 FrmEntriesController::process_entry($errors, true);
             }
             echo FrmFormsController::show_form($form->id);
             // trigger the footer scripts if there is a form to show
             if ($errors || !isset($form->options['show_form']) || $form->options['show_form'] || !isset($processed)) {
                 self::register_scripts();
                 FrmProEntriesController::enqueue_footer_js();
                 wp_deregister_script('formidable');
                 global $wp_scripts, $wp_styles;
                 foreach (array('jquery', 'jquery-ui-core', 'jquery-migrate', 'thickbox') as $s) {
                     if (isset($wp_scripts->registered[$s])) {
                         $wp_scripts->done[] = $s;
                     }
                     unset($s);
                 }
                 $keep_styles = apply_filters('frm_ajax_load_styles', array('dashicons', 'jquery-theme'));
                 foreach ($wp_styles->registered as $s => $info) {
                     if (!is_array($keep_styles) || !in_array($s, $keep_styles)) {
                         $wp_styles->done[] = $s;
                     }
                     unset($s);
                 }
                 wp_print_footer_scripts();
                 FrmProEntriesController::footer_js();
             }
         } else {
             echo false;
         }
     } else {
         $errors = str_replace('"', '&quot;', $errors);
         $obj = array();
         foreach ($errors as $field => $error) {
             $field_id = str_replace('field', '', $field);
             $obj[$field_id] = $error;
         }
         echo json_encode($obj);
     }
     die;
 }
Example #9
0
 public function get_form_preview()
 {
     global $post;
     add_filter('caldera_forms_render_form_element', array($this, 'set_preview_form_element'));
     $post = get_post((int) $_POST['post_id']);
     if (isset($_POST['atts']['named']['id'])) {
         $form = $_POST['atts']['named']['id'];
     } elseif (isset($_POST['atts']['named']['name'])) {
         $form = $_POST['atts']['named']['name'];
     }
     add_filter('caldera_forms_get_form-' . $form, array($this, 'set_preview_get_form'), 100);
     if (!empty($form)) {
         ob_start();
         wp_head();
         echo Caldera_Forms::render_form($form);
         wp_print_footer_scripts();
         $html = ob_get_clean();
     }
     $out = array();
     if (!empty($html)) {
         $out['html'] = $html;
     }
     wp_send_json_success($out);
 }
Example #10
0
 public function get_form_preview()
 {
     global $post;
     add_filter('caldera_forms_render_form_element', array($this, 'set_preview_form_element'));
     $post = get_post((int) $_POST['post_id']);
     if (isset($_POST['atts']['named']['id'])) {
         $form = $_POST['atts']['named']['id'];
     } elseif (isset($_POST['atts']['named']['name'])) {
         $form = $_POST['atts']['named']['name'];
     }
     add_filter('caldera_forms_get_form-' . $form, array($this, 'set_preview_get_form'), 100);
     //shortcode_handler( $atts, $content )
     $atts = $_POST['atts']['named'];
     $atts['preview'] = true;
     if (!empty($form)) {
         ob_start();
         wp_head();
         $content = '';
         if (!empty($_POST['content'])) {
             $content = stripslashes_deep($_POST['content']);
         }
         echo Caldera_Forms::shortcode_handler($atts, $content);
         echo '<div class="clear"></div>';
         wp_print_footer_scripts();
         $html = ob_get_clean();
     }
     $out = array();
     if (!empty($html)) {
         $out['html'] = $html;
     }
     wp_send_json_success($out);
 }
 public static function method_load_block_content()
 {
     /* Check for grid safe mode */
     if (HeadwayOption::get('grid-safe-mode', false, false)) {
         echo '<div class="alert alert-red block-safe-mode"><p>Grid Safe mode enabled.  Block content not outputted.</p></div>';
         return;
     }
     /* Go */
     $layout = headway_post('layout');
     $block_origin = headway_post('block_origin');
     $block_default = headway_post('block_default', false);
     $unsaved_block_settings = headway_post('unsaved_block_settings', false);
     /* If the block origin is a string or ID, then get the object from DB. */
     if (is_numeric($block_origin) || is_string($block_origin)) {
         $block = HeadwayBlocksData::get_block($block_origin);
     } else {
         $block = $block_origin;
     }
     /* If the block doesn't exist, then use the default as the origin.  If the default doesn't exist... We're screwed. */
     if (!$block && $block_default) {
         $block = $block_default;
     }
     /* If the block settings is an array, merge that into the origin.  But first, make sure the settings exists for the origin. */
     if (!isset($block['settings'])) {
         $block['settings'] = array();
     }
     if (is_array($unsaved_block_settings) && count($unsaved_block_settings) && isset($unsaved_block_settings['settings'])) {
         $block = headway_array_merge_recursive_simple($block, $unsaved_block_settings);
     }
     /* If the block is set to mirror, then get that block. */
     if ($mirrored_block = HeadwayBlocksData::is_block_mirrored($block)) {
         $original_block = $block;
         $block = $mirrored_block;
         $block['original'] = $original_block;
     }
     /* Add a flag into the block so we can check if this is coming from the visual editor. */
     $block['ve-live-content-query'] = true;
     /* Show the content */
     do_action('headway_block_content_' . $block['type'], $block);
     /* Output dynamic JS and CSS */
     if (headway_post('mode') != 'grid') {
         $block_types = HeadwayBlocks::get_block_types();
         /* Dynamic CSS */
         if (method_exists($block_types[$block['type']]['class'], 'dynamic_css')) {
             echo '<style type="text/css">';
             echo call_user_func(array($block_types[$block['type']]['class'], 'dynamic_css'), $block['id'], $block);
             echo '</style><!-- AJAX Block Content Dynamic CSS -->';
         }
         /* Run enqueue action and print right away */
         if (method_exists($block_types[$block['type']]['class'], 'enqueue_action')) {
             /* Remove all other enqueued scripts to reduce conflicts */
             global $wp_scripts;
             $wp_scripts = null;
             remove_all_actions('wp_print_scripts');
             /* Remove all other enqueued styles to reduce conflicts */
             global $wp_styles;
             $wp_styles = null;
             remove_all_actions('wp_print_styles');
             echo call_user_func(array($block_types[$block['type']]['class'], 'enqueue_action'), $block['id'], $block);
             wp_print_scripts();
             wp_print_footer_scripts();
             /* This isn't really needed, but it's here for juju power */
         }
         /* Output dynamic JS */
         if (method_exists($block_types[$block['type']]['class'], 'dynamic_js')) {
             echo '<script type="text/javascript">';
             echo call_user_func(array($block_types[$block['type']]['class'], 'dynamic_js'), $block['id'], $block);
             echo '</script><!-- AJAX Block Content Dynamic JS -->';
         }
     }
     /* End outputting dynamic JS and CSS */
 }