'; echo code_profiler_display_tabs( 1 ); $error = 0; if (! function_exists('register_tick_function') ) { $error = 'register_tick_function'; } elseif (! function_exists('stream_wrapper_unregister') ) { $error = 'stream_wrapper_unregister'; } elseif (! function_exists('stream_wrapper_register') ) { $error = 'stream_wrapper_register'; } elseif (! function_exists('stream_wrapper_restore') ) { $error = 'stream_wrapper_restore'; } if (! empty( $error ) ) { printf( CODE_PROFILER_ERROR_NOTICE, sprintf( esc_html__('Your PHP configuration is missing the "%s" function. Code Profiler cannot run without it. Please contact your server administrator about this error.', 'code-profiler'), $error ) ); } if (! is_writable( CODE_PROFILER_UPLOAD_DIR ) ) { printf( CODE_PROFILER_ERROR_NOTICE, sprintf( esc_html__('The following folder is not writable: %s. Please change its permissions or ownership so that Code Profiler can write to it.', 'code-profiler'), CODE_PROFILER_UPLOAD_DIR ) ); } // Clear the log if it's too big code_profiler_clearlog(); $home = home_url('/'); // Frontend $site = site_url('/'); // Backend // Get user login name $current_user = wp_get_current_user(); // Profile's name $profile = code_profiler_profile_name(); $cp_options = get_option('code-profiler'); // Memorized options if ( empty( $cp_options['mem_where'] ) ) { $cp_options['mem_where'] = 'frontend'; } if ( empty( $cp_options['mem_post'] ) ) { $cp_options['mem_post'] = ''; } if ( empty( $cp_options['mem_user'] ) ) { $cp_options['mem_user'] = 'unauthenticated'; } if ( $cp_options['mem_where'] == 'backend') { $cp_options['mem_user'] = 'authenticated'; } if ( empty( $cp_options['mem_method'] ) ) { $cp_options['mem_method'] = 'get'; } $default_theme = get_option('stylesheet'); if ( empty( $cp_options['mem_theme'] ) ) { $cp_options['mem_theme'] = $default_theme; } if ( empty( $cp_options['ua'] ) ) { $cp_options['ua'] = 'Firefox'; } $cookies = ''; $payload = ''; $custom_headers = ''; if ( isset( $cp_options['cookies'] ) ) { // stripslashes is only needed for cookies $cookies = trim( stripslashes( json_decode( $cp_options['cookies'] ) ) ); } if ( empty( $cp_options['mem_content_type'] ) || ! in_array( $cp_options['mem_content_type'], [ 1, 2 ] ) ) { $cp_options['mem_content_type'] = 1; } if ( isset( $cp_options['payload'] ) ) { $payload = trim( json_decode( $cp_options['payload'] ) ); } if ( isset( $cp_options['custom_headers'] ) ) { $custom_headers = trim( json_decode( $cp_options['custom_headers'] ) ); } ?>

         


'; } else { echo ' '; } else { $value = ''; echo ' '; } else { echo '

">

'; $disabled_button = ' disabled'; } else { echo '
/>    
%2$s', esc_attr( $home ), esc_html__('Homepage', 'code-profiler') ); } else { $pages = sprintf( '', esc_attr( $home ), esc_html__('Homepage', 'code-profiler') ); } $args = [ 'posts_per_page' => -1, 'post_type' => ['page'], 'post_status' => 'publish', 'orderby' => 'post_name', 'order' => 'ASC' ]; $query = new WP_Query( $args ); if ( $query ) { $items = $query->posts; foreach( $items as $item ) { if ( empty( $item->post_title ) ) { $item->post_title = __('Untitled'); } $permalink = get_permalink( $item->ID ); if ( $cp_options['mem_post'] == $permalink ) { $pages .= sprintf( '', esc_attr( $permalink ), esc_html( $item->post_title ) ); } else { $pages .= sprintf( '', esc_attr( $permalink ), esc_html( $item->post_title ) ); } } } return sprintf('%s', esc_attr__('Pages', 'code-profiler'), $pages ); } // ===================================================================== // Fetch admin pages (backend) function code_profiler_fetch_admin_pages( $home, $cp_options ) { $backend = ''; if ( empty( $cp_options['mem_post'] ) ) { $cp_options['mem_post'] = $home; } if (! empty( $GLOBALS[ 'menu' ] ) ) { foreach( $GLOBALS[ 'menu' ] as $menu => $value ) { if (! empty( $value[0] ) && substr( $value[2], -4 ) == '.php') { // E.g., "Comments", "Plugins" etc $value[0] = trim( preg_replace('/\s*<.+$/', '', $value[0] ) ); if ( $cp_options['mem_post'] == "{$home}wp-admin/{$value[2]}" ) { $backend .= sprintf( '', esc_attr("{$home}wp-admin/{$value[2]}"), esc_html( $value[0] ) ); } else { $backend .= sprintf( '', esc_attr("{$home}wp-admin/{$value[2]}"), esc_html( $value[0] ) ); } } } } if ( empty( $backend ) ) { $backend = sprintf( '', esc_attr( $home ), esc_html__('Dashboard', 'code-profiler') ); } return $backend; } // ===================================================================== // EOF