summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2025-08-28 17:11:00 +0100
committerlsces <lester@lsces.co.uk>2025-08-28 17:11:00 +0100
commite71d1ad3b0d588a76226c736c4c37677ec0e9154 (patch)
tree3cf4d874c374e321ec0c04cab86dd8c8561145c6
parent2ecb574fb7906e9c7f5ac5ce8191cba106aa7d81 (diff)
downloadblogs-e71d1ad3b0d588a76226c736c4c37677ec0e9154.tar.gz
blogs-e71d1ad3b0d588a76226c736c4c37677ec0e9154.tar.bz2
blogs-e71d1ad3b0d588a76226c736c4c37677ec0e9154.zip
Modules code updated to PHP8.4 and namespace
-rwxr-xr-x[-rw-r--r--]modules/help_mod_last_blog_posts.tpl0
-rwxr-xr-x[-rw-r--r--]modules/help_mod_top_active_blogs.tpl0
-rwxr-xr-x[-rw-r--r--]modules/help_mod_top_visited_blogs.tpl0
-rwxr-xr-x[-rw-r--r--]modules/index.php0
-rwxr-xr-x[-rw-r--r--]modules/lastblogposts/config_inc.php44
-rwxr-xr-x[-rw-r--r--]modules/lastblogposts/mod_last_blog_posts.php18
-rwxr-xr-x[-rw-r--r--]modules/lastblogposts/mod_last_blog_posts.tpl0
-rwxr-xr-x[-rw-r--r--]modules/mod_blog_roll.php20
-rwxr-xr-x[-rw-r--r--]modules/mod_blog_roll.tpl0
-rwxr-xr-x[-rw-r--r--]modules/mod_last_blog_posts.php22
-rwxr-xr-x[-rw-r--r--]modules/mod_last_blog_posts.tpl0
-rwxr-xr-x[-rw-r--r--]modules/mod_last_created_blogs.php9
-rwxr-xr-x[-rw-r--r--]modules/mod_last_created_blogs.tpl0
-rwxr-xr-x[-rw-r--r--]modules/mod_last_modified_blogs.php10
-rwxr-xr-x[-rw-r--r--]modules/mod_last_modified_blogs.tpl0
-rwxr-xr-x[-rw-r--r--]modules/mod_top_active_blogs.php13
-rwxr-xr-x[-rw-r--r--]modules/mod_top_active_blogs.tpl0
-rwxr-xr-x[-rw-r--r--]modules/mod_top_visited_blogs.php18
-rwxr-xr-x[-rw-r--r--]modules/mod_top_visited_blogs.tpl0
19 files changed, 76 insertions, 78 deletions
diff --git a/modules/help_mod_last_blog_posts.tpl b/modules/help_mod_last_blog_posts.tpl
index 063a7ca..063a7ca 100644..100755
--- a/modules/help_mod_last_blog_posts.tpl
+++ b/modules/help_mod_last_blog_posts.tpl
diff --git a/modules/help_mod_top_active_blogs.tpl b/modules/help_mod_top_active_blogs.tpl
index df5f998..df5f998 100644..100755
--- a/modules/help_mod_top_active_blogs.tpl
+++ b/modules/help_mod_top_active_blogs.tpl
diff --git a/modules/help_mod_top_visited_blogs.tpl b/modules/help_mod_top_visited_blogs.tpl
index 8011b61..8011b61 100644..100755
--- a/modules/help_mod_top_visited_blogs.tpl
+++ b/modules/help_mod_top_visited_blogs.tpl
diff --git a/modules/index.php b/modules/index.php
index 3e305fe..3e305fe 100644..100755
--- a/modules/index.php
+++ b/modules/index.php
diff --git a/modules/lastblogposts/config_inc.php b/modules/lastblogposts/config_inc.php
index 4c5ad5a..bd94e2b 100644..100755
--- a/modules/lastblogposts/config_inc.php
+++ b/modules/lastblogposts/config_inc.php
@@ -1,26 +1,28 @@
<?php
global $gBitThemes;
-$gBitThemes->registerModule( array(
- 'title' => tra( 'Recent Blog Posts' ),
- 'description' => tra( 'Displays a list of recent blog posts. The list can be customized by various parameters.' ),
- 'params' => array(
- 'user' => array( 'help' => 'Set a user name to limit the list of recent posts to just posts by that user.', ),
- 'blog_id' => array( 'help' => 'Set a blog_id to limit the list of recent posts to just posts to that blog', ),
- 'groupd_id' => array( 'help' => 'Set a groupd_id to limit the list of recent posts to just posts by users in that group.', ),
- 'max_records' => array(),
- 'offset' => array( 'help' => 'Set offset to offest the start of the list' ),
- 'status' => array( 'help' => 'Set status to "draft" to display a list of draft posts by the logged in user.',
- 'select' => array( 'public' => 'Public',
- 'draft' => 'Draft',
- ),
- ),
- ),
- 'package' => BLOGS_PKG_NAME,
- 'directory' => 'lastblogposts',
- 'handler' => 'mod_last_blog_posts.php',
- 'template' => 'mod_last_blog_posts.tpl',
- 'legacy_dir' => 'modules', // force module to show up in correct array during upgrade process
+$gBitThemes->registerModule( [
+ 'title' => \Bitweaver\KernelTools::tra( 'Recent Blog Posts' ),
+ 'description' => \Bitweaver\KernelTools::tra( 'Displays a list of recent blog posts. The list can be customized by various parameters.' ),
+ 'params' => [
+ 'user' => [ 'help' => 'Set a user name to limit the list of recent posts to just posts by that user.',],
+ 'blog_id' => [ 'help' => 'Set a blog_id to limit the list of recent posts to just posts to that blog',],
+ 'groupd_id' => [ 'help' => 'Set a groupd_id to limit the list of recent posts to just posts by users in that group.',],
+ 'max_records' => [],
+ 'offset' => [ 'help' => 'Set offset to offest the start of the list' ],
+ 'status' => [
+ 'help' => 'Set status to "draft" to display a list of draft posts by the logged in user.',
+ 'select' => [
+ 'public' => 'Public',
+ 'draft' => 'Draft',
+ ],
+ ],
+ ],
+ 'package' => BLOGS_PKG_NAME,
+ 'directory' => 'lastblogposts',
+ 'handler' => 'mod_last_blog_posts.php',
+ 'template' => 'mod_last_blog_posts.tpl',
+ 'legacy_dir' => 'modules', // force module to show up in correct array during upgrade process
'legacy_prefix' => 'mod_', // force module to show up in correct array during upgrade process
-));
+] );
diff --git a/modules/lastblogposts/mod_last_blog_posts.php b/modules/lastblogposts/mod_last_blog_posts.php
index e9c2521..d53652e 100644..100755
--- a/modules/lastblogposts/mod_last_blog_posts.php
+++ b/modules/lastblogposts/mod_last_blog_posts.php
@@ -13,7 +13,7 @@ include_once( BLOGS_PKG_CLASS_PATH.'BitBlogPost.php' );
// moduleParams contains lots of goodies: extract for easier handling
extract( $moduleParams );
-$date_start = NULL;
+$date_start = null;
if( !empty($module_params['date_start_offset']) ){
//offset is passed as number of hours
$date_start = time() - ( $module_params['date_start_offset'] * 3600 );
@@ -22,11 +22,11 @@ if( !empty($module_params['date_start_offset']) ){
$defaultsHash = array(
'sort_mode' => ( !empty( $module_params['sort_mode'] ) ? $module_params['sort_mode'] : 'publish_date_desc' ),
'max_records' => $module_rows,
- 'parse_data' => TRUE,
- 'user' => ( !empty( $module_params['user'] ) ? $module_params['user'] : NULL ),
- 'blog_id' => ( @BitBase::verifyId( $module_params['blog_id'] ) ? $module_params['blog_id'] : NULL ),
- 'group_id' => ( @BitBase::verifyId( $module_params['group_id'] ) ? $module_params['group_id'] : NULL ),
- 'role_id' => ( @BitBase::verifyId( $module_params['role_id'] ) ? $module_params['role_id'] : NULL ),
+ 'parse_data' => true,
+ 'user' => ( !empty( $module_params['user'] ) ? $module_params['user'] : null ),
+ 'blog_id' => ( BitBase::verifyId( $module_params['blog_id'] ) ? $module_params['blog_id'] : null ),
+ 'group_id' => ( BitBase::verifyId( $module_params['group_id'] ) ? $module_params['group_id'] : null ),
+ 'role_id' => ( BitBase::verifyId( $module_params['role_id'] ) ? $module_params['role_id'] : null ),
'date_start' => $date_start,
'offset' => ( !empty( $module_params['offset'] ) ? $module_params['offset'] : 0 ),
);
@@ -42,11 +42,11 @@ if( !$gBitUser->hasPermission( 'p_blogs_admin' )) {
}
// we dont want admin drafts included in regular lists if we are enforcing content status
-$listHash['enforce_status'] = TRUE;
+$listHash['enforce_status'] = true;
if ( !empty( $module_params['status'] ) && $module_params['status'] = "draft" && isset( $gBitUser->mUserId ) ){
// if we are getting drafts then get future posts too
- $listHash['show_future'] = TRUE;
+ $listHash['show_future'] = true;
$listHash['min_status_id'] = -6;
$listHash['max_status_id'] = -4;
$listHash['min_owner_status_id'] = -6;
@@ -64,7 +64,7 @@ $descriptionLength = ( !empty( $module_params['max_preview_length'] ) ? $module_
$gBitSmarty->assign( 'blogPostsFormat', (empty($module_params['format']) ? 'list' : $module_params['format']) );
$gBitSmarty->assign( 'descriptionLength', $descriptionLength );
-$gBitSmarty->assignByRef( 'modLastBlogPosts', $blogPosts["data"] );
+$gBitSmarty->assign( 'modLastBlogPosts', $blogPosts["data"] );
// not sure what this is, but using title doesn't work cos that will rename the moduleTitle
//$gBitSmarty->assign( 'modLastBlogPostsTitle', ( isset( $module_params["title"] ) ? $module_params["title"]:"" ));
?>
diff --git a/modules/lastblogposts/mod_last_blog_posts.tpl b/modules/lastblogposts/mod_last_blog_posts.tpl
index fa48b33..fa48b33 100644..100755
--- a/modules/lastblogposts/mod_last_blog_posts.tpl
+++ b/modules/lastblogposts/mod_last_blog_posts.tpl
diff --git a/modules/mod_blog_roll.php b/modules/mod_blog_roll.php
index f508aa0..c66bca2 100644..100755
--- a/modules/mod_blog_roll.php
+++ b/modules/mod_blog_roll.php
@@ -8,22 +8,22 @@
/**
* required setup
*/
-include_once( BLOGS_PKG_CLASS_PATH.'BitBlog.php' );
+use Bitweaver\Blogs\BitBlog;
+use Bitweaver\Users\RoleUser;
-global $gQueryUserId, $module_rows, $moduleParams;
+global $moduleParams;
-$listHash['max_records'] = $module_rows;
-$listHash['sort_mode'] = ( !empty( $moduleParams['module_params']['sort_mode'] ) ) ? $moduleParams['module_params']['sort_mode'] : 'created_desc';
-BitUser::userCollection( $moduleParams['module_params'], $listHash );
+$listHash['max_records'] = $moduleParams->value['module_rows'];
+$listHash['sort_mode'] = 'created_desc'; // ( !empty( $moduleParams['module_params']['sort_mode'] ) ) ? $moduleParams['module_params']['sort_mode'] : 'created_desc';
+RoleUser::userCollection( $moduleParams->value['module_params'] ?? null, $listHash );
$blog = new BitBlog();
if( $modBlogs = $blog->getList( $listHash ) ) {
foreach( array_keys( $modBlogs ) as $b ) {
- $modBlogs[$b]['post'] = $blog->getPost( array( 'blog_id' => $modBlogs[$b]['blog_id'] ) );
+ $modBlogs[$b]['post'] = $blog->getPost( [ 'blog_id' => $modBlogs[$b]['blog_id'] ] );
}
- $_template->tpl_vars['modBlogs'] = new Smarty_variable( $modBlogs );
+ $gBitSmarty->assign( 'modBlogs', $modBlogs );
}
-$moduleTitle = (!empty( $moduleParams['title'] ) ? $moduleParams['title'] : 'Blog Roll');
-$_template->tpl_vars['moduleTitle'] = new Smarty_variable( $moduleTitle );
-?>
+$moduleTitle = !empty( $moduleParams->value['title'] ) ? $moduleParams->value['title'] : 'Blog Roll';
+$gBitSmarty->assign( 'moduleTitle', $moduleTitle ); \ No newline at end of file
diff --git a/modules/mod_blog_roll.tpl b/modules/mod_blog_roll.tpl
index e3a3a15..e3a3a15 100644..100755
--- a/modules/mod_blog_roll.tpl
+++ b/modules/mod_blog_roll.tpl
diff --git a/modules/mod_last_blog_posts.php b/modules/mod_last_blog_posts.php
index 14c6e10..cb083a2 100644..100755
--- a/modules/mod_last_blog_posts.php
+++ b/modules/mod_last_blog_posts.php
@@ -13,7 +13,7 @@ include_once( BLOGS_PKG_CLASS_PATH.'BitBlogPost.php' );
// moduleParams contains lots of goodies: extract for easier handling
extract( $moduleParams );
-$date_start = NULL;
+$date_start = null;
if( !empty($module_params['date_start_offset']) ){
//offset is passed as number of hours
$date_start = time() - ( $module_params['date_start_offset'] * 3600 );
@@ -22,11 +22,11 @@ if( !empty($module_params['date_start_offset']) ){
$defaultsHash = array(
'sort_mode' => ( !empty( $module_params['sort_mode'] ) ? $module_params['sort_mode'] : 'publish_date_desc' ),
'max_records' => $module_rows,
- 'parse_data' => TRUE,
- 'user' => ( !empty( $module_params['user'] ) ? $module_params['user'] : NULL ),
- 'blog_id' => ( @BitBase::verifyId( $module_params['blog_id'] ) ? $module_params['blog_id'] : NULL ),
- 'role_id' => ( @BitBase::verifyId( $module_params['role_id'] ) ? $module_params['role_id'] : NULL ),
- 'group_id' => ( @BitBase::verifyId( $module_params['group_id'] ) ? $module_params['group_id'] : NULL ),
+ 'parse_data' => true,
+ 'user' => ( !empty( $module_params['user'] ) ? $module_params['user'] : null ),
+ 'blog_id' => ( BitBase::verifyId( $module_params['blog_id'] ) ? $module_params['blog_id'] : null ),
+ 'role_id' => ( BitBase::verifyId( $module_params['role_id'] ) ? $module_params['role_id'] : null ),
+ 'group_id' => ( BitBase::verifyId( $module_params['group_id'] ) ? $module_params['group_id'] : null ),
'date_start' => $date_start,
'offset' => ( !empty( $module_params['offset'] ) ? $module_params['offset'] : 0 ),
);
@@ -42,11 +42,11 @@ if( !$gBitUser->hasPermission( 'p_blogs_admin' )) {
}
// we dont want admin drafts included in regular lists if we are enforcing content status
-$listHash['enforce_status'] = TRUE;
+$listHash['enforce_status'] = true;
if ( !empty( $module_params['status'] ) && $module_params['status'] = "draft" && isset( $gBitUser->mUserId ) ){
// if we are getting drafts then get future posts too
- $listHash['show_future'] = TRUE;
+ $listHash['show_future'] = true;
$listHash['min_status_id'] = -6;
$listHash['max_status_id'] = -4;
$listHash['min_owner_status_id'] = -6;
@@ -61,6 +61,6 @@ $blogPost = new BitBlogPost();
$blogPosts = $blogPost->getList( $listHash );
$descriptionLength = ( !empty( $module_params['max_preview_length'] ) ? $module_params['max_preview_length'] : 500 );
-$_template->tpl_vars['blogPostsFormat'] = new Smarty_variable( (empty($module_params['format']) ) );
-$_template->tpl_vars['descriptionLength'] = new Smarty_variable( $descriptionLength );
-$_template->tpl_vars['modLastBlogPosts'] = new Smarty_variable( $blogPosts );
+$gBitSmarty->assign( 'blogPostsFormat', (empty($module_params['format']) ) );
+$gBitSmarty->assign( 'descriptionLength', $descriptionLength );
+$gBitSmarty->assign( 'modLastBlogPosts', $blogPosts );
diff --git a/modules/mod_last_blog_posts.tpl b/modules/mod_last_blog_posts.tpl
index fa48b33..fa48b33 100644..100755
--- a/modules/mod_last_blog_posts.tpl
+++ b/modules/mod_last_blog_posts.tpl
diff --git a/modules/mod_last_created_blogs.php b/modules/mod_last_created_blogs.php
index d4e873a..4ce50a8 100644..100755
--- a/modules/mod_last_created_blogs.php
+++ b/modules/mod_last_created_blogs.php
@@ -8,14 +8,13 @@
/**
* required setup
*/
-include_once( BLOGS_PKG_CLASS_PATH.'BitBlog.php' );
-
+use Bitweaver\Blogs\BitBlog;
+use Bitweaver\Users\RoleUser;
global $gQueryUserId, $module_rows, $module_params;
$listHash['max_records'] = $module_rows;
$listHash['sort_mode'] = 'created_desc';
-BitUser::userCollection( $module_params, $listHash );
+RoleUser::userCollection( $module_params, $listHash );
$blog = new BitBlog();
-$_template->tpl_vars['modLastCreatedBlogs'] = new Smarty_variable( $blog->getList( $listHash ) );
-?>
+$gBitSmarty->assign( 'modLastCreatedBlogs', $blog->getList( $listHash ) ); \ No newline at end of file
diff --git a/modules/mod_last_created_blogs.tpl b/modules/mod_last_created_blogs.tpl
index a584efe..a584efe 100644..100755
--- a/modules/mod_last_created_blogs.tpl
+++ b/modules/mod_last_created_blogs.tpl
diff --git a/modules/mod_last_modified_blogs.php b/modules/mod_last_modified_blogs.php
index 9aba738..1dd5409 100644..100755
--- a/modules/mod_last_modified_blogs.php
+++ b/modules/mod_last_modified_blogs.php
@@ -8,17 +8,17 @@
/**
* required setup
*/
-include_once( BLOGS_PKG_CLASS_PATH.'BitBlog.php' );
+use Bitweaver\Blogs\BitBlog;
+use Bitweaver\Users\RoleUser;
global $gQueryUserId, $moduleParams;
//$params = $moduleParams['module_params'];
-$listHash['max_records'] = $moduleParams['module_rows'];
+$listHash['max_records'] = $moduleParams->value['module_rows'];
$listHash['sort_mode'] = 'last_modified_desc';
-BitUser::userCollection( $moduleParams, $listHash );
+RoleUser::userCollection( $moduleParams->value, $listHash );
$blog = new BitBlog();
$ranking = $blog->getList( $listHash );
-$_template->tpl_vars['modLastModifiedBlogs'] = new Smarty_variable( $ranking);
-?>
+$gBitSmarty->assign( 'modLastModifiedBlogs', $ranking); \ No newline at end of file
diff --git a/modules/mod_last_modified_blogs.tpl b/modules/mod_last_modified_blogs.tpl
index a487cb0..a487cb0 100644..100755
--- a/modules/mod_last_modified_blogs.tpl
+++ b/modules/mod_last_modified_blogs.tpl
diff --git a/modules/mod_top_active_blogs.php b/modules/mod_top_active_blogs.php
index e9de007..0036951 100644..100755
--- a/modules/mod_top_active_blogs.php
+++ b/modules/mod_top_active_blogs.php
@@ -8,18 +8,17 @@
/**
* required setup
*/
-include_once( BLOGS_PKG_CLASS_PATH.'BitBlog.php' );
-
+use Bitweaver\Blogs\BitBlog;
+use Bitweaver\Users\RoleUser;
global $gQueryUserId, $gBitThemes, $module_rows, $module_params;
$listHash['max_records'] = $module_rows;
$listHash['sort_mode'] = 'activity_desc';
-BitUser::userCollection( $module_params, $listHash );
-$listHash['is_active'] = TRUE;
+RoleUser::userCollection( $module_params, $listHash );
+$listHash['is_active'] = true;
$blog = new BitBlog();
$ranking = $blog->getList( $listHash );
if( !empty( $ranking ) ) {
- $_template->tpl_vars['modTopActiveBlogs'] = new Smarty_variable( $ranking );
-}
-?>
+ $gBitSmarty->assign( 'modTopActiveBlogs', $ranking );
+} \ No newline at end of file
diff --git a/modules/mod_top_active_blogs.tpl b/modules/mod_top_active_blogs.tpl
index 78d65a4..78d65a4 100644..100755
--- a/modules/mod_top_active_blogs.tpl
+++ b/modules/mod_top_active_blogs.tpl
diff --git a/modules/mod_top_visited_blogs.php b/modules/mod_top_visited_blogs.php
index 88ed8c2..5ec744d 100644..100755
--- a/modules/mod_top_visited_blogs.php
+++ b/modules/mod_top_visited_blogs.php
@@ -8,24 +8,22 @@
/**
* required setup
*/
-include_once( BLOGS_PKG_CLASS_PATH.'BitBlog.php' );
+use Bitweaver\Blogs\BitBlog;
+use Bitweaver\Users\RoleUser;
+global $gQueryUserId, $moduleParams;
-global $gBitThemes;
-
-extract( $moduleParams );
//$params = $gBitThemes->getModuleParameters('bitpackage:blogs/mod_top_visited_blogs.tpl', $gQueryUserId);
-$listHash['max_records'] = $params['module_rows'];
+$listHash['max_records'] = $moduleParams->value['module_rows'] ?? 10;
$listHash['sort_mode'] = 'hits_desc';
//produces White Screen Of Death:
-//$listHash['is_hit'] = TRUE;
+//$listHash['is_hit'] = true;
-BitUser::userCollection( $_REQUEST, $listHash );
+RoleUser::userCollection( $_REQUEST, $listHash );
$blog = new BitBlog();
$ranking = $blog->getList( $listHash );
-$_template->tpl_vars['modTopVisitedBlogs'] = new Smarty_variable( $ranking);
-$_template->tpl_vars['bulletSrc'] = new Smarty_variable( isset($params["bullet"]) ? $params['bullet'] : NULL);
-?>
+$gBitSmarty->assign( 'modTopVisitedBlogs', $ranking);
+$gBitSmarty->assign( 'bulletSrc', $params['bullet'] ?? ''); \ No newline at end of file
diff --git a/modules/mod_top_visited_blogs.tpl b/modules/mod_top_visited_blogs.tpl
index c5c538b..c5c538b 100644..100755
--- a/modules/mod_top_visited_blogs.tpl
+++ b/modules/mod_top_visited_blogs.tpl