/**
  * Group items
  *
  * @param type $element
  *
  * @return string
  */
 static function render($element)
 {
     $_element = $element;
     $label_item = isset($element['label_item']) ? $element['label_item'] : '';
     $sub_items = $_element['sub_items'];
     $overwrite_shortcode_data = isset($element['overwrite_shortcode_data']) ? $element['overwrite_shortcode_data'] : true;
     $sub_item_type = $element['sub_item_type'];
     $items_html = array();
     $shortcode_name = str_replace('WR_', '', $element['shortcode']);
     // get id of parameter to extract
     $extract_title = isset($element['extract_title']) ? $element['extract_title'] : '';
     $extra_params = array('drag_handle' => false);
     if ($sub_items) {
         foreach ($sub_items as $idx => $item) {
             $el = new $sub_item_type();
             $el->init_element();
             // check if $item['std'] is empty or not
             $shortcode_data = '';
             if (!$label_item) {
                 $content = __($shortcode_name, WR_PBL) . ' ' . __('Item', WR_PBL) . ' ' . ($idx + 1);
             } else {
                 $content = $label_item . ($idx + 1);
             }
             if (isset($_element['no_title'])) {
                 $content = $_element['no_title'];
             }
             if (!empty($item['std'])) {
                 // keep shortcode data as it is
                 $shortcode_data = $item['std'];
                 // reassign params for shortcode base on std string
                 $extract_params = WR_Pb_Helper_Shortcode::extract_params($item['std']);
                 $params = WR_Pb_Helper_Shortcode::generate_shortcode_params($el->items, NULL, $extract_params, TRUE, FALSE, $content);
                 $el->shortcode_data();
                 $params['extract_title'] = empty($params['extract_title']) ? __('(Untitled)', WR_PBL) : $params['extract_title'];
                 $content = $params['extract_title'];
                 if ($overwrite_shortcode_data) {
                     $shortcode_data = $el->config['shortcode_structure'];
                 }
             }
             $element_type = (array) $el->element_in_pgbldr($content, $shortcode_data, '', '', true, $extra_params);
             foreach ($element_type as $element_structure) {
                 $items_html[$shortcode_data] = $element_structure;
             }
         }
     }
     $style = isset($_element['style']) ? 'style="' . $_element['style'] . '"' : '';
     // Wrap item html to table
     $html = '';
     foreach ($items_html as $shortcode_data => $item_html) {
         if (!empty($extract_title)) {
             $attrs = shortcode_parse_atts($shortcode_data);
             $title = isset($attrs[$extract_title]) ? $attrs[$extract_title] : '';
             $html .= sprintf('<tr><td><b>%s</b></td><td>%s</td></tr>', $title, $item_html);
         }
     }
     $html = sprintf('<table class="%s" %s>%s</table>', 'table table-bordered', $style, balanceTags($html));
     $element_name = isset($_element['name']) ? $_element['name'] : __(ucwords(!$label_item ? $shortcode_name : $label_item), WR_PBL) . ' ' . __('Items', WR_PBL);
     $html_element = "<div id='{$_element['id']}' class='form-group control-group clearfix'><label class='control-label'>{$element_name}</label>\n\t\t\t\t<div class='item-container submodal_frame_2 controls group-table {$_element['class']}'>\n                    <div class='item-container-content jsn-items-list'>\n                    {$html}\n                    </div>\n                </div>\n                </div>";
     return $html_element;
 }
Beispiel #2
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $advert_image = isset($instance['advert_image']) ? $instance['advert_image'] : '';
        $advert_link = isset($instance['advert_link']) ? $instance['advert_link'] : '';
        $advert_code = isset($instance['advert_code']) ? $instance['advert_code'] : '';
        /* Before widget (defined by themes). */
        echo balanceTags($before_widget);
        if ($title) {
            echo balanceTags($before_title . $title . $after_title);
        }
        ?>
			
		<div class="widget_advert_inner">
			<?php 
        if ($advert_image != '') {
            echo balanceTags(($advert_link != '' ? '<a href="' . $advert_link . '" class="image_wrapper">' : '') . '<img src="' . $advert_image . '" border="0" alt="' . $title . '" alt="" />' . ($advert_link != '' ? '</a>' : ''));
        }
        if ($advert_code != '') {
            echo substituteAll($advert_code);
        }
        ?>
		</div>
<?php 
        /* After widget (defined by themes). */
        echo balanceTags($after_widget);
    }
 function ot_type_user_select_ajax($args = array())
 {
     $default = array('field_placeholder' => __('Search for a User', ST_TEXTDOMAIN));
     $args = wp_parse_args($args, $default);
     extract($args);
     $post_type = $field_post_type;
     /* verify a description */
     $has_desc = $field_desc ? true : false;
     /* format setting outer wrapper */
     echo '<div class="format-setting type-post_select_ajax ' . ($has_desc ? 'has-desc' : 'no-desc') . '">';
     /* description */
     echo balanceTags($has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : '');
     /* format setting inner wrapper */
     echo '<div class="format-setting-inner">';
     /* allow fields to be filtered */
     $post_select_ajax = apply_filters('ot_recognized_post_select_ajax_fields', $field_value, $field_id);
     $pl_name = '';
     $pl_desc = '';
     if ($field_value) {
         $user = get_userdata($field_value);
         if ($user) {
             $pl_name = $user->user_login . ' (#' . $user->ID . ' - ' . $user->user_email . ')';
             $pl_desc = "";
             //"ID: ".get_the_ID($field_value);
         }
     }
     echo '<div class="option-tree-ui-user_select_ajax-input-wrap">';
     echo "<input data-pl-name='{$pl_name}' data-pl-desc='{$pl_desc}' data-placeholder='{$field_placeholder}' value='{$field_value}' data-post-type='{$post_type}' type=hidden class='st_user_select_ajax' id='" . esc_attr($field_id) . "' name='" . esc_attr($field_name) . "'/>";
     echo '</div>';
     echo '</div>';
     echo '</div>';
 }
 /**
  * Front-end display of widget.
  *
  * @see WP_Widget::widget()
  *
  * @param array $args     Widget arguments.
  * @param array $instance Saved values from database.
  */
 public function widget($args, $instance)
 {
     $default = array('title' => 'recent tweet', 'number_tweet' => 5, 'user_id' => 'evanto');
     $instance = wp_parse_args($instance, $default);
     extract($instance);
     echo balanceTags($args['before_widget']);
     if (!empty($title)) {
         echo balanceTags($args['before_title'] . $title . $args['after_title']);
     }
     if ($user_id) {
         $credentials = array('consumer_key' => '18ihEuNsfOJokCLb8SAgA', 'consumer_secret' => '7vTYnLYYiP4BhXvkMWtD3bGnysgiGqYlsPFfwXhGk');
         $twitter_api = new Wp_Twitter_Api($credentials);
         $query = 'count=' . $number_tweet . '&include_entities=true&include_rts=true&screen_name=' . $user_id;
         $args = array('type' => 'statuses/user_timeline');
         $twitters = $twitter_api->query($query);
         $output = array();
         $output[] = '<div class="twitter">';
         $output[] = '<ul class="tweet-list list-unstyled">';
         if (!isset($twitters['errors']) && count($twitters) > 0 and is_array($twitters)) {
             foreach ($twitters as $twitter) {
                 $twitter = (array) $twitter;
                 $output[] = '<li class="tweet">';
                 $output[] = "<span class='tweet-text'><a href='http://twitter.com/" . $user_id . "/status/" . $twitter['id'] . "'>" . human_time_diff(strtotime($twitter['created_at'])) . ' ago</a></span>';
                 $output[] = "<span class='tweet-time'>" . $twitter['text'] . "</span>";
                 $output[] = '</li>';
             }
         }
         $output[] = '</ul>';
         $output[] = '</div>';
         echo implode("\n", $output);
     }
 }
Beispiel #5
0
 function axiom_template_list_output($post_options, $post_data)
 {
     $parts = explode('_', $post_options['layout']);
     $layout = max(1, min(4, empty($parts[1]) ? $post_options['columns_count'] : (int) $parts[1]));
     if ($layout == 1) {
         $title = '<li class="post_item sc_blogger_item post_title sc_title sc_blogger_title list_style_' . esc_attr($layout) . '_item">' . '<div class="post_title sc_title sc_blogger_title">' . '<h5>' . (!isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '') . $post_data['post_title'] . (!isset($post_options['links']) || $post_options['links'] ? '</a>' : '') . '</h5>' . '<div class="post_info">' . '<span>by <a href="' . esc_url($post_data['post_author_url']) . '">' . $post_data['post_author'] . '</a></span>' . '<span>Views <span>' . esc_html($post_data['post_views']) . '</span></span>' . '</div>' . '</div>' . '</li>';
         echo $title;
     } else {
         if ($layout == 2) {
             $title = '<li class="post_item sc_blogger_item post_title sc_title sc_blogger_title list_style_' . esc_attr($layout) . '_item">' . '<div class="post_title sc_title sc_blogger_title">' . '<h4>' . (!isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '') . $post_data['post_title'] . (!isset($post_options['links']) || $post_options['links'] ? '</a>' : '') . '</h4>' . '<div class="post_descr">' . balanceTags($post_data['post_excerpt']) . '</div>' . '<div class="post_info">' . '<span>Posted on <span class="date">' . esc_html($post_data['post_date']) . '</span></span>' . '<span><span>' . balanceTags($post_data['post_terms'][$post_data['post_taxonomy']]->terms_links[0]) . '</span></span>' . '</div>' . '</div>' . '</li>';
             echo $title;
         } else {
             if ($layout == 3) {
                 $title = '<li class="post_item sc_blogger_item post_title sc_title sc_blogger_title list_style_' . esc_attr($layout) . '_item">';
                 echo $title;
                 if ($post_data['post_thumb']) {
                     require axiom_get_file_dir('templates/parts/post-featured.php');
                 }
                 $title = '';
                 $title .= '<div class="post_title sc_title sc_blogger_title">' . '<h5>' . (!isset($post_options['links']) || $post_options['links'] ? '<a href="' . esc_url($post_data['post_link']) . '">' : '') . $post_data['post_title'] . (!isset($post_options['links']) || $post_options['links'] ? '</a>' : '') . '</h5>' . '<div class="post_descr">' . substr($post_data['post_excerpt'], 0, 100) . '...</div>' . '</div>' . '</li>';
                 echo $title;
             }
         }
     }
 }
 function attributes_page()
 {
     if (class_exists('STAttribute')) {
         $a = new STAttribute();
         echo balanceTags($a->content());
     }
 }
 /**
  * Sanitize the input string. HTML tags can be permitted.
  * The permitted tags can be supplied in an array.
  *
  * @TODO: Finish the code needed to support the $permittedTags array.
  *
  * @param string $string
  * @param bool $allowHTML [optional]
  * @param array $permittedTags [optional]
  * @return string
  */
 public function sanitizeString($string, $allowHTML = FALSE, $permittedTags = array())
 {
     // Strip all tags except the permitted.
     if (!$allowHTML) {
         // Ensure all tags are closed. Uses WordPress method balanceTags().
         $balancedText = balanceTags($string, TRUE);
         $strippedText = strip_tags($balancedText);
         // Strip all script and style tags.
         $strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $strippedText);
         // Escape text using the WordPress method and then strip slashes.
         $escapedText = stripslashes(esc_attr($strippedText));
         // Remove line breaks and trim white space.
         $escapedText = preg_replace('/[\\r\\n\\t ]+/', ' ', $escapedText);
         return trim($escapedText);
     } else {
         // Strip all script and style tags.
         $strippedText = preg_replace('@<(script|style)[^>]*?>.*?</\\1>@si', '', $string);
         $strippedText = preg_replace('/&lt;(script|style).*?&gt;.*?&lt;\\/\\1&gt;/si', '', stripslashes($strippedText));
         /*
          * Use WordPress method make_clickable() to make links clickable and
          * use kses for filtering.
          *
          * http://ottopress.com/2010/wp-quickie-kses/
          */
         return wptexturize(wpautop(make_clickable(wp_kses_post($strippedText))));
     }
 }
 public static function get_fields($key = '', $raw = false)
 {
     if (empty(self::$fields)) {
         self::init_fields();
     }
     if (!$key) {
         return '';
     }
     $html = '';
     if (is_array(self::$fields)) {
         foreach (self::$fields as $i => $field) {
             if ($field['id'] == $key) {
                 if ($raw == false) {
                     $html .= '<div class="form-group fieldset-' . esc_attr_e($key) . '">';
                     if ($field['label']) {
                         $html .= '<label class="' . esc_attr($field['parent_key_class']) . ' control-label" for="' . esc_attr_e($key) . '">' . balanceTags($field['label'] . ($field['required'] ? '' : ' <small>' . __('(optional)', DLN_CLF) . '</small>')) . '</label>';
                     }
                     $html .= '<div class="' . esc_attr($field['parent_value_class']) . '">';
                     $html .= DLN_Form_Functions::form_get_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field));
                     $html .= '</div>';
                     $html .= '</div>';
                 } else {
                     $html = DLN_Form_Functions::form_get_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field));
                 }
             }
         }
     }
     return $html;
 }
Beispiel #9
0
function ssquiz_crud_template()
{
    if (!current_user_can(SSQUIZ_CAP)) {
        return;
    }
    $subjects = json_decode(stripslashes($_REQUEST['subject']));
    $type = $_REQUEST['type'];
    $settings = get_option('ssquiz_settings');
    switch ($type) {
        case 'btn_report':
            $settings->pdf_template = balanceTags($subjects->pdf_template);
            break;
        case 'btn_teacher_email':
            $settings->teacher_email_address = wp_kses($subjects->teacher_email_address, array());
            $settings->teacher_email_subject = wp_kses($subjects->teacher_email_subject, array());
            $settings->teacher_email_template = balanceTags($subjects->teacher_email_template);
            $settings->teacher_will_receive = $subjects->teacher_will_receive;
            break;
        case 'btn_user_email':
            $settings->user_email_subject = wp_kses($subjects->user_email_subject, array());
            $settings->user_email_template = balanceTags($subjects->user_email_template);
            $settings->user_will_receive = $subjects->user_will_receive;
            break;
        case 'btn_finish':
            $settings->finish_template = balanceTags($subjects->finish_template);
            break;
        case 'btn_start':
            $settings->start_template = balanceTags($subjects->start_template);
            break;
    }
    update_option('ssquiz_settings', $settings);
}
Beispiel #10
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $flickr_username = isset($instance['flickr_username']) ? $instance['flickr_username'] : '';
        $flickr_count = isset($instance['flickr_count']) ? $instance['flickr_count'] : '';
        /* Before widget (defined by themes). */
        echo balanceTags($before_widget);
        /* Display the widget title if one was input (before and after defined by themes). */
        if ($title) {
            echo balanceTags($before_title . $title . $after_title);
        }
        //here will be displayed widget content for Footer 1st column
        ?>
		<div class="flickr_images">
			<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=<?php 
        echo $flickr_count;
        ?>
&amp;flickr_display=random&amp;size=s&amp;layout=x&amp;source=user&amp;user=<?php 
        echo $flickr_username;
        ?>
"></script>
		</div>

		<?php 
        /* After widget (defined by themes). */
        echo $after_widget;
    }
Beispiel #11
0
function ts_essentials_escape($str = '', $type = '', $context = '')
{
    if (trim($str)) {
        if ($type == 'strip') {
            if ($context == 'widget_before_after') {
                return strip_tags($str, '<div><ul><li>');
            } elseif ($context == 'widget_title_before_after') {
                return strip_tags($str, '<div><ul><li><h3><h4><h5><h6><strong><em><i><b><span>');
            } elseif (substr($context, 0, 1) == '<') {
                return strip_tags($str, $context);
            } else {
                return strip_tags($str);
            }
        } elseif ($type == 'bal' || $type == 'balance') {
            return balanceTags($str);
        } elseif ($type == 'attr') {
            return esc_attr($str);
        } elseif ($type == 'html') {
            return esc_html($str);
        } elseif ($type == 'url') {
            return esc_url($str);
        } elseif ($type == 'js') {
            return esc_js($str);
        } elseif ($type == 'textarea') {
            return esc_textarea($str);
        } elseif ($type == 'sql') {
            return esc_sql($str);
        } elseif ($type == 'post') {
            return wp_kses_post($str);
        }
    }
    return $str;
}
 function st_sc_custom_meta($attr, $content = false)
 {
     $data = shortcode_atts(array('key' => ''), $attr, 'st_custom_meta');
     extract($data);
     if (!empty($key)) {
         $data = get_post_meta(get_the_ID(), $key, true);
         return balanceTags($data);
     }
 }
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        $args['before_title'] = '<h5 class="stm_subscribe_title">';
        $args['after_title'] = '</h5>';
        echo $args['before_widget'];
        if (!empty($title)) {
            echo $args['before_title'] . esc_html($title) . $args['after_title'];
        }
        $html = '';
        $mailchimp_key = stm_option('mailchimp_api_key');
        $mailchimp_list = stm_option('mailchimp_list_id');
        if ($mailchimp_key and $mailchimp_list) {
            $html .= '<form action="/" class="stm_subscribe_' . time() . '">';
            $html .= '<div class="stm_mailchimp_unit">';
            $html .= '<div class="form-group">';
            $html .= '<input type="email" name="email" class="form-control stm_subscribe_email" required/>';
            $html .= '</div>';
            $html .= '<button class="button"><span class="h5">' . __('Subscribe', 'stm_domain') . '</span></button>';
            $html .= '<div class="stm_subscribe_preloader">Please wait...</div>';
            $html .= '</div>';
            $html .= '</form>';
            $html .= '
			<script type="text/javascript">
				jQuery(document).ready( function($){
					$(".stm_subscribe_' . time() . '").on(\'submit\', function (e) {
						e.preventDefault;
					    var $this = $(this);
						$(".stm_subscribe_preloader").addClass("loading");
				        $.ajax({
				            type: \'POST\',
				            data: \'action=stm_subscribe&email=\' + $($this).find(".stm_subscribe_email").val(),
				            dataType: \'json\',
				            url: ajaxurl,
				            success: function (json) {
				                if (json[\'success\']) {
				                    $($this).replaceWith(\'<div class="success_message">\' + json[\'success\'] + \'</div>\');
				                }
				                if (json[\'error\']) {
				                    alert(json[\'error\']);
				                }
				                $(".stm_subscribe_preloader").removeClass("loading");
				            }
				        });

				        return false;
				    });
				})
			</script>
		';
        } else {
            $html .= __('Error API', 'stm_domain');
        }
        echo balanceTags($html, true);
        echo $args['after_widget'];
    }
 protected static function filter_text($text)
 {
     $text = trim($text);
     //$text = self::code_trick($text); // A better parser than Markdown's for: backticks -> CODE
     $allowed = array('a' => array('href' => array(), 'title' => array(), 'rel' => array()), 'blockquote' => array('cite' => array()), 'br' => array(), 'p' => array(), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h3' => array(), 'h4' => array());
     $text = balanceTags($text);
     $text = wp_kses($text, $allowed);
     $text = trim($text);
     return $text;
 }
Beispiel #15
0
function wyde_footer_content()
{
    global $wyde_options;
    if (!empty($wyde_options['footer_script'])) {
        /**
         *Echo extra HTML/JavaScript/Stylesheet from theme options > advanced - body content
         */
        echo balanceTags($wyde_options['footer_script'], true);
    }
}
function fpf_run_main($post_id)
{
    // If this is an autosave, our form has not been submitted, so we don't want to do anything.
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    //Don't process REVISIONS (would result in 2 fetches per save)
    if (wp_is_post_revision($post_id)) {
        return $post_id;
    }
    // Check the user's permissions.
    if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
        if (!current_user_can('edit_page', $post_id)) {
            return $post_id;
        }
    } else {
        if (!current_user_can('edit_post', $post_id)) {
            return $post_id;
        }
    }
    /* OK, it's safe for us to save the data now. */
    // Make sure that it is set.
    if (!isset($_POST['post_content'])) {
        return $post_id;
    }
    $parsed_content = '';
    $parsed_content = fpf_find_shortcode($_POST['post_content']);
    // back compatibility for old "magic tags"
    if (!$parsed_content) {
        $parsed_content = fpf_find_tags($_POST['post_content']);
        if (isset($parsed_content['aid'])) {
            $parsed_content['id'] = $parsed_content['aid'];
        }
    }
    // return early if nothing doing
    if (empty($parsed_content) || !isset($parsed_content['id'])) {
        return $post_id;
    }
    //Connect to Facebook and generate the album content
    $album_content = fpf_fetch_album_content($parsed_content['id'], $parsed_content);
    //Update the post we're about to save
    $album = $parsed_content['before'] . $parsed_content['startTag'] . $album_content['content'] . $parsed_content['endTag'] . $parsed_content['after'];
    $album = balanceTags($album);
    // @todo add more sanitization
    update_post_meta($post_id, '_fpf_album_html', $album);
    //Set postmeta with the album's size and cover photo (can be optionally referenced by the user)
    update_post_meta($post_id, '_fpf_album_size', $album_content['count']);
    if (isset($album_content['cover'])) {
        update_post_meta($post_id, '_fpf_album_cover', $album_content['cover']);
    } else {
        delete_post_meta($post_id, '_fpf_album_cover');
    }
    //Done!
    return $post_id;
}
function wp_splash_page_show_preview()
{
    check_admin_referer(WP_SPLASH_PAGE_PREVIEW_NONCE, 'nonce');
    $options = get_option('wp_splash_page_options');
    $preview = array('template' => strip_tags($_REQUEST['template']), 'page_title' => empty($_REQUEST['page_title']) ? get_bloginfo('name') : strip_tags(stripslashes($options['page_title'])), 'title' => balanceTags(stripslashes($_REQUEST['title'])), 'text' => balanceTags(stripslashes($_REQUEST['text'])), 'title_color' => !empty($_REQUEST['title_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['title_color'])) ? str_replace('#', '', $_REQUEST['title_color']) : $options['title_color'], 'text_color' => !empty($_REQUEST['text_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['text_color'])) ? str_replace('#', '', $_REQUEST['text_color']) : $options['text_color'], 'background_color' => !empty($_REQUEST['background_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['background_color'])) ? str_replace('#', '', $_REQUEST['background_color']) : $options['background_color'], 'continue_button_bg_color' => !empty($_REQUEST['continue_button_bg_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['continue_button_bg_color'])) ? str_replace('#', '', $_REQUEST['continue_button_bg_color']) : $options['continue_button_bg_color'], 'continue_button_text_color' => !empty($_REQUEST['continue_button_text_color']) && preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', str_replace('#', '', $_REQUEST['continue_button_text_color'])) ? str_replace('#', '', $_REQUEST['continue_button_text_color']) : $options['continue_button_text_color'], 'image_url' => esc_url_raw($_REQUEST['image_url']), 'repeat_image' => strip_tags($_REQUEST['repeat_image']), 'center_image' => strip_tags($_REQUEST['center_image']), 'youtube_id' => strip_tags($_REQUEST['youtube_id']), 'video_autoplay' => $_REQUEST['video_autoplay'] == 'true' ? 1 : 0, 'video_width' => $_REQUEST['video_width'] >= 1 && $_REQUEST['video_width'] <= 9999 && ctype_digit($_REQUEST['video_width']) ? intval($_REQUEST['video_width']) : $options['video_width'], 'video_height' => $_REQUEST['video_height'] >= 1 && $_REQUEST['video_height'] <= 9999 && ctype_digit($_REQUEST['video_height']) ? intval($_REQUEST['video_height']) : $options['video_height'], 'continue_button_text' => empty($_REQUEST['continue_button_text']) ? strip_tags('Continue to Web Site') : strip_tags(stripslashes($options['continue_button_text'])), 'enable_age_confirmation' => $_REQUEST['enable_age_confirmation'] == 'true' ? 1 : 0, 'reject_text' => strip_tags(stripslashes($_REQUEST['reject_text'])), 'enable_opt_in' => $_REQUEST['enable_opt_in'] == 'true' ? 1 : 0, 'opt_in_reject_text' => strip_tags(stripslashes($_REQUEST['opt_in_reject_text'])), 'opt_in_text' => balanceTags(stripslashes($_REQUEST['opt_in_text'])));
    update_option('wp_splash_page_options_preview', $preview);
    $result = array('homeURL' => home_url());
    header('content-type: application/json; charset=utf-8');
    echo json_encode($result);
    die;
}
        public function render_error($message)
        {
            ?>
			<div class="wrap">
				<div class="error" id="error">
					<p><strong><?php 
            echo balanceTags($message);
            ?>
</strong></p>
				</div></div>
			<?php 
        }
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        global $THEMEREX_CURRENT_SIDEBAR;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
        $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
        $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
        $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $show_counters = $show_counters ? get_theme_option("blog_counters") : '';
        $output = '';
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '<div class="columnsWrap"><div class="columns1_2">';
        }
        $args = array('numberposts' => $number, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'ignore_sticky_posts' => 1, 'suppress_filters' => true);
        if ($category > 0) {
            $args['category'] = $category;
        }
        $ex = get_theme_option('exclude_cats');
        if (!empty($ex)) {
            $args['category__not_in'] = explode(',', $ex);
        }
        $recent_posts = wp_get_recent_posts($args, OBJECT);
        $post_number = 0;
        foreach ($recent_posts as $post) {
            $post_number++;
            require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
            if ($THEMEREX_CURRENT_SIDEBAR == 'top' && $post_number == round($number / 2)) {
                $output .= '
					</div><div class="columns1_2">
				';
            }
            if ($post_number >= $number) {
                break;
            }
        }
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '</div></div>';
        }
        if (!empty($output)) {
            /* Before widget (defined by themes). */
            echo balanceTags($before_widget);
            /* Display the widget title if one was input (before and after defined by themes). */
            echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title);
            echo balanceTags($output);
            /* After widget (defined by themes). */
            echo balanceTags($after_widget);
        }
    }
Beispiel #20
0
    public function widget_action()
    {
        include_once ABSPATH . 'wp-admin/includes/widgets.php';
        wp_enqueue_style('wr-megamenu_modal', WR_MEGAMENU_ROOT_URL . '/assets/css/modal.css');
        @session_start();
        global $wp_widget_factory;
        $widgets = $wp_widget_factory->widgets;
        $widget_id = $_GET['widget_id'];
        $menu = isset($_REQUEST['menu']) ? $_REQUEST['menu'] : '';
        $location = isset($_REQUEST['location']) ? $_REQUEST['location'] : '';
        if (!$widget_id) {
            exit(__('No widget ID'));
        }
        if (!$widgets[$widget_id]) {
            exit(__('Can not find this widget'));
        }
        $instance = array();
        $options = array();
        if (isset($_REQUEST['status']) && $_REQUEST['status'] == 'edit') {
            $options = $_SESSION['wr_megamenu_widget_options_' . $widget_id];
            $options = (array) json_decode($options);
        } else {
            unset($_SESSION['wr_megamenu_widget_options_' . $widget_id]);
        }
        $wg = new $widget_id();
        $wg->number = 0;
        //Get the base ID of widget.
        $widget_id_base = $wg->id_base;
        if (isset($options) && count($options)) {
            // Process field name prefix
            $sample_name = $wg->get_field_name('');
            $_patern = '#([^\\[\\]\\r\\n\\s\\t]+)\\[#';
            preg_match_all($_patern, $sample_name, $matches, PREG_SET_ORDER);
            if ($matches) {
                $options_index = $matches[0][1];
            }
            $instance = (array) $options[$options_index][0];
        }
        ob_start();
        echo '<div class="jsn-bootstrap3" id="widget-options-container">
		<form id="widget-options" class="form-horizontal form-inline" onsubmit="javascript:void(0)" autocomplete="false">
		<input type="hidden" name="wr_megamenu_menu" id="wr_megamenu_menu" value="' . $menu . '">
		<input type="hidden" name="wr_megamenu_location" id="wr_megamenu_location" value="' . $location . '">
		<input type="hidden" name="wr_megamenu_widget_id" id="wr_megamenu_widget_id" value="' . $widget_id_base . '">
		<input type="hidden" name="wr_megamenu_widget_title_id" id="wr_megamenu_widget_title_id" value="' . $wg->get_field_id('title') . '">
		';
        $wg->form($instance);
        echo '</form></div>';
        echo balanceTags(ob_get_clean());
    }
Beispiel #21
0
function dotb_validate_options($input)
{
    global $dotb_options;
    $settings = get_option('dotb_options', $dotb_options);
    if (!isset($input['dotb_rss_url'])) {
        $input['dotb_rss_url'] = null;
    }
    $input['dotb_rss_url'] = esc_url_raw($input['dotb_rss_url']);
    if (!isset($input['dotb_is_excerpt'])) {
        $input['dotb_is_excerpt'] = null;
    }
    $input['dotb_is_excerpt'] = $input['dotb_is_excerpt'] == 1 ? 1 : 0;
    if (!isset($input['dotb_excerpt_length'])) {
        $input['dotb_excerpt_length'] = null;
    }
    $input['dotb_excerpt_length'] = intval($input['dotb_excerpt_length']);
    if (!isset($input['dotb_readmore'])) {
        $input['dotb_readmore'] = null;
    }
    $input['dotb_readmore'] = balanceTags($input['dotb_readmore']);
    if (!isset($input['dotb_is_ga'])) {
        $input['dotb_is_ga'] = null;
    }
    $input['dotb_is_ga'] = $input['dotb_is_ga'] == 1 ? 1 : 0;
    if (!isset($input['dotb_analytics_code'])) {
        $input['dotb_analytics_code'] = null;
    }
    $input['dotb_analytics_code'] = balanceTags($input['dotb_analytics_code']);
    if (!isset($input['dotb_footer'])) {
        $input['dotb_footer'] = null;
    }
    $input['dotb_footer'] = balanceTags($input['dotb_footer']);
    if (!isset($input['dotb_is_colorbar'])) {
        $input['dotb_is_colorbar'] = null;
    }
    $input['dotb_is_colorbar'] = $input['dotb_is_colorbar'] == 1 ? 1 : 0;
    if (!isset($input['dotb_is_sqlcount'])) {
        $input['dotb_is_sqlcount'] = null;
    }
    $input['dotb_is_sqlcount'] = $input['dotb_is_sqlcount'] == 1 ? 1 : 0;
    if (!isset($input['dotb_version'])) {
        $input['dotb_version'] = null;
    }
    $input['dotb_version'] = intval($input['dotb_version']);
    if (!isset($input['dotb_is_comment_note'])) {
        $input['dotb_is_comment_note'] = null;
    }
    $input['dotb_is_comment_note'] = $input['dotb_is_comment_note'] == 1 ? 1 : 0;
    return $input;
}
 /**
  * Save and Update the Custom Navigation Menu Item Properties by checking all $_POST vars with the name of $check
  * @param int $menu_id
  * @param int $menu_item_db
  */
 function update_menu($menu_id, $menu_item_db)
 {
     $check = array('megamenu', 'title-megamenu', 'disable-text', 'caption-megamenu', 'wrapcolumn-megamenu', 'division-megamenu', 'autop-megamenu');
     foreach ($check as $key) {
         if (!isset($_POST['menu-item-st-' . $key][$menu_item_db])) {
             $_POST['menu-item-st-' . $key][$menu_item_db] = "";
         }
         if ($key === '') {
             $value = balanceTags($_POST['menu-item-st-' . $key][$menu_item_db]);
         } else {
             $value = $_POST['menu-item-st-' . $key][$menu_item_db];
         }
         update_post_meta($menu_item_db, '_menu-item-st-' . $key, $value);
     }
 }
 function st_search_cars_title($arg = array())
 {
     if (!get_post_type() == 'st_cars' and get_query_var('post_type') != "st_cars") {
         return;
     }
     $default = array('search_modal' => 1);
     extract(wp_parse_args($arg, $default));
     $car = new STCars();
     $html = '<h3 class="booking-title">' . balanceTags($car->get_result_string());
     if ($search_modal) {
         $html .= '<small><a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out">' . __('Change search', ST_TEXTDOMAIN) . '</a></small>';
     }
     $html .= '</h3>';
     return $html;
 }
 function st_vc_search_hotel_title($arg = array())
 {
     if (!get_post_type() == 'st_hotel' and get_query_var('post_type') != "st_hotel") {
         return;
     }
     $default = array('search_modal' => 1);
     extract(wp_parse_args($arg, $default));
     $hotel = new STHotel();
     $a = '<h3 class="booking-title">' . balanceTags($hotel->get_result_string());
     if ($search_modal) {
         $a .= '<small><a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out">' . __('Change search') . '</a></small>';
     }
     $a .= '</h3>';
     return $a;
 }
Beispiel #25
0
 public function widget($args, $instance)
 {
     // Get menu
     $nav_menu = !empty($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : false;
     if (!$nav_menu) {
         return;
     }
     /** This filter is documented in wp-includes/default-widgets.php */
     $instance['title'] = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     echo balanceTags($args['before_widget']);
     if (!empty($instance['title'])) {
         echo $args['before_title'] . $instance['title'] . $args['after_title'];
     }
     wp_nav_menu(array('fallback_cb' => '', 'menu' => $nav_menu, 'items_wrap' => '<ul id="%1$s" class="%2$s nav nav-pills nav-stacked nav-side mb30">%3$s</ul>'));
     echo balanceTags($args['after_widget']);
 }
 /**
  * How to display the widget on the screen.
  */
 function widget($args, $instance)
 {
     extract($args);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
     $post_type = isset($instance['post_type']) ? $instance['post_type'] : 'post';
     $output = getThemeRexCalendar(true, 0, 0, array('post_type' => $post_type));
     if (!empty($output)) {
         /* Before widget (defined by themes). */
         echo balanceTags($before_widget);
         /* Display the widget title if one was input (before and after defined by themes). */
         echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title);
         echo balanceTags($output);
         /* After widget (defined by themes). */
         echo balanceTags($after_widget);
     }
 }
Beispiel #27
0
    /**
     * Front-end display of widget.
     *
     * @see WP_Widget::widget()
     *
     * @param array $args     Widget arguments.
     * @param array $instance Saved values from database.
     */
    public function widget($args, $instance)
    {
        $title = apply_filters('widget_title', $instance['title']);
        echo $args['before_widget'];
        if (!empty($title)) {
            echo $args['before_title'] . esc_html($title) . $args['after_title'];
        }
        $html = '';
        if (get_theme_mod('mailchimp_api_key') && get_theme_mod('mailchimp_list_id')) {
            $html .= '<form action="/" class="stm_subscribe_' . time() . '">';
            $html .= '<div class="form-group">';
            $html .= '<input type="email" placeholder="' . __('E-mail address', STM_DOMAIN) . '" name="email" class="form-control stm_subscribe_email" required/>';
            $html .= '</div>';
            $html .= '<button class="button"><span>' . __('Subscribe', STM_DOMAIN) . '</span></button>';
            $html .= '</form>';
            $html .= '
			<script type="text/javascript">
				jQuery(document).ready( function($){
					$(".stm_subscribe_' . time() . '").on(\'submit\', function () {
					    var $this = $(this);
				        $.ajax({
				            type: \'POST\',
				            data: \'action=stm_subscribe&email=\' + $($this).find(".stm_subscribe_email").val(),
				            dataType: \'json\',
				            url: ajaxurl,
				            success: function (json) {
				                if (json[\'success\']) {
				                    $($this).replaceWith(\'<div class="success_message">\' + json[\'success\'] + \'</div>\');
				                }
				                if (json[\'error\']) {
				                    alert(json[\'error\']);
				                }
				            }
				        });

				        return false;
				    });
				})
			</script>
		';
        } else {
            $html .= __('Error API', STM_DOMAIN);
        }
        echo balanceTags($html, true);
        echo $args['after_widget'];
    }
Beispiel #28
0
 /**
  * @param      $text
  * @param bool $markdown
  *
  * @return mixed|string
  */
 public function filter_text($text, $markdown = false)
 {
     // fancy, Markdown
     $text = trim($text);
     $text = call_user_func(array(get_parent_class($this), 'code_trick'), $text, $markdown);
     // A better parser than Markdown's for: backticks -> CODE
     if ($markdown) {
         // Parse markdown.
         $parser = new \Parsedown();
         $text = $parser->text($text);
     }
     $allowed = array('a' => array('href' => array(), 'title' => array(), 'rel' => array()), 'blockquote' => array('cite' => array()), 'br' => array(), 'cite' => array(), 'p' => array(), 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), 'h3' => array(), 'h4' => array());
     $text = balanceTags($text);
     $text = wp_kses($text, $allowed);
     $text = trim($text);
     return $text;
 }
        /**
         * Form in Settings page
         */
        public static function settings_page_form()
        {
            ob_start();
            self::$options = get_option(PT_CV_OPTION_NAME);
            ?>
			<form method="post" action="options.php">
				<?php 
            // This prints out all hidden setting fields
            settings_fields(PT_CV_OPTION_NAME . '_group');
            do_settings_sections(PT_CV_DOMAIN);
            submit_button();
            ?>
			</form>
			<?php 
            $text = ob_get_clean();
            echo balanceTags($text);
        }
Beispiel #30
0
function pandora_options_validator()
{
    $_REQUEST['pan_slider_number'] = pandora_i_want_to_be_number($_REQUEST['pan_slider_number'], "0-9", 5, 20);
    $_REQUEST['pan_news'] = pandora_i_want_to_be_number($_REQUEST['pan_news'], "0-9", 0, 50);
    $_REQUEST['pan_normals'] = pandora_i_want_to_be_number($_REQUEST['pan_normals'], "0-9", 0, 50);
    $_REQUEST['pan_olds'] = pandora_i_want_to_be_number($_REQUEST['pan_olds'], "0-9", 0, 50);
    $_REQUEST['pan_archives'] = pandora_i_want_to_be_number($_REQUEST['pan_archives'], "0-9", 0, 50);
    $_REQUEST['pan_login_logo'] = esc_url_raw($_REQUEST['pan_login_logo'], 'http');
    $_REQUEST['pan_login_logo'] = str_replace("'", '', $_REQUEST['pan_login_logo']);
    $_REQUEST['pan_smile'] = esc_url_raw($_REQUEST['pan_smile'], 'http');
    $_REQUEST['pan_smile'] = str_replace("'", '', $_REQUEST['pan_smile']);
    $_REQUEST['pan_favicon'] = esc_url_raw($_REQUEST['pan_favicon'], 'http');
    $_REQUEST['pan_favicon'] = str_replace("'", '', $_REQUEST['pan_favicon']);
    $_REQUEST['pan_page'] = pandora_i_want_to_be_number($_REQUEST['pan_page'], "0-2", 1, 2);
    $_REQUEST['pan_copyright'] = balanceTags($_REQUEST['pan_copyright']);
    $_REQUEST['pan_stats'] = balanceTags($_REQUEST['pan_stats']);
    $_REQUEST['pan_skinner'] = esc_attr($_REQUEST['pan_skinner']);
}