/** * Displays stored setting notification messages. * * @since 3.0.4 * @internal */ public function _replyToPrintSettingNotice() { if (!$this->_isInThePage()) { return; } // Ensure this method is called only once per a page load. if (self::$_bSettingNoticeLoaded) { return; } self::$_bSettingNoticeLoaded = true; $_iUserID = get_current_user_id(); $_aNotices = $this->oUtil->getTransient("apf_notices_{$_iUserID}"); if (false === $_aNotices) { return; } $this->oUtil->deleteTransient("apf_notices_{$_iUserID}"); // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. if (isset($_GET['settings-notice']) && !$_GET['settings-notice']) { return; } // Display the settings notices. $_aPeventDuplicates = array(); foreach ((array) $_aNotices as $__aNotice) { if (!isset($__aNotice['aAttributes'], $__aNotice['sMessage']) || !is_array($__aNotice)) { continue; } $_sNotificationKey = md5(serialize($__aNotice)); if (isset($_aPeventDuplicates[$_sNotificationKey])) { continue; } $_aPeventDuplicates[$_sNotificationKey] = true; $__aNotice['aAttributes']['class'] = isset($__aNotice['aAttributes']['class']) ? $__aNotice['aAttributes']['class'] . ' admin-page-framework-settings-notice-container' : 'admin-page-framework-settings-notice-container'; echo "<div " . $this->oUtil->generateAttributes($__aNotice['aAttributes']) . ">" . "<p class='admin-page-framework-settings-notice-message'>" . $__aNotice['sMessage'] . "</p>" . "</div>"; } }
public function _replyToPrintSettingNotice() { if (!$this->_isInThePage()) { return; } if (self::$_bSettingNoticeLoaded) { return; } self::$_bSettingNoticeLoaded = true; $_iUserID = get_current_user_id(); $_aNotices = $this->oUtil->getTransient("apf_notices_{$_iUserID}"); if (false === $_aNotices) { return; } $this->oUtil->deleteTransient("apf_notices_{$_iUserID}"); if (isset($_GET['settings-notice']) && !$_GET['settings-notice']) { return; } $this->_printSettingNotices($_aNotices); }