/** * Check if the user has opted into tracking * * @access private * @return bool */ private function tracking_allowed() { $tracking = CL_Common::get_option('tracking', 'general', false); if ('on' === $tracking) { return true; } return false; }
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 }
/** * Dashboard widget */ public function widget() { // FEED $rss_items = $this->get_feed(1, 'https://frosty.media/feed/'); $content = '<div class="rss-widget">'; $content .= '<ul>'; if (!$rss_items) { $content .= '<li>' . __('Error fetching feed', CUSTOM_LOGIN_DIRNAME) . '</li>'; } else { $count = 1; foreach ($rss_items as $key => $item) { $feed_url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), null, 'display')); $content .= '<li>'; $content .= '<a class="rsswidget" href="' . add_query_arg(array('utm_medium' => 'wpadmin_dashboard', 'utm_term' => 'newsitem', 'utm_campaign' => CUSTOM_LOGIN_DIRNAME), $feed_url) . '">' . esc_html($item->get_title()) . '</a>'; $content .= $count === 1 ? ' <span class="rss-date">' . $item->get_date(get_option('date_format')) . '</span>' : ''; $content .= $count === 1 ? '<div class="rssSummary">' . strip_tags(wp_trim_words($item->get_description(), 28)) . '</div>' : ''; $content .= '</li>'; $count++; } } $content .= '</ul>'; $content .= '</div>'; // Plugins $rss_items = CL_Common::fetch_rss_items(3, 'https://frosty.media/feed/?post_type=plugin&plugin_tag=custom-login-extension'); $content .= '<div class="rss-widget">'; $content .= '<ul>'; //$content .= '<li><strong>' . __( 'Custom Login Extensions:', CUSTOM_LOGIN_DIRNAME ) . '</strong></li>'; if (!$rss_items) { $content .= '<li>' . __('Error fetching feed', CUSTOM_LOGIN_DIRNAME) . '</li>'; } else { foreach ($rss_items as $item) { $url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), null, 'display')); $content .= '<li>'; $content .= '<a class="rsswidget" href="' . add_query_arg(array('utm_medium' => 'wpadmin_dashboard', 'utm_term' => 'newsitem', 'utm_campaign' => CUSTOM_LOGIN_DIRNAME), $url) . '">' . esc_html($item->get_title()) . '</a>'; # $content .= '<div class="rssSummary">' . strip_tags( wp_trim_words( $item->get_description(), 10 ) ) . '</div>'; $content .= '</li>'; } } $content .= '</ul>'; $content .= '</div>'; $content .= '<div class="rss-widget">'; $content .= '<ul class="social">'; $content .= '<li>'; $content .= '<a href="https://www.facebook.com/FrostyMediaWP"><span class="dashicons dashicons-facebook"></span>/FrostyMediaWP</a> | '; $content .= '<a href="https://twitter.com/Frosty_Media"><span class="dashicons dashicons-twitter"></span>/Frosty_Media</a> | '; $content .= '<a href="https://twitter.com/TheFrosty"><span class="dashicons dashicons-twitter"></span>/TheFrosty</a>'; $content .= '</li>'; $content .= '</ul>'; $content .= '</div>'; echo $content; }
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 3.0.0 */ // Exit if accessed directly if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } // Load Custom Login include_once 'custom-login.php'; include_once trailingslashit(CUSTOM_LOGIN_DIR) . 'includes/default-settings.php'; include_once trailingslashit(CUSTOM_LOGIN_DIR) . 'includes/class-cl-common.php'; // Delete all plugin options foreach ($sections as $section) { delete_option($section['id']); } // Delete user meta data $all_user_ids = get_users('fields=ID'); foreach ($all_user_ids as $user_id) { delete_user_meta($user_id, CUSTOM_LOGIN_OPTION . '_ignore_announcement'); } // Delete all announcement options and transients delete_transient(CL_Common::get_transient_key('announcement')); delete_option(CUSTOM_LOGIN_OPTION . '_announcement_message'); // Delete tracking options delete_option('custom_login_tracking_last_send'); delete_option('custom_login_hide_tracking_notice'); // Cleanup Cron Events wp_clear_scheduled_hook('custom_login_daily_scheduled_events'); wp_clear_scheduled_hook('custom_login_weekly_scheduled_events'); // Delete version option delete_option(CUSTOM_LOGIN_OPTION . '_version');
/** * 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; } }
/** * Box with latest plugins from Extendd.com for sidebar */ function sidebar_feed($args) { $defaults = array('items' => 6, 'feed' => 'https://frosty.media/feed/?post_type=plugin&plugin_tag=custom-login-extension'); $args = wp_parse_args($args, $defaults); $rss_items = CL_Common::fetch_rss_items($args['items'], $args['feed']); $content = '<ul>'; if (!$rss_items) { $content .= '<li>' . __('Error fetching feed', $this->settings['domain']) . '</li>'; } else { foreach ($rss_items as $item) { $url = preg_replace('/#.*/', '', esc_url($item->get_permalink(), null, 'display')); $content .= '<li>'; $content .= '<a href="' . $url . '?utm_source=wpadmin&utm_medium=sidebarwidget&utm_term=newsite&utm_campaign=' . $this->settings['prefix'] . '_settings-api" target="_blank">' . esc_html($item->get_title()) . '</a>'; $content .= '</li>'; } } $content .= '</ul>'; $this->postbox('custom-login-extensions', sprintf(__('Custom Login Extensions %s', $this->settings['domain']), '<small class="dashicons dashicons-external"></small>'), $content); }
/** * Remove the "Lost your password?" text. */ public function remove_lostpassword_text($translated_text, $untranslated_text) { global $pagenow; if ('wp-login.php' == $pagenow) { if ('off' !== CL_Common::get_option('lostpassword_text', 'general')) { //make the changes to the text switch ($untranslated_text) { case 'Lost your password?': $translated_text = ''; break; } } } return $translated_text; }
private function get_feed($count = 1, $feed = self::FEED_URL) { return CL_Common::fetch_rss_items($count, $feed); }