コード例 #1
0
/**
 * Simple jQuery Plugin Loader
 */
function initJSPlugin($plugin = '')
{
    $plugin = 'jquery.' . $plugin . '.js';
    if (empty($GLOBALS['block']['custom_htmlhead'][$plugin])) {
        initJSLib();
        $GLOBALS['block']['custom_htmlhead'][$plugin] = getJavaScriptSourceLink(TEMPLATE_PATH . 'lib/jquery/plugin/' . $plugin);
    }
    return TRUE;
}
コード例 #2
0
/**
 * Simple MooTools Plugin Loader
 */
function initJSPlugin($plugin = '', $more = false)
{
    // enhance teplate JS parser for MooTools More
    // sample: <!-- JS: MORE:Fx/Fx.Elements,Fx/Fx.Accordion -->
    if (is_string($plugin) && $more === false && substr(strtoupper($plugin), 0, 5) == 'MORE:') {
        $plugin = trim(substr($plugin, 5));
        $more = true;
    }
    if ($more === false) {
        $plugin = 'mootools.' . $plugin . '.js';
        if (empty($GLOBALS['block']['custom_htmlhead'][$plugin])) {
            initJSLib();
            $GLOBALS['block']['custom_htmlhead'][$plugin] = getJavaScriptSourceLink(TEMPLATE_PATH . 'lib/mootools/plugin-1.4/' . $plugin);
        }
    } else {
        // Load MooTools More Plugins - simple Wrapper 'Fx/Fx.Slide,Fx/Fx.Scroll...'
        // it does not check dependents
        if (!is_array($plugin)) {
            $plugin = convertStringToArray($plugin);
        }
        if (count($plugin)) {
            initJSLib();
            // add mootools more core
            array_unshift($plugin, 'More/More');
            foreach ($plugin as $more) {
                if (empty($GLOBALS['block']['custom_htmlhead'][$more]) && is_file(PHPWCMS_TEMPLATE . 'lib/mootools/more-1.4/' . $more . '.js')) {
                    $GLOBALS['block']['custom_htmlhead'][$more] = getJavaScriptSourceLink(TEMPLATE_PATH . 'lib/mootools/more-1.4/' . $more . '.js');
                }
            }
        }
    }
    return TRUE;
}
コード例 #3
0
ファイル: js.inc.php プロジェクト: Ideenkarosell/phpwcms
/**
 * render <!-- JS: PluginName|my.js //Whatever text -->
 */
function renderHeadJS($js)
{
    if (is_array($js) && isset($js[1])) {
        $js = $js[1];
    }
    $js = trim($js);
    if (empty($js)) {
        return '';
    }
    $remote = substr($js, 0, 4) == 'http' ? true : false;
    if (!$remote && (strpos($js, ';') !== false || strpos($js, '//') !== false || strpos($js, '/*') !== false)) {
        $key = md5($js);
        // add the same section only once
        if (empty($GLOBALS['block']['custom_htmlhead'][$key])) {
            $GLOBALS['block']['custom_htmlhead'][$key] = '  <script' . SCRIPT_ATTRIBUTE_TYPE . '>' . LF . SCRIPT_CDATA_START . LF . '	';
            $GLOBALS['block']['custom_htmlhead'][$key] .= $js;
            $GLOBALS['block']['custom_htmlhead'][$key] .= LF . SCRIPT_CDATA_END . LF . '  </script>';
        }
    } elseif ($js == 'initJSLib') {
        initJSLib();
    } elseif ($remote || which_ext($js) == 'js') {
        // decide if plugin or script
        // replace {TEMPLATE}
        $js = str_replace('{TEMPLATE}', TEMPLATE_PATH, $js);
        $GLOBALS['block']['custom_htmlhead'][md5($js)] = getJavaScriptSourceLink(html_specialchars($js));
    } else {
        initJSLib();
        if (strtolower($js) != 'initlib') {
            initJSPlugin($js);
        }
    }
    return '';
}
コード例 #4
0
ファイル: front.func.inc.php プロジェクト: EDVLanger/phpwcms
function getFrontendEditLink($type = '', $id_1 = 0, $id_2 = 0, $uid = 0)
{
    // check if frontend edit link allowed
    if (!FE_EDIT_LINK) {
        return '';
    }
    // init JSLib
    initJSLib();
    // set specific frontend editing link
    set_css_link('inc_css/specific/frontend_edit.css');
    $link = '';
    $href = '';
    $title = '';
    switch ($type) {
        case 'article':
            $href = 'do=articles&amp;p=2&amp;s=1&amp;id=' . $id_1;
            $title = '@@Backend: goto Article@@';
            break;
        case 'summary':
            $href = 'do=articles&amp;p=2&amp;s=1&amp;aktion=1&amp;id=' . $id_1;
            $title = '@@Backend: edit Article Summary@@';
            break;
            //enym new edit structure
        //enym new edit structure
        case 'structure':
            if (isset($GLOBALS['content']['struct'][$id_1]['acat_struct'])) {
                $href = 'do=admin&amp;p=6&amp;struct=';
                $href .= $id_1 ? $GLOBALS['content']['struct'][$id_1]['acat_struct'] . '&amp;cat=' . $id_1 : 'index';
                $title = '@@Backend: edit Structure Level@@';
            }
            break;
        case 'CP':
            if (!$_SESSION["wcs_user_admin"] && $id_1) {
                $sql = 'SELECT COUNT(*) FROM ' . DB_PREPEND . 'phpwcms_article WHERE article_id=' . _dbEscape($id_1);
                $sql .= ' AND article_uid=' . _dbEscape($_SESSION["wcs_user_id"]);
                if (!_dbCount($sql)) {
                    return '';
                }
            }
            $href = 'do=articles&amp;p=2&amp;s=1&amp;aktion=2&amp;id=' . $id_1 . '&amp;acid=' . $id_2;
            $title = '@@Backend: edit Content Part@@';
            break;
            //enym new block to make news items editable
        //enym new block to make news items editable
        case 'news':
            $href = 'do=articles&amp;p=3&amp;cntid=' . $id_1 . '&amp;action=edit';
            $title = '@@Backend: edit News@@';
            break;
            //end enym
        //end enym
        case 'module':
            if (!$_SESSION["wcs_user_admin"] && $id_2) {
                $sql = 'SELECT COUNT(*) FROM ' . DB_PREPEND . 'phpwcms_article WHERE article_id=' . _dbEscape($id_2);
                $sql .= ' AND article_uid=' . _dbEscape($_SESSION["wcs_user_id"]);
                if (!_dbCount($sql)) {
                    return '';
                }
            }
            $href = 'do=modules&amp;module=' . $id_1;
            $title = '@@Backend: goto Module@@';
            break;
    }
    if ($href) {
        $link = '<a href="' . PHPWCMS_URL . 'phpwcms.php?' . $href . '" target="backend" ';
        $link .= 'class="fe-link fe-' . $type . '" title="' . $title . '">';
        $link .= '<span>' . $title . '</span></a> ';
    }
    return $link;
}