private function get_extensions() { // Save this for a latter date since our checkin for our HTML data doesn't get called on init... $ext_url = false; //add_query_arg( array( 'edd_action' => 'cl_announcements' ), trailingslashit( CUSTOM_LOGIN_API_URL ) . 'cl-checkin-api/' ); $transient_key = CL_Common::get_transient_key('extensions'); $extensions = CL_Common::wp_remote_get($ext_url, $transient_key, WEEK_IN_SECONDS, 'CustomLogin'); if ($extensions) { $this->extensions[] = $extensions->html; } else { /* Stealth Login */ $this->extensions[] = array('title' => 'Custom Login Stealth Login', 'description' => 'Protect your wp-login.php page from brute force attacks.', 'url' => 'https://frosty.media/plugins/custom-login-stealth-login/', 'image' => 'https://i.imgur.com/mhuymPG.jpg', 'links' => array(array('description' => 'Personal', 'download_id' => '108', 'price_id' => '1', 'price' => '$35'), array('description' => 'Plus', 'download_id' => '108', 'price_id' => '2', 'price' => '$95'), array('description' => 'Professional', 'download_id' => '108', 'price_id' => '3', 'price' => '$195'))); /* Page Template */ $this->extensions[] = array('title' => 'Custom Login Page Template', 'description' => 'Add a login form to any WordPress page.', 'url' => 'https://frosty.media/plugins/custom-login-page-template/', 'image' => 'https://i.imgur.com/A0rzS9q.jpg', 'links' => array(array('description' => 'Personal', 'download_id' => '120', 'price_id' => '1', 'price' => '$35'), array('description' => 'Plus', 'download_id' => '120', 'price_id' => '2', 'price' => '$95'), array('description' => 'Professional', 'download_id' => '120', 'price_id' => '3', 'price' => '$195'))); /* Login Redirects */ $this->extensions[] = array('title' => 'Custom Login Redirects', 'description' => 'Manage redirects after logging in.', 'url' => 'https://extendd.com/plugin/wordpress-login-redirects/', 'image' => 'https://i.imgur.com/aNGoyAa.jpg', 'links' => array(array('description' => 'Personal', 'download_id' => '124', 'price_id' => '1', 'price' => '$35'), array('description' => 'Plus', 'download_id' => '124', 'price_id' => '2', 'price' => '$95'), array('description' => 'Professional', 'download_id' => '124', 'price_id' => '3', 'price' => '$195'))); /* No Password */ $this->extensions[] = array('title' => 'Custom Login No Password', 'description' => 'Allow users to login without a password.', 'url' => 'https://frosty.media/plugins/custom-login-no-passowrd-login/', 'image' => 'https://i.imgur.com/7SXIpi5.jpg', 'links' => array(array('description' => 'Personal', 'download_id' => '128', 'price_id' => '1', 'price' => '$35'), array('description' => 'Plus', 'download_id' => '128', 'price_id' => '2', 'price' => '$95'), array('description' => 'Professional', 'download_id' => '128', 'price_id' => '3', 'price' => '$195'))); } // if }
/** * Show global notifications if they are allowed. * */ function show_notifications() { $is_cl_screen = CL_Common::is_settings_page(); $transient_key = CL_Common::get_transient_key('announcement'); $ignore_key = CUSTOM_LOGIN_OPTION . '_ignore_announcement'; $old_message = get_option(CUSTOM_LOGIN_OPTION . '_announcement_message'); $user_meta = get_user_meta(get_current_user_id(), $ignore_key, true); $capability = CL_Common::get_option('capability', 'general', 'manage_options'); /** delete_user_meta( get_current_user_id(), $ignore_key, 1 ); delete_transient( $transient_key ); update_option( CUSTOM_LOGIN_OPTION . '_announcement_message', '' ); //*/ // Current user can't manage options if (!current_user_can($capability)) { return; } if (!$is_cl_screen) { // Let's not show this at all if not on out menu page. @since 3.1 return; // Global notifications if ('off' === CL_Common::get_option('admin_notices', 'general', 'off')) { return; } // Make sure 'Frosty_Media_Notifications' isn't activated if (class_exists('Frosty_Media_Notifications')) { return; } } // https://raw.github.com/thefrosty/custom-login/master/extensions.json $message_url = esc_url(add_query_arg(array('edd_action' => 'cl_announcements'), trailingslashit(CUSTOM_LOGIN_API_URL) . 'cl-checkin-api/')); $announcement = CL_Common::wp_remote_get($message_url, $transient_key, DAY_IN_SECONDS, 'CustomLogin'); // Bail if errors if (is_wp_error($announcement)) { return; } // Bail if false or empty if (!$announcement || empty($announcement)) { return; } if (trim($old_message) !== trim($announcement->message) && !empty($old_message)) { delete_user_meta(get_current_user_id(), $ignore_key); delete_transient($transient_key); update_option(CUSTOM_LOGIN_OPTION . '_announcement_message', $announcement->message); } $html = '<div class="updated"><p>'; $html .= !$is_cl_screen ? sprintf('%2$s <span class="alignright">| <a href="%3$s">%1$s</a></span>', __('Dismiss', CUSTOM_LOGIN_DIRNAME), $announcement->message, esc_url(add_query_arg($ignore_key, wp_create_nonce($ignore_key), admin_url('options-general.php?page=custom-login'))), esc_url(admin_url('options-general.php?page=custom-login#custom_login_general'))) : sprintf('%s', $announcement->message); $html .= '</p></div>'; if (!$user_meta && 1 !== $user_meta || $is_cl_screen) { echo $html; } }