fixes #182 - don't ask^^
This commit is contained in:
parent
49ef188451
commit
b229b86658
@ -159,13 +159,12 @@ class FPDB_Query {
|
|||||||
var $secondary_idx = null;
|
var $secondary_idx = null;
|
||||||
|
|
||||||
var $walker = null;
|
var $walker = null;
|
||||||
|
|
||||||
var $prevkey = null;
|
var $prevkey = null;
|
||||||
|
|
||||||
var $nextkey = null;
|
var $nextkey = null;
|
||||||
|
|
||||||
var $comments = null;
|
var $comments = null;
|
||||||
|
|
||||||
|
|
||||||
function __construct($params, $ID) {
|
function __construct($params, $ID) {
|
||||||
global $current_query;
|
global $current_query;
|
||||||
@ -849,6 +848,13 @@ function smarty_block_entry($params, $content, &$smarty, &$repeat) {
|
|||||||
|
|
||||||
$smarty->assignByRef('id', $id);
|
$smarty->assignByRef('id', $id);
|
||||||
|
|
||||||
|
// If PostViews plugin is active: Trigger view counter!
|
||||||
|
// This seems a bit hackish; please fix if possible.
|
||||||
|
// See also commented line "// add_action('entry_block', 'plugin_postviews_do');" in plugin.postviews.php
|
||||||
|
if (function_exists('plugin_postviews_do')) {
|
||||||
|
plugin_postviews_do($smarty, $id);
|
||||||
|
}
|
||||||
|
|
||||||
if (array_key_exists('categories', $entry)) {
|
if (array_key_exists('categories', $entry)) {
|
||||||
$smarty->assign('entry_commslock', in_array('commslock', $entry ['categories']));
|
$smarty->assign('entry_commslock', in_array('commslock', $entry ['categories']));
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
* Author URI: https://www.flatpress.org
|
* Author URI: https://www.flatpress.org
|
||||||
* Description: Counts and displays entry views. Part of the standard distribution.
|
* Description: Counts and displays entry views. Part of the standard distribution.
|
||||||
*/
|
*/
|
||||||
add_action('entry_block', 'plugin_postviews_do');
|
|
||||||
|
// This seems a bit hackish; please fix if possible.
|
||||||
|
// The action hook seems to come "to late", the 'views' variable assignment in plugin_postviews_do() does not have effect on the (already parsed?) template.
|
||||||
|
// For now, smarty_block_entry() in core.fpdb.class.php takes care of calling plugin_postviews_do() early enough.
|
||||||
|
// add_action('entry_block', 'plugin_postviews_do');
|
||||||
|
|
||||||
function plugin_postviews_calc($id, $calc) {
|
function plugin_postviews_calc($id, $calc) {
|
||||||
$dir = entry_dir($id);
|
$dir = entry_dir($id);
|
||||||
@ -32,18 +36,17 @@ function plugin_postviews_calc($id, $calc) {
|
|||||||
$v++;
|
$v++;
|
||||||
io_write_file($f, $v);
|
io_write_file($f, $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $v;
|
return $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_postviews_do($id) {
|
function plugin_postviews_do($smarty, $id) {
|
||||||
global $fpdb, $smarty;
|
global $fpdb;
|
||||||
|
|
||||||
$q = $fpdb->getQuery();
|
$q = $fpdb->getQuery();
|
||||||
$calc = $q->single;
|
$calc = $q->single;
|
||||||
|
|
||||||
$v = plugin_postviews_calc($id, $calc);
|
$v = plugin_postviews_calc($id, $calc);
|
||||||
|
|
||||||
$smarty->assign('views', $v);
|
$smarty->assign('views', $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user