本文整理汇总了PHP中JPluginHelper::getLayoutPath方法的典型用法代码示例。如果您正苦于以下问题:PHP JPluginHelper::getLayoutPath方法的具体用法?PHP JPluginHelper::getLayoutPath怎么用?PHP JPluginHelper::getLayoutPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPluginHelper
的用法示例。
在下文中一共展示了JPluginHelper::getLayoutPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLayoutPath
/**
* @since 1.1.0
*/
public static function getLayoutPath($type, $name, $layout = 'default')
{
// Create the plugin name
$extension = 'plg_' . $type . '_' . $name;
if (!($path = self::getPath($extension, $layout))) {
if (FieldsandfiltersFactory::isVersion()) {
$path = JPluginHelper::getLayoutPath($type, $name, $layout);
} else {
$template = JFactory::getApplication()->getTemplate();
$defaultLayout = $layout;
if (strpos($layout, ':') !== false) {
// Get the template and file name from the string
$temp = explode(':', $layout);
$template = $temp[0] == '_' ? $template : $temp[0];
$layout = $temp[1];
$defaultLayout = $temp[1] ? $temp[1] : 'default';
}
// Build the template and base path for the layout
$tPath = JPATH_THEMES . '/' . $template . '/html/plg_' . $type . '_' . $name . '/' . $layout . '.php';
$bPath = JPATH_BASE . '/plugins/' . $type . '/' . $name . '/tmpl/' . $defaultLayout . '.php';
$dPath = JPATH_BASE . '/plugins/' . $type . '/' . $name . '/tmpl/default.php';
// If the template has a layout override use it
if (file_exists($tPath)) {
$path = $tPath;
} elseif (file_exists($bPath)) {
$path = $bPath;
} else {
$path = $dPath;
}
}
self::setPath($path, $extension, $layout);
}
return $path;
}
示例2: onContentAfterDisplay
public function onContentAfterDisplay($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.details", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
$html = "";
$files = new CrowdfundingFiles\Files(JFactory::getDbo());
$files->load(array("project_id" => $item->id));
if (count($files) > 0) {
$mediaFolderUri = CrowdfundingFilesHelper::getMediaFolderUri($item->user_id);
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('content', 'crowdfundingfiles'));
// Render the login form.
ob_start();
include $path;
$html = ob_get_clean();
}
return $html;
}
示例3: onContentPrepare
/**
* Method called to prepare content before html output
*
* @param string $context The context of the content being passed to the plugin.
* @param object &$item The content object. Note $item->text is also available
* @param object &$params The content params.
* @param integer $page The 'page' number.
*
* @return mixed Returns void on success or false otherwise
*
* @since 2.5
*/
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
require_once dirname(__FILE__) . '/helper.php';
// Simple performance check to determine whether bot should process further.
if (JString::strpos($row->text, '{gallery}') === false) {
return;
}
$regex = "/{gallery}(.+?){\\/gallery}/is";
preg_match_all($regex, $row->text, $matches);
if (!count($matches)) {
return;
}
// Get the path for the layout file
$version = new JVersion();
if ($version->isCompatible(3.0)) {
$path = JPluginHelper::getLayoutPath('content', 'gallery');
} else {
$path = GalleryHelper::getLayoutPath('content', 'gallery');
}
foreach ($matches[1] as $source) {
$row->gallery = GalleryHelper::getGallery($source, '200x160', true, 90, 86400, $row->id);
ob_start();
include $path;
$html = ob_get_contents();
ob_end_clean();
$regex = '/{gallery}' . str_replace('.', '\\.', str_replace('/', '\\/', $source)) . '{\\/gallery}/is';
$row->text = preg_replace($regex, $html, $row->text);
}
return true;
}
示例4: onDisplaySlider
public function onDisplaySlider()
{
if (!$this->isHomePage()) {
return;
}
$app = JFactory::getApplication();
$articles = $this->getLatestPublishedArticles();
ob_start();
include JPluginHelper::getLayoutPath('content', 'slider');
return ob_get_clean();
}
示例5: onInstallerAddInstallationTab
/**
* Textfield or Form of the Plugin.
*
* @return array Returns an array with the tab information
*
* @since 3.6.0
*/
public function onInstallerAddInstallationTab()
{
$tab = array();
$tab['name'] = 'package';
$tab['label'] = JText::_('PLG_INSTALLER_PACKAGEINSTALLER_UPLOAD_PACKAGE_FILE');
// Render the input
ob_start();
include JPluginHelper::getLayoutPath('installer', 'packageinstaller');
$tab['content'] = ob_get_clean();
return $tab;
}
示例6: onContentAfterDisplay
public function onContentAfterDisplay($context, &$article, &$params, $limitstart)
{
$app = JFactory::getApplication();
$view = $app->input->get('view');
if ($context == 'com_content.article' && $view == 'article') {
$articles = $this->getRelatedArticles($article->id, $article->catid);
ob_start();
include JPluginHelper::getLayoutPath('content', 'relatedarticles');
return ob_get_clean();
}
return;
}
示例7: onExtrasDisplay
/**
* This method prepares a code that will be included to step "Extras" on project wizard.
*
* @param string $context This string gives information about that where it has been executed the trigger.
* @param object $item A project data.
* @param Joomla\Registry\Registry $params The parameters of the component
*
* @return null|string
*/
public function onExtrasDisplay($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.project.extras", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
if (empty($item->user_id)) {
return null;
}
// Create a media folder.
$mediaFolder = CrowdfundingFilesHelper::getMediaFolder();
if (!JFolder::exists($mediaFolder)) {
CrowdfundingHelper::createFolder($mediaFolder);
}
// Create a media folder for a user.
$mediaFolder = CrowdfundingFilesHelper::getMediaFolder($item->user_id);
if (!JFolder::exists($mediaFolder)) {
CrowdfundingHelper::createFolder($mediaFolder);
}
$componentParams = JComponentHelper::getParams("com_crowdfundingfiles");
/** @var $componentParams Joomla\Registry\Registry */
$mediaUri = CrowdfundingFilesHelper::getMediaFolderUri($item->user_id);
$options = array("project_id" => $item->id, "user_id" => $item->user_id);
$files = new CrowdfundingFiles\Files(JFactory::getDbo());
$files->load($options);
// Load jQuery
JHtml::_("jquery.framework");
JHtml::_("prism.ui.pnotify");
JHtml::_('prism.ui.fileupload');
JHtml::_('prism.ui.joomlaHelper');
// Include the translation of the confirmation question.
JText::script('PLG_CROWDFUNDING_FILES_DELETE_QUESTION');
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfunding', 'files'));
// Render the login form.
ob_start();
include $path;
$html = ob_get_clean();
return $html;
}
示例8: onExtrasDisplay
/**
* This method prepares a code that will be included to step "Extras" on project wizard.
*
* @param string $context This string gives information about that where it has been executed the trigger.
* @param object $item A project data.
* @param Joomla\Registry\Registry $params The parameters of the component
*
* @return null|string
*/
public function onExtrasDisplay($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.project.extras", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
if (empty($item->user_id)) {
return null;
}
// A flag that shows the options are active.
if (!$this->params->get("display_paypal", 0) and !$this->params->get("display_banktransfer", 0)) {
return "";
}
$activeTab = "";
if ($this->params->get("display_paypal", 0)) {
$activeTab = "paypal";
} elseif ($this->params->get("display_banktransfer", 0)) {
$activeTab = "banktransfer";
}
$payout = new CrowdfundingFinance\Payout(JFactory::getDbo());
$payout->load($item->id);
// Load jQuery
JHtml::_("jquery.framework");
JHtml::_("prism.ui.pnotify");
JHtml::_('prism.ui.joomlaHelper');
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfunding', 'payoutoptions'));
// Render the login form.
ob_start();
include $path;
$html = ob_get_clean();
return $html;
}
示例9: onContentPrepare
public function onContentPrepare($context, &$article, &$params, $page)
{
$pattern = '/\\{simpleimageslider (.*)\\}/';
if (preg_match($pattern, $article->text) !== 1) {
return;
}
JHTML::_('bootstrap.framework');
// TODO necessary or is jQuery enough?
$doc = JFactory::getDocument();
$doc->addScript('media/plg_content_simpleimageslider/simpleimageslider.js');
$doc->addStyleSheet('media/plg_content_simpleimageslider/simpleimageslider.css');
$path = JPluginHelper::getLayoutPath('content', 'simpleimageslider');
$replacement = file_get_contents($path);
$lang = JFactory::getLanguage();
$lang->load('plg_content_simpleimageslider', JPATH_ADMINISTRATOR);
$replacement = preg_replace('/SIS_LOADING/', JText::_('PLG_CONTENT_SIMPLEIMAGESLIDER_LOADING'), $replacement);
$replacement = preg_replace('/SIS_IMAGE/', JText::_('PLG_CONTENT_SIMPLEIMAGESLIDER_IMAGE'), $replacement);
$replacement = preg_replace('/SIS_OF/', JText::_('PLG_CONTENT_SIMPLEIMAGESLIDER_OF'), $replacement);
$replacement = preg_replace('/SIS_BASEPATH/', JURI::base(), $replacement);
$article->text = preg_replace($pattern, $replacement, $article->text);
// TODO use preg_quote for $replacement?
}
示例10: onContentAfterDisplay
/**
* Generate and display a list of team members on details page.
*
* @param string $context
* @param object $item
* @param Joomla\Registry\Registry $params
*
* @return null|string
*/
public function onContentAfterDisplay($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.details", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
$html = "";
$partners = new CrowdfundingPartners\Partners(JFactory::getDbo());
$partners->load($item->id);
if (0 < count($partners)) {
// Include the project owner to the team.
if ($this->params->get("display_owner", 0)) {
$user = JFactory::getUser($item->user_id);
$owner = array("name" => $user->get("name"), "project_id" => $item->id, "partner_id" => $item->user_id);
$partners->add($owner);
}
// Get a social platform for integration
$socialPlatform = $params->get("integration_social_platform");
// Prepare avatars.
$this->prepareIntegration($partners, $socialPlatform);
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('content', 'crowdfundingpartners'));
// Render the login form.
ob_start();
include $path;
$html = ob_get_clean();
}
return $html;
}
示例11: onExtrasDisplay
/**
* This method prepares a code that will be included to step "Extras" on project wizard.
*
* @param string $context This string gives information about that where it has been executed the trigger.
* @param object $item A project data.
* @param Joomla\Registry\Registry $params The parameters of the component
*
* @return null|string
*/
public function onExtrasDisplay($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.project.extras", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
if (empty($item->user_id)) {
return null;
}
$partners = new CrowdfundingPartners\Partners(JFactory::getDbo());
$partners->load($item->id);
// Get a social platform for integration
$socialPlatform = $params->get("integration_social_platform");
// Prepare avatars.
$this->prepareIntegration($partners, $socialPlatform);
// Load jQuery
JHtml::_("jquery.framework");
JHtml::_("prism.ui.pnotify");
JHtml::_('prism.ui.joomlaHelper');
// Include the translation of the confirmation question.
JText::script('PLG_CROWDFUNDING_PARTNERS_DELETE_QUESTION');
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfunding', 'partners'));
// Render the login form.
ob_start();
include $path;
$html = ob_get_clean();
return $html;
}
示例12: onProjectPayment
/**
* This method prepares a payment gateway - buttons, forms,...
* That gateway will be displayed on the summary page as a payment option.
*
* @param string $context This string gives information about that where it has been executed the trigger.
* @param object $item A project data.
* @param Joomla\Registry\Registry $params The parameters of the component
*
* @return null|string
*/
public function onProjectPayment($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.payment", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
JHtml::_('jquery.framework');
JText::script('PLG_CROWDFUNDINGPAYMENT_BANKTRANSFER_REGISTER_TRANSACTION_QUESTION');
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfundingpayment', 'banktransfer'));
ob_start();
include $path;
$html = ob_get_clean();
return $html;
}
示例13: defined
<?php
defined('_JEXEC') or die;
?>
<div class="main-slider-wrap">
<div class="main-slider">
<?php
foreach ($articles as $item) {
?>
<?php
require JPluginHelper::getLayoutPath('content', 'slider', $app->input->get('layout', 'default') . '_slide_image');
?>
<?php
}
?>
</div>
<div class="main-text-slider">
<?php
foreach ($articles as $item) {
?>
<?php
require JPluginHelper::getLayoutPath('content', 'slider', $app->input->get('layout', 'default') . '_slide_text');
?>
<?php
}
?>
</div>
</div>
示例14: testGetLayoutPath
/**
* Test JPluginHelper::getLayoutPath
*
* @return void
*
* @since 3.2
*/
public function testGetLayoutPath()
{
$this->assertEquals(JPluginHelper::getLayoutPath('content', 'pagenavigation'), JPATH_ROOT . '/plugins/content/pagenavigation/tmpl/default.php', 'The default layout path for plg_content_pagenavigation should be returned');
}
示例15: displayVotingData
/**
* Displays the voting area
*
* @param string $context The context of the content being passed to the plugin
* @param object &$row The article object
* @param object &$params The article params
* @param integer $page The 'page' number
*
* @return string|boolean HTML string containing code for the votes if in com_content else boolean false
*
* @since __DEPLOY_VERSION__
*/
private function displayVotingData($context, &$row, &$params, $page)
{
$parts = explode(".", $context);
if ($parts[0] != 'com_content') {
return false;
}
if (empty($params) || !$params->get('show_vote', null)) {
return '';
}
// Load plugin language files only when needed (ex: they are not needed if show_vote is not active).
$this->loadLanguage();
// Get the path for the rating summary layout file
$path = JPluginHelper::getLayoutPath('content', 'vote', 'rating');
// Render the layout
ob_start();
include $path;
$html = ob_get_clean();
if ($this->app->input->getString('view', '') == 'article' && $row->state == 1) {
// Get the path for the voting form layout file
$path = JPluginHelper::getLayoutPath('content', 'vote', 'vote');
// Render the layout
ob_start();
include $path;
$html .= ob_get_clean();
}
return $html;
}