value="yes">
awppt_get_show_only_wp() ,
'awppt_admin_folder' => AWPPT_ADMIN_FOLDER ,
'awppt_plugin_url' => AWPPT_PLUGIN_URL ,
'plugins_installed' => $plugins_installed ,
'addendio_plus_url' => $addendio_plus_url ,
'blog_language' => get_locale() ,
) );
}
//=======================================================================================================================================
// THEMES SEARCH PAGE
// only if user is admin and is on the right page, we load what we need
if(is_admin() && current_user_can('manage_options') && $hook == $awppt_themes_page ) {
//CSS
wp_enqueue_style( 'awppt-addt-css', AWPPT_PLUGIN_URL .'assets/css/addt.css' , array(), '1.0.0');
//JS
wp_enqueue_script( 'awppt_addt', AWPPT_PLUGIN_URL . 'assets/js/addt'.ADDENDIO_LITE_ENV.'.min.js',false,'1.0.0', true);
// We pass some variables to the JS app in order to improve results
$themes_installed = awppt_get_themes_installed ();
wp_localize_script('awppt_addt', 'awppt_addp_vars',
array (
'show_only_wp' => awppt_get_show_only_wp() ,
'awppt_admin_folder' => AWPPT_ADMIN_FOLDER ,
'awppt_plugin_url' => AWPPT_PLUGIN_URL ,
'themes_installed' => $themes_installed ,
'addendio_plus_url' => $addendio_plus_url,
'blog_language' => get_locale() ,
) );
}
}
function awppt_get_plugins_installed() {
//We get the list of plugins installed in order to check against the search so the user can see if
//the plugin is already installed directly in the results...
//Un-comment for debugging...
//print("
".print_r(get_plugins(),true)."
");
$all_plugins = get_plugins();
$all_plugins_keys = array_keys($all_plugins);
$plugins = array();
$loopCtr = 0;
foreach ($all_plugins as $plugin_item) {
// Get our Plugin data variables
$plugin_root_file = $all_plugins_keys[$loopCtr];
$arr = explode("/", $plugin_root_file, 2);
$plugins[] .= $arr[0];
//Uncomment for debugging if needed
/*
$slug = $arr[0];
$plugin_title = $plugin_item['Title'];
$plugin_version = $plugin_item['Version'];
$plugin_status = is_plugin_active($plugin_root_file) ? 'active' : 'inactive';
echo $loopCtr.'-'.$plugin_root_file .' - SLUG = '. $slug.' ';
*/
$loopCtr++;
}
return $plugins;
}
function awppt_get_themes_installed() {
$themes = wp_get_themes();
$theme_slugs = array_keys($themes);
return $theme_slugs;
}
//================================================================================================
// FREEMIUS RELATED FUNCTIONS
function add_fs_custom_connect_message(
$message,
$user_first_name,
$plugin_title,
$user_login,
$site_link,
$freemius_link
) {
return sprintf(
__fs( 'hey-x' ) . ' ' .
__( 'In order to enjoy all our features and functionality, %s needs to connect your user, %s at %s, to %s', 'addendio' ),
$user_first_name,
'' . $plugin_title . '',
'' . $user_login . '',
$site_link,
$freemius_link
);
}
add_fs()->add_filter('connect_message', 'add_fs_custom_connect_message', 10, 6);
function add_fs_connect_message_on_update (
$message,
$user_first_name,
$plugin_title,
$user_login,
$site_link,
$freemius_link
) {
return sprintf(
__fs( 'hey-x' ) . ' ' .
__( 'We added a few tricks, please help us improve, %s needs to connect your user, %s at %s, to %s', 'addendio' ),
$user_first_name,
'' . $plugin_title . '',
'' . $user_login . '',
$site_link,
$freemius_link
);
}
add_fs()->add_filter('connect_message_on_update ', 'add_fs_connect_message_on_update', 10, 6);