load() static public méthode

static public load ( $className )
 public function thumb($uniqueId, $width, $height, $method, $filename)
 {
     // only image can get thumbnails, existing files and valid resize method name
     if (!$this->MediaFile->isImage() || !($ImageFile = $this->MediaFile->file()) || !method_exists($ImageFile, $method)) {
         return false;
     }
     $filename = STATIC_DIR . 'img/public/' . $uniqueId . '/' . $width . 'x' . $height . '/' . $method . '/' . $filename;
     $width = (int) $width > 0 ? (int) $width : null;
     $height = (int) $height > 0 ? (int) $height : null;
     // resize Image
     try {
         $ImageFile->{$method}($width, $height, true, false);
         // apply sharpen filter if available and image is small
         if (function_exists('imageconvolution') && $width < 400 && $height < 400) {
             Library::load('ephFrame.lib.file.image.ImageSharpenFilter');
             $sharpenFilter = new ImageSharpenFilter();
             $ImageFile->applyFilter($sharpenFilter);
         }
     } catch (ImageToLargeToLoadException $e) {
         $ImageFile = new Image($width, $height);
         $ImageFile->backgroundColor('ffffe0')->border('e6db55', 1, 0);
         $ImageFile->text(Image::CENTERED, Image::CENTERED, 'image to large to' . LF . 'create thumbnail', 'b8ad4c', 1);
     }
     $ImageFile->saveAs($filename, $this->thumbQuality);
     $this->redirect(WEBROOT . $filename);
 }
Exemple #2
0
<?php

/**
 * This file loads console tasks by it’s name, call it from the application
 * root directory like this:
 *
 * $ php console/console.php cronReportEmail 
 * 
 * @since 2009-09-28
 * @author Marcel Eichner // Ephigenia <*****@*****.**>
 * @package app
 * @subpackage app.console
 */
// load ephFrame Framework
define('APP_ROOT', realpath(dirname(__FILE__) . '/../') . '/');
require dirname(__FILE__) . '/../html/ephFrame.php';
Library::load('ephFrame.lib.console.ConsoleController');
chdir(APP_ROOT . 'html/');
require dirname(__FILE__) . '/AppConsole.php';
new AppConsoleController();
Exemple #3
0
<?php

Library::load('ephFrame.lib.net.socket.CURL');
/**
 * Simple LastFMAPI Example
 * @author Marcel Eichner // Ephigenia <*****@*****.**>
 * @since 2009-07-19
 * @package app
 * @subpackage app.lib.component
 */
class LastFMAPI extends CURL
{
    const PERIOD_OVERALL = 'overall';
    const PERIOD_3MONTHS = '3month';
    const PERIOD_6MONTHS = '6month';
    const PERIOD_12MONTHS = '12month';
    protected $apikey;
    protected $user;
    public $url = 'http://ws.audioscrobbler.com/2.0/';
    public $userAgent = 'harrison, ephFrame';
    public function __construct($user, $apikey)
    {
        $this->user = $user;
        $this->apikey = $apikey;
        $this->data = array('api_key' => &$this->apikey, 'user' => &$this->user);
        return parent::__construct($this->url);
    }
    public function getTopArtists($period = self::PERIOD_OVERALL)
    {
        $this->data['method'] = 'user.gettopartists';
        if (preg_match_all('@<name>([^>]+)</name>@', $this->exec(true), $found)) {
    public function videoReplace($text)
    {
        // get normal videos
        if (preg_match_all('@\\[{2}
			video=([^|]+)
			\\|?(\\d+)?
			\\|?([^\\]]+)?
			\\]{2}@ix', $text, $found, PREG_SET_ORDER)) {
            foreach ($found as $arr) {
                $videoUrl = WEBROOT . STATIC_DIR . 'swf/VideoPlayer.swf?url=' . $arr[1] . '&name=' . urlencode(@$arr[3]);
                $videoTag = $this->HTML->tag('embed', null, array('src' => $videoUrl, 'allowFullScreen' => 'true', 'type' => 'application/x-shockwave-flash', 'width' => 440, 'height' => coalesce(@$arr[2], 440)));
                $text = str_replace($arr[0], $videoTag, $text);
            }
        }
        // get dailymotion / youtube videos
        if (preg_match_all('@\\[{2}
			(?:http:\\/{1,}(?:www\\.)?)?
			(?P<type>youtube|dailymotion|vimeo|traileraddict)=?
				 (
					(\\.com\\/(video\\/|watch\\?v=)|:)?
					(?P<id>[a-z0-9_-]+)
				)
				([^\\]]+)?
			\\]{2}@ix', $text, $found, PREG_SET_ORDER)) {
            foreach ($found as $arr) {
                class_exists('Element') or Library::load('ephFrame.lib.view.Element');
                $videoElement = new Element('video/' . $arr['type'], array('id' => $arr['id']));
                $text = str_replace($arr[0], $videoElement->render(), $text);
            }
        }
        return $text;
    }
Exemple #5
0
<?php

class_exists('Image') or Library::load('ephFrame.lib.file.image.Image');
class_exists('I18n') or Library::load('ephFrame.lib.component.I18n');
/**
 * Media File class
 * 	
 * @author Marcel Eichner // Ephigenia <*****@*****.**>
 * @since 04.12.2008
 * @package harrison
 * @subpackage harrison.lib.model
 */
class MediaFile extends AppModel
{
    const FLAG_SHARPEN = 2;
    const FLAG_CUSTOM1 = 128;
    const FLAG_CUSTOM2 = 255;
    public $order = array('position ASC', 'created DESC');
    public $belongsTo = array('Node', 'User', 'Folder');
    public $behaviors = array('Timestampable', 'Positionable', 'Flagable', 'HitCount');
    public $uses = array('Language');
    public $path = 'img/upload/';
    public function afterConstruct()
    {
        foreach ($this->Language->findAll() as $Language) {
            $modelName = 'Text' . ucFirst($Language->id);
            $this->bind($modelName, 'hasOne', array('class' => 'MediaText', 'foreignKey' => 'media_file_id', 'dependent' => true, 'conditions' => array($modelName . '.language_id' => DBQuery::quote($Language->id))));
            $this->{$modelName}->language_id = $Language->id;
        }
        return parent::afterConstruct();
    }
Exemple #6
0
function __autoload($class)
{
    try {
        Library::load($class);
    } catch (Exception $exception) {
        Diagnostics::handleException($exception);
        die('Could not autoload ' . $class);
    }
}
Exemple #7
0
<?php

Library::load('ephFrame.lib.component.MetaTags');
/**
 * Application MetaTags Collection
 * 
 * This is the application metatags wrapper that can be used to add application
 * specific meta tags. It also consumes meta tags values from every attribute
 * value beginning with an @. The example shows how:
 * <code>
 * 
 * </code>
 * 
 * @package harrison
 * @subpackage harrison.lib.component
 * @author Marcel Eichner // Ephigenia <*****@*****.**>
 * @since 2009-03-02
 */
class AppMetaTags extends MetaTags
{
    public $data = array('keywords' => '@keywords.txt', 'author' => 'Marcel Eichner', 'copyright' => '© 2010 Marcel Eichner // Ephigenia', 'description' => '');
    public function __construct($data = null)
    {
        $this->data = $this->__mergeParentProperty('data');
        parent::__construct($data);
    }
    public function startup()
    {
        $this->data['generator'] = 'harrison ' . AppController::VERSION . ', ephFrame';
        $this->data['contact'] = Registry::get('ContactEmail');
        // iterate over metatags to find @[files] ?