| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
/** |
| 6 |
* These are the Admin pages associated with the Datafeedr API plugin. |
| 7 |
* |
| 8 |
* These are called from their respective classes. |
| 9 |
*/ |
| 10 |
function dfrapi_setting_pages( $key = false ) { |
| 11 |
|
| 12 |
$pages = array( |
| 13 |
'dfrapi-configuration' => __( 'Configuration', 'datafeedr-api' ), |
| 14 |
'dfrapi-networks' => __( 'Networks', 'datafeedr-api' ), |
| 15 |
'dfrapi-merchants' => __( 'Merchants', 'datafeedr-api' ), |
| 16 |
'dfrapi-tools' => __( 'Tools', 'datafeedr-api' ), |
| 17 |
'dfrapi-export' => __( 'Export', 'datafeedr-api' ), |
| 18 |
'dfrapi-import' => __( 'Import', 'datafeedr-api' ), |
| 19 |
'dfrapi-account' => __( 'Account', 'datafeedr-api' ), |
| 20 |
); |
| 21 |
|
| 22 |
if ( isset( $pages[ $key ] ) ) { |
| 23 |
return $pages[ $key ]; |
| 24 |
} |
| 25 |
|
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* This stores messages to be displayed using the 'admin_notices' action. |
| 30 |
*/ |
| 31 |
function dfrapi_admin_messages( $key = false, $msg = '' ) { |
| 32 |
_deprecated_function( __FUNCTION__, '1.3.0', 'dfrapi_admin_notice()' ); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* This gets any notices set by the plugin. |
| 37 |
*/ |
| 38 |
function dfrapi_admin_notices( $key, $messages ) { |
| 39 |
_deprecated_function( __FUNCTION__, '1.3.0' ); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Button text for admin notices. |
| 44 |
*/ |
| 45 |
function dfrapi_fix_button( $url, $button_text = false ) { |
| 46 |
_deprecated_function( __FUNCTION__, '1.3.0' ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Return plan IDs & names. |
| 51 |
*/ |
| 52 |
function dfrapi_get_membership_plans(): array { |
| 53 |
return array( |
| 54 |
10300 => 'Private', |
| 55 |
10200 => 'Free', |
| 56 |
101000 => 'Starter', |
| 57 |
1025000 => 'Basic', |
| 58 |
1125000 => 'Beta Tester', |
| 59 |
10100000 => 'Professional', |
| 60 |
10250000 => 'Enterprise', |
| 61 |
30001 => 'Combo 1', |
| 62 |
30002 => 'Combo 2', |
| 63 |
30003 => 'Combo 3', |
| 64 |
); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Convert network group names to a css class name. |
| 69 |
*/ |
| 70 |
function dfrapi_group_name_to_css( $group ) { |
| 71 |
if ( is_string( $group ) ) { |
| 72 |
return strtolower( |
| 73 |
str_replace( |
| 74 |
array( " ", "-", "." ), |
| 75 |
"", |
| 76 |
$group |
| 77 |
) |
| 78 |
); |
| 79 |
} elseif ( is_array( $group ) ) { |
| 80 |
$name = str_replace( array( " ", "-", "." ), "", $group['group'] ); |
| 81 |
$type = ( $group['type'] == 'coupons' ) ? '_coupons' : ''; |
| 82 |
|
| 83 |
return strtolower( $name . $type ); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Adds global "support" content to "Help" tabs for all Datafeedr plugins. |
| 89 |
*/ |
| 90 |
function dfrapi_help_tab( $screen ) { |
| 91 |
|
| 92 |
$screen->add_help_tab( array( |
| 93 |
'id' => 'dfrapi_support_tab', |
| 94 |
'title' => __( 'Support', 'datafeedr-api' ), |
| 95 |
'content' => |
| 96 |
'<h2>' . __( "Datafeedr Support", 'datafeedr-api' ) . '</h2>' . |
| 97 |
'<p>' . sprintf( __( 'Find answers to common questions and problems in the <a href="%s?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">documentation</a> and in the <a href="%s?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">support forum</a>', 'datafeedr-api' ), DFRAPI_DOCS_URL, DFRAPI_QNA_URL ) . '. ' . __( 'For additional help, feel free to contact us using the links below.', 'datafeedr-api' ) . '</p>' . |
| 98 |
'<p><a href="' . DFRAPI_ASK_QUESTION_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" class="button button-primary" target="_blank">' . __( 'Post a Question', 'datafeedr-api' ) . '</a> (' . __( 'recommended', 'datafeedr-api' ) . ')</p>' . |
| 99 |
'<p><a href="' . DFRAPI_EMAIL_US_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" class="button" target="_blank">' . __( 'Email Us', 'datafeedr-api' ) . '</a></p>' |
| 100 |
|
| 101 |
) ); |
| 102 |
|
| 103 |
$screen->add_help_tab( array( |
| 104 |
'id' => 'dfrapi_bug_tab', |
| 105 |
'title' => __( 'Found a bug?', 'datafeedr-api' ), |
| 106 |
'content' => |
| 107 |
'<h2>' . __( "Found a bug?", 'datafeedr-api' ) . '</h2>' . |
| 108 |
'<p>' . sprintf( __( 'If you find a bug within Datafeedr, check the <a href="%s?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">Bug Reports</a> to see if it’s already been reported. Report a new bug with as much description as possible (context, screenshots, error log, etc.) Thank you!', 'datafeedr-api' ), DFRAPI_BUG_REPORTS_URL ) . '</p>' . |
| 109 |
'<p><a href="' . DFRAPI_REPORT_BUG_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" class="button button-primary" target="_blank">' . __( 'Report a bug', 'datafeedr-api' ) . '</a></p>' |
| 110 |
|
| 111 |
) ); |
| 112 |
|
| 113 |
$screen->set_help_sidebar( |
| 114 |
'<p><strong>' . __( 'For more information:', 'datafeedr-api' ) . '</strong></p>' . |
| 115 |
'<p><a href="' . DFRAPI_HOME_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">' . __( 'About Datafeedr', 'datafeedr-api' ) . '</a></p>' . |
| 116 |
'<p><a href="' . DFRAPI_KEYS_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">' . __( 'Datafeedr API Keys', 'datafeedr-api' ) . '</a></p>' |
| 117 |
); |
| 118 |
|
| 119 |
return $screen; |
| 120 |
} |
| 121 |
|