Slug => details. */ public static function plugins() { return array( 'cartpin' => array( 'name' => 'CartPin', 'what' => __( 'Sticky add to cart bar', 'cartpin' ), 'line' => __( 'Keeps the Add to cart button on screen while shoppers scroll down a product page.', 'cartpin' ), 'settings' => 'admin.php?page=cartpin', ), 'one-click-order' => array( 'name' => 'One Click Order', 'what' => __( 'Buy Now button and quick order form', 'cartpin' ), 'line' => __( 'Shoppers skip the cart and checkout: one short form, and you get a normal WooCommerce order. Made for cash on delivery.', 'cartpin' ), 'settings' => 'admin.php?page=one-click-order', ), ); } /** * Plugin file of an installed plugin ("folder/file.php"), or '' when it is not installed. * * @param string $slug WordPress.org slug. * @return string */ public static function installed_file( $slug ) { if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } foreach ( get_plugins() as $file => $data ) { // Folder name first; the text domain also finds a copy installed under another folder name. if ( 0 === strpos( $file, $slug . '/' ) || ( isset( $data['TextDomain'] ) && $slug === $data['TextDomain'] ) ) { return $file; } } return ''; } /** * Prints the tab. */ public static function render() { $plugins = self::plugins(); unset( $plugins[ self::SELF ] ); ?>
' . esc_html__( 'Active', 'cartpin' ) . ''; echo '' . esc_html__( 'Open settings', 'cartpin' ) . ''; return; } if ( $file ) { if ( current_user_can( 'activate_plugin', $file ) ) { $url = wp_nonce_url( add_query_arg( array( 'action' => 'activate', 'plugin' => rawurlencode( $file ), ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $file ); /* translators: %s: plugin name. */ echo '' . esc_html__( 'Activate', 'cartpin' ) . ''; } else { echo ''; } return; } if ( current_user_can( 'install_plugins' ) ) { $base = is_multisite() ? 'network_admin_url' : 'admin_url'; $install = wp_nonce_url( add_query_arg( array( 'action' => 'install-plugin', 'plugin' => $slug, ), $base( 'update.php' ) ), 'install-plugin_' . $slug ); $details = add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => $slug, 'TB_iframe' => 'true', 'width' => 772, 'height' => 600, ), $base( 'plugin-install.php' ) ); /* translators: %s: plugin name. */ echo '' . esc_html__( 'Install now', 'cartpin' ) . ''; /* translators: %s: plugin name. */ echo '' . esc_html__( 'More details', 'cartpin' ) . ''; return; } echo '' . esc_html__( 'See it on WordPress.org', 'cartpin' ) . ''; } }