コード例 #1
0
ファイル: ajax_headers.php プロジェクト: ircoco/BlackCatCMS
} elseif ($val->sanitizePost('del_css_file') != '') {
    $result = CAT_Helper_Page::adminDelHeaderComponent('css', $val->sanitizePost('del_css_file'), $page_id);
    print json_encode($result);
    exit;
} elseif ($val->sanitizePost('add_plugin') != '') {
    $plugin = $val->sanitizePost('add_plugin');
    $success = true;
    // find JS files
    $js = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('js'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin, true, true, CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin);
    // find CSS files
    $css = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('css'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin, true, true, CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin);
    foreach ($js as $file) {
        CAT_Helper_Page::adminAddHeaderComponent('js', $plugin . '/' . $file, $page_id);
    }
    foreach ($css as $file) {
        CAT_Helper_Page::adminAddHeaderComponent('css', $plugin . '/' . $file, $page_id);
    }
    $ajax = array('message' => $success ? 'ok' : 'error', 'success' => $success);
    print json_encode($ajax);
    exit;
} elseif ($val->sanitizePost('del_plugin') != '') {
    $plugin = $val->sanitizePost('del_plugin');
    // find JS files
    $js = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('js'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin, true, true, CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin);
    // find CSS files
    $css = CAT_Helper_Directory::getInstance()->maxRecursionDepth(5)->setSuffixFilter(array('css'))->scanDirectory(CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin, true, true, CAT_PATH . '/modules/lib_jquery/plugins/' . $plugin);
    foreach ($js as $file) {
        CAT_Helper_Page::adminDelHeaderComponent('js', '/modules/lib_jquery/plugins/' . $plugin . $file, $page_id);
    }
    foreach ($css as $file) {
        CAT_Helper_Page::adminDelHeaderComponent('css', '/modules/lib_jquery/plugins/' . $plugin . $file, $page_id);