id != 'settings_page_options' ) ) ) {
echo '
';
$screen = get_current_screen();
}
}
add_action( 'admin_notices', 'occ_show_admin_messages' );
/**
* Add Settings link to plugin list
*
* Add a Settings link to the options listed against this plugin
*
* @since 1.0
*
* @param string $links Current links
* @param string $file File in use
* @return string Links, now with settings added
*/
function occ_add_settings_link( $links, $file ) {
static $this_plugin;
if ( !$this_plugin ) { $this_plugin = plugin_basename( __FILE__ ); }
if ( strpos( $file, 'artiss-currency-converter.php' ) !== false ) {
$settings_link = '' . __( 'Settings', 'artiss-currency-converter' ) . '';
array_unshift( $links, $settings_link );
}
return $links;
}
add_filter( 'plugin_action_links', 'occ_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 occ_set_plugin_meta( $links, $file ) {
if ( strpos( $file, 'artiss-currency-converter.php' ) !== false ) { $links = array_merge( $links, array( '' . __( 'Support', 'artiss-currency-converter' ) . '' ) ); }
return $links;
}
add_filter( 'plugin_row_meta', 'occ_set_plugin_meta', 10, 2 );
/**
* Administration Menu
*
* Add a new option to the Admin menu and context menu
*
* @since 1.0
*
* @uses occ_help Return help text
*/
function occ_menu() {
// Add options sub-menu
global $occ_options_hook;
$occ_options_hook = add_submenu_page( 'options-general.php', __( 'Open Currency Converter Options', 'artiss-currency-converter' ), __( 'Open Currency', 'artiss-currency-converter' ), 'install_plugins', 'options', 'occ_options' );
add_action( 'load-' . $occ_options_hook, 'occ_add_options_help' );
// Add rates sub-menu
global $occ_rates_hook;
$occ_rates_hook = add_submenu_page( 'tools.php', __( 'Open Currency Converter Rates', 'artiss-currency-converter' ), __( 'Currency Rates', 'artiss-currency-converter' ), 'edit_posts', 'rates', 'occ_rates' );
add_action( 'load-' . $occ_rates_hook, 'occ_add_rates_help' );
}
add_action( 'admin_menu','occ_menu' );
/**
* Add Options Help
*
* Add help tab to options screen
*
* @since 1.0
*
* @uses occ_options_help Return help text
*/
function occ_add_options_help() {
global $occ_options_hook;
$screen = get_current_screen();
if ( $screen->id != $occ_options_hook ) { return; }
$screen -> add_help_tab( array( 'id' => 'options-help-tab', 'title' => __( 'Help', 'artiss-currency-converter' ), 'content' => occ_options_help() ) );
}
/**
* Add Rates Help
*
* Add help tab to exchange rates screen
*
* @since 1.0
*
* @uses occ_search_help Return help text
*/
function occ_add_rates_help() {
global $occ_rates_hook;
$screen = get_current_screen();
if ( $screen->id != $occ_rates_hook ) { return; }
$screen -> add_help_tab( array( 'id' => 'rates-help-tab', 'title' => __( 'Help', 'artiss-currency-converter' ), 'content' => occ_rates_help() ) );
}
/**
* Options screen
*
* Define an option screen
*
* @since 1.0
*/
function occ_options() {
include_once( plugin_dir_path( __FILE__ ) . 'options.php' );
}
/**
* Rates screen
*
* Define the exchange rates screen
*
* @since 1.0
*/
function occ_rates() {
include_once( WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), '', plugin_basename( __FILE__ ) ) . 'rates.php' );
}
/**
* Options Help
*
* Return help text for options screen
*
* @since 1.0
*
* @return string Help Text
*/
function occ_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.", 'artiss-currency-converter' ) . '
';
$help_text .= '' . __( "Before you can begin, though, you need to specify an API Key - get one here for free!", 'artiss-currency-converter' ) . '
';
$help_text .= '' . __( 'When that\'s all done you can also set caching times - 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.', 'artiss-currency-converter' ) . '
';
return $help_text;
}
/**
* Rates Help
*
* Return help text for exchange rates screen
*
* @since 1.0
*
* @return string Help Text
*/
function occ_rates_help() {
$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.', 'artiss-currency-converter' ) . '
';
$help_text .= '' . __( 'You can also perform a currency conversion from this screen too using the options at the very top.', 'artiss-currency-converter' ) . '
';
return $help_text;
}
?>