plugins_url( 'resources/js/admin.js' ), array( 'jquery' ) ); } public function admin_menu() { add_options_page( _x( 'Unit Converter', 'admin menu', 'another-unit-converter' ), _x( 'Another Unit Converter', 'admin menu', 'another-unit-converter' ), 'manage_options', 'aucp_settings', array( $this, 'settings_page' ) ); } public function settings_page() { echo '
'; echo '

' . get_admin_page_title() . '

'; echo '
'; settings_fields( 'aucp_settings' ); do_settings_sections( 'aucp_settings' ); submit_button(); echo '
'; echo '
'; } public function plugin_row_meta( $links, $file ) { if ( false !== strpos( $file, 'another-unit-converter.php' ) ) { $links['settings'] = '' . _x( 'Plugin Settings', 'plugins page', 'another-unit-converter' ) . ''; } return $links; } public function maybe_show_api_key_notice( $hook ) { global $pagenow; if ( empty( $pagenow ) || ! current_user_can( 'manage_options' ) ) { return; } $api_key = AUCP()->settings->get_option( 'currencylayer_key' ); if ( ! empty( $api_key ) ) { return; } $on_settings_page = 'options-general.php' == $pagenow && ! empty( $_GET['page'] ) && $_GET['page'] == 'aucp_settings'; $on_plugins_page = 'plugins.php' == $pagenow; if ( $on_settings_page ) { echo '

'; _e( 'Another Unit Converter requires a currencylayer API key to work properly. Obtaining an API key from currencylayer is completely FREE.', 'another-unit-converter' ); echo '

'; echo '' . __( 'What is currencylayer?', 'another-unit-converter' ) . ''; echo '
'; echo str_replace( array( '', '', '', '' ), array( '', '', '', '' ), __( 'currencylayer is a service that provides real-time and historical exchange rates for 168 world currencies. You can read more about currencylayer here.', 'another-unit-converter' ) ); echo '

'; echo '' . __( 'Why do I need an API key?', 'another-unit-converter' ) . ''; echo '
'; _e( 'Another Unit Converter uses the currencylayer API to download updated daily rates for the supported currencies, and then perform the conversions that you see on your posts and pages using this information.', 'another-unit-converter' ); echo '

'; echo '' . __( 'How do I sign-up for and use the currencylayer API key?', 'another-unit-converter' ) . ''; echo '
'; echo '

    '; echo '
  1. '; echo str_replace( '', '', __( 'Visit the currencylayer sign-up page and fill out the form.', 'another-unit-converter' ) ); echo '
  2. '; echo '
  3. ' . __( 'After submitting the form, you\'ll be redirected to a page with the API key on it.', 'another-unit-converter' ) . '
  4. '; echo '
  5. '; echo str_replace( '', '', __( 'Copy-paste your API key inside the text field below and save the changes.', 'another-unit-converter' ) ); echo '
  6. '; echo '
  7. ' . __( 'You\'re all set. Enjoy currency detection and conversion on all your posts and pages.', 'another-unit-converter' ) . '
  8. '; echo '
'; echo '

'; } if ( $on_plugins_page && ! get_user_meta( get_current_user_id(), 'dismissed_aucp_api_key_notice', true ) ) { echo '
'; echo '

'; echo str_replace( array( '', '' ), array( '', '' ), __( 'Another Unit Converter requires an API key from currencylayer.com to operate. Currency conversion will remain disabled until an API key is entered.', 'another-unit-converter' ) ); echo '
'; echo ''; _e( 'Click here for more details.', 'another-unit-converter' ); echo ''; echo '

'; echo '
'; } } public function dismiss_api_key_notice() { update_user_meta( get_current_user_id(), 'dismissed_aucp_api_key_notice', true ); } }