| 1 |
<?php |
| 2 |
/** |
| 3 |
* Statify: Statify_Backend class |
| 4 |
* |
| 5 |
* This file contains the derived class for the plugin's backend features. |
| 6 |
* |
| 7 |
* @package Statify |
| 8 |
* @since 1.4.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
// Quit if accessed outside WP context. |
| 12 |
defined( 'ABSPATH' ) || exit; |
| 13 |
|
| 14 |
/** |
| 15 |
* Statify_Backend |
| 16 |
* |
| 17 |
* @since 1.4.0 |
| 18 |
*/ |
| 19 |
class Statify_Backend { |
| 20 |
|
| 21 |
/** |
| 22 |
* Add plugin meta links |
| 23 |
* |
| 24 |
* @since 0.1.0 |
| 25 |
* @version 1.4.0 |
| 26 |
* |
| 27 |
* @param array $input Registered links. |
| 28 |
* @param string $file Current plugin file. |
| 29 |
* |
| 30 |
* @return array Merged links |
| 31 |
*/ |
| 32 |
public static function add_meta_link( $input, $file ) { |
| 33 |
|
| 34 |
// Other plugins? |
| 35 |
if ( STATIFY_BASE !== $file ) { |
| 36 |
return $input; |
| 37 |
} |
| 38 |
|
| 39 |
return array_merge( |
| 40 |
$input, |
| 41 |
array( |
| 42 |
'<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Donate', 'statify' ) . '</a>', |
| 43 |
'<a href="https://wordpress.org/support/plugin/statify" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Support', 'statify' ) . '</a>', |
| 44 |
) |
| 45 |
); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Add plugin action links |
| 50 |
* |
| 51 |
* @since 0.1.0 |
| 52 |
* @version 1.4.0 |
| 53 |
* |
| 54 |
* @param array $input Registered links. |
| 55 |
* |
| 56 |
* @return array Merged links |
| 57 |
*/ |
| 58 |
public static function add_action_link( $input ) { |
| 59 |
|
| 60 |
// Rights? |
| 61 |
if ( ! current_user_can( 'edit_dashboard' ) ) { |
| 62 |
return $input; |
| 63 |
} |
| 64 |
|
| 65 |
// Merge. |
| 66 |
return array_merge( |
| 67 |
$input, |
| 68 |
array( |
| 69 |
sprintf( |
| 70 |
/* @lang Disable language injection for Url query argument. */ |
| 71 |
'<a href="%s">%s</a>', |
| 72 |
add_query_arg( |
| 73 |
array( 'edit' => 'statify_dashboard#statify_dashboard' ), |
| 74 |
admin_url( '/' ) |
| 75 |
), |
| 76 |
esc_html__( 'Settings', 'statify' ) |
| 77 |
), |
| 78 |
) |
| 79 |
); |
| 80 |
} |
| 81 |
} |
| 82 |
|