diff --git a/includes/class-ayecode-connect-remote-actions.php b/includes/class-ayecode-connect-remote-actions.php index c44dd89..0d09939 100755 --- a/includes/class-ayecode-connect-remote-actions.php +++ b/includes/class-ayecode-connect-remote-actions.php @@ -702,7 +702,7 @@ public function import_page_template( $page_template, $type = '', $cpt = '' ) { $post_id = 0; if ( ! empty( $page_template['post_title'] ) ) { - //$this->debug_log( $page_template['post_title'], __METHOD__ . ':' . $type, __FILE__, __LINE__ ); + $this->debug_log( $page_template['post_title'], __METHOD__ . ':' . $type, __FILE__, __LINE__ ); } if ( $type == 'elementor' ) { @@ -1841,7 +1841,7 @@ public function install_theme( $result ) { ) ); - $this->debug_log( $api, __METHOD__ . . ':' . $slug . ':themes_api', __FILE__, __LINE__ ); + $this->debug_log( $api, __METHOD__ . ':' . $slug . ':themes_api', __FILE__, __LINE__ ); if ( is_wp_error( $api ) ) { $this->debug_log( $api->get_error_message(), __METHOD__ . ':themes_api error', __FILE__, __LINE__ ); @@ -2583,6 +2583,12 @@ public function str_replace_args( $values = false ) { } public function debug_log( $log, $title = '', $file = '', $line = '', $exit = false ) { + global $aye_usage; + + if ( empty( $aye_usage ) ) { + $aye_usage = array(); + } + $should_log = $this->debug; if ( defined( 'AYECODE_CONNECT_DEBUG' ) ) { @@ -2606,7 +2612,27 @@ public function debug_log( $log, $title = '', $file = '', $line = '', $exit = fa $append = ''; if ( is_scalar( $log ) && ( $log === 'start' || $log === 'end' ) ) { - $append = " " . memory_get_usage(); + $usage = memory_get_usage(); + + $append = " " . $usage; + + $_label = ''; + + if ( $file && $file !== '' ) { + $_label .= basename( $file ) . ':'; + } + + if ( $title && $title !== '' ) { + $_label .= $title; + } + + if ( $_label ) { + $aye_usage[ $_label ][ $log ] = $usage; + + if ( $log === 'end' && ! empty( $aye_usage[ $_label ][ 'start' ] ) ) { + $append .= " - " . ( $usage - $aye_usage[ $_label ][ 'start' ] ); + } + } } if ( is_array( $log ) || is_object( $log ) ) { diff --git a/includes/class-ayecode-connect.php b/includes/class-ayecode-connect.php index af48152..fa04379 100755 --- a/includes/class-ayecode-connect.php +++ b/includes/class-ayecode-connect.php @@ -1908,6 +1908,12 @@ public function request_demo_content( $demo, $type, $page = 0 ) { } public function debug_log( $log, $title = '', $file = '', $line = '', $exit = false ) { + global $aye_usage; + + if ( empty( $aye_usage ) ) { + $aye_usage = array(); + } + $should_log = $this->debug; if ( defined( 'AYECODE_CONNECT_DEBUG' ) ) { @@ -1930,8 +1936,28 @@ public function debug_log( $log, $title = '', $file = '', $line = '', $exit = fa $label = $label !== '' ? trim( $label ) . ' : ' : ''; $append = ''; - if ( is_scalar( $log ) && ( $log == 'start' || $log == 'end' ) ) { - $append = " " . memory_get_usage(); + if ( is_scalar( $log ) && ( $log === 'start' || $log === 'end' ) ) { + $usage = memory_get_usage(); + + $append = " " . $usage; + + $_label = ''; + + if ( $file && $file !== '' ) { + $_label .= basename( $file ) . ':'; + } + + if ( $title && $title !== '' ) { + $_label .= $title; + } + + if ( $_label ) { + $aye_usage[ $_label ][ $log ] = $usage; + + if ( $log === 'end' && ! empty( $aye_usage[ $_label ][ 'start' ] ) ) { + $append .= " - " . ( $usage - $aye_usage[ $_label ][ 'start' ] ); + } + } } if ( is_array( $log ) || is_object( $log ) ) { diff --git a/includes/class-ayecode-demo-content.php b/includes/class-ayecode-demo-content.php index df1d758..9ae82a5 100755 --- a/includes/class-ayecode-demo-content.php +++ b/includes/class-ayecode-demo-content.php @@ -615,13 +615,13 @@ public function get_demo_tabs_body( $sites ) } - public function get_demo_tabs_head($sites) - { + public function get_demo_tabs_head( $sites ) { + global $aui_bs5; $types = $this->get_demo_site_types($sites); ob_start(); - echo '