| @@ -1,7 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | + * Load AJAX related functions. | |
| 5 | + */ | |
| 6 | +require_once( DFRAPI_PATH . 'functions/ajax.php' ); | |
| 7 | + | |
| 8 | +/** | |
| 4 | 9 | * These are the Admin pages associated with the Datafeedr API plugin. |
| 5 | 10 | * |
| 6 | 11 | * These are called from their respecitive classes. |
| 7 | 12 | */ |
| @@ -23,26 +28,25 @@ | ||
| 23 | 28 | |
| 24 | 29 | } |
| 25 | 30 | |
| 26 | 31 | /** |
| 27 | - * This stores messages to be displayed using the | |
| 28 | - * 'admin_notices' action. | |
| 32 | + * This stores messages to be displayed using the 'admin_notices' action. | |
| 29 | 33 | */ |
| 30 | -function dfrapi_admin_messages( $key=false ) { | |
| 34 | +function dfrapi_admin_messages( $key = false, $msg = '' ) { | |
| 31 | 35 | |
| 32 | 36 | $messages = array( |
| 33 | 37 | |
| 34 | 38 | // User is missing 1 or more of their API Keys. |
| 35 | 39 | 'missing_api_keys' => array( |
| 36 | - 'class' => 'update-nag', | |
| 37 | - 'message' => __( 'Your Datafeedr API Keys are missing.', DFRAPI_DOMAIN ), | |
| 40 | + 'class' => 'notice notice-warning', | |
| 41 | + 'message' => __( 'Your Datafeedr API Keys are missing. ', DFRAPI_DOMAIN ), | |
| 38 | 42 | 'url' => 'admin.php?page=dfrapi', |
| 39 | - 'button_text' => __( 'Add Your API Keys', DFRAPI_DOMAIN ) | |
| 43 | + 'button_text' => __( 'Add API Keys', DFRAPI_DOMAIN ) | |
| 40 | 44 | ), |
| 41 | 45 | |
| 42 | 46 | // User is missing a network |
| 43 | 47 | 'missing_network_ids' => array( |
| 44 | - 'class' => 'update-nag', | |
| 48 | + 'class' => 'notice notice-warning', | |
| 45 | 49 | 'message' => __( 'You haven\'t selected any affiliate networks yet.', DFRAPI_DOMAIN ), |
| 46 | 50 | 'url' => 'admin.php?page=dfrapi_networks', |
| 47 | 51 | 'button_text' => __( 'Select Networks', DFRAPI_DOMAIN ) |
| 48 | 52 | ), |
| @@ -48,9 +52,9 @@ | ||
| 48 | 52 | ), |
| 49 | 53 | |
| 50 | 54 | // User is missing a merchant |
| 51 | 55 | 'missing_merchant_ids' => array( |
| 52 | - 'class' => 'update-nag', | |
| 56 | + 'class' => 'notice notice-warning', | |
| 53 | 57 | 'message' => __( 'You haven\'t selected any merchants yet.', DFRAPI_DOMAIN ), |
| 54 | 58 | 'url' => 'admin.php?page=dfrapi_merchants', |
| 55 | 59 | 'button_text' => __( 'Select Merchants', DFRAPI_DOMAIN ) |
| 56 | 60 | ), |
| @@ -56,9 +60,9 @@ | ||
| 56 | 60 | ), |
| 57 | 61 | |
| 58 | 62 | // Display message that user has used 90%+ of API requests. |
| 59 | 63 | 'usage_over_90_percent' => array( |
| 60 | - 'class' => 'update-nag', | |
| 64 | + 'class' => 'notice notice-warning', | |
| 61 | 65 | 'message' => __( 'You have used ', DFRAPI_DOMAIN ) . dfrapi_get_api_usage_percentage() . __( '% of your total Datafeedr API requests this month. ', DFRAPI_DOMAIN ), |
| 62 | 66 | 'url' => 'admin.php?page=dfrapi_account', |
| 63 | 67 | 'button_text' => __( 'View Account', DFRAPI_DOMAIN ) |
| 64 | 68 | ), |
| @@ -64,13 +68,70 @@ | ||
| 64 | 68 | ), |
| 65 | 69 | |
| 66 | 70 | // Missing affiliate IDs message. |
| 67 | 71 | 'missing_affiliate_ids' => array( |
| 68 | - 'class' => 'update-nag', | |
| 72 | + 'class' => 'notice notice-warning', | |
| 69 | 73 | 'message' => __( 'You are missing affiliate IDs. ', DFRAPI_DOMAIN ), |
| 70 | 74 | 'url' => 'admin.php?page=dfrapi_networks', |
| 71 | 75 | 'button_text' => __( 'Enter your Affiliate IDs', DFRAPI_DOMAIN ) |
| 72 | 76 | ), |
| 77 | + | |
| 78 | + // Unapproved Zanox merchant(s) message. | |
| 79 | + 'unapproved_zanox_merchants' => array( | |
| 80 | + 'class' => 'notice notice-error', | |
| 81 | + 'message' => '<strong>' . __( 'Unapproved Zanox Merchant(s):', DFRAPI_DOMAIN ) . '</strong> ' . | |
| 82 | + __( 'You have selected one or more Zanox merchants who have not approved your Adspace ID(s):<br />', DFRAPI_DOMAIN ) . | |
| 83 | + $msg . '<br /><br />' . | |
| 84 | + __( 'Please remove unapproved Zanox merchants from your ', DFRAPI_DOMAIN ) . | |
| 85 | + '<a href="' . admin_url( 'admin.php?page=dfrapi_merchants' ) . '" target="_blank">' . | |
| 86 | + __( 'Zanox merchant selection', DFRAPI_DOMAIN ) . | |
| 87 | + '</a>' . | |
| 88 | + __( ' then delete your cached API data ', DFRAPI_DOMAIN ) . | |
| 89 | + '<a href="' . admin_url( 'admin.php?page=dfrapi_tools' ) . '" target="_blank">' . | |
| 90 | + __( 'here', DFRAPI_DOMAIN ) . | |
| 91 | + '</a>.', | |
| 92 | + 'url' => '', | |
| 93 | + 'button_text' => __( '', DFRAPI_DOMAIN ) | |
| 94 | + ), | |
| 95 | + | |
| 96 | + // Unapproved Partnerize merchant(s) message. | |
| 97 | + 'unapproved_ph_merchants' => array( | |
| 98 | + 'class' => 'notice notice-error', | |
| 99 | + 'message' => '<strong>' . __( 'Unapproved Partnerize Merchant(s):', DFRAPI_DOMAIN ) . '</strong> ' . | |
| 100 | + __( 'You have selected one or more Partnerize merchants who have not approved your publisher account:<br />', | |
| 101 | + DFRAPI_DOMAIN ) . | |
| 102 | + $msg . '<br /><br />' . | |
| 103 | + __( 'Please remove unapproved Partnerize merchants from your ', DFRAPI_DOMAIN ) . | |
| 104 | + '<a href="' . admin_url( 'admin.php?page=dfrapi_merchants' ) . '" target="_blank">' . | |
| 105 | + __( 'Partnerize merchant selection', DFRAPI_DOMAIN ) . | |
| 106 | + '</a>' . | |
| 107 | + __( ' then delete your cached API data ', DFRAPI_DOMAIN ) . | |
| 108 | + '<a href="' . admin_url( 'admin.php?page=dfrapi_tools' ) . '" target="_blank">' . | |
| 109 | + __( 'here', DFRAPI_DOMAIN ) . | |
| 110 | + '</a>.', | |
| 111 | + 'url' => '', | |
| 112 | + 'button_text' => __( '', DFRAPI_DOMAIN ) | |
| 113 | + ), | |
| 114 | + | |
| 115 | + // Unapproved Effiliation merchant(s) message. | |
| 116 | + 'unapproved_effiliation_merchants' => array( | |
| 117 | + 'class' => 'notice notice-error', | |
| 118 | + 'message' => '<strong>' . __( 'Unapproved Effiliation Merchant(s):', DFRAPI_DOMAIN ) . '</strong> ' . | |
| 119 | + __( 'You have selected one or more Effiliation merchants who have not approved your publisher account:<br />', | |
| 120 | + DFRAPI_DOMAIN ) . | |
| 121 | + $msg . '<br /><br />' . | |
| 122 | + __( 'Please remove unapproved Effiliation merchants from your ', DFRAPI_DOMAIN ) . | |
| 123 | + '<a href="' . admin_url( 'admin.php?page=dfrapi_merchants' ) . '" target="_blank">' . | |
| 124 | + __( 'Effiliation merchant selection', DFRAPI_DOMAIN ) . | |
| 125 | + '</a>' . | |
| 126 | + __( ' then delete your cached API data ', DFRAPI_DOMAIN ) . | |
| 127 | + '<a href="' . admin_url( 'admin.php?page=dfrapi_tools' ) . '" target="_blank">' . | |
| 128 | + __( 'here', DFRAPI_DOMAIN ) . | |
| 129 | + '</a>.', | |
| 130 | + 'url' => '', | |
| 131 | + 'button_text' => __( '', DFRAPI_DOMAIN ) | |
| 132 | + ), | |
| 133 | + | |
| 73 | 134 | ); |
| 74 | 135 | |
| 75 | 136 | if ( isset( $messages[$key] ) ) { |
| 76 | 137 | dfrapi_admin_notices( $key, $messages ); |
| @@ -105,14 +166,18 @@ | ||
| 105 | 166 | * Return plan IDs & names. |
| 106 | 167 | */ |
| 107 | 168 | function dfrapi_get_membership_plans() { |
| 108 | 169 | return array( |
| 109 | - 10200 => 'Free', | |
| 110 | - 101000 => 'Starter', | |
| 111 | - 1025000 => 'Basic', | |
| 112 | - 1125000 => 'Beta Tester', | |
| 113 | - 10100000 => 'Professional', | |
| 114 | - 10250000 => 'Enterprise', | |
| 170 | + 10300 => 'Private', | |
| 171 | + 10200 => 'Free', | |
| 172 | + 101000 => 'Starter', | |
| 173 | + 1025000 => 'Basic', | |
| 174 | + 1125000 => 'Beta Tester', | |
| 175 | + 10100000 => 'Professional', | |
| 176 | + 10250000 => 'Enterprise', | |
| 177 | + 30001 => 'Combo 1', | |
| 178 | + 30002 => 'Combo 2', | |
| 179 | + 30003 => 'Combo 3', | |
| 115 | 180 | ); |
| 116 | 181 | } |
| 117 | 182 | |
| 118 | 183 | /** |
| @@ -143,9 +208,9 @@ | ||
| 143 | 208 | 'id' => 'dfrapi_support_tab', |
| 144 | 209 | 'title' => __( 'Support', DFRAPI_DOMAIN ), |
| 145 | 210 | 'content' => |
| 146 | 211 | '<h2>' . __( "Datafeedr Support", DFRAPI_DOMAIN ) . '</h2>' . |
| 147 | - '<p>' . sprintf(__( 'If you have a question or a problem, please search the <a href="%s?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">documentation</a> and the <a href="%s?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">support forums</a>', DFRAPI_DOMAIN ), DFRAPI_DOCS_URL, DFRAPI_QNA_URL ) . '. ' . __( 'If you are still unable to find an answer feel free to contact us using the links below.', DFRAPI_DOMAIN ) . '</p>' . | |
| 212 | + '<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>', DFRAPI_DOMAIN ), DFRAPI_DOCS_URL, DFRAPI_QNA_URL ) . '. ' . __( 'For additional help, feel free to contact us using the links below.', DFRAPI_DOMAIN ) . '</p>' . | |
| 148 | 213 | '<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', DFRAPI_DOMAIN ) . '</a> (' . __( 'recommended', DFRAPI_DOMAIN ) . ')</p>' . |
| 149 | 214 | '<p><a href="' . DFRAPI_EMAIL_US_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" class="button" target="_blank">' . __( 'Email Us', DFRAPI_DOMAIN ) . '</a></p>' |
| 150 | 215 | |
| 151 | 216 | ) ); |
| @@ -154,9 +219,9 @@ | ||
| 154 | 219 | 'id' => 'dfrapi_bug_tab', |
| 155 | 220 | 'title' => __( 'Found a bug?', DFRAPI_DOMAIN ), |
| 156 | 221 | 'content' => |
| 157 | 222 | '<h2>' . __( "Found a bug?", DFRAPI_DOMAIN ) . '</h2>' . |
| 158 | - '<p>' . sprintf( __( 'If you find a bug within Datafeedr please see if it\'s already been reported in <a href="%s?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">Bug Reports</a>. If it\'s a new bug, please be as descriptive as possible when reporting a bug.', DFRAPI_DOMAIN ), DFRAPI_BUG_REPORTS_URL ) . '</p>' . | |
| 223 | + '<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!', DFRAPI_DOMAIN ), DFRAPI_BUG_REPORTS_URL ) . '</p>' . | |
| 159 | 224 | '<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', DFRAPI_DOMAIN ) . '</a></p>' |
| 160 | 225 | |
| 161 | 226 | ) ); |
| 162 | 227 | |
| @@ -162,9 +227,9 @@ | ||
| 162 | 227 | |
| 163 | 228 | $screen->set_help_sidebar( |
| 164 | 229 | '<p><strong>' . __( 'For more information:', DFRAPI_DOMAIN ) . '</strong></p>' . |
| 165 | 230 | '<p><a href="' . DFRAPI_HOME_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">' . __( 'About Datafeedr', DFRAPI_DOMAIN ) . '</a></p>' . |
| 166 | - '<p><a href="' . DFRAPI_HOME_URL . '/keys?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">' . __( 'Datafeedr API Keys', DFRAPI_DOMAIN ) . '</a></p>' | |
| 231 | + '<p><a href="' . DFRAPI_KEYS_URL . '?utm_source=plugin&utm_medium=link&utm_campaign=helptab" target="_blank">' . __( 'Datafeedr API Keys', DFRAPI_DOMAIN ) . '</a></p>' | |
| 167 | 232 | ); |
| 168 | 233 | |
| 169 | 234 | return $screen; |
| 170 | 235 | } |