本文整理汇总了PHP中Library类的典型用法代码示例。如果您正苦于以下问题:PHP Library类的具体用法?PHP Library怎么用?PHP Library使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Library类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObjectStructure
static function getObjectStructure()
{
global $user;
//Load Libraries for lookup values
$library = new Library();
$library->orderBy('displayName');
if ($user->hasRole('libraryAdmin')) {
$homeLibrary = Library::getPatronHomeLibrary();
$library->libraryId = $homeLibrary->libraryId;
}
$library->find();
$libraryList = array();
while ($library->fetch()) {
$libraryList[$library->libraryId] = $library->displayName;
}
require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php';
$browseCategories = new BrowseCategory();
$browseCategories->orderBy('label');
$browseCategories->find();
$browseCategoryList = array();
while ($browseCategories->fetch()) {
$browseCategoryList[$browseCategories->textId] = $browseCategories->label . " ({$browseCategories->textId})";
}
$structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'browseCategoryTextId' => array('property' => 'browseCategoryTextId', 'type' => 'enum', 'values' => $browseCategoryList, 'label' => 'Browse Category', 'description' => 'The browse category to display '), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true));
foreach ($structure as $fieldName => $field) {
$field['propertyOld'] = $field['property'] . 'Old';
$structure[$fieldName] = $field;
}
return $structure;
}
示例2: Main
public static function Main()
{
ob_start();
$lib = new Library();
$lib->f();
var_dump(new LibX());
$x = 1;
if ($x) {
class Q
{
}
}
eval('
class P extends Q { }
');
eval('
class A extends C { }
class D extends A { }
class E extends LibX { }
');
class F extends P
{
}
var_dump(new Q(), new P(), new A(), new D(), new E(), new F());
$out = ob_get_contents();
ob_end_clean();
$EXPECTED = "object(LibX)(0) {\r\n}\r\nobject(Q)(0) {\r\n}\r\nobject(P)(0) {\r\n}\r\nobject(A)(0) {\r\n}\r\nobject(D)(0) {\r\n}\r\nobject(E)(0) {\r\n}\r\nobject(F)(0) {\r\n}\r\n";
echo $out == $EXPECTED ? "OK" : "ERROR", "\n";
}
示例3: showfileAction
public function showfileAction()
{
$strContent = null;
$strPathFile = $this->params()->fromRoute('path');
if (!empty($strPathFile)) {
$strPathFile = base64_decode($strPathFile);
$booForceDownload = strtolower($this->params()->fromRoute('force_download'));
if (!empty($booForceDownload)) {
$booForceDownload = base64_decode($booForceDownload);
}
if (file_exists($strPathFile)) {
$library = new Library();
if ($booForceDownload == 'true' || stripos($library->getMimeContentFromFile($strPathFile), 'image/') === false) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . end(explode('/', $strPathFile)) . '"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($strPathFile));
} else {
header('Content-Type: ' . $library->getMimeContentFromFile($strPathFile) . ';');
}
readfile($strPathFile);
} else {
$strContent = 'Arquivo inexistente!';
}
} else {
$strContent = 'Parâmetros incorretos!';
}
return $this->getViewClearContent($strContent);
}
示例4: checkoutValidaiton
public function checkoutValidaiton()
{
$validation = new Library();
$validation->getValidationOk();
if ($validation->getValidationOk()) {
echo "Success";
} else {
echo "Fail";
}
}
示例5: getLibraryName
function getLibraryName()
{
if ($this->libraryId == -1) {
return 'Shared Digital Collection';
} else {
$library = new Library();
$library->libraryId = $this->libraryId;
$library->find(true);
return $library->displayName;
}
}
示例6: return_book
public function return_book($copyId)
{
include 'connection.php';
$lib = new Library();
$lib->addCopy($copyId);
date_default_timezone_set('America/Chicago');
$date = date('Y-m-d');
$sql = "UPDATE Group8_loanHistory SET returned='" . $date . "' WHERE copyId = '" . $copyId . "' and username = '" . $this->username . "'";
//$sql = "delete from Group8_loanHistory where copyId = '".$copyId."' and username = '".$this->username."' and returned is null";
if ($conn->query($sql) === false) {
die('Invalid query: ' . $conn->error);
}
include 'close_connection.php';
}
示例7: addRouteRecursively
/**
* The recursive method powering addRouteFor(Request).
*
* @param array Part of a path in reverse order.
* @param int Current index of path part array - decrements with each step.
* @param Route The route being added
*
* @return FindRouteResult
*/
private function addRouteRecursively(&$pathParts, $index, $route)
{
// Base Case
if ($index < 0) {
foreach ($route->methods as $method) {
if (isset($this->m[$method])) {
Library::import('recess.framework.routing.DuplicateRouteException');
throw new DuplicateRouteException($method . ' ' . str_replace('//', '/', $route->path), $route->fileDefined, $route->lineDefined);
}
$this->m[$method] = new Rt($route);
}
return;
}
$nextPart = $pathParts[$index];
if ($nextPart[0] != '$') {
$childrenArray =& $this->s;
$nextKey = $nextPart;
$isParam = false;
} else {
$childrenArray =& $this->p;
$nextKey = substr($nextPart, 1);
$isParam = true;
}
if (!isset($childrenArray[$nextKey])) {
$child = new RtNode();
if ($isParam) {
$child->c = $nextKey;
}
$childrenArray[$nextKey] = $child;
} else {
$child = $childrenArray[$nextKey];
}
$child->addRouteRecursively($pathParts, $index - 1, $route);
}
示例8: isValidForUser
function isValidForUser($locationCode, $eContentFieldData)
{
$sharing = $this->getSharing($locationCode, $eContentFieldData);
if ($sharing == 'shared') {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary == null || $searchLibrary->econtentLocationsToInclude == 'all' || strlen($searchLibrary->econtentLocationsToInclude) == 0 || strpos($searchLibrary->econtentLocationsToInclude, $locationCode) !== FALSE) {
return true;
} else {
return false;
}
} else {
if ($sharing == 'library') {
$searchLibrary = Library::getSearchLibrary();
if ($searchLibrary == null || $searchLibrary->includeOutOfSystemExternalLinks || strlen($searchLibrary->ilsCode) > 0 && strpos($locationCode, $searchLibrary->ilsCode) === 0) {
return true;
} else {
return false;
}
} else {
$searchLibrary = Library::getSearchLibrary();
$searchLocation = Location::getSearchLocation();
if ($searchLibrary->includeOutOfSystemExternalLinks || strpos($locationCode, $searchLocation->code) === 0) {
return true;
} else {
return false;
}
}
}
}
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// Using factory
// Getting an instance of a model User example
$user = ModelFactory::getInstance('User');
// Getting an instance of a Library String
$stringLib = LibraryFactory::getInstance('String');
// Getting an instance of a Filter DateRange
$dateRange = FilterFactory::getInstance('DateRange');
// Getting an instance of a Type User
$userType = TypeFactory::getInstance('User');
// Perform an access check
AccessCheckFactory::getInstance('User')->canAccess(auth()->user()->id, 'view');
// Using facade
// Getting an instance of a model User example
$user = \Model::getInstance('User');
// Getting an instance of a Library String
$stringLib = \Library::getInstance('String');
// Getting an instance of a Filter DateRange
$dateRange = \Filter::getInstance('DateRange');
// Getting an instance of a Type User
$userType = \Type::getInstance('User');
// Passing data to view example
$this->view->fullname = auth()->user()->fullname;
// Perform an access check
\AccessCheck::getInstance('User')->canAccess(1, 'view');
return $this->view('dashboard');
}
示例10: 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);
}
示例11: expand
protected function expand($class, $reflection, $descriptor)
{
if (is_array($this->values[0])) {
$this->httpMethods = $this->values[0];
} else {
$this->httpMethods = array($this->values[0]);
}
if (isset($this->values[1])) {
$this->path = $this->values[1];
}
$controller = Library::getFullyQualifiedClassName($class);
$controllerMethod = $reflection->getName();
if (strpos($this->path, Library::pathSeparator) === 0) {
// Absolute Route
$route = new Route($controller, $controllerMethod, $this->httpMethods, $this->path);
$descriptor->methodUrls[$controllerMethod] = $this->path;
} else {
// Relative Route
$route = new Route($controller, $controllerMethod, $this->httpMethods, $descriptor->routesPrefix . $this->path);
$descriptor->methodUrls[$controllerMethod] = $descriptor->routesPrefix . $this->path;
}
$route->fileDefined = $reflection->getFileName();
$route->lineDefined = $reflection->getStartLine();
$descriptor->routes[] = $route;
}
示例12: __construct
public function __construct()
{
Cowl::timer('cowl init');
@session_start();
// I know that the @-notation is frowned upon, but adding it to session_start saves us unnecessary warnings
Cache::setDir(COWL_CACHE_DIR);
Current::initialize(COWL_DIR);
if (COWL_CLI) {
$this->parseCLIPath();
} else {
$this->parseRequestPath();
}
Cowl::timer('cowl set defaults');
// Get and set all directories for various things.
list($commands_dir, $model_dir, $validators_dir, $library_dir, $view_dir, $helpers_dir, $helpers_app_dir, $drivers_dir, $app_dir, $view_layout_dir, $validator_error_messages, $lang) = Current::$config->gets('paths.commands', 'paths.model', 'paths.validators', 'paths.library', 'paths.view', 'paths.helpers', 'paths.helpers_app', 'paths.drivers', 'paths.app', 'paths.layouts', 'paths.validator_messages', 'lang');
Controller::setDir($commands_dir);
DataMapper::setMappersDir($model_dir);
DataMapper::setObjectsDir($model_dir);
Validator::setPath($validators_dir);
Validator::loadStrings($validator_error_messages, $lang);
Templater::setBaseDir($view_dir);
Templater::setLayoutDir($view_layout_dir);
Library::setPath($library_dir);
Helpers::setPath($helpers_dir);
Helpers::setAppPath($helpers_app_dir);
Database::setPath($drivers_dir);
StaticServer::setDir($app_dir);
Cowl::timerEnd('cowl set defaults');
Cowl::timer('cowl plugins load');
Current::$plugins = new Plugins();
Cowl::timerEnd('cowl plugins load');
// Load default helper
Helpers::load('standard', 'form');
Cowl::timerEnd('cowl init');
}
示例13: __construct
public function __construct()
{
$library = Library::getActive();
if (is_object($library)) {
$this->controller = $library->getController();
}
}
示例14: getName
/**
* Get the name of this face.
*
* @return string The name of this face.
*/
public function getName()
{
if (is_null($this->name)) {
$this->name = $this->library->getFaceName($this->key);
}
return $this->name;
}
示例15: getComments
public function getComments($menuId)
{
$rows = $this->db->query("SELECT * FROM comment WHERE menu_id=%i", $menuId)->fetchAll();
foreach ($rows as &$row) {
$row['comment_id'] = (int) $row['comment_id'];
}
array_unshift($rows, new \Dibi\Row(array('id' => 0, 'comment_id' => null)));
$tree = $this->library->convertToTree($rows, 'id', 'comment_id', 'comments');
$tree[0]['comments'] = $this->library->removeKeys($tree[0]['comments'], 'comments');
return $tree[0]['comments'];
}