$slug,
'fields' => array(
'downloaded' => false,
'rating' => false,
'description' => false,
'short_description' => true,
'donate_link' => false,
'tags' => false,
'sections' => true,
'homepage' => true,
'added' => false,
'last_updated' => false,
'compatibility' => false,
'tested' => false,
'requires' => false,
'downloadlink' => false,
'icons' => true
)
) );
set_transient( 'aglee_lite_plugin_information_transient_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
}
return $call_api;
}
public function check_active( $slug ) {
if ( file_exists( ABSPATH . 'wp-content/plugins/' . $slug . '/' . $slug . '.php' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
$needs = is_plugin_active( $slug . '/' . $slug . '.php' ) ? 'deactivate' : 'activate';
return array( 'status' => is_plugin_active( $slug . '/' . $slug . '.php' ), 'needs' => $needs );
}
return array( 'status' => false, 'needs' => 'install' );
}
public function check_for_icon( $arr ) {
if ( ! empty( $arr['svg'] ) ) {
$plugin_icon_url = $arr['svg'];
} elseif ( ! empty( $arr['2x'] ) ) {
$plugin_icon_url = $arr['2x'];
} elseif ( ! empty( $arr['1x'] ) ) {
$plugin_icon_url = $arr['1x'];
} else {
$plugin_icon_url = $arr['default'];
}
return $plugin_icon_url;
}
public function create_action_link( $state, $slug ) {
switch ( $state ) {
case 'install':
return wp_nonce_url(
add_query_arg(
array(
'action' => 'install-plugin',
'plugin' => $slug
),
network_admin_url( 'update.php' )
),
'install-plugin_' . $slug
);
break;
case 'deactivate':
return add_query_arg( array(
'action' => 'deactivate',
'plugin' => rawurlencode( $slug . '/' . $slug . '.php' ),
'plugin_status' => 'all',
'paged' => '1',
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . $slug . '/' . $slug . '.php' ),
), network_admin_url( 'plugins.php' ) );
break;
case 'activate':
return add_query_arg( array(
'action' => 'activate',
'plugin' => rawurlencode( $slug . '/' . $slug . '.php' ),
'plugin_status' => 'all',
'paged' => '1',
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $slug . '/' . $slug . '.php' ),
), network_admin_url( 'plugins.php' ) );
break;
}
}
/**
* Adds an admin notice upon successful activation.
*
* @since 1.8.2.4
*/
public function aglee_lite_activation_admin_notice() {
global $pagenow;
if ( is_admin() && ( 'themes.php' == $pagenow ) && isset( $_GET['activated'] ) ) {
add_action( 'admin_notices', array( $this, 'aglee_lite_welcome_admin_notice' ), 99 );
}
}
/**
* Display an admin notice linking to the welcome screen
*
* @since 1.8.2.4
*/
public function aglee_lite_welcome_admin_notice() {
?>