static function image($image, $dir = '', $alt = '', $width = '100', $height = '', $thumb = false, $align = '', $link = true, $defaults = 0, $blank = false) { $imgdir = Util::value('imgdir'); $output = ''; $pattern = "/\\.gif\$|\\.jpeg\$|\\.tif\$|\\.jpg\$|\\.tiff\$|\\.png\$|\\.bmp\$/i"; if (preg_match($pattern, $image) || $blank !== false) { $height_line = $height == '' ? '' : " height=" . $height; if ($defaults) { $width = '100'; } if ($dir == '' && $imgdir != '') { $dir = $imgdir; } $image = $dir . $image; if ($align != '') { $align = 'align="' . $align . '"'; } if ($image != '' && file_exists(getcwd() . '/' . $image)) { if ($link) { $output .= '<a href="' . $image . '" target="_blank">'; } if ($thumb) { $output .= '<img src="thumb.php?f=' . $image . '&d=' . $dir . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />'; } else { $output .= '<img src="' . $image . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />'; } if ($link) { $output .= '</a>'; } } elseif ($blank != '' && file_exists(getcwd() . '/' . $blank)) { $output .= '<img src="' . $blank . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />'; } elseif ($image != '') { $output .= '<img src="' . $image . '" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" ' . $align . ' />'; } else { $output .= '<img src="noimage.png" border="0" alt="' . $alt . '" title="' . $alt . '" width="' . $width . $height_line . '" align="left" />'; } return $output; } else { return $image; } }
public function args() { global $argv, $argc; if ($argc > 1) { $this->_arguments[$this->_parameters[0]] = 'console'; for ($i = 1; $i <= $argc - 1; $i++) { $this->_arguments[$this->_parameters[$i]] = $argv[$i]; } } elseif (count($_GET) > 0 || count($_POST) > 0) { $args = $this->_parameters; foreach ($args as $arg) { $this->_arguments[$arg] = Util::value($arg); } } else { $request_parts = explode('/', $_SERVER['REQUEST_URI']); $parts = array_reverse($request_parts); } $this->_arguments[$this->_parameters[0]] = isset($this->_arguments[$this->_parameters[0]]) ? $this->_arguments[$this->_parameters[0]] : strtolower(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'); $this->_arguments[$this->_parameters[1]] = isset($this->_arguments[$this->_parameters[1]]) ? $this->_arguments[$this->_parameters[1]] : $this->name(); $this->_arguments[$this->_parameters[2]] = isset($this->_arguments[$this->_parameters[2]]) ? $this->_arguments[$this->_parameters[2]] : $this->_arguments[$this->_parameters[0]]; return $this; }