Esempio n. 1
0
	function parse_spipcss($spip) {
		if (preg_match_all("#(^|\n)\s*(.*?)\s*:\s*(\w+)(?:\.(\w+))?(?:\s*{\s*(.*?)\s*})?#s", $spip, $matches, PREG_SET_ORDER)) {
			$js = array() ;
			foreach($matches as $match) {
				if ($match[5]) {
					$css="{ ".parse_css($match[5])." }" ;
				} else {
					$css='' ;
				}
				$ajs = array() ;
				$ajs[] = "name: '".$match[2]."'" ;
				if ($match[3]) {
					$ajs[] = "element: '".$match[3]."'" ;
				}
				if ($match[4]) {
					$ajs[] = "attributes: { 'class': '".$match[4]."' }" ;
				}
				if ($css) {
					$ajs[] = "styles: $css" ;
				}
				$js[] = "{".join(", " , $ajs)."}" ;
			}
			return "CKEDITOR.addStylesSet('spip-styles',\n\t[\n".join(",\n",$js)."\n\t]\n);" ;
		} else 
			return '' ;
	}
function parse_style_node($root, &$pipeline)
{
    global $g_stylesheet_title;
    // Check if this style node have 'media' attribute
    // and if we're using this media;
    //
    // Note that, according to the HTML 4.01 p.14.2.3
    // This attribute specifies the intended destination medium for style information.
    // It may be a single media descriptor or a comma-separated list.
    // The default value for this attribute is "screen".
    //
    $media_list = array("screen");
    if ($root->has_attribute("media")) {
        // Note that there may be whitespace symbols around commas, so we should not just use 'explode' function
        //
        $media_list = preg_split("/\\s*,\\s*/", trim($root->get_attribute("media")));
    }
    if (!is_allowed_media($media_list)) {
        return;
    }
    if ($g_stylesheet_title === "") {
        $g_stylesheet_title = $root->get_attribute("title");
    }
    if (!$root->has_attribute("title") || $root->get_attribute("title") === $g_stylesheet_title) {
        /**
         * Check if current node is empty (then, we don't need to parse its contents)
         */
        $content = trim($root->get_content());
        if ($content != "") {
            parse_css($content, $pipeline);
        }
    }
}
function css_import($src, &$pipeline)
{
    // Update the base url;
    // all urls will be resolved relatively to the current stylesheet url
    $url = $pipeline->guess_url($src);
    $data = $pipeline->fetch($url);
    /**
     * If referred file could not be fetched return immediately
     */
    if (is_null($data)) {
        return;
    }
    $css = $data->get_content();
    if (!empty($css)) {
        parse_css($css, $pipeline);
    }
    $pipeline->pop_base_url();
}
Esempio n. 4
0
 function loadextcfg($item)
 {
     if (file_exists($item)) {
         $arr = parse_css(file_get_contents($item), true);
         if (isset($arr) && is_array($arr)) {
             foreach ($arr['1'] as $a => $b) {
                 $_cfg[$a] = piecele($arr['1'], $a);
             }
         } else {
             die("config (" . $item . ") invalid.");
         }
     }
     # end config load
     if (isset($_cfg) && is_array($_cfg)) {
         return $_cfg;
     } else {
         die("error loading " . $item);
     }
 }
Esempio n. 5
0
         session_start();
     }
 }
 $_SESSION['rdmstring'] = 'ulvl';
 $_SESSION[$_SESSION['rdmstring']] = 0;
 if (is_dir($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/gui/" . $_cfg['global']['default_gui']) && file_exists($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/gui/" . $_cfg['global']['default_gui'] . "/gui.css")) {
     $getguicss = $__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "cfgs/gui/" . $_cfg['global']['default_gui'] . "/gui.css";
 } else {
     $getguicss = $__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/gui/default/gui.css";
 }
 if ($_cfg['global']['var_dump'] == "on") {
     echo "{<br />get gui configuration in \$getguicss for make_object function from " . $getguicss . " and using the parser/css on file contents string<br /><span style=\"color:navy\">";
 }
 #vardump
 if (file_exists($getguicss)) {
     $arr = parse_css(file_get_contents($getguicss), true);
     if (is_array($arr)) {
         foreach ($arr['1'] as $a => $b) {
             $_cfg[$a] = piecele($arr['1'], $a);
         }
     } else {
         die("config invalid.");
     }
 }
 # end config load
 #select corresponding make object vars
 $aa = initcfg($_cfg);
 if (isset($_cfg[$aa]['exact_userlevels'])) {
     $exacts = explode("-", $_cfg[$aa]['exact_userlevels']);
 } else {
     $exacts = false;
}

/* 3 deep (or more) unordered lists use a square */
ol ol ul,     ol ul ul,     ol menu ul,     ol dir ul,
ol ol menu,   ol ul menu,   ol menu menu,   ol dir menu,
ol ol dir,    ol ul dir,    ol menu dir,    ol dir dir,
ul ol ul,     ul ul ul,     ul menu ul,     ul dir ul,
ul ol menu,   ul ul menu,   ul menu menu,   ul dir menu,
ul ol dir,    ul ul dir,    ul menu dir,    ul dir dir,
menu ol ul,   menu ul ul,   menu menu ul,   menu dir ul,
menu ol menu, menu ul menu, menu menu menu, menu dir menu,
menu ol dir,  menu ul dir,  menu menu dir,  menu dir dir,
dir ol ul,    dir ul ul,    dir menu ul,    dir dir ul,
dir ol menu,  dir ul menu,  dir menu menu,  dir dir menu,
dir ol dir,   dir ul dir,   dir menu dir,   dir dir dir {
  list-style-type: square;
}
EOF;
parse_css($css, new Pipeline());
global $g_css;
$g_css_defaults = array_merge($g_css_defaults, $g_css);
// Clear the global CSS object we've used to parse the CSS source above
$g_css = array();
for ($ctr = 0; $ctr < count($g_css_defaults); $ctr++) {
    $g_css_defaults[$ctr][2] = "";
    $g_css_defaults[$ctr][3] = $ctr;
}
$g_css_defaults_obj = new CSSObject();
foreach ($g_css_defaults as $rule) {
    $g_css_defaults_obj->add_rule($rule, new Pipeline());
}
Esempio n. 7
0
 function parse_init($aa2 = false)
 {
     global $donememo, $_cfg, $fd, $current_ext, $readonly, $skip_css_specific;
     $skip_css_specific = false;
     if ($aa2 != false && is_array($aa2)) {
         $skip_css_specific = true;
         if (isset($_POST['editelecont'])) {
             $readonly = false;
         }
     }
     #prepare file query
     if (isset($_GET) && isset($_GET['fn']) && strlen($_GET['fn']) > 0) {
         if (strlen($current_ext) > 0) {
             if ($current_ext != "" && $current_ext != "no_ext") {
                 $temp_1 = "." . $current_ext;
             } else {
                 $temp_1 = "";
             }
         }
         $_GET['fn'] = str_replace(array("..", "/", "." . $current_ext), "", $_GET['fn']) . $temp_1;
     }
     $temp_1 = '';
     if (!isset($donememo)) {
         $donememo = '';
     }
     if (!isset($_cfg['global']['memorize'])) {
         $_cfg['global']['memorize'] = '';
     }
     $_cfg['max'] = $_cfg['global']['memorize'] * $_cfg['global']['memorize'];
     if (isset($_GET['mode']) && is_numeric($_GET['mode'])) {
         $_SESSION['res_space'] = addslashes($_GET['mode']);
     }
     if (!isset($_SESSION['res_space'])) {
         $_SESSION['res_space'] = 1;
     }
     if (!isset($_GET) || !isset($_GET['fd']) || $_GET['fd'] == '') {
         $_GET['fd'] = 'nonexistent';
     } else {
         # $_GET['fd']= str_replace('..', '', addslashes($_GET['fd']));
     }
     if (!isset($_cfg['ddir'])) {
         $_cfg['ddir'] = '';
     }
     if (isset($_GET) && isset($_GET['fd']) && strlen($_GET['fd']) > 0 && is_dir($_cfg['ddir'] . html_entity_decode($_GET['fd']) . '/')) {
         chdir($_cfg['ddir'] . html_entity_decode($_GET['fd']) . '/');
     } elseif (is_dir($_cfg['ddir'] . "css") && isset($_GET) && $_GET['fd'] == '') {
         chdir("css");
         $fd = 'css';
         if (strlen($_GET['fd']) == 0) {
             $_GET['fd'] = '';
         }
     } elseif (isset($_GET) && isset($_GET['fd']) && $_GET['fd'] == 'nonexistent') {
         if (is_dir('css')) {
             $fd = 'css';
             chdir('css');
         }
         $_GET['fd'] = '';
     }
     if (!isset($fd)) {
         $fd = '';
     }
     if (is_array($aa2) || isset($_GET) && isset($_GET['fn']) && file_exists(html_entity_decode($_GET['fn']))) {
         if (!is_array($aa2)) {
             $filecont = file_get_contents(html_entity_decode($_GET['fn']));
         }
         if (is_array($aa2) || isset($filecont) && strlen($filecont) > 0) {
             if (!is_array($aa2)) {
                 $klikit = parse_css($filecont, $aa2);
                 # make 3d array of existing data
             } else {
                 $klikit = $aa2;
             }
             #change it with other userinput:
             if (isset($_GET['rmcat'])) {
                 #remove category/comment:
                 $klikit[html_entity_decode($_GET['rmcat'])] = '';
                 unset($klikit[html_entity_decode($_GET['rmcat'])]);
             } elseif (isset($_GET['rmele'])) {
                 $klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['rmele'])] = '';
                 unset($klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['rmele'])]);
             } elseif (isset($_POST) && is_array($_POST)) {
                 if (isset($_POST['attach'])) {
                     $ohwmg = explode(":", $_POST['brw']);
                     $ohwmg = trim($ohwmg[0]);
                     $_POST['ele'] = trim($_POST['ele']);
                     $_POST['ele'] .= $ohwmg;
                     unset($ohwmg);
                 }
                 if (isset($_POST['ele']) && strlen($_POST['ele']) > 0 && html_entity_decode($_GET['ele']) != $_POST['ele'] or isset($_POST['attach'])) {
                     #remove old (get) ele and set get to new posted
                     if (!isset($_POST['attach'])) {
                         $klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['ele'])] = '';
                         unset($klikit[html_entity_decode($_GET['cat'])][html_entity_decode($_GET['ele'])]);
                     }
                     $_GET['ele'] = urlencode(htmlentities($_POST['ele']));
                     $readonly = false;
                 }
                 # edit elem contents
                 if ($skip_css_specific == true) {
                     if (isset($_POST['editelecont'])) {
                         $spaceoutdude = $_POST['editelecont'];
                     }
                     #return $spaceoutdude;
                 } else {
                     if (isset($_POST['editelecont'])) {
                         $spaceoutdude = str_replace(array("  ", " "), "{spaceoutdude}", trim($_POST['editelecont']));
                         if (isset($_SESSION['res_space']) && $_SESSION['res_space'] == 1) {
                             $spaceoutdude = preg_replace('[\\n]', ';', $spaceoutdude);
                         } else {
                         }
                         $spaceoutdude = preg_replace('[\\s]', '', $spaceoutdude);
                         $spaceoutdude = trim(str_replace(";;", ";", $spaceoutdude));
                         if (isset($_SESSION['res_space']) && $_SESSION['res_space'] == 0) {
                             if (is_substr($_GET['fd'], "edit_area") || is_substr(html_entity_decode($_GET['fd']), $GLOBALS['_cfg']['folders']['language'])) {
                                 $rep = " ";
                             } else {
                                 $rep = "";
                             }
                         } else {
                             $rep = " ";
                         }
                         $spaceoutdude = str_replace("{spaceoutdude}", $rep, $spaceoutdude);
                     }
                 }
                 if (isset($spaceoutdude)) {
                     $klikit[html_entity_decode($_GET['cat'])][$_POST['ele']] = html_entity_decode($spaceoutdude);
                     #echo $klikit[html_entity_decode($_GET['cat'])][$_POST['ele']];
                     unset($spaceoutdude);
                 }
                 # add categ
                 if (isset($_POST['addcat']) && strlen($_POST['addcat']) > 0) {
                     $klikit[$_POST['addcat']] = '';
                     $_GET['cat'] = urlencode(htmlentities($_POST['addcat']));
                 } elseif (isset($_POST['addele']) && isset($_POST['addele']) && strlen($_POST['addele']) > 0) {
                     $klikit[$_POST['cat']][$_POST['addele']] = '';
                     if (isset($_POST['addele']) && strlen($_POST['addele']) > 0) {
                         $_GET['cat'] = urlencode(htmlentities($_POST['cat']));
                         $_GET['ele'] = urlencode(htmlentities($_POST['addele']));
                     }
                 }
                 if (isset($_POST['clr_hex']) && isset($_POST['addcolor']) && $_POST['addcolor'] == "addcolor") {
                     //    if (strlen($_COOKIE[$ckinm])>0){$_COOKIE[$ckinm]=$_POST['clr_hex'].",".$_COOKIE[$ckinm];}else{$_COOKIE[$ckinm]=$_POST['clr_hex'];}
                     //setcookie ($ckinm, $_COOKIE[$ckinm],$_cfg['global']['ckitime']);
                 }
             }
         }
     }
     if (!isset($klikit)) {
         $klikit = array();
     }
     return $klikit;
 }
Esempio n. 8
0
if (isset($_SERVER['HTTPS'])) {
    $____urlxs = 's';
}
$____urlx .= $____urlxs . '://' . $_SERVER['HTTP_HOST'] . "";
if (isset($_SERVER['SCRIPT_NAME'])) {
    $____urlx .= dirname($_SERVER['SCRIPT_NAME']);
}
$WIMPY_BASE['path']['www'] = $____urlx;
$_urli_ = htmlentities($____urlx);
# default {www}_
if (isset($_SERVER['QUERY_STRING'])) {
    $____urlx .= "?" . $_SERVER['QUERY_STRING'];
}
#####################
# load LANGUAGE VARS
$langcss = parse_css(file_get_contents($__the_cwd . "/" . $_cfg['folders']['language'] . "/" . $__tssf . "/" . $__tssf . ".css"), true);
#echo "<pre>";print_r($langcss);die();
$__lang = piecele($langcss["1"], $_cfg['global']['default_gui_lang']);
$__lang["current_template"] = $_cfg["global"]["default_template"];
$__lang["ele"] = "&ele=";
$__lang["tmpl_folder"] = $_cfg["folders"]["templates"];
# added for backwards compatibility with older freedomeditor (<0.2.5) html code, mayb be changed into a extension or something in the future
$langcss["1"][$_cfg['global']['default_gui_lang']] .= "current_template:" . $_cfg["global"]["default_template"] . ";\nele:&ele=;\ntmpl_folder:" . $_cfg["folders"]["templates"] . ";";
#LOAD CORE CLIENT VARS
$oldir = getcwd();
if (is_dir($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/")) {
    chdir($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/");
    if (file_exists("vars" . $scrext)) {
        include "vars" . $scrext;
    }
    chdir($___workpath . "/");
Esempio n. 9
0
    }
}
chdir($fd);
$dh = opendir("./");
while (false !== ($filename = readdir($dh))) {
    if ($filename != ".." && $filename != "." && is_file($filename) && $filename != "" && stristr($filename, filesystemcode($_GET['filename'], "b", "c")) !== FALSE) {
        $arr[] = $filename;
    }
}
closedir($dh);
if (is_array($arr) && count($arr) > 0) {
    if (count($arr) > 1) {
        $arr = natsort($arr);
    }
    foreach ($arr as $lal) {
        $arrx[] = parse_css(file_get_contents($lal), true);
    }
    $dullcounter = 0;
    if (is_array($arrx) && count($arrx) > 0) {
        foreach ($arrx as $lal) {
            if ($dullcounter == 0) {
                $array1 = $lal;
            } else {
                $array2 = $lal;
                $array1 = mergecss($array1, $array2);
            }
            $dullcounter++;
        }
    }
    $current_ext = "css";
    $getname = createsuffix("merged_", $current_ext);
Esempio n. 10
0
 function apply($str) {
   $this->style=array_merge($this->style, parse_css($str));
   return $this->style;
 }
Esempio n. 11
0
<?php

echo parse_css($_POST['css']);
function parse_css($css_url)
{
    $result = array();
    if (strlen($css_url) && strpos($css_url, '://') === false) {
        if (strpos($css_url, '/') === 0) {
            // against '/main.css'
            $css_url = substr($css_url, 1);
        }
        if (($css = file_get_contents($css_url)) !== false) {
            // strip comments
            $css = preg_replace("/\\/\\*(.*)?\\*\\//Usi", "", $css);
            // parse css
            $parts = explode("}", $css);
            if (sizeof($parts) > 0) {
                foreach ($parts as $part) {
                    list($s_key, $s_code) = explode("{", $part);
                    $keys = explode(",", trim($s_key));
                    if (sizeof($keys) > 0) {
                        foreach ($keys as $key) {
                            //if(strlen($key) > 0) {
                            list($tmp, $key) = explode(".", $key);
                            list($key, $tmp) = explode(" ", $key);
                            list($key, $tmp) = explode(":", $key);
                            list($key, $tmp) = explode("#", $key);
                            $key = trim($key);
                            if (strlen($key)) {
                                $result[$key] = true;
                            }
Esempio n. 12
0
<?php

#THIS FILE IS (CURRENTLY) NOT USED IN FREEDOMEDITOR AND ONLY EXIST FOR TEST/DEBUG/EXAMPLE PURPOSE
$scrext = ".php";
$___workpath = getcwd() . "/";
include "init" . $scrext;
#$___workpath.="parser/css/";
#include $___workpath."init".$scrext;
#EXAMPLE USAGE:
#load config
$arr = parse_css(file_get_contents("testsite.css"), true);
print_r($arr);
die;
if (is_array($arr)) {
    foreach ($arr['1'] as $a => $b) {
        $_cfg[$a] = piecele($arr['1'], $a);
    }
} else {
    die("config invalid.");
}
# end config load
if (!isset($_SESSION)) {
    session_start();
    $_SESSION['rdmstring'] = 'ulvl';
}
$_SESSION[$_SESSION['rdmstring']] = 0;
$lang = 'en';
$aa = initcfg($_cfg);
if (isset($_cfg[$aa]['exact_userlevels'])) {
    $exacts = explode("-", $_cfg[$aa]['exact_userlevels']);
} else {
Esempio n. 13
0
 function extension($source, $scrext, $_cfg, $langcss, $js = false, $donethatoncearray = array())
 {
     $returnjs = '';
     $cfg_gl = $_cfg;
     $resultingarray345 = repl_between($source, "", $_cfg['extension']['string_open'], $_cfg['extension']['string_close'], false, "sm", true);
     $amnt = count($resultingarray345[2]);
     $noloop = false;
     if (is_array($resultingarray345) && is_array($resultingarray345[2])) {
         foreach ($resultingarray345[2] as $boelieboelie) {
             if (strlen($boelieboelie) > 0) {
                 if (file_exists("cfg/custom/" . $boelieboelie . ".css")) {
                     $_cfgt = loadextcfg("cfg/custom/" . $boelieboelie . ".css");
                     if (isset($_cfgt)) {
                         $_cfg = mergecss($_cfg, $_cfgt);
                     }
                 }
                 $tmpl = "";
                 $emptytmpl = true;
                 $next = false;
                 if (isset($_cfg['extension_req_val']) && is_array($_cfg['extension_req_val']) && count($_cfg['extension_req_val']) > 0) {
                     foreach ($_cfg['extension_req_val'] as $var => $val) {
                         if (strlen($var) > 0) {
                             if (!isset($_REQUEST[$var])) {
                                 $next = true;
                             } else {
                                 if ($_cfg['extension']['ext_req_val'] == "matchvar") {
                                     if ($_cfg['extension']['ext_req_val_Casesens'] != "on") {
                                         if ($_REQUEST[strtolower($var)] != strtolower($val)) {
                                             $next = true;
                                         }
                                     } elseif ($_REQUEST[$var] != $val) {
                                         $next = true;
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($js != false) {
                     $next = false;
                 }
                 if ($next == false && $_cfg['extension']['launch'] == "enabled") {
                     if (strtolower($_cfg["extension"]["core_client"]) != "any") {
                         $coreclients = explode(",", $_cfg["extension"]["core_client"]);
                         if (isset($_cfg['global']['select_client_by_urlvar']) && isset($_GET[$_cfg['global']['select_client_by_urlvar']]) && isset($coreclients[$_GET[$_cfg['global']['select_client_by_urlvar']]]) || !isset($_cfg['global']['select_client_by_urlvar']) && !isset($_GET[$_cfg['global']['select_client_by_urlvar']]) && !isset($coreclients[$_GET[$_cfg['global']['select_client_by_urlvar']]]) && isset($_cfg['global']['current_client']) && isset($coreclients[$_cfg['global']['current_client']])) {
                             $emptytmpl = false;
                         }
                     } elseif (strtolower($_cfg["extension"]["core_client"]) == "any") {
                         $emptytmpl = false;
                     }
                     if ($_cfg['extension']['languageload'] == "enabled") {
                         $__tssf = $GLOBALS['__tssf'];
                         if (file_exists($_cfg['folders']['language'] . "/" . $__tssf . "/custom/" . $boelieboelie . "/" . $__tssf . ".css")) {
                             $lang_t = loadextcfg($_cfg['folders']['language'] . "/" . $__tssf . "/custom/" . $boelieboelie . "/" . $__tssf . ".css");
                         }
                     }
                     if (isset($lang_t) && is_array($lang_t) && $_cfg['extension']['globallanguageload'] == "enabled") {
                         if (is_array($langcss)) {
                             $langcss = mergecss($langcss, $lang_t);
                         }
                     } else {
                         if ($_cfg['extension']['globallanguageload'] == "enabled") {
                         } else {
                             $langcss = parse_css($lang_t);
                         }
                     }
                     if (is_array($langcss["1"])) {
                         $__lang = piecele($langcss["1"], $_cfg['global']['default_gui_lang']);
                     }
                     #print_r($__lang);
                     if ($emptytmpl == false && $_cfg['extension']['tmplload'] == "enabled") {
                         $tmpl = gethatmpl(0, $boelieboelie);
                     }
                     if ($_cfg['extension']['phplaunch'] == "enabled" && file_exists("fc/customcallback/" . $boelieboelie . $scrext)) {
                         ob_start();
                         $tmpl = (include "fc/customcallback/" . $boelieboelie . $scrext);
                         if (strlen($tmpl) == 0 || $emptytmpl == false) {
                             if ($_cfg['extension']['phplaunch_output'] == "enabled") {
                                 if (strlen($tmpl) < 1) {
                                     $tmpl = ob_get_contents();
                                 }
                             } else {
                                 ob_clean();
                             }
                         }
                     }
                     if ($_cfg['extension']['srch_ext'] != "disabled" && strlen($tmpl) > 0 && isset($srch_ext) && is_array($srch_ext) && count($srch_ext) > 0) {
                         $tmpl = str_replace(array_keys(${$_cfg['extension']['srch_ext']}), array_values(${$_cfg['extension']['srch_ext']}), $tmpl);
                     }
                     #if (strlen($tmpl)>0){
                     if ($_cfg['extension']['languagereplace'] == "enabled") {
                         if (!in_array($boelieboelie, $donethatoncearray)) {
                             $return[$_cfg['extension']['level']][$_cfg['extension']['string_open'] . $boelieboelie . $_cfg['extension']['string_close']] = guilang($tmpl, $__lang);
                             #$source=str_replace("{ext:".$boelieboelie.":ension}", guilang($tmpl, $__lang), $source);
                         }
                     } else {
                         if (!in_array($boelieboelie, $donethatoncearray)) {
                             $return[$_cfg['extension']['level']][$_cfg['extension']['string_open'] . $boelieboelie . $_cfg['extension']['string_close']] = $tmpl;
                             #$source=str_replace("{ext:".$boelieboelie.":ension}", $tmpl, $source);
                         }
                     }
                     #		}
                     #		echo "<pre>";
                     #		print_r($source);
                     if (isset($_cfg['always_block_ext_scan_inside'][$boelieboelie])) {
                         $donethatoncearray[] = $boelieboelie;
                     }
                     /*
                     loop result for generating output cmd
                       {
                     load "cfg/custom/named*.css"; if found
                     load "lang/custom/named*.css"; if found
                     load tmpl/named*.html if found;
                     load tmpl/js/named*.js if found;
                     ob_start();
                     load "fc/customcallback/named*.php"; < 
                     repl {DEFAULTTAG} in html result if any, with ob_end_Clean() or what comes from return function;  result
                     result repl guilang
                     $rep[$cfgdepth]["named*"]=result
                     }
                     #gen output cmd exe
                     */
                     $_cfg = $cfg_gl;
                 }
             }
         }
     } else {
         $noloop = true;
     }
     # end prepare loop
     #start output gen loop
     if (isset($return) && is_array($return) && count($return) > 0) {
         if ($js != false) {
             $extensionjs = "";
         }
         //$source2=$source;
         foreach ($return as $ret) {
             $source = str_replace(array_keys($ret), array_values($ret), $source);
             foreach ($ret as $re => $turn) {
                 if ($js == 'print') {
                     if (file_exists($GLOBALS['__the_cwd'] . "/" . $_cfg['folders']['templates'] . "js/" . str_replace(array($_cfg['extension']['string_open'], $_cfg['extension']['string_close']), "", $re) . ".js")) {
                         $extensionjs .= "//" . $_cfg['folders']['templates'] . "js/" . str_replace(array($_cfg['extension']['string_open'], $_cfg['extension']['string_close']), "", $re) . ".js\n";
                         $extensionjs .= file_get_contents($GLOBALS['__the_cwd'] . "/" . $_cfg['folders']['templates'] . "js/" . str_replace(array($_cfg['extension']['string_open'], $_cfg['extension']['string_close']), "", $re) . ".js");
                         $extensionjs .= "\n\n//------------------------------//\n\n\n\n";
                     }
                 }
             }
         }
         ############## moved to this place @ 0.2.6
         if ($_cfg['extension']['loop_srch_ext'] != "disabled" && $js == false) {
             $source = extension($source, $scrext, $_cfg, $langcss, $js, $donethatoncearray);
         }
         ##############
         if ($js == "print") {
             @ob_end_clean();
             @ob_end_clean();
             @ob_end_clean();
             @ob_end_clean();
             if (strlen($extensionjs) == 0) {
                 die("Unable to determine javascript source files, no " . $_cfg['extension']['string_open'] . "*" . $_cfg['extension']['string_close'] . " tags found for the current coreclient or no corresponding js files.");
             }
             $returnjs .= $extensionjs;
         }
     } elseif ($js != false) {
         die("Unable to determine javascript source files, no " . $_cfg['extension']['string_open'] . "*" . $_cfg['extension']['string_close'] . " tags found for the current coreclient or no corresponding js files.");
     }
     if ($js != false) {
         return $returnjs;
     } else {
         return $source;
     }
 }
Esempio n. 14
0
             $_GET['ele'] = "{lang:invalid_mime/l}: " . $mime;
             $_GET['fn'] = '';
         }
     } elseif ($_cfg['global']['detect_mime'] == "exact") {
         if (isset($_cfg['exlink_mime'][$current_ext]) && $mime == $_cfg['extlink_mime'][$current_ext]) {
         } else {
             $invalidmime = 1;
             $_GET['ele'] = "{lang:invalid_mime/l}: " . $mime;
             $_GET['fn'] = '';
         }
     }
     $mime = '';
 }
 #load overwriting current_extension_config now that we finally got the most likely correct extlink
 if (file_exists($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/" . $current_extlink . ".css")) {
     $arr = parse_css(file_get_contents($__the_cwd . "/core_clients/" . $_cfg['global']['current_client'] . "/cfgs/" . $current_extlink . ".css"), true);
     if (isset($arr) && is_array($arr)) {
         foreach ($arr['1'] as $a => $b) {
             $tmp_cfg[$a] = piecele($arr['1'], $a);
         }
     }
     $_cfg = mergecss($_cfg, $tmp_cfg);
 }
 # final EXTLINK check:
 # LETS LINE UP SOME MIMER-ABLE THINGS
 if (isset($noext) && $noext == 1 && $_cfg['global']['autodetect_ext'] == "on") {
     $__d0 = dir($oldir . "/" . $_cfg['global']['default_request_folder'] . "/");
     while (false !== ($entry = $__d0->read())) {
         if (strstr($entry, html_entity_decode($_GET['fn']))) {
             if ($_cfg['global']['detect_mime'] != "none") {
                 $mime = get_mime_wrap($oldir . "/" . $_cfg['global']['default_request_folder']) . "/" . html_entity_decode($_GET['fn']);
Esempio n. 15
0
<?php

echo parse_css('default2.css');
function parse_css($css_url)
{
    $result = array();
    if (strlen($css_url) && strpos($css_url, '://') === false) {
        if (strpos($css_url, '/') === 0) {
            // against '/main.css'
            $css_url = substr($css_url, 1);
        }
        if (($css = file_get_contents($css_url)) !== false) {
            // strip comments
            $css = preg_replace("/\\/\\*(.*)?\\*\\//Usi", "", $css);
            // parse css
            $partss = explode("}", $css);
            $parts = array_pop($partss);
            //print_r($partss);
            if (sizeof($partss) > 0) {
                foreach ($partss as $part) {
                    list($s_key, $s_code) = explode("{", $part);
                    $keys = explode(",", trim($s_key));
                    //print_r($keys);
                    if (sizeof($keys) > 0) {
                        foreach ($keys as $key) {
                            if (strlen($key) > 0) {
                                //echo $key;
                                list($tmp, $key) = explode(".", $key);
                                //list($key, $tmp) = explode(" ", $key);
                                //list($key, $tmp) = explode(":", $key);
                                //list($key, $tmp) = explode("#", $key);