示例#1
0
/**
 * @desc Prepare the string (add the a to the links and show the smileys)
 *
 * @param string $string
 * @param boolean display large emojis
 * @param check the links and convert them to pictures (heavy)
 * @return string
 */
function prepareString($string, $large = false, $preview = false)
{
    $string = addUrls($string, $preview);
    // We remove all the style attributes
    $string = preg_replace_callback('/(<[^>]+) style=".*?"/i', function ($match) {
        return $match[1];
    }, $string);
    // Twitter hashtags
    $string = preg_replace_callback("/ #[a-zA-Z0-9_-]{3,}/", function ($match) {
        return ' <a class="twitter hastag" href="http://twitter.com/search?q=' . urlencode(trim($match[0])) . '&src=hash" target="_blank">' . trim($match[0]) . '</a>';
    }, ' ' . $string);
    $string = preg_replace_callback("/ @[a-zA-Z0-9_-]{3,}/", function ($match) {
        return ' <a class="twitter at" href="http://twitter.com/' . trim($match[0]) . '" target="_blank">' . trim($match[0]) . '</a>';
    }, ' ' . $string);
    //remove all scripts
    $string = preg_replace_callback('#<[/]?script[^>]*>#is', function ($match) {
        return '';
    }, ' ' . $string);
    //remove all iframe
    $string = preg_replace_callback('#<[/]?iframe[^>]*>#is', function ($match) {
        return '';
    }, ' ' . $string);
    //remove all iframe
    $string = preg_replace_callback('#<[/]?ss[^>]*>#is', function ($match) {
        return '';
    }, ' ' . $string);
    // We add some smileys...
    $emoji = MovimEmoji::getInstance();
    $string = $emoji->replace($string, $large);
    return trim($string);
}
示例#2
0
}
$turl = "";
# Cycle through tree and build a url list
while ($turl = getNextUrl($turl)) {
    # Extend script time limit
    set_time_limit(3000);
    # Read html file into memory
    if ($html = file($turl)) {
        $html = stripslashes(implode($html));
        echo '<url>' . "\n\t" . '<loc>' . googlesitemap_compatible($turl) . '</loc>' . "\n";
        if ($lastmodification == true) {
            echo "\t" . '<lastmod>' . date("Y-m-d") . '</lastmod>' . "\n";
        }
        echo "\t" . '<changefreq>' . $frequency . '</changefreq>' . "\n\t" . '<priority>' . $priority . '</priority>' . "\n" . '</url>' . "\n";
        # Get site urls from html and add new unique url to list if needed
        addUrls(getUrls($turl, $html));
        #writte the same thing above on website if you have permission to writte
        if ($open_file == 'sucess') {
            fputs($fp, '<url>' . "\n\t" . '<loc>' . googlesitemap_compatible($turl) . '</loc>' . "\n");
            if ($lastmodification == true) {
                fputs($fp, "\t" . '<lastmod>' . date("Y-m-d") . '</lastmod>' . "\n");
            }
            fputs($fp, "\t" . '<changefreq>' . $frequency . '</changefreq>' . "\n\t" . '<priority>' . $priority . '</priority>' . "\n" . '</url>' . "\n");
        }
    } else {
        # check if 404error.txt was sucsefuly opened
        if ($open_file_404 == 'sucess') {
            fputs($fp_err, $turl . "\n");
        }
    }
}
示例#3
0
文件: Message.php 项目: Anon215/movim
 public function addUrls()
 {
     $this->body = addUrls($this->body);
 }
if (!$tweetArray) {
    $tweetArray = array();
    include_once TEMPLATEPATH . '/inc/tmhOAuth.php';
    include_once TEMPLATEPATH . '/inc/tmhUtilities.php';
    include_once TEMPLATEPATH . '/inc/twitter-functions.php';
    $tmhOAuth = new tmhOAuth(array('consumer_key' => 'ApaeS8RNAP8GlVo5RzRIqTmjr', 'consumer_secret' => 'MnkhVg07gJHIO0ocP9upwE0dnsviQp7oRRQXwgmvO3XirTX0Ep', 'user_token' => '32789509-ZY8I3bBQrf4DEqhKuUcvGOVIBiQwkXlUkrdLnfMbR', 'user_secret' => 'Le7peQjx0YhkgSgCg6L2S5zrgJhhEO8vB5fUnQHAClVez', 'curl_ssl_verifypeer' => false));
    $screen_name = 'povfilm';
    $code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/user_timeline'), array('screen_name' => $screen_name, 'count' => 3));
    $response = $tmhOAuth->response;
    $response = json_decode($response['response']);
    if ($response) {
        $j = 0;
        for ($i = 0; $i <= count($response); $i++) {
            if ($j < 3) {
                $text = $response[$i]->text;
                $is_retweet = $response[$i]->retweeted_status;
                if ($is_retweet) {
                    $text = "RT @" . $response[$i]->retweeted_status->user->screen_name . ": " . $response[$i]->retweeted_status->text;
                }
                $date = strtotime($response[$i]->created_at);
                $date = timeSince($date);
                $text = addUrls($text);
                $image = $response[$i]->user->profile_image_url;
                $tweetArray[$j] = array("date" => $date, "text" => $text);
                $j++;
            }
        }
    }
    // Cache for 10 minutes
    wp_cache_set('tweets', $tweetArray, "", 600);
}
示例#5
0
/**
 * @desc Prepare the string (add the a to the links and show the smileys)
 *
 * @param string $string
 * @param boolean display large emojis
 * @param check the links and convert them to pictures (heavy)
 * @return string
 */
function prepareString($string, $large = false, $preview = false)
{
    $string = addUrls($string, $preview);
    // We add some smileys...
    return trim((string) requestURL('http://localhost:1560/emojis/', 2, ['string' => $string]));
}
示例#6
0
<?php

include "sessionValid.php";
include "messagesFns.php";
//获得要添加的信息
$title = $_POST['title'];
$url = $_POST['url'];
$uid = $_SESSION['validUid'];
//添加书签
$res = addUrls($uid, $title, $url);
if ($res) {
    header('Location: http://1.softyun.sinaapp.com/messages/list.php');
} else {
    header('Location: http://1.softyun.sinaapp.com/messages/add.php');
}
exit;