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


PHP head_add_css函数代码示例

本文整理汇总了PHP中head_add_css函数的典型用法代码示例。如果您正苦于以下问题:PHP head_add_css函数的具体用法?PHP head_add_css怎么用?PHP head_add_css使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: b2tbtn_active

function b2tbtn_active(&$a, &$b)
{
    head_add_css('/addon/b2tbtn/view/css/b2tbtn.css');
    head_add_js('/addon/b2tbtn/view/js/b2tbtn.js');
    $b .= "\n<script>\n\$(document).ready(function(){\n\n\t// hide #back-top first\n\t\$(\"#back-top\").hide();\n\t\n\t// fade in #back-top\n\t\$(function () {\n\t\t\$(window).scroll(function () {\n\t\t\tif (\$(this).scrollTop() > 100) {\n\t\t\t\t\$('#back-top').fadeIn();\n\t\t\t} else {\n\t\t\t\t\$('#back-top').fadeOut();\n\t\t\t}\n\t\t});\n\n\t\t// scroll body to 0px on click\n\t\t\$('#back-top a').click(function () {\n\t\t\t\$('body,html').animate({\n\t\t\t\tscrollTop: 0\n\t\t\t}, 150);\n\t\t\treturn false;\n\t\t});\n\t});\n\n});\n</script>";
    $b .= '
<p id="back-top">
		<a href="#top"><span></span></a>
	</p>';
}
开发者ID:mrjive,项目名称:b2tbtn,代码行数:10,代码来源:b2tbtn.php

示例2: get

    function get()
    {
        if (!local_channel()) {
            return;
        }
        if (get_pconfig(local_channel(), 'cdav', 'enabled') != 1) {
            return t('You have to enable this plugin in Feature/Addon Settings > CalDAV/CardDAV Settings before you can use it.');
        }
        //TODO: add a possibility to enable this plugin here.
        $channel = \App::get_channel();
        $principalUri = 'principals/' . $channel['channel_address'];
        if (!cdav_principal($principalUri)) {
            return;
        }
        if (\DBA::$dba && \DBA::$dba->connected) {
            $pdovars = \DBA::$dba->pdo_get();
        } else {
            killme();
        }
        $pdo = new \PDO($pdovars[0], $pdovars[1], $pdovars[2]);
        $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
        require_once 'vendor/autoload.php';
        head_add_css('addon/cdav/view/css/cdav.css');
        if (argv(1) === 'calendar') {
            $caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);
            $calendars = $caldavBackend->getCalendarsForUser($principalUri);
        }
        //Display calendar(s) here
        if (argc() == 2 && argv(1) === 'calendar') {
            head_add_css('library/fullcalendar/fullcalendar.css');
            head_add_css('addon/cdav/view/css/cdav_calendar.css');
            head_add_js('library/moment/moment.min.js', 1);
            head_add_js('library/fullcalendar/fullcalendar.min.js', 1);
            head_add_js('library/fullcalendar/locale-all.js', 1);
            foreach ($calendars as $calendar) {
                $editable = $calendar['share-access'] == 2 ? 'false' : 'true';
                // false/true must be string since we're passing it to javascript
                $color = $calendar['{http://apple.com/ns/ical/}calendar-color'] ? $calendar['{http://apple.com/ns/ical/}calendar-color'] : '#3a87ad';
                $sharer = $calendar['share-access'] == 3 ? $calendar['{urn:ietf:params:xml:ns:caldav}calendar-description'] : '';
                $switch = get_pconfig(local_channel(), 'cdav_calendar', $calendar['id'][0]);
                if ($switch) {
                    $sources .= '{
						url: \'/cdav/calendar/json/' . $calendar['id'][0] . '/' . $calendar['id'][1] . '\',
						color: \'' . $color . '\'
					 }, ';
                }
                if ($calendar['share-access'] != 2) {
                    $writable_calendars[] = ['displayname' => $calendar['{DAV:}displayname'], 'sharer' => $sharer, 'id' => $calendar['id']];
                }
            }
            $sources = rtrim($sources, ', ');
            $first_day = get_pconfig(local_channel(), 'system', 'cal_first_day');
            $first_day = $first_day ? $first_day : 0;
            $title = ['title', t('Event title')];
            $dtstart = ['dtstart', t('Start date and time'), '', t('Example: YYYY-MM-DD HH:mm')];
            $dtend = ['dtend', t('End date and time'), '', t('Example: YYYY-MM-DD HH:mm')];
            $description = ['description', t('Description')];
            $location = ['location', t('Location')];
            $o .= replace_macros(get_markup_template('cdav_calendar.tpl', 'addon/cdav'), ['$sources' => $sources, '$color' => $color, '$lang' => \App::$language, '$first_day' => $first_day, '$prev' => t('Previous'), '$next' => t('Next'), '$today' => t('Today'), '$month' => t('Month'), '$week' => t('Week'), '$day' => t('Day'), '$list_month' => t('List month'), '$list_week' => t('List week'), '$list_day' => t('List day'), '$title' => $title, '$writable_calendars' => $writable_calendars, '$dtstart' => $dtstart, '$dtend' => $dtend, '$description' => $description, '$location' => $location, '$more' => t('More'), '$less' => t('Less'), '$calendar_select_label' => t('Select calendar'), '$delete' => t('Delete'), '$delete_all' => t('Delete all'), '$cancel' => t('Cancel'), '$recurrence_warning' => t('Sorry! Editing of recurrent events is not yet implemented.')]);
            return $o;
        }
        //Provide json data for calendar
        if (argc() == 5 && argv(1) === 'calendar' && argv(2) === 'json' && intval(argv(3)) && intval(argv(4))) {
            $id = [argv(3), argv(4)];
            if (!cdav_perms($id[0], $calendars)) {
                killme();
            }
            if (x($_GET, 'start')) {
                $start = new \DateTime($_GET['start']);
            }
            if (x($_GET, 'end')) {
                $end = new \DateTime($_GET['end']);
            }
            $filters['name'] = 'VCALENDAR';
            $filters['prop-filters'][0]['name'] = 'VEVENT';
            $filters['comp-filters'][0]['name'] = 'VEVENT';
            $filters['comp-filters'][0]['time-range']['start'] = $start;
            $filters['comp-filters'][0]['time-range']['end'] = $end;
            $uris = $caldavBackend->calendarQuery($id, $filters);
            if ($uris) {
                $objects = $caldavBackend->getMultipleCalendarObjects($id, $uris);
                foreach ($objects as $object) {
                    $vcalendar = \Sabre\VObject\Reader::read($object['calendardata']);
                    if (isset($vcalendar->VEVENT->RRULE)) {
                        $vcalendar = $vcalendar->expand($start, $end);
                    }
                    foreach ($vcalendar->VEVENT as $vevent) {
                        $title = (string) $vevent->SUMMARY;
                        $dtstart = (string) $vevent->DTSTART;
                        $dtend = (string) $vevent->DTEND;
                        $description = (string) $vevent->DESCRIPTION;
                        $location = (string) $vevent->LOCATION;
                        $rw = cdav_perms($id[0], $calendars, true) ? true : false;
                        $recurrent = isset($vevent->{'RECURRENCE-ID'}) ? true : false;
                        $editable = $rw ? true : false;
                        if ($recurrent) {
                            $editable = false;
                        }
                        $allDay = false;
                        // allDay event rules
//.........这里部分代码省略.........
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:101,代码来源:Mod_Cdav.php

示例3: map_content

function map_content($a)
{
    if (argc() > 1 && argv(1) === 'import') {
        logger('map import launching');
        return map_import($a);
    }
    //$a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/map/map.css' . '" media="all" />' . "\r\n";
    head_add_css('/addon/map/view/css/map.css');
    //    $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array(
    //        '$baseurl' => $a->get_baseurl(),
    //        '$editselect' => 'none',
    //        '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
    //        '$geotag' => '',
    //        '$nickname' => $channel['channel_address'],
    //        '$confirmdelete' => t('Delete webpage?')
    //    ));
    if ($_SESSION['data_cache'] !== null) {
        $data_cache = json_encode($_SESSION['data_cache']);
    } else {
        $data_cache = '';
    }
    $o .= replace_macros(get_markup_template('map.tpl', 'addon/map'), array('$header' => t('Map'), '$text' => $text, '$data_cache' => $data_cache, '$loginbox' => login()));
    $o .= '<script type="text/javascript" src="' . App::get_baseurl() . '/addon/map/view/js/underscore-min.js"></script>' . "\r\n";
    $o .= '<script type="text/javascript" src="' . App::get_baseurl() . '/addon/map/view/js/backbone-min.js"></script>' . "\r\n";
    $o .= '<script type="text/javascript" src="' . App::get_baseurl() . '/addon/map/view/js/ol.js"></script>' . "\r\n";
    $o .= '<script type="text/javascript" src="' . App::get_baseurl() . '/addon/map/view/js/map.js?version=' . map_get_version() . '"></script>' . "\r\n";
    return $o;
}
开发者ID:anaqreon,项目名称:ownmapp,代码行数:28,代码来源:map.php

示例4: construct_page

/**
 * @brief build the page.
 *
 * Build the page - now that we have all the components
 *
 * @param App &$a global application object
 */
function construct_page(&$a)
{
    exec_pdl($a);
    $comanche = count($a->layout) ? true : false;
    require_once theme_include('theme_init.php');
    $installing = false;
    if ($a->module == 'setup') {
        $installing = true;
    } else {
        nav($a);
    }
    if ($comanche) {
        if ($a->layout['nav']) {
            $a->page['nav'] = get_custom_nav($a, $a->layout['nav']);
        }
    }
    if (($p = theme_include(current_theme() . '.js')) != '') {
        head_add_js($p);
    }
    if (($p = theme_include('mod_' . $a->module . '.php')) != '') {
        require_once $p;
    }
    require_once 'include/js_strings.php';
    if (x($a->page, 'template_style')) {
        head_add_css($a->page['template_style'] . '.css');
    } else {
        head_add_css((x($a->page, 'template') ? $a->page['template'] : 'default') . '.css');
    }
    head_add_css('mod_' . $a->module . '.css');
    head_add_css(current_theme_url($installing));
    head_add_js('mod_' . $a->module . '.js');
    $a->build_pagehead();
    $arr = $a->get_widgets();
    ksort($arr, SORT_NUMERIC);
    if (count($arr)) {
        foreach ($arr as $x) {
            if (!array_key_exists($x['location'], $a->page)) {
                $a->page[$x['location']] = '';
            }
            $a->page[$x['location']] .= $x['html'];
        }
    }
    // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
    // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave
    // $a->page['nav'] empty and put the default content from $a->page['nav'] and $a->page['section']
    // into a new region called $a->data['content']. It is presumed that the chosen layout file for this comanche page
    // has a '<content>' element instead of a '<section>'.
    // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the
    // layout completely with a new layout definition, or replace/remove existing content.
    if ($comanche) {
        $arr = array('module' => $a->module, 'layout' => $a->layout);
        call_hooks('construct_page', $arr);
        $a->layout = $arr['layout'];
        foreach ($a->layout as $k => $v) {
            if (strpos($k, 'region_') === 0 && strlen($v)) {
                if (strpos($v, '$region_') !== false) {
                    $v = preg_replace_callback('/\\$region_([a-zA-Z0-9]+)/ism', 'comanche_replace_region', $v);
                }
                // And a couple of convenience macros
                if (strpos($v, '$htmlhead') !== false) {
                    $v = str_replace('$htmlhead', $a->page['htmlhead'], $v);
                }
                if (strpos($v, '$nav') !== false) {
                    $v = str_replace('$nav', $a->page['nav'], $v);
                }
                if (strpos($v, '$content') !== false) {
                    $v = str_replace('$content', $a->page['content'], $v);
                }
                $a->page[substr($k, 7)] = $v;
            }
        }
    }
    if ($a->is_mobile || $a->is_tablet) {
        if (isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&address=' . curPageURL();
        } else {
            $link = $a->get_baseurl() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
        }
        if (isset($_SESSION) && $_SESSION['mobile_theme'] != '' && $_SESSION['mobile_theme'] != '---' || isset($a->config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme'])) {
            $a->page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
        }
    }
    $page = $a->page;
    $profile = $a->profile;
    header("Content-type: text/html; charset=utf-8");
    require_once theme_include((x($a->page, 'template') ? $a->page['template'] : 'default') . '.php');
}
开发者ID:HaakonME,项目名称:redmatrix,代码行数:94,代码来源:boot.php

示例5: head_add_css

<?php

require_once 'include/plugin.php';
head_add_css('library/tiptip/tipTip.css');
head_add_css('library/jgrowl/jquery.jgrowl.css');
head_add_css('library/jRange/jquery.range.css');
head_add_css('view/css/conversation.css');
head_add_css('view/css/widgets.css');
head_add_css('view/css/colorbox.css');
head_add_css('library/justifiedGallery/justifiedGallery.min.css');
head_add_js('jquery.js');
//head_add_js('jquery-migrate-1.1.1.js');
head_add_js('library/justifiedGallery/jquery.justifiedGallery.min.js');
head_add_js('library/sprintf.js/dist/sprintf.min.js');
//head_add_js('jquery-compat.js');
head_add_js('spin.js');
head_add_js('jquery.spin.js');
head_add_js('jquery.textinputs.js');
head_add_js('autocomplete.js');
head_add_js('library/jquery-textcomplete/jquery.textcomplete.js');
//head_add_js('library/colorbox/jquery.colorbox.js');
head_add_js('library/jquery.timeago.js');
head_add_js('library/readmore.js/readmore.js');
//head_add_js('library/jquery_ac/friendica.complete.js');
//head_add_js('library/tiptip/jquery.tipTip.minified.js');
head_add_js('library/jgrowl/jquery.jgrowl_minimized.js');
//head_add_js('library/tinymce/jscripts/tiny_mce/tiny_mce.js');
head_add_js('library/cryptojs/components/core-min.js');
head_add_js('library/cryptojs/rollups/aes.js');
head_add_js('library/cryptojs/rollups/rabbit.js');
head_add_js('library/cryptojs/rollups/tripledes.js');
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:31,代码来源:theme_init.php

示例6: construct_page

/**
 * @brief build the page.
 *
 * Build the page - now that we have all the components
 *
 * @param App &$a global application object
 */
function construct_page(&$a)
{
    exec_pdl($a);
    $comanche = count(App::$layout) ? true : false;
    require_once theme_include('theme_init.php');
    $installing = false;
    if (App::$module == 'setup') {
        $installing = true;
    } else {
        nav($a);
    }
    if ($comanche) {
        if (App::$layout['nav']) {
            App::$page['nav'] = get_custom_nav($a, App::$layout['nav']);
        }
    }
    $current_theme = Zotlabs\Render\Theme::current();
    if (($p = theme_include($current_theme[0] . '.js')) != '') {
        head_add_js($p);
    }
    if (($p = theme_include('mod_' . App::$module . '.php')) != '') {
        require_once $p;
    }
    require_once 'include/js_strings.php';
    if (x(App::$page, 'template_style')) {
        head_add_css(App::$page['template_style'] . '.css');
    } else {
        head_add_css((x(App::$page, 'template') ? App::$page['template'] : 'default') . '.css');
    }
    head_add_css('mod_' . App::$module . '.css');
    head_add_css(Zotlabs\Render\Theme::url($installing));
    head_add_js('mod_' . App::$module . '.js');
    App::build_pagehead();
    if (App::$page['pdl_content']) {
        App::$page['content'] = App::$comanche->region(App::$page['content']);
    }
    // Let's say we have a comanche declaration '[region=nav][/region][region=content]$nav $content[/region]'.
    // The text 'region=' identifies a section of the layout by that name. So what we want to do here is leave
    // App::$page['nav'] empty and put the default content from App::$page['nav'] and App::$page['section']
    // into a new region called App::$data['content']. It is presumed that the chosen layout file for this comanche page
    // has a '<content>' element instead of a '<section>'.
    // This way the Comanche layout can include any existing content, alter the layout by adding stuff around it or changing the
    // layout completely with a new layout definition, or replace/remove existing content.
    if ($comanche) {
        $arr = array('module' => App::$module, 'layout' => App::$layout);
        call_hooks('construct_page', $arr);
        App::$layout = $arr['layout'];
        foreach (App::$layout as $k => $v) {
            if (strpos($k, 'region_') === 0 && strlen($v)) {
                if (strpos($v, '$region_') !== false) {
                    $v = preg_replace_callback('/\\$region_([a-zA-Z0-9]+)/ism', array(App::$comanche, 'replace_region'), $v);
                }
                // And a couple of convenience macros
                if (strpos($v, '$htmlhead') !== false) {
                    $v = str_replace('$htmlhead', App::$page['htmlhead'], $v);
                }
                if (strpos($v, '$nav') !== false) {
                    $v = str_replace('$nav', App::$page['nav'], $v);
                }
                if (strpos($v, '$content') !== false) {
                    $v = str_replace('$content', App::$page['content'], $v);
                }
                App::$page[substr($k, 7)] = $v;
            }
        }
    }
    if (App::$is_mobile || App::$is_tablet) {
        if (isset($_SESSION['show_mobile']) && !$_SESSION['show_mobile']) {
            $link = z_root() . '/toggle_mobile?f=&address=' . curPageURL();
        } else {
            $link = z_root() . '/toggle_mobile?f=&off=1&address=' . curPageURL();
        }
        if (isset($_SESSION) && $_SESSION['mobile_theme'] != '' && $_SESSION['mobile_theme'] != '---' || isset(App::$config['system']['mobile_theme']) && !isset($_SESSION['mobile_theme'])) {
            App::$page['footer'] .= replace_macros(get_markup_template("toggle_mobile_footer.tpl"), array('$toggle_link' => $link, '$toggle_text' => t('toggle mobile')));
        }
    }
    $page = App::$page;
    $profile = App::$profile;
    // There's some experimental support for right-to-left text in the view/php/default.php page template.
    // In v1.9 we started providing direction preference in the per language hstrings.php file
    // This requires somebody with fluency in a RTL language to make happen
    $page['direction'] = 0;
    // ((App::$rtl) ? 1 : 0);
    header("Content-type: text/html; charset=utf-8");
    // security headers - see https://securityheaders.io
    if (App::get_scheme() === 'https' && App::$config['system']['transport_security_header']) {
        header("Strict-Transport-Security: max-age=31536000");
    }
    if (App::$config['system']['content_security_policy']) {
        header("Content-Security-Policy: script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'");
    }
    if (App::$config['system']['x_security_headers']) {
        header("X-Frame-Options: SAMEORIGIN");
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:101,代码来源:boot.php

示例7: openclipatar_profile_photo_content_end

function openclipatar_profile_photo_content_end(&$a, &$o)
{
    $prefclipids = get_config('openclipatar', 'prefclipids');
    $defsearch = get_config('openclipatar', 'defsearch');
    $returnafter = get_config('openclipatar', 'returnafter');
    $sortprefids = get_config('openclipatar', 'sortprefids');
    if ($sortprefids == "0") {
        $sortprefids = 'date';
    }
    // Backwards compatibility
    if ($sortprefids == "1") {
        $sortprefids = 'asentered';
    }
    $sortids = get_config('openclipatar', 'sortids');
    $prefclipmsg = get_config('openclipatar', 'prefclipmsg');
    head_add_css('addon/openclipatar/openclipatar.css');
    $t = get_markup_template('avatars.tpl', 'addon/openclipatar/');
    if (!$defsearch) {
        $defsearch = 'avatar';
    }
    if (!$prefclipmsg) {
        $prefclipmsg = t('System defaults:');
    }
    if (x($_POST, 'search')) {
        $search = notags(trim($_POST['search']));
    } else {
        $search = x($_GET, 'search') ? notags(trim(rawurldecode($_GET['search']))) : '';
    }
    if (!$search) {
        $search = $defsearch;
    }
    $entries = array();
    $haveprefclips = false;
    $eidlist = array();
    if ($prefclipids && preg_match('/[\\d,]+/', $prefclipids)) {
        logger('Openclipatar: initial load: ' . var_export($_REQUEST, true), LOGGER_DEBUG);
        $sortpref = $sortprefids == 'asentered' ? 'date' : $sortprefids;
        // Use user defined sort, unless it's asentered. That's handled later
        $x = z_fetch_url('https://openclipart.org/search/json/?sort=' . $sortpref . '&amount=50&byids=' . dbesc($prefclipids));
        if ($x['success']) {
            $j = json_decode($x['body'], true);
            if ($j && !empty($j['payload'])) {
                $eidlist = explode(',', $prefclipids);
                // save for later
                if (!$_REQUEST['aj']) {
                    foreach ($j['payload'] as $rr) {
                        $e = openclipatar_decode_result($rr);
                        $e['extraclass'] = 'openclipatar-prefids';
                        $entries[] = $e;
                    }
                    if (count($entries)) {
                        openclipatar_sort_result($entries, $eidlist, $sortprefids);
                        $haveprefclips = true;
                    }
                }
            }
        }
    }
    $x = z_fetch_url('https://openclipart.org/search/json/?sort=' . $sortids . '&amount=20&query=' . urlencode($search) . '&page=' . $a->pager['page']);
    if ($x['success']) {
        $j = json_decode($x['body'], true);
        if ($j && !empty($j['payload'])) {
            foreach ($j['payload'] as $rr) {
                $e = openclipatar_decode_result($rr);
                if (!in_array($e['id'], $eidlist)) {
                    //logger('openclipatar: id '.$e['id'].' not in '.var_export($eidlist,true), LOGGER_DEBUG);
                    $entries[] = $e;
                }
            }
            $o .= "<script> var page_query = 'openclipatar'; var extra_args = '&search=" . urlencode($search) . '&' . extra_query_args() . "' ; </script>";
        }
    }
    if ($_REQUEST['aj']) {
        if ($entries) {
            $o = replace_macros(get_markup_template('avatar-ajax.tpl', 'addon/openclipatar/'), array('$use' => t('Use'), '$entries' => $entries));
        } else {
            $o = '<div id="content-complete"></div>';
        }
        echo $o;
        killme();
    } else {
        $o .= replace_macros($t, array('$selectmsg' => t('Or select from a free OpenClipart.org image:'), '$prefmsg' => $haveprefclips ? '<div class="openclipatar-prefclipmsg">' . $prefclipmsg . '</div>' : '', '$use' => t('Use'), '$defsearch' => array('search', t('Search Term'), $search), '$entries' => $entries));
    }
}
开发者ID:einervonvielen,项目名称:redmatrix-addons,代码行数:84,代码来源:openclipatar.php

示例8: chess_content

/**
 * @brief Outputs the main content of the page, depending on the URL
 *
 * @return string HTML content
 */
function chess_content($a)
{
    // Include the custom CSS and JavaScript necessary for the chess board
    head_add_css('/addon/chess/view/css/chessboard.css');
    head_add_js('/addon/chess/view/js/chessboard.js');
    // If the user is not a local channel, then they must use a URL like /chess/localchannel
    // to specify which local channel "chess host" they are visiting
    $which = null;
    if (argc() > 1) {
        $which = argv(1);
        $user = q("select channel_id from channel where channel_address = '%s' and channel_removed = 0  limit 1", dbesc($which));
        if (!$user) {
            notice(t('Requested channel is not available.') . EOL);
            App::$error = 404;
            return;
        }
    }
    if (!$which) {
        if (local_channel()) {
            $channel = App::get_channel();
            if ($channel && $channel['channel_address']) {
                $which = $channel['channel_address'];
            }
        }
    }
    if (!$which) {
        notice(t('You must select a local channel /chess/channelname') . EOL);
        return;
    }
    if (argc() > 2) {
        switch (argv(2)) {
            case 'new':
                if (!local_channel()) {
                    notice(t('You must be logged in to see this page.') . EOL);
                    return;
                }
                $acl = new Zotlabs\Access\AccessList(App::get_channel());
                $channel_acl = $acl->get();
                require_once 'include/acl_selectors.php';
                $channel = App::get_channel();
                $o = replace_macros(get_markup_template('chess_new.tpl', 'addon/chess'), array('$acl' => populate_acl($channel_acl, false), '$allow_cid' => acl2json($channel_acl['allow_cid']), '$allow_gid' => acl2json($channel_acl['allow_gid']), '$deny_cid' => acl2json($channel_acl['deny_cid']), '$deny_gid' => acl2json($channel_acl['deny_gid']), '$channel' => $channel['channel_address']));
                return $o;
            default:
                // argv(2) is the resource_id for an existing game
                // argv(1) should be the owner channel of the game
                $owner = argv(1);
                $hash = q("select channel_hash from channel where channel_address = '%s' and channel_removed = 0  limit 1", dbesc($owner));
                $owner_hash = $hash[0]['channel_hash'];
                $game_id = argv(2);
                $observer = App::get_observer();
                $g = chess_get_game($game_id);
                if (!$g['status'] || $g['game']['owner_xchan'] !== $owner_hash) {
                    notice(t('Invalid game.') . EOL);
                    return;
                }
                // Verify that observer is a valid player
                $game = json_decode($g['game']['obj'], true);
                if (!in_array($observer['xchan_hash'], $game['players'])) {
                    notice(t('You are not a player in this game.') . EOL);
                    goaway('/chess');
                }
                $player = array_search($observer['xchan_hash'], $game['players']);
                $color = $game['colors'][$player];
                $active = $game['active'] === $game['players'][$player] ? true : false;
                $game_ended = !x($game, 'ended') || $game['ended'] === 0 ? 0 : 1;
                $notify = intval(get_xconfig($observer['xchan_hash'], 'chess', 'notifications'));
                logger('xconfig notifications: ' . $notify);
                $o = replace_macros(get_markup_template('chess_game.tpl', 'addon/chess'), array('$myturn' => $active ? 'true' : 'false', '$active' => $active, '$color' => $color, '$game_id' => $game_id, '$position' => $game['position'], '$ended' => $game_ended, '$notifications' => $notify));
                // TODO: Create settings panel to set the board size and eventually the board theme
                // and other customizations
                return $o;
        }
    }
    // If the URL was simply /chess, then if the script reaches this point the
    // user is a local channel, so load any games they may have as well as a board
    // they can move pieces around on without storing the moves anywhere
    $o .= replace_macros(get_markup_template('chess.tpl', 'addon/chess'), array('$color' => 'white'));
    return $o;
}
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:84,代码来源:chess.php

示例9: head_add_css

<?php

head_add_css('library/font_awesome/css/font-awesome.min.css');
head_add_css('library/bootstrap/css/bootstrap-theme.min.css');
head_add_css('library/bootstrap/css/bootstrap.min.css');
head_add_css('view/css/bootstrap-red.css');
head_add_css('library/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css');
//head_add_css('library/colorpicker/css/colorpicker.css');
head_add_css('library/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css');
require_once 'view/php/theme_init.php';
head_add_js('library/bootstrap/js/bootstrap.min.js');
head_add_js('library/bootstrap/js/bootbox.min.js');
head_add_js('library/bootstrap-datetimepicker/js/moment.js');
head_add_js('library/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js');
//head_add_js('library/colorpicker/js/colorpicker.js');
head_add_js('library/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.js');
//head_add_js('library/bootstrap-colorpicker/src/js/docs.js');
开发者ID:Mauru,项目名称:red,代码行数:17,代码来源:theme_init.php

示例10: head_add_css

<?php

require_once 'include/plugin.php';
head_add_css('library/tiptip/tipTip.css');
head_add_css('library/jgrowl/jquery.jgrowl.css');
head_add_css('library/jRange/jquery.range.css');
head_add_css('view/css/conversation.css');
head_add_css('view/css/widgets.css');
head_add_css('view/css/colorbox.css');
head_add_css('library/justifiedGallery/justifiedGallery.min.css');
head_add_css('library/Text_Highlighter/sample.css');
head_add_js('jquery.js');
//head_add_js('jquery.migrate-3.0.0.js');
head_add_js('library/justifiedGallery/jquery.justifiedGallery.min.js');
head_add_js('library/sprintf.js/dist/sprintf.min.js');
//head_add_js('jquery-compat.js');
head_add_js('spin.js');
head_add_js('jquery.spin.js');
head_add_js('jquery.textinputs.js');
head_add_js('autocomplete.js');
head_add_js('library/jquery-textcomplete/jquery.textcomplete.js');
//head_add_js('library/colorbox/jquery.colorbox.js');
head_add_js('library/jquery.timeago.js');
head_add_js('library/readmore.js/readmore.js');
//head_add_js('library/jquery_ac/friendica.complete.js');
//head_add_js('library/tiptip/jquery.tipTip.minified.js');
head_add_js('library/jgrowl/jquery.jgrowl_minimized.js');
//head_add_js('library/tinymce/jscripts/tiny_mce/tiny_mce.js');
head_add_js('library/cryptojs/components/core-min.js');
head_add_js('library/cryptojs/rollups/aes.js');
head_add_js('library/cryptojs/rollups/rabbit.js');
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:theme_init.php

示例11: head_add_css

<?php

require_once 'include/plugin.php';
head_add_css('library/fancybox/jquery.fancybox-1.3.4.css');
head_add_css('library/tiptip/tipTip.css');
head_add_css('library/jgrowl/jquery.jgrowl.css');
head_add_css('library/jslider/css/jslider.css');
head_add_css('library/colorbox/colorbox.css');
head_add_css('view/css/conversation.css');
head_add_css('view/css/widgets.css');
head_add_js('jquery.js');
head_add_js('jquery-migrate-1.1.1.js');
//head_add_js('jquery-compat.js');
head_add_js('spin.js');
head_add_js('jquery.spin.js');
head_add_js('jquery.textinputs.js');
head_add_js('autocomplete.js');
head_add_js('library/fancybox/jquery.fancybox-1.3.4.js');
head_add_js('library/jquery.timeago.js');
head_add_js('library/jquery.divgrow/jquery.divgrow-1.3.1.js');
head_add_js('library/jquery_ac/friendica.complete.js');
head_add_js('library/tiptip/jquery.tipTip.minified.js');
head_add_js('library/jgrowl/jquery.jgrowl_minimized.js');
head_add_js('library/tinymce/jscripts/tiny_mce/tiny_mce.js');
head_add_js('library/cryptojs/components/core-min.js');
head_add_js('library/cryptojs/rollups/aes.js');
head_add_js('library/cryptojs/rollups/rabbit.js');
head_add_js('library/cryptojs/rollups/tripledes.js');
head_add_js('acl.js');
head_add_js('webtoolkit.base64.js');
head_add_js('main.js');
开发者ID:Mauru,项目名称:red,代码行数:31,代码来源:theme_init.php


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