function wp_generate_product_tag_cloud($tags, $args = '') { global $wp_rewrite; $defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC'); $args = wp_parse_args($args, $defaults); extract($args); if (!$tags) { return; } $counts = $tag_links = array(); foreach ((array) $tags as $tag) { $counts[$tag->name] = $tag->count; $tag_links[$tag->name] = get_product_tag_link($tag->term_id); if (is_wp_error($tag_links[$tag->name])) { return $tag_links[$tag->name]; } $tag_ids[$tag->name] = $tag->term_id; } $min_count = min($counts); $spread = max($counts) - $min_count; if ($spread <= 0) { $spread = 1; } $font_spread = $largest - $smallest; if ($font_spread <= 0) { $font_spread = 1; } $font_step = $font_spread / $spread; // SQL cannot save you; this is a second (potentially different) sort on a subset of data. if ('name' == $orderby) { uksort($counts, 'strnatcasecmp'); } else { asort($counts); } if ('DESC' == $order) { $counts = array_reverse($counts, true); } $a = array(); $rel = is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ? ' rel="tag"' : ''; foreach ($counts as $tag => $count) { $tag_id = $tag_ids[$tag]; $tag_link = clean_url($tag_links[$tag]); $tag = str_replace(' ', ' ', wp_specialchars($tag)); $a[] = "<a href='{$tag_link}' class='tag-link-{$tag_id}' title='" . attribute_escape(sprintf(__('%d topics'), $count)) . "'{$rel} style='font-size: " . ($smallest + ($count - $min_count) * $font_step) . "{$unit};'>{$tag}</a>"; } switch ($format) { case 'array': $return =& $a; break; case 'list': $return = "<ul class='product_tag_cloud'>\n\t<li>"; $return .= join("</li>\n\t<li>", $a); $return .= "</li>\n</ul>\n"; break; default: $return = join("\n", $a); break; } return apply_filters('wp_generate_product_tag_cloud', $return, $tags, $args); }
function wp_widget_simple_upcoming_events_control() { $options = $newoptions = get_option('widget_simple_upcoming_events'); if (isset($_POST["simple_upcoming_events-submit"])) { $newoptions['title'] = strip_tags(stripslashes($_POST["simple_upcoming_events-title"])); $newoptions['date_format'] = strip_tags(stripslashes($_POST["simple_upcoming_events-date_format"])); } if ($options != $newoptions) { $options = $newoptions; update_option('widget_simple_upcoming_events', $options); } $title = attribute_escape($options['title']); $date_format = attribute_escape($options['date_format']); ?> <p><label for="simple_upcoming_events-title"><?php _e('Title:'); ?> <input class="widefat" id="simple_upcoming_events-title" name="simple_upcoming_events-title" type="text" value="<?php echo $title; ?> " /></label></p> <p><label for="simple_upcoming_events-date_format"><?php _e('Date Format:'); ?> <a href="http://us.php.net/date"><?php _e('reference'); ?> </a><input class="widefat" id="simple_upcoming_events-date_format" name="simple_upcoming_events-date_format" type="text" value="<?php echo $date_format; ?> " /></label></p> <input type="hidden" id="simple_upcoming_events-submit" name="simple_upcoming_events-submit" value="1" /> <?php }
/** * Processes the widget's options to be saved. * * @param array new_instance The previous instance of values before the update. * @param array old_instance The new instance of values to be generated via the update. */ public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = attribute_escape($new_instance['title']); $instance['caption'] = attribute_escape($new_instance['caption']); return $instance; }
function hlst_query() { global $hlst_do_extend; $areas = array('div.hentry', '#content', '#main', 'div.content', '#middle', '#container', '#wrapper'); // Using the tag 'body' is known to cause conflicts. // js >> var hlst_ids = new Array("'.$id'","#main","#wrapper"); //$bgclr = '#D3E18A'; // default moss background // dark orange:#9CD4FF; lightblue:#9CD4FF; light orange:#FFCA61 $terms = hlst_get_search_query(); $filtered = array(); foreach ($terms as $term) { $term = attribute_escape(trim(str_replace(array('"', '\'', '%22'), '', $term))); if (!empty($term)) { $filtered[] = '"' . $term . '"'; } } if (count($filtered) > 0) { $hlst_do_extend = true; echo ' <!-- Highlight Search Terms ' . HLST_VERSION . ' ( RavanH - http://4visions.nl/en/wordpress-plugins/highlight-search-terms/ ) --> <script type="text/javascript"> var hlst_query = new Array(' . implode(',', $filtered) . '); var hlst_areas = new Array("' . implode('","', $areas) . '"); </script> '; } }
function form($instance) { include 'defaults.php'; $options = wp_parse_args($instance, $defaults); extract($options); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'moo-collapsing-arc'); ?> <input id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo attribute_escape($title); ?> " /></label></p> <?php include 'options.txt'; ?> <p><?php _e('Style can be set from the', 'moo-collapsing-arc'); ?> <a href='options-general.php?page=collapsArch.php'><?php _e('options page', 'moo-collapsing-arc'); ?> </a></p> <?php }
function form($instance) { $instance = wp_parse_args((array) $instance, array('max_items' => 200, 'per_page' => 25)); $per_page = strip_tags($instance['per_page']); $max_items = strip_tags($instance['max_items']); ?> <p><label for="bp-mtc-per-page"><?php _e('Number of Items Per Page:', 'bp-mtc'); ?> <input class="widefat" id="<?php echo $this->get_field_id('per_page'); ?> " name="<?php echo $this->get_field_name('per_page'); ?> " type="text" value="<?php echo attribute_escape($per_page); ?> " style="width: 30%" /></label></p> <p><label for="bp-mtc-max"><?php _e('Max items to show:', 'bp-mtc'); ?> <input class="widefat" id="<?php echo $this->get_field_id('max_items'); ?> " name="<?php echo $this->get_field_name('max_items'); ?> " type="text" value="<?php echo attribute_escape($max_items); ?> " style="width: 30%" /></label></p> <?php }
function control() { $data = get_option('Home_Image'); ?> <p><label>Enter image src <input name="Home_Image_uri" type="text" value="<?php echo $data['uri']; ?> " /></label></p> <p><label>Enter link <input name="Home_Image_link" type="text" value="<?php echo $data['link']; ?> " /></label></p> <p><label>Enter link target <input name="Home_Image_target" type="text" value="<?php echo $data['target']; ?> " /></label></p> <p><label>Enter image alt tag <input name="Home_Image_alt" type="text" value="<?php echo $data['alt']; ?> " /></label></p> <?php if (isset($_POST['Home_Image_uri'])) { $data['uri'] = attribute_escape($_POST['Home_Image_uri']); $data['alt'] = attribute_escape($_POST['Home_Image_alt']); $data['link'] = attribute_escape($_POST['Home_Image_link']); $data['target'] = attribute_escape($_POST['Home_Image_target']); update_option('Home_Image', $data); } }
/** * tarski_author_posts_link() - If site has more than one author, output a link to that author's archive page. * * @global object $authordata * @return string */ function tarski_author_posts_link() { global $authordata; if (get_tarski_option('show_authors')) { printf(__(' by ', 'tarski') . '<span class="vcard author"><a href="%1$s" title="%2$s" class="url fn">%3$s</a></span>', get_author_posts_url($authordata->ID, $authordata->user_nicename), sprintf(__('Articles by %s', 'tarski'), attribute_escape(get_the_author())), get_the_author()); } }
function formCreate($instance,$headline_instance, $cat_instance, $dropdown_instance,$num_post_instance){ //Generates widget options form which you see in the widgets section in the admin $headline = esc_attr($instance[$headline_instance]); $include_cats = esc_attr($instance[$cat_instance]); $num_post_selected = esc_attr($instance[$num_post_instance]); ?> <p><label for="<? echo $this->get_field_id($headline_instance); ?>">Headline: <input class="widefat" id="<? echo $this->get_field_id($headline_instance); ?>" name="<? echo $this->get_field_name($headline_instance); ?>" type="text" value="<? echo attribute_escape($headline); ?>" /> </label> </p> <p> Categories Dropdown / How Many Posts<br /> <? wp_dropdown_categories('orderby=name&hide_empty=0&show_option_none=Select Categories to include&id='.$dropdown_instance.'&name='.$dropdown_instance.'&taxonomy=category'); echo " "; echo $this->dw_createNumSelect($this->get_field_id($num_post_instance),$this->get_field_name($num_post_instance),10,$num_post_selected);?> <br /><br /> <label for="<? echo $this->get_field_id($cat_instance); ?>">Included Categories: <textarea class="widefat" id="<? echo $this->get_field_id($cat_instance); ?>" name="<? echo $this->get_field_name($cat_instance); ?>" rows="2" cols="1" style="text-align:left;"><? echo attribute_escape($include_cats); ?></textarea> </label> </p> <? }
function edit_screen() { global $bp; if (!bp_is_group_admin_screen($this->slug)) { return false; } ?> <p class="desc"><?php _e("Enter RSS feed URL's for blogs you would like to attach to this group. Any future posts on these blogs will show on the group activity stream. Seperate URL's with commas.", 'bp-groups-externalblogs'); ?> </span> <p> <label for="blogfeeds"><?php _e("Feed URL's:", 'bp-groups-externalblogs'); ?> </label> <textarea name="blogfeeds" id="blogfeeds"><?php echo attribute_escape(implode(', ', (array) groups_get_groupmeta($bp->groups->current_group->id, 'blogfeeds'))); ?> </textarea> </p> <input type="submit" name="save" value="<?php _e("Update Feed URL's", 'bp-groups-externalblogs'); ?> " /> <?php wp_nonce_field('groups_edit_save_' . $this->slug); }
function txfx_plt_meta_box() { global $post; echo '<p>'; wp_nonce_field('txfx_plt', '_txfx_pl2_nonce', false, true); echo '</p>'; ?> <p>Point to this URL: <input name="txfx_links_to" type="text" style="width:75%" id="txfx_links_to" value="<?php echo attribute_escape(get_post_meta($post->ID, '_links_to', true)); ?> " /></p> <p><label for="txfx_links_to_new_window"><input type="checkbox" name="txfx_links_to_new_window" id="txfx_links_to_new_window" value="_blank"<?php if ("_blank" == get_post_meta($post->ID, '_links_to_target', true)) { echo ' checked="checked"'; } ?> > Open this link in a new window</label></p> <p><label for="txfx_links_to_302"><input type="checkbox" name="txfx_links_to_302" id="txfx_links_to_302" value="302"<?php if ('302' == get_post_meta($post->ID, '_links_to_type', true)) { echo ' checked="checked"'; } ?> > Use a temporary <code>302</code> redirect (default is a permanent <code>301</code> redirect)</label></p> <?php }
function default_scripts() { $this->add('dbx', '/wp-includes/js/dbx.js', false, '2.05'); $this->add('fat', '/wp-includes/js/fat.js', false, '1.0-RC1_3660'); $this->add('sack', '/wp-includes/js/tw-sack.js', false, '1.6.1'); $this->add('quicktags', '/wp-includes/js/quicktags.js', false, '3958'); $this->localize('quicktags', 'quicktagsL10n', array('quickLinks' => __('(Quick Links)'), 'wordLookup' => __('Enter a word to look up:'), 'dictionaryLookup' => attribute_escape(__('Dictionary lookup')), 'lookup' => attribute_escape(__('lookup')), 'closeAllOpenTags' => attribute_escape(__('Close all open tags')), 'closeTags' => attribute_escape(__('close tags')), 'enterURL' => __('Enter the URL'), 'enterImageURL' => __('Enter the URL of the image'), 'enterImageDescription' => __('Enter a description of the image'))); $this->add('colorpicker', '/wp-includes/js/colorpicker.js', false, '3517'); $this->add('tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070326'); $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); $this->add('wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225'); $this->add('prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0'); $this->add('autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306'); $this->localize('autosave', 'autosaveL10n', array('autosaveInterval' => apply_filters('autosave_interval', '120'), 'errorText' => __('Error: %response%'), 'saveText' => __('Saved at %time%.'), 'requestFile' => get_option('siteurl') . '/wp-admin/admin-ajax.php', 'savingText' => __('Saving Draft...'))); $this->add('wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); $this->localize('wp-ajax', 'WPAjaxL10n', array('defaultUrl' => get_option('siteurl') . '/wp-admin/admin-ajax.php', 'permText' => __("You don't have permission to do that."), 'strangeText' => __("Something strange happened. Try refreshing the page."), 'whoaText' => __("Slow down, I'm still sending your data!"))); $this->add('listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306'); $this->localize('listman', 'listManL10n', array('jumpText' => __('Jump to new item'), 'delText' => __('Are you sure you want to delete this %thing%?'))); $this->add('scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0'); $this->add('scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0'); $this->add('scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.7.0'); $this->add('scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.7.0'); $this->add('scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.7.0'); $this->add('scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.7.0'); $this->add('scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.7.0'); $this->add('cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); $this->add('jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.2'); $this->add('interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2'); if (is_admin()) { global $pagenow; $man = false; switch ($pagenow) { case 'post.php': case 'post-new.php': $man = 'postmeta'; break; case 'page.php': case 'page-new.php': $man = 'pagemeta'; break; case 'link-add.php': case 'link.php': $man = 'linkmeta'; break; } if ($man) { $this->add('dbx-admin-key', '/wp-admin/dbx-admin-key.js', array('dbx'), '20070417'); $this->localize('dbx-admin-key', 'dbxL10n', array('manager' => $man, 'open' => __('open'), 'close' => __('close'), 'moveMouse' => __('click-down and drag to move this box'), 'toggleMouse' => __('click to %toggle% this box'), 'moveKey' => __('use the arrow keys to move this box'), 'toggleKey' => __(', or press the enter key to %toggle% it'))); } $this->add('ajaxcat', '/wp-admin/cat.js', array('listman'), '20070417'); $this->localize('ajaxcat', 'catL10n', array('add' => attribute_escape(__('Add')), 'how' => __('Separate multiple categories with commas.'))); $this->add('admin-categories', '/wp-admin/categories.js', array('listman'), '3684'); $this->add('admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733'); $this->add('admin-comments', '/wp-admin/edit-comments.js', array('listman'), '20070327'); $this->add('admin-users', '/wp-admin/users.js', array('listman'), '4583'); $this->add('xfn', '/wp-admin/xfn.js', false, '3517'); $this->add('upload', '/wp-admin/upload.js', array('prototype'), '20070306'); $this->localize('upload', 'uploadL10n', array('browseTitle' => attribute_escape(__('Browse your files')), 'back' => __('« Back'), 'directTitle' => attribute_escape(__('Direct link to file')), 'edit' => __('Edit'), 'thumb' => __('Thumbnail'), 'full' => __('Full size'), 'icon' => __('Icon'), 'title' => __('Title'), 'show' => __('Show:'), 'link' => __('Link to:'), 'file' => __('File'), 'page' => __('Page'), 'none' => __('None'), 'editorText' => attribute_escape(__('Send to editor »')), 'insert' => __('Insert'), 'urlText' => __('URL'), 'desc' => __('Description'), 'deleteText' => attribute_escape(__('Delete File')), 'saveText' => attribute_escape(__('Save »')), 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back."))); } }
function __construct() { global $email, $opt, $tml; $this->post_author = __("Thank Me Later", "thankmelater"); $this->post_date = date("Y-m-d H:i:s"); $this->guid = get_bloginfo('url') . "?tmloptout"; $this->post_title = __("E-mail Preferences", "thankmelater"); $this->post_content = '<form method="get" action="' . htmlspecialchars(get_bloginfo('url')) . '">'; $this->post_content .= '<input type="hidden" name="tmloptout" value="" />'; $this->post_content .= '<p>' . sprintf(__("This page allows you to opt-out or subscribe to 'Thank Me Later' e-mails. These are e-mails sent when you leave a comment at %s.", "thankmelater"), wp_specialchars(get_bloginfo("name"))) . '</p>'; if ($email) { $this->post_content .= '<input type="hidden" name="email" value="' . attribute_escape($email) . '" />'; $this->post_content .= '<p>' . sprintf(__("Your e-mail address: <strong>%s</strong>", "thankmelater"), wp_specialchars($email)) . '</p>'; if ($opt) { $this->post_content .= '<p>' . __("You are currently <strong>subscribed</strong> to receive e-mails. Click 'Opt Out' if you wish to opt-out of these e-mails:", "thankmelater") . '</p>'; $this->post_content .= '<input type="hidden" name="opt" value="0" />'; $this->post_content .= '<p><input type="submit" value="' . __("Opt Out", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>'; } else { $this->post_content .= '<p>' . __("You are <strong>not subscribed</strong> to receive e-mails. Click 'Opt In' if you wish to receive e-mails again:", "thankmelater") . '</p>'; $this->post_content .= '<input type="hidden" name="opt" value="1" />'; $this->post_content .= '<p><input type="submit" value="' . __("Opt In", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>'; } } else { $this->post_content .= '<p>' . sprintf(__("Your e-mail address: <strong>%s</strong>", "thankmelater"), '<input type="text" name="email" value="" />') . '</p>'; $this->post_content .= '<p><input type="submit" value="' . __("Get Preferences »", "thankmelater") . '" name="submit" style="font-weight: bold;" /></p>'; } // don't allow opt outs if (!$tml->get_option("allow_opt_out")) { $this->post_content = "<p>" . __("Sorry, this feature is disabled.", "thankmelater") . "</p>"; } }
function control() { $data = get_option('widget_tree_nav'); global $wpdb, $table_prefix; $nav_menu_term_id = $wpdb->get_col("SELECT term_id FROM {$table_prefix}term_taxonomy WHERE taxonomy = 'nav_menu'"); echo '<select name="widget_nav_option">'; foreach ($nav_menu_term_id as $n_m_term_id) { $nav_menu_name = $wpdb->get_col("SELECT name FROM {$table_prefix}terms WHERE term_id = {$n_m_term_id}"); foreach ($nav_menu_name as $n_m_name) { if ($data['treev_option'] == $n_m_term_id) { $selected = ' selected="selected"'; } else { $selected = ''; } $nav_dlist = "<option value=" . $n_m_term_id . "" . $selected . ">" . $n_m_name . "</option>"; echo $nav_dlist; } //foreach child } //foreach echo '</select>'; ?> <?php if (isset($_POST['widget_nav_option'])) { $data['treev_option'] = attribute_escape($_POST['widget_nav_option']); update_option('widget_tree_nav', $data); } }
function title() { global $thesis_site, $thesis_pages; $site_name = get_bloginfo('name'); #wp $separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '—'; if (is_home() || is_front_page()) { #wp $tagline = get_bloginfo('description'); #wp $home_title = $thesis_pages->home['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->home['head']['title']))) : "{$site_name} {$separator} {$tagline}"; #wp if (get_option('show_on_front') == 'page' && is_front_page()) { #wp $page_title = get_post_meta(get_option('page_on_front'), 'thesis_title', true); } elseif (get_option('show_on_front') == 'page' && is_home()) { #wp $page_title = get_post_meta(get_option('page_for_posts'), 'thesis_title', true); } #wp $output = $page_title ? trim(wptexturize(strip_tags(stripslashes($page_title)))) : $home_title; #wp } elseif (is_category()) { #wp global $wp_query; #wp $category_title = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title']))) : single_cat_title('', false); #wp $output = $thesis_site->head['title']['branded'] ? "{$category_title} {$separator} {$site_name}" : $category_title; } elseif (is_tag()) { global $wp_query; #wp $tag_title = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title']))) : single_tag_title('', false); #wp $output = $thesis_site->head['title']['branded'] ? "{$tag_title} {$separator} {$site_name}" : $tag_title; } elseif (is_search()) { #wp $search_title = __('You searched for', 'thesis') . ' “' . attribute_escape(get_search_query()) . '”'; #wp $output = $thesis_site->head['title']['branded'] ? "{$search_title} {$separator} {$site_name}" : $search_title; } else { global $post; #wp $custom_title = is_single() || is_page() ? trim(wptexturize(strip_tags(stripslashes(get_post_meta($post->ID, 'thesis_title', true))))) : false; #wp $page_title = $custom_title ? $custom_title : trim(wp_title('', false)); #wp $output = $thesis_site->head['title']['branded'] ? "{$page_title} {$separator} {$site_name}" : $page_title; } if (is_home() || is_archive() || is_search()) { #wp $current_page = get_query_var('paged'); #wp if ($current_page > 1) { $output .= " {$separator} " . __('Page', 'thesis') . " {$current_page}"; } } $this->title['title'] = '<title>' . apply_filters('thesis_title', $output, $separator) . '</title>'; #wp #filter }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '')); $title = strip_tags($instance['title']); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> ">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo attribute_escape($title); ?> " /></label></p> <p>To edit the settings for the zone being displayed by this Widget please go <a href='<?php echo admin_url(CRANKY_ADS_SETTINGS_PAGE_URL_RELATIVE); ?> '>here</a>.</p> <?php }
/** * Check WordPress version against the newest version. * * The WordPress version, PHP version, and Locale is sent. Checks against the * WordPress server at api.wordpress.org server. Will only check if WordPress * isn't installing. * * @package WordPress * @since 2.3.0 * @uses $wp_version Used to check against the newest WordPress version. * * @return mixed Returns null if update is unsupported. Returns false if check is too soon. */ function wp_version_check() { if (defined('WP_INSTALLING')) { return; } global $wp_version, $wpdb, $wp_local_package; $php_version = phpversion(); $current = get_option('update_core'); if (!is_object($current)) { $current = new stdClass(); } $locale = get_locale(); if (isset($current->last_checked) && 43200 > time() - $current->last_checked && $current->version_checked == $wp_version) { return false; } // Update last_checked for current to prevent multiple blocking requests if request hangs $current->last_checked = time(); update_option('update_core', $current); if (method_exists($wpdb, 'db_version')) { $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users)); } else { $mysql_version = 'N/A'; } $local_package = isset($wp_local_package) ? $wp_local_package : ''; $url = "http://api.wordpress.org/core/version-check/1.3/?version={$wp_version}&php={$php_version}&locale={$locale}&mysql={$mysql_version}&local_package={$local_package}"; $options = array('timeout' => 3, 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url')); $response = wp_remote_get($url, $options); if (is_wp_error($response)) { return false; } if (200 != $response['response']['code']) { return false; } $body = trim($response['body']); $body = str_replace(array("\r\n", "\r"), "\n", $body); $new_options = array(); foreach (explode("\n\n", $body) as $entry) { $returns = explode("\n", $entry); $new_option = new stdClass(); $new_option->response = attribute_escape($returns[0]); if (isset($returns[1])) { $new_option->url = clean_url($returns[1]); } if (isset($returns[2])) { $new_option->package = clean_url($returns[2]); } if (isset($returns[3])) { $new_option->current = attribute_escape($returns[3]); } if (isset($returns[4])) { $new_option->locale = attribute_escape($returns[4]); } $new_options[] = $new_option; } $updates = new stdClass(); $updates->updates = $new_options; $updates->last_checked = time(); $updates->version_checked = $wp_version; update_option('update_core', $updates); }
function form($instance) { //this function handles the widget form in the WordPress backend $instance = wp_parse_args((array) $instance, array('title' => '')); $title = $instance['title']; $form_id = $instance['form_id']; ?> <p><label for="<?php echo $this->get_field_id('title'); ?> ">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo attribute_escape($title); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('form_id'); ?> ">Form ID: <input class="widefat" id="<?php echo $this->get_field_id('form_id'); ?> " name="<?php echo $this->get_field_name('form_id'); ?> " type="text" value="<?php echo attribute_escape($form_id); ?> " /></label></p> <?php }
/** * tarski_doctitle() - Returns the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * @since 1.5 * @param string $sep * @return string $doctitle * @hook filter tarski_doctitle * Filter document titles. */ function tarski_doctitle($sep = '·') { $site_name = get_bloginfo('name'); if (is_404()) { $content = __(sprintf('Error %s', '404'), 'tarski'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { if (get_bloginfo('description')) { $content = get_bloginfo('description'); } } elseif (is_search()) { $content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query())); } elseif (is_month()) { $content = single_month_title(' ', false); } elseif (is_tag()) { $content = multiple_tag_titles(); } else { $content = trim(wp_title('', false)); } if ($content) { $elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content); } else { $elements = array('site_name' => $site_name); } if (get_tarski_option('swap_title_order')) { $elements = array_reverse($elements, true); } // Filters should return an array $elements = apply_filters('tarski_doctitle', $elements); // But if they don't, it won't try to implode if (check_input($elements, 'array')) { $doctitle = implode(' ', $elements); } echo $doctitle; }
function countdown_to_settings_page() { $options = array('countdown_date' => get_option('countdown_date'), 'close_comments' => get_option('countdown_close_comments', 0), 'countdown_message' => get_option('countdown_message', 'Ends in'), 'countdown_ended_message' => get_option('countdown_ended_message', 'Countdown ended')); $changed = FALSE; if (isset($_POST['countdown_date'])) { $new_date = strtotime($_POST['countdown_date']); if ($new_date === FALSE) { echo '<div class="error"><p>' . __('Please enter a valid date') . '</p></div>'; } else { $options = array('countdown_date' => $new_date); update_option('countdown_date', $options['countdown_date']); $changed = TRUE; } } foreach (array('countdown_message', 'countdown_ended_message') as $key) { if (!empty($_POST[$key])) { $options[$key] = attribute_escape(strip_tags($_POST[$key])); update_option($key, $options[$key]); $changed = TRUE; } } if (isset($_POST['countdown_close_comments']) && $_POST['countdown_close_comments' == 1]) { update_option('countdown_close_comments', 1); $changed = TRUE; } else { update_option('countdown_close_comments', 0); } if ($changed) { echo '<div class="updated"><p>' . __('Options saved') . '</p></div>'; } require dirname(__FILE__) . '/admin_page.tpl.php'; }
/** * Start the importing process */ function greet() { $this->header(); ?> <div class="narrow"> <p><?php _e('Howdy! We’re about to begin importing all of your podPress podcasts into Podcasting. To begin, click "Start Importing".'); ?> </p> <form method="post" action="<?php echo add_query_arg('step', 1); ?> " class="import-upload-form"> <?php wp_nonce_field('import-podpress'); ?> <p class="submit"> <input type="submit" value="<?php echo attribute_escape(__('Start Importing')); ?> " id="podpress-submit" /> </p> </form> <p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if—for whatever reason—it doesn\'t finish.'); ?> </p> </div> <?php $this->footer(); }
public function form($instance) { ?> <p><label for="<?php echo $this->get_field_id('title'); ?> ">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo attribute_escape($title); ?> " /></label></p> <p><label for="<?php echo $this->get_field_id('author_credit'); ?> "><?php _e('Give credit to plugin author?'); ?> <input type="checkbox" class="checkbox" <?php checked($instance['author_credit'], 'on'); ?> id="<?php echo $this->get_field_id('author_credit'); ?> " name="<?php echo $this->get_field_name('author_credit'); ?> " /></label></p> <p><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ZMEZEYTRBZP5N&lc=ID&item_name=Aditya%20Subawa&item_number=426267¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted" target="_blank"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" alt="<?_e('Donate')?>" /></a></p> <?php }
function form($instance) { $title = esc_attr($instance['title']); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> ">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo attribute_escape($title); ?> " /> </label> </p> <?php }
function add_head() { $query = attribute_escape(get_search_query()); if (strlen($query) > 0) { echo '<script type="text/javascript">var hls_query = "' . $query . '";</script>'; } }
public function tokenCheck($tokenID, $token) { global $connections; $token = attribute_escape($token); /** * @TODO: Check for $tokenID. */ if (isset($_SESSION['cn_session']['formTokens'][$tokenID]['token'])) { $sessionToken = esc_attr($_SESSION['cn_session']['formTokens'][$tokenID]['token']); } else { $connections->setErrorMessage('form_no_session_token'); $error = TRUE; } if (empty($token)) { $connections->setErrorMessage('form_no_token'); $error = TRUE; } if ($sessionToken === $token && !$error) { unset($_SESSION['cn_session']['formTokens']); return TRUE; } else { $connections->setErrorMessage('form_token_mismatch'); return FALSE; } }
/** * Outputs the options form on admin * * @param array $instance The widget options */ public function form($instance) { // PART 1: Extract the data from the instance variable $instance = wp_parse_args((array) $instance, array('title' => '')); $fb_link = $instance['fb_link']; // PART 2-3: Display the fields ?> <!-- PART 2: Facebook Link field START --> <p> <label for="<?php echo $this->get_field_id('fb_link'); ?> ">Facebook Link: <input class="widefat" id="<?php echo $this->get_field_id('fb_link'); ?> " name="<?php echo $this->get_field_name('fb_link'); ?> " type="text" value="<?php echo attribute_escape($fb_link); ?> " /> </label> </p> <!-- Widget Facebook Link field END --> <?php }
function control() { // Get our options and see if we're handling a form submission. $options = get_option('ace_widget_calendar'); if (!is_array($options)) { $options = array('title' => ''); } if (!empty($_POST['ace-calendar-submit'])) { $options['title'] = trim(strip_tags(stripslashes($_POST['ace-calendar-title']))); update_option('ace_widget_calendar', $options); } $title = attribute_escape($options['title']); ?> <p> <label for="calendar-title"> <?php _e('Title:'); ?> <input class="widefat" id="calendar-title" name="ace-calendar-title" type="text" value="<?php echo $title; ?> " /> </label> </p> <input type="hidden" name="ace-calendar-submit" value="1" /> <?php }
function cutline_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?> "> <?php echo get_avatar($comment, 48); ?> <p class="comment_meta"> <strong><?php comment_author_link(); ?> </strong> <span class="comment_time">// <a href="#comment-<?php comment_ID(); ?> " title="<?php echo attribute_escape(__('Permalink to this comment', 'cutline')); ?> "><?php comment_date(); ?> <?php _e('at'); ?> <?php comment_time(); ?> </a> <?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => ' | ')); ?> <?php edit_comment_link(__('edit', 'cutline'), '(', ')'); ?> </span> </p> <div class="entry"> <?php comment_text(); ?> <?php if ($comment->comment_approved == '0') { ?> <p><strong><?php _e('Your comment is awaiting moderation.', 'cutline'); ?> </strong></p> <?php } ?> </div> </li> <?php }
function GFCIWidget_Custom($args, $widget_args = 1) { extract($args, EXTR_SKIP); if (is_numeric($widget_args)) { $widget_args = array('number' => $widget_args); } $widget_args = wp_parse_args($widget_args, array('number' => -1)); extract($widget_args, EXTR_SKIP); $canvas_path = get_option(gfci_canvas_path); $options = get_option('custom_widget_gfci'); if (!isset($options[$number])) { return; } $gadget_wid = attribute_escape($options[$number]['gadget_wid']); $gadget_url = attribute_escape($options[$number]['gadget_url']); $gfci_border = attribute_escape($options[$number]['gfci_border']); $gfci_present = attribute_escape($options[$number]['gfci_present']); if ("checked" == $gfci_present) { $gfci_present2 = 'presentation:"canvas",'; } echo $before_widget; echo $before_title; echo $after_title; ?> <div id="gfccustom-<?php echo $number; ?> " style="width:<?php echo $gadget_wid; ?> px;border:1px solid #<?php echo $gfci_border; ?> ;"></div> <script type="text/javascript"> google.friendconnect.container.setParentUrl('<?php echo $canvas_path; ?> ' /* location of rpc_relay.html and canvas.html */); google.friendconnect.container.renderOpenSocialGadget( { id: 'gfccustom-<?php echo $number; ?> ',<?php echo $gfci_present2; ?> url:'<?php echo $gadget_url; ?> ', site: '<?php echo gfci_sit(); ?> '}, skin); </script> <?php echo $after_widget; }
function event_change_status__change_event_status() { echo '<fieldset>'; echo ' <input name="change-event-status-mail" type="text" id="change-event-status-mail" value="' . attribute_escape(get_option('change-event-status-mail')) . '" class="regular-text" />'; echo '<br />'; echo '<label for="change-event-status-mail">' . __('Send messages to this e-mails', 'event-change-status') . '</label>'; echo '</fieldset>'; }