当前位置: 首页>>代码示例>>PHP>>正文


PHP text_to_summary函数代码示例

本文整理汇总了PHP中text_to_summary函数的典型用法代码示例。如果您正苦于以下问题:PHP text_to_summary函数的具体用法?PHP text_to_summary怎么用?PHP text_to_summary使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了text_to_summary函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: jaiku_post

function jaiku_post($text, $short_url)
{
    global $globals;
    syslog(LOG_NOTICE, "Meneame: jaiku updater called, {$short_url}");
    $url = "http://api.jaiku.com/json";
    if (!function_exists('curl_init')) {
        syslog(LOG_NOTICE, "Meneame: curl is not installed");
        return;
    }
    $postdata = "method=presence.send";
    $postdata .= "&user=" . urlencode($globals['jaiku_user']);
    $postdata .= "&personal_key=" . $globals['jaiku_key'];
    $postdata .= "&icon=337";
    // Event
    $postdata .= "&message=" . urlencode(text_to_summary(html_entity_decode($text), 115) . ' ' . $short_url);
    $session = curl_init();
    curl_setopt($session, CURLOPT_URL, $url);
    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_USERAGENT, "meneame.net");
    curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 15);
    curl_setopt($session, CURLOPT_TIMEOUT, 20);
    curl_setopt($session, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($session, CURLOPT_POST, 1);
    curl_setopt($session, CURLOPT_POSTFIELDS, $postdata);
    $result = curl_exec($session);
    curl_close($session);
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:28,代码来源:external_post.php

示例2: twitter_post

function twitter_post($auth, $text, $short_url, $image = false)
{
    global $globals;
    if (empty($auth['twitter_token']) || empty($auth['twitter_token_secret']) || empty($auth['twitter_consumer_key']) || empty($auth['twitter_consumer_secret'])) {
        return false;
    }
    if (!class_exists("OAuth")) {
        syslog(LOG_NOTICE, "Meneame: pecl/oauth is not installed");
        return;
    }
    if (!$auth['twitter_consumer_key'] || !$auth['twitter_consumer_secret'] || !$auth['twitter_token'] || !$auth['twitter_token_secret']) {
        syslog(LOG_NOTICE, "Meneame: consumer_key, consumer_secret, token, or token_secret not defined");
        return;
    }
    $req_url = 'https://api.twitter.com/oauth/request_token';
    $acc_url = 'https://api.twitter.com/oauth/access_token';
    $authurl = 'https://api.twitter.com/oauth/authorize';
    $api_url = 'https://api.twitter.com/1.1/statuses/update.json';
    $api_media_url = 'https://api.twitter.com/1.1/statuses/update_with_media.json';
    $api_args = array("empty_param" => NULL);
    $maxlen = 140 - 24;
    // minus the url length
    if ($image) {
        $maxlen -= 24;
        echo "Adding image: {$image}\n";
        $api_args['@media[]'] = '@' . $image;
        $url = $api_media_url;
    } else {
        $url = $api_url;
    }
    $msg = mb_substr(text_to_summary(html_entity_decode($text), $maxlen), 0, $maxlen);
    $msg_full = $msg . ' ' . $short_url;
    $api_args["status"] = $msg_full;
    $oauth = new OAuth($auth['twitter_consumer_key'], $auth['twitter_consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
    $oauth->debug = 1;
    $oauth->setRequestEngine(OAUTH_REQENGINE_CURL);
    // For posting images
    $oauth->setToken($auth['twitter_token'], $auth['twitter_token_secret']);
    try {
        $oauth->fetch($url, $api_args, OAUTH_HTTP_METHOD_POST, array("User-Agent" => "pecl/oauth"));
    } catch (Exception $e) {
        syslog(LOG_INFO, 'Menéame, Twitter caught exception: ' . $e->getMessage() . " in " . basename(__FILE__) . "\n");
        echo "Twitter post failed: {$msg} " . mb_strlen($msg) . "\n";
        return false;
    }
    // $response_info = $oauth->getLastResponseInfo();
    // echo $oauth->getLastResponse() . "\n";
    return true;
}
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:49,代码来源:external_post.php

示例3: print_summary

 function print_summary($length = 0)
 {
     global $current_user, $globals;
     if ($current_user->user_id != $this->author && $current_user->user_id != $this->to) {
         return;
     }
     // Security check
     $post_meta_class = 'comment-meta';
     $post_class = 'comment-body';
     if ($this->date_read < $this->date) {
         $post_class .= ' new';
     }
     if ($length > 0) {
         $this->content = text_to_summary($this->content, $length);
     }
     $this->content = $this->to_html($this->content) . $expand;
     $vars = compact('post_meta_class', 'post_class', 'length');
     /* reference $this to use in the template */
     $vars['self'] = $this;
     return Haanga::Load('priv_summary.html', $vars);
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:21,代码来源:private.php

示例4: print_summary

	function print_summary($type='full', $karma_best_comment = 0, $show_tags = true) {
		global $current_user, $current_user, $globals, $db;

		if(!$this->read) return;
		if($this->is_votable()) {
			$this->voted = $this->vote_exists($current_user->user_id);
			if (!$this->voted) $this->md5 = md5($current_user->user_id.$this->id.$this->randkey.$globals['user_ip']);
		}

		$url = htmlspecialchars($this->url);

		$this->permalink = $this->get_permalink();

		echo '<div class="news-summary">';
		echo '<div class="news-body">';
		if ($type != 'preview' && $this->title && $this->content 
				&& ($this->votes > 0 || $current_user->user_id == $this->author) ) {
			$this->print_shake_box();
		}

		$this->print_warn();

		if ($this->status != 'published') $nofollow = ' rel="nofollow"';
		else $nofollow = '';

		if($globals['ads']) echo "<!-- google_ad_section_start -->\n";

		echo '<h1>';
		echo '<a href="'.$url.'"'.$nofollow.'>'. $this->title. '</a>';

		// Content type (for video and images)
		if ($this->content_type == 'image') {
			echo '&nbsp;<img src="'.$globals['base_static'].'img/common/is-photo01.png" class="media-icon" width="18" height="15" alt="'._('imagen').'" title="'._('imagen').'" />';
		} elseif ($this->content_type == 'video') {
			echo '&nbsp;<img src="'.$globals['base_static'].'img/common/is-video01.png" class="media-icon" width="18" height="15" alt="'._('vídeo').'" title="'._('vídeo').'" />';
		}
		echo '</h1> ';

		echo '<div class="news-submitted">';
		if ($type != 'short') {
			echo '<a href="'.get_user_uri($this->username).'"><img src="'.get_avatar_url($this->author, $this->avatar, 25).'" width="25" height="25" alt="" onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', '.$this->author.');" onmouseout="tooltip.clear(event);" /></a>';
		}
		echo '<strong>'.htmlentities(preg_replace('/^https*:\/\//', '', txt_shorter($this->url))).'</strong>'."&nbsp;<br />\n";

		// Allow to invert user in japanese translations
		printf (_('por %s'), ' <a href="'.get_user_uri($this->username, 'history').'">'.$this->username.'</a> ');

		// Print dates
		if ($globals['now'] - $this->date > 604800 || empty($_SERVER['HTTP_USER_AGENT'])) { // 7 days or user agent is empty
			echo _('el').get_date_time($this->sent_date);
			if($this->status == 'published')
				echo ', '  ._('publicado el').get_date_time($this->date);
		} else {
			echo _('hace').txt_time_diff($this->sent_date);
			if($this->status == 'published')
				echo ', '  ._('publicado hace').txt_time_diff($this->date);
		}
		echo "</div>\n";

		if($type=='full' || $type=='preview') {
			if (($src = $this->has_thumb())) {
				echo "<img src='$src' width='$this->thumb_x' height='$this->thumb_y' alt='' class='thumbnail'/>";
			}

			echo '<p>';
			echo text_to_html($this->content, 'links');
			if ($globals['link'] && $type != 'preview' ) {
				if ($this->is_editable()) {
					echo '&nbsp;&nbsp;<a href="'.$globals['base_url'].'editlink.php?id='.$this->id.'&amp;user='.$current_user->user_id.'" title="'._('editar noticia').' #'.$this->id.'"><img class="mini-icon-text" src="'.$globals['base_static'].'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>';
				}
				if ($this->geo && $this->is_map_editable()) {
					echo '&nbsp;&nbsp;<a href="#" onclick="$(\'#geoedit\').load(\''.$globals['base_url']."geo/get_form.php?id=$this->id&amp;type=link&amp;icon=$this->status".'\'); return false;"><img class="mini-icon-text" src="'.$globals['base_static'].'img/common/edit-geo01.png" alt="edit" title="'._('editar geolocalización').'"/></a>';
				}
			}
			echo '</p>';
		}


    if ($this->start_date && (!$this->end_date || ($this->start_date==$this->end_date))) {
      echo '<div>';
      echo _('Data:').' <strong>'.Link::format_date($this->start_date).'</strong>';
      echo '</div>';
    } elseif ($this->start_date && $this->end_date) {
      echo '<div>';
      echo _('Do').' <strong>'.Link::format_date($this->start_date).'</strong> '._('ata o').' <strong>'.Link::format_date($this->end_date).'</strong>';
      echo '</div>';
    }


		// Print a summary of the best comment
		// with a least one vote and younger than a day
		if ($karma_best_comment > 0 && $this->comments > 0 && $this->comments < 50 && $globals['now'] - $this->date < 86400 &&
			($best_comment = $db->get_row("select SQL_CACHE comment_id, comment_order, substr(comment_content, 1, 225) as content from comments where comment_link_id = $this->id and comment_karma > $karma_best_comment and comment_votes > 0 order by comment_karma desc limit 1"))) {
			echo '<div class="box" style="font-size: 80%; border: 1px solid; border-color: #dadada; background: #fafafa; margin: 7px 50px 7px 25px; padding: 4px; overflow:hidden">';
			$link = $this->permalink.'/000'.$best_comment->comment_order;
			echo '<a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \''.$best_comment->comment_id.'\', 10000);" href="'.$link.'"><strong>'.$best_comment->comment_order.'</strong></a>';
			echo ':&nbsp;'.text_to_summary($best_comment->content, 200).'</div>';
		}

		if ($this->do_inline_friend_votes) $this->inline_friend_votes();
//.........这里部分代码省略.........
开发者ID:rasomu,项目名称:chuza,代码行数:101,代码来源:link.php

示例5: get_server_name

    $url['most'] = "http://" . get_server_name() . "/story.php?id={$res->link_id}";
}
$res = $db->get_row("select link_id, link_title, link_votes, link_anonymous from links where link_status = 'published' order by link_date desc limit 1");
if ($res) {
    $title['published'] = text_to_summary($res->link_title, 70) . ' <span style="font-size: 90%;">[' . ($res->link_votes + $res->link_anonymous) . "&nbsp;" . _('votos') . "]</span>";
    $url['published'] = "http://" . get_server_name() . "/story.php?id={$res->link_id}";
}
$res = $db->get_row("select link_id, link_title, link_votes, link_anonymous from links where link_status = 'queued' order by link_date desc limit 1");
if ($res) {
    $title['sent'] = text_to_summary($res->link_title, 70) . ' <span style="font-size: 90%;">[' . ($res->link_votes + $res->link_anonymous) . "&nbsp;" . _('votos') . "]</span>";
    $url['sent'] = "http://" . get_server_name() . "/story.php?id={$res->link_id}";
}
$last_comment = (int) $db->get_var("select comment_link_id from comments order by comment_id desc limit 1");
$res = $db->get_row("select link_id, link_title, link_votes, link_anonymous from links where link_id = {$last_comment}");
if ($res) {
    $title['commented'] = text_to_summary($res->link_title, 70) . ' <span style="font-size: 90%;">[' . ($res->link_votes + $res->link_anonymous) . "&nbsp;" . _('votos') . "]</span>";
    $url['commented'] = "http://" . get_server_name() . "/story.php?id={$res->link_id}";
}
switch ($format) {
    case 'vertical':
        $div1 = '<div style="padding: 1px 1px 1px 1px; height: 23%; width: 100%; ">';
        $div2 = '<div style="padding: 1px 1px 1px 1px; height: 23%; width: 100%; border-top: 1px solid #' . $color_border . ';">';
        $div3 = '<div style="padding: 1px 1px 1px 1px; height: 23%; width: 100%; border-top: 1px solid #' . $color_border . ';">';
        $div4 = '<div style="padding: 1px 1px 1px 1px; height: 23%; width: 100%; border-top: 1px solid #' . $color_border . ';">';
        $signature = _('Menéame');
        break;
    case 'horizontal':
    default:
        $div1 = '<div style="position: absolute; left: 2px; top: 2px; width: 24%;">';
        $div2 = '<div style="position: absolute; left: 25%; top: 2px; width: 24%;">';
        $div3 = '<div style="position: absolute; left: 50%; top: 2px; width: 24%;">';
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:31,代码来源:show_banner.php

示例6: print_text

 function print_text($length = 0, $html_id = false)
 {
     global $current_user, $globals;
     if (!$html_id) {
         $html_id = $this->id;
     }
     if (!$this->basic_summary && ($this->author == $current_user->user_id && $globals['now'] - $this->date < $globals['comment_edit_time'] || ($this->author != $current_user->user_id || $this->type == 'admin') && $current_user->user_level == 'god')) {
         // gods can always edit
         $expand = '&nbsp;&nbsp;<a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'c-' . $html_id . '\',0,' . $this->id . ')" title="' . _('editar comentario') . '"><img class="mini-icon-text" src="' . $globals['base_static'] . 'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>';
     }
     if ($length > 0 && mb_strlen($this->content) > $length + $length / 2) {
         $this->content = text_to_summary($this->content, $length);
         // Check all html tags are closed
         if (preg_match('/<\\w+>/', $this->content)) {
             $this->content = close_tags($this->content);
         }
         $expand .= '&nbsp;&nbsp;' . '<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('resto del comentario') . '">&#187;&nbsp;' . _('ver todo el comentario') . '</a>';
     }
     echo put_smileys($this->put_comment_tooltips(save_text_to_html($this->content, 'comments'))) . $expand;
     echo "\n";
 }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:21,代码来源:comment.php

示例7: Comment

    $new = new Comment();
    $new_comment_error = $new->save_from_post($link);
}
$username = $comment->type == 'admin' ? 'admin' : $comment->username;
if ($comment->type != 'admin') {
    $globals['search_options'] = array('w' => 'comments', 'u' => $comment->username);
}
$comment->check_visibility();
if (!$comment->hide_comment) {
    $globals['description'] = _('Autor') . ": {$username}, " . _('Resumen') . ': ' . text_to_summary($comment->content, 250);
    if ($globals['media_public'] && $comment->media_size > 0) {
        $globals['thumbnail'] = Upload::get_url('comment', $comment->id, 0, $comment->media_date, $comment->media_mime);
    } elseif ($comment->avatar) {
        $globals['thumbnail'] = get_avatar_url($comment->author, $comment->avatar, 80);
    }
    $title = text_to_summary($comment->content, 120);
} else {
    $title = '';
}
if (isset($globals['canonical_server_name']) && !empty($globals['canonical_server_name'])) {
    $globals['extra_head'] = '<link rel="canonical" href="http://' . $globals['canonical_server_name'] . $comment->get_relative_individual_permalink() . '" />';
}
do_header($title . ' | ' . $globals['site_name']);
//do_subheader(_('comentario de') . ' ' . $username);
/*** SIDEBAR ****/
echo '<div id="sidebar">';
do_banner_right();
//do_best_stories();
do_best_comments();
do_banner_promotions();
echo '</div>' . "\n";
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comment.php

示例8: do_best_posts

function do_best_posts()
{
    global $db, $globals, $dblang;
    if ($globals['mobile']) {
        return;
    }
    $output = '';
    $key = 'best_posts_' . $globals['css_main'];
    if (memcache_mprint($key)) {
        return;
    }
    $min_date = date("Y-m-d H:i:00", $globals['now'] - 86400);
    // about 24 hours
    $res = $db->get_results("select post_id from posts, users where post_date > '{$min_date}' and  post_user_id = user_id and post_karma > 0 order by post_karma desc limit 10");
    if ($res) {
        $output .= '<div class="sidebox"><div class="header"><h4><a href="' . post_get_base_url('_best') . '">' . _('mejores notas') . '</a></h4></div><div class="comments"><ul>' . "\n";
        foreach ($res as $p) {
            $post = new Post();
            $post->id = $p->post_id;
            $post->read();
            $output .= '<li><img src="' . get_avatar_url($post->author, $post->avatar, 20) . '" alt="" width="20" height="20" class="avatar"/>';
            $output .= '<p><strong>' . $post->username . '</strong>: <a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_post_tooltip.php\', \'' . $post->id . '\', 10000);" href="' . post_get_base_url($post->username) . '/' . $post->id . '"><em>' . text_to_summary($post->clean_content(), 80) . '</em></a></p></li>' . "\n";
        }
        $output .= '</ul></div></div>';
        echo $output;
        memcache_madd($key, $output, 300);
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:28,代码来源:html1.php

示例9: UNIX_TIMESTAMP

    $sql = "SELECT post_id FROM posts WHERE {$from_time} ORDER BY post_date DESC LIMIT {$rows}";
    $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(post_date) FROM posts ORDER BY post_date DESC LIMIT 1");
    $title = _('Nótame') . ': ' . _('notas');
}
do_header($title);
$post = new Post();
if ($sql) {
    $posts = $db->get_col($sql);
}
if ($posts) {
    foreach ($posts as $post_id) {
        $post = Post::from_db($post_id);
        if (!$post) {
            continue;
        }
        $title = text_to_summary($post->clean_content(), 40);
        $title = $post->username . ': ' . htmlentities2unicodeentities($title);
        $content = htmlentities2unicodeentities(put_smileys($post->to_html($post->clean_content())));
        echo "\t<item>\n";
        echo "\t\t<title>{$title}</title>\n";
        echo "\t\t<link>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</link>\n";
        echo "\t\t<pubDate>" . date("r", $post->date) . "</pubDate>\n";
        echo "\t\t<dc:creator>{$post->username}</dc:creator>\n";
        echo "\t\t<guid>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</guid>\n";
        // Insert GEO
        if ($latlng = geo_latlng('user', $post->author)) {
            echo "\t\t<georss:point>{$latlng->lat} {$latlng->lng}</georss:point>\n";
        }
        echo "\t\t<description><![CDATA[{$content}";
        echo '</p><p>&#187;&nbsp;' . _('autor') . ': <strong>' . $post->username . '</strong></p>';
        echo "]]></description>\n";
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:31,代码来源:sneakme_rss2.php

示例10: intval

// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
$globals['force_ssl'] = False;
// We open the bar always as http to allow loading no https pages
include mnminclude . 'html1.php';
$url_args = $globals['path'];
$id = intval($globals['path'][1]);
if (!$id > 0 || !($link = Link::from_db($id))) {
    do_error(_('enlace no encontrado'), 404);
}
// Mark as read, add click if necessary
$link->add_click();
if ($globals['https'] && !preg_match('/^https:/', $link->url)) {
    redirect($link->url);
    die;
}
$link->title = text_to_summary($link->title, 80);
// From libs/html1.php do_header()
header('Content-Type: text/html; charset=utf-8');
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
// From libks/link.php print_summary()
$link->is_votable();
$link->permalink = $link->get_permalink();
$link->can_vote_negative = !$link->voted && $link->votes_enabled && $link->negatives_allowed(true);
$link->get_box_class();
$vars = compact('type');
$vars['self'] = $link;
$globals['extra_css'] = 'bar.css';
do_header($link->title, 'post');
Haanga::Load("link_bar.html", $vars);
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:31,代码来源:bar.php

示例11: send

 function send($link)
 {
     if (empty($this->url)) {
         return;
     }
     $this->title = clean_input_url($link->url);
     syslog(LOG_INFO, "Sending trackback " . $link->get_canonical_permalink());
     if (preg_match('/^ping:/', $this->url)) {
         // we got a pingback adress
         require_once mnminclude . 'IXR_Library.inc.php';
         $url = preg_replace('/^ping:/', '', $this->url);
         $client = new IXR_Client($url);
         $client->timeout = 3;
         $client->useragent .= ' -- Meneame/2';
         $client->debug = false;
         if ($client->query('pingback.ping', $link->get_canonical_permalink(), $this->link)) {
             $this->status = 'ok';
             $this->store();
             syslog(LOG_NOTICE, "Meneame, pingback sent: {$this->link}, {$this->url}");
             return true;
         } else {
             // Be quiet for pingbacks
             $this->status = 'error';
             $this->title = $client->getErrorMessage();
             $this->store();
             // syslog(LOG_NOTICE, "Meneame, out pingback error: $url ".$link->get_canonical_permalink().': '.$client->getErrorCode().' '.$client->getErrorMessage());
             return false;
         }
     }
     // Send standard old trackback
     $title = urlencode($link->title);
     // Convert everything to HTML and the strip all html tags.
     $excerpt = urlencode(text_to_summary($link->content, 250));
     $blog_name = urlencode(get_server_name());
     $tb_url = $this->url;
     $url = urlencode($link->get_canonical_permalink());
     $query_string = "charset=UTF-8&title={$title}&url={$url}&blog_name={$blog_name}&excerpt={$excerpt}";
     $trackback_url = parse_url($this->url);
     $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?' . $trackback_url['query'] : '') . " HTTP/1.0\r\n";
     $http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
     $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' . "\r\n";
     $http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
     $http_request .= "User-Agent: MNM (http://meneame.net) ";
     $http_request .= "\r\n\r\n";
     $http_request .= $query_string;
     if (empty($trackback_url['port'])) {
         $trackback_url['port'] = 80;
     }
     $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 5);
     if ($fs && ($res = @fputs($fs, $http_request))) {
         /*********** DEBUG *********
         			$debug_file = '/tmp/trackback.log';
         			$fp = fopen($debug_file, 'a');
         			fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n");
         			while(!@feof($fs)) {
         				fwrite($fp, @fgets($fs, 4096));
         			}
         			fwrite($fp, "\n\n");
         			fclose($fp);
         		/*********** DEBUG ************/
         @fclose($fs);
         $this->status = 'ok';
         $this->store();
         syslog(LOG_NOTICE, "Meneame, trackback sent: {$this->link}, {$this->url}");
         return true;
     }
     $this->status = 'error';
     $this->store();
     return false;
 }
开发者ID:GallardoAlba,项目名称:Meneame,代码行数:70,代码来源:trackback.php

示例12: Link

$link = new Link();
$link->id = $comment->link;
$link->read();
$globals['link'] = $link;
// Change to a min_value is times is changed for the current link_status
if ($globals['time_enabled_comments_status'][$link->status]) {
    $globals['time_enabled_comments'] = min($globals['time_enabled_comments_status'][$link->status], $globals['time_enabled_comments']);
}
// Check for comment post
if ($_POST['process'] == 'newcomment') {
    $new = new Comment();
    $new_comment_error = $new->save_from_post($link);
}
$username = $comment->type == 'admin' ? 'admin' : $comment->username;
$globals['search_options'] = array('w' => 'comments', 'u' => $comment->username);
$globals['description'] = _('Autor') . ": {$username}, " . _('Resumen') . ': ' . text_to_summary($comment->content, 250);
do_header(sprintf(_('comentario de %s'), $username) . ' (' . $comment->id . ') | ' . _('menéame'));
//do_subheader(_('comentario de') . ' ' . $username);
/*** SIDEBAR ****/
echo '<div id="sidebar">';
do_banner_right();
//do_best_stories();
//do_best_comments();
do_banner_promotions();
echo '</div>' . "\n";
/*** END SIDEBAR ***/
echo '<div id="newswrap">' . "\n";
echo '<h3 style="text-shadow: 0 1px #ccc"><a href="' . $link->get_permalink() . '">' . $link->title . '</a></h3>';
echo '<ol class="comments-list">';
echo '<li>';
$comment->print_summary($link, 10000, true);
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comment.php

示例13: print_summary

 function print_summary($type = 'full', $karma_best_comment = 0)
 {
     global $current_user, $current_user, $globals, $db;
     if (!$this->read) {
         return;
     }
     if ($this->is_votable()) {
         $this->voted = $this->vote_exists($current_user->user_id);
         if (!$this->voted) {
             $this->md5 = md5($current_user->user_id . $this->id . $this->randkey . $globals['user_ip']);
         }
     }
     $url = htmlspecialchars($this->url);
     echo '<div class="news-summary">';
     echo '<div class="news-body">';
     if ($type != 'preview' && !empty($this->title) && !empty($this->content)) {
         $this->print_shake_box($votes_enabled);
     }
     $this->print_warn();
     //if($globals['external_ads']) echo "<!-- google_ad_section_start -->\n";
     if ($this->status != 'published') {
         $nofollow = ' rel="nofollow"';
     } else {
         $nofollow = '';
     }
     echo '<h1>';
     echo '<a href="' . $url . '"' . $nofollow . '>' . $this->title . '</a>';
     // Content type (for video and images)
     if ($this->content_type == 'image') {
         echo '&nbsp;<img src="' . $globals['base_url'] . 'img/common/is-photo01.png" class="media-icon" width="18" height="15" alt="' . _('imagen') . '" title="' . _('imagen') . '" />';
     } elseif ($this->content_type == 'video') {
         echo '&nbsp;<img src="' . $globals['base_url'] . 'img/common/is-video01.png" class="media-icon" width="18" height="15" alt="' . _('vídeo') . '" title="' . _('vídeo') . '" />';
     }
     echo '</h1>';
     if (!$globals['bot']) {
         // GEO
         if ($this->latlng) {
             echo '<div class="thumbnail" id="map" style="width:130px;height:130px">&nbsp;</div>' . "\n";
         } elseif ($type == 'full' && $globals['do_websnapr'] && $this->votes_enabled && $globals['link_id'] > 0 && !empty($this->url_title)) {
             // Websnapr
             // In order not to overload websnapr, display the image only if votes are enabled
             echo '<img class="news-websnapr" alt="websnapr.com" src="http://images.websnapr.com/?size=T&amp;url=' . $url . '" width="92" height="70"  onmouseover="return tooltip.ajax_delayed(event, \'get_link_snap.php\', ' . $this->id . ');" onmouseout="tooltip.clear(event);" onclick="tooltip.clear(this);"/>';
         }
         echo '<div class="news-submitted">';
         if ($type != 'short') {
             echo '<a href="' . get_user_uri($this->username) . '"><img src="' . get_avatar_url($this->author, $this->avatar, 25) . '" width="25" height="25" alt="' . $this->username . '" onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $this->author . ');" onmouseout="tooltip.clear(event);" /></a>';
         }
         echo '<strong>' . htmlentities(preg_replace('/^https*:\\/\\//', '', txt_shorter($this->url))) . '</strong>' . "<br />\n";
         echo _('por') . ' <a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a> ';
         // Print dates
         if ($globals['now'] - $this->date > 604800) {
             // 7 days
             echo _('el') . get_date_time($this->sent_date);
             if ($this->status == 'published') {
                 echo ', ' . _('publicado el') . get_date_time($this->date);
             }
         } else {
             echo _('hace') . txt_time_diff($this->sent_date);
             if ($this->status == 'published') {
                 echo ', ' . _('publicado hace') . txt_time_diff($this->date);
             }
         }
         echo "</div>\n";
     }
     if ($type == 'full' || $type == 'preview') {
         echo '<p>' . text_to_html($this->content);
         if ($type != 'preview') {
             if ($this->is_editable()) {
                 echo '&nbsp;&nbsp;<a href="' . $globals['base_url'] . 'editlink.php?id=' . $this->id . '&amp;user=' . $current_user->user_id . '" title="' . _('editar noticia') . ' #' . $this->id . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>';
             }
             if ($this->geo && $this->is_map_editable()) {
                 echo '&nbsp;&nbsp;<a href="#" onclick="$(\'#geoedit\').load(\'' . $globals['base_url'] . "geo/get_form.php?id={$this->id}&amp;type=link&amp;icon={$this->status}" . '\'); return false;"><img src="' . $globals['base_url'] . 'img/common/edit-geo01.png" alt="edit" title="' . _('editar geolocalización') . '"/></a>';
             }
         }
         echo '</p>';
     }
     // Print a summary of the best comment
     if ($karma_best_comment > 0 && ($best_comment = $db->get_row("select comment_id, comment_order, comment_content from comments where comment_link_id = {$this->id} and comment_karma > {$karma_best_comment} order by comment_karma desc limit 1"))) {
         echo '<div style="font-size: 80%; border: 1px solid; border-color: #dadada; background: #fafafa; margin: 7px 50px 7px 25px; padding: 4px; overflow:hidden">';
         $link = $this->get_permalink() . get_comment_page_suffix($globals['comments_page_size'], $best_comment->comment_order, $this->comments) . '#comment-' . $best_comment->comment_order;
         echo '<a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \'' . $best_comment->comment_id . '\', 10000);" href="' . $link . '"><strong>' . $best_comment->comment_order . '</strong></a>';
         echo ':&nbsp;' . text_to_summary($best_comment->comment_content, 200) . '</div>';
     }
     echo '<div class="news-details">';
     if ($this->comments > 0) {
         $comments_mess = $this->comments . ' ' . _('comentarios');
     } else {
         $comments_mess = _('sin comentarios');
     }
     echo '<span class="comments">&nbsp;<a href="' . $this->get_relative_permalink() . '">' . $comments_mess . '</a></span>';
     // If the user is authenticated, show favorite box
     if ($current_user->user_id > 0) {
         echo '<span class="tool"><a id="fav-' . $this->id . '" href="javascript:get_votes(\'get_favorite.php\',\'' . $current_user->user_id . '\',\'fav-' . $this->id . '\',0,\'' . $this->id . '\')">' . favorite_teaser($current_user->user_id, $this->id) . '</a></span>';
     }
     // Print meta and category
     echo ' <span class="tool">' . _('en') . ': ';
     echo '<a href="' . $globals['base_url'] . '?meta=' . $this->meta_uri . '" title="' . _('meta') . '">' . $this->meta_name . '</a>, ';
     echo '<a href="' . $globals['base_url'] . '?meta=' . $this->meta_uri . '&amp;category=' . $this->category . '" title="' . _('categoría') . '">' . $this->category_name . '</a>';
     echo '</span>';
     echo ' <span class="tool">karma: <span id="a-karma-' . $this->id . '">' . intval($this->karma) . '</span></span>';
//.........这里部分代码省略.........
开发者ID:brainsqueezer,项目名称:fffff,代码行数:101,代码来源:link.php

示例14: min

if ($globals['time_enabled_comments_status'][$link->status]) {
    $globals['time_enabled_comments'] = min($globals['time_enabled_comments_status'][$link->status], $globals['time_enabled_comments']);
}
// Check for comment post
if ($_POST['process'] == 'newcomment') {
    $new = new Comment();
    $new_comment_error = $new->save_from_post($link);
}
$username = $comment->type == 'admin' ? 'admin' : $comment->username;
if ($comment->type != 'admin') {
    $globals['search_options'] = array('w' => 'comments', 'u' => $comment->username);
}
$comment->check_visibility();
if (!$comment->hide_comment) {
    $description = text_to_summary($comment->content, 250);
    $title = text_to_summary($description, 117);
    $globals['description'] = _('Autor') . ": {$username}, " . _('Resumen') . ': ' . $description;
    if ($globals['media_public'] && $comment->media_size > 0) {
        $globals['thumbnail'] = Upload::get_url('comment', $comment->id, 0, $comment->media_date, $comment->media_mime);
    } elseif ($comment->avatar) {
        $globals['thumbnail'] = get_avatar_url($comment->author, $comment->avatar, 80);
    }
} else {
    $title = '';
    $globals['noindex'] = true;
}
// Canonical url
if (isset($globals['canonical_server_name']) && !empty($globals['canonical_server_name'])) {
    $canonical_server = $globals['canonical_server_name'];
} else {
    $canonical_server = $link->server_name;
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comment.php

示例15: text_sub_text

function text_sub_text($str, $length=70) {
	// Just in case, to maintain compatibility
	return text_to_summary($str, $length);
}
开发者ID:rasomu,项目名称:chuza,代码行数:4,代码来源:utils.php


注:本文中的text_to_summary函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。