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


PHP XenForo_Template_Helper_Core::addClass方法代码示例

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


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

示例1: listItem

    /**
     * Returns a list item element.
     *
     * @param array $controlOptions Options relating to the item
     * @param array $popups A list of popups (HTML) that belong to the item
     *
     * @return string List row HTML
     */
    public static function listItem(array $controlOptions, array $popups)
    {
        // active toggle handler
        if (isset($controlOptions['toggle'])) {
            if ($controlOptions['toggle']) {
                $toggleChecked = ' checked="checked"';
            } else {
                $toggleChecked = '';
                XenForo_Template_Helper_Core::addClass('disabled', $controlOptions['labelclass']);
            }
            if (!empty($controlOptions['toggletitle'])) {
                $toggleClass = ' Tooltip';
                $toggleTitle = " title=\"{$controlOptions['toggletitle']}\" data-tipclass=\"flipped\" data-offsetx=\"2\" data-offsety=\"-2\"";
            } else {
                $toggleTitle = '';
            }
            $toggle = '
				<input type="hidden" name="exists[' . $controlOptions['id'] . ']" value="1" />
				<label class="toggler secondaryContent' . $toggleClass . '"' . $toggleTitle . '><input type="checkbox" name="id[' . $controlOptions['id'] . ']" value="1" ' . $toggleChecked . ' class="SubmitOnChange Toggler" /></label>';
        } else {
            $toggle = '';
        }
        if (!empty($controlOptions['selectable'])) {
            $selectName = isset($controlOptions['selectname']) ? $controlOptions['selectname'] : '';
            $selectValue = isset($controlOptions['selectvalue']) ? $controlOptions['selectvalue'] : $controlOptions['id'];
            $selectDisabled = !empty($controlOptions['selectdisabled']) ? ' disabled="disabled"' : '';
            if (!empty($controlOptions['selecttooltip'])) {
                $selectTitle = ' title="' . $controlOptions['selecttooltip'] . '"';
                $selectClass = ' Tooltip';
            } else {
                $selectTitle = '';
                $selectClass = '';
            }
            $select = '<label class="secondaryContent selectListItem' . $selectClass . '"' . $selectTitle . '><input type="checkbox" name="' . $selectName . '" value="' . $selectValue . '" ' . (!empty($controlOptions['selected']) ? ' checked="checked"' : '') . $selectDisabled . ' /></label>';
        } else {
            $select = '';
        }
        if (!empty($controlOptions['tooltip'])) {
            $tooltip = ' title="' . $controlOptions['tooltip'] . '" data-offsetx="10"';
            XenForo_Template_Helper_Core::addClass('Tooltip', $controlOptions['linkclass']);
        } else {
            $tooltip = '';
        }
        $dataOptions = '';
        foreach ($controlOptions as $controlOptionId => $controlOptionValue) {
            if (substr($controlOptionId, 0, 5) == 'data-') {
                $dataOptions .= " {$controlOptionId}=\"{$controlOptionValue}\"";
            }
        }
        $extraClasses = !empty($controlOptions['class']) ? ' ' . $controlOptions['class'] : '';
        $labelClass = !empty($controlOptions['labelclass']) ? ' class="' . $controlOptions['labelclass'] . '"' : '';
        $linkClass = !empty($controlOptions['linkclass']) ? ' class="' . $controlOptions['linkclass'] . '"' : '';
        $href = !empty($controlOptions['href']) ? $controlOptions['href'] : '';
        $target = !empty($controlOptions['target']) ? $controlOptions['target'] : '';
        $linkStyle = !empty($controlOptions['linkstyle']) ? ' style="' . $controlOptions['linkstyle'] . '"' : '';
        $beforeLabel = !empty($controlOptions['beforelabel']) ? $controlOptions['beforelabel'] : '';
        if (empty($controlOptions['delete'])) {
            $delete = '';
        } else {
            $deletePhrase = new XenForo_Phrase('delete') . '...';
            $deleteHint = !empty($controlOptions['deletehint']) ? $controlOptions['deletehint'] : $deletePhrase;
            if ($controlOptions['delete'] === '#') {
                $delete = '<a class="delete secondaryContent"></a>' . "\n";
            } else {
                $delete = '<a href="' . $controlOptions['delete'] . '" class="delete OverlayTrigger secondaryContent" title="' . $deleteHint . '"><span>' . $deletePhrase . '</span></a>' . "\n";
            }
        }
        $href = $href ? ' href="' . $href . '"' : '';
        $target = $target ? ' target="' . $target . '"' : '';
        $output = '
<li class="listItem primaryContent' . $extraClasses . '" id="' . self::getListItemId($controlOptions['id']) . '"' . $dataOptions . '>
	' . $delete . '
	' . $select . '
	' . (!empty($controlOptions['html']) ? $controlOptions['html'] : '') . '
';
        $popupOutput = '';
        foreach ($popups as $popup) {
            if ($popup !== '') {
                $popupOutput = $popup . "\n" . $popupOutput;
            }
        }
        $output .= $popupOutput;
        $output .= '
	<h4' . $labelClass . '>' . $toggle . $beforeLabel . '
		<a' . $href . $linkClass . $linkStyle . $tooltip . $target . '>
		<em>' . $controlOptions['label'] . '</em>' . (!empty($controlOptions['snippet']) ? '
		<dfn>' . $controlOptions['snippet'] . '</dfn>' : '') . '
	</a></h4>
</li>
';
        return $output;
    }
开发者ID:darkearl,项目名称:projectT122015,代码行数:100,代码来源:Admin.php


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