$version )
return;
}
} else {
$wpa_templates = array();
}
$template = array(
'name' => $template_name,
'version' => $version,
'path' => $path
);
$wpa_templates[$template_name] = $template;
return $wpa_templates;
}
}
if( !function_exists( 'wpa_load_template' ) ){
function wpa_load_template( $template_name ){
global $wpa_templates;
if( !is_array( $wpa_templates ) )
return;
if( !array_key_exists( $template_name, $wpa_templates ) )
return;
$template = $wpa_templates[$template_name];
if( !file_exists( $template['path'] ) )
return;
include_once( $template['path'] );
}
}
/* Outputs Install/activate button for plugin */
if( !function_exists( 'wpa_aw_plugin_button' ) ){
function wpa_aw_plugin_button( $slug, $plugin ){
if ( ! function_exists('is_plugin_inactive')) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}
$status = validate_plugin( $plugin );
if( is_wp_error( $status ) ){
if( array_key_exists( 'plugin_not_found', $status->errors ) ){
$action = __( '🔰 Install' );
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'install-plugin',
'plugin' => $slug
),
self_admin_url( 'update.php' )
),
'install-plugin_' . $slug
);
echo '' . $action . '';
} else {
$action = __( '❌ Error' );
}
} elseif( is_plugin_inactive( $plugin ) ){
$action = __( '💎 Activate' );
$url = wp_nonce_url(
add_query_arg(
array(
'action' => 'activate',
'plugin' => urlencode( $plugin )
),
self_admin_url( 'plugins.php' )
),
'activate-plugin_' . $plugin
);
echo '' . $action . '';
} else {
$action = __( '✔️ Installed' );
echo '' . $action . '';
}
}
}