|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* WP PHP Console |
|
4
|
|
|
* |
|
5
|
|
|
* This source file is subject to the GNU General Public License v3.0 |
|
6
|
|
|
* that is bundled with this package in the file license.txt. |
|
7
|
|
|
* It is also available through the world-wide-web at this URL: |
|
8
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
|
9
|
|
|
* |
|
10
|
|
|
* @author Fulvio Notarstefano <[email protected]> |
|
11
|
|
|
* @copyright Copyright (c) 2014-2019 Fulvio Notarstefano |
|
12
|
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace WP_PHP_Console; |
|
16
|
|
|
|
|
17
|
|
|
defined( 'ABSPATH' ) or exit; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* WP PHP Console admin handler. |
|
21
|
|
|
* |
|
22
|
|
|
* @since 1.6.0 |
|
23
|
|
|
*/ |
|
24
|
|
|
class Admin { |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Initializes the plugin admin. |
|
29
|
|
|
* |
|
30
|
|
|
* @since 1.6.0 |
|
31
|
|
|
*/ |
|
32
|
|
|
public function __construct() { |
|
33
|
|
|
|
|
34
|
|
|
// add plugin page row action links |
|
35
|
|
|
add_filter( 'plugin_action_links_wp-php-console/wp-php-console.php', static function( $actions ) { |
|
36
|
|
|
return array_merge( [ |
|
37
|
|
|
'<a href="' . esc_url( admin_url() ) . '">' . esc_html__( 'Settings', 'wp-php-console' ) . '</a>', |
|
38
|
|
|
'<a href="' . esc_url( Plugin::get_project_page_url() ) . '">' . esc_html__( 'GitHub', 'wp-php-console' ) . '</a>', |
|
39
|
|
|
'<a href="' . esc_url( Plugin::get_support_page_url() ) . '">' . esc_html__( 'Support', 'wp-php-console' ) . '</a>', |
|
40
|
|
|
'<a href="' . esc_url( Plugin::get_reviews_page_url() ) . '">' . esc_html__( 'Review', 'wp-php-console' ) . '</a>', |
|
41
|
|
|
], $actions ); |
|
42
|
|
|
} ); |
|
43
|
|
|
|
|
44
|
|
|
// init settings page |
|
45
|
|
|
if ( ! defined( 'DOING_AJAX' ) ) { |
|
46
|
|
|
new Admin\SettingsPage(); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Displays notices in admin. |
|
53
|
|
|
* |
|
54
|
|
|
* @since 1.6.0 |
|
55
|
|
|
*/ |
|
56
|
|
|
private static function output_admin_notices() { |
|
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
// display admin notice and abort if no password has been set |
|
59
|
|
|
add_action( 'admin_notices', static function() { |
|
60
|
|
|
if ( ! Settings::has_eval_terminal_password() ) : |
|
61
|
|
|
?> |
|
62
|
|
|
<div class="update-nag"> |
|
63
|
|
|
<p><?php printf( |
|
64
|
|
|
/* translators: Placeholders: %1$s - WP PHP Console name, %2$s - opening HTML <a> link tag; %3$s closing HTML </a> link tag */ |
|
65
|
|
|
__( '%1$s: Please remember to %2$sset a password%3$s if you want to enable the terminal.', 'wp-php-console' ), |
|
66
|
|
|
'<strong>' . Plugin::NAME . '</strong>', |
|
67
|
|
|
'<a href="' . esc_url( admin_url( 'options-general.php?page=wp-php-console' ) ) .'">', |
|
68
|
|
|
'</a>' |
|
69
|
|
|
); ?></p> |
|
70
|
|
|
</div> |
|
71
|
|
|
<?php |
|
72
|
|
|
endif; |
|
73
|
|
|
}, -1000 ); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
|
|
77
|
|
|
} |
|
78
|
|
|
|