Ejemplo n.º 1
0
/**
 * Update the list of the registered users currently in session.
 *
 * Useful when you are removing users and need the list of the remaining users.
 *
 * @param  array   $logged_in_users List of registered users currently in session.
 * @return boolean                  Either TRUE or FALSE representing the success or fail of the operation.
 */
function sucuriscan_save_online_users($logged_in_users = array())
{
    $expiration = 30 * 60;
    if (SucuriScan::is_multisite()) {
        return set_site_transient('online_users', $logged_in_users, $expiration);
    } else {
        return set_transient('online_users', $logged_in_users, $expiration);
    }
}
Ejemplo n.º 2
0
 /**
  * Generate an URL pointing to the page indicated in the function and that must
  * be loaded through the administrator panel.
  *
  * @param  string  $page Short name of the page that will be generated.
  * @param  boolean $ajax True if the URL should point to the Ajax handler.
  * @return string        Full string containing the link of the page.
  */
 public static function getUrl($page = '', $ajax = false)
 {
     $suffix = $ajax === true ? 'admin-ajax' : 'admin';
     $url_path = SucuriScan::admin_url($suffix . '.php?page=sucuriscan');
     if (!empty($page)) {
         $url_path .= '_' . strtolower($page);
     }
     if (SucuriScan::is_multisite()) {
         $url_path = str_replace('wp-admin/network/admin-ajax.php', 'wp-admin/admin-ajax.php', $url_path);
     }
     return $url_path;
 }