array( 'name' => 'ASAP Notes', // The plugin name. 'slug' => 'asap-notes', // The plugin slug (typically the folder name). 'source' => get_template_directory() . '/addons/asap-notes.zip', // The plugin source. 'url' => 'www.themeasap.com/add-ons/asap-notes', 'short_description' => 'A simple plugin to add notes on your ThemeASAP themes', 'author' => 'ibenic', 'type' => 'bundle', ), ); } function bloatless_get_recommended_plugins() { return array( 'siteorigin-panels', 'woocommerce', ); } function bloatless_theme_addons_page() { require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); $currentTab = 'recommended'; if ( isset( $_GET['tab'] ) ) { $currentTab = $_GET['tab']; } ?>

' . __( 'This plugins are all the plugins that came bundled within the theme BloatLess', 'bloatless' ) . '

'; $plugins = bloatless_get_bundled_plugins(); if ( isset( $_GET['type'] ) && $_GET['type'] == 'bundle' && isset( $_GET['action'] ) && $_GET['action'] == 'install' ) { if ( ! class_exists( 'Plugin_Upgrader', false ) ) { require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; } $thePluginFile = null; foreach ( $plugins as $plugin ) { if ( $plugin['slug'] == $_GET['plugin'] ) { $thePluginFile = $plugin['source']; } } if ( $thePluginFile ) { $pluginUpgrader = new Plugin_Upgrader(); echo '
'; echo '
'; $pluginUpgrader->install( $thePluginFile ); echo '
'; echo '
'; } } bloatless_list_plugins( $plugins, $currentTab ); } if ( $currentTab == 'ibenic' ) { echo '

' . sprintf( __( 'See all the plugins from the author %s', 'bloatless' ), 'Igor Benic' ) . '

'; $plugins = plugins_api( 'query_plugins', array( 'author' => 'ibenic', 'fields' => array( 'last_updated' => true, 'icons' => true, 'active_installs' => true, ), ) ); bloatless_list_plugins( $plugins->plugins, $currentTab ); } if ( $currentTab == 'recommended' ) { echo '

Recommended Plugins for this theme

'; $recommended = bloatless_get_recommended_plugins(); $plugins = array(); foreach ( $recommended as $value ) { $plugins[] = plugins_api( 'plugin_information', array( 'slug' => $value, 'fields' => array( 'last_updated' => true, 'icons' => true, 'active_installs' => true, ), ) ); } bloatless_list_plugins( $plugins, $currentTab ); } ?>
' . __( 'Install Now', 'bloatless' ) . ''; } break; case 'update_available': if ( $status['url'] ) { /* translators: 1: Plugin name and version */ $action_links[] = '' . __( 'Update Now', 'bloatless' ) . ''; } break; case 'latest_installed': case 'newer_installed': $action_links[] = '' . _x( 'Installed', 'plugin', 'bloatless' ) . ''; break; } if ( bloatless_is_plugin_install( $file ) ) { if ( is_plugin_active( $file ) ) { $action_links[] = '' . __( 'Deactivate Now', 'bloatless' ) . ''; } else { $action_links[] = '' . __( 'Activate Now', 'bloatless' ) . ''; } } } else { if ( bloatless_is_plugin_install( $file ) ) { if ( is_plugin_active( $file ) ) { $action_links[] = '' . __( 'Deactivate Now', 'bloatless' ) . ''; } else { $action_links[] = '' . __( 'Activate Now', 'bloatless' ) . '' ; } } else { if ( $plugin['url'] ) { if ( isset( $plugin['type'] ) && $plugin['type'] == 'bundle' ) { $action_links[] = '' . __( 'Install Now', 'bloatless' ) . ''; } else { $action_links[] = '' . __( 'Buy Now', 'bloatless' ) . ''; } } } } // $action_links[] = $file; } return $action_links; } function bloatless_is_plugin_install( $plugin ) { $installed_plugins = get_plugins(); return isset( $installed_plugins[ $plugin ] ); } function bloatless_list_plugins( $add_ons, $tab = '' ) { if ( ! is_array( $add_ons ) || sizeof( $add_ons ) == 0 ) { printf( '

%s

', __( 'No add-ons found', 'bloatless' ) ); return false; } echo ''; } ?>

By %s', 'bloatless' ), $add_on['author'] ); ?>

$add_on['rating'], 'type' => 'percent', 'number' => $add_on['num_ratings'] ) ); ?> ()
= 1000000 ) { $active_installs_text = _x( '1+ Million', 'Active plugin installs', 'bloatless' ); } else { $active_installs_text = number_format_i18n( $add_on['active_installs'] ) . '+'; } printf( __( '%s Active Installs', 'bloatless' ), $active_installs_text ); ?>
' ) ) { echo '' . __( 'Untested with your version of WordPress', 'bloatless' ) . ''; } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $add_on['requires'] ) ), $add_on['requires'], '<' ) ) { echo '' . __( 'Incompatible with your version of WordPress', 'bloatless' ) . ''; } else { echo '' . __( 'Compatible with your version of WordPress', 'bloatless' ) . ''; } ?>
'; }