From c29fea0ae79977f09fd7b4706c88f3ecb90a4575 Mon Sep 17 00:00:00 2001 From: lsces Date: Thu, 28 Aug 2025 17:12:09 +0100 Subject: Templates code updated to PHP8.4 and namespace --- templates/admin_blogs.tpl | 0 templates/blog_list_post.tpl | 8 ++--- templates/blog_post.tpl | 35 +++++++++---------- templates/blogs_send_link.tpl | 0 templates/center_list_blog_posts.php | 64 ++++++++++++++++------------------ templates/center_list_blog_posts.tpl | 2 +- templates/crosspost.tpl | 18 +++++----- templates/edit_blog.tpl | 2 +- templates/edit_blogpost_status_inc.tpl | 0 templates/html_head_inc.tpl | 4 +-- templates/index.php | 0 templates/list_blogs.tpl | 0 templates/list_posts.tpl | 0 templates/menu_blogs.tpl | 2 +- templates/menu_blogs_admin.tpl | 2 +- templates/popup_categs.tpl | 0 templates/print_blog_post.tpl | 2 +- templates/ranking.tpl | 0 templates/send_blog_post.tpl | 0 templates/user_watch_blog_post.tpl | 0 templates/view_blog.tpl | 4 +-- templates/view_blog_post.tpl | 29 ++++++++------- templates/view_blog_post_xml.tpl | 0 templates/wp-migrate.tpl | 0 24 files changed, 86 insertions(+), 86 deletions(-) mode change 100644 => 100755 templates/admin_blogs.tpl mode change 100644 => 100755 templates/blog_list_post.tpl mode change 100644 => 100755 templates/blog_post.tpl mode change 100644 => 100755 templates/blogs_send_link.tpl mode change 100644 => 100755 templates/center_list_blog_posts.php mode change 100644 => 100755 templates/center_list_blog_posts.tpl mode change 100644 => 100755 templates/crosspost.tpl mode change 100644 => 100755 templates/edit_blog.tpl mode change 100644 => 100755 templates/edit_blogpost_status_inc.tpl mode change 100644 => 100755 templates/html_head_inc.tpl mode change 100644 => 100755 templates/index.php mode change 100644 => 100755 templates/list_blogs.tpl mode change 100644 => 100755 templates/list_posts.tpl mode change 100644 => 100755 templates/menu_blogs.tpl mode change 100644 => 100755 templates/menu_blogs_admin.tpl mode change 100644 => 100755 templates/popup_categs.tpl mode change 100644 => 100755 templates/print_blog_post.tpl mode change 100644 => 100755 templates/ranking.tpl mode change 100644 => 100755 templates/send_blog_post.tpl mode change 100644 => 100755 templates/user_watch_blog_post.tpl mode change 100644 => 100755 templates/view_blog.tpl mode change 100644 => 100755 templates/view_blog_post.tpl mode change 100644 => 100755 templates/view_blog_post_xml.tpl mode change 100644 => 100755 templates/wp-migrate.tpl diff --git a/templates/admin_blogs.tpl b/templates/admin_blogs.tpl old mode 100644 new mode 100755 diff --git a/templates/blog_list_post.tpl b/templates/blog_list_post.tpl old mode 100644 new mode 100755 index ba232fb..c24e8b8 --- a/templates/blog_list_post.tpl +++ b/templates/blog_list_post.tpl @@ -54,8 +54,8 @@
-
- {if $aPost.crosspost_note} +
+ {if !empty($aPost.crosspost_note)}
{$aPost.crosspost_note}
{/if} @@ -84,11 +84,11 @@ {/legend} {/jstab} +
+   + +
{/jstabs} {/form}
diff --git a/templates/blogs_send_link.tpl b/templates/blogs_send_link.tpl old mode 100644 new mode 100755 diff --git a/templates/center_list_blog_posts.php b/templates/center_list_blog_posts.php old mode 100644 new mode 100755 index 52e65f1..550ce4b --- a/templates/center_list_blog_posts.php +++ b/templates/center_list_blog_posts.php @@ -3,23 +3,22 @@ * @version $Header$ * @package bitweaver */ -global $gBitSmarty, $gBlog, $gBitSystem, $moduleParams, $gBitUser; -if( !empty( $moduleParams ) ) { - extract( $moduleParams ); -} +use Bitweaver\Blogs\BitBlogPost; +use Bitweaver\Users\RoleUser; + +global $moduleParams; -include_once( BLOGS_PKG_CLASS_PATH.'BitBlog.php' ); -include_once( BLOGS_PKG_INCLUDE_PATH.'lookup_post_inc.php' ); +include_once BLOGS_PKG_INCLUDE_PATH.'lookup_post_inc.php'; $blogPost = new BitBlogPost(); if( empty( $gContent )) { - $gBitSmarty->assignByRef( 'gContent', $blogPost ); + $gBitSmarty->assign( 'gContent', $blogPost ); } if( $gBitUser->hasPermission( 'p_blog_posts_read_future' ) || $gBitUser->isAdmin() ) { - $futuresHash = array(); + $futuresHash = []; $futuresHash['max_records'] = !empty( $_REQUEST['max_records'] ) ? $_REQUEST['max_records'] : $gBitSystem->getConfig( 'blog_posts_max_list' ); - $futuresHash['get_future'] = TRUE; + $futuresHash['get_future'] = true; if( empty( $futuresHash['user_id'] )) { if( !empty( $gQueryUserId )) { $futuresHash['user_id'] = $gQueryUserId; @@ -28,10 +27,10 @@ if( $gBitUser->hasPermission( 'p_blog_posts_read_future' ) || $gBitUser->isAdmin } } // prevent anything lower than publicly visible be displayed in blog roll - $futuresHash['enforce_status'] = TRUE; + $futuresHash['enforce_status'] = true; $futuresHash['min_owner_status_id'] = 0; $futures = $blogPost->getFutureList( $futuresHash ); - $gBitSmarty->assign( 'futures', $futures['data']); + $gBitSmarty->assign( 'futures', $futures['data'] ?? []); } else { $_REQUEST['max_records'] = $gBitSystem->getConfig( 'blog_posts_max_list' ); } @@ -41,22 +40,22 @@ if( $gBitUser->hasPermission( 'p_blog_posts_read_future' ) || $gBitUser->isAdmin $listHash = $module_params; $listHash = array( 'max_records' => $module_rows, - 'parse_data' => TRUE, - 'load_comments' => TRUE, + 'parse_data' => true, + 'load_comments' => true, ); */ -$listHash = array(); -if( !empty( $moduleParams )) { - $listHash = array_merge( $_REQUEST, $moduleParams['module_params'] ); - $listHash['max_records'] = $module_rows; - //$listHash['parse_data'] = TRUE; - //$listHash['load_comments'] = TRUE; +$listHash = []; +if( !empty( $moduleParams->values )) { + $listHash = array_merge( $_REQUEST, $moduleParams->values ); + $listHash['max_records'] = $moduleParams->values['module_rows']; + //$listHash['parse_data'] = true; + //$listHash['load_comments'] = true; } else { $listHash = $_REQUEST; } -BitUser::userCollection( $_REQUEST, $listHash ); +RoleUser::userCollection( $_REQUEST, $listHash ); if ( empty( $listHash['sort_mode'] ) ){ $listHash['sort_mode'] = 'sort_date_desc'; @@ -75,12 +74,12 @@ $paginationPath = BLOGS_PKG_URL.'index.php'; */ if ( !empty( $module_params ) && !empty( $module_params['blog_id'] ) ){ - $_template->tpl_vars['blogId'] = new Smarty_variable( $module_params['blog_id'] ); + $gBitSmarty->assign( 'blogId', $module_params['blog_id'] ); $paginationPath = BLOGS_PKG_URL.'view.php'; } // prevent anything lower than publicly visible be displayed in blog roll -$listHash['enforce_status'] = TRUE; +$listHash['enforce_status'] = true; $listHash['min_owner_status_id'] = 0; /* I think this is right - usually we pass in $_REQUEST @@ -89,15 +88,14 @@ $listHash['min_owner_status_id'] = 0; */ $blogPost->invokeServices( 'content_list_function', $listHash ); $blogPosts = $blogPost->getList( $listHash ); -$_template->tpl_vars['paginationPath'] = new Smarty_variable( $paginationPath ); -$_template->tpl_vars['gQueryUserId'] = new Smarty_variable( $listHash['user_id'] ); -$_template->tpl_vars['blogPosts'] = new Smarty_variable( $blogPosts ); - -$_template->tpl_vars['listInfo'] = new Smarty_variable( $listHash ); -$_template->tpl_vars['descriptionLength'] = new Smarty_variable( $gBitSystem->getConfig( 'blog_posts_description_length', 500 )); -$_template->tpl_vars['showDescriptionsOnly'] = new Smarty_variable( TRUE ); -$_template->tpl_vars['showBlogTitle'] = new Smarty_variable( 'y' ); -$_template->tpl_vars['blogPostsFormat'] = new Smarty_variable( (empty($module_params['format']) ? 'full' : $module_params['format']) ); +$gBitSmarty->assign( 'paginationPath', $paginationPath ); +$gBitSmarty->assign( 'gQueryUserId', $listHash['user_id'] ?? 0 ); +$gBitSmarty->assign( 'blogPosts', $blogPosts ); + +$gBitSmarty->assign( 'listInfo', $listHash ); +$gBitSmarty->assign( 'descriptionLength', $gBitSystem->getConfig( 'blog_posts_description_length', 500 )); +$gBitSmarty->assign( 'showDescriptionsOnly', true ); +$gBitSmarty->assign( 'showBlogTitle', 'y' ); +$gBitSmarty->assign( 'blogPostsFormat', empty( $module_params['format'] ) ? 'full' : $module_params['format'] ); // unfortunately, the following feature pulls module parameters in from other modules -//$gBitSmarty->assign( 'centerTitle', $moduleParams['title'] ); -?> +//$gBitSmarty->assign( 'centerTitle', $moduleParams['title'] ); \ No newline at end of file diff --git a/templates/center_list_blog_posts.tpl b/templates/center_list_blog_posts.tpl old mode 100644 new mode 100755 index 27b1ec5..5c380e8 --- a/templates/center_list_blog_posts.tpl +++ b/templates/center_list_blog_posts.tpl @@ -1,5 +1,5 @@ {* $Header$ *} -{if !( $smarty.request.home && $gBitSystem->isFeatureActive('blog_hide_empty_usr_list') ) } +{if !( $smarty.request.home|default:true && $gBitSystem->isFeatureActive('blog_hide_empty_usr_list') ) }
{bithelp}
diff --git a/templates/crosspost.tpl b/templates/crosspost.tpl old mode 100644 new mode 100755 index dc0d9ec..95dd74c --- a/templates/crosspost.tpl +++ b/templates/crosspost.tpl @@ -16,8 +16,8 @@ {formlabel label="Blogs this Post is Already Crossposted To" for="blog_id"} {forminput} {foreach from=$availableBlogs key=blogContentId item=availBlogTitle} - {if $gContent->mInfo.blogs.$blogContentId && ($blogContentId != $crosspost.blog_content_id) } - {assign var="has_crosspost" value=TRUE} + {if $gContent->mInfo.blogs.$blogContentId and ($blogContentId != $crosspost.blog_content_id) } + {assign var="has_crosspost" value=true} {$availBlogTitle|escape}  {booticon iname="icon-edit" ipackage="icons" iexplain="edit crosspost note"}  {booticon iname="icon-trash" ipackage="icons" iexplain="delete this crossposting"}
@@ -38,7 +38,7 @@ {forminput} {foreach from=$availableBlogs key=blogContentId item=availBlogTitle} {if !$gContent->mInfo.blogs.$blogContentId || ($blogContentId == $crosspost.blog_content_id) } - {assign var="has_crosspost_option" value=TRUE} + {assign var="has_crosspost_option" value=true} {$availBlogTitle|escape}
{/if} {/foreach} @@ -51,11 +51,11 @@
{/if} - {if $has_crosspost_option} + {* if $has_crosspost_option} {formlabel label="Crosspost Note Format"} {forminput} {foreach name=formatPlugins from=$gLibertySystem->mPlugins item=plugin key=guid} - {if $plugin.edit_field eq $post_info.format_guid} + {if $plugin.edit_field|default:'' eq $post_info.format_guid} {$plugin.edit_label} {/if} {/foreach} @@ -66,7 +66,7 @@  
- {/if} + {/if *} {/legend} {/form} @@ -76,9 +76,9 @@
-

- {$post_info.blogtitle|escape} -

+ {if !empty($post_info.blogtitle)} +

{$post_info.blogtitle|escape}

+ {/if} diff --git a/templates/edit_blogpost_status_inc.tpl b/templates/edit_blogpost_status_inc.tpl old mode 100644 new mode 100755 diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl old mode 100644 new mode 100755 index e4cf8a4..14ad066 --- a/templates/html_head_inc.tpl +++ b/templates/html_head_inc.tpl @@ -20,10 +20,10 @@ * needed for your site configuation by creating a custom version of this tpl in your theme. Target the * conditionals to the pkg you are including center_list_blog_posts in. *} -{if $ajax_more} +{if !empty($ajax_more)} {* @TODO develop custom callback - for now override ajax callback for cool scroll effect *} {literal} -