/** * Load the remote installer on our setting page only. * * @updated 3.1 */ public function remote_install_client() { if (!CL_Common::is_settings_page()) { return; } if (!class_exists('CL_Remote_Install_Client')) { require_once trailingslashit(CUSTOM_LOGIN_DIR) . 'includes/libraries/edd-remote-install-client/EDD_Remote_Install_Client.php'; } $cl_remote_install_client = new CL_Remote_Install_Client(trailingslashit(CUSTOM_LOGIN_API_URL) . 'edd-sl-api/', 'settings_page_custom-login/extensions', array('skipplugincheck' => 0, 'url' => home_url())); }
/** * 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; } }