/** * Create an HTML link for the command. * @param COMMAND $cmd * @param string $css_class * @return string * @access private */ protected function _command_as_html($cmd, $css_class) { $Result = ''; $text = ''; if ($cmd->caption && ($this->content_mode & Menu_show_title || !$cmd->icon)) { $text = $cmd->caption; } if ($cmd->icon && $this->content_mode & Menu_show_icon) { $text = $this->context->get_icon_with_text($cmd->icon, Sixteen_px, $text); } if (!empty($text)) { $Result = $text; $class_statement = $css_class ? ' class="' . $css_class . '"' : ''; if ($cmd->link) { $link = htmlspecialchars($this->context->resolve_file($cmd->link)); $tag = '<a' . $class_statement . ' href="' . $link . '" title="' . global_text_options()->convert_to_html_attribute($cmd->link_title) . '"'; if ($this->target) { $tag .= ' target="' . $this->target . '"'; } if ($cmd->on_click) { $tag .= ' onclick="' . $cmd->on_click . '; return false;"'; } $tag .= '>'; if (!empty($cmd->description) && $css_class == 'menu-item') { $description_class_statement = $css_class ? ' class="' . $css_class . '-description"' : ''; $Result .= ' <span ' . $description_class_statement . '>' . $cmd->description . '</span>'; } $Result = $tag . $Result; $Result .= '</a>'; } elseif ($class_statement) { $tag = ''; if ($class_statement) { $tag = '<span ' . $class_statement . '>'; } $Result = $tag . $Result; if ($class_statement) { $Result .= '</span>'; } if (!empty($cmd->description) && $css_class == 'menu-item') { $Result .= '<span class="menu-item-description">' . $cmd->description . '</span>'; } } } return $Result; }
/** * @param ENVIRONMENT $env Global environment. */ public function __construct($env) { $this->env = $env; parent::__construct(); $this->date_time_toolkit = $this->env->date_time_toolkit; $class_name = $this->final_class_name('COOKIE', 'webcore/util/cookie.php'); $this->cookie = new $class_name(); $this->cookie->path = '/'; $this->storage = $this->cookie; $class_name = $this->final_class_name('CONTEXT_DISPLAY_OPTIONS'); $this->display_options = new $class_name($this); $class_name = $this->final_class_name('CONTEXT_MAIL_OPTIONS'); $this->mail_options = new $class_name(); $class_name = $this->final_class_name('CONTEXT_DATABASE_OPTIONS'); $this->database_options = new $class_name(); $class_name = $this->final_class_name('CONTEXT_UPLOAD_OPTIONS'); $this->upload_options = new $class_name(); $class_name = $this->final_class_name('CONTEXT_STORAGE_OPTIONS'); $this->storage_options = new $class_name(); $this->text_options = global_text_options(); }
public function __construct() { $this->_url_options = global_url_options(); $this->_text_options = global_text_options(); $this->restore_root_behavior(); }
/** * Add an attribute to the style being contructed. * @param string $name * @param string $value */ public function add_attribute($name, $value) { if ($value) { if ($this->_text) { $this->_text .= '; '; } $text_options = global_text_options(); $this->_text .= $name . ': ' . $text_options->convert_to_html_attribute($value); } }
/** * Convert the text to an output format. * @param MUNGER $munger The conversion context. * @param string $text * @return string * @access private */ protected function _convert($munger, $text) { switch ($munger->convert_mode) { case Munger_convert_html_simple: return htmlspecialchars($text, ENT_NOQUOTES); case Munger_convert_html_strict: $options = global_text_options(); return $options->convert_to_html_entities($text); case Munger_convert_plain_text: return $text; default: return $text; } }
/** * Return HTML code for displaying the image. * If the image has been resized, the image tag itself is constrained to the desired size. * @param string $title Title to use for the image. * @param string $css_class CSS class to use for the image. * @see as_html() */ public function as_html_without_link($title = ' ', $css_class = '') { if (!isset($this->_image) || $this->_image->loadable()) { $opts = global_text_options(); $title = $opts->convert_to_html_attribute($title); $Result = '<img src="' . $this->url . '" alt="' . $title . '"'; if ($css_class) { $Result .= ' class="' . $css_class . '"'; } if ($this->was_resized) { $Result .= ' width="' . $this->constrained_width . '" height="' . $this->constrained_height . '"'; } $Result .= '>'; return $Result; } return '[<span title="' . $this->url . '">Image</span>] was not found.'; }
/** * Convert a value for placement within an HTML tag attribute value. * @param string $value The value to convert. * @return string * @access private */ protected function _convert_to_attribute($value) { $text_options = global_text_options(); return $text_options->convert_to_html_attribute($value); }