Exemplo n.º 1
0
/**
 * A shortcut for plain output of an embedded stylesheet/javascript in the footer of the page
 *
 * @global array $out Output snippets
 * @param string $code Stylesheet or javascript code
 * @param string $type Resource type: 'js' or 'css'
 *
 * @deprecated Will be removed in v.1.0. Resources::embedFooter() instead
 */
function cot_rc_embed_footer($code, $type = 'js')
{
    Resources::embedFooter($code, $type);
}
Exemplo n.º 2
0
 /**
  * A shortcut for plain output of an embedded stylesheet/javascript in the header of the page
  *
  * Example: Resources::embed(" alert('ssssss') ");
  * Resources::embed(" .blablabla {color: #000000} ", 'css');
  *
  * @param string $code Stylesheet or javascript code
  * @param int $order
  * @param string $type Resource type: 'js' or 'css'
  */
 public static function embed($code, $type = 'js', $order = 50)
 {
     // header.php executed. Try add code to footer
     if (static::$headerComplete) {
         Resources::embedFooter($code, $type, $order);
     }
     static::$headerRc[$type . '_embed'][$order][] = cot_rc("code_rc_{$type}_embed", array('code' => $code));
 }
Exemplo n.º 3
0
if (!$ckeditor_timestamp) {
    $ckeditor_timestamp = ckeditor_max_timestamp($cfg['plugins_dir'] . '/ckeditor/lib');
}
// Main CKEditor file
Resources::linkFileFooter(cot::$cfg['plugins_dir'] . '/ckeditor/lib/ckeditor.js?' . $ckeditor_timestamp, 'js');
// Load preset and connector
if (cot::$usr['id'] > 0) {
    $preset_name = 'group_' . cot::$usr['maingrp'];
    if (!file_exists(cot::$cfg['plugins_dir'] . "/ckeditor/presets/ckeditor.{$preset_name}.set.js")) {
        $preset_name = 'default';
    }
} else {
    $preset_name = file_exists(cot::$cfg['plugins_dir'] . "/ckeditor/presets/ckeditor.group_1.set.js") ? 'group_1' : 'default';
}
Resources::linkFileFooter(cot::$cfg['plugins_dir'] . "/ckeditor/presets/ckeditor.{$preset_name}.set.js?" . $ckeditor_timestamp);
if (!empty($ckeditor_css_to_load) && is_array($ckeditor_css_to_load)) {
    foreach ($ckeditor_css_to_load as $key => $css_file) {
        if (!file_exists($css_file)) {
            unset($ckeditor_css_to_load[$key]);
        }
    }
} else {
    // Default ckeditor content styles
    $ckeditor_css_connector = "CKEDITOR.config.contentsCss = ['" . cot::$cfg['plugins_dir'] . "/ckeditor/lib/styles.js?'];";
    $ckeditor_css_to_load = array(cot::$cfg['plugins_dir'] . '/ckeditor/lib/styles.js?' . $ckeditor_timestamp, cot::$cfg['plugins_dir'] . '/ckeditor/presets/contents.default.css?' . $ckeditor_timestamp);
}
if (sizeof($ckeditor_css_to_load)) {
    $ckeditor_css_connector = "CKEDITOR.config.contentsCss = ['" . implode("','", $ckeditor_css_to_load) . "'];";
}
Resources::embedFooter("CKEDITOR.timestamp = {$ckeditor_timestamp}; CKEDITOR.config.baseHref='{$cfg['mainurl']}/'; " . $ckeditor_css_connector);
Exemplo n.º 4
0
if ($f_miniput['f_choose'] == 'fthumbs') {
    $fclass = 'fancybox-thumbs';
    $fgroup = 'thumb';
}
$fa_conf = '$(document).ready(function() {$("a[href]").filter(function() {return /\\.(jpg|jpeg|png|gif)$/i.test(this.href);}).attr({"class":"' . $fclass . '","data-fancybox-group":"' . $fgroup . '"})});';
if ($f_miniput['f_scale']) {
    if (empty($f_miniput['f_scalelspx'])) {
        $scale_param[] = !empty($f_miniput['f_scalewpx']) ? 'w:"' . $f_miniput['f_scalewpx'] . 'px"' : '';
        $scale_param[] = !empty($f_miniput['f_scalehpx']) ? 'h:"' . $f_miniput['f_scalehpx'] . 'px"' : '';
        $scale_param = implode(', ', $scale_param);
    } else {
        $scale_param = 'ls:"' . $f_miniput['f_scalelspx'] . 'px"';
    }
    $fa_conf .= '$(document).ready(function(){jQuery(document).ready(function($){$("a[data-fancybox-group] img").jScale({' . $scale_param . '})})});';
}
$fa_conf .= Resources::minify(file_get_contents($cfg['plugins_dir'] . '/fancyboxes/js/fancyboxes.cfg.js'), 'js');
if ($f_miniput['f_nomainjs']) {
    if ($env['ext'] != 'index' && $env['location'] != 'home') {
        Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.fancybox.pack.js');
        if ($f_miniput['f_scale']) {
            Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.jScale.js');
        }
        Resources::embedFooter($fa_conf);
    }
} else {
    Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.fancybox.pack.js');
    if ($f_miniput['f_scale']) {
        Resources::linkFileFooter($cfg['plugins_dir'] . '/fancyboxes/js/jquery.jScale.js');
    }
    Resources::embedFooter($fa_conf);
}
Exemplo n.º 5
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=header.main
[END_COT_EXT]
==================== */
/**
 * Cotonti Banners Module
 * Banner rotation with statistics
 *
 * @package Banners
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL.');
$brsInclided = false;
if (cot::$cfg['headrc_consolidate'] && cot::$cache) {
    Resources::addFile(cot::$cfg['modules_dir'] . "/brs/js/brs.js");
    $brsInclided = true;
}
if (!empty($cache_ext) && cot::$usr['id'] == 0 && cot::$cfg['cache_' . $cache_ext]) {
    Resources::embedFooter("var brsX = '" . cot::$sys['xk'] . "'");
    if (!$brsInclided) {
        Resources::linkFileFooter(cot::$cfg['modules_dir'] . "/brs/js/brs.js");
    }
}
Exemplo n.º 6
0
<?php

/**
 * golink plugin
 * 
 * @author Roffun
 * @copyright Copyright (c) 2015 - today: Roffun | https://webcot.net/cotonti/extensions/golink-plugin
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('golink', 'plug');
function golink($url, $anchor, $prfx = "rdr")
{
    global $cfg;
    $href = '/?r=golink&amp;' . $prfx . '=' . htmlentities(base64_encode($url));
    return '<a href="' . $href . '" data-link="' . $href . '" rel="nofollow" target="_blank" class="' . $cfg['plugin']['golink']['golink_class'] . '">' . $anchor . '</a>';
}
if ($cfg['jquery'] && $cfg['plugin']['golink']['golink_datahref']) {
    Resources::embedFooter('$(document).ready(function(){$("a.' . $cfg['plugin']['golink']['golink_class'] . '").attr("href","#").click(function(){window.open($(this).data("link"),"_blank");return false;});});');
}
Exemplo n.º 7
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=global
[END_COT_EXT]
* ==================== */
/**
 * share global
 *
 * @author  Roffun
 * @copyright Copyright (C)  Roffun | https://github.com/Roffun/share
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('share', 'plug');
Resources::linkFileFooter($cfg['plugins_dir'] . '/share/js/goodshare.min.js');
Resources::embedFooter('$(document).ready(function(){$(".goodshare").css("display","block");$(".goodshare [data-type=toggle]").click(function(){$(".goodshare .hidden").toggle();});$(".goodshare .sh-close").click(function(){$(".goodshare .hidden").toggle();});});');