protected function constantTest()
 {
     $string = "Hello how are you? <br> what is up <p>" . "What's going on with you<br><br><br><br><br><p><p><p><p>" . "howdy!!!!!<br><br><br><br><p>blahblahblah blah blah blah blahblahb" . "wow what's up!!!!!!! What's going on!!!!!!!!<br><br><br><p>" . "<p><p><br><br>howdy!!!!!!!!!!! More text. More text!";
     $time = microtime(true);
     for ($i = 0; $i < $this->runNumber; $i++) {
         clean_pre($string);
     }
     $time = microtime(true) - $time;
     $this->enterResult($time);
 }
function escape_my_code($attr, $content = null)
{
    $content = clean_pre($content);
    $content = trim($content);
    $content = str_replace("\t", '    ', $content);
    // タブを半角スペースに
    $content = str_replace('<', '&lt;', $content);
    return '
<pre class="sourcecode"><code>' . $content . '</code></pre>

';
}
Example #3
0
 function the_excerpt_rss($content)
 {
     if ($this->get_option('cross_relate')) {
         $type = $this->get_post_types();
     } else {
         if ('page' == get_post_type()) {
             $type = array('page');
         } else {
             $type = array('post');
         }
     }
     if ($this->get_option('rss_excerpt_display') && $this->get_option('rss_display')) {
         return $content . clean_pre($this->display_related(null, array('post_type' => $type, 'domain' => 'rss'), false));
     } else {
         return $content;
     }
 }
Example #4
0
function email_content_alt()
{
    remove_filter('the_content', 'wptexturize');
    $content = get_email_content();
    $content = clean_pre($content);
    $content = strip_tags($content);
    $email_snippet = intval(get_option('email_snippet'));
    if ($email_snippet > 0) {
        return snippet_words($content, $email_snippet);
    } else {
        return $content;
    }
}
Example #5
0
 function the_excerpt_rss($content)
 {
     global $post;
     $type = $post->post_type == 'page' ? array('page') : array('post');
     if ($this->get_option('cross_relate')) {
         $type = array('post', 'page');
     }
     if ($this->get_option('rss_excerpt_display') && $this->get_option('rss_display')) {
         return $content . clean_pre($this->display_related(null, array('post_type' => $type, 'domain' => 'rss'), false));
     } else {
         return $content;
     }
 }
Example #6
0
 function tcapi_get_activitySummary($atts, $key = "")
 {
     $url = "http://tcapi.apiary.io/v2/platform/activitySummary";
     $url = "http://community.topcoder.com/tc?module=BasicData&c=tc_direct_facts&dsid=28&json=true";
     $url = "http://api.topcoder.com/v2/platform/statistics";
     $args = array('httpversion' => get_option('httpversion'), 'timeout' => get_option('request_timeout'));
     $response = wp_remote_get($url, $args);
     if (is_wp_error($response) || !isset($response['body'])) {
         return $key == "memberCount" ? "675,000+" : "Error in processing";
     }
     if ($response['response']['code'] == 200) {
         $activity = json_decode($response['body']);
         #print_r($activity);
         $key = clean_pre($key);
         if ($key != null && $key != "") {
             return number_format($activity->data[0]->{$key});
         }
         return $activity->data[0];
     }
     return $key == "memberCount" ? "675,000+" : "Error in processing request";
 }
 function test_removes_p()
 {
     $source = "<p>isn't this exciting!</p><p>oh indeed!</p>";
     $res = "\nisn't this exciting!\noh indeed!";
     $this->assertEquals($res, clean_pre($source));
 }
Example #8
0
function yarpp_rss_excerpt($content)
{
    global $wpdb, $post;
    $type = $post->post_type == 'page' ? array('page') : array('post');
    if (yarpp_get_option('cross_relate')) {
        $type = array('post', 'page');
    }
    if (yarpp_get_option('rss_excerpt_display') && yarpp_get_option('rss_display')) {
        return $content . clean_pre(yarpp_related($type, array(), false, false, 'rss'));
    } else {
        return $content;
    }
}
Example #9
0
/**
 * This is for [html] tag postprocess
 *
 * @param unknown_type $match
 * @return unknown
 */
function plugin_bbcode_undoHtmlCallback($match)
{
    //builtin function (see core.wp-formatting)
    return clean_pre($match[1]);
}
Example #10
0
/**
 * Clear shortcode
 *
 * @param array $atts
 * @param string $content
 * @param string $code
 * @return string
 */
function fastblog_shortcode_clear($atts, $content = NULL, $code = '')
{
    extract(shortcode_atts(array('tag' => 'span'), $atts));
    if ($tag == 'pre') {
        $content = clean_pre($content);
    }
    $content = str_replace(array('{', '}'), array('[', ']'), $content);
    $content = tb_shortcode_content($content);
    return "<{$tag}>{$content}</{$tag}>";
}
function yarpp_rss_excerpt($content)
{
    global $wpdb, $post;
    if (yarpp_get_option('rss_excerpt_display') && yarpp_get_option('rss_display')) {
        return $content . clean_pre(yarpp_related(array('post'), array(), false, false, 'rss'));
    } else {
        return $content;
    }
}
function my_callback($text)
{
    return stripslashes('$text[1]') . clean_pre('$text[2]') . '</pre>';
}
Example #13
0
 function tcapi_get_track_statistics($atts, $key = "")
 {
     $url = "http://api.topcoder.com/v2/platform/statistics/";
     $args = array('httpversion' => get_option('httpversion'), 'timeout' => get_option('request_timeout'));
     if (!$atts['track']) {
         return "Track attribute is required";
     }
     $url .= $atts['track'] . '?';
     if ($atts['start_date']) {
         $url .= "&startDate=" . $atts['start_date'];
     }
     if ($atts['end_date']) {
         $url .= "&endDate=" . $atts['end_date'];
     }
     $response = wp_remote_get($url, $args);
     if (is_wp_error($response) || !isset($response['body'])) {
         return "Error in processing";
     }
     if ($response['response']['code'] == 200) {
         $statistics = json_decode($response['body']);
         $key = clean_pre($key);
         if ($key != NULL && $key != "") {
             return number_format($statistics->{$key});
         }
         return $statistics;
     }
     return "Error in processing request";
 }