define_constants(); $this->hooks(); $this->includes(); do_action( 'wpgetapi_loaded' ); } /** * Define Constants. * @since 1.0.0 */ private function define_constants() { $this->define( 'WPGETAPIDIR',plugin_dir_path( __FILE__ ) ); $this->define( 'WPGETAPIURL',plugin_dir_url( __FILE__ ) ); $this->define( 'WPGETAPIBASENAME', plugin_basename( __FILE__ ) ); $this->define( 'WPGETAPIVERSION', $this->version ); $this->define( 'WPGETAPILICENSEPAGE', 'wpgetapi_plugin_licenses' ); $this->define( 'WPGETAPISTOREURL', 'https://wpgetapi.com' ); } /** * Define hooks. * @since 1.4.2 */ private function hooks() { $plugin_file = WPGETAPIBASENAME; add_filter( "plugin_action_links_{$plugin_file}", array( $this, 'plugin_action_links' ), 10, 4 ); add_filter( 'plugin_row_meta', array( $this, 'filter_plugin_row_meta' ), 10, 4 ); } /** * Define constant if not already set. * @since 1.0.0 */ private function define( $name, $value ) { if ( ! defined( $name ) ) { define( $name, $value ); } } /** * Include required files. * @since 1.0.0 */ public function includes() { require_once ( WPGETAPIDIR . '/lib/cmb2/init.php' ); require_once ( WPGETAPIDIR . '/includes/block-editor/block-editor.php' ); include_once ( WPGETAPIDIR . 'includes/class-encryption.php' ); include_once ( WPGETAPIDIR . 'includes/class-admin-options.php' ); include_once ( WPGETAPIDIR . 'includes/functions.php' ); include_once ( WPGETAPIDIR . 'includes/class-enqueues.php' ); include_once ( WPGETAPIDIR . 'includes/class-api.php' ); include_once ( WPGETAPIDIR . 'frontend/functions.php' ); include_once ( WPGETAPIDIR . 'includes/class-licenses.php' ); } /** * Filters the array of row meta for each plugin in the Plugins list table. * * @param array $plugin_meta An array of the plugin row's meta data. * @param string $plugin_file Path to the plugin file relative to the plugins directory. * @return array An array of the plugin row's meta data. */ function filter_plugin_row_meta( array $plugin_meta, $plugin_file ) { if ( 'wpgetapi/wpgetapi.php' !== $plugin_file ) { return $plugin_meta; } $plugin_meta[] = sprintf( '%2$s', 'https://wpgetapi.com/docs/?utm_campaign=Docs&utm_medium=plugin&utm_source=external', esc_html( 'Docs', 'wpgetapi' ) ); return $plugin_meta; } /** * Adds items to the plugin's action links on the Plugins listing screen. * * @param array $actions Array of action links. * @param string $plugin_file Path to the plugin file relative to the plugins directory. * @param mixed[] $plugin_data An array of plugin data. * @param string $context The plugin context. * @return array Array of action links. */ function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) { $new = array( 'setup' => sprintf( '%s', esc_url( admin_url( 'admin.php?page=wpgetapi_setup' ) ), esc_html__( 'API Setup', 'wpgetapi' ) ), ); return array_merge( $new, $actions ); } } /** * Run the plugin. */ function WpGetApi() { return WpGetApi::instance(); } WpGetApi();