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


PHP csstidy::parse_from_url方法代码示例

本文整理汇总了PHP中csstidy::parse_from_url方法的典型用法代码示例。如果您正苦于以下问题:PHP csstidy::parse_from_url方法的具体用法?PHP csstidy::parse_from_url怎么用?PHP csstidy::parse_from_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在csstidy的用法示例。


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

示例1: elseif

        case 3:
            $css->load_template('highest_compression');
            break;
        case 2:
            $css->load_template('high_compression');
            break;
        case 0:
            $css->load_template('low_compression');
            break;
    }
}
if ($url) {
    if (substr($_REQUEST['url'], 0, 7) !== 'http://') {
        $_REQUEST['url'] = 'http://' . $_REQUEST['url'];
    }
    $result = $css->parse_from_url($_REQUEST['url'], 0);
} elseif (isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text']) > 5) {
    $result = $css->parse($_REQUEST['css_text']);
}
if ($result) {
    $ratio = $css->print->get_ratio();
    $diff = $css->print->get_diff();
    if (isset($_REQUEST['file_output'])) {
        $filename = md5(mt_rand() . time() . mt_rand());
        if (!is_dir('temp')) {
            $madedir = mkdir('temp');
            if (!$madedir) {
                print 'Could not make directory "temp" in ' . dirname(__FILE__);
                exit;
            }
        }
开发者ID:moscarar,项目名称:cityhow,代码行数:31,代码来源:css_optimiser.php

示例2: printResults


//.........这里部分代码省略.........
                    $totalSum = 0;
                    foreach ($masterResultsRaw[$elementId][$calc] as $group => $rawResult) {
                        foreach ($theseGroupSettings as $id => $thisGroupSetting) {
                            if ($thisGroupSetting === "none") {
                                continue;
                            }
                            $elementMetaData = formulize_getElementMetaData($thisGroupSetting, false);
                            $groupText = formulize_swapUIText($groupingValues[$elementId][$calc][$group][$id], unserialize($elementMetaData['ele_uitext']));
                            $output .= "<tr><td>" . printSmart(trans($groupText)) . "</td><td class='sum-total' style='text-align: right;'>" . formulize_numberFormat($rawResult['sum'], $handle) . "</td></tr>";
                            $totalSum += $rawResult['sum'];
                        }
                    }
                    $output .= "<tr><td style='border-top: 1px solid black;'><b>" . _formulize_DE_CALC_GRANDTOTAL . "</b></td><td style='border-top: 1px solid black; text-align: right;' class='sum-total'><b>" . formulize_numberFormat($totalSum, $handle) . "</b></td></tr>\n";
                    $output .= "</table>";
                } else {
                    $rawResult = $masterResultsRaw[$elementId][$calc][0];
                    $output .= "<div class='sum-total'><p><b>" . _formulize_DE_CALC_SUM . " . . . " . formulize_numberFormat($rawResult['sum'], $handle) . "</b></p></div>\n";
                }
                $output .= "</td></tr>";
                // end of the main row, and the specific cell with the calculations results
            } else {
                $start = 1;
                foreach ($groups as $group => $result) {
                    //foreach($result as $resultID=>$thisResult) {
                    if (!$start) {
                        $output .= "<tr>\n";
                    }
                    $start = 0;
                    $output .= "<td class=odd>\n";
                    //if(count($groups)>1) { // OR count($groups)>1) { // output the heading section for this group of results
                    $output .= "<p><b>";
                    $start2 = true;
                    foreach (explode("!@^%*", $groupingSettings[$elementId][$calc]) as $id => $thisGroupSetting) {
                        if ($thisGroupSetting === "none") {
                            continue;
                        }
                        if (!$start2) {
                            $output .= "<br>\n";
                        }
                        $start2 = false;
                        $elementMetaData = formulize_getElementMetaData($thisGroupSetting, false);
                        $groupText = formulize_swapUIText($groupingValues[$elementId][$calc][$group][$id], unserialize($elementMetaData['ele_uitext']));
                        $output .= printSmart(trans(getCalcHandleText($thisGroupSetting, true))) . ": " . printSmart(trans($groupText)) . "\n";
                    }
                    $output .= "</b></p>\n";
                    //}
                    $output .= "<p>{$result}</p>\n";
                    $output .= "</td></tr>\n";
                    //}
                }
            }
        }
    }
    print $output;
    // addition of calculation download, August 22 2006
    if ($filename) {
        // get the current CSS values for head, even and odd
        global $xoopsConfig;
        $head = "";
        $odd = "";
        $even = "";
        formulize_benchmark("before reading stylesheet");
        if (file_exists(XOOPS_ROOT_PATH . "/themes/" . $xoopsConfig['theme_set'] . "/style.css")) {
            if (!class_exists('csstidy')) {
                // use supplied csstidy in parent if one exists...
                if (file_exists(XOOPS_ROOT_PATH . "/plugins/csstidy/class.csstidy.php")) {
                    include_once XOOPS_ROOT_PATH . "/plugins/csstidy/class.csstidy.php";
                } else {
                    include_once XOOPS_ROOT_PATH . "/modules/formulize/class/class.csstidy.php";
                }
            }
            $css = new csstidy();
            $css->set_cfg('merge_selectors', 0);
            $css->parse_from_url(XOOPS_ROOT_PATH . "/themes/" . $xoopsConfig['theme_set'] . "/style.css");
            $parsed_css = $css->css;
            // parsed_css seems to have only one key when looking at the default template...key is the number of styles?
            foreach ($parsed_css as $thiscss) {
                $head = isset($thiscss['.head']['background-color']) ? $thiscss['.head']['background-color'] : isset($thiscss['.head']['background']) ? $thiscss['.head']['background'] : "";
                $even = isset($thiscss['.even']['background-color']) ? $thiscss['.even']['background-color'] : isset($thiscss['.even']['background']) ? $thiscss['.even']['background'] : "";
                $odd = isset($thiscss['.odd']['background-color']) ? $thiscss['.odd']['background-color'] : isset($thiscss['.odd']['background']) ? $thiscss['.odd']['background'] : "";
            }
        }
        formulize_benchmark("after reading stylesheet");
        unset($css);
        // if we couldn't find any values, use these:
        $head = $head ? $head : "#c2cdd6";
        $even = $even ? $even : "#dee3e7";
        $odd = $odd ? $odd : "#E9E9E9";
        // create the file
        formulize_benchmark("before creating file");
        $outputfile = "<HTML>\n<head>\n<meta name=\"generator\" content=\"Formulize -- form creation and data management for XOOPS\" />\n<title>" . _formulize_DE_EXPORTCALC_TITLE . " '{$title}'</title>\n<style type=\"text/css\">\n.outer {border: 1px solid silver;}\n.head { background-color: {$head}; padding: 5px; font-weight: bold; }\n.even { background-color: {$even}; padding: 5px; }\t\t\n.odd { background-color: {$odd}; padding: 5px; }\nbody {color: black; background: white; margin-top: 30px; margin-bottom: 30px; margin-left: 30px; margin-right: 30px; padding: 0; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;}\ntd { vertical-align: top; }\n</style>\n</head>\n<body>\n<h1>" . _formulize_DE_EXPORTCALC_TITLE . " '{$title}'</h1>\n<table class=outer>\n{$output}\n</table>\n</body>\n</html>";
        // output the file
        $exfilename = strrchr($filename, "/");
        $wpath = XOOPS_ROOT_PATH . SPREADSHEET_EXPORT_FOLDER . "{$exfilename}";
        $exportfile = fopen($wpath, "w");
        fwrite($exportfile, $outputfile);
        fclose($exportfile);
    }
    formulize_benchmark("after creating file");
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:101,代码来源:entriesdisplay.php


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