当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::asset方法代码示例

本文整理汇总了PHP中Html::asset方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::asset方法的具体用法?PHP Html::asset怎么用?PHP Html::asset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Html的用法示例。


在下文中一共展示了Html::asset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: button

 /**
  * Method to generate html code for a list of buttons
  *
  * @param   array|object   $button  Button properties
  * @return  string
  */
 public static function button($button)
 {
     if (!empty($button['access'])) {
         if (is_bool($button['access'])) {
             if ($button['access'] == false) {
                 return '';
             }
         } else {
             // Take each pair of permission, context values.
             for ($i = 0, $n = count($button['access']); $i < $n; $i += 2) {
                 if (!\User::authorise($button['access'][$i], $button['access'][$i + 1])) {
                     return '';
                 }
             }
         }
     }
     $html[] = '<div class="icon-wrapper"' . (empty($button['id']) ? '' : ' id="' . $button['id'] . '"') . '>';
     $html[] = '<div class="icon">';
     $html[] = '<a href="' . $button['link'] . '"';
     $html[] = empty($button['target']) ? '' : ' target="' . $button['target'] . '"';
     $html[] = empty($button['onclick']) ? '' : ' onclick="' . $button['onclick'] . '"';
     $html[] = empty($button['title']) ? '' : ' title="' . htmlspecialchars($button['title']) . '"';
     $html[] = '>';
     if (isset($button['image']) && $button['image']) {
         $html[] = \Html::asset('image', empty($button['image']) ? '' : $button['image'], empty($button['alt']) ? null : htmlspecialchars($button['alt']), null, true);
     }
     $html[] = empty($button['text']) ? '' : '<span>' . $button['text'] . '</span>';
     $html[] = '</a>';
     $html[] = '</div>';
     $html[] = '</div>';
     return implode($html);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:38,代码来源:icons.php

示例2: association

 /**
  * @param	int $itemid	The menu item id
  */
 static function association($itemid)
 {
     // Get the associations
     $associations = MenusHelper::getAssociations($itemid);
     // Get the associated menu items
     $db = App::get('db');
     $query = $db->getQuery(true);
     $query->select('m.*');
     $query->select('mt.title as menu_title');
     $query->from('#__menu as m');
     $query->leftJoin('#__menu_types as mt ON mt.menutype=m.menutype');
     $query->where('m.id IN (' . implode(',', array_values($associations)) . ')');
     $query->leftJoin('#__languages as l ON m.language=l.lang_code');
     $query->select('l.image');
     $query->select('l.title as language_title');
     $db->setQuery($query);
     $items = $db->loadObjectList('id');
     // Check for a database error.
     if ($error = $db->getErrorMsg()) {
         throw new Exception($error, 500);
         return false;
     }
     // Construct html
     $text = array();
     foreach ($associations as $tag => $associated) {
         if ($associated != $itemid) {
             $text[] = Lang::txt('COM_MENUS_TIP_ASSOCIATED_LANGUAGE', Html::asset('image', 'mod_languages/' . $items[$associated]->image . '.gif', $items[$associated]->language_title, array('title' => $items[$associated]->language_title), true), $items[$associated]->title, $items[$associated]->menu_title);
         }
     }
     return JHtml::_('tooltip', implode('<br />', $text), Lang::txt('COM_MENUS_TIP_ASSOCIATION'), 'menu/icon-16-links.png');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:34,代码来源:menus.php

示例3: published

 /**
  * method to generate an information about the default language
  *
  * @param	boolean	$published is the language the default?
  *
  * @return	string	html code
  */
 public static function published($published)
 {
     if ($published) {
         return Html::asset('image', 'menu/icon-16-default.png', Lang::txt('COM_LANGUAGES_HEADING_DEFAULT'), NULL, true);
     } else {
         return '&#160;';
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:15,代码来源:languages.php

示例4: state

 /**
  * @param	int $value	The state value
  * @param	int $i
  */
 public static function state($value = 0, $i)
 {
     // Array of image, task, title, action
     $states = array(1 => array('tick.png', 'newsfeeds.unpublish', 'JPUBLISHED', 'COM_NEWSFEEDS_UNPUBLISH_ITEM'), 0 => array('publish_x.png', 'newsfeeds.publish', 'JUNPUBLISHED', 'COM_NEWSFEEDS_PUBLISH_ITEM'));
     $state = \Hubzero\Utility\Arr::getValue($states, (int) $value, $states[0]);
     $html = '<a href="#" onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" title="' . Lang::txt($state[3]) . '">' . Html::asset('image', 'admin/' . $state[0], Lang::txt($state[2]), NULL, true) . '</a>';
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:12,代码来源:newsfeed.php

示例5: featured

 /**
  * @param	int $value	The state value
  * @param	int $i
  */
 static function featured($value = 0, $i, $canChange = true)
 {
     // Array of image, task, title, action
     $states = array(0 => array('disabled.png', 'articles.featured', 'COM_CONTENT_UNFEATURED', 'COM_CONTENT_TOGGLE_TO_FEATURE'), 1 => array('featured.png', 'articles.unfeatured', 'COM_CONTENT_FEATURED', 'COM_CONTENT_TOGGLE_TO_UNFEATURE'));
     $state = \Hubzero\Utility\Arr::getValue($states, (int) $value, $states[1]);
     $html = Html::asset('image', 'admin/' . $state[0], Lang::txt($state[2]), NULL, true);
     if ($canChange) {
         $html = '<a href="#" class="state ' . ($value ? 'yes' : 'no') . '" onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" title="' . Lang::txt($state[3]) . '">' . $html . '</a>';
     }
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:15,代码来源:contentadministrator.php

示例6: __construct

 function __construct($config = array())
 {
     // Article frontpage Editor pagebreak proxying:
     if (Request::getCmd('view') === 'article' && Request::getCmd('layout') === 'pagebreak') {
         $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
     } elseif (Request::getCmd('view') === 'articles' && Request::getCmd('layout') === 'modal') {
         Html::asset('stylesheet', 'adminlist.css', array(), true);
         $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
     }
     parent::__construct($config);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:11,代码来源:controller.php

示例7: state

 /**
  * @param	int $value	The state value
  * @param	int $i
  */
 public static function state($value = 0, $i, $canChange)
 {
     // Array of image, task, title, action.
     $states = array(-2 => array('trash.png', 'messages.unpublish', 'JTRASHED', 'COM_MESSAGES_MARK_AS_UNREAD'), 1 => array('tick.png', 'messages.unpublish', 'COM_MESSAGES_OPTION_READ', 'COM_MESSAGES_MARK_AS_UNREAD'), 0 => array('publish_x.png', 'messages.publish', 'COM_MESSAGES_OPTION_UNREAD', 'COM_MESSAGES_MARK_AS_READ'));
     $state = \Hubzero\Utility\Arr::getValue($states, (int) $value, $states[0]);
     $html = Html::asset('image', 'admin/' . $state[0], Lang::txt($state[2]), NULL, true);
     if ($canChange) {
         $html = '<a href="#" onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" title="' . Lang::txt($state[3]) . '">' . $html . '</a>';
     }
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:15,代码来源:messages.php

示例8: thumb

 /**
  * Display the thumb for the template.
  *
  * @param   string   $template   The name of the active view.
  * @param   integer  $protected
  * @return  string
  */
 public static function thumb($template, $protected = 0)
 {
     $basePath = ($protected == 0 ? PATH_APP : PATH_CORE) . '/templates/' . $template;
     $baseUrl = Request::root(true) . ($protected == 0 ? '/app' : '/core');
     $thumb = $basePath . '/template_thumbnail.png';
     $preview = $basePath . '/template_preview.png';
     $html = '';
     if (file_exists($thumb)) {
         $html = Html::asset('image', ltrim(substr($thumb, strlen(PATH_ROOT)), DS), Lang::txt('COM_TEMPLATES_PREVIEW'));
         if (file_exists($preview)) {
             $preview = $baseUrl . '/templates/' . $template . '/template_preview.png';
             $html = '<a href="' . $preview . '" class="modal" title="' . Lang::txt('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</a>';
         }
     }
     return $html;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:23,代码来源:templates.php

示例9: onContentBeforeDisplay

 /**
  * Prepare content
  *
  * @param   string   $context  The context of the content being passed to the plugin.
  * @param   object   $article  The article object.  Note $article->text is also available
  * @param   object   $params   The article params
  * @param   integer  $page     The 'page' number
  * @return  void
  */
 public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
 {
     $html = '';
     if ($params->get('show_vote')) {
         $rating = intval(@$row->rating);
         $rating_count = intval(@$row->rating_count);
         $view = Request::getString('view', '');
         $img = '';
         // look for images in template if available
         $starImageOn = Html::asset('image', 'system/rating_star.png', NULL, NULL, true);
         $starImageOff = Html::asset('image', 'system/rating_star_blank.png', NULL, NULL, true);
         for ($i = 0; $i < $rating; $i++) {
             $img .= $starImageOn;
         }
         for ($i = $rating; $i < 5; $i++) {
             $img .= $starImageOff;
         }
         $html .= '<span class="content_rating">';
         $html .= Lang::txt('PLG_VOTE_USER_RATING', $img, $rating_count);
         $html .= "</span>\n<br />\n";
         if ($view == 'article' && $row->state == 1) {
             $uri = JFactory::getURI();
             $uri->setQuery($uri->getQuery() . '&hitcount=0');
             $html .= '<form method="post" action="' . htmlspecialchars($uri->toString()) . '">';
             $html .= '<div class="content_vote">';
             $html .= Lang::txt('PLG_VOTE_POOR');
             $html .= '<input type="radio" title="' . Lang::txt('PLG_VOTE_VOTE', '1') . '" name="user_rating" value="1" />';
             $html .= '<input type="radio" title="' . Lang::txt('PLG_VOTE_VOTE', '2') . '" name="user_rating" value="2" />';
             $html .= '<input type="radio" title="' . Lang::txt('PLG_VOTE_VOTE', '3') . '" name="user_rating" value="3" />';
             $html .= '<input type="radio" title="' . Lang::txt('PLG_VOTE_VOTE', '4') . '" name="user_rating" value="4" />';
             $html .= '<input type="radio" title="' . Lang::txt('PLG_VOTE_VOTE', '5') . '" name="user_rating" value="5" checked="checked" />';
             $html .= Lang::txt('PLG_VOTE_BEST');
             $html .= '&#160;<input class="button" type="submit" name="submit_vote" value="' . Lang::txt('PLG_VOTE_RATE') . '" />';
             $html .= '<input type="hidden" name="task" value="article.vote" />';
             $html .= '<input type="hidden" name="hitcount" value="0" />';
             $html .= '<input type="hidden" name="url" value="' . htmlspecialchars($uri->toString()) . '" />';
             $html .= Html::input('token');
             $html .= '</div>';
             $html .= '</form>';
         }
     }
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:52,代码来源:vote.php

示例10: onInit

    /**
     * Initialise the captcha
     *
     * @param   string   $id  The id of the field.
     * @return  boolean  True on success, false otherwise
     * @since   2.5
     */
    public function onInit($id)
    {
        // Initialise variables
        $lang = $this->_getLanguage();
        $pubkey = $this->params->get('public_key', '');
        $theme = $this->params->get('theme', 'clean');
        if ($pubkey == null || $pubkey == '') {
            throw new Exception(Lang::txt('PLG_RECAPTCHA_ERROR_NO_PUBLIC_KEY'));
        }
        $server = self::RECAPTCHA_API_SERVER;
        if (Request::isSecure()) {
            $server = self::RECAPTCHA_API_SECURE_SERVER;
        }
        Html::asset('script', $server . '/js/recaptcha_ajax.js');
        Document::addScriptDeclaration('jQuery(document).ready(function($) {
			Recaptcha.create("' . $pubkey . '", "dynamic_recaptcha_1", {theme: "' . $theme . '",' . $lang . 'tabindex: 0});
		});');
        return true;
    }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:26,代码来源:recaptcha.php

示例11: edit

 /**
  * Display an edit icon for the article.
  *
  * This icon will not display in a popup window, nor if the article is trashed.
  * Edit access checks must be performed in the calling code.
  *
  * @param	object	$article	The article in question.
  * @param	object	$params		The article parameters
  * @param	array	$attribs	Not used??
  *
  * @return	string	The HTML for the article edit icon.
  * @since	1.6
  */
 static function edit($article, $params, $attribs = array())
 {
     // Initialise variables.
     $userId = User::get('id');
     // Ignore if in a popup window.
     if ($params && $params->get('popup')) {
         return;
     }
     // Ignore if the state is negative (trashed).
     if ($article->state < 0) {
         return;
     }
     Html::behavior('tooltip');
     // Show checked_out icon if the article is checked out by a different user
     if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != User::get('id')) {
         $checkoutUser = User::getInstance($article->checked_out);
         $button = Html::asset('image', 'checked_out.png', NULL, NULL, true);
         $date = Date::of($article->checked_out_time)->toLocal();
         $tooltip = Lang::txt('JLIB_HTML_CHECKED_OUT') . ' :: ' . Lang::txt('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date;
         return '<span class="hasTip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>';
     }
     $url = 'index.php?option=com_content&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode(urlencode(Request::current(true)));
     $icon = $article->state ? 'edit.png' : 'edit_unpublished.png';
     if (strtotime($article->publish_up) > strtotime(Date::of('now'))) {
         $icon = 'edit_unpublished.png';
     }
     $text = Lang::txt('JGLOBAL_EDIT');
     //Html::asset('image', $icon, Lang::txt('JGLOBAL_EDIT'), NULL, true);
     if ($article->state == 0) {
         $overlib = Lang::txt('JUNPUBLISHED');
     } else {
         $overlib = Lang::txt('JPUBLISHED');
     }
     $date = Date::of($article->created)->toLocal();
     $author = $article->created_by_alias ? $article->created_by_alias : $article->author;
     $overlib .= '&lt;br /&gt;';
     $overlib .= $date;
     $overlib .= '&lt;br /&gt;';
     $overlib .= Lang::txt('COM_CONTENT_WRITTEN_BY', htmlspecialchars($author, ENT_COMPAT, 'UTF-8'));
     $button = '<a href="' . Route::url($url) . '">' . $text . '</a>';
     $output = '<span class="hasTip" title="' . Lang::txt('COM_CONTENT_EDIT_ITEM') . ' :: ' . $overlib . '">' . $button . '</span>';
     return $output;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:icon.php

示例12: thumb

 /**
  * Display the thumb for the template.
  *
  * @param	string	The name of the active view.
  */
 public static function thumb($template, $clientId = 0)
 {
     $client = JApplicationHelper::getClientInfo($clientId);
     $basePath = $client->path . '/templates/' . $template;
     $baseUrl = $clientId == 0 ? Request::root(true) : Request::root(true) . '/administrator';
     $thumb = $basePath . '/template_thumbnail.png';
     $preview = $basePath . '/template_preview.png';
     $html = '';
     if (file_exists($thumb)) {
         $clientPath = $clientId == 0 ? '' : 'administrator/';
         $thumb = $clientPath . 'templates/' . $template . '/template_thumbnail.png';
         $html = Html::asset('image', $thumb, Lang::txt('COM_TEMPLATES_PREVIEW'));
         if (file_exists($preview)) {
             $preview = $baseUrl . '/templates/' . $template . '/template_preview.png';
             $html = '<a href="' . $preview . '" class="modal" title="' . Lang::txt('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</a>';
         }
     }
     return $html;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:24,代码来源:templates.php

示例13: display

 function display($tpl = null)
 {
     $config = Component::params('com_media');
     $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word');
     Document::setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu');
     Html::behavior('framework', true);
     \Hubzero\Document\Assets::addComponentScript('com_media', 'mediamanager.js');
     \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'mediamanager.css');
     Html::behavior('modal');
     Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\tdocument.preview = \$.fancybox;\n\t\t});");
     Html::asset('script', 'system/jquery.treeview.js', true, true, false, false);
     Html::asset('stylesheet', 'system/jquery.treeview.css', array(), true);
     if (Lang::isRTL()) {
         Html::asset('stylesheet', 'media/jquery.treeview_rtl.css', array(), true);
     }
     if (DIRECTORY_SEPARATOR == '\\') {
         $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE);
     } else {
         $base = COM_MEDIA_BASE;
     }
     $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t";
     Document::addScriptDeclaration($js);
     // Display form for FTP credentials?
     // Don't set them here, as there are other functions called before this one if there is any file write operation
     $ftp = !JClientHelper::hasCredentials('ftp');
     $session = App::get('session');
     $state = $this->get('state');
     $this->assignRef('session', $session);
     $this->assignRef('config', $config);
     $this->assignRef('state', $state);
     $this->require_ftp = $ftp;
     $this->folders_id = ' id="media-tree"';
     $this->folders = $this->get('folderTree');
     // Set the toolbar
     $this->addToolbar();
     parent::display($tpl);
     echo Html::behavior('keepalive');
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:38,代码来源:view.html.php

示例14: array

echo $this->item->type;
?>
	</td>
	<td class="center">
		<?php 
if (!$this->item->element) {
    ?>
		<strong>X</strong>
		<?php 
} else {
    ?>
		<a href="<?php 
    echo Route::url('index.php?option=com_installer&type=manage&task=' . $this->item->task . '&eid[]=' . $this->item->extension_id . '&limitstart=' . $this->pagination->limitstart . '&' . Session::getFormToken() . '=1');
    ?>
"><?php 
    echo Html::asset('image', 'images/' . $this->item->img, $this->item->alt, array('title' => $this->item->action));
    ?>
</a>
		<?php 
}
?>
	</td>
	<td class="center"><?php 
echo @$this->item->folder != '' ? $this->item->folder : 'N/A';
?>
</td>
	<td class="center"><?php 
echo @$this->item->client != '' ? $this->item->client : 'N/A';
?>
</td>
	<td>
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:default_item.php

示例15:

?>
/templates/<?php 
echo $this->template;
?>
/html/mod_reportproblems/mod_reportproblems.css" />

		<script type="text/javascript" src="<?php 
echo \Html::asset('script', 'jquery.js', false, true, true);
?>
"></script>
		<script type="text/javascript" src="<?php 
echo \Html::asset('script', 'jquery.ui.js', false, true, true);
?>
"></script>
		<script type="text/javascript" src="<?php 
echo \Html::asset('script', 'jquery.fancybox.js', false, true, true);
?>
"></script>
		<script type="text/javascript" src="<?php 
echo $this->baseurl;
?>
/templates/<?php 
echo $this->template;
?>
/js/hub.js"></script>
		<script type="text/javascript" src="<?php 
echo $this->baseurl;
?>
/modules/mod_reportproblems/mod_reportproblems.js"></script>
	</head>
	<body>
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:31,代码来源:error.php


注:本文中的Html::asset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。