示例#1
0
文件: index.php 项目: kangza/hagtag
" colspan="2" nowrap><font color="#ffcc00">$client->has_feature(<i>feature</i>)</font></td>
    </tr>
	<?php 
has_feature('html');
has_feature('images');
has_feature('frames');
has_feature('tables');
has_feature('java');
has_feature('plugins');
has_feature('css2');
has_feature('css1');
has_feature('iframes');
has_feature('xml');
has_feature('dom');
has_feature('hdml');
has_feature('wml');
?>
	<!-- quirks -->
    <tr>
        <td bgcolor="<?php 
print $c3_bg;
?>
" colspan="2" nowrap><font color="#ffcc00">$client->has_quirk(<i>quirk</i>)</font></td>
    </tr>
    <?php 
has_quirk('must_cache_forms');
has_quirk('avoid_popup_windows');
has_quirk('cache_ssl_downloads');
has_quirk('break_disposition_header');
has_quirk('empty_file_input_value');
has_quirk('scrollbar_in_way');
示例#2
0
/**
 * Find whether a particular feature is available to ocPortal (e.g. it's an addon).
 *
 * @param  ID_TEXT		Feature name
 * @return boolean		Whether it is
 */
function has_feature($dependency)
{
    $dependency = str_replace(' ', '', strtolower(preg_replace('# (enabled|needed|required)$#', '', $dependency)));
    if ($dependency == 'yes') {
        return true;
    }
    // Buggy addon definition
    $remapping = array('chatrooms' => 'chat', 'side_stats' => 'stats_block');
    if (array_key_exists($dependency, $remapping)) {
        $dependency = $remapping[$dependency];
    }
    // Non-bundled addon
    $test = $GLOBALS['SITE_DB']->query_value_null_ok('addons', 'addon_name', array('addon_name' => $dependency));
    if (!is_null($test)) {
        return true;
    }
    // Bundled/new-style addon
    if (file_exists(get_file_base() . '/sources_custom/hooks/systems/addon_registry/' . $dependency . '.php')) {
        return true;
    }
    if (file_exists(get_file_base() . '/sources/hooks/systems/addon_registry/' . $dependency . '.php')) {
        return true;
    }
    // Some other features
    if ($dependency == 'javascript' && has_js()) {
        return true;
    }
    if ($dependency == 'cron' && cron_installed()) {
        return true;
    }
    if ($dependency == 'ocf' && get_forum_type() == 'ocf') {
        return true;
    }
    if ($dependency == 'gd' && get_option('is_on_gd') == '1' && function_exists('imagecreatefromstring')) {
        return true;
    }
    if ($dependency == 'adobeflash') {
        return true;
    }
    if (substr($dependency, 0, 3) == 'php') {
        $phpv = phpversion();
        if (version_compare(substr($phpv, 0, strlen(substr($dependency, 3))), substr($dependency, 3), '>=')) {
            return true;
        }
    }
    // ---
    // Try plural form
    if (substr($dependency, -1) != 's') {
        return has_feature($dependency . 's');
    }
    return false;
}