本文整理汇总了PHP中truncate_string函数的典型用法代码示例。如果您正苦于以下问题:PHP truncate_string函数的具体用法?PHP truncate_string怎么用?PHP truncate_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了truncate_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getInfo
function getInfo()
{
//retrieve Data from the DB
$id = db_escape_string($_REQUEST['id']);
$result = db_query("SELECT title, link\n\t\t\t\tFROM ttrss_entries, ttrss_user_entries\n\t\t\t\tWHERE id = '{$id}' AND ref_id = id AND owner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) != 0) {
$title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')), 100, '...');
$article_link = db_fetch_result($result, 0, 'link');
}
$consumer_key = $this->host->get($this, "pocket_consumer_key");
$pocket_access_token = $this->host->get($this, "pocket_access_token");
//Call Pocket API
if (function_exists('curl_init')) {
$postfields = array('consumer_key' => $consumer_key, 'access_token' => $pocket_access_token, 'url' => $article_link, 'title' => $title);
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, 'https://getpocket.com/v3/add');
curl_setopt($cURL, CURLOPT_HEADER, 1);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded;charset=UTF-8'));
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_TIMEOUT, 5);
curl_setopt($cURL, CURLOPT_POST, 4);
curl_setopt($cURL, CURLOPT_POSTFIELDS, http_build_query($postfields));
$apicall = curl_exec($cURL);
curl_close($cURL);
//Store error code in $status
$status = preg_match('/^X-Error: .*$/m', $apicall, $matches) ? $matches[0] : 1;
} else {
$status = 'For the plugin to work you need to <strong>enable PHP extension CURL</strong>!';
}
//Return information on article and status
print json_encode(array("title" => $title, "link" => $article_link, "id" => $id, "status" => $status));
}
开发者ID:Arthaey,项目名称:oneclickpocket,代码行数:32,代码来源:init.php
示例2: memberlist_view_profile
/**
* Display zodiac on viewing user profile
*
* @param object $event The event object
* @return null
* @access public
*/
public function memberlist_view_profile($event)
{
$user_id = $event['member']['user_id'];
$this->user->add_lang_ext('rmcgirr83/topicsbyuser', 'common');
// get all topics started by the user and make sure they are visible
$sql = 'SELECT t.*, p.post_visibility
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
WHERE t.topic_poster = ' . $user_id . '
ORDER BY t.topic_time ASC';
$result = $this->db->sql_query($sql);
$count = 0;
$topic_options = '<option value="">' . $this->user->lang['CHOOSE_A_TOPIC'] . '</option>';
while ($row = $this->db->sql_fetchrow($result)) {
if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
continue;
}
++$count;
$topic_color = $row['post_visibility'] != ITEM_APPROVED ? 'class="error"' : '';
$topic_options .= '<option value="' . append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']) . '" ' . $topic_color . '> ' . truncate_string($row['topic_title'], 30, 255, false, $this->user->lang['ELLIPSIS']) . '</option>';
}
$this->db->sql_freeresult($result);
if (!empty($count)) {
$this->template->assign_vars(array('HAS_TOPICS' => true, 'S_TOPIC_OPTIONS' => $topic_options));
}
}
开发者ID:rmcgirr83,项目名称:phpBB-3.1-topicsbyuser,代码行数:36,代码来源:listener.php
示例3: filter_test
function filter_test($filter_type, $reg_exp, $action_id, $action_param, $filter_param, $inverse, $feed_id, $cat_id, $cat_filter)
{
$result = db_query($this->link, "SELECT name FROM ttrss_filter_types WHERE\n\t\t\tid = " . $filter_type);
$type_name = db_fetch_result($result, 0, "name");
$result = db_query($this->link, "SELECT name FROM ttrss_filter_actions WHERE\n\t\t\tid = " . $action_id);
$action_name = db_fetch_result($result, 0, "name");
$filter["reg_exp"] = $reg_exp;
$filter["action"] = $action_name;
$filter["type"] = $type_name;
$filter["action_param"] = $action_param;
$filter["filter_param"] = $filter_param;
$filter["inverse"] = $inverse;
$filters[$type_name] = array($filter);
if ($feed_id) {
$feed = $feed_id;
} else {
$feed = -4;
}
$regexp_valid = preg_match('/' . $filter['reg_exp'] . '/', $filter['reg_exp']) !== FALSE;
print __("Articles matching this filter:");
print "<div class=\"filterTestHolder\">";
print "<table width=\"100%\" cellspacing=\"0\" id=\"prefErrorFeedList\">";
if ($regexp_valid) {
$feed_title = getFeedTitle($this->link, $feed);
$qfh_ret = queryFeedHeadlines($this->link, $cat_filter ? $cat_id : $feed, 30, "", $cat_filter, false, false, false, "date_entered DESC", 0, $_SESSION["uid"], $filter);
$result = $qfh_ret[0];
$articles = array();
$found = 0;
while ($line = db_fetch_assoc($result)) {
$entry_timestamp = strtotime($line["updated"]);
$entry_tags = get_article_tags($this->link, $line["id"], $_SESSION["uid"]);
$content_preview = truncate_string(strip_tags($line["content_preview"]), 100, '...');
if ($line["feed_title"]) {
$feed_title = $line["feed_title"];
}
print "<tr>";
print "<td width='5%' align='center'><input\n\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" checked=\"1\"\n\t\t\t\t\tdisabled=\"1\" type=\"checkbox\"></td>";
print "<td>";
print $line["title"];
print " (";
print "<b>" . $feed_title . "</b>";
print "): ";
print "<span class=\"insensitive\">" . $content_preview . "</span>";
print " " . mb_substr($line["date_entered"], 0, 16);
print "</td></tr>";
$found++;
}
if ($found == 0) {
print "<tr><td align='center'>" . __("No articles matching this filter has been found.") . "</td></tr>";
}
} else {
print "<tr><td align='center' class='error'>" . __("Invalid regular expression.") . "</td></tr>";
}
print "</table>";
print "</div>";
}
开发者ID:4iji,项目名称:Tiny-Tiny-RSS,代码行数:56,代码来源:pref_filters.php
示例4: getInfo
function getInfo()
{
$id = db_escape_string($_REQUEST['id']);
$result = db_query($this->link, "SELECT title, link\n\t\t\t\tFROM ttrss_entries, ttrss_user_entries\n\t\t\t\tWHERE id = '{$id}' AND ref_id = id AND owner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) != 0) {
$title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')), 100, '...');
$article_link = db_fetch_result($result, 0, 'link');
}
print json_encode(array("title" => $title, "link" => $article_link, "id" => $id));
}
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:10,代码来源:init.php
示例5: getShaarli
function getShaarli()
{
$id = db_escape_string($_REQUEST['id']);
$result = $this->dbh->query("SELECT title, link\n FROM ttrss_entries, ttrss_user_entries\n WHERE id = '{$id}' AND ref_id = id AND owner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) != 0) {
$title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')), 100, '...');
$article_link = db_fetch_result($result, 0, 'link');
}
$shaarli_url = $this->host->get($this, "shaarli");
print json_encode(array("title" => $title, "link" => $article_link, "id" => $id, "shaarli_url" => $shaarli_url));
}
开发者ID:GregThib,项目名称:tt-rss-shaarli,代码行数:11,代码来源:init.php
示例6: seo_create_meta_keywords
function seo_create_meta_keywords($str, $length = 200)
{
// Strip HTML and Truncate to create a META keywords, Google doesn't care about META tags.
$exclude = array('description', 'save', 'month', 'year', 'hundreds', 'dollars', 'per', "a", "ii", "about", "above", "according", "across", "39", "actually", "ad", "adj", "ae", "af", "after", "afterwards", "ag", "again", "against", "ai", "al", "all", "almost", "alone", "along", "already", "also", "although", "always", "am", "among", "amongst", "an", "and", "another", "any", "anyhow", "anyone", "anything", "anywhere", "ao", "aq", "ar", "are", "aren", "aren't", "around", "arpa", "as", "at", "au", "aw", "az", "b", "ba", "bb", "bd", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "begin", "beginning", "behind", "being", "below", "beside", "besides", "between", "beyond", "bf", "bg", "bh", "bi", "billion", "bj", "bm", "bn", "bo", "both", "br", "bs", "bt", "but", "buy", "bv", "bw", "by", "bz", "c", "ca", "can", "can't", "cannot", "caption", "cc", "cd", "cf", "cg", "ch", "ci", "ck", "cl", "click", "cm", "cn", "co", "co.", "com", "copy", "could", "couldn", "couldn't", "cr", "cs", "cu", "cv", "cx", "cy", "cz", "d", "de", "did", "didn", "didn't", "dj", "dk", "dm", "do", "does", "doesn", "doesn't", "don", "don't", "down", "during", "dz", "e", "each", "ec", "edu", "ee", "eg", "eh", "eight", "eighty", "either", "else", "elsewhere", "end", "ending", "enough", "er", "es", "et", "etc", "even", "ever", "every", "everyone", "everything", "everywhere", "except", "f", "few", "fi", "fifty", "find", "first", "five", "fj", "fk", "fm", "fo", "for", "former", "formerly", "forty", "found", "four", "fr", "free", "from", "further", "fx", "g", "ga", "gb", "gd", "ge", "get", "gf", "gg", "gh", "gi", "gl", "gm", "gmt", "gn", "go", "gov", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "h", "had", "has", "hasn", "hasn't", "have", "haven", "haven't", "he", "he'd", "he'll", "he's", "help", "hence", "her", "here", "here's", "hereafter", "hereby", "herein", "hereupon", "hers", "herself", "him", "himself", "his", "hk", "hm", "hn", "home", "homepage", "how", "however", "hr", "ht", "htm", "html", "http", "hu", "hundred", "i", "i'd", "i'll", "i'm", "i've", "i.e.", "id", "ie", "if", "il", "im", "in", "inc", "inc.", "indeed", "information", "instead", "int", "into", "io", "iq", "ir", "is", "isn", "isn't", "it", "it's", "its", "itself", "j", "je", "jm", "jo", "join", "jp", "k", "ke", "kg", "kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "l", "la", "last", "later", "latter", "lb", "lc", "least", "less", "let", "let's", "li", "like", "likely", "lk", "ll", "lr", "ls", "lt", "ltd", "lu", "lv", "ly", "m", "ma", "made", "make", "makes", "many", "maybe", "mc", "md", "me", "meantime", "meanwhile", "mg", "mh", "microsoft", "might", "mil", "million", "miss", "mk", "ml", "mm", "mn", "mo", "more", "moreover", "most", "mostly", "mp", "mq", "mr", "mrs", "ms", "msie", "mt", "mu", "much", "must", "mv", "mw", "mx", "my", "myself", "mz", "n", "na", "namely", "nc", "ne", "neither", "net", "netscape", "never", "nevertheless", "new", "next", "nf", "ng", "ni", "nine", "ninety", "nl", "no", "nobody", "none", "nonetheless", "noone", "nor", "not", "nothing", "now", "nowhere", "np", "nr", "nu", "nz", "o", "of", "off", "often", "om", "on", "once", "one", "one's", "only", "onto", "or", "org", "other", "others", "otherwise", "our", "ours", "ourselves", "out", "over", "overall", "own", "p", "pa", "page", "pe", "per", "perhaps", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "pt", "pw", "py", "q", "qa", "r", "rather", "re", "recent", "recently", "reserved", "ring", "ro", "ru", "rw", "s", "sa", "same", "sb", "sc", "sd", "se", "seem", "seemed", "seeming", "seems", "seven", "seventy", "several", "sg", "sh", "she", "she'd", "she'll", "she's", "should", "shouldn", "shouldn't", "si", "since", "site", "six", "sixty", "sj", "sk", "sl", "sm", "sn", "so", "some", "somehow", "someone", "something", "sometime", "sometimes", "somewhere", "sr", "st", "still", "stop", "su", "such", "sv", "sy", "sz", "t", "taking", "tc", "td", "ten", "text", "tf", "tg", "test", "th", "than", "that", "that'll", "that's", "the", "their", "them", "themselves", "then", "thence", "there", "there'll", "there's", "thereafter", "thereby", "therefore", "therein", "thereupon", "these", "they", "they'd", "they'll", "they're", "they've", "thirty", "this", "those", "though", "thousand", "three", "through", "throughout", "thru", "thus", "tj", "tk", "tm", "tn", "to", "together", "too", "toward", "towards", "tp", "tr", "trillion", "tt", "tv", "tw", "twenty", "two", "tz", "u", "ua", "ug", "uk", "um", "under", "unless", "unlike", "unlikely", "until", "up", "upon", "us", "use", "used", "using", "uy", "uz", "v", "va", "vc", "ve", "very", "vg", "vi", "via", "vn", "vu", "w", "was", "wasn", "wasn't", "we", "we'd", "we'll", "we're", "we've", "web", "webpage", "website", "welcome", "well", "were", "weren", "weren't", "wf", "what", "what'll", "what's", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "wherein", "whereupon", "wherever", "whether", "which", "while", "whither", "who", "who'd", "who'll", "who's", "whoever", "NULL", "whole", "whom", "whomever", "whose", "why", "will", "with", "within", "without", "won", "won't", "would", "wouldn", "wouldn't", "ws", "www", "x", "y", "ye", "yes", "yet", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves", "yt", "yu", "z", "za", "zm", "zr", "10", "z");
$splitstr = @explode(" ", truncate_string(seo_simple_strip_tags(str_replace(array(",", "."), " ", $str)), $length));
$new_splitstr = array();
foreach ($splitstr as $spstr) {
if (strlen($spstr) > 2 && !in_array(strtolower($spstr), $new_splitstr) && !in_array(strtolower($spstr), $exclude)) {
$new_splitstr[] = strtolower($spstr);
}
}
return @implode(",", $new_splitstr);
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:13,代码来源:cms_seo.class.php
示例7: seo_create_meta_keywords
function seo_create_meta_keywords($str, $length = 2000)
{
// Strip HTML and Truncate to create a META keywords, Google doesn't care about META tags.
$exclude = array('description', 'save', '$ave', 'month!', 'year!', 'hundreds', 'dollars', 'per', 'month', 'year', 'and', 'or', 'but', 'at', 'in', 'on', 'to', 'from', 'is', 'a', 'an', 'am', 'for', 'of', 'the');
$splitstr = @explode(" ", truncate_string(seo_simple_strip_tags(str_replace(array(",", "."), " ", $str)), $length));
$new_splitstr = array();
foreach ($splitstr as $spstr) {
if (strlen($spstr) > 2 && !in_array(strtolower($spstr), $new_splitstr) && !in_array(strtolower($spstr), $exclude)) {
$new_splitstr[] = strtolower($spstr);
}
}
return @implode(", ", $new_splitstr);
}
开发者ID:nstungxd,项目名称:F2CA5,代码行数:13,代码来源:seo.inc.php
示例8: zenphoto_recent_comments
function zenphoto_recent_comments()
{
////////////////////////////////////////////////////////////////////
/*------------------- START OF CONFIGURATION ---------------------*/
/*MySQL Settings*/
$zen_db = '';
//The name of the database
$zen_username = '';
//Your MySQL username
$zen_password = '';
//...and password
$zen_host = 'localhost';
//99% chance you won't need to change this value
$mysql_prefix = '';
//Zen Database Tables prefix (if any)
/*More...*/
$num_of_comments = '10';
//Number of comments you want to show up.
$mods_rewrite = true;
//If you have Apache mod_rewrite, put true here, and you'll get nice cruft-free URLs.
$gallery_folder = 'zenphoto';
//eg. http://mysite.com/zenphoto
/*--------------------- END OF CONFIGURATION ---------------------*/
////////////////////////////////////////////////////////////////////
//we will try to connect to the database
@($mysql_connection = mysql_connect($zen_host, $zen_username, $zen_password)) or die('Could not connect to database.');
//selecting zenphoto database
@mysql_select_db($zen_db) or die('Could not select database.');
$sql = "SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.website," . " c.date, c.comment FROM " . prefix('comments') . " AS c, " . prefix('images') . " AS i, " . prefix('albums') . " AS a " . " WHERE c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT 10";
$result = mysql_query($sql, $mysql_connection) or die('MySQL Query ( ' . $sql . ' ) Failed. Error: ' . mysql_error());
$allrows = array();
while ($row = mysql_fetch_assoc($result)) {
$allrows[] = $row;
}
foreach ($allrows as $comment) {
$author = $comment['name'];
$album = $comment['folder'];
$image = $comment['filename'];
$albumtitle = $comment['albumtitle'];
if ($comment['title'] == "") {
$title = $image;
} else {
$title = $comment['title'];
}
$website = $comment['website'];
$comment = truncate_string($comment['comment'], 123);
echo "<li><div>{$author} on <a href=\"" . ($mods_rewrite ? "../{$gallery_folder}/{$album}/{$image}" : "../{$gallery_folder}/index.php?album=" . urlencode($album) . "&image=" . urlencode($image)) . "\">{$albumtitle} / {$title}</a>:</div><div>{$comment}</div></li>";
}
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:49,代码来源:zen-recent-comments.php
示例9: dashboard_incoming_display
function dashboard_incoming_display($dashletid)
{
global $sit, $CONFIG, $iconset;
global $dbUpdates, $dbTempIncoming;
// extract updates (query copied from review_incoming_email.php)
$sql = "SELECT u.id AS id, u.bodytext AS bodytext, ti.emailfrom AS emailfrom, ti.subject AS subject, ";
$sql .= "u.timestamp AS timestamp, ti.incidentid AS incidentid, ti.id AS tempid, ti.locked AS locked, ";
$sql .= "ti.reason AS reason, ti.contactid AS contactid, ti.`from` AS fromaddr ";
$sql .= "FROM `{$dbUpdates}` AS u, `{$dbTempIncoming}` AS ti ";
$sql .= "WHERE u.incidentid = 0 AND ti.updateid = u.id ";
$sql .= "ORDER BY timestamp ASC, id ASC";
$result = mysql_query($sql);
if (mysql_error()) {
trigger_error(mysql_error(), E_USER_WARNING);
}
if (user_permission($sit[2], 42)) {
//echo "<div class='window'>";
if (mysql_num_rows($result) >= 1) {
echo "<table align='center' width='100%'>";
echo "<tr>";
# echo colheader('from', $GLOBALS['strFrom']);
echo colheader('subject', $GLOBALS['strSubject']);
echo colheader('message', $GLOBALS['strMessage']);
echo "</tr>\n";
$shade = 'shade1';
while ($incoming = mysql_fetch_object($result)) {
$date = mysql2date($incoming->date);
echo "<tr class='{$shade}'>";
# echo "<td><a href='holding_queue.php' class='info'>".truncate_string($incoming->emailfrom, 15);
# echo "</a></td>";
echo "<td><a href='holding_queue.php' class='info'>" . truncate_string($incoming->subject, 25);
echo "</a></td>";
echo "<td><a href='holding_queue.php' class='info'>" . truncate_string($incoming->reason, 25);
echo "</a></td>";
echo "</tr>\n";
if ($shade == 'shade1') {
$shade = 'shade2';
} else {
$shade = 'shade1';
}
}
echo "</table>\n";
} else {
echo "<p align='center'>{$GLOBALS['strNoRecords']}</p>";
}
} else {
echo "<p class='error'>{$GLOBALS['strPermissionDenied']}</p>";
}
}
开发者ID:sitracker,项目名称:sitracker_old,代码行数:49,代码来源:dashboard_incoming.php
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$inputs = Input::all();
$type = Message::getIntegerTypeBy($inputs['name']);
$to = $inputs['pk'];
$from = $inputs['sentby_id'];
$body = $inputs['value'];
$subject = truncate_string($body, 24, '...');
$msg = new Message();
$msg->from = $from;
$msg->to = $to;
$msg->type = $type;
$msg->subject = $subject;
$msg->body = $body;
$msg->save();
$data['status'] = 'success';
$data['message'] = 'Sent successfully';
return Response::json($data);
}
开发者ID:sliekasirdis79,项目名称:POS,代码行数:24,代码来源:MessageController.php
示例11: makeArticle
function makeArticle($class, $text)
{
global $unique;
$unique++;
$i = strpos($text, '</a>');
$j = strpos($text, '</h4>');
$h4 = substr($text, $i + 4, $j - $i - 4);
$text = substr($text, $j + 5);
$text = str_replace('<hr />', '', $text);
$text = str_replace('<hr/>', '', $text);
$ts_news = new ZenpageNews(seoFriendly($class . '_' . trim(truncate_string(strip_tags($h4), 30, '')) . '_' . $unique), true);
$ts_news->setShow(0);
$ts_news->setDateTime(date('Y-m-d H:i:s'));
$ts_news->setAuthor('TSGenerator');
$ts_news->setTitle($h4);
$ts_news->setContent($text);
$ts_news->setCategories(array());
$ts_news->setCategories(array('troubleshooting', 'troubleshooting-' . $class));
$ts_news->save();
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:20,代码来源:createTSarticles.php
示例12: getInfo
function getInfo()
{
$id = db_escape_string($_REQUEST['id']);
$result = db_query("SELECT title, link\r\n\t\t\t\tFROM ttrss_entries, ttrss_user_entries\r\n\t\t\t\tWHERE id = '{$id}' AND ref_id = id AND owner_uid = " . $_SESSION['uid']);
if (db_num_rows($result) != 0) {
$title = truncate_string(strip_tags(db_fetch_result($result, 0, 'title')), 100, '...');
$article_link = db_fetch_result($result, 0, 'link');
}
$yourls_url = $this->host->get($this, "Yourls_URL");
$yourls_api = $this->host->get($this, "Yourls_API");
curl_setopt($curl_yourls, CURLOPT_URL, "{$yourls_url}/yourls-api.php?signature={$yourls_api}&action=shorturl&format=simple&url=" . urlencode($article_link) . "&title=" . urlencode($title));
curl_setopt($curl_yourls, CURLOPT_RETURNTRANSFER, true);
if (!ini_get('safe_mode') && !ini_get('open_basedir')) {
curl_setopt($curl_yourls, CURLOPT_FOLLOWLOCATION, true);
}
$short_url = curl_exec($curl_yourls);
curl_setopt($this->curl_yourls, CURLOPT_URL, "{$yourls_url}/yourls-api.php?signature={$yourls_api}&action=shorturl&format=simple&url=" . urlencode($article_link) . "&title=" . urlencode($title));
$short_url = curl_exec($this->curl_yourls);
print json_encode(array("title" => $title, "link" => $article_link, "id" => $id, "yourlsurl" => $yourls_url, "yourlsapi" => $yourls_api, "shorturl" => $short_url));
}
开发者ID:Gabbalo,项目名称:tt-rss-yourls,代码行数:20,代码来源:init.php
示例13: gettext
?>
" title="<?php
echo gettext('View album:');
?>
<?php
printBareAlbumTitle();
?>
"><?php
printAlbumTitle();
?>
</a></h3>
<?php
printAlbumDate("");
?>
<p><?php
echo truncate_string(getAlbumDesc(), 45);
?>
</p>
</div>
</div>
<?php
}
?>
</div>
<?php
}
?>
<?php
if (getNumImages() > 0) {
?>
<div id="images">
开发者ID:jmruas,项目名称:zenphoto,代码行数:31,代码来源:search.php
示例14: submit_pm
/**
* Submit PM
*/
function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
{
global $db, $auth, $config, $phpEx, $template, $user, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $request;
// We do not handle erasing pms here
if ($mode == 'delete') {
return false;
}
$current_time = time();
/**
* Get all parts of the PM that are to be submited to the DB.
*
* @event core.submit_pm_before
* @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit
* @var string subject Subject of the private message
* @var array data The whole row data of the PM.
* @since 3.1.0-b3
*/
$vars = array('mode', 'subject', 'data');
extract($phpbb_dispatcher->trigger_event('core.submit_pm_before', compact($vars)));
// Collect some basic information about which tables and which rows to update/insert
$sql_data = array();
$root_level = 0;
// Recipient Information
$recipients = $to = $bcc = array();
if ($mode != 'edit') {
// Build Recipient List
// u|g => array($user_id => 'to'|'bcc')
$_types = array('u', 'g');
foreach ($_types as $ug_type) {
if (isset($data['address_list'][$ug_type]) && sizeof($data['address_list'][$ug_type])) {
foreach ($data['address_list'][$ug_type] as $id => $field) {
$id = (int) $id;
// Do not rely on the address list being "valid"
if (!$id || $ug_type == 'u' && $id == ANONYMOUS) {
continue;
}
$field = $field == 'to' ? 'to' : 'bcc';
if ($ug_type == 'u') {
$recipients[$id] = $field;
}
${$field}[] = $ug_type . '_' . $id;
}
}
}
if (isset($data['address_list']['g']) && sizeof($data['address_list']['g'])) {
// We need to check the PM status of group members (do they want to receive PM's?)
// Only check if not a moderator or admin, since they are allowed to override this user setting
$sql_allow_pm = !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_') ? ' AND u.user_allow_pm = 1' : '';
$sql = 'SELECT u.user_type, ug.group_id, ug.user_id
FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug
WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data['address_list']['g'])) . '
AND ug.user_pending = 0
AND u.user_id = ug.user_id
AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . $sql_allow_pm;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$field = $data['address_list']['g'][$row['group_id']] == 'to' ? 'to' : 'bcc';
$recipients[$row['user_id']] = $field;
}
$db->sql_freeresult($result);
}
if (!sizeof($recipients)) {
trigger_error('NO_RECIPIENT');
}
}
// First of all make sure the subject are having the correct length.
$subject = truncate_string($subject);
$db->sql_transaction('begin');
$sql = '';
switch ($mode) {
case 'reply':
case 'quote':
$root_level = $data['reply_from_root_level'] ? $data['reply_from_root_level'] : $data['reply_from_msg_id'];
// Set message_replied switch for this user
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . '
SET pm_replied = 1
WHERE user_id = ' . $data['from_user_id'] . '
AND msg_id = ' . $data['reply_from_msg_id'];
// no break
// no break
case 'forward':
case 'post':
case 'quotepost':
$sql_data = array('root_level' => $root_level, 'author_id' => $data['from_user_id'], 'icon_id' => $data['icon_id'], 'author_ip' => $data['from_user_ip'], 'message_time' => $current_time, 'enable_bbcode' => $data['enable_bbcode'], 'enable_smilies' => $data['enable_smilies'], 'enable_magic_url' => $data['enable_urls'], 'enable_sig' => $data['enable_sig'], 'message_subject' => $subject, 'message_text' => $data['message'], 'message_attachment' => !empty($data['attachment_data']) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid'], 'to_address' => implode(':', $to), 'bcc_address' => implode(':', $bcc), 'message_reported' => 0);
break;
case 'edit':
$sql_data = array('icon_id' => $data['icon_id'], 'message_edit_time' => $current_time, 'enable_bbcode' => $data['enable_bbcode'], 'enable_smilies' => $data['enable_smilies'], 'enable_magic_url' => $data['enable_urls'], 'enable_sig' => $data['enable_sig'], 'message_subject' => $subject, 'message_text' => $data['message'], 'message_attachment' => !empty($data['attachment_data']) ? 1 : 0, 'bbcode_bitfield' => $data['bbcode_bitfield'], 'bbcode_uid' => $data['bbcode_uid']);
break;
}
if (sizeof($sql_data)) {
$query = '';
if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') {
$db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data));
$data['msg_id'] = $db->sql_nextid();
} else {
if ($mode == 'edit') {
$sql = 'UPDATE ' . PRIVMSGS_TABLE . '
//.........这里部分代码省略.........
开发者ID:binano,项目名称:phpbb,代码行数:101,代码来源:functions_privmsgs.php
示例15: printZenpageStatistic
/**
* Prints the statistics Zenpage items as an unordered list
*
* @param int $number The number of news items to get
* @param string $option "all" pages and articles
* "news" for news articles
* "pages" for pages
* @param string $mode "popular" most viewed for pages, news articles and categories
* "mostrated" for news articles and pages
* "toprated" for news articles and pages
* "random" for pages, news articles and categories
* @param bool $showstats if the value should be shown
* @param bool $showtype if the type should be shown
* @param bool $showdate if the date should be shown (news articles and pages only)
* @param bool $showcontent if the content should be shown (news articles and pages only)
* @param bool $contentlength The shortened lenght of the content
* @param string $sortdir "asc" for ascending or "desc" for descending (default)
*/
function printZenpageStatistic($number = 10, $option = "all", $mode = "popular", $showstats = true, $showtype = true, $showdate = true, $showcontent = true, $contentlength = 40, $sortdir = 'desc')
{
$stats = getZenpageStatistic($number, $option, $mode);
$contentlength = sanitize_numeric($contentlength);
switch ($mode) {
case 'popular':
$cssid = "'zenpagemostpopular'";
break;
case 'mostrated':
$cssid = "'zenpagemostrated'";
break;
case 'toprated':
$cssid = "'zenpagetoprated'";
break;
case 'random':
$cssid = "'zenpagerandom'";
break;
}
echo "<ul id={$cssid}>";
foreach ($stats as $item) {
switch ($mode) {
case 'popular':
$statsvalue = $item['hitcounter'];
break;
case 'mostrated':
$statsvalue = $item['total_votes'];
break;
case 'toprated':
$statsvalue = $item['rating'];
break;
}
switch ($item['type']) {
case 'Page':
$titlelink = html_encode(getPageURL($item['titlelink']));
case 'News':
$titlelink = html_encode(getNewsURL($item['titlelink']));
break;
case 'Category':
$titlelink = html_encode(getNewsCategoryURL($item['titlelink']));
break;
}
echo '<li><a href = "' . $titlelink . '" title = "' . html_encode(getBare($item['title'])) . '"><h3>' . $item['title'];
echo '<small>';
if ($showtype) {
echo ' [' . $item['type'] . ']';
}
if ($showstats && ($item['type'] != 'Category' && $mode != 'mostrated' && $mode != 'toprated')) {
echo ' (' . $statsvalue . ')';
}
echo '</small>';
echo '</h3></a>';
if ($showdate && $item['type'] != 'Category') {
echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($item['date'])) . "</p>";
}
if ($showcontent && $item['type'] != 'Category') {
echo '<p>' . truncate_string($item['content'], $contentlength) . '</p>';
}
echo '</li>';
}
echo '</ul>';
}
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:79,代码来源:zenpage-template-functions.php
示例16: submit_post
/**
* Submit Post
* @todo Split up and create lightweight, simple API for this.
*/
function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true, $update_search_index = true)
{
global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;
/**
* Modify the data for post submitting
*
* @event core.modify_submit_post_data
* @var string mode Variable containing posting mode value
* @var string subject Variable containing post subject value
* @var string username Variable containing post author name
* @var int topic_type Variable containing topic type value
* @var array poll Array with the poll data for the post
* @var array data Array with the data for the post
* @var bool update_message Flag indicating if the post will be updated
* @var bool update_search_index Flag indicating if the search index will be updated
* @since 3.1.0-a4
*/
$vars = array('mode', 'subject', 'username', 'topic_type', 'poll', 'data', 'update_message', 'update_search_index');
extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact($vars)));
// We do not handle erasing posts here
if ($mode == 'delete') {
return false;
}
if (!empty($data['post_time'])) {
$current_time = $data['post_time'];
} else {
$current_time = time();
}
if ($mode == 'post') {
$post_mode = 'post';
$update_message = true;
} else {
if ($mode != 'edit') {
$post_mode = 'r
|
请发表评论