plugin_exists() ) { echo "

" . esc_html( apply_filters( 'titan_checker_installation_notice', __( 'Titan Framework needs to be installed.', 'default' ) ) ) . sprintf( " %s", esc_url( admin_url( 'plugin-install.php?tab=search&type=term&s=titan+framework' ) ), esc_html( apply_filters( 'titan_checker_search_plugin_notice', __( 'Click here to search for the plugin.', 'default' ) ) ) ) . '

'; // If the class doesn't exist, the plugin is inactive. Throw admin notice to activate plugin. } else if ( ! class_exists( apply_filters( 'tf_framework_checker_titan_class', self::TITAN_CLASS ) ) ) { echo "

" . esc_html( apply_filters( 'titan_checker_activation_notice', __( 'Titan Framework needs to be activated.', 'default' ) ) ) . sprintf( " %s", esc_url( admin_url( 'plugins.php' ) ), esc_html( apply_filters( 'titan_checker_activate_plugin_notice', __( 'Click here to go to the plugins page and activate it.', 'default' ) ) ) ) . '

'; } } /** * Checks the existence of Titan Framework in the list of plugins. * It uses the slug path of the plugin for checking. * * @since 1.6 * * @return boolean True if Titan Framework is installed (even if not activated). */ public function plugin_exists() { // Required function as it is only loaded in admin pages. require_once ABSPATH . 'wp-admin/includes/plugin.php'; // Get all plugins, activated or not. $plugins = get_plugins(); // Check plugin existence by checking if the name is registered as an array key. get_plugins collects all plugin path into arrays. foreach ( $plugins as $slug => $plugin ) { $search_regex = apply_filters( 'tf_framework_checker_regex', self::SEARCH_REGEX ); if ( preg_match( $search_regex, $slug, $matches ) ) { return true; } } return false; } /** * Includes Titan Framework in TGM Plugin Activation if it's available. * * @since 1.7.4 * * @return void * * @see http://tgmpluginactivation.com/ * * @codeCoverageIgnore */ public function tgm_plugin_activation_include() { if ( function_exists( 'tgmpa' ) ) { tgmpa( array( array( 'name' => 'Titan Framework', 'slug' => self::PLUGIN_SLUG, 'required' => true, ), ) ); } } } new TitanFrameworkChecker(); }