function __construct($context) { Loader::includeLibrary('phpmailer5.2/class.phpmailer.php'); $this->mailer = new PHPMailer(); $this->mailer->CharSet = AppConfig::CHARSET; parent::__construct($context); }
/** * * @example * * $this->createThumbs( * array('best', '[programa]/{random[10]}_{width}x{height}.{ext}' 300, 500), * array('width', '[programa]/{random[10]}_width.{ext}', 110), * array('square', '[programa]/{random[10]}_square.{ext}', 80), * array('crop', '[programa]/{random[10]}_crop_{width}x{height}.{ext}', 300, 500), * array('height', '[programa]/{random[10]}_height.{ext}', 180), * array('filled', '[programa]/{random[10]}_filled.{ext}', 365), * array('original','[programa]/{random[10]}.{ext}') * ); * * @return array */ function createThumbs() { if (!$this->hasFile()) { return false; } $thumbs = func_get_args(); #No thumbs specified if (!count($thumbs)) { return false; } #Save temporarily the original image in the tmp directory $path = APPD_TMP . DS . '{random}.{ext}'; $source = $this->saveFileAs($path); if (!$source) { trigger_error("Could not create temporary thumbnail.", E_USER_WARNING); return false; } Loader::includeLibrary('phaxsithumb/PhaxsiThumb.php'); $fk_thumb = new PhaxsiThumb($source); if ($fk_thumb->isError()) { @unlink($source); return false; } #Generate filenames if needed. $names will be returned. $names = array(); for ($i = 0; $i < count($thumbs); $i++) { $info = pathinfo($this->_value['name']); $replacements = array('size' => isset($thumbs[$i][2]) ? $thumbs[$i][2] : '', 'width' => isset($thumbs[$i][2]) ? $thumbs[$i][2] : '', 'height' => isset($thumbs[$i][3]) ? $thumbs[$i][3] : '', 'name' => $info['filename'], 'ext' => $info['extension']); $thumbs[$i][1] = PathHelper::replaceUploadsDir($thumbs[$i][1]); $thumbs[$i][1] = PathHelper::parse($thumbs[$i][1], $replacements); $dir = dirname($thumbs[$i][1]); if (!file_exists($dir)) { $old = umask(0); mkdir($dir, 0777, true); umask($old); } $names[$i] = $thumbs[$i][1]; } $success = call_user_func_array(array(&$fk_thumb, 'batchCreateThumbs'), $thumbs); @unlink($source); if (!$success) { return false; } return $names; }
static function decode($string) { Loader::includeLibrary('json/json.php'); $json = new Services_Json(); return $json->decode($string); }
function __construct($context) { Loader::includeLibrary('feedwriter/FeedWriter.php'); $this->feed = new FeedWriter(RSS2); parent::__construct($context); }