function dsq_render_single_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        ?>
		<li id="dsq-comment-<?php 
        echo (int) get_comment_ID();
        ?>
">
			<div id="dsq-comment-header-<?php 
        echo (int) get_comment_ID();
        ?>
" class="dsq-comment-header">
				<cite id="dsq-cite-<?php 
        echo (int) get_comment_ID();
        ?>
">
					<?php 
        if (comment_author_url()) {
            ?>
						<a id="dsq-author-user-<?php 
            echo (int) get_comment_ID();
            ?>
" href="<?php 
            echo esc_url(get_comment_author_url());
            ?>
" target="_blank" rel="nofollow"><?php 
            echo esc_html(get_comment_author());
            ?>
</a>
					<?php 
        } else {
            ?>
						<span id="dsq-author-user-<?php 
            echo (int) get_comment_ID();
            ?>
"><?php 
            echo esc_html(get_comment_author());
            ?>
</span>
					<?php 
        }
        ?>
				</cite>
			</div>
			<div id="dsq-comment-body-<?php 
        echo (int) get_comment_ID();
        ?>
" class="dsq-comment-body">
				<div id="dsq-comment-message-<?php 
        echo (int) get_comment_ID();
        ?>
" class="dsq-comment-message"><?php 
        wp_filter_kses(comment_text());
        ?>
</div>
			</div>
		</li>
		<?php 
    }
Esempio n. 2
0
/**
 * xprofile_sanitize_data_value_before_save ( $field_value, $field_id )
 *
 * Safely runs profile field data through kses and force_balance_tags.
 *
 * @param string $field_value
 * @param int $field_id
 * @return string
 */
function xprofile_sanitize_data_value_before_save ( $field_value, $field_id ) {

	// Return if empty
	if ( empty( $field_value ) )
		return;

	// Value might be serialized
	$field_value = maybe_unserialize( $field_value );

	// Filter single value
	if ( !is_array( $field_value ) ) {
		$kses_field_value     = wp_filter_kses( $field_value );
		$filtered_field_value = force_balance_tags( $kses_field_value );

	// Filter each array item independently
	} else {
		foreach ( (array)$field_value as $value ) {
			$kses_field_value       = wp_filter_kses( $value );
			$filtered_values[] = force_balance_tags( $kses_field_value );
		}

		$filtered_field_value = serialize( $filtered_values );
	}

	return $filtered_field_value;
}
Esempio n. 3
0
/**
 * Plugin register_setting() sanitize callback
 * 
 * Validate and whitelist user-input data before updating Plugin 
 * Options in the database. Only whitelisted options are passed
 * back to the database, and user-input data for all whitelisted
 * options are sanitized.
 * 
 * @link	http://codex.wordpress.org/Data_Validation	Codex Reference: Data Validation
 * 
 * @param	array	$input	Raw user-input data submitted via the Plugin Settings page
 * @return	array	$input	Sanitized user-input data passed to the database
 */
function cbnetdppp_options_validate($input)
{
    // This is the "whitelist": current settings
    $valid_input = cbnetdppp_get_options();
    // Get the array of option parameters
    $option_parameters = cbnetdppp_get_option_parameters();
    // Get the array of option defaults
    $option_defaults = cbnetdppp_get_option_defaults();
    // Determine what type of submit was input
    $submittype = !empty($input['reset']) ? 'reset' : 'submit';
    // Loop through each setting
    foreach ($option_defaults as $setting => $value) {
        // If no option is selected, set the default
        //$valid_input[$setting] = ( ! isset( $input[$setting] ) ? $option_defaults[$setting] : $input[$setting] );
        // If submit, validate/sanitize $input
        if ('submit' == $submittype) {
            // Get the setting details from the defaults array
            $optiondetails = $option_parameters[$setting];
            // Get the array of valid options, if applicable
            $valid_options = isset($optiondetails['valid_options']) ? $optiondetails['valid_options'] : false;
            // Validate checkbox fields
            if ('checkbox' == $optiondetails['type']) {
                // If input value is set and is true, return true; otherwise return false
                $valid_input[$setting] = isset($input[$setting]) && true == $input[$setting] ? true : false;
            } else {
                if ('radio' == $optiondetails['type']) {
                    // Only update setting if input value is in the list of valid options
                    $valid_input[$setting] = array_key_exists($input[$setting], $valid_options) ? $input[$setting] : $valid_input[$setting];
                } else {
                    if ('select' == $optiondetails['type']) {
                        // Only update setting if input value is in the list of valid options
                        $valid_input[$setting] = array_key_exists($input[$setting], $valid_options) ? $input[$setting] : $valid_input[$setting];
                    } else {
                        if ('text' == $optiondetails['type'] || 'textarea' == $optiondetails['type']) {
                            // Validate no-HTML content
                            if ('nohtml' == $optiondetails['sanitize']) {
                                // Pass input data through the wp_filter_nohtml_kses filter
                                $valid_input[$setting] = wp_filter_nohtml_kses($input[$setting]);
                            }
                            // Validate HTML content
                            if ('html' == $optiondetails['sanitize']) {
                                // Pass input data through the wp_filter_kses filter
                                $valid_input[$setting] = wp_filter_kses($input[$setting]);
                            }
                            // Validate integer content
                            if ('integer' == $optiondetails['sanitize']) {
                                // Verify value is an integer
                                $valid_input[$setting] = is_int((int) $input[$setting]) ? $input[$setting] : $valid_input[$setting];
                            }
                        }
                    }
                }
            }
        } elseif ('reset' == $submittype) {
            // Set $setting to the default value
            $valid_input[$setting] = $option_defaults[$setting];
        }
    }
    return $valid_input;
}
function messages_notification_new_message($args)
{
    global $bp;
    extract($args);
    $message = new BP_Messages_Message($item_id);
    $sender_name = bp_fetch_user_fullname($message->sender_id, false);
    for ($i = 0; $i < count($recipient_ids); $i++) {
        if ($message->sender_id == $recipient_ids[$i] || 'no' == get_userdata($recipient_ids[$i], 'notification-messages-new-message')) {
            continue;
        }
        $ud = get_userdata($recipient_ids[$i]);
        $message_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/messages/view/' . $message->id;
        $settings_link = site_url() . '/' . BP_MEMBERS_SLUG . '/' . $ud->user_login . '/settings/notifications';
        // Set up and send the message
        $to = $ud->user_email;
        $subject = '[' . get_blog_option(1, 'blogname') . '] ' . sprintf(__('New message from %s', 'buddypress'), stripslashes($sender_name));
        $content = sprintf(__('%s sent you a new message:

Subject: %s

"%s"

To view the message: %s

---------------------
', 'buddypress'), $sender_name, stripslashes(wp_filter_kses($message->subject)), stripslashes(wp_filter_kses($message->message)), $message_link);
        $content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
        // Send it
        wp_mail($to, $subject, $content);
    }
}
Esempio n. 5
0
 /**
  * Returns HTML formatted comment content. Cleans returned content of any XSS.
  *
  * @return string
  */
 public function content()
 {
     if ($this->content === null) {
         $this->content = stripcslashes(apply_filters('comment_text', wp_filter_kses($this->c->comment_content)));
     }
     return $this->content;
 }
function sanitize_option($option, $value) {

	switch ($option) {
		case 'admin_email':
			$value = sanitize_email($value);
			break;

		case 'default_post_edit_rows':
		case 'mailserver_port':
		case 'comment_max_links':
			$value = abs((int) $value);
			break;

		case 'posts_per_page':
		case 'posts_per_rss':
			$value = (int) $value;
			if ( empty($value) ) $value = 1;
			if ( $value < -1 ) $value = abs($value);
			break;

		case 'default_ping_status':
		case 'default_comment_status':
			// Options that if not there have 0 value but need to be something like "closed"
			if ( $value == '0' || $value == '')
				$value = 'closed';
			break;

		case 'blogdescription':
		case 'blogname':
			if (current_user_can('unfiltered_html') == false)
				$value = wp_filter_post_kses( $value );
			break;

		case 'blog_charset':
			$value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value);
			break;

		case 'date_format':
		case 'time_format':
		case 'mailserver_url':
		case 'mailserver_login':
		case 'mailserver_pass':
		case 'ping_sites':
		case 'upload_path':
			$value = strip_tags($value);
			$value = wp_filter_kses($value);
			break;

		case 'gmt_offset':
			$value = preg_replace('/[^0-9:.-]/', '', $value);
			break;

		case 'siteurl':
		case 'home':
			$value = clean_url($value);
			break;
	}

	return $value;	
}
/**
 * Show form to remove an affiliate.
 * @param int $affiliate_id affiliate id
 */
function affiliates_admin_affiliates_remove($affiliate_id)
{
    global $wpdb;
    if (!current_user_can(AFFILIATES_ADMINISTER_AFFILIATES)) {
        wp_die(__('Access denied.', AFFILIATES_PLUGIN_DOMAIN));
    }
    $affiliate = affiliates_get_affiliate(intval($affiliate_id));
    if (empty($affiliate)) {
        wp_die(__('No such affiliate.', AFFILIATES_PLUGIN_DOMAIN));
    }
    $affiliates_users_table = _affiliates_get_tablename('affiliates_users');
    $affiliate_user = null;
    $affiliate_user_edit = '';
    $affiliate_user_id = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM {$affiliates_users_table} WHERE affiliate_id = %d", intval($affiliate_id)));
    if ($affiliate_user_id !== null) {
        $affiliate_user = get_user_by('id', intval($affiliate_user_id));
        if ($affiliate_user) {
            if (current_user_can('edit_user', $affiliate_user->ID)) {
                $affiliate_user_edit = sprintf(__('Edit %s', AFFILIATES_PLUGIN_DOMAIN), '<a target="_blank" href="' . esc_url("user-edit.php?user_id={$affiliate_user->ID}") . '">' . $affiliate_user->user_login . '</a>');
            } else {
                $affiliate_user_edit = $affiliate_user->user_login;
            }
        }
    }
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $current_url = remove_query_arg('action', $current_url);
    $current_url = remove_query_arg('affiliate_id', $current_url);
    $output = '<div class="manage-affiliates">' . '<div>' . '<h2>' . __('Remove an affiliate', AFFILIATES_PLUGIN_DOMAIN) . '</h2>' . '</div>' . '<form id="remove-affiliate" action="' . $current_url . '" method="post">' . '<div class="affiliate remove">' . '<input id="affiliate-id-field" name="affiliate-id-field" type="hidden" value="' . esc_attr(intval($affiliate_id)) . '"/>' . '<ul>' . '<li>' . sprintf(__('Name : %s', AFFILIATES_PLUGIN_DOMAIN), wp_filter_kses($affiliate['name'])) . '</li>' . '<li>' . sprintf(__('Email : %s', AFFILIATES_PLUGIN_DOMAIN), wp_filter_kses($affiliate['email'])) . '</li>' . '<li>' . sprintf(__('Username : %s', AFFILIATES_PLUGIN_DOMAIN), wp_filter_kses($affiliate_user_edit)) . '</li>' . '<li>' . sprintf(__('From : %s', AFFILIATES_PLUGIN_DOMAIN), wp_filter_kses($affiliate['from_date'])) . '</li>' . '<li>' . sprintf(__('Until : %s', AFFILIATES_PLUGIN_DOMAIN), wp_filter_kses($affiliate['from_date'])) . '</li>' . '</ul> ' . wp_nonce_field('affiliates-remove', AFFILIATES_ADMIN_AFFILIATES_NONCE, true, false) . '<input class="button" type="submit" value="' . __('Remove', AFFILIATES_PLUGIN_DOMAIN) . '"/>' . '<input type="hidden" value="remove" name="action"/>' . '<a class="cancel" href="' . $current_url . '">' . __('Cancel', AFFILIATES_PLUGIN_DOMAIN) . '</a>' . '</div>' . '</div>' . '</form>' . '</div>';
    // .manage-affiliates
    echo $output;
    affiliates_footer();
}
function bp_forums_filter_decode($content)
{
    $content = str_replace('/amp/', '&', $content);
    $content = @html_entity_decode($content, ENT_COMPAT, "UTF-8");
    $content = str_replace('[', '<', $content);
    $content = str_replace(']', '>', $content);
    $content = stripslashes(wp_filter_kses($content));
    return $content;
}
 /**
  * Automatically apply coupons.
  * 
  * Also removes auto-apply coupons (although that should happen
  * automatically, it seems we're on the safer side doing that as well
  * here).
  */
 public static function wp_init()
 {
     global $wpdb, $woocommerce;
     if (isset($woocommerce) && isset($woocommerce->cart) && $woocommerce->cart->coupons_enabled()) {
         $coupons = $wpdb->get_results("SELECT DISTINCT ID, post_title FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id WHERE {$wpdb->posts}.post_status = 'publish' AND {$wpdb->postmeta}.meta_key = '_vd_auto'");
         if ($coupons && count($coupons) > 0) {
             foreach ($coupons as $coupon) {
                 $coupon_code = $coupon->post_title;
                 $coupon = new WC_Coupon($coupon_code);
                 if ($coupon->id) {
                     if ($coupon->is_valid()) {
                         if (!$woocommerce->cart->has_discount($coupon_code)) {
                             $woocommerce->cart->add_discount($coupon_code);
                             $msg = '';
                             $message = get_post_meta($coupon->id, '_vd_auto_message_display', true);
                             $show_description = get_post_meta($coupon->id, '_vd_auto_description_display', true) == 'yes';
                             $show_info = get_post_meta($coupon->id, '_vd_auto_info_display', true) == 'yes';
                             if (!empty($message)) {
                                 $msg .= sprintf('<div class="coupon display message %s">', wp_strip_all_tags($coupon->code));
                                 $msg .= stripslashes(wp_filter_kses($message));
                                 $msg .= '</div>';
                             }
                             if ($show_description) {
                                 if ($post = get_post($coupon->id)) {
                                     if (!empty($post->post_excerpt)) {
                                         $msg .= sprintf('<div class="coupon display description %s">', wp_strip_all_tags($coupon->code));
                                         $msg .= stripslashes(wp_filter_kses($post->post_excerpt));
                                         $msg .= '</div>';
                                     }
                                 }
                             }
                             if ($show_info) {
                                 $msg .= sprintf('<div class="coupon display volume-discount %s">', wp_strip_all_tags($coupon->code));
                                 $msg .= WooCommerce_Volume_Discount_Coupons_Shortcodes::get_volume_discount_info($coupon);
                                 $msg .= '</div>';
                             }
                             if (!empty($msg)) {
                                 $woocommerce->add_message($msg);
                             }
                         }
                     } else {
                         if ($woocommerce->cart->has_discount($coupon_code)) {
                             if (!empty($woocommerce->cart->applied_coupons)) {
                                 foreach ($woocommerce->cart->applied_coupons as $index => $code) {
                                     if ($coupon_code == $code) {
                                         unset($woocommerce->cart->applied_coupons[$index]);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * Start the process of including the widget
  **/
 function GoogleAnalyticsSummary()
 {
     add_action('wp_dashboard_setup', array($this, 'addDashboardWidget'));
     add_action('admin_footer', array($this, 'addJavascript'));
     add_action('admin_footer-index.php', array($this, 'addTopJs'));
     $this->qa_selecteddate = isset($_REQUEST['qa_selecteddate']) ? wp_filter_kses($_REQUEST['qa_selecteddate']) : '31';
     $this->date_before = date('Y-m-d', strtotime('-' . $this->qa_selecteddate . ' days', strtotime(current_time('mysql'))));
     $this->date_yesterday = date('Y-m-d', strtotime('-1 days', strtotime(current_time('mysql'))));
     add_action('wp_ajax_ga_stats_widget', array($this, 'ajaxWidget'));
 }
 /**
  * Save the widget data'
  * 
  * @see WP_Widget::update()
  */
 public function update($new, $old)
 {
     foreach ($new as $key => $val) {
         if (is_array($val)) {
             foreach ($val as $key => $value) {
                 $val[$key] = wp_filter_kses($val);
             }
         }
         $new[$key] = wp_filter_kses($val);
     }
     return $new;
 }
function messages_notification_new_message($args = array())
{
    // These should be extracted below
    $recipients = array();
    $email_subject = $email_content = '';
    extract($args);
    $sender_name = bp_core_get_user_displayname($sender_id);
    // Bail if no recipients
    if (!empty($recipients)) {
        foreach ($recipients as $recipient) {
            if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) {
                continue;
            }
            // User data and links
            $ud = get_userdata($recipient->user_id);
            // Bail if user cannot be found
            if (empty($ud)) {
                continue;
            }
            $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/';
            $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
            $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/';
            // Sender info
            $sender_name = stripslashes($sender_name);
            $subject = stripslashes(wp_filter_kses($subject));
            $content = stripslashes(wp_filter_kses($content));
            // Set up and send the message
            $email_to = $ud->user_email;
            $email_subject = bp_get_email_subject(array('text' => sprintf(__('New message from %s', 'buddypress'), $sender_name)));
            $email_content = sprintf(__('%1$s sent you a new message:

Subject: %2$s

"%3$s"

To view and read your messages please log in and visit: %4$s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
            // Only show the disable notifications line if the settings component is enabled
            if (bp_is_active('settings')) {
                $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            }
            // Send the message
            $email_to = apply_filters('messages_notification_new_message_to', $email_to);
            $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name);
            $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link);
            wp_mail($email_to, $email_subject, $email_content);
        }
    }
    do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args);
}
 /** 
  * Renders a comment according to the $options given.
  * 
  * @param int $comment_ID the comment ID
  * @param array $options used to specify rendering settings, defaults apply if none given
  * @return rendered comment
  * @see Decent_Comments_Renderer::$defaults
  */
 static function get_comment($comment_ID = 0, $options = array())
 {
     $ellipsis = self::$defaults['ellipsis'];
     if (isset($options["ellipsis"])) {
         $ellipsis = wp_filter_kses(addslashes($options["ellipsis"]));
     }
     $excerpt = self::$defaults['excerpt'];
     if (isset($options["excerpt"])) {
         $excerpt = $options["excerpt"] !== false;
     }
     $max_excerpt_words = self::$defaults['max_excerpt_words'];
     if (isset($options["max_excerpt_words"])) {
         $max_excerpt_words = intval($options["max_excerpt_words"]);
     }
     $strip_tags = self::$defaults['strip_tags'];
     if (isset($options["strip_tags"])) {
         $strip_tags = $options["strip_tags"] !== false;
     }
     $output = "";
     $comment = get_comment($comment_ID);
     if ($comment) {
         if ($strip_tags) {
             $content = strip_tags($comment->comment_content);
         } else {
             $content = $comment->comment_content;
         }
         // guard against shortcodes in comments
         $content = str_replace("[", "&#91;", $content);
         $content = str_replace("]", "&#93;", $content);
         if ($excerpt) {
             $content = preg_replace("/\\s+/", " ", $content);
             $words = explode(" ", $content);
             $nwords = count($words);
             for ($i = 0; $i < $max_excerpt_words && $i < $nwords; $i++) {
                 $output .= $words[$i];
                 if ($i < $max_excerpt_words - 1) {
                     $output .= " ";
                 } else {
                     $output .= $ellipsis;
                 }
             }
         } else {
             $output = $content;
         }
     }
     return $output;
 }
function messages_notification_new_message($args = array())
{
    // These should be extracted below
    $recipients = array();
    $email_subject = $email_content = '';
    extract($args);
    $sender_name = bp_core_get_user_displayname($sender_id);
    // Bail if no recipients
    if (!empty($recipients)) {
        foreach ($recipients as $recipient) {
            if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) {
                continue;
            }
            // User data and links
            $ud = get_userdata($recipient->user_id);
            $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/';
            $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
            $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/';
            // Sender info
            $sender_name = stripslashes($sender_name);
            $subject = stripslashes(wp_filter_kses($subject));
            $content = stripslashes(wp_filter_kses($content));
            // Set up and send the message
            $email_to = $ud->user_email;
            $sitename = wp_specialchars_decode(get_blog_option(bp_get_root_blog_id(), 'blogname'), ENT_QUOTES);
            $email_subject = '[' . $sitename . '] ' . sprintf(__('New message from %s', 'buddypress'), $sender_name);
            $email_content = sprintf(__('%1$s sent you a new message:

Subject: %2$s

"%3$s"

To view and read your messages please log in and visit: %4$s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
            $email_content .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            // Send the message
            $email_to = apply_filters('messages_notification_new_message_to', $email_to);
            $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name);
            $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link);
            wp_mail($email_to, $email_subject, $email_content);
        }
    }
    do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args);
}
Esempio n. 15
0
function print_feed($myfeed = 'http://code.google.com/feeds/p/xiyoulinux/updates/basic', $feedtitle = '西邮Linux小组网站更新', $shownumber = '3')
{
    require_once ABSPATH . WPINC . '/rss-functions.php';
    $rss = @fetch_rss($myfeed);
    if (isset($rss->items) && 0 != count($rss->items)) {
        echo '<h3>' . $feedtitle . '</h3><ul>';
        $rss->items = array_slice($rss->items, 0, $shownumber);
        foreach ($rss->items as $item) {
            $title = wp_specialchars($item['title']);
            $url = wp_filter_kses($item['link']);
            //echo $title;
            //echo $url;
            echo "<li><a href={$url}>{$title}</a></li>";
            //echo $item['description'];
        }
    }
    echo "</ul>";
}
Esempio n. 16
0
function qa_buddypress_activity_post($args)
{
    global $bp;
    $defaults = array('content' => false, 'user_id' => $bp->loggedin_user->id);
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    // Record this on the user's profile
    $from_user_link = bp_core_get_userlink($user_id);
    $activity_action = $action;
    $activity_content = $content;
    $primary_link = bp_core_get_userlink($user_id, false, true);
    // Now write the values
    $activity_id = bp_activity_add(array('user_id' => $user_id, 'action' => apply_filters('bp_activity_new_update_action', $activity_action), 'content' => apply_filters('bp_activity_new_update_content', $activity_content), 'primary_link' => apply_filters('bp_activity_new_update_primary_link', $primary_link), 'component' => $bp->activity->id, 'type' => $type));
    // Add this update to the "latest update" usermeta so it can be fetched anywhere.
    bp_update_user_meta($bp->loggedin_user->id, 'bp_latest_update', array('id' => $activity_id, 'content' => wp_filter_kses($content)));
    do_action('bp_activity_posted_update', $content, $user_id, $activity_id);
    return $activity_id;
}
Esempio n. 17
0
function messages_notification_new_message( $args ) {
	global $bp;
	extract($args);

	$sender_name = bp_core_get_user_displayname( $sender_id );

	foreach( $recipients as $recipient ) {
		if ( $sender_id == $recipient->user_id || 'no' == get_user_meta( $recipient->user_id, 'notification_messages_new_message', true ) ) continue;

		$ud = get_userdata( $recipient->user_id );
		$message_link = bp_core_get_user_domain( $recipient->user_id ) . BP_MESSAGES_SLUG .'/';
		$settings_link = bp_core_get_user_domain( $recipient->user_id ) .  BP_SETTINGS_SLUG . '/notifications/';

		$sender_name = stripslashes( $sender_name );
		$subject = stripslashes( wp_filter_kses( $subject ) );
		$content = stripslashes( wp_filter_kses( $content ) );

		// Set up and send the message
		$email_to      = $ud->user_email;
		$sitename      = wp_specialchars_decode( get_blog_option( BP_ROOT_BLOG, 'blogname' ), ENT_QUOTES );
		$email_subject = '[' . $sitename . '] ' . sprintf( __( 'New message from %s', 'buddypress' ), $sender_name );

		$email_content = sprintf( __(
'%s sent you a new message:

Subject: %s

"%s"

To view and read your messages please log in and visit: %s

---------------------
', 'buddypress' ), $sender_name, $subject, $content, $message_link );

		$email_content .= sprintf( __( 'To disable these notifications please log in and go to: %s', 'buddypress' ), $settings_link );

		/* Send the message */
		$email_to = apply_filters( 'messages_notification_new_message_to', $email_to );
		$email_subject = apply_filters( 'messages_notification_new_message_subject', $email_subject, $sender_name );
		$email_content = apply_filters( 'messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link );

		wp_mail( $email_to, $email_subject, $email_content );
	}
}
function bp_links_at_message_notification($content, $poster_user_id, $link_id, $activity_id)
{
    global $bp;
    /* Scan for @username strings in an activity update. Notify each user. */
    $pattern = '/[@]+([A-Za-z0-9-_]+)/';
    preg_match_all($pattern, $content, $usernames);
    /* Make sure there's only one instance of each username */
    if (!($usernames = array_unique($usernames[1]))) {
        return false;
    }
    $link = new BP_Links_Link($link_id);
    foreach ((array) $usernames as $username) {
        if (!($receiver_user_id = bp_core_get_userid($username))) {
            continue;
        }
        if (!bp_links_is_link_visibile($link, $receiver_user_id)) {
            continue;
        }
        // Now email the user with the contents of the message (if they have enabled email notifications)
        if ('no' != get_usermeta($user_id, 'notification_activity_new_mention')) {
            $poster_name = bp_core_get_user_displayname($poster_user_id);
            $message_link = bp_activity_get_permalink($activity_id);
            $settings_link = bp_core_get_user_domain($receiver_user_id) . 'settings/notifications/';
            // Set up and send the message
            $ud = bp_core_get_core_userdata($receiver_user_id);
            $to = $ud->user_email;
            $subject = '[' . get_blog_option(BP_ROOT_BLOG, 'blogname') . '] ' . sprintf(__('%s mentioned you in the link "%s"', 'buddypress-links'), stripslashes($poster_name), wp_filter_kses(stripslashes($link->name)));
            $message = sprintf(__('%s mentioned you in the link "%s":

"%s"

To view and respond to the message, log in and visit: %s

---------------------
', 'buddypress-links'), $poster_name, wp_filter_kses(stripslashes_deep($link->name)), wp_filter_kses(stripslashes_deep($content)), $message_link);
            $message .= sprintf(__('To disable these notifications please log in and go to: %s', 'buddypress'), $settings_link);
            // Send it
            wp_mail($to, $subject, $message);
        }
    }
}
Esempio n. 19
0
 public static function cf_sanitize_values_on_save($value)
 {
     if (current_user_can('unfiltered_html')) {
         if (is_array($value)) {
             foreach ($value as $val) {
                 $val = self::cf_sanitize_values_on_save($val);
             }
         } else {
             $value = wp_filter_post_kses($value);
         }
     } else {
         if (is_array($value)) {
             foreach ($value as $val) {
                 $val = self::cf_sanitize_values_on_save($val);
             }
         } else {
             $value = wp_filter_kses($value);
         }
     }
     return $value;
 }
Esempio n. 20
0
/**
 * Sanitises various option values based on the nature of the option.
 *
 * This is basically a switch statement which will pass $value through a number
 * of functions depending on the $option.
 *
 * @since 2.0.5
 *
 * @param string $option The name of the option.
 * @param string $value The unsanitised value.
 * @return string Sanitized value.
 */
function sanitize_option($option, $value)
{
    switch ($option) {
        case 'admin_email':
            $value = sanitize_email($value);
            if (!is_email($value)) {
                $value = get_option($option);
                // Resets option to stored value in the case of failed sanitization
                if (function_exists('add_settings_error')) {
                    add_settings_error('admin_email', 'invalid_admin_email', __('The email address entered did not appear to be a valid email address. Please enter a valid email address.'));
                }
            }
            break;
        case 'thumbnail_size_w':
        case 'thumbnail_size_h':
        case 'medium_size_w':
        case 'medium_size_h':
        case 'large_size_w':
        case 'large_size_h':
        case 'embed_size_h':
        case 'default_post_edit_rows':
        case 'mailserver_port':
        case 'comment_max_links':
        case 'page_on_front':
        case 'page_for_posts':
        case 'rss_excerpt_length':
        case 'default_category':
        case 'default_email_category':
        case 'default_link_category':
        case 'close_comments_days_old':
        case 'comments_per_page':
        case 'thread_comments_depth':
        case 'users_can_register':
        case 'start_of_week':
            $value = absint($value);
            break;
        case 'embed_size_w':
            if ('' !== $value) {
                $value = absint($value);
            }
            break;
        case 'posts_per_page':
        case 'posts_per_rss':
            $value = (int) $value;
            if (empty($value)) {
                $value = 1;
            }
            if ($value < -1) {
                $value = abs($value);
            }
            break;
        case 'default_ping_status':
        case 'default_comment_status':
            // Options that if not there have 0 value but need to be something like "closed"
            if ($value == '0' || $value == '') {
                $value = 'closed';
            }
            break;
        case 'blogdescription':
        case 'blogname':
            $value = addslashes($value);
            $value = wp_filter_post_kses($value);
            // calls stripslashes then addslashes
            $value = stripslashes($value);
            $value = esc_html($value);
            break;
        case 'blog_charset':
            $value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value);
            // strips slashes
            break;
        case 'date_format':
        case 'time_format':
        case 'mailserver_url':
        case 'mailserver_login':
        case 'mailserver_pass':
        case 'ping_sites':
        case 'upload_path':
            $value = strip_tags($value);
            $value = addslashes($value);
            $value = wp_filter_kses($value);
            // calls stripslashes then addslashes
            $value = stripslashes($value);
            break;
        case 'gmt_offset':
            $value = preg_replace('/[^0-9:.-]/', '', $value);
            // strips slashes
            break;
        case 'siteurl':
            if ((bool) preg_match('#http(s?)://(.+)#i', $value)) {
                $value = esc_url_raw($value);
            } else {
                $value = get_option($option);
                // Resets option to stored value in the case of failed sanitization
                if (function_exists('add_settings_error')) {
                    add_settings_error('siteurl', 'invalid_siteurl', __('The Cartoonbank address you entered did not appear to be a valid URL. Please enter a valid URL.'));
                }
            }
            break;
        case 'home':
            if ((bool) preg_match('#http(s?)://(.+)#i', $value)) {
                $value = esc_url_raw($value);
            } else {
                $value = get_option($option);
                // Resets option to stored value in the case of failed sanitization
                if (function_exists('add_settings_error')) {
                    add_settings_error('home', 'invalid_home', __('The Site address you entered did not appear to be a valid URL. Please enter a valid URL.'));
                }
            }
            break;
        default:
            $value = apply_filters("sanitize_option_{$option}", $value, $option);
            break;
    }
    return $value;
}
Esempio n. 21
0
/**
 * Show the latest NextGEN Gallery news
 * 
 * @return void
 */
function ngg_overview_news()
{
    // get feed_messages
    require_once ABSPATH . WPINC . '/rss.php';
    ?>
<div class="rss-widget">
    <?php 
    //    $rss = @fetch_rss('http://alexrabe.boelinger.com/?tag=nextgen-gallery&feed=rss2');
    $rss = @fetch_rss('http://alexrabe.boelinger.com/feed/rss2/');
    if (isset($rss->items) && 0 != count($rss->items)) {
        $rss->items = array_slice($rss->items, 0, 3);
        echo "<ul>";
        foreach ($rss->items as $item) {
            ?>
          <li><a class="rsswidget" title="" href='<?php 
            echo wp_filter_kses($item['link']);
            ?>
'><?php 
            echo wp_specialchars($item['title']);
            ?>
</a>
		  <span class="rss-date"><?php 
            echo date("F jS, Y", strtotime($item['pubdate']));
            ?>
</span> 
          <div class="rssSummary"><strong><?php 
            echo human_time_diff(strtotime($item['pubdate'], time()));
            ?>
</strong> - <?php 
            echo $item['description'];
            ?>
</div></li>
        <?php 
        }
        echo "</ul>";
    } else {
        ?>
        <p><?php 
        printf(__('Newsfeed could not be loaded.  Check the <a href="%s">front page</a> to check for updates.', 'nggallery'), 'http://alexrabe.boelinger.com/');
        ?>
</p>
        <?php 
    }
    ?>
</div>
<?php 
}
 function validate_general_options($input)
 {
     $options = get_option(GCE_GENERAL_OPTIONS_NAME);
     $options['stylesheet'] = esc_url($input['stylesheet']);
     $options['javascript'] = isset($input['javascript']) ? true : false;
     $options['loading'] = esc_html($input['loading']);
     $options['error'] = wp_filter_kses($input['error']);
     $options['fields'] = isset($input['fields']) ? true : false;
     $options['old_stylesheet'] = isset($input['old_stylesheet']) ? true : false;
     add_settings_error('gce_general', 'gce_general_updated', __('General options updated.', GCE_TEXT_DOMAIN), 'updated');
     return $options;
 }
Esempio n. 23
0
function sandbox_init()
{
    load_theme_textdomain('sandbox');
    if ($GLOBALS['pagenow'] == 'themes.php' && isset($_GET['page']) && $_GET['page'] == 'skins' && isset($_GET['action']) && $_GET['action'] == 'activate' && current_user_can('switch_themes')) {
        check_admin_referer('switch-skin_' . $_GET['skin']);
        $info = sandbox_skin_info($_GET['skin']);
        sandbox_set_options(array('skin' => wp_filter_kses($_GET['skin']), 'globalnav' => bool_from_yn($info['global_navigation'])));
        wp_redirect('themes.php?page=skins&message=updated');
    }
}
/**
 * Email message recipients to alert them of a new unread private message.
 *
 * @since BuddyPress (1.0.0)
 *
 * @param array|BP_Messages_Message $raw_args {
 *     Array of arguments. Also accepts a BP_Messages_Message object.
 *     @type array  $recipients    User IDs of recipients.
 *     @type string $email_subject Subject line of message.
 *     @type string $email_content Content of message.
 *     @type int    $sender_id     User ID of sender.
 * }
 */
function messages_notification_new_message($raw_args = array())
{
    // Cast possible $message object as an array
    if (is_object($raw_args)) {
        $args = (array) $raw_args;
    } else {
        $args = $raw_args;
    }
    // These should be extracted below
    $recipients = array();
    $email_subject = $email_content = '';
    $sender_id = 0;
    // Barf
    extract($args);
    // Get the sender display name
    $sender_name = bp_core_get_user_displayname($sender_id);
    // Bail if no recipients
    if (!empty($recipients)) {
        foreach ($recipients as $recipient) {
            if ($sender_id == $recipient->user_id || 'no' == bp_get_user_meta($recipient->user_id, 'notification_messages_new_message', true)) {
                continue;
            }
            // User data and links
            $ud = get_userdata($recipient->user_id);
            // Bail if user cannot be found
            if (empty($ud)) {
                continue;
            }
            $message_link = bp_core_get_user_domain($recipient->user_id) . bp_get_messages_slug() . '/';
            $settings_slug = function_exists('bp_get_settings_slug') ? bp_get_settings_slug() : 'settings';
            $settings_link = bp_core_get_user_domain($recipient->user_id) . $settings_slug . '/notifications/';
            // Sender info
            $sender_name = stripslashes($sender_name);
            $subject = stripslashes(wp_filter_kses($subject));
            $content = stripslashes(wp_filter_kses($message));
            // Set up and send the message
            $email_to = $ud->user_email;
            $email_subject = bp_get_email_subject(array('text' => sprintf(__('New message from %s', 'buddypress'), $sender_name)));
            $email_content = sprintf(__('%1$s sent you a new message:

Subject: %2$s

"%3$s"

To view and read your messages please log in and visit: %4$s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
            // Only show the disable notifications line if the settings component is enabled
            if (bp_is_active('settings')) {
                $email_content .= sprintf(__('To disable these notifications, please log in and go to: %s', 'buddypress'), $settings_link);
            }
            /**
             * Filters the user email that the message notification will be sent to.
             *
             * @since BuddyPress (1.2.0)
             *
             * @param string  $email_to User email the notification is being sent to.
             * @param WP_User $ud       WP_User object of who is receiving the message.
             */
            $email_to = apply_filters('messages_notification_new_message_to', $email_to, $ud);
            /**
             * Filters the message notification subject that will be sent to user.
             *
             * @since BuddyPress (1.2.0)
             *
             * @param string  $email_subject Email notification subject text.
             * @param string  $sender_name   Name of the person who sent the message.
             * @param WP_User $ud            WP_User object of who is receiving the message.
             */
            $email_subject = apply_filters('messages_notification_new_message_subject', $email_subject, $sender_name, $ud);
            /**
             * Filters the message notification message that will be sent to user.
             *
             * @since BuddyPress (1.2.0)
             *
             * @param string  $email_content Email notification message text.
             * @param string  $sender_name   Name of the person who sent the message.
             * @param string  $subject       Email notification subject text.
             * @param string  $content       Content of the message.
             * @param string  $message_link  URL permalink for the message.
             * @param string  $settings_link URL permalink for the user's notification settings area.
             * @param WP_User $ud            WP_User object of who is receiving the message.
             */
            $email_content = apply_filters('messages_notification_new_message_message', $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud);
            wp_mail($email_to, $email_subject, $email_content);
        }
    }
    /**
     * Fires after the sending of a new message email notification.
     *
     * @since BuddyPress (1.5.0)
     *
     * @param array  $recipients    User IDs of recipients.
     * @param string $email_subject Email notification subject text.
     * @param string $email_content Email notification message text.
     * @param array  $$args         Array of originally provided arguments.
     */
    do_action('bp_messages_sent_notification_email', $recipients, $email_subject, $email_content, $args);
}
Esempio n. 25
0
function dsq_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    switch ($comment->comment_type) {
        case '':
            ?>
    <li <?php 
            comment_class();
            ?>
 id="dsq-comment-<?php 
            echo comment_ID();
            ?>
">
        <div id="dsq-comment-header-<?php 
            echo comment_ID();
            ?>
" class="dsq-comment-header">
            <cite id="dsq-cite-<?php 
            echo comment_ID();
            ?>
">
<?php 
            if (comment_author_url()) {
                ?>
                <a id="dsq-author-user-<?php 
                echo comment_ID();
                ?>
" href="<?php 
                echo comment_author_url();
                ?>
" target="_blank" rel="nofollow"><?php 
                echo comment_author();
                ?>
</a>
<?php 
            } else {
                ?>
                <span id="dsq-author-user-<?php 
                echo comment_ID();
                ?>
"><?php 
                echo comment_author();
                ?>
</span>
<?php 
            }
            ?>
            </cite>
        </div>
        <div id="dsq-comment-body-<?php 
            echo comment_ID();
            ?>
" class="dsq-comment-body">
            <div id="dsq-comment-message-<?php 
            echo comment_ID();
            ?>
" class="dsq-comment-message"><?php 
            echo wp_filter_kses(comment_text());
            ?>
</div>
        </div>

    <?php 
            break;
        case 'pingback':
        case 'trackback':
            ?>
    <li class="post pingback">
        <p><?php 
            echo dsq_i('Pingback:');
            ?>
 <?php 
            comment_author_link();
            ?>
(<?php 
            edit_comment_link(dsq_i('Edit'), ' ');
            ?>
)</p>
    </li>
    <?php 
            break;
    }
}
Esempio n. 26
0
 static function text_sanitize_html_field($input, $setting)
 {
     $input = wp_filter_kses($input);
     return $input;
 }
function bp_the_site_member_random_profile_data()
{
    global $site_members_template;
    if (function_exists('xprofile_get_random_profile_data')) {
        ?>
		<?php 
        $random_data = xprofile_get_random_profile_data($site_members_template->member->id, true);
        ?>
			<strong><?php 
        echo wp_filter_kses($random_data[0]->name);
        ?>
</strong>
			<?php 
        echo wp_filter_kses($random_data[0]->value);
        ?>
	<?php 
    }
}
Esempio n. 28
0
 function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $instance['title'] = esc_html($new_instance['title']);
     $instance['id'] = esc_html($new_instance['id']);
     $instance['display_type'] = esc_html($new_instance['display_type']);
     $instance['max_events'] = absint($new_instance['max_events']);
     $instance['order'] = 'asc' == $new_instance['order'] ? 'asc' : 'desc';
     $instance['display_title'] = 'on' == $new_instance['display_title'] ? true : false;
     $instance['display_title_text'] = wp_filter_kses($new_instance['display_title_text']);
     return $instance;
 }
Esempio n. 29
0
function ga_options_page()
{
    // If we are a postback, store the options
    if (isset($_POST['info_update'])) {
        # Verify nonce
        check_admin_referer('google-analyticator-update_settings');
        update_option('ga_defaults', 'no');
        // Get our domains array, and match the UID to the value
        $domains = stripslashes($_POST['ga_domain_names']);
        $all_domains = unserialize($domains);
        update_option('ga_domain_name', $all_domains[$_POST[key_ga_uid]]);
        // Update the status
        $ga_status = wp_filter_kses($_POST[key_ga_status]);
        if ($ga_status != ga_enabled && $ga_status != ga_disabled) {
            $ga_status = ga_status_default;
        }
        update_option(key_ga_status, $ga_status);
        // Update Hiding UID (if set)
        if (isset($_POST[key_ga_disable_gasites])) {
            $ga_disable_gasites = wp_filter_kses($_POST[key_ga_disable_gasites]);
            if (!$ga_disable_gasites) {
                $ga_disable_gasites = ga_disable_gasites_default;
            }
            update_option(key_ga_disable_gasites, $ga_disable_gasites);
        }
        // Update the Analytic Snippet
        //define("key_ga_analytic_snippet", "ga_analytic_snippet", true);
        $ga_analytic_snippet = wp_filter_kses($_POST[key_ga_analytic_snippet]);
        if ($ga_analytic_snippet != ga_enabled && $ga_analytic_snippet != ga_disabled) {
            $ga_analytic_snippet = ga_analytic_snippet;
        }
        update_option(key_ga_analytic_snippet, $ga_analytic_snippet);
        // Update the UID
        $ga_uid = wp_filter_kses($_POST[key_ga_uid]);
        if ($ga_uid == '') {
            $ga_uid = ga_uid_default;
        }
        update_option(key_ga_uid, $ga_uid);
        // Update the admin logging
        $ga_admin = wp_filter_kses($_POST[key_ga_admin]);
        if ($ga_admin != ga_enabled && $ga_admin != ga_disabled) {
            $ga_admin = ga_admin_default;
        }
        update_option(key_ga_admin, wp_filter_kses($ga_admin));
        // Update the Dimension Index
        $ga_admin_disable_DimentionIndex = $_POST[key_ga_admin_disable_DimentionIndex];
        if ($ga_admin_disable_DimentionIndex == '') {
            $ga_admin_disable_DimentionIndex = ga_admin_disable_DimentionIndex_default;
        }
        update_option(key_ga_admin_disable_DimentionIndex, wp_filter_kses($ga_admin_disable_DimentionIndex));
        // Update the admin disable setting
        $ga_admin_disable = wp_filter_kses($_POST[key_ga_admin_disable]);
        if ($ga_admin_disable == '') {
            $ga_admin_disable = ga_admin_disable_default;
        }
        update_option(key_ga_admin_disable, wp_filter_kses($ga_admin_disable));
        // Update the admin level
        if (array_key_exists(key_ga_admin_role, $_POST)) {
            $ga_admin_role = $_POST[key_ga_admin_role];
        } else {
            $ga_admin_role = "";
        }
        update_option(key_ga_admin_role, $ga_admin_role);
        // Update the dashboard level
        if (array_key_exists(key_ga_dashboard_role, $_POST)) {
            $ga_dashboard_role = $_POST[key_ga_dashboard_role];
        } else {
            $ga_dashboard_role = "";
        }
        update_option(key_ga_dashboard_role, $ga_dashboard_role);
        // Update the extra tracking code
        $ga_extra = $_POST[key_ga_extra];
        update_option(key_ga_extra, wp_filter_kses($ga_extra));
        // Update the extra after tracking code
        $ga_extra_after = $_POST[key_ga_extra_after];
        update_option(key_ga_extra_after, wp_filter_kses($ga_extra_after));
        // Update the adsense key
        $ga_adsense = $_POST[key_ga_adsense];
        update_option(key_ga_adsense, wp_filter_kses($ga_adsense));
        // Update the event tracking
        $ga_event = $_POST[key_ga_event];
        if ($ga_event != ga_enabled && $ga_event != ga_disabled) {
            $ga_event = ga_event_default;
        }
        update_option(key_ga_event, wp_filter_kses($ga_event));
        // Update the outbound tracking
        $ga_outbound = $_POST[key_ga_outbound];
        if ($ga_outbound != ga_enabled && $ga_outbound != ga_disabled) {
            $ga_outbound = ga_outbound_default;
        }
        update_option(key_ga_outbound, wp_filter_kses($ga_outbound));
        // Update the outbound prefix
        $ga_outbound_prefix = $_POST[key_ga_outbound_prefix];
        if ($ga_outbound_prefix == '') {
            $ga_outbound_prefix = ga_outbound_prefix_default;
        }
        update_option(key_ga_outbound_prefix, wp_filter_kses($ga_outbound_prefix));
        // Update the download tracking code
        $ga_downloads = $_POST[key_ga_downloads];
        update_option(key_ga_downloads, wp_filter_kses($ga_downloads));
        // Update the Enhanced Link Attribution
        $ga_enhanced_link_attr = $_POST[key_ga_enhanced_link_attr];
        if ($ga_enhanced_link_attr == '') {
            $ga_enhanced_link_attr = ga_enhanced_link_attr_default;
        }
        update_option(key_ga_enhanced_link_attr, wp_filter_kses($ga_enhanced_link_attr));
        // Update the download prefix
        $ga_downloads_prefix = $_POST[key_ga_downloads_prefix];
        if ($ga_downloads_prefix == '') {
            $ga_downloads_prefix = ga_downloads_prefix_default;
        }
        update_option(key_ga_downloads_prefix, wp_filter_kses($ga_downloads_prefix));
        // Update the widgets option
        $ga_widgets = $_POST[key_ga_widgets];
        if ($ga_widgets != ga_enabled && $ga_widgets != ga_disabled) {
            $ga_widgets = ga_widgets_default;
        }
        update_option(key_ga_widgets, wp_filter_kses($ga_widgets));
        // Update the widgets option
        update_option(key_ga_annon, wp_filter_kses($_POST[key_ga_annon]));
        // Update enable remarketing
        update_option(key_ga_remarketing, wp_filter_kses($_POST[key_ga_remarketing]));
        // Update key_ga_hide_ad
        update_option(key_ga_show_ad, wp_filter_kses($_POST[key_ga_show_ad]));
        // Update enable tracking login
        update_option(key_ga_track_login, wp_filter_kses($_POST[key_ga_track_login]));
        // Give an updated message
        echo "<div class='updated fade'><p><strong>" . __('Google Analyticator settings saved.', 'google-analyticator') . "</strong></p></div>";
    }
    // Are we using the auth system?
    $useAuth = get_option('ga_google_token') == '' ? false : true;
    // Output the options page
    ?>
<div class="wrap">
  <form method="post" action="<?php 
    echo ga_analyticator_setting_url();
    ?>
">
    <?php 
    # Add a nonce
    wp_nonce_field('google-analyticator-update_settings');
    ?>
    <?php 
    if (get_option(key_ga_status) == ga_disabled) {
        ?>
    <div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
      <?php 
        _e('Google Analytics integration is currently <strong>DISABLED</strong>.', 'google-analyticator');
        ?>
    </div>
    <?php 
    }
    ?>
    <?php 
    if (get_option(key_ga_uid) == "XX-XXXXX-X" && get_option(key_ga_status) != ga_disabled) {
        ?>
    <div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
      <?php 
        _e('Google Analytics integration is currently enabled, but you did not enter a UID. Tracking will not occur.', 'google-analyticator');
        ?>
    </div>
    <?php 
    }
    ?>
    <div id="vumga-container" style="position:relative;">
    <?php 
    $addons = get_option("gapro_addons");
    if (!$addons) {
        ?>
    <div id="vumga-sidebar" style="position: absolute; top: 0; right: 0; width: 250px; border: 1px solid #ccc; padding: 20px; background:#FFFFFF"> <a href="http://get.videousermanuals.com/ga-pro/?utm_campaign=analyticatorpro&utm_medium=plugin&utm_source=settings" target="_blank"><img src="<?php 
        echo plugins_url('gapro-plugin-advert-sidebar.png', __FILE__);
        ?>
" alt="Learn More" title="Learn More" /></a> </div>
    <?php 
    }
    ?>
    <div style="margin-right: 320px;">
    <table class="form-table" cellspacing="2" cellpadding="5" width="100%">
      <tr>
        <td colspan="2"><h3>
            <?php 
    _e('Basic Settings', 'google-analyticator');
    ?>
          </h3></td>
      </tr>
      
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_status;
    ?>
">
            <?php 
    _e('Google Analytics logging is', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td>
		<?php 
    echo "<select name='" . key_ga_status . "' id='" . key_ga_status . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_status) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_status) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
       
       </td>
      </tr>
      <tr id="ga_ajax_accounts">
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_uid;
    ?>
"> 
            <?php 
    _e('Analytics Account', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td>
		
		<?php 
    if (get_option(key_ga_disable_gasites) == ga_disabled) {
        ?>
		<?php 
        if ($useAuth) {
            $uids = ga_get_analytics_accounts();
            echo "<select name='" . key_ga_uid . "'> ";
            $hasSelected = false;
            // Will be set to true once a match is found. Cant echo selected twice.
            foreach ($uids as $id => $domain) {
                echo '<option value="' . $id . '"';
                // If set in DB.
                if (get_option(key_ga_uid) == $id) {
                    $hasSelected = true;
                    echo ' selected="selected"';
                } elseif ($_SERVER['HTTP_HOST'] == $domain && !$hasSelected) {
                    $hasSelected = true;
                    echo ' selected="selected"';
                }
                echo '>' . $domain . '</option>';
            }
            echo '</select>';
            // Need a copy of the array, so we can store the domain name too (for visual purposes)
            echo '<input type="hidden" name="ga_domain_names" value=\'' . serialize($uids) . '\' />';
        } else {
            echo '<input type="text" name="' . key_ga_uid . '" value="' . get_option(key_ga_uid) . '" />';
        }
        ?>
<br />
                        <input type="checkbox" name="<?php 
        echo key_ga_disable_gasites;
        ?>
" id="<?php 
        echo key_ga_disable_gasites;
        ?>
"<?php 
        if (get_option(key_ga_disable_gasites) == ga_enabled) {
            ?>
 checked="checked"<?php 
        }
        ?>
 /> <?php 
        _e('Hide Google Analytics UID after saving', 'google-analyticator');
        ?>
         	<?php 
    } else {
        echo get_option('ga_domain_name');
        ?>
 - To change this, you must <a href="<?php 
        echo admin_url('/options-general.php?page=ga_reset');
        ?>
">deauthorize and reset the plugin</a>
			 <input type="hidden" name="<?php 
        echo key_ga_disable_gasites;
        ?>
" value="<?php 
        echo ga_enabled;
        ?>
" /><input type="hidden" name="<?php 
        echo key_ga_uid;
        ?>
" value="<?php 
        echo get_option(key_ga_uid);
        ?>
" />
			<?php 
    }
    ?>
               
         </td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_analytic_snippet;
    ?>
">
            <?php 
    _e('Tracking Code', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_analytic_snippet . "' id='" . key_ga_analytic_snippet . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_analytic_snippet) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Traditional (ga.js)', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_analytic_snippet) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Universal (analytics.js)', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
					  <p  class="setting-description">
						<?php 
    _e('If you are using Universal Analytics make sure you have changed your account to a Universal Analytics property in Google Analytics. Read more about Universal Analytics <a href="https://support.google.com/analytics/answer/2817075?hl=en" target="_blank">here</a>.', 'google-analyticator');
    ?>
					  </p>						
						
						</td>
      </tr>
      <tr>
        <td colspan="2"><h3>
            <?php 
    _e('Tracking Settings', 'google-analyticator');
    ?>
          </h3></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_admin;
    ?>
">
            <?php 
    _e('Track all logged in WordPress users', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_admin . "' id='" . key_ga_admin . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_admin) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Yes', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_admin) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('No', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Selecting "no" to this option will prevent logged in WordPress users from showing up on your Google Analytics reports. This setting will prevent yourself or other users from showing up in your Analytics reports. Use the next setting to determine what user groups to exclude.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label>
            <?php 
    _e('Anonymize IP Addresses', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_annon . "' id='" . key_ga_annon . "'>\n";
    echo "<option value='0'";
    if (get_option(key_ga_annon) == false) {
        echo " selected='selected'";
    }
    echo ">" . __('No', 'google-analyticator') . "</option>\n";
    echo "<option value='1'";
    if (get_option(key_ga_annon) == true) {
        echo " selected='selected'";
    }
    echo ">" . __('Yes', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('By selecting "Yes", This tells Google Analytics to anonymize the information sent by the tracker objects by removing the last octet of the IP address prior to its storage. Note that this will slightly reduce the accuracy of geographic reporting.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_admin_role;
    ?>
">
            <?php 
    _e('User roles to not track', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    global $wp_roles;
    $roles = $wp_roles->get_names();
    $selected_roles = get_option(key_ga_admin_role);
    if (!is_array($selected_roles)) {
        $selected_roles = array();
    }
    # Loop through the roles
    foreach ($roles as $role => $name) {
        echo '<input type="checkbox" value="' . $role . '" name="' . key_ga_admin_role . '[]"';
        if (in_array($role, $selected_roles)) {
            echo " checked='checked'";
        }
        $name_pos = strpos($name, '|');
        $name = $name_pos ? substr($name, 0, $name_pos) : $name;
        echo ' /> ' . _x($name, 'User role') . '<br />';
    }
    ?>
          <p  class="setting-description">
            <?php 
    _e('Specifies the user roles to not include in your WordPress Analytics report. If a user is logged into WordPress with one of these roles, they will not show up in your Analytics report.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_admin_disable;
    ?>
">
            <?php 
    _e('Method to prevent tracking', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_admin_disable . "' id='" . key_ga_admin_disable . "'>\n";
    echo "<option value='remove'";
    if (get_option(key_ga_admin_disable) == 'remove') {
        echo " selected='selected'";
    }
    echo ">" . __('Remove', 'google-analyticator') . "</option>\n";
    echo "<option value='admin'";
    if (get_option(key_ga_admin_disable) == 'admin') {
        echo " selected='selected'";
    }
    echo ">" . __('Use \'admin\' variable', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <span class="ga_admin_disable_DimentionIndex_span"> Dimension Index :
          <input type="text" name="<?php 
    echo key_ga_admin_disable_DimentionIndex;
    ?>
" style="width:50px;" value="<?php 
    echo get_option(key_ga_admin_disable_DimentionIndex);
    ?>
" class="<?php 
    echo key_ga_admin_disable_DimentionIndex;
    ?>
" id="<?php 
    echo key_ga_admin_disable_DimentionIndex;
    ?>
" />
          </span>
          <p  class="setting-description">
            <?php 
    _e('Selecting the "Remove" option will physically remove the tracking code from logged in users. Selecting the "Use \'admin\' variable" option will assign a variable called \'admin\' to logged in users. This option will allow Google Analytics\' site overlay feature to work, but you will have to manually configure Google Analytics to exclude tracking from pageviews with the \'admin\' variable.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label>
            <?php 
    _e('Enable Remarketing, Demographics and Interests reports', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_remarketing . "' id='" . key_ga_remarketing . "'>\n";
    echo "<option value='0'";
    if (get_option(key_ga_remarketing) == '0') {
        echo " selected='selected'";
    }
    echo ">" . __('No', 'google-analyticator') . "</option>\n";
    echo "<option value='1'";
    if (get_option(key_ga_remarketing) == '1') {
        echo " selected='selected'";
    }
    echo ">" . __('Yes', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('In order to use remarketing, <a href="https://support.google.com/analytics/answer/2611270" target="_blank">please make sure you complete this checklist from Google</a>', 'google-analyticator');
    ?>
          </p>
          <p  class="setting-description">
            <?php 
    _e('To use remarketing, <a href="https://support.google.com/analytics/answer/2884495" target="_blank">Edit permission</a> is required', 'google-analyticator');
    ?>
          </p>
          <p style="color:#FF5B5B" class="newtrackingnote">Universal Analytics (analytics.js) does not currently support this feature <a href="https://developers.google.com/analytics/devguides/collection/upgrade/" target="_blank">learn more</a></p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label>
            <?php 
    _e('Track WordPress Login Page', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_track_login . "' id='" . key_ga_track_login . "'>\n";
    echo "<option value='1'";
    if (get_option(key_ga_track_login) == '1') {
        echo " selected='selected'";
    }
    echo ">" . __('Yes', 'google-analyticator') . "</option>\n";
    echo "<option value='0'";
    if (get_option(key_ga_track_login) == '0') {
        echo " selected='selected'";
    }
    echo ">" . __('No', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('This will track all access to wp-login.php', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <td colspan="2"><h3>Link Tracking Settings</h3></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_outbound;
    ?>
">
            <?php 
    _e('Outbound link tracking', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_outbound . "' id='" . key_ga_outbound . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_outbound) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_outbound) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Disabling this option will turn off the tracking of outbound links. It\'s recommended not to disable this option unless you\'re a privacy advocate (now why would you be using Google Analytics in the first place?) or it\'s causing some kind of weird issue.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_event;
    ?>
">
            <?php 
    _e('Event tracking', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_event . "' id='" . key_ga_event . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_event) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_event) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enabling this option will treat outbound links and downloads as events instead of pageviews. Since the introduction of <a href="https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide">event tracking in Analytics</a>, this is the recommended way to track these types of actions. Only disable this option if you must use the old pageview tracking method.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_enhanced_link_attr;
    ?>
">
            <?php 
    _e('Enhanced Link Attribution', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_enhanced_link_attr . "' id='" . key_ga_enhanced_link_attr . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_enhanced_link_attr) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_enhanced_link_attr) || get_option(key_ga_enhanced_link_attr) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('You can tag your pages to implement an enhanced link-tracking functionality by enabling this option. <a href="https://support.google.com/analytics/answer/2558867?hl=en" target="_blank">learn more</a>', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_downloads;
    ?>
">
            <?php 
    _e('Download extensions to track', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<input type='text' size='50' ";
    echo "name='" . key_ga_downloads . "' ";
    echo "id='" . key_ga_downloads . "' ";
    echo "value='" . wp_filter_kses(get_option(key_ga_downloads)) . "' />\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enter any extensions of files you would like to be tracked as a download. For example to track all MP3s and PDFs enter <strong>mp3,pdf</strong>. <em>Outbound link tracking must be enabled for downloads to be tracked.</em>', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_outbound_prefix;
    ?>
">
            <?php 
    _e('Prefix external links with', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<input type='text' size='50' ";
    echo "name='" . key_ga_outbound_prefix . "' ";
    echo "id='" . key_ga_outbound_prefix . "' ";
    echo "value='" . stripslashes(wp_filter_kses(get_option(key_ga_outbound_prefix))) . "' />\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enter a name for the section tracked external links will appear under. This option has no effect if event tracking is enabled.', 'google-analyticator');
    ?>
            </em></p></td>
      </tr>
      <tr>
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_downloads_prefix;
    ?>
">
            <?php 
    _e('Prefix download links with', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<input type='text' size='50' ";
    echo "name='" . key_ga_downloads_prefix . "' ";
    echo "id='" . key_ga_downloads_prefix . "' ";
    echo "value='" . stripslashes(wp_filter_kses(get_option(key_ga_downloads_prefix))) . "' />\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enter a name for the section tracked download links will appear under. This option has no effect if event tracking is enabled.', 'google-analyticator');
    ?>
            </em></p></td>
      </tr>
      <tr>
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_adsense;
    ?>
">
            <?php 
    _e('Google Adsense ID', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<input type='text' size='50' ";
    echo "name='" . key_ga_adsense . "' ";
    echo "id='" . key_ga_adsense . "' ";
    echo "value='" . get_option(key_ga_adsense) . "' />\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enter your Google Adsense ID assigned by Google Analytics in this box. This enables Analytics tracking of Adsense information if your Adsense and Analytics accounts are linked.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <td colspan="2"><h3>Additional Tracking Code </h3></td>
      </tr>
      <tr>
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_extra;
    ?>
">
            <?php 
    _e('Additional tracking code', 'google-analyticator');
    ?>
            <br />
            (
            <?php 
    _e('before tracker initialization', 'google-analyticator');
    ?>
            ):</label>
        </th>
        <td><?php 
    echo "<textarea cols='50' rows='8' ";
    echo "name='" . key_ga_extra . "' ";
    echo "id='" . key_ga_extra . "'>";
    echo stripslashes(get_option(key_ga_extra)) . "</textarea>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>before</strong> the Google Analytics tracker is initialized.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_extra_after;
    ?>
">
            <?php 
    _e('Additional tracking code', 'google-analyticator');
    ?>
            <br />
            (
            <?php 
    _e('after tracker initialization', 'google-analyticator');
    ?>
            ):</label>
        </th>
        <td><?php 
    echo "<textarea cols='50' rows='8' ";
    echo "name='" . key_ga_extra_after . "' ";
    echo "id='" . key_ga_extra_after . "'>";
    echo stripslashes(get_option(key_ga_extra_after)) . "</textarea>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Enter any additional lines of tracking code that you would like to include in the Google Analytics tracking script. The code in this section will be displayed <strong>after</strong> the Google Analytics tracker is initialized.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <td colspan="2"><h3>Admin Dashboard Widgets</h3>
          <?php 
    if (!$useAuth) {
        ?>
          <div style="margin:10px auto; border:3px #f00 solid; background-color:#fdd; color:#000; padding:10px; text-align:center;">
            <?php 
        _e('You have not authenticated with Google - you cannot use dashboard widgets! Reset the plugin to authenticate..', 'google-analyticator');
        ?>
          </div>
          <?php 
    }
    ?>
</td>
      </tr>
      <tr<?php 
    if (!$useAuth) {
        echo ' style="display:none"';
    }
    ?>
>
        <th width="30%" valign="top" style="padding-top: 10px;"><label for="<?php 
    echo key_ga_widgets;
    ?>
">
            <?php 
    _e('Include widgets', 'google-analyticator');
    ?>
            :</label></th>
        <td><?php 
    echo "<select name='" . key_ga_widgets . "' id='" . key_ga_widgets . "'>\n";
    echo "<option value='" . ga_enabled . "'";
    if (get_option(key_ga_widgets) == ga_enabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Enabled', 'google-analyticator') . "</option>\n";
    echo "<option value='" . ga_disabled . "'";
    if (get_option(key_ga_widgets) == ga_disabled) {
        echo " selected='selected'";
    }
    echo ">" . __('Disabled', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('Disabling this option will completely remove the Dashboard Summary widget and the theme Stats widget. Use this option if you would prefer to not see the widgets.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_widgets;
    ?>
">
            <?php 
    _e('Display Ad', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    echo "<select name='" . key_ga_show_ad . "' id='" . key_ga_show_ad . "'>\n";
    echo "<option value='1'";
    if (get_option(key_ga_show_ad) == '1') {
        echo " selected='selected'";
    }
    echo ">" . __('Yes', 'google-analyticator') . "</option>\n";
    echo "<option value='0' ";
    if (get_option(key_ga_show_ad) == '0') {
        echo " selected='selected'";
    }
    echo ">" . __('No', 'google-analyticator') . "</option>\n";
    echo "</select>\n";
    ?>
          <p  class="setting-description">
            <?php 
    _e('You can disable the ad on the admin dashboard.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
      <tr<?php 
    if (!$useAuth) {
        echo ' style="display:none"';
    }
    ?>
>
        <th width="30%" valign="top" style="padding-top: 10px;"> <label for="<?php 
    echo key_ga_dashboard_role;
    ?>
">
            <?php 
    _e('User roles that can see the dashboard widget', 'google-analyticator');
    ?>
            :</label>
        </th>
        <td><?php 
    global $wp_roles;
    $roles = $wp_roles->get_names();
    $selected_roles = get_option(key_ga_dashboard_role);
    if (!is_array($selected_roles)) {
        $selected_roles = array();
    }
    # Loop through the roles
    foreach ($roles as $role => $name) {
        echo '<input type="checkbox" value="' . $role . '" name="' . key_ga_dashboard_role . '[]"';
        if (in_array($role, $selected_roles)) {
            echo " checked='checked'";
        }
        $name_pos = strpos($name, '|');
        $name = $name_pos ? substr($name, 0, $name_pos) : $name;
        echo ' /> ' . _x($name, 'User role') . '<br />';
    }
    ?>
          <p  class="setting-description">
            <?php 
    _e('Specifies the user roles that can see the dashboard widget. If a user is not in one of these role groups, they will not see the dashboard widget.', 'google-analyticator');
    ?>
          </p></td>
      </tr>
    </table>
    <p class="submit">
      <input type="submit" class="button button-primary" name="info_update" value="<?php 
    _e('Save Changes', 'google-analyticator');
    ?>
" />
    </p>
    <a href="<?php 
    echo admin_url('/options-general.php?page=ga_reset');
    ?>
">
    <?php 
    _e('Deauthorize &amp; Reset Google Analyticator.', 'google-analyticator');
    ?>
    </a>
  </form>
</div>
</div>
<!-- end wrap -->
</div>
<!-- end vumga-container -->

<?php 
}
Esempio n. 30
0
function tmh_has_query_var($query_key, $value_to_check, $string_to_echo, $default = FALSE)
{
    global $wp_query;
    $mappings = tmh_article_to_demo_mappings();
    if (isset($wp_query->query_vars[$query_key]) and $wp_query->query_vars[$query_key] == $value_to_check) {
        echo stripslashes(wp_filter_kses($string_to_echo));
    } elseif (isset($wp_query->query_vars[$query_key]) and $wp_query->query_vars[$query_key] == array_search($value_to_check, $mappings)) {
        echo stripslashes(wp_filter_kses($string_to_echo));
    } elseif ($default and (!isset($wp_query->query_vars[$query_key]) or empty($wp_query->query_vars[$query_key]))) {
        echo stripslashes(wp_filter_kses($string_to_echo));
    }
}