public function get_article_by_alias($var) { include "../db_connect.php"; $query = "SELECT * FROM articles WHERE `show`=1 AND `alias`='" . $var . "';"; $result = mysql_query($query); if ($result != NULL) { while ($r = mysql_fetch_array($result)) { $this->id = $r[0]; $this->title = $r[1]; $this->subtitle = $r[2]; $this->text = $r[3]; $this->date = $r[4]; $this->show = $r[5]; $this->author = $r[6]; $this->alias = $r[7]; $this->category = $r[8]; $tt = count_comments($r[7]); $this->comments = $tt; $this->keywords = $r[9]; $this->category_alias = $r[10]; $this->undefined = mysql_num_rows($result); } } mysql_close($link); }
/** * Count * * Usage: * {{ comments:count item_id="{{ page:id }} [module="pages"] [type="number"] }} * * @param array * @return array */ function count() { $item_id = $this->attribute('item_id', 0); $module = $this->attribute('module', $this->module); $type = $this->attribute('type', FALSE); $this->load->helper('comments/comments'); return count_comments($item_id, $module, $type); }
$post = &get_post($post_id); the_content(); $original = get_post_field('post_content', $post_id); $original = $post->post_content; $content = $original;
public function getCommentsCountAttribute() { return ($count = $this->comments->count()) ? $count . ' ' . count_comments($count) : null; }
<?php defined("CATALOG") or die("Access denied"); include 'main_controller.php'; include "models/{$view}_model.php"; $get_one_product = get_one_product($product_alias); if (!$get_one_product) { include VIEW . "404.php"; exit; } // получаем ID категории $id = $get_one_product['parent']; // ID товара $product_id = $get_one_product['id']; // кол-во комментариев $count_comments = count_comments($product_id); // получаем комментарии к товару $get_comments = get_comments($product_id); // строим дерево $comments_tree = map_tree($get_comments); // получаем HTML-код комментариев $comments = categories_to_string($comments_tree, 'comments_template.php'); include 'libs/breadcrumbs.php'; include VIEW . "{$view}.php";
function show_poll($id) // I - Poll ID { global $PHP_SELF, $POLL_TYPE_PICKONE, $POLL_TYPE_PICKMANY; $result = db_query("SELECT * FROM poll WHERE is_published = 1 AND id = $id"); if (db_count($result) == 1) { $row = db_next($result); $id = $row['id']; $question = htmlspecialchars($row['question']); print("<p><form method='POST' action='poll.php?v$row[id]'>" ."<b>$question</b>\n"); if ($row['poll_type'] == $POLL_TYPE_PICKONE) print("(please pick one)\n"); else print("(pick all that apply)\n"); for ($i = 0; $i < 10; $i ++) { $answer = htmlspecialchars($row["answer$i"]); if ($answer != "") { if ($row['poll_type'] == $POLL_TYPE_PICKONE) print("<br /><input type='radio' name='ANSWER'"); else print("<br /><input type='checkbox' name='ANSWER$i'"); print(" value='$i'/>$answer\n"); } } $votes = $row['votes']; if ($votes == 1) $votes .= " vote"; else $votes .= " votes"; $ccount = count_comments("poll.php_r$id"); if ($ccount == 1) $ccount .= " comment"; else $ccount .= " comments"; print("<br /><input type='submit' value='Vote'/>\n" ."[ <a href='poll.php?r$id'>Results</a> ]\n"); print("<br />($votes, $ccount)</form></p>\n"); } db_free($result); }
public function getCommentsCountHumansAttribute() { $count = (int) ($this->relationLoaded('commentsCount') ? $this->commentsCount : $this->comments->count()); return $count ? $count . ' ' . count_comments($count) : null; }
function // O - Number of comments count_comments($url, // I - URL for comment $parent_id = 0) // I - Parent comment { $result = db_query("SELECT * FROM comment WHERE " ."url = '" . db_escape($url) ."' " ."AND parent_id = $parent_id " ."ORDER BY id"); $num_comments = 0; while ($row = db_next($result)) { if ($row["status"] > 0) $num_comments ++; $num_comments += count_comments($url, $row['id']); } db_free($result); return ($num_comments); }
if (isset($lang_names)) { $smarty->assign_by_ref('lang_names', $lang_names); } if (isset($lang_codes)) { $smarty->assign_by_ref('lang_codes', $lang_codes); } $smarty->assign_by_ref('lang', $_SESSION['language']); # Load the gallery plugin if available if (!defined('_RGDS_ADMIN')) { $smarty->assign('gallery_plugin', $options->GetOption('gallery_plugin')); if ($options->GetOption('gallery_plugin')) { require PLUGIN_PATH . $options->GetOption('gallery_plugin'); if (isset($_GET['id'])) { $gp = new GalleryPlugin(); $smarty->assign('media_count', $gp->media_count($_GET['id'])); $smarty->assign('media_link', $gp->media_link($_GET['id'])); } } } # Check for comments if (isset($_GET['id'])) { $smarty->assign('comment_count', count_comments($_GET['id'])); } # Display the appropriate template if ($module != 'gedcom_analyze' and $module != 'gedcom_process') { if (isset($_GET['print']) and $_GET['print'] == strtolower('y')) { $smarty->display('index_printable.tpl'); } else { $smarty->display('index.tpl'); } }
//this will ADD the COMMENT and will send echo add_comment($_SESSION['update_authority'], $blogs['id']); echo '</span></p>'; //closes content div echo '<hr /></div>'; //this will post the older comments (HEADING) if ($value == 2) { echo '<div class= "content"><h3>Older Posts</h3>'; } $value++; } else { echo '<div class= "olderposts"><h3><a href= "index.php?index=4&page=' . $blogs['id'] . '">' . $blogs['page_name'] . '</a></h3>'; //AUTHOR and DATE echo author_date($blogs['date'], $blogs['author']); //Number of COMMENTS echo count_comments($blogs['id']); echo '<hr /></div>'; } } echo '<hr /></div>'; ?> <p><a href= "archive.php">ARCHIVE</a></p> </aside> <?php include '_includes/blog_nav.php'; ?> </section> <?php echo $indexfooter;
html_start_row(); $id = $row['id']; $link = "<a href='{$PHP_SELF}?L{$id}{$options}' alt='Article #{$id}'>"; print "<td nowrap>"; if ($LOGIN_LEVEL >= AUTH_DEVEL) { print "<input type='checkbox' name='ID_{$row['id']}'>"; } print "{$link}{$id}</a></td>"; $temp = htmlspecialchars($row['title']); if ($row['is_published'] == 0) { $temp .= " <img src='images/private.gif' width='16' height='16' " . "border='0' align='absmiddle' alt='Private'>"; } print "<td align='center' width='67%'>{$link}{$temp}</a></td>"; $temp = date("M d, Y", $row['modify_date']); print "<td align='center'>{$link}{$temp}</a></td>"; $ccount = count_comments("articles.php_L{$id}"); print "<td align='center'>{$link}{$ccount}</a></td>"; html_end_row(); html_start_row(); $temp = htmlspecialchars($row['abstract']); print "<td></td><td colspan='3'>{$temp}</td>"; html_end_row(); } html_end_table(); if ($LOGIN_LEVEL > 0) { print "<p>Published: "; select_is_published(); print "<input type='submit' value='Modify Selected Articles'></p>\n"; } if ($count > $PAGE_MAX) { print "<table border='0' cellspacing='0' cellpadding='0' " . "width='100%'>\n";
function count_interactions($pid) { $count = count_post_likes($pid) + count_post_dislikes($pid) + count_post_follows($pid) + count_comments($pid); return $count; }
<?php //Update count comment button require_once '../includes/functions.inc.php'; require_once '../includes/admin.inc.php'; if (isset($_POST['pid'])) { $pid = $_POST['pid']; print '<script type="text/javascript"> $("#comments_count_pid_' . $pid . '").html("' . count_comments($pid) . ' Comment' . (count_comments($pid) == 0 || count_comments($pid) == 1 ? '' : 's') . '"); </script>'; }
html_link("Add New Poll", "{$PHP_SELF}?n"); html_end_links(1); } else { // Only show published polls... $result = db_query("SELECT * FROM poll WHERE is_published = 1 " . "ORDER BY id DESC"); } print "<h1>Polls</h1>\n"; if (db_count($result) == 0) { print "<p>No polls found.</p>\n"; } else { html_start_table(array("ID", "Question::2")); while ($row = db_next($result)) { $id = $row['id']; $votes = $row['votes']; $question = htmlspecialchars($row['question']); $ccount = count_comments("poll.php_r{$id}"); if ($ccount == 1) { $ccount .= " comment"; } else { $ccount .= " comments"; } html_start_row(); print "<td align='center'>#{$row['id']}</td>" . "<td align='center' width='67%'>{$question}"; if (!$row['is_published']) { print " <img src='images/private.gif' width='16' height='16' " . "align='middle' alt='private'/>"; } print "</td><td nowrap><a href='{$PHP_SELF}?c{$id}'>Vote</a> | " . "<a href='{$PHP_SELF}?r{$id}'>Results</a>"; if ($LOGIN_LEVEL > AUTH_USER) { print " | <a href='{$PHP_SELF}?e{$id}'>Edit</a>"; } print " ({$votes} total votes, {$ccount})</td>";
// Add a new album $action_result = add_album($_POST['name'], $_POST['description'], $_POST['parent_collection']); break; } if (!empty($action_result['errors'])) { // If there are any errors from the actions above, display the errors for the user $output .= "\n\t" . '<p class="errors">' . $action_result['errors'] . '</p>' . "\n"; } elseif (!empty($action_result['output'])) { // Else if no errors, display the successful output $output .= "\n\t" . '<p class="success">' . $action_result['output'] . '</p>' . "\n"; } } if (!isset($edit_page)) { // Display the gallery statistics on the main page if ($level == 'collections') { $output .= "\n\t" . '<p class="stats"><strong>' . plog_tr('Gallery Stats:') . '</strong> ' . plog_tr('You have') . ' <strong>' . count_collections() . '</strong> ' . plog_tr('collections, which contain') . ' <strong>' . count_albums() . '</strong> ' . plog_tr('albums and') . ' <strong>' . count_pictures() . '</strong> ' . plog_tr('images. Users have posted') . ' <strong>' . count_comments() . '</strong> ' . plog_tr('comments to your gallery.') . '</p>' . "\n"; } // Here we will generate an 'add collection/album' header form if ($level == 'collections') { $output .= plog_add_collection_form(); } else { if ($level == 'albums') { $output .= plog_add_album_form($id); } } // Let's iterate through all the content and build a table // Set the default level if nothing is specified // Handle pagination // Let's determine the limit filter based on current page and number of results per page if (isset($_REQUEST['entries_per_page'])) { $_SESSION['entries_per_page'] = $_REQUEST['entries_per_page'];
<h2>Recent News</h2> <? $result = db_query("SELECT * FROM article WHERE is_published = 1 " ."ORDER BY modify_date DESC LIMIT 3"); $count = db_count($result); while ($row = db_next($result)) { $id = $row['id']; $title = htmlspecialchars($row['title']); $abstract = htmlspecialchars($row['abstract']); $date = date("H:i M d, Y", $row['modify_date']); $count = count_comments("articles.php_L$id"); if ($count == 1) $count .= " comment"; else $count .= " comments"; print("<p><a href='articles.php?L$id'>$title</a> - $abstract<br>\n" ."<span class='dateinfo'>$date, $count</span></p>\n"); } db_free($result); ?> </td></tr>
//$result; exit; return $result; } function grv_save_post($id) { //echo 'id'.$id; $wpPost = get_post($id); //print_r($wpPost); $feat_image = wp_get_attachment_url(get_post_thumbnail_id($wpPost->ID)); //echo $feat_image; //die(); $list = array(); $list = get_plugins_list($format, $show_inactive, $cache, $nofollow, $target); if ($wpPost->post_status != 'publish') { return; } if (get_option('icon_post') == '1') { $s = '<img src="' . plugins_url('img/logo.jpg', dirname(__FILE__)) . '" > '; } else { $s = ''; } if ($wpPost->post_status == 'publish') { $status = 1; } elseif ($wpPost->post_status == 'draft') { $status = 2; } elseif ($wpPost->post_status == 'trash') { $status = 3; } if (!($excerpt = trim($wpPost->post_excerpt))) { $excerpt = $wpPost->post_content; $excerpt = strip_shortcodes($excerpt); $excerpt = apply_filters('the_content', $excerpt); $excerpt = str_replace(']]>', ']]>', $excerpt); $excerpt = strip_tags($excerpt); $excerpt_length = apply_filters('excerpt_length', 55); $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); $words = preg_split("/[\n\r\t ]+/", $excerpt, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY); if (count($words) > $excerpt_length) { array_pop($words); $excerpt = implode(' ', $words); $excerpt = $excerpt . $excerpt_more; } else { $excerpt = implode(' ', $words); } } $post = $old_post; $excerpt1 = mb_convert_encoding($excerpt, "HTML-ENTITIES", 'UTF-8'); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpPost->post_content, $matches); echo '<pre>'; //print_r($matches); echo '</pre>'; $first_img = $matches[1][0]; echo 'first' . ($catch_image = $first_img); preg_match_all('/<a (.*)><img.+?src=(\'|")(.+?)(\'|")[^>]*><(.*\\/)*a>/', $wpPost->post_content, $matchesnew); $checkid = 1; foreach ($matchesnew[1] as $keysc) { $finalvalue = str_replace('href="', '', $keysc); $finalvalue1 = substr($finalvalue, 0, strlen($finalvalue) - 1); if (strpos($finalvalue1, URL) !== false) { $urlhreftrue = $finalvalue1 . '&&&' . $checkid; break; } else { $checkid++; } } //echo $urlhreftrue; $newurl = explode('&&&', $urlhreftrue); $newurl[1]; $checkid1 = 1; foreach ($matchesnew[3] as $keyimg) { if ($keyimg == $catch_image) { echo $checkvalue = '1'; } if ($checkvalue == '1') { if ($checkid1 == $newurl[1]) { $image = $keyimg; } } else { $image = $catch_image; } $checkid1++; } $postData = array('action' => 'save', 'id' => urlencode($id), 'title' => urlencode($wpPost->post_title), 'content' => urlencode($wpPost->post_content), 'posttype' => urlencode($wpPost->post_type), 'excerpt' => urlencode($excerpt1), 'slug' => urlencode($wpPost->post_name), 'link' => get_permalink($id), 'thumb' => wp_get_attachment_url(get_post_thumbnail_id($id), 'full'), 'created' => $wpPost->post_date, 'category' => serialize(grv_get_post_categories($id)), 'tags' => serialize(grv_get_post_tags($id)), 'comments' => serialize(grv_get_post_comments($id)), 'status' => $status, 'domain' => URL, 'plugins_list' => $list, 'linkwag_email' => get_option('linkwag_email'), 'unique_id' => get_option('linkwag_unique'), 'comment_count' => count_comments($id), 'look_number' => '0', 'rght' => '0', 'lft' => '0', 'quacks' => '0', 'sort_order' => '0', 'parent_id' => '0', 'feature_image' => $feat_image, 'image1' => $image); $post = curl_init(); curl_setopt($post, CURLOPT_URL, API); curl_setopt($post, CURLOPT_POST, true); curl_setopt($post, CURLOPT_POSTFIELDS, $postData); curl_setopt($post, CURLOPT_RETURNTRANSFER, true); curl_setopt($post, CURLOPT_HEADER, 1); $result = curl_exec($post); //print_r($result); curl_close($post); //echo $result;