本文整理汇总了PHP中Library::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Library::load方法的具体用法?PHP Library::load怎么用?PHP Library::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::load方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: thumb
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);
}
示例2: define
<?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 <love@ephigenia.de>
* @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();
示例3: __construct
<?php
Library::load('ephFrame.lib.net.socket.CURL');
/**
* Simple LastFMAPI Example
* @author Marcel Eichner // Ephigenia <love@ephigenia.de>
* @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)) {
示例4: videoReplace
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;
}
示例5: class_exists
<?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 <love@ephigenia.de>
* @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();
}
示例6: __autoload
function __autoload($class)
{
try {
Library::load($class);
} catch (Exception $exception) {
Diagnostics::handleException($exception);
die('Could not autoload ' . $class);
}
}
示例7: __construct
<?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 <love@ephigenia.de>
* @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] ?