From b7755468843dd624848927820adb7c5fa1a3ad0c Mon Sep 17 00:00:00 2001 From: Stephen J Carnam Date: Tue, 15 Aug 2023 17:48:56 -0700 Subject: [PATCH] refactor for hcpp_render_body, hcpp_render_panel --- hooks/pluginable.php | 2 +- hooks/post_install.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hooks/pluginable.php b/hooks/pluginable.php index 4917e24..b590ac0 100644 --- a/hooks/pluginable.php +++ b/hooks/pluginable.php @@ -861,7 +861,7 @@ function str_starts_with($haystack, $needle) { }); // List plugins in HestiaCP's Configure Server UI - $hcpp->add_action( 'hcpp_render_page', function( $args ) { + $hcpp->add_action( 'hcpp_render_body', function( $args ) { global $hcpp; $content = $args['content']; if ( false == ($args['page'] == 'edit_server' && $args['TAB'] == 'SERVER' ) ) { diff --git a/hooks/post_install.sh b/hooks/post_install.sh index a550146..70ebd28 100755 --- a/hooks/post_install.sh +++ b/hooks/post_install.sh @@ -104,6 +104,16 @@ $hcpp->patch_file( 'include $__template_dir . "header.php";', "include \$__template_dir . \"header.php\";\n\t\$args = [ 'TAB' => \$TAB, 'page' => \$page, 'user' => \$user, 'content' => ob_get_clean() ];\n echo \$hcpp->do_action('hcpp_render_header', \$args)['content'];\n" ); +$hcpp->patch_file( + '/usr/local/hestia/web/inc/main.php', + "// Panel", + "// Panel\n\tob_start();\n" +); +$hcpp->patch_file( + '/usr/local/hestia/web/inc/main.php', + "// Policies controller", + "\t\$args['content'] = ob_get_clean();\n\techo \$hcpp->do_action('hcpp_render_panel', \$args)['content'];\n\n\t// Policies controller" +); $hcpp->patch_file( '/usr/local/hestia/web/inc/main.php', "// Body", @@ -112,7 +122,7 @@ $hcpp->patch_file( $hcpp->patch_file( '/usr/local/hestia/web/inc/main.php', "// Footer", - "\t\$args['content'] = ob_get_clean();\n\techo \$hcpp->do_action('hcpp_render_page', \$args)['content'];\n\n\t// Footer" + "\t\$args['content'] = ob_get_clean();\n\techo \$hcpp->do_action('hcpp_render_body', \$args)['content'];\n\n\t// Footer" ); $hcpp->patch_file( '/usr/local/hestia/web/inc/main.php',