' . __( 'Github', 'artiss-transient-cleaner' ) . '' ) ); $links = array_merge( $links, array( '' . __( 'Support', 'artiss-transient-cleaner' ) . '' ) ); } return $links; } add_filter( 'plugin_row_meta', 'tc_set_plugin_meta', 10, 2 ); /** * Add Settings link to plugin list * * Add a Settings link to the options listed against this plugin * * @since 1.3 * * @param string $links Current links * @param string $file File in use * @return string Links, now with settings added */ function tc_add_settings_link( $links, $file ) { static $this_plugin; if ( !$this_plugin ) { $this_plugin = plugin_basename( __FILE__ ); } global $_wp_using_ext_object_cache; if ( defined( 'TC_LITE' ) && TC_LITE ) { $lite = true; } else { $lite = false; } if ( !$_wp_using_ext_object_cache && !$lite && strpos( $file, 'artiss-transient-cleaner.php' ) !== false ) { $settings_link = '' . __( 'Settings', 'artiss-transient-cleaner' ) . ''; array_unshift( $links, $settings_link ); } return $links; } add_filter( 'plugin_action_links', 'tc_add_settings_link', 10, 2 ); /** * Show Admin Messages * * Display messages on the administration screen * * @since 1.2 * */ function tc_show_admin_messages() { global $_wp_using_ext_object_cache; if ( $_wp_using_ext_object_cache ) { echo '

' . __( 'An external object cache is in use so Transient Cleaner is not required. Please disable the plugin.', 'artiss-transient-cleaner' ) . '

'; } global $wp_version; if ( version_compare( $wp_version, '4.9', '>=' ) ) { echo '

' . __( 'Transient housekeeping is now part of WordPress core, as of version 4.9. Please disable the Transient Cleaner plugin.', 'artiss-transient-cleaner' ) . '

'; } } add_action( 'admin_notices', 'tc_show_admin_messages' ); /** * Admin Screen Initialisation * * Set up admin menu * * @since 1.2 */ function tc_menu_initialise() { global $_wp_using_ext_object_cache; if ( defined( 'TC_LITE' ) && TC_LITE ) { $lite = true; } else { $lite = false; } if ( !$_wp_using_ext_object_cache && !$lite ) { // Add submenu to tools menu global $tc_options_hook; $tc_options_hook = add_submenu_page( 'tools.php', __( 'Transient Cleaner Options', 'artiss-transient-cleaner' ), __( 'Transient Cleaner', 'artiss-transient-cleaner' ), 'install_plugins', 'transient-options', 'tc_options' ); add_action( 'load-' . $tc_options_hook, 'tc_add_options_help' ); } } add_action( 'admin_menu', 'tc_menu_initialise' ); /** * Include options screen * * XHTML screen to prompt and update settings * * @since 1.2 */ function tc_options() { include_once( plugin_dir_path( __FILE__ ) . 'options-general.php' ); } /** * Add Options Help * * Add help tab to options screen * * @since 1.2 * * @uses tc_options_help Return help text */ function tc_add_options_help() { global $tc_options_hook; $screen = get_current_screen(); if ( $screen->id !== $tc_options_hook ) { return; } $screen -> add_help_tab( array( 'id' => 'tc-options-help-tab', 'title' => __( 'Help', 'artiss-transient-cleaner' ), 'content' => tc_options_help() ) ); $screen -> set_help_sidebar( tc_options_sidebar() ); } /** * Options Help * * Return help text for options screen * * @since 1.2 * * @return string Help Text */ function tc_options_help() { $help_text = '

' . __( 'This screen allows you to specify the default options for the Transient Cleaner plugin.', 'artiss-transient-cleaner' ) . '

'; $help_text .= '

' . __( "In addition, details of recent transient cleans are shown. Tick the 'Run Now' options to perform a clean, whether a full removal of transients or just the removal of expired transients.", 'artiss-transient-cleaner' ) . '

'; $help_text .= '

' . __( 'Remember to click the Save Changes button at the bottom of the screen for new settings to take effect.', 'artiss-transient-cleaner' ) . '

'; return $help_text; } /** * Options Help Sidebar * * Add a links sidebar to the options help * * @since 1.5 * * @return string Help Text */ function tc_options_sidebar() { $help_text = '

' . __( 'For more information:', 'artiss-transient-cleaner' ) . '

'; $help_text .= '

' . __( 'Instructions', 'artiss-transient-cleaner' ) . '

'; $help_text .= '

' . __( 'Support Forum', 'artiss-transient-cleaner' ) . '

'; return $help_text; }