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(' ', '&nbsp;', 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);
}
Example #2
1
function title()
{
    if (is_category()) {
        echo 'Category Archive for &quot;';
        single_cat_title();
        echo '&quot; | ';
        bloginfo('name');
    } elseif (is_tag()) {
        echo 'Tag Archive for &quot;';
        single_tag_title();
        echo '&quot; | ';
        bloginfo('name');
    } elseif (is_archive()) {
        wp_title('');
        echo ' Archive | ';
        bloginfo('name');
    } elseif (is_search()) {
        echo 'Search for &quot;' . wp_specialchars($s) . '&quot; | ';
        bloginfo('name');
    } elseif (is_home() || is_front_page()) {
        bloginfo('name');
        echo ' | ';
        bloginfo('description');
    } elseif (is_404()) {
        echo 'Error 404 Not Found | ';
        bloginfo('name');
    } elseif (is_single()) {
        wp_title('');
    } else {
        echo wp_title(' | ', false, right);
        bloginfo('name');
    }
}
Example #3
0
function jj_ngg_jquery_carousel_shortcode_handler($atts)
{
    $instance = array();
    foreach ($atts as $att => $val) {
        $instance[wp_specialchars($att)] = wp_specialchars($val);
    }
    // Set defaults
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'html_id')) {
        $instance['html_id'] = 'jcarousel';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'order')) {
        $instance['order'] = 'random';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'scroll')) {
        $instance['scroll'] = '1';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'visible')) {
        $instance['visible'] = '1';
    }
    if (WPJJNGGJ_CAROUSEL_use_default($instance, 'wrap')) {
        $instance['wrap'] = 'circular';
    }
    $instance['shortcode'] = '1';
    ob_start();
    the_widget("JJ_NGG_JQuery_Carousel", $instance, array());
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Example #4
0
 public function apanel_gateways_html($atts, $content)
 {
     //        global $wp_widget_factory;
     //
     //        extract(shortcode_atts(array(
     //            'widget_name' => FALSE
     //        ), $atts));
     //
     //        $widget_name = wp_specialchars($widget_name);
     //
     //        if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')):
     //            $wp_class = 'WP_Widget_'.ucwords(strtolower($class));
     //
     //            if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')):
     //                return '<p>'.sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"),'<strong>'.$class.'</strong>').'</p>';
     //            else:
     //                $class = $wp_class;
     //            endif;
     //        endif;
     $widget_name = wp_specialchars('Skc_Apanel_Gateways_Widget');
     ob_start();
     the_widget($widget_name, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => ''));
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
function thematic_search_form($echo = true)
{
    $search_form = "\n" . "\t";
    $search_form .= '<form id="searchbox" method="get" action="' . get_bloginfo('home') . '">';
    $search_form .= "\n" . "\t" . "\t";
    $search_form .= '<div>';
    $search_form .= "\n" . "\t" . "\t" . "\t";
    if (is_search()) {
        $search_form .= '<input id="s" name="s" type="search" placeholder="' . wp_specialchars(stripslashes($_GET['s']), true) . '" size="32" tabindex="1" />';
    } else {
        $value = __('To search, type and hit enter', 'thematic');
        $value = apply_filters('search_field_value', $value);
        $search_form .= '<input id="s" name="s" type="text" value="' . $value . '" onfocus="if (this.value == \'' . $value . '\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'' . $value . '\';}" size="32" tabindex="1" />';
    }
    $search_form .= "\n" . "\t" . "\t" . "\t";
    $search_submit = '<input id="searchsubmit" name="searchsubmit" type="submit" value="' . __('Search', 'thematic') . '" tabindex="2" />';
    $search_form .= apply_filters('thematic_search_submit', $search_submit);
    $search_form .= "\n" . "\t" . "\t";
    $search_form .= '</div>';
    $search_form .= "\n" . "\t";
    $search_form .= '</form>';
    if ($echo) {
        echo apply_filters('thematic_search_form', $search_form);
    } else {
        return apply_filters('thematic_search_form', $search_form);
    }
}
Example #6
0
function pdf24Plugin_widgetControl()
{
    if ($_POST['pdf24PluginSubmit']) {
        update_option('pdf24Plugin_sbpStyle', $_POST['pdf24Plugin-sbpStyle']);
        update_option('pdf24Plugin_widgetTitle', $_POST['pdf24Plugin-widget-title']);
    }
    $styleParms = pdf24Plugin_getStyleParams('pdf24Plugin_sbpStyle', 'styles/sbp');
    ?>
	<p style="text-align:left; line-height: 100%;">
	<label for="pdf24Plugin-widget-title" style="line-height:25px;display:block;">
		<?php 
    _e('Title:');
    ?>
<br />
		<input style="width:100%" type="text" id="pdf24Plugin-widget-title" name="pdf24Plugin-widget-title" value="<?php 
    echo wp_specialchars(pdf24Plugin_getWidgetTitle(), true);
    ?>
" />
	</label>
	<label for="pdf24Plugin-sbpStyle" style="line-height:25px;display:block;">
		<?php 
    _e('Style:');
    ?>
<br />
		<select id="pdf24Plugin-sbpStyle" name="pdf24Plugin-sbpStyle">
		<?php 
    echo $styleParms['options'];
    ?>
		</select>
	</label>
	<input type="hidden" name="pdf24PluginSubmit" id="pdf24PluginSubmit" value="1" />
	</p>
	
<?php 
}
Example #7
0
 function widget_subpagehierarchy_page_rows($headpage, $parent = 0, $level = 0, $pages = 0)
 {
     global $wpdb, $class, $post;
     if (!$pages) {
         $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
     }
     if ($pages) {
         foreach ($pages as $post) {
             start_wp();
             if ($post->post_parent == $parent) {
                 $post->post_title = wp_specialchars($post->post_title);
                 $pad = str_repeat('&#8212;', $level);
                 $id = $post->ID;
                 if ($id == $headpage) {
                     $selectString = ' selected';
                 } else {
                     unset($selectString);
                 }
                 $class = 'alternate' == $class ? '' : 'alternate';
                 echo '  <option value="' . $post->ID . '"' . $selectString . ">{$pad}" . $post->post_title . "</option>\n";
                 widget_subpagehierarchy_page_rows($headpage, $id, $level + 1, $pages);
             }
         }
     } else {
         return false;
     }
 }
function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
	$content = get_the_content($more_link_text, $stripteaser, $more_file);
	$content = apply_filters('the_content_rss', $content);
	if ( $cut && !$encode_html )
		$encode_html = 2;
	if ( 1== $encode_html ) {
		$content = wp_specialchars($content);
		$cut = 0;
	} elseif ( 0 == $encode_html ) {
		$content = make_url_footnote($content);
	} elseif ( 2 == $encode_html ) {
		$content = strip_tags($content);
	}
	if ( $cut ) {
		$blah = explode(' ', $content);
		if ( count($blah) > $cut ) {
			$k = $cut;
			$use_dotdotdot = 1;
		} else {
			$k = count($blah);
			$use_dotdotdot = 0;
		}
		for ( $i=0; $i<$k; $i++ )
			$excerpt .= $blah[$i].' ';
		$excerpt .= ($use_dotdotdot) ? '...' : '';
		$content = $excerpt;
	}
	$content = str_replace(']]>', ']]&gt;', $content);
	echo $content;
}
Example #9
0
 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 &raquo;", "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 ufandshands_widget_shortcode($atts)
{
    global $wp_widget_factory;
    extract(shortcode_atts(array('widget_name' => FALSE, 'title' => '', 'numberofposts' => '3', 'showexcerpt' => 1, 'showthumbnails' => 1, 'showdate' => 1, 'showrssicon' => 1, 'specific_category_id' => ''), $atts));
    $widget_name = wp_specialchars($widget_name);
    if (!is_a($wp_widget_factory->widgets[$widget_name], 'WP_Widget')) {
        $wp_class = 'WP_Widget_' . ucwords(strtolower($class));
        if (!is_a($wp_widget_factory->widgets[$wp_class], 'WP_Widget')) {
            return '<p>' . sprintf(__("%s: Widget class not found. Make sure this widget exists and the class name is correct"), '<strong>' . $class . '</strong>') . '</p>';
        } else {
            $class = $wp_class;
        }
    }
    $instance = '&title=' . $title;
    $instance .= '&numberofposts=' . $numberofposts;
    $instance .= '&showexcerpt=' . $showexcerpt;
    $instance .= '&showthumbnails=' . $showthumbnails;
    $instance .= '&showdate=' . $showdate;
    $instance .= '&showrssicon=' . $showrssicon;
    $instance .= '&specific_category_id=' . $specific_category_id;
    // $instance .= '&='.$;
    ob_start();
    the_widget($widget_name, $instance, array('widget_id' => 'arbitrary-instance-' . $id, 'before_widget' => '<div class="widget_body">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
function thematic_search_form($echo = true)
{
    global $my_shortname;
    $search_form = "\n" . "\t";
    $search_form .= '<form id="searchbox" method="get" action="' . get_bloginfo('home') . '" role="search">';
    $search_form .= "\n" . "\t" . "\t";
    $search_form .= '<div>';
    $search_form .= "\n" . "\t" . "\t" . "\t";
    if (is_search()) {
        $search_form .= '<input id="s" name="s" type="search" placeholder="' . wp_specialchars(stripslashes($_GET['s']), true) . '" size="32" tabindex="1" autofocus>';
    } else {
        $value = __('Type to Find', $my_shortname);
        $value = apply_filters('search_field_value', $value);
        $search_form .= '<input id="s" name="s" type="search" placeholder="' . $value . '" size="32" tabindex="1">';
    }
    $search_form .= "\n" . "\t" . "\t" . "\t";
    $search_submit = '<input id="searchsubmit" name="searchsubmit" type="submit" value="' . __('go', $my_shortname) . '" tabindex="2">';
    $search_form .= apply_filters('thematic_search_submit', $search_submit);
    $search_form .= "\n" . "\t" . "\t";
    $search_form .= '</div>';
    $search_form .= "\n" . "\t";
    $search_form .= '</form>';
    if ($echo) {
        echo apply_filters('thematic_search_form', $search_form);
    } else {
        return apply_filters('thematic_search_form', $search_form);
    }
}
Example #12
0
function admin_filter_action($string, $action)
{
    if (strpos($string, '?') === false) {
        return $string .= "?action={$action}";
    } else {
        return $string .= wp_specialchars("&action={$action}");
    }
}
Example #13
0
function cargopress_title() {
  if ( is_single() ) { single_post_title(); }
  elseif ( is_home() || is_front_page() ) { bloginfo('name'); print ' | '; bloginfo('description'); get_page_number(); }
  elseif ( is_page() ) { single_post_title(''); }
  elseif ( is_search() ) { bloginfo('name'); print ' | Search results for ' . wp_specialchars($s); get_page_number(); }
  elseif ( is_404() ) { bloginfo('name'); print ' | Not Found'; }
  else { bloginfo('name'); wp_title('|'); get_page_number(); }
}
function admin_getpanellink($page, $action, $command = '')
{
    $link = BLOG_BASEURL . 'admin.php?p=' . $page . '&action=' . $action;
    if ($command) {
        $link .= '&' . $command;
    }
    return wp_specialchars(apply_filter('admin_panel_link', $link, $page, $action, $command));
}
 function start_el(&$output, $category, $depth, $args)
 {
     extract($args);
     $input_id = $this->input_id . '-' . $category->term_id;
     $output .= "\n" . '<li id="' . $this->li_id . '">';
     $output .= '<label for="' . $input_id . '" class="selectit">';
     $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $this->input_name . '[' . $category->term_id . ']" id="' . $input_id . '"' . (in_array($category->term_id, $selected_cats) ? ' checked="checked"' : "") . '/> ' . wp_specialchars(apply_filters('the_category', $category->name)) . '</label>';
 }
function wpsq_display_quiz($quizzes, $options = null)
{
    ?>
    <div class="wrap">    
    <div class="tablenav" style="height:80px">
    <form name="searchform" id="searchform" action="admin.php" method="get">
        <input type="hidden" name="page" value="slick-quiz" />
        <fieldset><legend>Search Quiz Title&hellip;</legend>
        <input type="text" name="search" id="search" value="<?php 
    echo $options['search'];
    ?>
" size="17" />
        <input type="submit" value="Filter &#187;" class="button-secondary" />
        </fieldset>
<p>How to set up the Quiz ?<br>
    	Copy and Paste the quizID (ex: [wpsq-quiz=1]) into your TITLE <b>and</b> BODY field on a Post/Page.<br />
    And then Your quiz will be set up automatically.</p>
        
    </form>
    </div>
    <br style="clear:both;" />

    <table class="widefat">
        <thead>
        <tr>

        <th scope="col"><div style="text-align: center">QuizID</div></th>
        <th scope="col">Title</th>
        <th scope="col"></th>
        <th scope="col"></th>

        </tr>
        </thead>
        <tbody id="the-list">
        
        <?php 
    $cnt = 0;
    foreach ($quizzes as $quiz) {
        $link = "admin.php?page=wpsq-addedit&task=delete&quiz_id=" . $quiz->quiz_id;
        echo "<tr " . ($cnt % 2 == 0 ? ' class="alternate"' : '') . ">\n";
        echo "<th scope=\"row\" style=\"text-align: center\" width=\"100\">[wpsq-quiz=" . $quiz->quiz_id . "]</th>\n";
        echo "<td width=\"300\">" . wp_specialchars($quiz->quiz_title) . "</td>\n";
        echo "<td width=\"50\"><a href=\"admin.php?page=wpsq-addedit&task=edit&quiz_id=" . $quiz->quiz_id . "\" class=\"edit\">Edit</a></td>\n";
        echo "<td width=\"50\"><a href=\"" . $link . "\" class=\"delete\" >Delete</a></td>\n";
        echo "</tr>\n";
    }
    ?>

        </tbody>
    </table>
<div class="tablenav">
<br class="clear"/>
</div>
    </div>
    <?php 
}
Example #17
0
function mystique_xtranav_icons($nav_extra)
{
    if (get_mystique_option('xtranav_twitter')) {
        $nav_extra .= '<a href="http://twitter.com/' . wp_specialchars(get_mystique_option('xtranav_twitter')) . '" class="nav-extra twitter" title="' . __("Follow me on Twitter", "mystique") . '"><span>' . __("Follow me on Twitter", "mystique") . '</span></a>';
    }
    if (get_mystique_option('xtranav_rss')) {
        $nav_extra .= '<a href="' . wp_specialchars(get_mystique_option('xtranav_rss')) . '" class="nav-extra rss" title="' . __("RSS Feeds", "mystique") . '"><span>' . __("RSS Feeds", "mystique") . '</span></a>';
    }
    return $nav_extra;
}
Example #18
0
/**
 * Display a tag clouds.
 */
function vicuna_tag_cloud($args = '')
{
    global $wp_rewrite;
    $defaults = array('levels' => 6, 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '');
    $args = wp_parse_args($args, $defaults);
    $tags = get_tags(array_merge($args, array('orderby' => 'count', 'order' => 'ASC')));
    // Always query top tags
    if (empty($tags)) {
        return;
    }
    extract($args);
    if (!$tags) {
        return;
    }
    $counts = $tag_links = array();
    foreach ((array) $tags as $tag) {
        $counts[$tag->name] = $tag->count;
        $tag_links[$tag->name] = get_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);
    $step = (int) ((max($counts) - $min_count) / $levels) + 1;
    if ($step <= 1) {
        $step = 1;
    }
    // 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]);
        $level = $levels - (int) (($count - $min_count) / $step);
        $tag = str_replace(' ', '&nbsp;', wp_specialchars($tag));
        $a[] = "<li class=\"level" . $level . "\"><a href=\"{$tag_link}\" title=\"" . attribute_escape(sprintf(__('%d Entries', 'vicuna'), $count)) . "\"{$rel}>{$tag}</a></li>";
    }
    $return = "<ul class=\"tagCloud\">\n\t";
    $return .= join("\n\t", $a);
    $return .= "\n</ul>\n";
    if (is_wp_error($return)) {
        return false;
    } else {
        echo apply_filters('vicuna_tag_cloud', $return, $tags, $args);
    }
}
function fup_upload_action()
{
    global $action, $fup_key;
    if ($action == 'upload') {
        if (!is_array($_FILES['image']['error'])) {
            return;
        }
        global $from_tab, $post_id, $style;
        if (!$from_tab) {
            $from_tab = 'upload';
        }
        check_admin_referer('inlineuploading');
        global $post_id, $post_title, $post_content;
        if (!current_user_can('upload_files')) {
            wp_die(__('You are not allowed to upload files.', 'fup') . " <a href='" . get_option('siteurl') . "/wp-admin/upload.php?style=" . attribute_escape($style . "&amp;tab=browse-all&amp;post_id={$post_id}") . "'>" . __('Browse Files', 'fup') . '</a>');
        }
        $overrides = array('action' => 'upload');
        $errors = array();
        $successed = array();
        foreach ($_FILES['image']['error'] as $key => $value) {
            if ($value == 4) {
                $errors[] = "File {$key}(" . wp_specialchars($_FILES['image']['name'][$key]) . "): " . __("No file was uploaded.", 'fup');
                continue;
            }
            $the_file = array('name' => $_FILES['image']['name'][$key], 'type' => $_FILES['image']['type'][$key], 'tmp_name' => $_FILES['image']['tmp_name'][$key], 'error' => $_FILES['image']['error'][$key], 'size' => $_FILES['image']['size'][$key]);
            $file = wp_handle_upload($the_file, $overrides);
            if (isset($file['error'])) {
                $errors[] = "File {$key}: " . $file['error'];
                continue;
            }
            $url = $file['url'];
            $type = $file['type'];
            $file = $file['file'];
            $filename = basename($file);
            // Construct the attachment array
            $attachment = array('post_title' => $post_title[$key] ? $post_title[$key] : $filename, 'post_content' => $post_content[$key], 'post_type' => 'attachment', 'post_parent' => $post_id, 'post_mime_type' => $type, 'guid' => $url);
            $fup_key = $key;
            // Resize image and create thumbnail if applicable
            fup_resize_and_thumbnail($file);
            // Save the data
            $id = wp_insert_attachment($attachment, $file, $post_id);
            wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
            $successed[] = $filename;
        }
        if (empty($successed)) {
            wp_die(implode('<br />', $errors) . "<br /><a href='" . get_option('siteurl') . "/wp-admin/upload.php?style={$style}&amp;tab={$from_tab}&amp;post_id={$post_id}'>" . __('Back to Image Uploading', 'fup') . '</a>');
        }
        if (count($successed) > 1) {
            wp_redirect(get_option('siteurl') . "/wp-admin/upload.php?style={$style}&tab=browse&post_id={$post_id}");
        } else {
            wp_redirect(get_option('siteurl') . "/wp-admin/upload.php?style={$style}&tab=browse&action=view&ID={$id}&post_id={$post_id}");
        }
        die;
    }
}
Example #20
0
 function start_el(&$output, $page, $depth, $args)
 {
     extract($args);
     $checked = "";
     if ($selected_cats === true || in_array($page->ID, $selected_cats)) {
         $checked = ' checked="checked"';
     }
     $output .= "\n<li>";
     $output .= '<label class="selectit"><input value="' . $page->ID;
     $output .= '" type="checkbox" name="' . $fieldName . '" id="in-page-' . $page->ID . '"';
     $output .= $checked . '/> ';
     $output .= wp_specialchars(apply_filters('the_title', $page->post_title)) . '</label>';
 }
Example #21
0
function mim_if_updated_today()
{
    global $wpdb;
    $today = date('Y-m-d');
    $updated = $wpdb->get_var("SELECT post_date, ID FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_date LIKE '" . $today . "%'");
    if ($updated > 0) {
        if (is_home() && !is_paged()) {
            printf(__("\t\t" . '<div class="ut"><span class="ak">0</span>&#160;<span class="utt">%1$s</span>&#160;<a accesskey="0" href="%2$s" title="%3$s">%4$s</a></div>' . "\n", 'mim'), attribute_escape(get_option('mim_updated_today')), get_permalink($updated->ID), wp_specialchars(get_the_title($updated->ID), 1), get_the_title($updated->ID));
        } elseif (is_home() && is_paged()) {
            printf(__("\t\t" . '<div class="ut"><span class="ak">H</span>&#160;<span class="utt">%1$s</span>&#160;<a accesskey="H" href="%2$s/" title="Home" rel="home">Back to home</a></div>' . "\n", 'mim'), attribute_escape(get_option('mim_updated_today')), get_bloginfo('url'));
        }
    }
}
function wp_ajax_meta_row( $pid, $mid, $key, $value ) {
	$value = attribute_escape($value);
	$key_js = addslashes(wp_specialchars($key, 'double'));
	$key = attribute_escape($key);
	$r .= "<tr id='meta-$mid'><td valign='top'>";
	$r .= "<input name='meta[$mid][key]' tabindex='6' onkeypress='return killSubmit(\"theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);\",event);' type='text' size='20' value='$key' />";
	$r .= "</td><td><textarea name='meta[$mid][value]' tabindex='6' rows='2' cols='30'>$value</textarea></td><td align='center'>";
	$r .= "<input name='updatemeta' type='button' class='updatemeta' tabindex='6' value='".attribute_escape(__('Update'))."' onclick='return theList.ajaxUpdater(&#039;meta&#039;,&#039;meta-$mid&#039;);' /><br />";
	$r .= "<input name='deletemeta[$mid]' type='submit' onclick=\"return deleteSomething( 'meta', $mid, '";
	$r .= js_escape(sprintf(__("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop."), $key_js));
	$r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__('Delete'))."' /></td></tr>";
	return $r;
}
Example #23
0
function content_tag($tag, $content, $options = array(), $out = true)
{
    foreach ($options as $k => $v) {
        $attrs .= $k . '="' . wp_specialchars($v) . '"';
    }
    if (!empty($attrs)) {
        $attrs = " {$attrs}";
    }
    $tag = "<{$tag}{$attrs}>{$content}</{$tag}>";
    if ($out) {
        echo $tag;
    }
    return $tag;
}
Example #24
0
function widget_flickr_control()
{
    $options = $newoptions = get_option('widget_flickr');
    if ($options == false) {
        $newoptions['title'] = 'Flickr Photos';
    }
    if ($_POST["flickr-submit"]) {
        $newoptions['title'] = strip_tags(stripslashes($_POST["flickr-title"]));
        $newoptions['bk-color'] = strip_tags(stripslashes($_POST["flickr-bk-color"]));
        $newoptions['flickr_rss_id'] = strip_tags(stripslashes($_POST["flickr-rss-url"]));
    }
    if ($options != $newoptions) {
        $options = $newoptions;
        update_option('widget_flickr', $options);
    }
    $title = wp_specialchars($options['title']);
    $flickr_bk_color = wp_specialchars($options['bk-color']);
    if (empty($flickr_bk_color)) {
        $flickr_bk_color = '#FFFFFF';
    }
    $flickr_rss_id = wp_specialchars($options['flickr_rss_id']);
    ?>
	<p><label for="flickr-title"><?php 
    _e('Title:');
    ?>
 <input style="width: 250px;" id="flickr-title" name="flickr-title" type="text" value="<?php 
    echo $title;
    ?>
" /></label></p>
	<p><label for="flickr-rss-url"><?php 
    _e('Flickr RSS ID:');
    ?>
 <input style="width: 250px;" id="flickr-rss-url" name="flickr-rss-url" type="text" value="<?php 
    echo $flickr_rss_id;
    ?>
" /></label></p>
	<p><label for="flickr-bk-color"><?php 
    _e('Widget Background Color:');
    ?>
 <input style="width: 100px;" id="flickr-bk-color" name="flickr-bk-color" type="text" value="<?php 
    echo $flickr_bk_color;
    ?>
" /></label></p>
	<p align='left'>
	* Your RSS ID can be found on http://www.flickr.com/fun/zeitgeist/. <br /><em>var zg_nsids = 123456@N05';</em> <br />copy the value '123456@N05' into the box above.<br />
	<br clear='all'></p>
	<p>Leave the Flickr RSS URL blank to display <a href="http://freetofeel.com/">Joshua's</a> Flickr photos.</p>
	<input type="hidden" id="flickr-submit" name="flickr-submit" value="1" />
	<?php 
}
Example #25
0
 function AlephWidget($name, $description = '')
 {
     $this->name = $name;
     $this->class_name = get_class(&$this);
     $this->wrap_start = '';
     $this->wrap_end = '';
     $this->display_title = true;
     $this->widget_id = sanitize_title($name);
     $this->widget_opts = array('classname' => 'widget_' . strtolower($this->class_name));
     if (!empty($description)) {
         $this->widget_opts['description'] = wp_specialchars($description);
     }
     wp_register_sidebar_widget($this->widget_id, $this->name, array(&$this, 'display'), $this->widget_opts);
 }
Example #26
0
function screen_meta_drafts_content()
{
    $output = '';
    $drafts = cfdd_get_drafts();
    if (count($drafts)) {
        $output .= '<ul id="cfdd_drafts">';
        foreach ($drafts as $draft) {
            $output .= '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $draft->ID . '">' . wp_specialchars($draft->post_title) . '</a></li>';
        }
        $output .= '</ul>';
    } else {
        $output .= '<p>' . __('(none)', 'drafts-dropdown') . '</p>';
    }
    return $output;
}
function category_dropdown($fieldname, $selected = 0) {
	global $wpdb;
	
	$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
	echo "\n<select name='$fieldname' size='1'>";
	foreach ($results as $row) {
		echo "\n\t<option value='$row->cat_id'";
		if ($row->cat_id == $selected)
			echo " selected='selected'";
		echo ">$row->cat_id: ".wp_specialchars($row->cat_name);
		if ('Y' == $row->auto_toggle)
			echo ' (auto toggle)';
		echo "</option>\n";
	}
	echo "\n</select>\n";
}
function sf_sidedash_tag($show_avatar = true, $show_pm = true, $redirect = 4, $show_admin_link = true, $show_login_link = true)
{
    include_once SF_PLUGIN_DIR . '/template-tags/sf-template-tags-pm.php';
    include_once SF_PLUGIN_DIR . '/template-tags/sf-template-tags-avatars.php';
    global $current_user, $sfvars;
    sf_initialise_globals($sfvars['forumid']);
    $sflogin = get_option("sflogin");
    if ($redirect == 1) {
        $redirect_to = SFSITEURL;
    } else {
        if ($redirect == 2) {
            $redirect_to = SFSITEURL . 'wp-admin';
        } else {
            if ($redirect == 3) {
                $redirect_to = $_SERVER['REQUEST_URI'];
            } else {
                $redirect_to = SFURL;
            }
        }
    }
    if ($current_user->guest) {
        # are we showing login form and lost password
        if ($show_login_link) {
            # display login form
            echo '<form action="' . SFSITEURL . 'wp-login.php?action=login" method="post">' . "\n";
            echo '<div class="sftagusername"><label for="sftaglog">' . __("Username: "******"sforum") . '<input type="text" name="log" id="sftaglog" value="" size="15" /></label></div>' . "\n";
            echo '<div class="sftagpassword"><label for="sftagpwd">' . __("Password: "******"sforum") . '<input type="password" name="pwd" id="sftagpwd" value="" size="15"  /></label></div>' . "\n";
            echo '<div class="sftagremember"><input type="checkbox" id="rememberme" name="rememberme" value="forever" /><label for="rememberme">' . __("Remember me", "sforum") . '</label></div>';
            echo '<input type="submit" name="submit" id="submit" value="' . __("Login", "sforum") . '" />' . "\n";
            echo '<input type="hidden" name="redirect_to" value="' . wp_specialchars($redirect_to) . '" />' . "\n";
            echo '</form>' . "\n";
            echo '<p class="sftagguest"><a href="' . $sflogin['sflostpassurl'] . '">' . __("Lost Password", "sforum") . '</a>' . "\n";
            # if registrations allowed, display register link
            if (get_option('users_can_register') == TRUE) {
                echo '<br /><a href="' . $sflogin['sfregisterurl'] . '">' . __("Register", "sforum") . '</a></p>' . "\n";
            }
        }
    } else {
        echo '<div class="sftagavatar">' . sf_show_avatar() . '</div>';
        echo '<p class="sftag-loggedin">' . __("Logged in as", "sforum") . ' <strong>' . stripslashes($current_user->display_name) . '</strong></p>' . "\n";
        sf_pm_tag(true, false);
        if ($show_admin_link) {
            echo '<p class="sftag-admin"><a href="' . SFSITEURL . 'wp-admin' . '">' . __('Dashboard', "sforum") . '</a></p>';
        }
        echo '<p class="sftag-logout"><a href="' . wp_nonce_url(SFSITEURL . 'wp-login.php?action=logout&amp;redirect_to=' . wp_specialchars($redirect_to), 'log-out') . '">' . __('Logout', "sforum") . '</a></p>' . "\n";
    }
}
Example #29
0
function latest_posts_sidebar_module($args)
{
    global $post;
    extract($args);
    $query = 'showposts=' . sbm_get_option('num_posts');
    $k2asidescategory = get_option('k2asidescategory');
    if ($k2asidescategory != '0' and sbm_get_option('hide_asides')) {
        $query .= '&cat=-' . $k2asidescategory;
    }
    echo $before_module . $before_title . $title . $after_title;
    ?>
	<span class="metalink"><a href="<?php 
    bloginfo('rss2_url');
    ?>
" title="<?php 
    _e('RSS Feed for Blog Entries', 'k2_domain');
    ?>
" class="feedlink"><img src="<?php 
    bloginfo('template_directory');
    ?>
/images/feed.png" alt="RSS" /></a></span>

		<ul>
		<?php 
    $latest = new WP_Query($query);
    foreach ($latest->posts as $post) {
        setup_postdata($post);
        ?>
			<li><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        echo wp_specialchars(strip_tags(the_title('', '', false)), 1);
        ?>
"><?php 
        the_title();
        ?>
</a></li>
		<?php 
    }
    /* end latest loop */
    ?>
		</ul>
	<?php 
    echo $after_module;
}
function eshop_small_stats($stock, $limit = 5)
{
    global $wpdb;
    $limit = apply_filters('eshop-dashboard-top-sellers-amount', $limit);
    $rand = eshop_random_code('3');
    $table = $wpdb->prefix . "eshop_downloads";
    $stktable = $wpdb->prefix . 'eshop_stock';
    switch ($stock) {
        case 'dloads':
            $mypages = $wpdb->get_results("Select id,title,purchases,downloads From {$table} order by purchases DESC LIMIT {$limit}");
            if (!count($mypages) > 0) {
                return;
            }
            echo '<table class="widefat"><caption>' . __('Top Download Purchases', 'eshop') . '</caption>';
            echo '<thead><tr><th id="edtitle' . $rand . '">' . __('Download', 'eshop') . '</th><th id="eddown' . $rand . '">' . __('Downloads', 'eshop') . '</th><th id="edpurch' . $rand . '">' . __('Purchases', 'eshop') . '</th></tr></thead><tbody>';
            $calt = 0;
            foreach ($mypages as $row) {
                $calt++;
                $alt = $calt % 2 ? '' : ' class="alternate"';
                echo '<tr' . $alt . '>';
                echo '<td id="redid' . $row->id . '" headers="edtitle' . $rand . '"><a href="?page=eshop-downloads.php&amp;edit=' . $row->id . '" title="edit details for ' . $row->title . '">' . wp_specialchars(stripslashes($row->title), 1) . "</a></td>\n";
                echo '<td headers="eddown' . $rand . ' redid' . $row->id . '">' . $row->downloads . "</td>\n";
                echo '<td headers="edpurch' . $rand . ' redid' . $row->id . '">' . $row->purchases . "</td>\n";
                echo '</tr>' . "\n";
            }
            echo '</tbody></table>' . "\n";
            break;
        case 'stock':
        default:
            $mypages = $wpdb->get_results("SELECT {$wpdb->posts}.ID,{$wpdb->posts}.post_title, stk.purchases, stk.option_id\r\n\t\t\tfrom {$wpdb->postmeta},{$wpdb->posts}, {$stktable} as stk\r\n\t\t\tWHERE {$wpdb->postmeta}.meta_key='_eshop_stock' \r\n\t\t\tAND {$wpdb->posts}.ID={$wpdb->postmeta}.post_id AND {$wpdb->posts}.post_status != 'trash' \r\n\t\t\tAND {$wpdb->posts}.post_status != 'revision' AND stk.post_id={$wpdb->posts}.ID\r\n\t\t\torder by stk.purchases DESC LIMIT {$limit}");
            if (!count($mypages) > 0) {
                return;
            }
            echo '<table class="widefat"><caption>' . __('Top Sellers', 'eshop') . '</caption>';
            echo '<thead><tr><th id="edprod' . $rand . '">' . __('Product', 'eshop') . '</th><th id="edpurch' . $rand . '">' . __('Purchases', 'eshop') . '</th></tr></thead><tbody>';
            $calt = 0;
            foreach ($mypages as $page) {
                $calt++;
                $alt = $calt % 2 ? '' : ' class="alternate"';
                echo '<tr' . $alt . '><td id="repid' . $page->ID . $rand . $calt . '" headers="edprod' . $rand . '"><a href="post.php?action=edit&amp;post=' . $page->ID . '">' . $page->post_title . '</a> ' . $page->option_id . '</td>
				<td headers="edpurch' . $rand . ' repid' . $page->ID . $rand . $calt . '">' . $page->purchases . '</td></tr>' . "\n";
            }
            echo '</tbody></table>';
            break;
    }
}