/** * Initiate class * * @access public * @return void */ function NexusSystem() { // Set the package using LibertySystem $this->mSystem = NEXUS_PKG_NAME; $this->mPluginPath = NEXUS_PKG_PATH . "plugins/"; parent::__construct(FALSE); }
/** * fetch all available thumbnails for a given item. if no thumbnails are present, get thumbnailing image or the appropriate mime type icon * * @param array $pParamHash Hash of all settings used to fetch thumbnails, including source_file, default_image, thumbnail_sizes, and mime_image * @access public * @return array of available thumbnails or mime icons * TODO: individual options are only for legacy reasons - remove options and deprecated() soon - xing - Monday Jun 23, 2008 22:36:53 CEST */ function liberty_fetch_thumbnails($pParamHash) { global $gBitSystem, $gThumbSizes; $ret = array(); if (!empty($pParamHash['source_file'])) { if (empty($pParamHash['thumbnail_sizes'])) { $pParamHash['thumbnail_sizes'] = array_keys($gThumbSizes); } // liberty file processors automatically pick the best format for us. we can force a format though. // using array_unique will give us the best order in which to look for the thumbnails $exts = array_unique(array($gBitSystem->getConfig('liberty_thumbnail_format', 'jpg'), 'jpg', 'png', 'gif', 'x-jpeg')); // short hand $path =& $pParamHash['source_file']; // $path might already be the absolute path or it might already contain BIT_ROOT_URL if (!($path = preg_replace("!^" . preg_quote(STORAGE_PKG_PATH, "!") . "!", "", $path))) { $path = preg_replace("!^" . preg_quote(STORAGE_PKG_URL, "!") . "!", "", $path); } // remove the filename if there is one (we can't just use dirname() becuase we might only have the path to the dir) $dir = substr($path, 0, strrpos($path, '/') + 1); // assume thumb sizes are from largest to smallest. reverse so smaller can be used if larger don't exist $lastSize = NULL; foreach (array_reverse($pParamHash['thumbnail_sizes']) as $size) { foreach ($exts as $ext) { $image = $size . '.' . $ext; $thumbDir = is_dir(STORAGE_PKG_PATH . $dir . 'thumbs/') ? $dir . 'thumbs/' : $dir; if (is_readable(STORAGE_PKG_PATH . $thumbDir . $image)) { $ret[$size] = (empty($_REQUEST['uri_mode']) ? STORAGE_PKG_URL : STORAGE_PKG_URI) . $thumbDir . $image; } } // fetch mime image unless we set this to FALSE if ((!isset($pParamHash['mime_image']) || $pParamHash['mime_image'] === TRUE) && empty($ret[$size])) { if ($lastSize && !empty($ret[$lastSize])) { $ret[$size] = $ret[$lastSize]; } } $lastSize = $size; } // default if nothing else is available foreach (array_reverse($pParamHash['thumbnail_sizes']) as $size) { if (empty($ret[$size])) { if (!empty($pParamHash['default_image'])) { $ret[$size] = $pParamHash['default_image']; } else { // we need to make sure we have an image name that we can look up the mime type $path .= strrpos($dir, '/') == strlen($path) ? 'dummy.jpg' : basename($path); $ret[$size] = LibertySystem::getMimeThumbnailURL($gBitSystem->lookupMimeType($path), substr($path, strrpos($path, '.') + 1)); } } } } return $ret; }
<?php /** * base package include * * @author spider <*****@*****.**> * @version $Revision$ * @package liberty * @subpackage functions */ $registerHash = array('package_name' => 'liberty', 'package_path' => dirname(__FILE__) . '/', 'required_package' => TRUE); $gBitSystem->registerPackage($registerHash); // initiate LibertySystem require_once LIBERTY_PKG_PATH . 'LibertySystem.php'; LibertySystem::loadSingleton(); $gBitSmarty->assignByRef('gLibertySystem', $gLibertySystem); // We can't load this in liberty/bit_setup_inc.php becuase it's too soon in the process. // packages haven't been scanned yet making things like <pkg>_PKG_URL and similar // unavailable to the plugins that are kept in <pkg>/liberty_plugins/ $current_default_format_guid = $gBitSystem->getConfig('default_format'); if ($gLibertySystem->mDb->isValid()) { // install condition check $plugin_status = $gBitSystem->getConfig('liberty_plugin_status_' . $current_default_format_guid); if (empty($current_default_format_guid) || empty($plugin_status) || $plugin_status != 'y') { $gLibertySystem->scanAllPlugins(); } else { $gLibertySystem->loadActivePlugins(); } } $gLibertySystem->registerService('liberty', LIBERTY_PKG_NAME, array('content_edit_mini_tpl' => 'bitpackage:liberty/service_content_edit_mini_inc.tpl', 'content_edit_tab_tpl' => 'bitpackage:liberty/service_content_edit_tab_inc.tpl', 'content_icon_tpl' => 'bitpackage:liberty/service_content_icon_inc.tpl', 'content_body_tpl' => 'bitpackage:liberty/service_content_body_inc.tpl', 'content_display_function' => 'liberty_content_display', 'content_edit_function' => 'liberty_content_edit', 'content_load_sql_function' => 'liberty_content_load_sql', 'content_list_sql_function' => 'liberty_content_list_sql', 'content_preview_function' => 'liberty_content_preview'), array('description' => tra('Provides core functionality, including enforcing some access control and dynamic layout components.'), 'required' => TRUE)); // delete cache file if requested