*
 * {@internal Open Source relicensing agreement:
 * }}
 *
 * @package admin
 *
 * @version $Id: _html_footer.inc.php 3328 2013-03-26 11:44:11Z yura $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
if (empty($mode)) {
    /**
     * Icon Legend
     */
    if ($IconLegend =& get_IconLegend()) {
        // Display icon legend, if activated by user
        $IconLegend->display_legend();
    }
    echo $this->get_footer_contents();
}
// CALL PLUGINS NOW:
global $Plugins;
$Plugins->trigger_event('AdminAfterPageFooter', array());
if (empty($mode)) {
    // Close open divs, etc...
    echo $this->get_body_bottom();
}
if ($this->get_path(0) == 'files' || $this->get_path_range(0, 1) == array('blogs', 'perm') || $this->get_path_range(0, 1) == array('blogs', 'permgroup')) {
    // init checkall JS functions
    ?>
Beispiel #2
0
/**
 * Get properties of an icon.
 *
 * Note: to get a file type icon, use {@link File::get_icon()} instead.
 *
 * @uses get_icon_info()
 * @param string icon for what? (key)
 * @param string what to return for that icon ('imgtag', 'alt', 'legend', 'file', 'url', 'size' {@link imgsize()})
 * @param array additional params
 *   - 'class' => class name when getting 'imgtag',
 *   - 'size' => param for 'size',
 *   - 'title' => title attribute for 'imgtag'
 * @param boolean true to include this icon into the legend at the bottom of the page (works for 'imgtag' only)
 * @return mixed False on failure, string on success.
 */
function get_icon($iconKey, $what = 'imgtag', $params = NULL, $include_in_legend = false)
{
    global $admin_subdir, $Debuglog, $use_strict;
    global $conf_path;
    global $rsc_path, $rsc_uri;
    if (!function_exists('get_icon_info')) {
        require_once $conf_path . '_icons.php';
    }
    $icon = get_icon_info($iconKey);
    if (!$icon) {
        $Debuglog->add('No image defined for ' . var_export($iconKey, true) . '!', 'icons');
        return false;
    }
    if (!isset($icon['file']) && $what != 'imgtag') {
        $icon['file'] = 'icons/icons_sprite.png';
    }
    switch ($what) {
        case 'rollover':
            if (isset($icon['rollover'])) {
                // Image has rollover available
                return $icon['rollover'];
            }
            return false;
            /* BREAK */
        /* BREAK */
        case 'file':
            return $rsc_path . $icon['file'];
            /* BREAK */
        /* BREAK */
        case 'alt':
            if (isset($icon['alt'])) {
                // alt tag from $map_iconfiles
                return $icon['alt'];
            } else {
                // fallback to $iconKey as alt-tag
                return $iconKey;
            }
            /* BREAK */
        /* BREAK */
        case 'legend':
            if (isset($icon['legend'])) {
                // legend tag from $map_iconfiles
                return $icon['legend'];
            } else {
                if (isset($icon['alt'])) {
                    // alt tag from $map_iconfiles
                    return $icon['alt'];
                } else {
                    // fallback to $iconKey as alt-tag
                    return $iconKey;
                }
            }
            /* BREAK */
        /* BREAK */
        case 'class':
            if (isset($icon['class'])) {
                return $icon['class'];
            } else {
                return '';
            }
            /* BREAK */
        /* BREAK */
        case 'url':
            return $rsc_uri . $icon['file'];
            /* BREAK */
        /* BREAK */
        case 'size':
            if (!isset($icon['size'])) {
                $Debuglog->add('No iconsize for [' . $iconKey . ']', 'icons');
                $icon['size'] = imgsize($rsc_path . $icon['file']);
            }
            switch ($params['size']) {
                case 'width':
                    return $icon['size'][0];
                case 'height':
                    return $icon['size'][1];
                case 'widthxheight':
                    return $icon['size'][0] . 'x' . $icon['size'][1];
                case 'width':
                    return $icon['size'][0];
                case 'string':
                    return 'width="' . $icon['size'][0] . '" height="' . $icon['size'][1] . '"';
                default:
                    return $icon['size'];
            }
            /* BREAK */
        /* BREAK */
        case 'xy':
            if (isset($icon['xy'])) {
                // Return data for style property "background-position"
                return "-" . $icon['xy'][0] . "px -" . $icon['xy'][1] . "px";
            }
            return false;
        case 'sprite':
            if (isset($icon['xy'])) {
                // Image uses spite file
                return true;
            }
            return false;
            /* BREAK */
        /* BREAK */
        case 'imgtag':
            if (!isset($icon['file'])) {
                // Use span tag with sprite instead of img
                $styles = array();
                if (isset($params['xy'])) {
                    // Get background position from params
                    $styles[] = "background-position: " . $params['xy'][0] . "px " . $params['xy'][1] . "px";
                    unset($params['xy']);
                } else {
                    if (isset($icon['xy'])) {
                        // Set background position in the icons_sprite.png
                        $styles[] = "background-position: -" . $icon['xy'][0] . "px -" . $icon['xy'][1] . "px";
                    }
                }
                if (isset($params['size'])) {
                    // Get sizes from params
                    $icon['size'] = $params['size'];
                    unset($params['size']);
                }
                if (isset($icon['size'])) {
                    // Set width & height
                    if ($icon['size'][0] != 16) {
                        $styles[] = "width: " . $icon['size'][0] . "px";
                    }
                    if ($icon['size'][1] != 16) {
                        $styles[] = "height: " . $icon['size'][1] . "px; line-height: " . $icon['size'][1] . "px";
                    }
                }
                if (isset($params['style'])) {
                    // Get styles from params
                    $styles[] = $params['style'];
                }
                if (count($styles) > 0) {
                    $params['style'] = implode('; ', $styles);
                }
                if (!isset($params['title'])) {
                    // Use 'alt' for 'title'
                    if (isset($params['alt'])) {
                        $params['title'] = $params['alt'];
                        unset($params['alt']);
                    } else {
                        if (!isset($params['alt']) && isset($icon['alt'])) {
                            $params['title'] = $icon['alt'];
                        }
                    }
                }
                if (isset($params['class'])) {
                    // Get class from params
                    $params['class'] = 'icon ' . $params['class'];
                } else {
                    // Set default class
                    $params['class'] = 'icon';
                }
                // Add all the attributes:
                $params = get_field_attribs_as_string($params, false);
                $r = '<span' . $params . '>&nbsp;</span>';
            } else {
                // Use img tag
                $r = '<img src="' . $rsc_uri . $icon['file'] . '" ';
                if (!$use_strict) {
                    // Include non CSS fallbacks - transitional only:
                    $r .= 'border="0" align="top" ';
                }
                // Include class (will default to "icon"):
                if (!isset($params['class'])) {
                    if (isset($icon['class'])) {
                        // This icon has a class
                        $params['class'] = $icon['class'];
                    } else {
                        $params['class'] = '';
                    }
                }
                // Include size (optional):
                if (isset($icon['size'])) {
                    $r .= 'width="' . $icon['size'][0] . '" height="' . $icon['size'][1] . '" ';
                }
                // Include alt (XHTML mandatory):
                if (!isset($params['alt'])) {
                    if (isset($icon['alt'])) {
                        // alt-tag from $map_iconfiles
                        $params['alt'] = $icon['alt'];
                    } else {
                        // $iconKey as alt-tag
                        $params['alt'] = $iconKey;
                    }
                }
                // Add all the attributes:
                $r .= get_field_attribs_as_string($params, false);
                // Close tag:
                $r .= '/>';
                if ($include_in_legend && ($IconLegend =& get_IconLegend())) {
                    // This icon should be included into the legend:
                    $IconLegend->add_icon($iconKey);
                }
            }
            return $r;
            /* BREAK */
        /* BREAK */
        case 'noimg':
            // Include size (optional):
            if (isset($icon['size'])) {
                $params['size'] = $icon['size'];
            }
            $params['style'] = 'margin: 0 2px';
            return get_icon('pixel', 'imgtag', $params);
            /* BREAK */
            /*
            			$blank_icon = get_icon_info('pixel');
            
            			$r = '<img src="'.$rsc_uri.$blank_icon['file'].'" ';
            
            			// TODO: dh> add this only for !$use_strict, like above?
            			// Include non CSS fallbacks (needed by bozos... and basic skin):
            			$r .= 'border="0" align="top" ';
            
            			// Include class (will default to "noicon"):
            			if( ! isset( $params['class'] ) )
            			{
            				if( isset($icon['class']) )
            				{	// This icon has a class
            					$params['class'] = $icon['class'];
            				}
            				else
            				{
            					$params['class'] = 'no_icon';
            				}
            			}
            
            			// Include size (optional):
            			if( isset( $icon['size'] ) )
            			{
            				$r .= 'width="'.$icon['size'][0].'" height="'.$icon['size'][1].'" ';
            			}
            
            			// Include alt (XHTML mandatory):
            			if( ! isset( $params['alt'] ) )
            			{
            				$params['alt'] = '';
            			}
            
            			// Add all the attributes:
            			$r .= get_field_attribs_as_string( $params, false );
            
            			// Close tag:
            			$r .= '/>';
            
            			return $r;*/
            /* BREAK */
    }
}
Beispiel #3
0
/**
 * Get properties of an icon.
 *
 * Note: to get a file type icon, use {@link File::get_icon()} instead.
 *
 * @uses get_icon_info()
 * @param string icon for what? (key)
 * @param string what to return for that icon ('imgtag', 'alt', 'legend', 'file', 'url', 'size' {@link imgsize()})
 * @param array additional params
 *   - 'class' => class name when getting 'imgtag',
 *   - 'size' => param for 'size',
 *   - 'title' => title attribute for 'imgtag'
 * @param boolean true to include this icon into the legend at the bottom of the page (works for 'imgtag' only)
 * @return mixed False on failure, string on success.
 */
function get_icon($iconKey, $what = 'imgtag', $params = NULL, $include_in_legend = false)
{
    global $admin_subdir, $Debuglog, $use_strict;
    global $conf_path;
    global $rsc_path, $rsc_uri;
    if (!function_exists('get_icon_info')) {
        require_once $conf_path . '_icons.php';
    }
    $icon = get_icon_info($iconKey);
    if (!$icon) {
        $Debuglog->add('No image defined for ' . var_export($iconKey, true) . '!', 'icons');
        return false;
    }
    if (!isset($icon['file']) && $what != 'imgtag') {
        $icon['file'] = 'icons/icons_sprite.png';
    }
    switch ($what) {
        case 'rollover':
            if (isset($icon['rollover'])) {
                // Image has rollover available
                global $b2evo_icons_type;
                if (isset($b2evo_icons_type) && (!empty($icon['glyph']) || !empty($icon['fa']))) {
                    // Glyph and font-awesome icons don't have rollover effect
                    return false;
                }
                return $icon['rollover'];
            }
            return false;
            /* BREAK */
        /* BREAK */
        case 'file':
            return $rsc_path . $icon['file'];
            /* BREAK */
        /* BREAK */
        case 'alt':
            if (isset($icon['alt'])) {
                // alt tag from $map_iconfiles
                return $icon['alt'];
            } else {
                // fallback to $iconKey as alt-tag
                return $iconKey;
            }
            /* BREAK */
        /* BREAK */
        case 'legend':
            if (isset($icon['legend'])) {
                // legend tag from $map_iconfiles
                return $icon['legend'];
            } else {
                if (isset($icon['alt'])) {
                    // alt tag from $map_iconfiles
                    return $icon['alt'];
                } else {
                    // fallback to $iconKey as alt-tag
                    return $iconKey;
                }
            }
            /* BREAK */
        /* BREAK */
        case 'class':
            if (isset($icon['class'])) {
                return $icon['class'];
            } else {
                return '';
            }
            /* BREAK */
        /* BREAK */
        case 'url':
            return $rsc_uri . $icon['file'];
            /* BREAK */
        /* BREAK */
        case 'size':
            if (!isset($icon['size'])) {
                $Debuglog->add('No iconsize for [' . $iconKey . ']', 'icons');
                $icon['size'] = imgsize($rsc_path . $icon['file']);
            }
            switch ($params['size']) {
                case 'width':
                    return $icon['size'][0];
                case 'height':
                    return $icon['size'][1];
                case 'widthxheight':
                    return $icon['size'][0] . 'x' . $icon['size'][1];
                case 'width':
                    return $icon['size'][0];
                case 'string':
                    return 'width="' . $icon['size'][0] . '" height="' . $icon['size'][1] . '"';
                default:
                    return $icon['size'];
            }
            /* BREAK */
        /* BREAK */
        case 'xy':
            if (isset($icon['xy'])) {
                // Return data for style property "background-position"
                return "-" . $icon['xy'][0] . "px -" . $icon['xy'][1] . "px";
            }
            return false;
        case 'sprite':
            if (isset($icon['xy'])) {
                // Image uses spite file
                return true;
            }
            return false;
            /* BREAK */
        /* BREAK */
        case 'imgtag':
            global $b2evo_icons_type;
            if (isset($b2evo_icons_type)) {
                // Specific icons type is defined
                $current_icons_type = $b2evo_icons_type;
                if ($current_icons_type == 'fontawesome-glyphicons') {
                    // Use fontawesome icons as a priority over the glyphicons
                    $current_icons_type = isset($icon['fa']) ? 'fontawesome' : 'glyphicons';
                }
                switch ($current_icons_type) {
                    case 'glyphicons':
                        // Use glyph icons of bootstrap
                        $icon_class_prefix = 'glyphicon glyphicon-';
                        $icon_param_name = 'glyph';
                        $icon_content = '&nbsp;';
                        break;
                    case 'fontawesome':
                        // Use the icons from http://fortawesome.github.io/Font-Awesome/icons/
                        $icon_class_prefix = 'fa fa-';
                        $icon_param_name = 'fa';
                        $icon_content = '';
                        break;
                }
            }
            if (isset($icon_class_prefix) && !empty($icon[$icon_param_name])) {
                // Use glyph or fa icon if it is defined in icons config
                if (isset($params['class'])) {
                    // Get class from params
                    $params['class'] = $icon_class_prefix . $icon[$icon_param_name] . ' ' . $params['class'];
                } else {
                    // Set default class
                    $params['class'] = $icon_class_prefix . $icon[$icon_param_name];
                }
                $styles = array();
                if (isset($icon['color-' . $icon_param_name])) {
                    // Set a color for icon only for current type
                    if ($icon['color-' . $icon_param_name] != 'default') {
                        $styles[] = 'color:' . $icon['color-' . $icon_param_name];
                    }
                } elseif (isset($icon['color'])) {
                    // Set a color for icon for all types
                    if ($icon['color'] != 'default') {
                        $styles[] = 'color:' . $icon['color'];
                    }
                }
                if (isset($icon['color-over'])) {
                    // Set a color for mouse over event
                    $params['data-color'] = $icon['color-over'];
                }
                if (isset($icon['toggle-' . $icon_param_name])) {
                    // Set a color for mouse over event
                    $params['data-toggle'] = $icon['toggle-' . $icon_param_name];
                }
                if (!isset($params['title'])) {
                    // Use 'alt' for 'title'
                    if (isset($params['alt'])) {
                        $params['title'] = $params['alt'];
                        unset($params['alt']);
                    } else {
                        if (!isset($params['alt']) && isset($icon['alt'])) {
                            $params['title'] = $icon['alt'];
                        }
                    }
                }
                if (isset($icon['size-' . $icon_param_name])) {
                    // Set a size for icon only for current type
                    if (isset($icon['size-' . $icon_param_name][0])) {
                        // Width
                        $styles['width'] = 'width:' . $icon['size-' . $icon_param_name][0] . 'px';
                    }
                    if (isset($icon['size-' . $icon_param_name][1])) {
                        // Height
                        $styles['width'] = 'height:' . $icon['size-' . $icon_param_name][1] . 'px';
                    }
                }
                if (isset($params['style'])) {
                    // Keep styles from params
                    $styles[] = $params['style'];
                }
                if (!empty($styles)) {
                    // Init attribute 'style'
                    $params['style'] = implode(';', $styles);
                }
                // Add all the attributes:
                $params = get_field_attribs_as_string($params, false);
                $r = '<span' . $params . '>' . $icon_content . '</span>';
            } elseif (!isset($icon['file'])) {
                // Use span tag with sprite instead of img
                $styles = array();
                if (isset($params['xy'])) {
                    // Get background position from params
                    $styles[] = "background-position: " . $params['xy'][0] . "px " . $params['xy'][1] . "px";
                    unset($params['xy']);
                } else {
                    if (isset($icon['xy'])) {
                        // Set background position in the icons_sprite.png
                        $styles[] = "background-position: -" . $icon['xy'][0] . "px -" . $icon['xy'][1] . "px";
                    }
                }
                if (isset($params['size'])) {
                    // Get sizes from params
                    $icon['size'] = $params['size'];
                    unset($params['size']);
                }
                if (isset($icon['size'])) {
                    // Set width & height
                    if ($icon['size'][0] != 16) {
                        $styles[] = "width: " . $icon['size'][0] . "px";
                    }
                    if ($icon['size'][1] != 16) {
                        $styles[] = "height: " . $icon['size'][1] . "px; line-height: " . $icon['size'][1] . "px";
                    }
                }
                if (isset($params['style'])) {
                    // Get styles from params
                    $styles[] = $params['style'];
                }
                if (count($styles) > 0) {
                    $params['style'] = implode('; ', $styles);
                }
                if (!isset($params['title'])) {
                    // Use 'alt' for 'title'
                    if (isset($params['alt'])) {
                        $params['title'] = $params['alt'];
                        unset($params['alt']);
                    } else {
                        if (!isset($params['alt']) && isset($icon['alt'])) {
                            $params['title'] = $icon['alt'];
                        }
                    }
                }
                if (isset($params['class'])) {
                    // Get class from params
                    $params['class'] = 'icon ' . $params['class'];
                } else {
                    // Set default class
                    $params['class'] = 'icon';
                }
                // Add all the attributes:
                $params = get_field_attribs_as_string($params, false);
                $r = '<span' . $params . '>&nbsp;</span>';
            } else {
                // Use img tag
                $r = '<img src="' . $rsc_uri . $icon['file'] . '" ';
                if (!$use_strict) {
                    // Include non CSS fallbacks - transitional only:
                    $r .= 'border="0" align="top" ';
                }
                // Include class (will default to "icon"):
                if (!isset($params['class'])) {
                    if (isset($icon['class'])) {
                        // This icon has a class
                        $params['class'] = $icon['class'];
                    } else {
                        $params['class'] = '';
                    }
                }
                // Include size (optional):
                if (isset($icon['size'])) {
                    $r .= 'width="' . $icon['size'][0] . '" height="' . $icon['size'][1] . '" ';
                }
                // Include alt (XHTML mandatory):
                if (!isset($params['alt'])) {
                    if (isset($icon['alt'])) {
                        // alt-tag from $map_iconfiles
                        $params['alt'] = $icon['alt'];
                    } else {
                        // $iconKey as alt-tag
                        $params['alt'] = $iconKey;
                    }
                }
                // Add all the attributes:
                $r .= get_field_attribs_as_string($params, false);
                // Close tag:
                $r .= '/>';
                if ($include_in_legend && ($IconLegend =& get_IconLegend())) {
                    // This icon should be included into the legend:
                    $IconLegend->add_icon($iconKey);
                }
            }
            return $r;
            /* BREAK */
        /* BREAK */
        case 'noimg':
            global $b2evo_icons_type;
            if (isset($b2evo_icons_type)) {
                // Specific icons type is defined
                $current_icons_type = $b2evo_icons_type;
                if ($current_icons_type == 'fontawesome-glyphicons') {
                    // Use fontawesome icons as a priority over the glyphicons
                    $current_icons_type = isset($icon['fa']) ? 'fontawesome' : 'glyphicons';
                }
                switch ($current_icons_type) {
                    case 'glyphicons':
                        // Use glyph icons of bootstrap
                        $icon_param_name = 'glyph';
                        break;
                    case 'fontawesome':
                        // Use the icons from http://fortawesome.github.io/Font-Awesome/icons/
                        $icon_param_name = 'fa';
                        break;
                }
            }
            $styles = array();
            if (isset($icon_param_name) && !empty($icon[$icon_param_name])) {
                // Use glyph or fa icon if it is defined in icons config
                if (isset($icon['size-' . $icon_param_name])) {
                    // Set a size for icon only for current type
                    if (isset($icon['size-' . $icon_param_name][0])) {
                        // Width
                        $styles['width'] = 'width:' . $icon['size-' . $icon_param_name][0] . 'px';
                    }
                    if (isset($icon['size-' . $icon_param_name][1])) {
                        // Height
                        $styles['width'] = 'height:' . $icon['size-' . $icon_param_name][1] . 'px';
                    }
                    if (isset($icon['size'])) {
                        // Unset size for sprite icon
                        unset($icon['size']);
                    }
                }
            }
            // Include size (optional):
            if (isset($icon['size'])) {
                $params['size'] = $icon['size'];
            }
            $styles[] = 'margin:0 2px';
            if (isset($params['style'])) {
                // Keep styles from params
                $styles[] = $params['style'];
            }
            if (!empty($styles)) {
                // Init attribute 'style'
                $params['style'] = implode(';', $styles);
            }
            return get_icon('pixel', 'imgtag', $params);
            /* BREAK */
            /*
            			$blank_icon = get_icon_info('pixel');
            
            			$r = '<img src="'.$rsc_uri.$blank_icon['file'].'" ';
            
            			// TODO: dh> add this only for !$use_strict, like above?
            			// Include non CSS fallbacks (needed by bozos... and basic skin):
            			$r .= 'border="0" align="top" ';
            
            			// Include class (will default to "noicon"):
            			if( ! isset( $params['class'] ) )
            			{
            				if( isset($icon['class']) )
            				{	// This icon has a class
            					$params['class'] = $icon['class'];
            				}
            				else
            				{
            					$params['class'] = 'no_icon';
            				}
            			}
            
            			// Include size (optional):
            			if( isset( $icon['size'] ) )
            			{
            				$r .= 'width="'.$icon['size'][0].'" height="'.$icon['size'][1].'" ';
            			}
            
            			// Include alt (XHTML mandatory):
            			if( ! isset( $params['alt'] ) )
            			{
            				$params['alt'] = '';
            			}
            
            			// Add all the attributes:
            			$r .= get_field_attribs_as_string( $params, false );
            
            			// Close tag:
            			$r .= '/>';
            
            			return $r;*/
            /* BREAK */
    }
}