示例#1
0
    public function admin_notices()
    {
        if (get_option('mainwp_refresh')) {
            echo '<meta http-equiv="refresh" content="0">';
            delete_option('mainwp_refresh');
        }
        $current_options = get_option('mainwp_showhide_events_notice');
        if (!is_array($current_options)) {
            $current_options = array();
        }
        if (is_multisite() && (!isset($current_options['hide_multi_site_notice']) || empty($current_options['hide_multi_site_notice']))) {
            ?>
			<div class="mainwp-events-notice mainwp_info-box-red">
				<span style="float: right;"><a class="mainwp-events-notice-dismiss" notice="multi_site"
						      style="text-decoration: none;" href="#"><i class="fa fa-times-circle"></i> <?php 
            esc_html_e('Dismiss', 'mainwp');
            ?>
</a></span>
				<span><i class="fa fa-exclamation-triangle fa-2x mwp-red"></i> <strong><?php 
            esc_html_e('Warning! WordPress Multisite detected.', 'mainwp');
            ?>
</strong></span>
				<p><?php 
            esc_html_e('MainWP Plugin is not designed nor fully tested on WordPress Multi Site installations. Varisous features may not work propely. We highly recommend insallting it on a Single Site installation!', 'mainwp');
            ?>
</p>
			</div>
			<?php 
        }
        if (MainWP_DB::Instance()->getWebsitesCount() == 0) {
            echo '<div id="message" class="mainwp-api-message-valid updated fade"><p><strong>MainWP is almost ready. Please <a href="' . admin_url() . 'admin.php?page=managesites&do=new">enter your first site</a>.</strong></p></div>';
            update_option('mainwp_first_site_events_notice', 'yes');
        } else {
            if (get_option('mainwp_first_site_events_notice') == 'yes') {
                ?>
				<div class="mainwp-events-notice updated fade">
					<p>
						<span style="float: right;"><a class="mainwp-events-notice-dismiss" notice="first_site"
						      style="text-decoration: none;" href="#"><i
								class="fa fa-times-circle"></i> <?php 
                esc_html_e('Dismiss', 'mainwp');
                ?>
</a></span><span><strong><?php 
                echo sprintf(__('Warning: Your setup is almost complete we recommend following the directions in the following help doc to be sure your scheduled events occur as expected %sScheduled Events%s', 'mainwp'), '<a href="http://docs.mainwp.com/backups-scheduled-events-occurring/">', '</a>');
                ?>
</strong></span>
					</p>
				</div>
				<?php 
            }
        }
        if ($this->current_version == '2.0.22' || $this->current_version == '2.0.23') {
            if (get_option('mainwp_installation_warning_hide_the_notice') == 'yes') {
                if (get_option('mainwp_fixed_security_2022') != 1) {
                    ?>
					<div class="mainwp_info-box-red">
						<span><strong><?php 
                    esc_html_e('This update includes additional security hardening.', 'mainwp');
                    ?>
</strong>
							<p><?php 
                    esc_html_e('In order to complete the security hardening process follow these steps:', 'mainwp');
                    ?>
</p>
							<ol>
								<li><?php 
                    esc_html_e('Update all your Child Sites to the latest version MainWP Child.', 'mainwp');
                    ?>
</li>
								<li><?php 
                    echo sprintf(__('Then Go to the MainWP Tools Page by clicking %sHere%s.', 'mainwp'), '<a style="text-decoration: none;" href="admin.php?page=MainWPTools" "MainWP Tools">', '</a>');
                    ?>
</li>
								<li><?php 
                    esc_html_e('Press the Establish New Connection Button and Let it Run.', 'mainwp');
                    ?>
</li>
								<li><?php 
                    esc_html_e('Once completed the security hardening is done.', 'mainwp');
                    ?>
</li>
							</ol>
							<em><?php 
                    esc_html_e('This message will automatically go away once you have completed the hardening process.', 'mainwp');
                    ?>
</em>
						</span>
					</div>
					<?php 
                }
            }
        }
        if (!isset($current_options['trust_child']) || empty($current_options['trust_child'])) {
            if (self::isMainWP_Pages()) {
                if (!MainWP_Plugins::checkAutoUpdatePlugin('mainwp-child/mainwp-child.php')) {
                    ?>
					<div id="" class="mainwp-events-notice error fade">
						<p>
							<span style="float: right;"><a class="mainwp-events-notice-dismiss" notice="trust_child" style="text-decoration: none;" href="#"><i class="fa fa-times-circle"></i> <?php 
                    esc_html_e('Dismiss', 'mainwp');
                    ?>
</a></span>
							<strong><?php 
                    esc_html_e('You have not set your MainWP Child Plugins for auto updates, this is highly recommended', 'mainwp');
                    ?>
</strong>
							&nbsp;<a id="mainwp_btn_autoupdate_and_trust" class="button-primary" href="#"><?php 
                    esc_html_e('Turn On', 'mainwp');
                    ?>
</a>
							&nbsp;<a class="button" href="//docs.mainwp.com/setting-mainwp-as-a-trusted-plugin/" target="_blank"><?php 
                    esc_html_e('Learn More', 'mainwp');
                    ?>
</a>
						</p>
					</div>
					<?php 
                }
            }
        }
        $display_request1 = $display_request2 = false;
        if (isset($current_options['request_reviews1'])) {
            if ($current_options['request_reviews1'] == 'forever') {
                $display_request1 = false;
            } else {
                $days = intval($current_options['request_reviews1']);
                // 15 or 30
                $start_time = $current_options['request_reviews1_starttime'];
                $display_request1 = time() - $start_time > $days * 24 * 3600 ? true : false;
            }
        } else {
            $current_options['request_reviews1'] = 30;
            $current_options['request_reviews1_starttime'] = time();
            update_option('mainwp_showhide_events_notice', $current_options);
        }
        if (isset($current_options['request_reviews2'])) {
            if ($current_options['request_reviews2'] == 'forever') {
                $display_request2 = false;
            } else {
                $days = intval($current_options['request_reviews2']);
                // 15
                $start_time = $current_options['request_reviews2_starttime'];
                $display_request2 = time() - $start_time > $days * 24 * 3600 ? true : false;
            }
        } else {
            $currentExtensions = MainWP_Extensions::$extensionsLoaded ? MainWP_Extensions::$extensions : get_option('mainwp_extensions');
            if (is_array($currentExtensions) && count($currentExtensions) > 10) {
                $display_request2 = true;
            }
        }
        if ($display_request1) {
            ?>
			<div class="mainwp-events-notice updated fade">
				<p>
					<span style="float: right;"><a class="mainwp-events-notice-dismiss" notice="request_reviews1" style="text-decoration: none;" href="#"><i class="fa fa-times-circle"></i> <?php 
            esc_html_e('Dismiss', 'mainwp');
            ?>
</a></span>
					<span style="font-size: 14px;">
						<?php 
            esc_html_e('Hi, I noticed you having been using MainWP for over 30 days and that\'s awesome!', 'mainwp');
            ?>
						<br/>
						<?php 
            esc_html_e('Could you please do me a BIG favor and give it a 5-star rating on WordPress?  Reviews from users like you really help the MainWP community to grow.', 'mainwp');
            ?>
						<br/><br/>
						<?php 
            esc_html_e('Thank You', 'mainwp');
            ?>
<br/>
						<?php 
            esc_html_e('~ Dennis', 'mainwp');
            ?>
<br/><br/>
						<a href="https://wordpress.org/support/view/plugin-reviews/mainwp#postform" target="_blank" class="button mainwp-upgrade-button"><?php 
            esc_html_e('Ok, you deserve', 'mainwp');
            ?>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
						</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="" class="button mainwp-events-notice-dismiss" notice="request_reviews1"><?php 
            esc_html_e('Nope, maybe later', 'mainwp');
            ?>
</a>
						<a href="" class="button mainwp-events-notice-dismiss" notice="request_reviews1_forever"><?php 
            esc_html_e('I already did', 'mainwp');
            ?>
</a>
					</span>
				</p>
			</div>
		<?php 
        } else {
            if ($display_request2) {
                ?>
			<div class="mainwp-events-notice updated fade">
				<p>
					<span style="float: right;"><a class="mainwp-events-notice-dismiss" notice="request_reviews2" style="text-decoration: none;" href="#"><i class="fa fa-times-circle"></i> <?php 
                esc_html_e('Dismiss', 'mainwp');
                ?>
</a></span>
					<span style="font-size: 14px;">
						<?php 
                esc_html_e('Hi, I noticed you have a few MainWP Extensions installed and that\'s awesome!', 'mainwp');
                ?>
						<br/>
						<?php 
                esc_html_e('Could you please do me a BIG favor and give it a 5-star rating on WordPress?  Reviews from users like you really help the MainWP community to grow.', 'mainwp');
                ?>
						<br/><br/>
						<?php 
                esc_html_e('Thank You', 'mainwp');
                ?>
<br/>
						<?php 
                esc_html_e('~ Dennis', 'mainwp');
                ?>
<br/><br/>
						<a href="https://wordpress.org/support/view/plugin-reviews/mainwp#postform" target="_blank" class="button mainwp-upgrade-button">
							<?php 
                esc_html_e('Ok, you deserve', 'mainwp');
                ?>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
							<i class="fa fa-star"></i>
						</a>
						&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="" class="button mainwp-events-notice-dismiss" notice="request_reviews2"><?php 
                esc_html_e('Nope, maybe later', 'mainwp');
                ?>
</a>
						<a href="" class="button mainwp-events-notice-dismiss" notice="request_reviews2_forever"><?php 
                esc_html_e('I already did', 'mainwp');
                ?>
</a>
					</span>
				</p>
			</div>
			<?php 
            }
        }
    }