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


PHP Link::get_permalink方法代码示例

本文整理汇总了PHP中Link::get_permalink方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::get_permalink方法的具体用法?PHP Link::get_permalink怎么用?PHP Link::get_permalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


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

示例1: check_already_sent

function check_already_sent()
{
    global $db;
    // Check if the url has been sent already
    if (!empty($_GET['url'])) {
        $linkres = new Link();
        if ($found = $linkres->duplicates($_GET['url'])) {
            $linkres->url = $db->escape($found);
            if ($linkres->read('url')) {
                header('Location: ' . $linkres->get_permalink());
                die;
            }
        }
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:15,代码来源:submit.php

示例2: check_already_sent

function check_already_sent()
{
    global $db;
    // Check if the url has been sent already
    if (!empty($_GET['url'])) {
        if ($found = Link::duplicates($_GET['url'])) {
            $link = new Link();
            $link->id = $found;
            if ($link->read()) {
                header('Location: ' . $link->get_permalink());
                die;
            }
        }
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:15,代码来源:submit.php

示例3: do_link_item

function do_link_item($sql)
{
    global $db;
    $link = new Link();
    $links = $db->get_col($sql);
    if ($links) {
        foreach ($links as $link_id) {
            $link->id = $link_id;
            $link->read();
            if ($_REQUEST['url'] == 'source') {
                $url = __($link->url);
            } else {
                $url = $link->get_permalink();
            }
            echo '<DT><A HREF="' . $url . '" REL="nofollow">' . $link->title . '</A>' . "\n";
        }
    }
}
开发者ID:manelio,项目名称:woolr,代码行数:18,代码来源:link_bookmark.php

示例4: do_header

$comment = new Comment;
$link = new Link;
$comments = $db->get_col($sql);
if ($comments) {
	foreach($comments as $comment_id) {
		$comment->id=$comment_id;
		$comment->read();
		$content = save_text_to_html($comment->content);
		echo "	<item>\n";
		$link_id = $link->id = $comment->link;
		$link->read();
		$link_title = $db->get_var("select link_title from links where link_id = $link_id");
		// Title must not carry htmlentities
		echo "		<title><![CDATA[".html_entity_decode($link_title)."]]></title>\n";
		echo "		<link>".$link->get_permalink()."#c-$comment_id</link>\n";
		echo "		<pubDate>".date("r", $comment->date)."</pubDate>\n";
		echo "		<dc:creator>$comment->username</dc:creator>\n";
		echo "		<guid>".$link->get_permalink()."#c-$comment_id</guid>\n";
		echo "		<description><![CDATA[<p>$content";
		echo '</p><p>&#187;&nbsp;'._('autor').': <strong>'.$comment->username.'</strong></p>';
		echo '<p><img src="http://'. get_server_name() .$globals['base_url'].'backend/votes_img.php?id='. $link_id .'" alt="votes" />';
		echo '&nbsp;<img src="http://'. get_server_name() .$globals['base_url'].'backend/comments_img.php?id='. $link_id .'" alt="comments" /></p>';
		echo "]]></description>\n";
		echo "	</item>\n\n";
	}
}

do_footer();

function do_header($title) {
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:30,代码来源:comments_rss2.php

示例5: count

// Get most voted link
$link_sqls[_('Más votada')] = "select vote_link_id as id, count(*) as n from sub_statuses, links, votes use index (vote_type_4) where id = " . SitesMgr::my_id() . " AND link_id = link AND link_status = 'published' AND vote_link_id = link AND vote_type='links' and vote_date > date_sub(now(), interval {$hours} hour) and vote_user_id > 0 and vote_value > 0 group by vote_link_id order by n desc limit 1";
// Most commented
$link_sqls[_('Más comentada')] = "select comment_link_id as id, count(*) as n from sub_statuses, comments use index (comment_date) where id = " . SitesMgr::my_id() . " AND sub_statuses.status in ('published', 'metapublished') AND comment_link_id = link AND comment_date > date_sub(now(), interval {$hours} hour) group by comment_link_id order by n desc limit 1";
if ($globals['click_counter'] && $hours > 20) {
    $link_sqls[_('Más leída')] = "select sub_statuses.link as id, counter as n from sub_statuses, link_clicks where sub_statuses.id = " . SitesMgr::my_id() . " AND sub_statuses.status in ('published', 'metapublished') AND date > date_sub(now(), interval {$hours} hour) and link_clicks.id = sub_statuses.link order by n desc limit 1";
}
foreach ($link_sqls as $key => $sql) {
    $res = $db->get_row($sql);
    if (!$res) {
        continue;
    }
    $link = new Link();
    $link->id = $res->id;
    if ($link->read()) {
        $url = $link->get_permalink();
        if ($globals['url_shortener']) {
            $short_url = $link->get_short_permalink();
        } else {
            //$short_url = fon_gs($link->get_permalink());
            $short_url = $url;
        }
        if ($hours < 72) {
            $intro = "{$key} {$hours}h";
        } else {
            $days = intval($hours / 24);
            $intro = "{$key} {$days}d";
        }
        $text = "{$intro}: {$link->title}";
        if ($globals['twitter_token']) {
            twitter_post($text, $url);
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:post_summaries.php

示例6: min

			// Do not allow annonimous users to give more karma than registered users
			if ($karma_new > 0) 
				$karma_new += min($karma_new, $karma_pos_ano + $karma_neg_ano);


			// Aged karma
			$diff = max(0, $now - ($link->date + 18*3600)); // 1 hour without decreasing
			$oldd = 1 - $diff/(3600*144);
			$oldd = max(0.5, $oldd);
			$oldd = min(1, $oldd);
			$aged_karma =  $karma_new * $oldd;
			$dblink->karma=$aged_karma;

			$max_karma_found = max($max_karma_found, $dblink->karma);
			if ( $dblink->karma > $past_karma * 0.5 ) {
				print "<tr><td>$link->id</td><td>".$link->votes."</td><td>".intval($dblink->karma)."</td><td><a href='".$link->get_permalink()."'>$link->title</a>\n";
				if (intval($link->karma) < intval($dblink->karma)) 
					printf ("<br>updated karma: %6d -> %-6d\n", $link->karma, $dblink->karma);
			}
			if (intval($link->karma) != intval($dblink->karma)) {
				$link->karma = $dblink->karma;
				$link->store();
			}
			//echo "$link->id:  $dblink->votes, $dblink->karma, '" . $link->title; echo "'\n";
			if ($max_karma_found == $dblink->karma)	{
				$best_title = $link->title;
				$best_url = $link->get_permalink();
			}
			
			if ($link->votes >= $min_votes && $dblink->karma >= $min_karma &&
				$dblink->karma > ($max_karma_found - 0.1) ) {
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:31,代码来源:promote3.php

示例7: do_header

do_header($title);
$comment = new Comment();
$link = new Link();
$comments = $db->get_col($sql);
if ($comments) {
    foreach ($comments as $comment_id) {
        $comment->id = $comment_id;
        $comment->read();
        $content = save_text_to_html($comment->content);
        echo "\t<item>\n";
        $link_id = $link->id = $comment->link;
        $link->read();
        $link_title = $db->get_var("select link_title from links where link_id = {$link_id}");
        // Title must not carry htmlentities
        echo "\t\t<title><![CDATA[" . html_entity_decode($link_title) . "]]></title>\n";
        echo "\t\t<link>" . $link->get_permalink() . "#comment-" . $comment->order . "</link>\n";
        echo "\t\t<pubDate>" . date("r", $comment->date) . "</pubDate>\n";
        echo "\t\t<dc:creator>{$comment->username}</dc:creator>\n";
        echo "\t\t<guid>" . $link->get_permalink() . "#comment-" . $comment->order . "</guid>\n";
        echo "\t\t<description><![CDATA[<p>{$content}";
        echo '</p><p>&#187;&nbsp;' . _('autor') . ': <strong>' . $comment->username . '</strong></p>';
        echo '<p><img src="http://' . get_server_name() . $globals['base_url'] . 'backend/vote_com_img.php?id=' . $link->id . '" alt="votes" width=200, height=16 /></p>';
        echo "]]></description>\n";
        echo "\t</item>\n\n";
    }
}
do_footer();
function do_header($title)
{
    global $last_modified, $dblang, $home, $globals;
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified) . ' GMT');
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:comments_rss2.php

示例8: intval

$blog_name = $_POST['blog_name'];
$charset = $_POST['charset'];
if (!empty($charset)) {
    $title = @iconv($charset, 'UTF-8//IGNORE', $title);
    $excerpt = @iconv($charset, 'UTF-8//IGNORE', $excerpt);
    $blog_name = @iconv($charset, 'UTF-8//IGNORE', $blog_name);
}
$tb_id = intval($_GET['id']);
$link = new Link();
$link->id = $tb_id;
if (!$tb_id > 0 || !$link->read()) {
    trackback_response(1, 'I really need an ID for this to work.');
}
if (empty($title) && empty($tb_url) && empty($blog_name)) {
    // If it doesn't look like a trackback at all...
    header('Location: ' . $link->get_permalink());
    exit;
}
if (!empty($tb_url) && !empty($title) && !empty($excerpt)) {
    header('Content-Type: text/xml; charset=UTF-8');
    $title = htmlspecialchars(strip_tags($title));
    $title = strlen($title) > 150 ? substr($title, 0, 150) . '...' : $title;
    $excerpt = strip_tags($excerpt);
    $excerpt = strlen($excerpt) > 200 ? substr($excerpt, 0, 200) . '...' : $excerpt;
    $trackres = new Trackback();
    $trackres->link = $tb_id;
    $trackres->type = 'in';
    $trackres->url = $tb_url;
    $dupe = $trackres->read();
    if ($dupe) {
        syslog(LOG_DEBUG, 'We already have a ping from that URI for this post.');
开发者ID:BackupTheBerlios,项目名称:meneamenet-svn,代码行数:31,代码来源:trackback.php

示例9: header

// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es> and
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// The code below was made by Beldar <beldar at gmail dot com>
if (!defined('mnmpath')) {
    include_once '../config.php';
    header('Content-Type: text/html; charset=utf-8');
    stats_increment('ajax');
}
if (empty($_GET['id'])) {
    die;
}
$id = intval($_GET['id']);
$link = new Link();
$link->id = $id;
$link->read();
if (!$link->read) {
    die;
}
echo '<div style="font-size:8.5pt;width:250px; margin-right:15px">';
if ($link->avatar) {
    echo '<img src="' . get_avatar_url($link->author, $link->avatar, 40) . '" width="40" height="40" alt="avatar"  style="float:left; margin: 0 5px 4px 0;"/>';
}
echo '<a href="' . $link->get_permalink() . '" target="_blank"><strong>' . $link->title . '</strong></a><br clear="all"/>';
echo $link->meta_name . ', ' . $link->category_name . ' | ' . _('comentarios') . ':&nbsp;' . $link->comments . ' | karma:&nbsp;' . intval($link->karma) . ' | ' . _('negativos') . ':&nbsp;' . $link->negatives;
echo '</div>';
开发者ID:brainsqueezer,项目名称:fffff,代码行数:30,代码来源:link.php

示例10: do_commented

function do_commented()
{
    global $db, $rows, $user, $offset, $page_size, $globals, $current_user;
    if ($globals['bot']) {
        return;
    }
    $link = new Link();
    $comment = new Comment();
    $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id={$user->id}");
    $comments = $db->get_results("SELECT comment_id, link_id, comment_type FROM comments, links WHERE comment_user_id={$user->id} and link_id=comment_link_id ORDER BY comment_date desc LIMIT {$offset},{$page_size}");
    if ($comments) {
        echo '<div class="bookmarks-export-user-stories">';
        echo '<a href="' . $globals['base_url'] . 'link_bookmark.php?user_id=' . $user->id . '&amp;option=commented" title="' . _('exportar bookmarks en formato Mozilla') . '" class="bookmarks-export-user-commented"><img src="' . $globals['base_url'] . 'img/common/bookmarks-export-01.png" alt="Mozilla bookmark"/></a>';
        echo '&nbsp;&nbsp;<a href="' . $globals['base_url'] . 'comments_rss2.php?user_id=' . $user->id . '" title="' . _('obtener comentarios en rss2') . '"><img src="' . $globals['base_url'] . 'img/common/rss-button01.png" alt="rss2"/></a>';
        echo '</div>';
        foreach ($comments as $dbcomment) {
            if ($dbcomment->comment_type == 'admin' && $current_user->user_level != 'god' && $current_user->user_level != 'admin') {
                continue;
            }
            $link->id = $dbcomment->link_id;
            $comment->id = $dbcomment->comment_id;
            if ($last_link != $link->id) {
                $link->read();
                echo '<h4>';
                echo '<a href="' . $link->get_permalink() . '">' . $link->title . '</a>';
                echo ' [' . $link->comments . ']';
                echo '</h4>';
                $last_link = $link->id;
            }
            $comment->read();
            echo '<ol class="comments-list">';
            $comment->print_summary($link, 2000, false);
            echo "</ol>\n";
        }
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:36,代码来源:user.php

示例11: intval

    array_shift($url_args);
    // The first element is always a "/"
    $link->uri = $db->escape($url_args[0]);
    if (!$link->read('uri')) {
        not_found();
    }
} else {
    $url_args = preg_split('/\\/+/', $_REQUEST['id']);
    $link->id = intval($url_args[0]);
    if (is_numeric($url_args[0]) && $link->read('id')) {
        // Redirect to the right URL if the link has a "semantic" uri
        if (!empty($link->uri) && !empty($globals['base_story_url'])) {
            if (!empty($url_args[1])) {
                $extra_url = '/' . $url_args[1];
            }
            header('Location: ' . $link->get_permalink() . $extra_url);
            die;
        }
    } else {
        not_found();
    }
}
/*
// Check if the browser sent if-modified-since and act accordingly
// Reverted: firefox get fooked
//           it shows the old page if the user just authenticated
$if_modified = get_if_modified();
if ($if_modified > 0 && $if_modified == $link->modified) {
	header("HTTP/1.1 304 Not Modified");
	exit;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:story.php

示例12: do_top

function do_top($string)
{
    require_once mnminclude . 'link.php';
    global $db, $globals;
    $rank = "*Top* ";
    $sql = "select link_id from links where link_date > date_sub(now(), interval 4 day) and link_status='queued' order by link_karma desc limit 2";
    $result = $db->get_results($sql);
    foreach ($result as $linkid) {
        $link = new Link();
        $link->id = $linkid->link_id;
        $link->read();
        $rank .= '<br/> ' . $link->get_permalink() . " ({$link->karma})";
    }
    return $rank;
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:15,代码来源:sneaker-stats.php

示例13: User

            log_insert('link_depublished', $link->link_id, $link->link_author);
            // Add the discard to log/event
            $user = new User();
            $user->id = $link->link_author;
            if ($user->read()) {
                $user->karma -= $globals['instant_karma_per_depublished'];
                echo "{$user->username}: {$user->karma}\n";
                $user->store();
                $annotation = new Annotation("karma-{$user->id}");
                $annotation->append(_('Retirada de portada') . ": -" . $globals['instant_karma_per_depublished'] . ", karma: {$user->karma}\n");
            }
            if ($globals['twitter_user'] || $globals['jaiku_user']) {
                if ($globals['url_shortener']) {
                    $short_url = $l->get_short_permalink();
                } else {
                    $short_url = fon_gs($l->get_permalink());
                }
                $text = _('Retirada de portada') . ': ';
                if ($globals['twitter_user'] && $globals['twitter_password']) {
                    twitter_post($text, $short_url);
                }
                if ($globals['jaiku_user'] && $globals['jaiku_key']) {
                    jaiku_post($text, $short_url);
                }
            }
        }
    }
}
punish_comments();
// Discard links
$negatives = $db->get_results("select SQL_NO_CACHE link_id, link_karma, link_votes, link_negatives, link_author from links where link_date > {$min_date} and link_status = 'queued' and link_karma < 0 and (link_date < {$max_date} or link_karma < -100) and (link_karma < -link_votes*2 or (link_negatives > 20 and link_negatives > link_votes/2)) and (link_negatives > 20 or (link_negatives > 4 and link_negatives > link_votes) )");
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:discard3.php

示例14: do_commented

function do_commented()
{
    global $db, $rows, $user, $offset, $page_size;
    $link = new Link();
    $comment = new Comment();
    echo '<h2>' . _('comentarios') . '</h2><br />';
    $rows = $db->get_var("SELECT count(*) FROM comments WHERE comment_user_id={$user->id}");
    $comments = $db->get_results("SELECT comment_id, link_id FROM comments, links WHERE comment_user_id={$user->id} and link_id=comment_link_id ORDER BY comment_date desc LIMIT {$offset},{$page_size}");
    if ($comments) {
        foreach ($comments as $dbcomment) {
            $link->id = $dbcomment->link_id;
            $comment->id = $dbcomment->comment_id;
            if ($last_link != $link->id) {
                $link->read();
                echo '<h4>';
                echo '<a href="' . $link->get_permalink() . '">' . $link->title . '</a>';
                echo ' [' . $link->comments . ']';
                echo '</h4>';
                $last_link = $link->id;
            }
            $comment->read();
            echo '<ol class="comments-list">';
            $comment->print_summary($link, 2000, false);
            echo "</ol>\n";
        }
    }
}
开发者ID:brainsqueezer,项目名称:fffff,代码行数:27,代码来源:user.php

示例15: Link

    }
    $sql = "SELECT link_id {$from_where} {$order_by} LIMIT {$rows}";
}
do_header($title);
$link = new Link();
$links = $db->get_col($sql);
if ($links) {
    foreach ($links as $link_id) {
        $link->id = $link_id;
        $link->read();
        $category_name = $db->get_var("SELECT category_name FROM categories WHERE category_id = {$link->category} AND category_lang='{$dblang}'");
        $content = text_to_html(htmlentities2unicodeentities($link->content));
        echo "\t<item>\n";
        // Title must not carry htmlentities
        echo "\t\t<title>" . htmlentities2unicodeentities($link->title) . "</title>\n";
        echo "\t\t<link>" . $link->get_permalink() . "</link>\n";
        echo "\t\t<comments>" . $link->get_permalink() . "</comments>\n";
        if (!empty($link_date)) {
            echo "\t\t<pubDate>" . date("r", $link->{$link_date}) . "</pubDate>\n";
        } else {
            echo "      <pubDate>" . date("r", $link->date) . "</pubDate>\n";
        }
        echo "\t\t<dc:creator>{$link->username}</dc:creator>\n";
        echo "\t\t<category><![CDATA[{$category_name}]]></category>\n";
        // Add tags as categories
        if (!empty($link->tags)) {
            $tags_array = explode(",", $link->tags);
            foreach ($tags_array as $tag_item) {
                $tag_item = trim($tag_item);
                echo "\t\t<category><![CDATA[" . $tag_item . "]]></category>\n";
            }
开发者ID:brainsqueezer,项目名称:fffff,代码行数:31,代码来源:rss2.php


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