'; if ($url) echo $eol.$tab.''; echo $eol.$tab.'

'.$plugin_name.' '.__('Settings').'

'.$eol; } static function open_form($action) { $eol = "\n"; echo $eol.'
'.$eol; } static function close_page() { $eol = "\n"; $tab = "\t"; echo $eol.$tab.'
'.$eol.''.$eol; } /** * * Building the menu for the tabs * */ static function nav_menu($args) { $eol = "\n"; $tab = "\t"; extract ($args); echo ''.$eol; } /** * * Opening and closing the tabs, columns etc. * */ static function open_tab($columns = false) { $eol = "\n"; $n = ($columns) ? '-'.$columns : ''; $columns = ($columns) ? ' columns-'.$columns : ''; echo $eol.'
'.$eol.'
'.$eol.'
'; } static function close_tab() { $eol = "\n"; echo $eol.'
'.$eol.'
'.$eol.'
'.$eol; } /** * * Wrapping sections into postboxes * */ static function postbox($label, $id, $sections ) { if (!is_array($sections)) $sections = array($sections); $postbox = self::open_postbox($label, $id); ob_start(); foreach ($sections as $section) do_settings_sections($section); $postbox .= ob_get_contents(); ob_end_clean(); $postbox .= self::close_postbox(); return $postbox; } /** * * Opening and closing the postboxes * */ static function open_postbox($label, $id, $closed = false) { $eol = "\n"; $tab = "\t"; $dtab = $tab.$tab; $class = (false === $closed) ? '' : ' closed'; $output = $eol.'
'.$eol.$tab.'
'.$eol.$dtab.'
'.$eol.$tab.'
'.$eol.$tab; $output .= $eol.'

'.$eol.$dtab.''.$label.''.$eol.$tab.'

'.$eol.$tab.'
'.$eol.$tab; return $output; } static function close_postbox() { $eol = "\n"; return $eol.'
'.$eol.'
'; } /** * * Wrapping postboxes into sortables * */ static function sortable($id, $postboxes) { if (!is_array($postboxes)) $postboxes = array($postboxes); $sortable = self::open_sortable($id); foreach ($postboxes as $postbox) : $sortable .= $postbox; endforeach; $sortable .= self::close_sortable(); echo $sortable; } /** * * Opening and closing the postboxes * */ static function open_sortable($id) { $eol = "\n"; $tab = "\t"; $output = $eol.'
'.$eol.$tab; return $output; } static function close_sortable() { return "\n
"; } /** * * Changing to the next column * */ static function column($n) { $eol = "\n"; echo $eol.''.$eol.'
'; } /** * * Wrapping different sections in containers inside postbox * */ static function wrapper($id, $label, $postbox_id, $sections, $atts = false) { $wrapper = self::open_sortable($id); $wrapper .= self::open_postbox($label, $postbox_id); foreach ($sections as $section) $wrapper .= self::wrap_section($section, $atts); $wrapper .= self::clear_it(false); $wrapper .= self::close_postbox(); $wrapper .= self::close_sortable(); echo $wrapper; } /** * * Wrapping section in container * */ static function wrap_section($section_id, $attributes = false) { $eol = "\n"; $tab = "\t"; ob_start(); do_settings_sections($section_id); $section = ob_get_contents(); ob_end_clean(); return self::tag_it($section, 'div', 1, $attributes); } /** * * Wrapping elements into html tags * */ static function tag_it($element, $tag, $indent = false, $atts = false, $echo = false) { $eol = "\n"; $tab = "\t"; $attributes = ''; if (false !== $atts) : foreach ($atts as $attribute => $value) $attributes .= ' '.$attribute.'="'.$value.'"'; endif; $item = $eol; if (false != $indent) : for ($i = 0; $i <= $indent; $i++) $item .= $tab; endif; $item .= '<'.$tag.$attributes.'>'.$element.''; if (false === $echo) return $item; echo $item; } /** * * Wrapping fields in unordered lists * * uses tag_it function * */ static function list_it($fields, $header = false, $atts = false, $list_atts = false, $echo = true) { $eol = "\n"; $list = ''; $list_items = ''; if (false != $header) $list .= $header.$eol; foreach ($fields as $field) $list_items .= self::tag_it($field, 'li', 1, $list_atts); $list .= self::tag_it($list_items, 'ul', $atts); if (false === $echo) return $list; echo $list; } /** * * Putting the clear both div * * uses tag_it function * */ static function clear_it($echo = true) { $clear_both = self::tag_it('', 'div', false, array('style' => 'clear: both;')); if (false === $echo) return $clear_both; echo $clear_both; } /** * * Output options for debugging * */ static function debug_info($options, $label) { $postbox = self::open_postbox($label, 'debug-info', true); $postbox .= self::tag_it(a5_get_version(), 'p'); if (!is_array($options)) $options = array ($options); $opt_str = ''; foreach ($options as $key => $value) : $key = str_replace('_', ' ', $key); if (is_array($value)) : ob_start(); var_dump($value); $value = ob_get_contents(); $value = self::tag_it($value, 'pre', 3); ob_end_clean(); else: if (true === $value) $value = 'true'; if (false === $value) $value = 'false'; if (NULL === $value) $value = 'NULL'; if (empty($value)) $value = __('Not set', 'adseasy'); $value = str_replace(array("\r\n", "\n", "\r"), '
', $value); endif; $key = self::tag_it(ucwords($key).':', 'td', 2, array('style' => 'width: 25%; border: solid 1px')); $value = self::tag_it($value, 'td', 2, array('style' => 'border: solid 1px')); $opt_str .= self::tag_it($key.$value, 'tr', 1); endforeach; $postbox .= self::tag_it($opt_str, 'table', 0, array('style' => 'border-collapse: collapse')); $postbox .= self::close_postbox(); return $postbox; } /** * * Output help box * */ static function help_box($text, $label) { $eol = "\n"; $tab = "\t"; $postbox = self::open_postbox($label, sanitize_key($label)); $postbox .= $text; $postbox .= self::close_postbox(); return $postbox; } /** * * Output donation box * */ static function donation_box($text, $label, $paypal = false, $flattr = false) { $eol = "\n"; $tab = "\t"; $postbox = self::open_postbox($label, 'donations'); $postbox .= $text; if ($paypal) : $postbox .= '
'.$eol.$tab.''.$eol.$tab; $postbox .= ''.$eol.$tab; $postbox .= ''.$eol.$tab; $postbox .= ''.$eol.$tab.'
'.$eol.$tab; endif; if ($flattr) : $postbox .= $eol.$tab.''.$eol.$tab; $postbox .= 'Flattr this'.$eol.$tab; endif; $postbox .= self::close_postbox(); return $postbox; } } // A5_OptionPage ?>