本文整理匯總了PHP中Gallery::LoadGallery方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gallery::LoadGallery方法的具體用法?PHP Gallery::LoadGallery怎麽用?PHP Gallery::LoadGallery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Gallery
的用法示例。
在下文中一共展示了Gallery::LoadGallery方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: runTask
/**
* Triggers to perform upgrade tasks using a special key from the db upgrade routine
* If we have to move files or remove something specifically during an upgrade
* @param $id
*/
public function runTask($id)
{
Yii::log("Running upgrade task {$id}.", 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
switch ($id) {
case 416:
//Place any header images in our new gallery library
Gallery::LoadGallery(1);
$d = dir(YiiBase::getPathOfAlias('webroot') . "/images/header");
while (false !== ($filename = $d->read())) {
if ($filename[0] != ".") {
$model = new GalleryPhoto();
$model->gallery_id = 1;
$model->file_name = $filename;
$model->name = '';
$model->description = '';
$model->save();
$arrImages["/images/header/" . $filename] = CHtml::image(Yii::app()->request->baseUrl . "/images/header/" . $filename);
$src = YiiBase::getPathOfAlias('webroot') . "/images/header/" . $filename;
$fileinfo = mb_pathinfo($filename);
$model->thumb_ext = $fileinfo['extension'];
$model->save();
$imageFile = new CUploadedFile($filename, $src, "image/" . $fileinfo['extension'], getimagesize($src), null);
if (Yii::app()->params['LIGHTSPEED_MT'] == '1') {
$model->setS3Image($imageFile);
} else {
$model->setImage($imageFile);
}
}
}
break;
case 417:
//Remove wsconfig.php reference from /config/main.php
if (Yii::app()->params['LIGHTSPEED_MT'] == 1) {
return;
}
//only applies to single tenant
$main_config = file_get_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php");
// @codingStandardsIgnoreStart
$main_config = str_replace('if (file_exists(dirname(__FILE__).\'/wsconfig.php\'))
$wsconfig = require(dirname(__FILE__).\'/wsconfig.php\');
else $wsconfig = array();', '//For customization, let\'s look in custom/config for a main.php which will be merged
//Use this instead of modifying this main.php directly
if(file_exists(realpath(dirname(__FILE__)."/../custom").\'/config/main.php\'))
$arrCustomConfig = require(realpath(dirname(__FILE__)."/../custom").\'/config/main.php\');
else
$arrCustomConfig = array();', $main_config);
$main_config = str_replace('),$wsconfig);', '),
$arrCustomConfig
);', $main_config);
// @codingStandardsIgnoreEnd
file_put_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php", $main_config);
break;
case 423:
// add cart/cancel url rule for sim payment methods (ex. moneris) that require hardcoded cancel urls
$main_config = file_get_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php");
// check to see if the entry is already there and write it if it isn't
$position = strpos($main_config, 'cart/cancel');
if (!$position) {
$comments = "\r\r\t\t\t\t\t\t// moneris simple integration requires a hardcoded cancel URL\r\t\t\t\t\t\t// any other methods that require something similar we can add a cart/cancel rule like this one\r\t\t\t\t\t\t";
$pos = strpos($main_config, "sro/view',") + strlen("sro/view',");
$main_config = substr_replace($main_config, $comments . "'cart/cancel/<order_id:\\WO-[0-9]+>&<cancelTXN:(.*)>'=>'cart/cancel',\t\t\t\t\t\t", $pos, 0);
file_put_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php", $main_config);
}
break;
case 427:
// Add URL mapping for custom pages
// If the store's on multi-tenant server, do nothing
if (Yii::app()->params['LIGHTSPEED_MT'] > 0) {
return;
}
$main_config = file_get_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php");
$search_string = "'<id:(.*)>/pg'";
// Check if the entry already exists. If not, add the mapping.
if (strpos($main_config, $search_string) === false) {
$position = strpos($main_config, "'<feed:[\\w\\d\\-_\\.()]+>.xml' => 'xml/<feed>', //xml feeds");
$custompage_mapping = "'<id:(.*)>/pg'=>array('custompage/index', 'caseSensitive'=>false,'parsingOnly'=>true), //Custom Page\r\t\t\t\t\t\t";
$main_config = substr_replace($main_config, $custompage_mapping, $position, 0);
file_put_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php", $main_config);
}
break;
case 447:
// Remove bootstrap, add in separate main.php
// If the store's on multi-tenant server, do nothing
if (Yii::app()->params['LIGHTSPEED_MT'] > 0) {
return;
}
$main_config = file_get_contents(YiiBase::getPathOfAlias('webroot') . "/config/main.php");
// @codingStandardsIgnoreStart
//Remove preloading bootstrap, loaded now in Controller.php on demand if needed
$main_config = str_replace("\t\t\t'bootstrap',\n", "", $main_config);
//Bootstrap is loaded on demand now
$main_config = str_replace("//Twitter bootstrap\n\t\t\t\t'bootstrap'=>array(\n\t\t\t\t\t'class'=>'ext.bootstrap.components.Bootstrap',\n\t\t\t\t\t'responsiveCss'=>true,\n\t\t\t\t),", "", $main_config);
//Remove old email strings and facebook strings, they're loaded elsewhere now
$main_config = str_replace("//Email handling\n\t\t\t\t'email'=>require(dirname(__FILE__).'/wsemail.php'),\n", "", $main_config);
//Remove old email strings and facebook strings, they're loaded elsewhere now
//.........這裏部分代碼省略.........
示例2: actionImage
/**
* Manage user uploaded images
*/
public function actionImage()
{
$id = Yii::app()->getRequest()->getQuery('id');
$this->render('image', array('gallery' => Gallery::LoadGallery($id)));
}
示例3: _upload_default_header_to_s3
function _upload_default_header_to_s3()
{
Gallery::LoadGallery(1);
$d = dir(YiiBase::getPathOfAlias('webroot') . "/images/header");
while (false !== ($filename = $d->read())) {
if ($filename == "defaultheader.png") {
$model = new GalleryPhoto();
$model->gallery_id = 1;
$model->file_name = $filename;
$model->name = '';
$model->description = '';
$model->thumb_ext = 'png';
$model->save();
$arrImages["/images/header/" . $filename] = CHtml::image(Yii::app()->request->baseUrl . "/images/header/" . $filename);
$src = YiiBase::getPathOfAlias('webroot') . "/images/header/" . $filename;
$fileinfo = mb_pathinfo($filename);
$imageFile = new CUploadedFile($filename, $src, "image/" . $fileinfo['extension'], getimagesize($src), null);
if (Yii::app()->params['LIGHTSPEED_MT'] == '1') {
$model->setS3Image($imageFile);
}
_xls_set_conf('HEADER_IMAGE', "//lightspeedwebstore.s3.amazonaws.com/" . _xls_get_conf('LIGHTSPEED_HOSTING_LIGHTSPEED_URL') . "/gallery/1/" . $model->id . ".png");
}
}
}