PluginProbe
Datafeedr API / 1.4.3
Datafeedr API v1.4.3
1.4.3 1.4.2 1.0.125 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.3 1.0.30 1.0.31 1.0.32 All 182 releases
datafeedr-api / hooks / admin / interface.php

interface.php in Datafeedr API 1.4.3, at hooks/admin/interface.php

73 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 /**
6 * Includes HelpScout Beacon if enabled and if on a Datafeedr-specific page.
7 *
8 * @since 1.0.84
9 */
10 function dfrapi_include_helpscout_beacon() {
11
12 $options = get_option( 'dfrapi_configuration', [] );
13
14 if ( isset( $options['hs_beacon'] ) && 'off' === $options['hs_beacon'] ) {
15 return;
16 }
17
18 if ( ! dfrapi_is_datafeedr_admin_page() ) {
19 return;
20 }
21
22 // Only load the third-party Beacon script for users who manage the plugin.
23 if ( ! current_user_can( 'manage_options' ) ) {
24 return;
25 }
26
27 include_once DFRAPI_PATH . 'js/helpscout-beacon.php';
28 }
29
30 add_action( 'admin_footer', 'dfrapi_include_helpscout_beacon' );
31
32 /**
33 * Add link to Configuration page to action links on Plugins page.
34 *
35 * @param array $links
36 *
37 * @return array
38 */
39 function dfrapi_add_plugin_action_links( array $links ): array {
40 return array_merge(
41 $links,
42 [
43 'config' => sprintf
44 (
45 '<a href="%1$s">%2$s</a>',
46 dfrapi_configuration_page_url(),
47 __( 'Configuration', 'datafeedr-api' )
48 )
49 ]
50 );
51 }
52
53 add_filter( 'plugin_action_links_' . DFRAPI_BASENAME, 'dfrapi_add_plugin_action_links' );
54
55 /**
56 * Add links to Documentation and Contact page to meta row on Plugins page.
57 *
58 * @param array $links
59 * @param string $plugin_file
60 *
61 * @return array
62 */
63 function dfrapi_add_plugin_row_meta( array $links, string $plugin_file ): array {
64 if ( $plugin_file === DFRAPI_BASENAME ) {
65 $links[] = sprintf( '<a href="' . DFRAPI_DOCS_URL . '" target="_blank" rel="noopener nofollow">%s</a>', __( 'Documentation', 'datafeedr-api' ) );
66 $links[] = sprintf( '<a href="' . DFRAPI_HELP_URL . '" target="_blank" rel="noopener nofollow">%s</a>', __( 'Support', 'datafeedr-api' ) );
67 }
68
69 return $links;
70 }
71
72 add_filter( 'plugin_row_meta', 'dfrapi_add_plugin_row_meta', 10, 2 );
73