PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.0
Kubio AI Page Builder v2.8.0
2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / lib / AI / admin-tab / tab.php
kubio / lib / AI / admin-tab Last commit date
partials 1 year ago tab.php 1 year ago
tab.php
75 lines
1 <?php
2
3 use IlluminateAgnostic\Arr\Support\Arr;
4 use Kubio\Core\Utils;
5 use Kubio\FileLog;
6 use Kubio\Flags;
7
8 add_filter(
9 'kubio/admin-page/info_page_tabs',
10 function ( $tabs ) {
11 if ( ! Flags::getSetting( 'enableAICapabilities', false ) ) {
12 return $tabs;
13 }
14
15 $skip_ai_tab = apply_filters( 'kubio/admin-page/skip_ai_tab_in_stage_2', true );
16 if ( ( Flags::getSetting( 'aiStage2' ) && $skip_ai_tab ) ) {
17 return $tabs;
18 }
19
20 $tabs = array_merge(
21 $tabs,
22 array(
23 'ai-info' => array(
24 'type' => 'page',
25 'label' => __( 'Kubio AI', 'kubio' ),
26 'tab-partial' => __DIR__ . '/partials/main.php',
27 'subtitle' => __( 'Build smarter & faster with Kubio AI', 'kubio' ),
28 ),
29 )
30 );
31
32 if ( defined( 'KUBIO_AI_LOG' ) && KUBIO_AI_LOG ) {
33 $tabs = array_merge(
34 $tabs,
35 array(
36 'ai-logs' => array(
37 'type' => 'page',
38 'label' => 'Kubio AI Logs',
39 'tab-partial' => __DIR__ . '/partials/log.php',
40 'subtitle' => 'Kubio AI internal logs' . '<br/>' . sprintf( 'Cloud URL: %s', preg_replace( '#\?(.*)#', '', Utils::getCloudURL() ) ),
41 ),
42 )
43 );
44 }
45
46 return $tabs;
47 }
48 );
49
50 add_action(
51 'wp_ajax_kubio_clear_ai_logs',
52 function () {
53 // phpcs:ignore WordPress.Security.NonceVerification
54 $nonce = Arr::get( $_REQUEST, '_wpnonce', '' );
55 if ( ! wp_verify_nonce( $nonce, 'kubio_clear_ai_logs' ) ) {
56 wp_die(
57 esc_html__( 'Unauthorized', 'kubio' ),
58 esc_html__( 'Unauthorized', 'kubio' ),
59 array(
60 'response' => 401,
61 )
62 );
63 }
64
65 $logs_file = FileLog::get_log_files( 'AI' );
66
67 foreach ( $logs_file as $file ) {
68 wp_delete_file( $file );
69 }
70
71 wp_redirect( wp_get_referer() );
72 exit();
73 }
74 );
75