public function handleSettingsForm() { if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) && is_array($_POST[$this->widgetId])) { $formInputs = $_POST[$this->widgetId]; $this->settings->set('widget_line_count', intval($formInputs['widget_line_count'])); if ($this->settings->get('widget_line_count') <= 0) { $this->settings->set('widget_line_count', $this->settings->get_defaults('widget_line_count')); } $this->settings->set('strip_wordpress_path', isset($formInputs['strip_wordpress_path'])); $this->settings->set('send_errors_to_email', trim(strval($formInputs['send_errors_to_email']))); $this->settings->set('email_interval', intval($formInputs['email_interval'])); if ($this->settings->get('email_interval') <= 60) { $this->settings->set('email_interval', $this->settings->get_defaults('email_interval')); } do_action('elm_settings_changed', $this->settings); } printf('<p><label>%s <input type="text" name="%s[widget_line_count]" value="%s" size="5"></label></p>', 'Number of lines to show:', esc_attr($this->widgetId), esc_attr($this->settings->get('widget_line_count'))); printf('<p><label><input type="checkbox" name="%s[strip_wordpress_path]"%s> %s</label></p>', esc_attr($this->widgetId), $this->settings->get('strip_wordpress_path') ? ' checked="checked"' : '', 'Strip WordPress root directory from log messages'); printf('<p> <label for="%1$s-send_errors_to_email">%2$s</label> <input type="text" class="widefat" name="%1$s[send_errors_to_email]" id="%1$s-send_errors_to_email" value="%3$s"> </p>', esc_attr($this->widgetId), 'Periodically email logged errors to:', $this->settings->get('send_errors_to_email')); printf('<p><label>%s <select name="%s[email_interval]">', 'How often to send email (max):', esc_attr($this->widgetId)); $intervals = array('Every 10 minutes' => 10 * 60, 'Every 15 minutes' => 15 * 60, 'Every 30 minutes' => 30 * 60, 'Hourly' => 60 * 60, 'Daily' => 24 * 60 * 60, 'Weekly' => 7 * 24 * 60 * 60); foreach ($intervals as $name => $interval) { printf('<option value="%d"%s>%s</option>', $interval, $interval == $this->settings->get('email_interval') ? ' selected="selected"' : '', $name); } echo '</select></label></p>'; }
/** * @return Prompt_Admin_Delivery_Metabox */ public static function text_metabox() { if (!self::$options->get('enable_post_delivery')) { return null; } if (!self::$text_metabox) { self::$text_metabox = new Prompt_Admin_Text_Metabox('prompt_text_version', __('Postmatic Text Version', 'Postmatic'), array('post_type' => self::$options->get('site_subscription_post_types'))); } return self::$text_metabox; }
public function formatTimestamp($timestamp) { return gmdate($this->settings->get('timestamp_format'), $timestamp); }