' . __( 'Settings', 'currency-converter' ) . ''; array_unshift( $links, $settings_link ); } return $links; } add_filter( 'plugin_action_links', 'acc_add_settings_link', 10, 2 ); /** * Add meta to plugin details * * Add options to plugin meta line * * @since 1.0 * * @param string $links Current links * @param string $file File in use * @return string Links, now with settings added */ function acc_set_plugin_meta( $links, $file ) { if ( strpos( $file, '[plugin file name].php' ) !== false ) { $links = array_merge( $links, array( '' . __( 'Support', 'currency-converter' ) . '' ) ); $links = array_merge( $links, array( '' . __( 'Donate', 'currency-converter' ) . '' ) ); } return $links; } add_filter( 'plugin_row_meta', 'acc_set_plugin_meta', 10, 2 ); /** * Administration Menu * * Add a new option to the Admin menu and context menu * * @since 1.0 * * @uses acc_help Return help text */ function acc_menu() { // Depending on WordPress version and available functions decide which (if any) contextual help system to use $contextual_help = acc_contextual_help_type(); // Add main admin option add_menu_page( __( 'Artiss Currency Converter Settings', 'currency-converter' ), __( 'Currency', 'currency-converter' ), 'edit_posts', 'acc-options', 'acc_options', plugins_url() . '/artiss-currency-converter/images/menu_icon.png' ); // Add search sub-menu if ( $contextual_help == 'new' ) { global $acc_options_hook; } $acc_options_hook = add_submenu_page( 'acc-options', __( 'Artiss Currency Converter Options', 'currency-converter' ), __( 'Options', 'currency-converter' ), 'edit_posts', 'acc-options', 'acc_options' ); if ( $contextual_help == 'new' ) { add_action( 'load-' . $acc_options_hook, 'acc_add_options_help' ); } if ( $contextual_help == 'old' ) { add_contextual_help( $acc_options_hook, acc_options_help() ); } // Add rates sub-menu if ( $contextual_help == 'new' ) { global $acc_rates_hook; } $acc_rates_hook = add_submenu_page( 'acc-options', __( 'Artiss Currency Converter Rates', 'currency-converter' ), __( 'Rates', 'currency-converter' ), 'manage_options', 'acc-rates', 'acc_rates' ); if ( $contextual_help == 'new' ) { add_action( 'load-' . $acc_rates_hook, 'acc_add_rates_help' ); } if ( $contextual_help == 'old' ) { add_contextual_help( $acc_rates_hook, acc_rates_help() ); } // Add readme sub-menu if ( function_exists( 'wp_readme_parser' ) ) { add_submenu_page( 'acc-options', __( 'Artiss Currency Converter README', 'currency-converter' ), __( 'README', 'currency-converter' ), 'edit_posts', 'acc-readme', 'acc_readme' ); } // Add support sub-menu add_submenu_page( 'acc-options', __( 'Artiss Currency Converter Support', 'currency-converter' ), __( 'Support', 'currency-converter' ), 'edit_posts', 'acc-support', 'acc_support' ); } add_action( 'admin_menu','acc_menu' ); /** * Get contextual help type * * Return whether this WP installation requires the new or old contextual help type, or none at all * * @since 1.0 * * @return string Contextual help type - 'new', 'old' or false */ function acc_contextual_help_type() { global $wp_version; $type = false; if ( ( float ) $wp_version >= 3.3 ) { $type = 'new'; } else { if ( function_exists( 'add_contextual_help' ) ) { $type = 'old'; } } return $type; } /** * Add Options Help * * Add help tab to options screen * * @since 1.0 * * @uses acc_options_help Return help text */ function acc_add_options_help() { global $acc_options_hook; $screen = get_current_screen(); if ( $screen->id != $acc_options_hook ) { return; } $screen -> add_help_tab( array( 'id' => 'acc-options-help-tab', 'title' => __( 'Help', 'currency-converter' ), 'content' => acc_options_help() ) ); } /** * Add Rates Help * * Add help tab to exchange rates screen * * @since 1.0 * * @uses acc_search_help Return help text */ function acc_add_rates_help() { global $acc_rates_hook; $screen = get_current_screen(); if ( $screen->id != $acc_rates_hook ) { return; } $screen -> add_help_tab( array( 'id' => 'acc-rates-help-tab', 'title' => __( 'Help', 'currency-converter' ), 'content' => acc_rates_help() ) ); } /** * Options screen * * Define an option screen * * @since 1.0 */ function acc_options() { include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'acc-options.php' ); } /** * Rates screen * * Define the exchange rates screen * * @since 1.0 */ function acc_rates() { include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'acc-rates.php' ); } /** * README screen * * Define the README screen * * @since 1.0 */ function acc_readme() { include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'acc-readme.php' ); } /** * Support screen * * Define the support screen * * @since 1.0 */ function acc_support() { include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'acc-support.php' ); } /** * Options Help * * Return help text for options screen * * @since 1.0 * * @return string Help Text */ function acc_options_help() { $help_text = '
' . __( "This screen allows you to set some default options - if, when using the shortcode or function call, you don't specify a particular parameter then the default from this screen will be used.", 'currency-converter' ) . '
'; $help_text .= '' . __( 'You can also set caching times as well - this is to limit the regularity of updates to the exchange rates and currency codes. The former is updated hourly and the latter ad-hoc, so retrieving this information everytime is not required.', 'currency-converter' ) . '
'; $help_text .= '' . __( 'Use this screen to view the current exchange rates along with all the currency codes. All exchange rates are in relation to the US Dollar.', 'currency-converter' ) . '
'; $help_text .= '' . __( 'You can also perform a currency conversion from this screen.', 'currency-converter' ) . '
'; $help_text .= '' . __( 'Thank you for installing this plugin.', 'currency-converter' ) . '
'; $pointer_content .= '' . __( 'A new menu has been added to the sidebar. This will allow you to change the default options (recommended!) and see the current exchange rate information.', 'currency-converter' ); ?>