static function getInstance() { if (!self::$instance) { self::$instance = new self(); } self::$instance->load(); return self::$instance; }
function errorMessageSelect($value, $name) { $id = substr(md5(uniqid()), rand(0, 9), rand(10, 20)); ?> <ul><?php _e('Please select error message:', 'am4-plugin'); ?> <?php foreach ((array) am4Errors::getInstance()->getAll() as $e) { ?> <li> <input type="radio" name="<?php echo $name; ?> " value="<?php $this->e($e['name']); ?> " <?php checked($value, $e['name']); ?> > <?php $this->e($e['name']); ?> <a href="#" class ="am4-text-show-<?php echo $id; ?> " > >> </a> <div class="am4-error-text-container" style='overflow:auto; height:300px; width:800px; border: 1px solid #7F9DB9; padding: 5px; display: none;'><?php echo $e['text']; ?> </div> </li> <?php } ?> </ul> <script> jQuery(document).ready(function(){ jQuery(".am4-text-show-<?php echo $id; ?> ").click(function(e){ e.preventDefault(); jQuery(".am4-error-text-container").hide(200); jQuery(this).next("div").show(200); }); }); </script> <?php }
function run($atts = array(), $content = '') { $errors = am4Errors::getInstance(); if (!am4PluginsManager::getAPI()->isLoggedIn()) { return do_shortcode($errors->get($atts['guest_error'])); } if (!am4PluginsManager::getAPI()->isUserActive()) { return do_shortcode($errors->get($atts['user_error'])); } $access = new am4UserAccess(); //User is logged in let's check his access level; if ($atts['have']) { $records = $this->convertToAccessRequirement($atts['have']); if (!$access->anyTrue($records)) { return do_shortcode($errors->get($atts['user_error'])); } } if ($atts['not_have']) { $records = $this->convertToAccessRequirement($atts['not_have']); if (!$access->allFalse($records)) { return do_shortcode($errors->get($atts['user_error'])); } } return do_shortcode($content); }
protected function getErrorText($error) { if ($error = am4Errors::getInstance()->get($error)) { return do_shortcode($error); } return __('Template not found:', 'am4-plugin') . $error; }