本文整理匯總了PHP中BlockView::getBlockPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP BlockView::getBlockPath方法的具體用法?PHP BlockView::getBlockPath怎麽用?PHP BlockView::getBlockPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BlockView
的用法示例。
在下文中一共展示了BlockView::getBlockPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: computeView
private function computeView() {
$bFilename = $this->bFilename;
$obj = $this->obj;
// if we've passed in "templates/" as the first part, we strip that off.
if (strpos($bFilename, 'templates/') === 0) {
$bFilename = substr($bFilename, 10);
}
if ($bFilename) {
if (is_file(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
$template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
$bv = new BlockView();
$bv->setBlockObject($obj);
$this->baseURL = $bv->getBlockURL();
$this->basePath = $bv->getBlockPath($this->render);
} else if (is_file(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
$template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
$this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
$this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle();
} else if (is_dir(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
$template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render;
$this->baseURL = DIR_REL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
} else if (is_dir(DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
$template = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render;
$this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
}
// we check all installed packages
if (!isset($template)) {
$pl = PackageList::get();
$packages = $pl->getPackages();
foreach($packages as $pkg) {
$d = '';
if (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle())) {
$d = DIR_PACKAGES . '/'. $pkg->getPackageHandle();
} else if (is_dir(DIR_PACKAGES_CORE . '/'. $pkg->getPackageHandle())) {
$d = DIR_PACKAGES_CORE . '/'. $pkg->getPackageHandle();
}
if ($d != '') {
$baseStub = (is_dir(DIR_PACKAGES . '/' . $pkg->getPackageHandle())) ? DIR_REL . '/' . DIRNAME_PACKAGES . '/'. $pkg->getPackageHandle() : ASSETS_URL . '/'. DIRNAME_PACKAGES . '/' . $pkg->getPackageHandle();
if (is_file($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $bFilename)) {
$template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . $bFilename;
$this->baseURL = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
$this->basePath = DIR_FILES_BLOCK_TYPES_CORE . '/' . $obj->getBlockTypeHandle();
} else if (is_file($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
$template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
$this->baseURL = $baseStub . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
$this->basePath = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
} else if (is_dir($d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename)) {
$template = $d . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename . '/' . $this->render;
$this->baseURL = $baseStub . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle() . '/' . DIRNAME_BLOCK_TEMPLATES . '/' . $bFilename;
}
}
if ($this->baseURL != '') {
continue;
}
}
}
} else if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '.php')) {
$template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '.php';
$bv = new BlockView();
$bv->setBlockObject($obj);
$this->baseURL = $bv->getBlockURL();
$this->basePath = $bv->getBlockPath($this->render);
} else if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $this->render)) {
$template = DIR_FILES_BLOCK_TYPES . '/' . $obj->getBlockTypeHandle() . '/' . $this->render;
$this->baseURL = DIR_REL . '/' . DIRNAME_BLOCKS . '/' . $obj->getBlockTypeHandle();
}
if (!isset($template)) {
$bv = new BlockView();
$bv->setBlockObject($obj);
$template = $bv->getBlockPath($this->render) . '/' . $this->render;
$this->baseURL = $bv->getBlockURL();
}
if ($this->basePath == '') {
$this->basePath = dirname($template);
}
$this->template = $template;
}
示例2: isEditable
function isEditable() {
$bv = new BlockView();
$bv->setBlockObject($this);
$path = $bv->getBlockPath(FILENAME_BLOCK_EDIT);
if (file_exists($path . '/' . FILENAME_BLOCK_EDIT)) {
return true;
}
return false;
}
示例3: hasComposerBlockTemplate
public function hasComposerBlockTemplate()
{
$bv = new BlockView();
$bv->setBlockObject($this);
$cpFilename = $this->getBlockComposerFilename();
if ($cpFilename) {
$cmpbase = $bv->getBlockPath(DIRNAME_BLOCK_TEMPLATES_COMPOSER . '/' . $cpFilename);
if (file_exists($cmpbase . '/' . DIRNAME_BLOCK_TEMPLATES_COMPOSER . '/' . $cpFilename)) {
return true;
}
}
$cmpbase = $bv->getBlockPath(FILENAME_BLOCK_COMPOSER);
if (file_exists($cmpbase . '/' . FILENAME_BLOCK_COMPOSER)) {
return true;
}
return false;
}
示例4: hasAddTemplate
/**
* Determines if the block type has templates available
* @return boolean
*/
public function hasAddTemplate() {
$bv = new BlockView();
$bv->setBlockObject($this);
$path = $bv->getBlockPath(FILENAME_BLOCK_ADD);
if (file_exists($path . '/' . FILENAME_BLOCK_ADD)) {
return true;
}
return false;
}