Version Description
- Removed unnecessary code from AJAX processing file
- Improved admin data processing
Download this release
Release Info
Developer | Rustaurius |
Plugin | Ultimate FAQ |
Version | 1.6.4 |
Comparing to | |
See all releases |
Code changes from version 1.6.3 to 1.6.4
- Functions/EWD_UFAQ_Import.php +2 -2
- Functions/EWD_UFAQ_Meta_Boxes.php +2 -2
- Functions/Process_Ajax.php +18 -16
- Functions/Update_Admin_Databases.php +127 -103
- Main.php +5 -3
- css/CSSTidy/class.csstidy.php +999 -0
- css/CSSTidy/class.csstidy_optimise.php +809 -0
- css/CSSTidy/class.csstidy_print.php +349 -0
- css/CSSTidy/css_optimiser.php +353 -0
- css/CSSTidy/cssparse.css +137 -0
- css/CSSTidy/data.inc.php +473 -0
- css/CSSTidy/lang.inc.php +238 -0
- html/DashboardPage.php +2 -2
- js/ewd-ufaq-js.js +0 -1
- readme.txt +4 -0
Functions/EWD_UFAQ_Import.php
CHANGED
@@ -40,10 +40,10 @@ function EWD_UFAQ_Import(){
|
|
40 |
function Add_EWD_UFAQs_From_Spreadsheet($Excel_File_Name){
|
41 |
global $wpdb;
|
42 |
|
43 |
-
$Excel_URL = '
|
44 |
|
45 |
// Uses the PHPExcel class to simplify the file parsing process
|
46 |
-
include_once('
|
47 |
|
48 |
// Build the workbook object out of the uploaded spredsheet
|
49 |
$inputFileType = PHPExcel_IOFactory::identify($Excel_URL);
|
40 |
function Add_EWD_UFAQs_From_Spreadsheet($Excel_File_Name){
|
41 |
global $wpdb;
|
42 |
|
43 |
+
$Excel_URL = EWD_UFAQ_CD_PLUGIN_PATH . 'faq-sheets/' . $Excel_File_Name;
|
44 |
|
45 |
// Uses the PHPExcel class to simplify the file parsing process
|
46 |
+
include_once(EWD_UFAQ_CD_PLUGIN_PATH . 'PHPExcel/Classes/PHPExcel.php');
|
47 |
|
48 |
// Build the workbook object out of the uploaded spredsheet
|
49 |
$inputFileType = PHPExcel_IOFactory::identify($Excel_URL);
|
Functions/EWD_UFAQ_Meta_Boxes.php
CHANGED
@@ -190,11 +190,11 @@ function EWD_UFAQ_Save_Meta_Box_Data($post_id) {
|
|
190 |
else {$Value = $File_Upload_Return['Data'];}
|
191 |
}
|
192 |
elseif ($FAQ_Field_Item['FieldType'] == "checkbox") {
|
193 |
-
foreach ($_POST[$FieldName] as $SingleValue) {$Value .= trim($SingleValue) . ",";}
|
194 |
$Value = substr($Value, 0, strlen($Value)-1);
|
195 |
}
|
196 |
else {
|
197 |
-
$Value = stripslashes_deep(trim($_POST[$FieldName]));
|
198 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
199 |
if (sizeOf($Options) > 0 and $Options[0] != "") {
|
200 |
array_walk($Options, create_function('&$val', '$val = trim($val);'));
|
190 |
else {$Value = $File_Upload_Return['Data'];}
|
191 |
}
|
192 |
elseif ($FAQ_Field_Item['FieldType'] == "checkbox") {
|
193 |
+
foreach ($_POST[$FieldName] as $SingleValue) {$Value .= trim(sanitize_text_field($SingleValue)) . ",";}
|
194 |
$Value = substr($Value, 0, strlen($Value)-1);
|
195 |
}
|
196 |
else {
|
197 |
+
$Value = stripslashes_deep(trim(sanitize_text_field($_POST[$FieldName])));
|
198 |
$Options = explode(",", $FAQ_Field_Item['FieldValues']);
|
199 |
if (sizeOf($Options) > 0 and $Options[0] != "") {
|
200 |
array_walk($Options, create_function('&$val', '$val = trim($val);'));
|
Functions/Process_Ajax.php
CHANGED
@@ -4,24 +4,20 @@
|
|
4 |
|
5 |
// Returns the FAQs that are found for a specific search
|
6 |
function UFAQ_Search() {
|
7 |
-
$
|
8 |
-
include_once($Path);
|
9 |
|
10 |
-
$
|
11 |
-
|
12 |
-
$ReturnArray['request_count'] = $_POST['request_count'];
|
13 |
$ReturnArray['message'] = $response;
|
14 |
echo json_encode($ReturnArray);
|
|
|
|
|
15 |
}
|
16 |
add_action('wp_ajax_ufaq_search', 'UFAQ_Search');
|
17 |
add_action( 'wp_ajax_nopriv_ufaq_search', 'UFAQ_Search');
|
18 |
|
19 |
// Change the up and down votes for a particular FAQ
|
20 |
function EWD_UFAQ_Update_Rating() {
|
21 |
-
|
22 |
-
include_once($Path);*/
|
23 |
-
|
24 |
-
$FAQ_ID = $_POST['FAQ_ID'];
|
25 |
$Vote_Type = $_POST['Vote_Type'];
|
26 |
|
27 |
if ($Vote_Type == "Up") {
|
@@ -44,30 +40,36 @@ add_action( 'wp_ajax_nopriv_ufaq_update_rating', 'EWD_UFAQ_Update_Rating');
|
|
44 |
|
45 |
// Records the number of time an FAQ post is opened
|
46 |
function UFAQ_Record_View() {
|
47 |
-
$Path = ABSPATH . 'wp-load.php';
|
48 |
-
include_once($Path);
|
49 |
-
|
50 |
global $wpdb;
|
51 |
$wpdb->show_errors();
|
52 |
-
$post_id = substr($_POST['post_id'], 4, strrpos($_POST['post_id'], "-") - 4);
|
|
|
|
|
|
|
53 |
$Meta_ID = $wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key='ufaq_view_count'", $post_id));
|
54 |
if ($Meta_ID != "" and $Meta_ID != 0) {$wpdb->query($wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value=meta_value+1 WHERE post_id=%d AND meta_key='ufaq_view_count'", $post_id));}
|
55 |
else {$wpdb->query($wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES (%d,'ufaq_view_count','1')", $post_id));}
|
56 |
|
|
|
57 |
}
|
58 |
add_action('wp_ajax_ufaq_record_view', 'UFAQ_Record_View');
|
59 |
add_action( 'wp_ajax_nopriv_ufaq_record_view', 'UFAQ_Record_View');
|
60 |
|
61 |
function EWD_UFAQ_Save_Order(){
|
|
|
|
|
62 |
foreach ($_POST['ewd-ufaq-item'] as $Key=>$ID) {
|
63 |
update_post_meta($ID, 'ufaq_order', $Key);
|
64 |
}
|
65 |
|
|
|
66 |
}
|
67 |
add_action('wp_ajax_UFAQ_update_order','EWD_UFAQ_Save_Order');
|
68 |
|
69 |
function EWD_UFAQ_Add_WC_FAQs(){
|
70 |
-
$Post_ID = $_POST['Post_ID'];
|
|
|
|
|
71 |
|
72 |
$Current_FAQs = get_post_meta($Post_ID, 'EWD_UFAQ_WC_Selected_FAQs', true );
|
73 |
if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
|
@@ -111,7 +113,7 @@ function EWD_UFAQ_Delete_WC_FAQs(){
|
|
111 |
add_action('wp_ajax_ewd_ufaq_delete_wc_faqs','EWD_UFAQ_Delete_WC_FAQs');
|
112 |
|
113 |
function EWD_UFAQ_WC_FAQ_Category() {
|
114 |
-
$Cat_ID = $_POST['Cat_ID'];
|
115 |
|
116 |
$args = array("numberposts" => -1, "post_type" => 'ufaq');
|
117 |
if ($Cat_ID != "") {
|
@@ -142,7 +144,7 @@ function EWD_UFAQ_WC_FAQ_Category() {
|
|
142 |
add_action('wp_ajax_ewd_ufaq_wc_faq_category','EWD_UFAQ_WC_FAQ_Category');
|
143 |
|
144 |
function EWD_UFAQ_Hide_Review_Ask(){
|
145 |
-
$Ask_Review_Date = $_POST['Ask_Review_Date'];
|
146 |
|
147 |
update_option('EWD_UFAQ_Ask_Review_Date', time()+3600*24*$Ask_Review_Date);
|
148 |
|
4 |
|
5 |
// Returns the FAQs that are found for a specific search
|
6 |
function UFAQ_Search() {
|
7 |
+
$response = do_shortcode("[ultimate-faqs search_string='" . strtolower(sanitize_text_field($_POST['Q'])) . "' include_category='" . sanitize_text_field($_POST['include_category']) . "' exclude_category='" . sanitize_text_field($_POST['exclude_category']) . "' orderby='" . sanitize_text_field($_POST['orderby']) . "' order='" . sanitize_text_field($_POST['order']) . "' post_count='" . sanitize_text_field($_POST['post_count']) . "' current_url='" . sanitize_text_field($_POST['current_url']) . "' ajax='Yes']");
|
|
|
8 |
|
9 |
+
$ReturnArray['request_count'] = sanitize_text_field($_POST['request_count']);
|
|
|
|
|
10 |
$ReturnArray['message'] = $response;
|
11 |
echo json_encode($ReturnArray);
|
12 |
+
|
13 |
+
die();
|
14 |
}
|
15 |
add_action('wp_ajax_ufaq_search', 'UFAQ_Search');
|
16 |
add_action( 'wp_ajax_nopriv_ufaq_search', 'UFAQ_Search');
|
17 |
|
18 |
// Change the up and down votes for a particular FAQ
|
19 |
function EWD_UFAQ_Update_Rating() {
|
20 |
+
$FAQ_ID = is_numeric($_POST['FAQ_ID']) ? sanitize_text_field($_POST['FAQ_ID']) : 0;
|
|
|
|
|
|
|
21 |
$Vote_Type = $_POST['Vote_Type'];
|
22 |
|
23 |
if ($Vote_Type == "Up") {
|
40 |
|
41 |
// Records the number of time an FAQ post is opened
|
42 |
function UFAQ_Record_View() {
|
|
|
|
|
|
|
43 |
global $wpdb;
|
44 |
$wpdb->show_errors();
|
45 |
+
$post_id = substr($_POST['post_id'], 4, strrpos(sanitize_text_field($_POST['post_id']), "-") - 4);
|
46 |
+
|
47 |
+
if (!is_numeric($post_id)) {return;}
|
48 |
+
|
49 |
$Meta_ID = $wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key='ufaq_view_count'", $post_id));
|
50 |
if ($Meta_ID != "" and $Meta_ID != 0) {$wpdb->query($wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value=meta_value+1 WHERE post_id=%d AND meta_key='ufaq_view_count'", $post_id));}
|
51 |
else {$wpdb->query($wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES (%d,'ufaq_view_count','1')", $post_id));}
|
52 |
|
53 |
+
die();
|
54 |
}
|
55 |
add_action('wp_ajax_ufaq_record_view', 'UFAQ_Record_View');
|
56 |
add_action( 'wp_ajax_nopriv_ufaq_record_view', 'UFAQ_Record_View');
|
57 |
|
58 |
function EWD_UFAQ_Save_Order(){
|
59 |
+
if (!is_array($_POST['ewd-ufaq-item'])) {return;}
|
60 |
+
|
61 |
foreach ($_POST['ewd-ufaq-item'] as $Key=>$ID) {
|
62 |
update_post_meta($ID, 'ufaq_order', $Key);
|
63 |
}
|
64 |
|
65 |
+
die();
|
66 |
}
|
67 |
add_action('wp_ajax_UFAQ_update_order','EWD_UFAQ_Save_Order');
|
68 |
|
69 |
function EWD_UFAQ_Add_WC_FAQs(){
|
70 |
+
$Post_ID = sanitize_text_field($_POST['Post_ID']);
|
71 |
+
|
72 |
+
if (!is_numeric($Post_ID)) {return;}
|
73 |
|
74 |
$Current_FAQs = get_post_meta($Post_ID, 'EWD_UFAQ_WC_Selected_FAQs', true );
|
75 |
if (!is_array($Current_FAQs)) {$Current_FAQs = array();}
|
113 |
add_action('wp_ajax_ewd_ufaq_delete_wc_faqs','EWD_UFAQ_Delete_WC_FAQs');
|
114 |
|
115 |
function EWD_UFAQ_WC_FAQ_Category() {
|
116 |
+
$Cat_ID = sanitize_text_field($_POST['Cat_ID']);
|
117 |
|
118 |
$args = array("numberposts" => -1, "post_type" => 'ufaq');
|
119 |
if ($Cat_ID != "") {
|
144 |
add_action('wp_ajax_ewd_ufaq_wc_faq_category','EWD_UFAQ_WC_FAQ_Category');
|
145 |
|
146 |
function EWD_UFAQ_Hide_Review_Ask(){
|
147 |
+
$Ask_Review_Date = sanitize_text_field($_POST['Ask_Review_Date']);
|
148 |
|
149 |
update_option('EWD_UFAQ_Ask_Review_Date', time()+3600*24*$Ask_Review_Date);
|
150 |
|
Functions/Update_Admin_Databases.php
CHANGED
@@ -17,50 +17,51 @@ function EWD_UFAQ_UpdateOptions() {
|
|
17 |
|
18 |
if ( ! wp_verify_nonce( $_POST['EWD_UFAQ_Save_Options_Nonce'], 'EWD_UFAQ_Save_Options' ) ) {return;}
|
19 |
|
20 |
-
$Custom_CSS = (isset($_POST['custom_css']) ? $_POST['custom_css'] : null);
|
21 |
-
$Social_Media_Array = (isset($_POST['Socialmedia']) ? $_POST['Socialmedia'] :
|
|
|
22 |
if (is_array($Social_Media_Array)) {$Social_Media = implode(",", $Social_Media_Array);}
|
23 |
|
24 |
$Custom_CSS = stripslashes_deep($Custom_CSS);
|
25 |
|
26 |
if (isset($_POST['Options_Submit'])) {update_option('EWD_UFAQ_Custom_CSS', $Custom_CSS);}
|
27 |
-
if (isset($_POST['faq_toggle'])) {update_option('EWD_UFAQ_Toggle',
|
28 |
-
if (isset($_POST['faq_category_toggle'])) {update_option('EWD_UFAQ_Category_Toggle',
|
29 |
-
if (isset($_POST['expand_collapse_all'])) {update_option('EWD_UFAQ_Expand_Collapse_All',
|
30 |
-
if (isset($_POST['faq_accordion'])) {update_option('EWD_UFAQ_FAQ_Accordion', $_POST['faq_accordion']);}
|
31 |
-
if (isset($_POST['faq_auto_complete_titles'])) {update_option('EWD_UFAQ_Auto_Complete_Titles', $_POST['faq_auto_complete_titles']);}
|
32 |
-
if (isset($_POST['hide_categories'])) {update_option('EWD_UFAQ_Hide_Categories', $_POST['hide_categories']);}
|
33 |
-
if (isset($_POST['hide_tags'])) {update_option('EWD_UFAQ_Hide_Tags', $_POST['hide_tags']);}
|
34 |
-
if (isset($_POST['scroll_to_top'])) {update_option('EWD_UFAQ_Scroll_To_Top', $_POST['scroll_to_top']);}
|
35 |
-
if (isset($_POST['display_all_answers'])) {update_option('EWD_UFAQ_Display_All_Answers', $_POST['display_all_answers']);}
|
36 |
-
if (isset($_POST['display_author'])) {update_option('EWD_UFAQ_Display_Author', $_POST['display_author']);}
|
37 |
-
if (isset($_POST['display_date'])) {update_option('EWD_UFAQ_Display_Date', $_POST['display_date']);}
|
38 |
-
if (isset($_POST['display_back_to_top'])) {update_option('EWD_UFAQ_Display_Back_To_Top', $_POST['display_back_to_top']);}
|
39 |
-
if (isset($_POST['include_permalink'])) {update_option('EWD_UFAQ_Include_Permalink', $_POST['include_permalink']);}
|
40 |
-
if (isset($_POST['permalink_type'])) {update_option('EWD_UFAQ_Permalink_Type', $_POST['permalink_type']);}
|
41 |
-
if (isset($_POST['show_tinymce'])) {update_option('EWD_UFAQ_Show_TinyMCE', $_POST['show_tinymce']);}
|
42 |
-
if (isset($_POST['comments_on'])) {update_option('EWD_UFAQ_Comments_On', $_POST['comments_on']);}
|
43 |
-
|
44 |
-
if (isset($_POST['display_style']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Display_Style', $_POST['display_style']);}
|
45 |
-
if (isset($_POST['color_block_shape']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Color_Block_Shape', $_POST['color_block_shape']);}
|
46 |
-
if (isset($_POST['faq_ratings']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_FAQ_Ratings', $_POST['faq_ratings']);}
|
47 |
-
if (isset($_POST['woocommerce_faqs']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_WooCommerce_FAQs', $_POST['woocommerce_faqs']);}
|
48 |
-
if (isset($_POST['use_product']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Use_Product', $_POST['use_product']);}
|
49 |
-
if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', $_POST['reveal_effect']);}
|
50 |
-
if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', $_POST['pretty_permalinks']);}
|
51 |
-
if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', $_POST['allow_proposed_answer']);}
|
52 |
-
if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', $_POST['admin_question_notification']);}
|
53 |
-
if (isset($_POST['Options_Submit']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Notification_Email', $_POST['admin_notification_email']);}
|
54 |
-
if (isset($_POST['faq_auto_complete_titles']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Auto_Complete_Titles', $_POST['faq_auto_complete_titles']);}
|
55 |
if (isset($_POST['slug_base']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Slug_Base', $_POST['slug_base']);}
|
56 |
if (isset($_POST['Socialmedia']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Social_Media', $Social_Media);}
|
57 |
|
58 |
-
if (isset($_POST['group_by_category'])) {update_option('EWD_UFAQ_Group_By_Category', $_POST['group_by_category']);}
|
59 |
-
if (isset($_POST['group_by_category_count'])) {update_option('EWD_UFAQ_Group_By_Category_Count', $_POST['group_by_category_count']);}
|
60 |
-
if (isset($_POST['group_by_order_by'])) {update_option('EWD_UFAQ_Group_By_Order_By', $_POST['group_by_order_by']);}
|
61 |
-
if (isset($_POST['group_by_order'])) {update_option('EWD_UFAQ_Group_By_Order', $_POST['group_by_order']);}
|
62 |
-
if (isset($_POST['order_by_setting'])) {update_option('EWD_UFAQ_Order_By', $_POST['order_by_setting']);}
|
63 |
-
if (isset($_POST['order_setting'])) {update_option('EWD_UFAQ_Order', $_POST['order_setting']);}
|
64 |
|
65 |
$Counter = 0;
|
66 |
$Custom_Fields = array();
|
@@ -80,77 +81,100 @@ function EWD_UFAQ_UpdateOptions() {
|
|
80 |
}
|
81 |
|
82 |
if (isset($_POST['Options_Submit'])) {update_option('EWD_UFAQ_FAQ_Fields', $Custom_Fields);}
|
83 |
-
if (isset($_POST['hide_blank_fields'])) {update_option('EWD_UFAQ_Hide_Blank_Fields', $_POST['hide_blank_fields']);}
|
84 |
-
|
85 |
-
|
86 |
-
if (isset($_POST['posted_label'])) {update_option('EWD_UFAQ_Posted_Label', $_POST['posted_label']);}
|
87 |
-
if (isset($_POST['by_label'])) {update_option('EWD_UFAQ_By_Label', $_POST['by_label']);}
|
88 |
-
if (isset($_POST['on_label'])) {update_option('EWD_UFAQ_On_Label', $_POST['on_label']);}
|
89 |
-
if (isset($_POST['category_label'])) {update_option('EWD_UFAQ_Category_Label', $_POST['category_label']);}
|
90 |
-
if (isset($_POST['tag_label'])) {update_option('EWD_UFAQ_Tag_Label', $_POST['tag_label']);}
|
91 |
-
if (isset($_POST['enter_question_label'])) {update_option('EWD_UFAQ_Enter_Question_Label', $_POST['enter_question_label']);}
|
92 |
-
if (isset($_POST['search_label'])) {update_option('EWD_UFAQ_Search_Label', $_POST['search_label']);}
|
93 |
-
if (isset($_POST['permalink_label'])) {update_option('EWD_UFAQ_Permalink_Label', $_POST['permalink_label']);}
|
94 |
-
if (isset($_POST['back_to_top_label'])) {update_option('EWD_UFAQ_Back_To_Top_Label', $_POST['back_to_top_label']);}
|
95 |
-
if (isset($_POST['woocommerce_tab_label'])) {update_option('EWD_UFAQ_WooCommerce_Tab_Label', $_POST['woocommerce_tab_label']);}
|
96 |
-
|
97 |
-
if (isset($_POST['thank_you_submit_label'])) {update_option('EWD_UFAQ_Thank_You_Submit_Label', $_POST['thank_you_submit_label']);}
|
98 |
-
if (isset($_POST['submit_question_label'])) {update_option('EWD_UFAQ_Submit_Question_Label', $_POST['submit_question_label']);}
|
99 |
-
if (isset($_POST['please_fill_form_below_label'])) {update_option('EWD_UFAQ_Please_Fill_Form_Below_Label', $_POST['please_fill_form_below_label']);}
|
100 |
-
if (isset($_POST['send_question_label'])) {update_option('EWD_UFAQ_Send_Question_Label', $_POST['send_question_label']);}
|
101 |
-
if (isset($_POST['question_title_label'])) {update_option('EWD_UFAQ_Question_Title_Label', $_POST['question_title_label']);}
|
102 |
-
if (isset($_POST['what_question_being_answered_label'])) {update_option('EWD_UFAQ_What_Question_Being_Answered_Label', $_POST['what_question_being_answered_label']);}
|
103 |
-
if (isset($_POST['proposed_answer_label'])) {update_option('EWD_UFAQ_Proposed_Answer_Label', $_POST['proposed_answer_label']);}
|
104 |
-
if (isset($_POST['review_author_label'])) {update_option('EWD_UFAQ_Review_Author_Label', $_POST['review_author_label']);}
|
105 |
-
if (isset($_POST['what_name_with_review_label'])) {update_option('EWD_UFAQ_What_Name_With_Review_Label', $_POST['what_name_with_review_label']);}
|
106 |
-
if (isset($_POST['retrieving_results'])) {update_option('EWD_UFAQ_Retrieving_Results', $_POST['retrieving_results']);}
|
107 |
-
if (isset($_POST['no_results_found_text'])) {update_option('EWD_UFAQ_No_Results_Found_Text', $_POST['no_results_found_text']);}
|
108 |
-
|
109 |
-
if (isset($_POST['ufaq_styling_default_bg_color'])) {update_option('EWD_UFAQ_Styling_Default_Bg_Color', $_POST['ufaq_styling_default_bg_color']);}
|
110 |
-
if (isset($_POST['ufaq_styling_default_font_color'])) {update_option('EWD_UFAQ_Styling_Default_Font_Color', $_POST['ufaq_styling_default_font_color']);}
|
111 |
-
if (isset($_POST['ufaq_styling_default_border_size'])) {update_option('EWD_UFAQ_Styling_Default_Border_Size', $_POST['ufaq_styling_default_border_size']);}
|
112 |
-
if (isset($_POST['ufaq_styling_default_border_color'])) {update_option('EWD_UFAQ_Styling_Default_Border_Color', $_POST['ufaq_styling_default_border_color']);}
|
113 |
-
if (isset($_POST['ufaq_styling_default_border_radius'])) {update_option('EWD_UFAQ_Styling_Default_Border_Radius', $_POST['ufaq_styling_default_border_radius']);}
|
114 |
-
if (isset($_POST['ufaq_styling_toggle_symbol_size'])) {update_option('EWD_UFAQ_Styling_Toggle_Symbol_Size', $_POST['ufaq_styling_toggle_symbol_size']);}
|
115 |
-
if (isset($_POST['ufaq_styling_block_bg_color'])) {update_option('EWD_UFAQ_Styling_Block_Bg_Color', $_POST['ufaq_styling_block_bg_color']);}
|
116 |
-
if (isset($_POST['ufaq_styling_block_font_color'])) {update_option('EWD_UFAQ_Styling_Block_Font_Color', $_POST['ufaq_styling_block_font_color']);}
|
117 |
-
if (isset($_POST['ufaq_styling_list_font'])) {update_option('EWD_UFAQ_Styling_List_Font', $_POST['ufaq_styling_list_font']);}
|
118 |
-
if (isset($_POST['ufaq_styling_list_font_size'])) {update_option('EWD_UFAQ_Styling_List_Font_Size', $_POST['ufaq_styling_list_font_size']);}
|
119 |
-
if (isset($_POST['ufaq_styling_list_font_color'])) {update_option('EWD_UFAQ_Styling_List_Font_Color', $_POST['ufaq_styling_list_font_color']);}
|
120 |
-
if (isset($_POST['ufaq_styling_list_margin'])) {update_option('EWD_UFAQ_Styling_List_Margin', $_POST['ufaq_styling_list_margin']);}
|
121 |
-
if (isset($_POST['ufaq_styling_list_padding'])) {update_option('EWD_UFAQ_Styling_List_Padding', $_POST['ufaq_styling_list_padding']);}
|
122 |
-
|
123 |
-
if (isset($_POST['ufaq_styling_question_font'])) {update_option('EWD_UFAQ_Styling_Question_Font', $_POST['ufaq_styling_question_font']);}
|
124 |
-
if (isset($_POST['ufaq_styling_question_font_size'])) {update_option('EWD_UFAQ_Styling_Question_Font_Size', $_POST['ufaq_styling_question_font_size']);}
|
125 |
-
if (isset($_POST['ufaq_styling_question_font_color'])) {update_option('EWD_UFAQ_Styling_Question_Font_Color', $_POST['ufaq_styling_question_font_color']);}
|
126 |
-
if (isset($_POST['ufaq_styling_question_margin'])) {update_option('EWD_UFAQ_Styling_Question_Margin', $_POST['ufaq_styling_question_margin']);}
|
127 |
-
if (isset($_POST['ufaq_styling_question_padding'])) {update_option('EWD_UFAQ_Styling_Question_Padding', $_POST['ufaq_styling_question_padding']);}
|
128 |
-
if (isset($_POST['ufaq_styling_question_icon_top_margin'])) {update_option('EWD_UFAQ_Styling_Question_Icon_Top_Margin', $_POST['ufaq_styling_question_icon_top_margin']);}
|
129 |
-
if (isset($_POST['ufaq_styling_answer_font'])) {update_option('EWD_UFAQ_Styling_Answer_Font', $_POST['ufaq_styling_answer_font']);}
|
130 |
-
if (isset($_POST['ufaq_styling_answer_font_size'])) {update_option('EWD_UFAQ_Styling_Answer_Font_Size', $_POST['ufaq_styling_answer_font_size']);}
|
131 |
-
if (isset($_POST['ufaq_styling_answer_font_color'])) {update_option('EWD_UFAQ_Styling_Answer_Font_Color', $_POST['ufaq_styling_answer_font_color']);}
|
132 |
-
if (isset($_POST['ufaq_styling_answer_margin'])) {update_option('EWD_UFAQ_Styling_Answer_Margin', $_POST['ufaq_styling_answer_margin']);}
|
133 |
-
if (isset($_POST['ufaq_styling_answer_padding'])) {update_option('EWD_UFAQ_Styling_Answer_Padding', $_POST['ufaq_styling_answer_padding']);}
|
134 |
-
if (isset($_POST['ufaq_styling_postdate_font'])) {update_option('EWD_UFAQ_Styling_Postdate_Font', $_POST['ufaq_styling_postdate_font']);}
|
135 |
-
if (isset($_POST['ufaq_styling_postdate_font_size'])) {update_option('EWD_UFAQ_Styling_Postdate_Font_Size', $_POST['ufaq_styling_postdate_font_size']);}
|
136 |
-
if (isset($_POST['ufaq_styling_postdate_font_color'])) {update_option('EWD_UFAQ_Styling_Postdate_Font_Color', $_POST['ufaq_styling_postdate_font_color']);}
|
137 |
-
if (isset($_POST['ufaq_styling_postdate_margin'])) {update_option('EWD_UFAQ_Styling_Postdate_Margin', $_POST['ufaq_styling_postdate_margin']);}
|
138 |
-
if (isset($_POST['ufaq_styling_postdate_padding'])) {update_option('EWD_UFAQ_Styling_Postdate_Padding', $_POST['ufaq_styling_postdate_padding']);}
|
139 |
-
if (isset($_POST['ufaq_styling_category_font'])) {update_option('EWD_UFAQ_Styling_Category_Font', $_POST['ufaq_styling_category_font']);}
|
140 |
-
if (isset($_POST['ufaq_styling_category_font_size'])) {update_option('EWD_UFAQ_Styling_Category_Font_Size', $_POST['ufaq_styling_category_font_size']);}
|
141 |
-
if (isset($_POST['ufaq_styling_category_font_color'])) {update_option('EWD_UFAQ_Styling_Category_Font_Color', $_POST['ufaq_styling_category_font_color']);}
|
142 |
-
if (isset($_POST['ufaq_styling_category_margin'])) {update_option('EWD_UFAQ_Styling_Category_Margin', $_POST['ufaq_styling_category_margin']);}
|
143 |
-
if (isset($_POST['ufaq_styling_category_padding'])) {update_option('EWD_UFAQ_Styling_Category_Padding', $_POST['ufaq_styling_category_padding']);}
|
144 |
-
|
145 |
-
if (isset($_POST['ufaq_styling_category_heading_type'])) {update_option('EWD_UFAQ_Styling_Category_Heading_Type', $_POST['ufaq_styling_category_heading_type']);}
|
146 |
-
if (isset($_POST['ufaq_styling_faq_heading_type'])) {update_option('EWD_UFAQ_Styling_FAQ_Heading_Type', $_POST['ufaq_styling_faq_heading_type']);}
|
147 |
-
if (isset($_POST['toggle_symbol'])) {update_option('EWD_UFAQ_Toggle_Symbol', $_POST['toggle_symbol']);}
|
148 |
-
|
149 |
-
if (isset($_POST['custom_css'])) {update_option('EWD_UFAQ_Custom_CSS', $Custom_CSS);}
|
150 |
|
151 |
if (isset($_POST['Pretty_Permalinks']) and $_POST['Pretty_Permalinks'] == "Yes") {
|
152 |
update_option("EWD_UFAQ_Rewrite_Rules", "Yes");
|
153 |
}
|
154 |
}
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
?>
|
17 |
|
18 |
if ( ! wp_verify_nonce( $_POST['EWD_UFAQ_Save_Options_Nonce'], 'EWD_UFAQ_Save_Options' ) ) {return;}
|
19 |
|
20 |
+
$Custom_CSS = (isset($_POST['custom_css']) ? EWD_UFAQ_Validate_CSS($_POST['custom_css']) : null);
|
21 |
+
$Social_Media_Array = (isset($_POST['Socialmedia']) ? $_POST['Socialmedia'] : array());
|
22 |
+
array_walk($Social_Media_Array, 'sanitize_text_field');
|
23 |
if (is_array($Social_Media_Array)) {$Social_Media = implode(",", $Social_Media_Array);}
|
24 |
|
25 |
$Custom_CSS = stripslashes_deep($Custom_CSS);
|
26 |
|
27 |
if (isset($_POST['Options_Submit'])) {update_option('EWD_UFAQ_Custom_CSS', $Custom_CSS);}
|
28 |
+
if (isset($_POST['faq_toggle'])) {update_option('EWD_UFAQ_Toggle', sanitize_text_field($_POST['faq_toggle']));}
|
29 |
+
if (isset($_POST['faq_category_toggle'])) {update_option('EWD_UFAQ_Category_Toggle', sanitize_text_field($_POST['faq_category_toggle']));}
|
30 |
+
if (isset($_POST['expand_collapse_all'])) {update_option('EWD_UFAQ_Expand_Collapse_All', sanitize_text_field($_POST['expand_collapse_all']));}
|
31 |
+
if (isset($_POST['faq_accordion'])) {update_option('EWD_UFAQ_FAQ_Accordion', sanitize_text_field($_POST['faq_accordion']));}
|
32 |
+
if (isset($_POST['faq_auto_complete_titles'])) {update_option('EWD_UFAQ_Auto_Complete_Titles', sanitize_text_field($_POST['faq_auto_complete_titles']));}
|
33 |
+
if (isset($_POST['hide_categories'])) {update_option('EWD_UFAQ_Hide_Categories', sanitize_text_field($_POST['hide_categories']));}
|
34 |
+
if (isset($_POST['hide_tags'])) {update_option('EWD_UFAQ_Hide_Tags', sanitize_text_field($_POST['hide_tags']));}
|
35 |
+
if (isset($_POST['scroll_to_top'])) {update_option('EWD_UFAQ_Scroll_To_Top', sanitize_text_field($_POST['scroll_to_top']));}
|
36 |
+
if (isset($_POST['display_all_answers'])) {update_option('EWD_UFAQ_Display_All_Answers', sanitize_text_field($_POST['display_all_answers']));}
|
37 |
+
if (isset($_POST['display_author'])) {update_option('EWD_UFAQ_Display_Author', sanitize_text_field($_POST['display_author']));}
|
38 |
+
if (isset($_POST['display_date'])) {update_option('EWD_UFAQ_Display_Date', sanitize_text_field($_POST['display_date']));}
|
39 |
+
if (isset($_POST['display_back_to_top'])) {update_option('EWD_UFAQ_Display_Back_To_Top', sanitize_text_field($_POST['display_back_to_top']));}
|
40 |
+
if (isset($_POST['include_permalink'])) {update_option('EWD_UFAQ_Include_Permalink', sanitize_text_field($_POST['include_permalink']));}
|
41 |
+
if (isset($_POST['permalink_type'])) {update_option('EWD_UFAQ_Permalink_Type', sanitize_text_field($_POST['permalink_type']));}
|
42 |
+
if (isset($_POST['show_tinymce'])) {update_option('EWD_UFAQ_Show_TinyMCE', sanitize_text_field($_POST['show_tinymce']));}
|
43 |
+
if (isset($_POST['comments_on'])) {update_option('EWD_UFAQ_Comments_On', sanitize_text_field($_POST['comments_on']));}
|
44 |
+
|
45 |
+
if (isset($_POST['display_style']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Display_Style', sanitize_text_field($_POST['display_style']));}
|
46 |
+
if (isset($_POST['color_block_shape']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Color_Block_Shape', sanitize_text_field($_POST['color_block_shape']));}
|
47 |
+
if (isset($_POST['faq_ratings']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_FAQ_Ratings', sanitize_text_field($_POST['faq_ratings']));}
|
48 |
+
if (isset($_POST['woocommerce_faqs']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_WooCommerce_FAQs', sanitize_text_field($_POST['woocommerce_faqs']));}
|
49 |
+
if (isset($_POST['use_product']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Use_Product', sanitize_text_field($_POST['use_product']));}
|
50 |
+
if (isset($_POST['reveal_effect']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Reveal_Effect', sanitize_text_field($_POST['reveal_effect']));}
|
51 |
+
if (isset($_POST['pretty_permalinks']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Pretty_Permalinks', sanitize_text_field($_POST['pretty_permalinks']));}
|
52 |
+
if (isset($_POST['allow_proposed_answer']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Allow_Proposed_Answer', sanitize_text_field($_POST['allow_proposed_answer']));}
|
53 |
+
if (isset($_POST['admin_question_notification']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Question_Notification', sanitize_text_field($_POST['admin_question_notification']));}
|
54 |
+
if (isset($_POST['Options_Submit']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Admin_Notification_Email', sanitize_text_field($_POST['admin_notification_email']));}
|
55 |
+
if (isset($_POST['faq_auto_complete_titles']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Auto_Complete_Titles', sanitize_text_field($_POST['faq_auto_complete_titles']));}
|
56 |
if (isset($_POST['slug_base']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Slug_Base', $_POST['slug_base']);}
|
57 |
if (isset($_POST['Socialmedia']) and $UFAQ_Full_Version == "Yes") {update_option('EWD_UFAQ_Social_Media', $Social_Media);}
|
58 |
|
59 |
+
if (isset($_POST['group_by_category'])) {update_option('EWD_UFAQ_Group_By_Category', sanitize_text_field($_POST['group_by_category']));}
|
60 |
+
if (isset($_POST['group_by_category_count'])) {update_option('EWD_UFAQ_Group_By_Category_Count', sanitize_text_field($_POST['group_by_category_count']));}
|
61 |
+
if (isset($_POST['group_by_order_by'])) {update_option('EWD_UFAQ_Group_By_Order_By', sanitize_text_field($_POST['group_by_order_by']));}
|
62 |
+
if (isset($_POST['group_by_order'])) {update_option('EWD_UFAQ_Group_By_Order', sanitize_text_field($_POST['group_by_order']));}
|
63 |
+
if (isset($_POST['order_by_setting'])) {update_option('EWD_UFAQ_Order_By', sanitize_text_field($_POST['order_by_setting']));}
|
64 |
+
if (isset($_POST['order_setting'])) {update_option('EWD_UFAQ_Order', sanitize_text_field($_POST['order_setting']));}
|
65 |
|
66 |
$Counter = 0;
|
67 |
$Custom_Fields = array();
|
81 |
}
|
82 |
|
83 |
if (isset($_POST['Options_Submit'])) {update_option('EWD_UFAQ_FAQ_Fields', $Custom_Fields);}
|
84 |
+
if (isset($_POST['hide_blank_fields'])) {update_option('EWD_UFAQ_Hide_Blank_Fields', sanitize_text_field($_POST['hide_blank_fields']));}
|
85 |
+
|
86 |
+
|
87 |
+
if (isset($_POST['posted_label'])) {update_option('EWD_UFAQ_Posted_Label', sanitize_text_field($_POST['posted_label']));}
|
88 |
+
if (isset($_POST['by_label'])) {update_option('EWD_UFAQ_By_Label', sanitize_text_field($_POST['by_label']));}
|
89 |
+
if (isset($_POST['on_label'])) {update_option('EWD_UFAQ_On_Label', sanitize_text_field($_POST['on_label']));}
|
90 |
+
if (isset($_POST['category_label'])) {update_option('EWD_UFAQ_Category_Label', sanitize_text_field($_POST['category_label']));}
|
91 |
+
if (isset($_POST['tag_label'])) {update_option('EWD_UFAQ_Tag_Label', sanitize_text_field($_POST['tag_label']));}
|
92 |
+
if (isset($_POST['enter_question_label'])) {update_option('EWD_UFAQ_Enter_Question_Label', sanitize_text_field($_POST['enter_question_label']));}
|
93 |
+
if (isset($_POST['search_label'])) {update_option('EWD_UFAQ_Search_Label', sanitize_text_field($_POST['search_label']));}
|
94 |
+
if (isset($_POST['permalink_label'])) {update_option('EWD_UFAQ_Permalink_Label', sanitize_text_field($_POST['permalink_label']));}
|
95 |
+
if (isset($_POST['back_to_top_label'])) {update_option('EWD_UFAQ_Back_To_Top_Label', sanitize_text_field($_POST['back_to_top_label']));}
|
96 |
+
if (isset($_POST['woocommerce_tab_label'])) {update_option('EWD_UFAQ_WooCommerce_Tab_Label', sanitize_text_field($_POST['woocommerce_tab_label']));}
|
97 |
+
|
98 |
+
if (isset($_POST['thank_you_submit_label'])) {update_option('EWD_UFAQ_Thank_You_Submit_Label', sanitize_text_field($_POST['thank_you_submit_label']));}
|
99 |
+
if (isset($_POST['submit_question_label'])) {update_option('EWD_UFAQ_Submit_Question_Label', sanitize_text_field($_POST['submit_question_label']));}
|
100 |
+
if (isset($_POST['please_fill_form_below_label'])) {update_option('EWD_UFAQ_Please_Fill_Form_Below_Label', sanitize_text_field($_POST['please_fill_form_below_label']));}
|
101 |
+
if (isset($_POST['send_question_label'])) {update_option('EWD_UFAQ_Send_Question_Label', sanitize_text_field($_POST['send_question_label']));}
|
102 |
+
if (isset($_POST['question_title_label'])) {update_option('EWD_UFAQ_Question_Title_Label', sanitize_text_field($_POST['question_title_label']));}
|
103 |
+
if (isset($_POST['what_question_being_answered_label'])) {update_option('EWD_UFAQ_What_Question_Being_Answered_Label', sanitize_text_field($_POST['what_question_being_answered_label']));}
|
104 |
+
if (isset($_POST['proposed_answer_label'])) {update_option('EWD_UFAQ_Proposed_Answer_Label', sanitize_text_field($_POST['proposed_answer_label']));}
|
105 |
+
if (isset($_POST['review_author_label'])) {update_option('EWD_UFAQ_Review_Author_Label', sanitize_text_field($_POST['review_author_label']));}
|
106 |
+
if (isset($_POST['what_name_with_review_label'])) {update_option('EWD_UFAQ_What_Name_With_Review_Label', sanitize_text_field($_POST['what_name_with_review_label']));}
|
107 |
+
if (isset($_POST['retrieving_results'])) {update_option('EWD_UFAQ_Retrieving_Results', sanitize_text_field($_POST['retrieving_results']));}
|
108 |
+
if (isset($_POST['no_results_found_text'])) {update_option('EWD_UFAQ_No_Results_Found_Text', sanitize_text_field($_POST['no_results_found_text']));}
|
109 |
+
|
110 |
+
if (isset($_POST['ufaq_styling_default_bg_color'])) {update_option('EWD_UFAQ_Styling_Default_Bg_Color', sanitize_text_field($_POST['ufaq_styling_default_bg_color']));}
|
111 |
+
if (isset($_POST['ufaq_styling_default_font_color'])) {update_option('EWD_UFAQ_Styling_Default_Font_Color', sanitize_text_field($_POST['ufaq_styling_default_font_color']));}
|
112 |
+
if (isset($_POST['ufaq_styling_default_border_size'])) {update_option('EWD_UFAQ_Styling_Default_Border_Size', sanitize_text_field($_POST['ufaq_styling_default_border_size']));}
|
113 |
+
if (isset($_POST['ufaq_styling_default_border_color'])) {update_option('EWD_UFAQ_Styling_Default_Border_Color', sanitize_text_field($_POST['ufaq_styling_default_border_color']));}
|
114 |
+
if (isset($_POST['ufaq_styling_default_border_radius'])) {update_option('EWD_UFAQ_Styling_Default_Border_Radius', sanitize_text_field($_POST['ufaq_styling_default_border_radius']));}
|
115 |
+
if (isset($_POST['ufaq_styling_toggle_symbol_size'])) {update_option('EWD_UFAQ_Styling_Toggle_Symbol_Size', sanitize_text_field($_POST['ufaq_styling_toggle_symbol_size']));}
|
116 |
+
if (isset($_POST['ufaq_styling_block_bg_color'])) {update_option('EWD_UFAQ_Styling_Block_Bg_Color', sanitize_text_field($_POST['ufaq_styling_block_bg_color']));}
|
117 |
+
if (isset($_POST['ufaq_styling_block_font_color'])) {update_option('EWD_UFAQ_Styling_Block_Font_Color', sanitize_text_field($_POST['ufaq_styling_block_font_color']));}
|
118 |
+
if (isset($_POST['ufaq_styling_list_font'])) {update_option('EWD_UFAQ_Styling_List_Font', sanitize_text_field($_POST['ufaq_styling_list_font']));}
|
119 |
+
if (isset($_POST['ufaq_styling_list_font_size'])) {update_option('EWD_UFAQ_Styling_List_Font_Size', sanitize_text_field($_POST['ufaq_styling_list_font_size']));}
|
120 |
+
if (isset($_POST['ufaq_styling_list_font_color'])) {update_option('EWD_UFAQ_Styling_List_Font_Color', sanitize_text_field($_POST['ufaq_styling_list_font_color']));}
|
121 |
+
if (isset($_POST['ufaq_styling_list_margin'])) {update_option('EWD_UFAQ_Styling_List_Margin', sanitize_text_field($_POST['ufaq_styling_list_margin']));}
|
122 |
+
if (isset($_POST['ufaq_styling_list_padding'])) {update_option('EWD_UFAQ_Styling_List_Padding', sanitize_text_field($_POST['ufaq_styling_list_padding']));}
|
123 |
+
|
124 |
+
if (isset($_POST['ufaq_styling_question_font'])) {update_option('EWD_UFAQ_Styling_Question_Font', sanitize_text_field($_POST['ufaq_styling_question_font']));}
|
125 |
+
if (isset($_POST['ufaq_styling_question_font_size'])) {update_option('EWD_UFAQ_Styling_Question_Font_Size', sanitize_text_field($_POST['ufaq_styling_question_font_size']));}
|
126 |
+
if (isset($_POST['ufaq_styling_question_font_color'])) {update_option('EWD_UFAQ_Styling_Question_Font_Color', sanitize_text_field($_POST['ufaq_styling_question_font_color']));}
|
127 |
+
if (isset($_POST['ufaq_styling_question_margin'])) {update_option('EWD_UFAQ_Styling_Question_Margin', sanitize_text_field($_POST['ufaq_styling_question_margin']));}
|
128 |
+
if (isset($_POST['ufaq_styling_question_padding'])) {update_option('EWD_UFAQ_Styling_Question_Padding', sanitize_text_field($_POST['ufaq_styling_question_padding']));}
|
129 |
+
if (isset($_POST['ufaq_styling_question_icon_top_margin'])) {update_option('EWD_UFAQ_Styling_Question_Icon_Top_Margin', sanitize_text_field($_POST['ufaq_styling_question_icon_top_margin']));}
|
130 |
+
if (isset($_POST['ufaq_styling_answer_font'])) {update_option('EWD_UFAQ_Styling_Answer_Font', sanitize_text_field($_POST['ufaq_styling_answer_font']));}
|
131 |
+
if (isset($_POST['ufaq_styling_answer_font_size'])) {update_option('EWD_UFAQ_Styling_Answer_Font_Size', sanitize_text_field($_POST['ufaq_styling_answer_font_size']));}
|
132 |
+
if (isset($_POST['ufaq_styling_answer_font_color'])) {update_option('EWD_UFAQ_Styling_Answer_Font_Color', sanitize_text_field($_POST['ufaq_styling_answer_font_color']));}
|
133 |
+
if (isset($_POST['ufaq_styling_answer_margin'])) {update_option('EWD_UFAQ_Styling_Answer_Margin', sanitize_text_field($_POST['ufaq_styling_answer_margin']));}
|
134 |
+
if (isset($_POST['ufaq_styling_answer_padding'])) {update_option('EWD_UFAQ_Styling_Answer_Padding', sanitize_text_field($_POST['ufaq_styling_answer_padding']));}
|
135 |
+
if (isset($_POST['ufaq_styling_postdate_font'])) {update_option('EWD_UFAQ_Styling_Postdate_Font', sanitize_text_field($_POST['ufaq_styling_postdate_font']));}
|
136 |
+
if (isset($_POST['ufaq_styling_postdate_font_size'])) {update_option('EWD_UFAQ_Styling_Postdate_Font_Size', sanitize_text_field($_POST['ufaq_styling_postdate_font_size']));}
|
137 |
+
if (isset($_POST['ufaq_styling_postdate_font_color'])) {update_option('EWD_UFAQ_Styling_Postdate_Font_Color', sanitize_text_field($_POST['ufaq_styling_postdate_font_color']));}
|
138 |
+
if (isset($_POST['ufaq_styling_postdate_margin'])) {update_option('EWD_UFAQ_Styling_Postdate_Margin', sanitize_text_field($_POST['ufaq_styling_postdate_margin']));}
|
139 |
+
if (isset($_POST['ufaq_styling_postdate_padding'])) {update_option('EWD_UFAQ_Styling_Postdate_Padding', sanitize_text_field($_POST['ufaq_styling_postdate_padding']));}
|
140 |
+
if (isset($_POST['ufaq_styling_category_font'])) {update_option('EWD_UFAQ_Styling_Category_Font', sanitize_text_field($_POST['ufaq_styling_category_font']));}
|
141 |
+
if (isset($_POST['ufaq_styling_category_font_size'])) {update_option('EWD_UFAQ_Styling_Category_Font_Size', sanitize_text_field($_POST['ufaq_styling_category_font_size']));}
|
142 |
+
if (isset($_POST['ufaq_styling_category_font_color'])) {update_option('EWD_UFAQ_Styling_Category_Font_Color', sanitize_text_field($_POST['ufaq_styling_category_font_color']));}
|
143 |
+
if (isset($_POST['ufaq_styling_category_margin'])) {update_option('EWD_UFAQ_Styling_Category_Margin', sanitize_text_field($_POST['ufaq_styling_category_margin']));}
|
144 |
+
if (isset($_POST['ufaq_styling_category_padding'])) {update_option('EWD_UFAQ_Styling_Category_Padding', sanitize_text_field($_POST['ufaq_styling_category_padding']));}
|
145 |
+
|
146 |
+
if (isset($_POST['ufaq_styling_category_heading_type'])) {update_option('EWD_UFAQ_Styling_Category_Heading_Type', sanitize_text_field($_POST['ufaq_styling_category_heading_type']));}
|
147 |
+
if (isset($_POST['ufaq_styling_faq_heading_type'])) {update_option('EWD_UFAQ_Styling_FAQ_Heading_Type', sanitize_text_field($_POST['ufaq_styling_faq_heading_type']));}
|
148 |
+
if (isset($_POST['toggle_symbol'])) {update_option('EWD_UFAQ_Toggle_Symbol', sanitize_text_field($_POST['toggle_symbol']));}
|
|
|
|
|
149 |
|
150 |
if (isset($_POST['Pretty_Permalinks']) and $_POST['Pretty_Permalinks'] == "Yes") {
|
151 |
update_option("EWD_UFAQ_Rewrite_Rules", "Yes");
|
152 |
}
|
153 |
}
|
154 |
|
155 |
+
function EWD_UFAQ_Validate_CSS($CSS) {
|
156 |
+
require_once( EWD_UFAQ_CD_PLUGIN_PATH . 'css/CSSTidy/class.csstidy.php' );
|
157 |
+
|
158 |
+
$CSSTidy = new csstidy();
|
159 |
+
|
160 |
+
$CSSTidy->set_cfg( 'remove_bslash', false );
|
161 |
+
$CSSTidy->set_cfg( 'compress_colors', false );
|
162 |
+
$CSSTidy->set_cfg( 'compress_font-weight', false );
|
163 |
+
$CSSTidy->set_cfg( 'optimise_shorthands', 0 );
|
164 |
+
$CSSTidy->set_cfg( 'remove_last_;', false );
|
165 |
+
$CSSTidy->set_cfg( 'case_properties', false );
|
166 |
+
$CSSTidy->set_cfg( 'discard_invalid_properties', false );
|
167 |
+
$CSSTidy->set_cfg( 'css_level', 'CSS3.0' );
|
168 |
+
$CSSTidy->set_cfg( 'preserve_css', true );
|
169 |
+
|
170 |
+
$CSS = preg_replace( '/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $CSS );
|
171 |
+
|
172 |
+
$CSS = str_replace( '<=', '<=', $CSS );
|
173 |
+
$CSS = wp_kses_split($CSS, array(), array());
|
174 |
+
$CSS = str_replace( '>', '>', $CSS );
|
175 |
+
$CSS = strip_tags( $CSS );
|
176 |
+
|
177 |
+
$CSSTidy->parse( $CSS );
|
178 |
+
return $CSSTidy->print->plain();
|
179 |
+
}
|
180 |
?>
|
Main.php
CHANGED
@@ -7,14 +7,14 @@ Author: Etoile Web Design
|
|
7 |
Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
|
8 |
Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
|
9 |
Text Domain: ultimate-faqs
|
10 |
-
Version: 1.6.
|
11 |
*/
|
12 |
|
13 |
global $ewd_ufaq_message;
|
14 |
global $UFAQ_Full_Version;
|
15 |
global $EWD_UFAQ_Version;
|
16 |
|
17 |
-
$EWD_UFAQ_Version = '1.
|
18 |
if (get_option("EWD_UFAQ_Version") == "") {update_option("EWD_UFAQ_Version", $EWD_UFAQ_Version);}
|
19 |
|
20 |
define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
|
@@ -139,7 +139,9 @@ function EWD_UFAQ_Admin_Options() {
|
|
139 |
|
140 |
add_action( 'wp_enqueue_scripts', 'Add_EWD_UFAQ_FrontEnd_Scripts' );
|
141 |
function Add_EWD_UFAQ_FrontEnd_Scripts() {
|
142 |
-
|
|
|
|
|
143 |
|
144 |
$Retrieving_Results = get_option("EWD_UFAQ_Retrieving_Results");
|
145 |
if ($Retrieving_Results == "") {$Retrieving_Results = __("Retrieving Results", 'ultimate-faqs') . "...";}
|
7 |
Author URI: http://www.EtoileWebDesign.com/wordpress-plugins/
|
8 |
Terms and Conditions: http://www.etoilewebdesign.com/plugin-terms-and-conditions/
|
9 |
Text Domain: ultimate-faqs
|
10 |
+
Version: 1.6.4
|
11 |
*/
|
12 |
|
13 |
global $ewd_ufaq_message;
|
14 |
global $UFAQ_Full_Version;
|
15 |
global $EWD_UFAQ_Version;
|
16 |
|
17 |
+
$EWD_UFAQ_Version = '1.6.4';
|
18 |
if (get_option("EWD_UFAQ_Version") == "") {update_option("EWD_UFAQ_Version", $EWD_UFAQ_Version);}
|
19 |
|
20 |
define( 'EWD_UFAQ_CD_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
|
139 |
|
140 |
add_action( 'wp_enqueue_scripts', 'Add_EWD_UFAQ_FrontEnd_Scripts' );
|
141 |
function Add_EWD_UFAQ_FrontEnd_Scripts() {
|
142 |
+
global $EWD_UFAQ_Version;
|
143 |
+
|
144 |
+
wp_register_script('ewd-ufaq-js', plugins_url( '/js/ewd-ufaq-js.js' , __FILE__ ), array( 'jquery' ), $EWD_UFAQ_Version);
|
145 |
|
146 |
$Retrieving_Results = get_option("EWD_UFAQ_Retrieving_Results");
|
147 |
if ($Retrieving_Results == "") {$Retrieving_Results = __("Retrieving Results", 'ultimate-faqs') . "...";}
|
css/CSSTidy/class.csstidy.php
ADDED
@@ -0,0 +1,999 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CSSTidy - CSS Parser and Optimiser
|
4 |
+
*
|
5 |
+
* CSS Parser class
|
6 |
+
*
|
7 |
+
* This file is part of CSSTidy.
|
8 |
+
*
|
9 |
+
* CSSTidy is free software; you can redistribute it and/or modify
|
10 |
+
* it under the terms of the GNU General Public License as published by
|
11 |
+
* the Free Software Foundation; either version 2 of the License, or
|
12 |
+
* (at your option) any later version.
|
13 |
+
*
|
14 |
+
* CSSTidy is distributed in the hope that it will be useful,
|
15 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
+
* GNU General Public License for more details.
|
18 |
+
*
|
19 |
+
* You should have received a copy of the GNU General Public License
|
20 |
+
* along with CSSTidy; if not, write to the Free Software
|
21 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
22 |
+
*
|
23 |
+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
24 |
+
* @package csstidy
|
25 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
26 |
+
*/
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Various CSS data needed for correct optimisations etc.
|
30 |
+
*
|
31 |
+
* @version 1.3
|
32 |
+
*/
|
33 |
+
require('data.inc.php');
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Contains a class for printing CSS code
|
37 |
+
*
|
38 |
+
* @version 1.0
|
39 |
+
*/
|
40 |
+
require('class.csstidy_print.php');
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Contains a class for optimising CSS code
|
44 |
+
*
|
45 |
+
* @version 1.0
|
46 |
+
*/
|
47 |
+
require('class.csstidy_optimise.php');
|
48 |
+
|
49 |
+
/**
|
50 |
+
* CSS Parser class
|
51 |
+
*
|
52 |
+
* This class represents a CSS parser which reads CSS code and saves it in an array.
|
53 |
+
* In opposite to most other CSS parsers, it does not use regular expressions and
|
54 |
+
* thus has full CSS2 support and a higher reliability.
|
55 |
+
* Additional to that it applies some optimisations and fixes to the CSS code.
|
56 |
+
* An online version should be available here: http://cdburnerxp.se/cssparse/css_optimiser.php
|
57 |
+
* @package csstidy
|
58 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
59 |
+
* @version 1.3
|
60 |
+
*/
|
61 |
+
class csstidy {
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Saves the parsed CSS
|
65 |
+
* @var array
|
66 |
+
* @access public
|
67 |
+
*/
|
68 |
+
var $css = array();
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Saves the parsed CSS (raw)
|
72 |
+
* @var array
|
73 |
+
* @access private
|
74 |
+
*/
|
75 |
+
var $tokens = array();
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Printer class
|
79 |
+
* @see csstidy_print
|
80 |
+
* @var object
|
81 |
+
* @access public
|
82 |
+
*/
|
83 |
+
var $print;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Optimiser class
|
87 |
+
* @see csstidy_optimise
|
88 |
+
* @var object
|
89 |
+
* @access private
|
90 |
+
*/
|
91 |
+
var $optimise;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Saves the CSS charset (@charset)
|
95 |
+
* @var string
|
96 |
+
* @access private
|
97 |
+
*/
|
98 |
+
var $charset = '';
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Saves all @import URLs
|
102 |
+
* @var array
|
103 |
+
* @access private
|
104 |
+
*/
|
105 |
+
var $import = array();
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Saves the namespace
|
109 |
+
* @var string
|
110 |
+
* @access private
|
111 |
+
*/
|
112 |
+
var $namespace = '';
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Contains the version of csstidy
|
116 |
+
* @var string
|
117 |
+
* @access private
|
118 |
+
*/
|
119 |
+
var $version = '1.3';
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Stores the settings
|
123 |
+
* @var array
|
124 |
+
* @access private
|
125 |
+
*/
|
126 |
+
var $settings = array();
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Saves the parser-status.
|
130 |
+
*
|
131 |
+
* Possible values:
|
132 |
+
* - is = in selector
|
133 |
+
* - ip = in property
|
134 |
+
* - iv = in value
|
135 |
+
* - instr = in string (started at " or ' or ( )
|
136 |
+
* - ic = in comment (ignore everything)
|
137 |
+
* - at = in @-block
|
138 |
+
*
|
139 |
+
* @var string
|
140 |
+
* @access private
|
141 |
+
*/
|
142 |
+
var $status = 'is';
|
143 |
+
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Saves the current at rule (@media)
|
147 |
+
* @var string
|
148 |
+
* @access private
|
149 |
+
*/
|
150 |
+
var $at = '';
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Saves the current selector
|
154 |
+
* @var string
|
155 |
+
* @access private
|
156 |
+
*/
|
157 |
+
var $selector = '';
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Saves the current property
|
161 |
+
* @var string
|
162 |
+
* @access private
|
163 |
+
*/
|
164 |
+
var $property = '';
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Saves the position of , in selectors
|
168 |
+
* @var array
|
169 |
+
* @access private
|
170 |
+
*/
|
171 |
+
var $sel_separate = array();
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Saves the current value
|
175 |
+
* @var string
|
176 |
+
* @access private
|
177 |
+
*/
|
178 |
+
var $value = '';
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Saves the current sub-value
|
182 |
+
*
|
183 |
+
* Example for a subvalue:
|
184 |
+
* background:url(foo.png) red no-repeat;
|
185 |
+
* "url(foo.png)", "red", and "no-repeat" are subvalues,
|
186 |
+
* seperated by whitespace
|
187 |
+
* @var string
|
188 |
+
* @access private
|
189 |
+
*/
|
190 |
+
var $sub_value = '';
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Array which saves all subvalues for a property.
|
194 |
+
* @var array
|
195 |
+
* @see sub_value
|
196 |
+
* @access private
|
197 |
+
*/
|
198 |
+
var $sub_value_arr = array();
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Saves the char which opened the last string
|
202 |
+
* @var string
|
203 |
+
* @access private
|
204 |
+
*/
|
205 |
+
var $str_char = '';
|
206 |
+
var $cur_string = '';
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Status from which the parser switched to ic or instr
|
210 |
+
* @var string
|
211 |
+
* @access private
|
212 |
+
*/
|
213 |
+
var $from = '';
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Variable needed to manage string-in-strings, for example url("foo.png")
|
217 |
+
* @var string
|
218 |
+
* @access private
|
219 |
+
*/
|
220 |
+
var $str_in_str = false;
|
221 |
+
|
222 |
+
/**
|
223 |
+
* =true if in invalid at-rule
|
224 |
+
* @var bool
|
225 |
+
* @access private
|
226 |
+
*/
|
227 |
+
var $invalid_at = false;
|
228 |
+
|
229 |
+
/**
|
230 |
+
* =true if something has been added to the current selector
|
231 |
+
* @var bool
|
232 |
+
* @access private
|
233 |
+
*/
|
234 |
+
var $added = false;
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Array which saves the message log
|
238 |
+
* @var array
|
239 |
+
* @access private
|
240 |
+
*/
|
241 |
+
var $log = array();
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Saves the line number
|
245 |
+
* @var integer
|
246 |
+
* @access private
|
247 |
+
*/
|
248 |
+
var $line = 1;
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Loads standard template and sets default settings
|
252 |
+
* @access private
|
253 |
+
* @version 1.3
|
254 |
+
*/
|
255 |
+
function csstidy()
|
256 |
+
{
|
257 |
+
$this->settings['remove_bslash'] = true;
|
258 |
+
$this->settings['compress_colors'] = true;
|
259 |
+
$this->settings['compress_font-weight'] = true;
|
260 |
+
$this->settings['lowercase_s'] = false;
|
261 |
+
$this->settings['optimise_shorthands'] = 1;
|
262 |
+
$this->settings['remove_last_;'] = false;
|
263 |
+
$this->settings['case_properties'] = 1;
|
264 |
+
$this->settings['sort_properties'] = false;
|
265 |
+
$this->settings['sort_selectors'] = false;
|
266 |
+
$this->settings['merge_selectors'] = 2;
|
267 |
+
$this->settings['discard_invalid_properties'] = false;
|
268 |
+
$this->settings['css_level'] = 'CSS2.1';
|
269 |
+
$this->settings['preserve_css'] = false;
|
270 |
+
$this->settings['timestamp'] = false;
|
271 |
+
|
272 |
+
$this->load_template('default');
|
273 |
+
$this->print = new csstidy_print($this);
|
274 |
+
$this->optimise = new csstidy_optimise($this);
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Get the value of a setting.
|
279 |
+
* @param string $setting
|
280 |
+
* @access public
|
281 |
+
* @return mixed
|
282 |
+
* @version 1.0
|
283 |
+
*/
|
284 |
+
function get_cfg($setting)
|
285 |
+
{
|
286 |
+
if(isset($this->settings[$setting]))
|
287 |
+
{
|
288 |
+
return $this->settings[$setting];
|
289 |
+
}
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Set the value of a setting.
|
295 |
+
* @param string $setting
|
296 |
+
* @param mixed $value
|
297 |
+
* @access public
|
298 |
+
* @return bool
|
299 |
+
* @version 1.0
|
300 |
+
*/
|
301 |
+
function set_cfg($setting,$value)
|
302 |
+
{
|
303 |
+
if(isset($this->settings[$setting]) && $value !== '')
|
304 |
+
{
|
305 |
+
$this->settings[$setting] = $value;
|
306 |
+
return true;
|
307 |
+
}
|
308 |
+
return false;
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Adds a token to $this->tokens
|
313 |
+
* @param mixed $type
|
314 |
+
* @param string $data
|
315 |
+
* @param bool $do add a token even if preserve_css is off
|
316 |
+
* @access private
|
317 |
+
* @version 1.0
|
318 |
+
*/
|
319 |
+
function _add_token($type, $data, $do = false) {
|
320 |
+
if($this->get_cfg('preserve_css') || $do) {
|
321 |
+
$this->tokens[] = array($type, ($type == COMMENT) ? $data : trim($data));
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Add a message to the message log
|
327 |
+
* @param string $message
|
328 |
+
* @param string $type
|
329 |
+
* @param integer $line
|
330 |
+
* @access private
|
331 |
+
* @version 1.0
|
332 |
+
*/
|
333 |
+
function log($message,$type,$line = -1)
|
334 |
+
{
|
335 |
+
if($line === -1)
|
336 |
+
{
|
337 |
+
$line = $this->line;
|
338 |
+
}
|
339 |
+
$line = intval($line);
|
340 |
+
$add = array('m' => $message, 't' => $type);
|
341 |
+
if(!isset($this->log[$line]) || !in_array($add,$this->log[$line]))
|
342 |
+
{
|
343 |
+
$this->log[$line][] = $add;
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Parse unicode notations and find a replacement character
|
349 |
+
* @param string $string
|
350 |
+
* @param integer $i
|
351 |
+
* @access private
|
352 |
+
* @return string
|
353 |
+
* @version 1.2
|
354 |
+
*/
|
355 |
+
function _unicode(&$string, &$i)
|
356 |
+
{
|
357 |
+
++$i;
|
358 |
+
$add = '';
|
359 |
+
$tokens =& $GLOBALS['csstidy']['tokens'];
|
360 |
+
$replaced = false;
|
361 |
+
|
362 |
+
while($i < strlen($string) && (ctype_xdigit($string{$i}) || ctype_space($string{$i})) && strlen($add) < 6)
|
363 |
+
{
|
364 |
+
$add .= $string{$i};
|
365 |
+
|
366 |
+
if(ctype_space($string{$i})) {
|
367 |
+
break;
|
368 |
+
}
|
369 |
+
$i++;
|
370 |
+
}
|
371 |
+
|
372 |
+
if(hexdec($add) > 47 && hexdec($add) < 58 || hexdec($add) > 64 && hexdec($add) < 91 || hexdec($add) > 96 && hexdec($add) < 123)
|
373 |
+
{
|
374 |
+
$this->log('Replaced unicode notation: Changed \\'. $add .' to ' . chr(hexdec($add)),'Information');
|
375 |
+
$add = chr(hexdec($add));
|
376 |
+
$replaced = true;
|
377 |
+
}
|
378 |
+
else {
|
379 |
+
$add = trim('\\'.$add);
|
380 |
+
}
|
381 |
+
|
382 |
+
if(@ctype_xdigit($string{$i+1}) && ctype_space($string{$i})
|
383 |
+
&& !$replaced || !ctype_space($string{$i})) {
|
384 |
+
$i--;
|
385 |
+
}
|
386 |
+
|
387 |
+
if($add != '\\' || !$this->get_cfg('remove_bslash') || strpos($tokens, $string{$i+1}) !== false) {
|
388 |
+
return $add;
|
389 |
+
}
|
390 |
+
|
391 |
+
if($add == '\\') {
|
392 |
+
$this->log('Removed unnecessary backslash','Information');
|
393 |
+
}
|
394 |
+
return '';
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Loads a new template
|
399 |
+
* @param string $content either filename (if $from_file == true), content of a template file, "high_compression", "highest_compression", "low_compression", or "default"
|
400 |
+
* @param bool $from_file uses $content as filename if true
|
401 |
+
* @access public
|
402 |
+
* @version 1.1
|
403 |
+
* @see http://csstidy.sourceforge.net/templates.php
|
404 |
+
*/
|
405 |
+
function load_template($content, $from_file=true)
|
406 |
+
{
|
407 |
+
$predefined_templates =& $GLOBALS['csstidy']['predefined_templates'];
|
408 |
+
if($content == 'high_compression' || $content == 'default' || $content == 'highest_compression' || $content == 'low_compression')
|
409 |
+
{
|
410 |
+
$this->template = $predefined_templates[$content];
|
411 |
+
return;
|
412 |
+
}
|
413 |
+
|
414 |
+
if($from_file)
|
415 |
+
{
|
416 |
+
$content = strip_tags(file_get_contents($content),'<span>');
|
417 |
+
}
|
418 |
+
$content = str_replace("\r\n","\n",$content); // Unify newlines (because the output also only uses \n)
|
419 |
+
$template = explode('|',$content);
|
420 |
+
|
421 |
+
for ($i = 0; $i < count($template); $i++ )
|
422 |
+
{
|
423 |
+
$this->template[$i] = $template[$i];
|
424 |
+
}
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Starts parsing from URL
|
429 |
+
* @param string $url
|
430 |
+
* @access public
|
431 |
+
* @version 1.0
|
432 |
+
*/
|
433 |
+
function parse_from_url($url)
|
434 |
+
{
|
435 |
+
return $this->parse(@file_get_contents($url));
|
436 |
+
}
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Checks if there is a token at the current position
|
440 |
+
* @param string $string
|
441 |
+
* @param integer $i
|
442 |
+
* @access public
|
443 |
+
* @version 1.11
|
444 |
+
*/
|
445 |
+
function is_token(&$string, $i)
|
446 |
+
{
|
447 |
+
$tokens =& $GLOBALS['csstidy']['tokens'];
|
448 |
+
return (strpos($tokens, $string{$i}) !== false && !csstidy::escaped($string,$i));
|
449 |
+
}
|
450 |
+
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Parses CSS in $string. The code is saved as array in $this->css
|
454 |
+
* @param string $string the CSS code
|
455 |
+
* @access public
|
456 |
+
* @return bool
|
457 |
+
* @version 1.1
|
458 |
+
*/
|
459 |
+
function parse($string) {
|
460 |
+
// PHP bug? Settings need to be refreshed in PHP4
|
461 |
+
$this->print = new csstidy_print($this);
|
462 |
+
$this->optimise = new csstidy_optimise($this);
|
463 |
+
|
464 |
+
$all_properties =& $GLOBALS['csstidy']['all_properties'];
|
465 |
+
$at_rules =& $GLOBALS['csstidy']['at_rules'];
|
466 |
+
|
467 |
+
$this->css = array();
|
468 |
+
$this->print->input_css = $string;
|
469 |
+
$string = str_replace("\r\n","\n",$string) . ' ';
|
470 |
+
$cur_comment = '';
|
471 |
+
|
472 |
+
for ($i = 0, $size = strlen($string); $i < $size; $i++ )
|
473 |
+
{
|
474 |
+
if($string{$i} == "\n" || $string{$i} == "\r")
|
475 |
+
{
|
476 |
+
++$this->line;
|
477 |
+
}
|
478 |
+
|
479 |
+
switch($this->status)
|
480 |
+
{
|
481 |
+
/* Case in at-block */
|
482 |
+
case 'at':
|
483 |
+
if(csstidy::is_token($string,$i))
|
484 |
+
{
|
485 |
+
if($string{$i} == '/' && @$string{$i+1} == '*')
|
486 |
+
{
|
487 |
+
$this->status = 'ic'; ++$i;
|
488 |
+
$this->from = 'at';
|
489 |
+
}
|
490 |
+
elseif($string{$i} == '{')
|
491 |
+
{
|
492 |
+
$this->status = 'is';
|
493 |
+
$this->_add_token(AT_START, $this->at);
|
494 |
+
}
|
495 |
+
elseif($string{$i} == ',')
|
496 |
+
{
|
497 |
+
$this->at = trim($this->at).',';
|
498 |
+
}
|
499 |
+
elseif($string{$i} == '\\')
|
500 |
+
{
|
501 |
+
$this->at .= $this->_unicode($string,$i);
|
502 |
+
}
|
503 |
+
}
|
504 |
+
else
|
505 |
+
{
|
506 |
+
$lastpos = strlen($this->at)-1;
|
507 |
+
if(!( (ctype_space($this->at{$lastpos}) || csstidy::is_token($this->at,$lastpos) && $this->at{$lastpos} == ',') && ctype_space($string{$i})))
|
508 |
+
{
|
509 |
+
$this->at .= $string{$i};
|
510 |
+
}
|
511 |
+
}
|
512 |
+
break;
|
513 |
+
|
514 |
+
/* Case in-selector */
|
515 |
+
case 'is':
|
516 |
+
if(csstidy::is_token($string,$i))
|
517 |
+
{
|
518 |
+
if($string{$i} == '/' && @$string{$i+1} == '*' && trim($this->selector) == '')
|
519 |
+
{
|
520 |
+
$this->status = 'ic'; ++$i;
|
521 |
+
$this->from = 'is';
|
522 |
+
}
|
523 |
+
elseif($string{$i} == '@' && trim($this->selector) == '')
|
524 |
+
{
|
525 |
+
// Check for at-rule
|
526 |
+
$this->invalid_at = true;
|
527 |
+
foreach($at_rules as $name => $type)
|
528 |
+
{
|
529 |
+
if(!strcasecmp(substr($string,$i+1,strlen($name)),$name))
|
530 |
+
{
|
531 |
+
($type == 'at') ? $this->at = '@'.$name : $this->selector = '@'.$name;
|
532 |
+
$this->status = $type;
|
533 |
+
$i += strlen($name);
|
534 |
+
$this->invalid_at = false;
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
if($this->invalid_at)
|
539 |
+
{
|
540 |
+
$this->selector = '@';
|
541 |
+
$invalid_at_name = '';
|
542 |
+
for($j = $i+1; $j < $size; ++$j)
|
543 |
+
{
|
544 |
+
if(!ctype_alpha($string{$j}))
|
545 |
+
{
|
546 |
+
break;
|
547 |
+
}
|
548 |
+
$invalid_at_name .= $string{$j};
|
549 |
+
}
|
550 |
+
$this->log('Invalid @-rule: '.$invalid_at_name.' (removed)','Warning');
|
551 |
+
}
|
552 |
+
}
|
553 |
+
elseif(($string{$i} == '"' || $string{$i} == "'"))
|
554 |
+
{
|
555 |
+
$this->cur_string = $string{$i};
|
556 |
+
$this->status = 'instr';
|
557 |
+
$this->str_char = $string{$i};
|
558 |
+
$this->from = 'is';
|
559 |
+
}
|
560 |
+
elseif($this->invalid_at && $string{$i} == ';')
|
561 |
+
{
|
562 |
+
$this->invalid_at = false;
|
563 |
+
$this->status = 'is';
|
564 |
+
}
|
565 |
+
elseif($string{$i} == '{')
|
566 |
+
{
|
567 |
+
$this->status = 'ip';
|
568 |
+
$this->_add_token(SEL_START, $this->selector);
|
569 |
+
$this->added = false;
|
570 |
+
}
|
571 |
+
elseif($string{$i} == '}')
|
572 |
+
{
|
573 |
+
$this->_add_token(AT_END, $this->at);
|
574 |
+
$this->at = '';
|
575 |
+
$this->selector = '';
|
576 |
+
$this->sel_separate = array();
|
577 |
+
}
|
578 |
+
elseif($string{$i} == ',')
|
579 |
+
{
|
580 |
+
$this->selector = trim($this->selector).',';
|
581 |
+
$this->sel_separate[] = strlen($this->selector);
|
582 |
+
}
|
583 |
+
elseif($string{$i} == '\\')
|
584 |
+
{
|
585 |
+
$this->selector .= $this->_unicode($string,$i);
|
586 |
+
}
|
587 |
+
// remove unnecessary universal selector, FS#147
|
588 |
+
else if(!($string{$i} == '*' && @in_array($string{$i+1}, array('.', '#', '[', ':')))) {
|
589 |
+
$this->selector .= $string{$i};
|
590 |
+
}
|
591 |
+
}
|
592 |
+
else
|
593 |
+
{
|
594 |
+
$lastpos = strlen($this->selector)-1;
|
595 |
+
if($lastpos == -1 || !( (ctype_space($this->selector{$lastpos}) || csstidy::is_token($this->selector,$lastpos) && $this->selector{$lastpos} == ',') && ctype_space($string{$i})))
|
596 |
+
{
|
597 |
+
$this->selector .= $string{$i};
|
598 |
+
}
|
599 |
+
}
|
600 |
+
break;
|
601 |
+
|
602 |
+
/* Case in-property */
|
603 |
+
case 'ip':
|
604 |
+
if(csstidy::is_token($string,$i))
|
605 |
+
{
|
606 |
+
if(($string{$i} == ':' || $string{$i} == '=') && $this->property != '')
|
607 |
+
{
|
608 |
+
$this->status = 'iv';
|
609 |
+
if(!$this->get_cfg('discard_invalid_properties') || csstidy::property_is_valid($this->property)) {
|
610 |
+
$this->_add_token(PROPERTY, $this->property);
|
611 |
+
}
|
612 |
+
}
|
613 |
+
elseif($string{$i} == '/' && @$string{$i+1} == '*' && $this->property == '')
|
614 |
+
{
|
615 |
+
$this->status = 'ic'; ++$i;
|
616 |
+
$this->from = 'ip';
|
617 |
+
}
|
618 |
+
elseif($string{$i} == '}')
|
619 |
+
{
|
620 |
+
$this->explode_selectors();
|
621 |
+
$this->status = 'is';
|
622 |
+
$this->invalid_at = false;
|
623 |
+
$this->_add_token(SEL_END, $this->selector);
|
624 |
+
$this->selector = '';
|
625 |
+
$this->property = '';
|
626 |
+
}
|
627 |
+
elseif($string{$i} == ';')
|
628 |
+
{
|
629 |
+
$this->property = '';
|
630 |
+
}
|
631 |
+
elseif($string{$i} == '\\')
|
632 |
+
{
|
633 |
+
$this->property .= $this->_unicode($string,$i);
|
634 |
+
}
|
635 |
+
}
|
636 |
+
elseif(!ctype_space($string{$i}))
|
637 |
+
{
|
638 |
+
$this->property .= $string{$i};
|
639 |
+
}
|
640 |
+
break;
|
641 |
+
|
642 |
+
/* Case in-value */
|
643 |
+
case 'iv':
|
644 |
+
$pn = (($string{$i} == "\n" || $string{$i} == "\r") && $this->property_is_next($string,$i+1) || $i == strlen($string)-1);
|
645 |
+
if(csstidy::is_token($string,$i) || $pn)
|
646 |
+
{
|
647 |
+
if($string{$i} == '/' && @$string{$i+1} == '*')
|
648 |
+
{
|
649 |
+
$this->status = 'ic'; ++$i;
|
650 |
+
$this->from = 'iv';
|
651 |
+
}
|
652 |
+
elseif(($string{$i} == '"' || $string{$i} == "'" || $string{$i} == '('))
|
653 |
+
{
|
654 |
+
$this->cur_string = $string{$i};
|
655 |
+
$this->str_char = ($string{$i} == '(') ? ')' : $string{$i};
|
656 |
+
$this->status = 'instr';
|
657 |
+
$this->from = 'iv';
|
658 |
+
}
|
659 |
+
elseif($string{$i} == ',')
|
660 |
+
{
|
661 |
+
$this->sub_value = trim($this->sub_value).',';
|
662 |
+
}
|
663 |
+
elseif($string{$i} == '\\')
|
664 |
+
{
|
665 |
+
$this->sub_value .= $this->_unicode($string,$i);
|
666 |
+
}
|
667 |
+
elseif($string{$i} == ';' || $pn)
|
668 |
+
{
|
669 |
+
if($this->selector{0} == '@' && isset($at_rules[substr($this->selector,1)]) && $at_rules[substr($this->selector,1)] == 'iv')
|
670 |
+
{
|
671 |
+
$this->sub_value_arr[] = trim($this->sub_value);
|
672 |
+
|
673 |
+
$this->status = 'is';
|
674 |
+
|
675 |
+
switch($this->selector)
|
676 |
+
{
|
677 |
+
case '@charset': $this->charset = $this->sub_value_arr[0]; break;
|
678 |
+
case '@namespace': $this->namespace = implode(' ',$this->sub_value_arr); break;
|
679 |
+
case '@import': $this->import[] = implode(' ',$this->sub_value_arr); break;
|
680 |
+
}
|
681 |
+
|
682 |
+
$this->sub_value_arr = array();
|
683 |
+
$this->sub_value = '';
|
684 |
+
$this->selector = '';
|
685 |
+
$this->sel_separate = array();
|
686 |
+
}
|
687 |
+
else
|
688 |
+
{
|
689 |
+
$this->status = 'ip';
|
690 |
+
}
|
691 |
+
}
|
692 |
+
elseif($string{$i} != '}')
|
693 |
+
{
|
694 |
+
$this->sub_value .= $string{$i};
|
695 |
+
}
|
696 |
+
if(($string{$i} == '}' || $string{$i} == ';' || $pn) && !empty($this->selector))
|
697 |
+
{
|
698 |
+
if($this->at == '')
|
699 |
+
{
|
700 |
+
$this->at = DEFAULT_AT;
|
701 |
+
}
|
702 |
+
|
703 |
+
// case settings
|
704 |
+
if($this->get_cfg('lowercase_s'))
|
705 |
+
{
|
706 |
+
$this->selector = strtolower($this->selector);
|
707 |
+
}
|
708 |
+
$this->property = strtolower($this->property);
|
709 |
+
|
710 |
+
$this->optimise->subvalue();
|
711 |
+
if($this->sub_value != '') {
|
712 |
+
$this->sub_value_arr[] = $this->sub_value;
|
713 |
+
$this->sub_value = '';
|
714 |
+
}
|
715 |
+
|
716 |
+
$this->value = implode(' ',$this->sub_value_arr);
|
717 |
+
|
718 |
+
$this->selector = trim($this->selector);
|
719 |
+
|
720 |
+
$this->optimise->value();
|
721 |
+
|
722 |
+
$valid = csstidy::property_is_valid($this->property);
|
723 |
+
if((!$this->invalid_at || $this->get_cfg('preserve_css')) && (!$this->get_cfg('discard_invalid_properties') || $valid))
|
724 |
+
{
|
725 |
+
$this->css_add_property($this->at,$this->selector,$this->property,$this->value);
|
726 |
+
$this->_add_token(VALUE, $this->value);
|
727 |
+
$this->optimise->shorthands();
|
728 |
+
}
|
729 |
+
if(!$valid)
|
730 |
+
{
|
731 |
+
if($this->get_cfg('discard_invalid_properties'))
|
732 |
+
{
|
733 |
+
$this->log('Removed invalid property: '.$this->property,'Warning');
|
734 |
+
}
|
735 |
+
else
|
736 |
+
{
|
737 |
+
$this->log('Invalid property in '.strtoupper($this->get_cfg('css_level')).': '.$this->property,'Warning');
|
738 |
+
}
|
739 |
+
}
|
740 |
+
|
741 |
+
$this->property = '';
|
742 |
+
$this->sub_value_arr = array();
|
743 |
+
$this->value = '';
|
744 |
+
}
|
745 |
+
if($string{$i} == '}')
|
746 |
+
{
|
747 |
+
$this->explode_selectors();
|
748 |
+
$this->_add_token(SEL_END, $this->selector);
|
749 |
+
$this->status = 'is';
|
750 |
+
$this->invalid_at = false;
|
751 |
+
$this->selector = '';
|
752 |
+
}
|
753 |
+
}
|
754 |
+
elseif(!$pn)
|
755 |
+
{
|
756 |
+
$this->sub_value .= $string{$i};
|
757 |
+
|
758 |
+
if(ctype_space($string{$i}))
|
759 |
+
{
|
760 |
+
$this->optimise->subvalue();
|
761 |
+
if($this->sub_value != '') {
|
762 |
+
$this->sub_value_arr[] = $this->sub_value;
|
763 |
+
$this->sub_value = '';
|
764 |
+
}
|
765 |
+
}
|
766 |
+
}
|
767 |
+
break;
|
768 |
+
|
769 |
+
/* Case in string */
|
770 |
+
case 'instr':
|
771 |
+
if($this->str_char == ')' && ($string{$i} == '"' || $string{$i} == '\'') && !$this->str_in_str && !csstidy::escaped($string,$i))
|
772 |
+
{
|
773 |
+
$this->str_in_str = true;
|
774 |
+
}
|
775 |
+
elseif($this->str_char == ')' && ($string{$i} == '"' || $string{$i} == '\'') && $this->str_in_str && !csstidy::escaped($string,$i))
|
776 |
+
{
|
777 |
+
$this->str_in_str = false;
|
778 |
+
}
|
779 |
+
$temp_add = $string{$i}; // ...and no not-escaped backslash at the previous position
|
780 |
+
if( ($string{$i} == "\n" || $string{$i} == "\r") && !($string{$i-1} == '\\' && !csstidy::escaped($string,$i-1)) )
|
781 |
+
{
|
782 |
+
$temp_add = "\\A ";
|
783 |
+
$this->log('Fixed incorrect newline in string','Warning');
|
784 |
+
}
|
785 |
+
if (!($this->str_char == ')' && in_array($string{$i}, $GLOBALS['csstidy']['whitespace']) && !$this->str_in_str)) {
|
786 |
+
$this->cur_string .= $temp_add;
|
787 |
+
}
|
788 |
+
if($string{$i} == $this->str_char && !csstidy::escaped($string,$i) && !$this->str_in_str)
|
789 |
+
{
|
790 |
+
$this->status = $this->from;
|
791 |
+
if (!preg_match('|[' . implode('', $GLOBALS['csstidy']['whitespace']) . ']|uis', $this->cur_string) && $this->property != 'content') {
|
792 |
+
if ($this->str_char == '"' || $this->str_char == '\'') {
|
793 |
+
$this->cur_string = substr($this->cur_string, 1, -1);
|
794 |
+
} else if (strlen($this->cur_string) > 3 && ($this->cur_string[1] == '"' || $this->cur_string[1] == '\'')) /* () */ {
|
795 |
+
$this->cur_string = $this->cur_string[0] . substr($this->cur_string, 2, -2) . substr($this->cur_string, -1);
|
796 |
+
}
|
797 |
+
}
|
798 |
+
if($this->from == 'iv')
|
799 |
+
{
|
800 |
+
$this->sub_value .= $this->cur_string;
|
801 |
+
}
|
802 |
+
elseif($this->from == 'is')
|
803 |
+
{
|
804 |
+
$this->selector .= $this->cur_string;
|
805 |
+
}
|
806 |
+
}
|
807 |
+
break;
|
808 |
+
|
809 |
+
/* Case in-comment */
|
810 |
+
case 'ic':
|
811 |
+
if($string{$i} == '*' && $string{$i+1} == '/')
|
812 |
+
{
|
813 |
+
$this->status = $this->from;
|
814 |
+
$i++;
|
815 |
+
$this->_add_token(COMMENT, $cur_comment);
|
816 |
+
$cur_comment = '';
|
817 |
+
}
|
818 |
+
else
|
819 |
+
{
|
820 |
+
$cur_comment .= $string{$i};
|
821 |
+
}
|
822 |
+
break;
|
823 |
+
}
|
824 |
+
}
|
825 |
+
|
826 |
+
$this->optimise->postparse();
|
827 |
+
|
828 |
+
$this->print->_reset();
|
829 |
+
|
830 |
+
return !(empty($this->css) && empty($this->import) && empty($this->charset) && empty($this->tokens) && empty($this->namespace));
|
831 |
+
}
|
832 |
+
|
833 |
+
/**
|
834 |
+
* Explodes selectors
|
835 |
+
* @access private
|
836 |
+
* @version 1.0
|
837 |
+
*/
|
838 |
+
function explode_selectors()
|
839 |
+
{
|
840 |
+
// Explode multiple selectors
|
841 |
+
if($this->get_cfg('merge_selectors') == 1)
|
842 |
+
{
|
843 |
+
$new_sels = array();
|
844 |
+
$lastpos = 0;
|
845 |
+
$this->sel_separate[] = strlen($this->selector);
|
846 |
+
foreach($this->sel_separate as $num => $pos)
|
847 |
+
{
|
848 |
+
if($num == count($this->sel_separate)-1) {
|
849 |
+
$pos += 1;
|
850 |
+
}
|
851 |
+
|
852 |
+
$new_sels[] = substr($this->selector,$lastpos,$pos-$lastpos-1);
|
853 |
+
$lastpos = $pos;
|
854 |
+
}
|
855 |
+
|
856 |
+
if(count($new_sels) > 1)
|
857 |
+
{
|
858 |
+
foreach($new_sels as $selector)
|
859 |
+
{
|
860 |
+
$this->merge_css_blocks($this->at,$selector,$this->css[$this->at][$this->selector]);
|
861 |
+
}
|
862 |
+
unset($this->css[$this->at][$this->selector]);
|
863 |
+
}
|
864 |
+
}
|
865 |
+
$this->sel_separate = array();
|
866 |
+
}
|
867 |
+
|
868 |
+
/**
|
869 |
+
* Checks if a character is escaped (and returns true if it is)
|
870 |
+
* @param string $string
|
871 |
+
* @param integer $pos
|
872 |
+
* @access public
|
873 |
+
* @return bool
|
874 |
+
* @version 1.02
|
875 |
+
*/
|
876 |
+
function escaped(&$string,$pos)
|
877 |
+
{
|
878 |
+
return !(@($string{$pos-1} != '\\') || csstidy::escaped($string,$pos-1));
|
879 |
+
}
|
880 |
+
|
881 |
+
/**
|
882 |
+
* Adds a property with value to the existing CSS code
|
883 |
+
* @param string $media
|
884 |
+
* @param string $selector
|
885 |
+
* @param string $property
|
886 |
+
* @param string $new_val
|
887 |
+
* @access private
|
888 |
+
* @version 1.2
|
889 |
+
*/
|
890 |
+
function css_add_property($media,$selector,$property,$new_val)
|
891 |
+
{
|
892 |
+
if($this->get_cfg('preserve_css') || trim($new_val) == '') {
|
893 |
+
return;
|
894 |
+
}
|
895 |
+
|
896 |
+
$this->added = true;
|
897 |
+
if(isset($this->css[$media][$selector][$property]))
|
898 |
+
{
|
899 |
+
if((csstidy::is_important($this->css[$media][$selector][$property]) && csstidy::is_important($new_val)) || !csstidy::is_important($this->css[$media][$selector][$property]))
|
900 |
+
{
|
901 |
+
unset($this->css[$media][$selector][$property]);
|
902 |
+
$this->css[$media][$selector][$property] = trim($new_val);
|
903 |
+
}
|
904 |
+
}
|
905 |
+
else
|
906 |
+
{
|
907 |
+
$this->css[$media][$selector][$property] = trim($new_val);
|
908 |
+
}
|
909 |
+
}
|
910 |
+
|
911 |
+
/**
|
912 |
+
* Adds CSS to an existing media/selector
|
913 |
+
* @param string $media
|
914 |
+
* @param string $selector
|
915 |
+
* @param array $css_add
|
916 |
+
* @access private
|
917 |
+
* @version 1.1
|
918 |
+
*/
|
919 |
+
function merge_css_blocks($media,$selector,$css_add)
|
920 |
+
{
|
921 |
+
foreach($css_add as $property => $value)
|
922 |
+
{
|
923 |
+
$this->css_add_property($media,$selector,$property,$value,false);
|
924 |
+
}
|
925 |
+
}
|
926 |
+
|
927 |
+
/**
|
928 |
+
* Checks if $value is !important.
|
929 |
+
* @param string $value
|
930 |
+
* @return bool
|
931 |
+
* @access public
|
932 |
+
* @version 1.0
|
933 |
+
*/
|
934 |
+
function is_important(&$value)
|
935 |
+
{
|
936 |
+
return (!strcasecmp(substr(str_replace($GLOBALS['csstidy']['whitespace'],'',$value),-10,10),'!important'));
|
937 |
+
}
|
938 |
+
|
939 |
+
/**
|
940 |
+
* Returns a value without !important
|
941 |
+
* @param string $value
|
942 |
+
* @return string
|
943 |
+
* @access public
|
944 |
+
* @version 1.0
|
945 |
+
*/
|
946 |
+
function gvw_important($value)
|
947 |
+
{
|
948 |
+
if(csstidy::is_important($value))
|
949 |
+
{
|
950 |
+
$value = trim($value);
|
951 |
+
$value = substr($value,0,-9);
|
952 |
+
$value = trim($value);
|
953 |
+
$value = substr($value,0,-1);
|
954 |
+
$value = trim($value);
|
955 |
+
return $value;
|
956 |
+
}
|
957 |
+
return $value;
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* Checks if the next word in a string from pos is a CSS property
|
962 |
+
* @param string $istring
|
963 |
+
* @param integer $pos
|
964 |
+
* @return bool
|
965 |
+
* @access private
|
966 |
+
* @version 1.2
|
967 |
+
*/
|
968 |
+
function property_is_next($istring, $pos)
|
969 |
+
{
|
970 |
+
$all_properties =& $GLOBALS['csstidy']['all_properties'];
|
971 |
+
$istring = substr($istring,$pos,strlen($istring)-$pos);
|
972 |
+
$pos = strpos($istring,':');
|
973 |
+
if($pos === false)
|
974 |
+
{
|
975 |
+
return false;
|
976 |
+
}
|
977 |
+
$istring = strtolower(trim(substr($istring,0,$pos)));
|
978 |
+
if(isset($all_properties[$istring]))
|
979 |
+
{
|
980 |
+
$this->log('Added semicolon to the end of declaration','Warning');
|
981 |
+
return true;
|
982 |
+
}
|
983 |
+
return false;
|
984 |
+
}
|
985 |
+
|
986 |
+
/**
|
987 |
+
* Checks if a property is valid
|
988 |
+
* @param string $property
|
989 |
+
* @return bool;
|
990 |
+
* @access public
|
991 |
+
* @version 1.0
|
992 |
+
*/
|
993 |
+
function property_is_valid($property) {
|
994 |
+
$all_properties =& $GLOBALS['csstidy']['all_properties'];
|
995 |
+
return (isset($all_properties[$property]) && strpos($all_properties[$property],strtoupper($this->get_cfg('css_level'))) !== false );
|
996 |
+
}
|
997 |
+
|
998 |
+
}
|
999 |
+
?>
|
css/CSSTidy/class.csstidy_optimise.php
ADDED
@@ -0,0 +1,809 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CSSTidy - CSS Parser and Optimiser
|
4 |
+
*
|
5 |
+
* CSS Optimising Class
|
6 |
+
* This class optimises CSS data generated by csstidy.
|
7 |
+
*
|
8 |
+
* This file is part of CSSTidy.
|
9 |
+
*
|
10 |
+
* CSSTidy is free software; you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation; either version 2 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* CSSTidy is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with CSSTidy; if not, write to the Free Software
|
22 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
23 |
+
*
|
24 |
+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
25 |
+
* @package csstidy
|
26 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
27 |
+
*/
|
28 |
+
|
29 |
+
/**
|
30 |
+
* CSS Optimising Class
|
31 |
+
*
|
32 |
+
* This class optimises CSS data generated by csstidy.
|
33 |
+
*
|
34 |
+
* @package csstidy
|
35 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
36 |
+
* @version 1.0
|
37 |
+
*/
|
38 |
+
|
39 |
+
class csstidy_optimise
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* Constructor
|
43 |
+
* @param array $css contains the class csstidy
|
44 |
+
* @access private
|
45 |
+
* @version 1.0
|
46 |
+
*/
|
47 |
+
function csstidy_optimise(&$css)
|
48 |
+
{
|
49 |
+
$this->parser =& $css;
|
50 |
+
$this->css =& $css->css;
|
51 |
+
$this->sub_value =& $css->sub_value;
|
52 |
+
$this->at =& $css->at;
|
53 |
+
$this->selector =& $css->selector;
|
54 |
+
$this->property =& $css->property;
|
55 |
+
$this->value =& $css->value;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Optimises $css after parsing
|
60 |
+
* @access public
|
61 |
+
* @version 1.0
|
62 |
+
*/
|
63 |
+
function postparse()
|
64 |
+
{
|
65 |
+
if ($this->parser->get_cfg('preserve_css')) {
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
|
69 |
+
if ($this->parser->get_cfg('merge_selectors') == 2)
|
70 |
+
{
|
71 |
+
foreach ($this->css as $medium => $value)
|
72 |
+
{
|
73 |
+
$this->merge_selectors($this->css[$medium]);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
if ($this->parser->get_cfg('optimise_shorthands') > 0)
|
78 |
+
{
|
79 |
+
foreach ($this->css as $medium => $value)
|
80 |
+
{
|
81 |
+
foreach ($value as $selector => $value1)
|
82 |
+
{
|
83 |
+
$this->css[$medium][$selector] = csstidy_optimise::merge_4value_shorthands($this->css[$medium][$selector]);
|
84 |
+
|
85 |
+
if ($this->parser->get_cfg('optimise_shorthands') < 2) {
|
86 |
+
continue;
|
87 |
+
}
|
88 |
+
|
89 |
+
$this->css[$medium][$selector] = csstidy_optimise::merge_bg($this->css[$medium][$selector]);
|
90 |
+
if (empty($this->css[$medium][$selector])) {
|
91 |
+
unset($this->css[$medium][$selector]);
|
92 |
+
}
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Optimises values
|
100 |
+
* @access public
|
101 |
+
* @version 1.0
|
102 |
+
*/
|
103 |
+
function value()
|
104 |
+
{
|
105 |
+
$shorthands =& $GLOBALS['csstidy']['shorthands'];
|
106 |
+
|
107 |
+
// optimise shorthand properties
|
108 |
+
if(isset($shorthands[$this->property]))
|
109 |
+
{
|
110 |
+
$temp = csstidy_optimise::shorthand($this->value); // FIXME - move
|
111 |
+
if($temp != $this->value)
|
112 |
+
{
|
113 |
+
$this->parser->log('Optimised shorthand notation ('.$this->property.'): Changed "'.$this->value.'" to "'.$temp.'"','Information');
|
114 |
+
}
|
115 |
+
$this->value = $temp;
|
116 |
+
}
|
117 |
+
|
118 |
+
// Remove whitespace at ! important
|
119 |
+
if($this->value != $this->compress_important($this->value))
|
120 |
+
{
|
121 |
+
$this->parser->log('Optimised !important','Information');
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Optimises shorthands
|
127 |
+
* @access public
|
128 |
+
* @version 1.0
|
129 |
+
*/
|
130 |
+
function shorthands()
|
131 |
+
{
|
132 |
+
$shorthands =& $GLOBALS['csstidy']['shorthands'];
|
133 |
+
|
134 |
+
if(!$this->parser->get_cfg('optimise_shorthands') || $this->parser->get_cfg('preserve_css')) {
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
|
138 |
+
if($this->property == 'background' && $this->parser->get_cfg('optimise_shorthands') > 1)
|
139 |
+
{
|
140 |
+
unset($this->css[$this->at][$this->selector]['background']);
|
141 |
+
$this->parser->merge_css_blocks($this->at,$this->selector,csstidy_optimise::dissolve_short_bg($this->value));
|
142 |
+
}
|
143 |
+
if(isset($shorthands[$this->property]))
|
144 |
+
{
|
145 |
+
$this->parser->merge_css_blocks($this->at,$this->selector,csstidy_optimise::dissolve_4value_shorthands($this->property,$this->value));
|
146 |
+
if(is_array($shorthands[$this->property]))
|
147 |
+
{
|
148 |
+
unset($this->css[$this->at][$this->selector][$this->property]);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Optimises a sub-value
|
155 |
+
* @access public
|
156 |
+
* @version 1.0
|
157 |
+
*/
|
158 |
+
function subvalue()
|
159 |
+
{
|
160 |
+
$replace_colors =& $GLOBALS['csstidy']['replace_colors'];
|
161 |
+
|
162 |
+
$this->sub_value = trim($this->sub_value);
|
163 |
+
if($this->sub_value == '') // caution : '0'
|
164 |
+
{
|
165 |
+
return;
|
166 |
+
}
|
167 |
+
|
168 |
+
$important = '';
|
169 |
+
if(csstidy::is_important($this->sub_value))
|
170 |
+
{
|
171 |
+
$important = '!important';
|
172 |
+
}
|
173 |
+
$this->sub_value = csstidy::gvw_important($this->sub_value);
|
174 |
+
|
175 |
+
// Compress font-weight
|
176 |
+
if($this->property == 'font-weight' && $this->parser->get_cfg('compress_font-weight'))
|
177 |
+
{
|
178 |
+
if($this->sub_value == 'bold')
|
179 |
+
{
|
180 |
+
$this->sub_value = '700';
|
181 |
+
$this->parser->log('Optimised font-weight: Changed "bold" to "700"','Information');
|
182 |
+
}
|
183 |
+
else if($this->sub_value == 'normal')
|
184 |
+
{
|
185 |
+
$this->sub_value = '400';
|
186 |
+
$this->parser->log('Optimised font-weight: Changed "normal" to "400"','Information');
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
$temp = $this->compress_numbers($this->sub_value);
|
191 |
+
if($temp != $this->sub_value)
|
192 |
+
{
|
193 |
+
if(strlen($temp) > strlen($this->sub_value)) {
|
194 |
+
$this->parser->log('Fixed invalid number: Changed "'.$this->sub_value.'" to "'.$temp.'"','Warning');
|
195 |
+
} else {
|
196 |
+
$this->parser->log('Optimised number: Changed "'.$this->sub_value.'" to "'.$temp.'"','Information');
|
197 |
+
}
|
198 |
+
$this->sub_value = $temp;
|
199 |
+
}
|
200 |
+
if($this->parser->get_cfg('compress_colors'))
|
201 |
+
{
|
202 |
+
$temp = $this->cut_color($this->sub_value);
|
203 |
+
if($temp !== $this->sub_value)
|
204 |
+
{
|
205 |
+
if(isset($replace_colors[$this->sub_value])) {
|
206 |
+
$this->parser->log('Fixed invalid color name: Changed "'.$this->sub_value.'" to "'.$temp.'"','Warning');
|
207 |
+
} else {
|
208 |
+
$this->parser->log('Optimised color: Changed "'.$this->sub_value.'" to "'.$temp.'"','Information');
|
209 |
+
}
|
210 |
+
$this->sub_value = $temp;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
$this->sub_value .= $important;
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Compresses shorthand values. Example: margin:1px 1px 1px 1px -> margin:1px
|
218 |
+
* @param string $value
|
219 |
+
* @access public
|
220 |
+
* @return string
|
221 |
+
* @version 1.0
|
222 |
+
*/
|
223 |
+
function shorthand($value)
|
224 |
+
{
|
225 |
+
$important = '';
|
226 |
+
if(csstidy::is_important($value))
|
227 |
+
{
|
228 |
+
$values = csstidy::gvw_important($value);
|
229 |
+
$important = '!important';
|
230 |
+
}
|
231 |
+
else $values = $value;
|
232 |
+
|
233 |
+
$values = explode(' ',$values);
|
234 |
+
switch(count($values))
|
235 |
+
{
|
236 |
+
case 4:
|
237 |
+
if($values[0] == $values[1] && $values[0] == $values[2] && $values[0] == $values[3])
|
238 |
+
{
|
239 |
+
return $values[0].$important;
|
240 |
+
}
|
241 |
+
elseif($values[1] == $values[3] && $values[0] == $values[2])
|
242 |
+
{
|
243 |
+
return $values[0].' '.$values[1].$important;
|
244 |
+
}
|
245 |
+
elseif($values[1] == $values[3])
|
246 |
+
{
|
247 |
+
return $values[0].' '.$values[1].' '.$values[2].$important;
|
248 |
+
}
|
249 |
+
break;
|
250 |
+
|
251 |
+
case 3:
|
252 |
+
if($values[0] == $values[1] && $values[0] == $values[2])
|
253 |
+
{
|
254 |
+
return $values[0].$important;
|
255 |
+
}
|
256 |
+
elseif($values[0] == $values[2])
|
257 |
+
{
|
258 |
+
return $values[0].' '.$values[1].$important;
|
259 |
+
}
|
260 |
+
break;
|
261 |
+
|
262 |
+
case 2:
|
263 |
+
if($values[0] == $values[1])
|
264 |
+
{
|
265 |
+
return $values[0].$important;
|
266 |
+
}
|
267 |
+
break;
|
268 |
+
}
|
269 |
+
|
270 |
+
return $value;
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Removes unnecessary whitespace in ! important
|
275 |
+
* @param string $string
|
276 |
+
* @return string
|
277 |
+
* @access public
|
278 |
+
* @version 1.1
|
279 |
+
*/
|
280 |
+
function compress_important(&$string)
|
281 |
+
{
|
282 |
+
if(csstidy::is_important($string))
|
283 |
+
{
|
284 |
+
$string = csstidy::gvw_important($string) . '!important';
|
285 |
+
}
|
286 |
+
return $string;
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* Color compression function. Converts all rgb() values to #-values and uses the short-form if possible. Also replaces 4 color names by #-values.
|
291 |
+
* @param string $color
|
292 |
+
* @return string
|
293 |
+
* @version 1.1
|
294 |
+
*/
|
295 |
+
function cut_color($color)
|
296 |
+
{
|
297 |
+
$replace_colors =& $GLOBALS['csstidy']['replace_colors'];
|
298 |
+
|
299 |
+
// rgb(0,0,0) -> #000000 (or #000 in this case later)
|
300 |
+
if(strtolower(substr($color,0,4)) == 'rgb(')
|
301 |
+
{
|
302 |
+
$color_tmp = substr($color,4,strlen($color)-5);
|
303 |
+
$color_tmp = explode(',',$color_tmp);
|
304 |
+
for ( $i = 0; $i < count($color_tmp); $i++ )
|
305 |
+
{
|
306 |
+
$color_tmp[$i] = trim ($color_tmp[$i]);
|
307 |
+
if(substr($color_tmp[$i],-1) == '%')
|
308 |
+
{
|
309 |
+
$color_tmp[$i] = round((255*$color_tmp[$i])/100);
|
310 |
+
}
|
311 |
+
if($color_tmp[$i]>255) $color_tmp[$i] = 255;
|
312 |
+
}
|
313 |
+
$color = '#';
|
314 |
+
for ($i = 0; $i < 3; $i++ )
|
315 |
+
{
|
316 |
+
if($color_tmp[$i]<16) {
|
317 |
+
$color .= '0' . dechex($color_tmp[$i]);
|
318 |
+
} else {
|
319 |
+
$color .= dechex($color_tmp[$i]);
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
// Fix bad color names
|
325 |
+
if(isset($replace_colors[strtolower($color)]))
|
326 |
+
{
|
327 |
+
$color = $replace_colors[strtolower($color)];
|
328 |
+
}
|
329 |
+
|
330 |
+
// #aabbcc -> #abc
|
331 |
+
if(strlen($color) == 7)
|
332 |
+
{
|
333 |
+
$color_temp = strtolower($color);
|
334 |
+
if($color_temp{0} == '#' && $color_temp{1} == $color_temp{2} && $color_temp{3} == $color_temp{4} && $color_temp{5} == $color_temp{6})
|
335 |
+
{
|
336 |
+
$color = '#'.$color{1}.$color{3}.$color{5};
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
switch(strtolower($color))
|
341 |
+
{
|
342 |
+
/* color name -> hex code */
|
343 |
+
case 'black': return '#000';
|
344 |
+
case 'fuchsia': return '#F0F';
|
345 |
+
case 'white': return '#FFF';
|
346 |
+
case 'yellow': return '#FF0';
|
347 |
+
|
348 |
+
/* hex code -> color name */
|
349 |
+
case '#800000': return 'maroon';
|
350 |
+
case '#ffa500': return 'orange';
|
351 |
+
case '#808000': return 'olive';
|
352 |
+
case '#800080': return 'purple';
|
353 |
+
case '#008000': return 'green';
|
354 |
+
case '#000080': return 'navy';
|
355 |
+
case '#008080': return 'teal';
|
356 |
+
case '#c0c0c0': return 'silver';
|
357 |
+
case '#808080': return 'gray';
|
358 |
+
case '#f00': return 'red';
|
359 |
+
}
|
360 |
+
|
361 |
+
return $color;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Compresses numbers (ie. 1.0 becomes 1 or 1.100 becomes 1.1 )
|
366 |
+
* @param string $subvalue
|
367 |
+
* @return string
|
368 |
+
* @version 1.2
|
369 |
+
*/
|
370 |
+
function compress_numbers($subvalue)
|
371 |
+
{
|
372 |
+
$units =& $GLOBALS['csstidy']['units'];
|
373 |
+
$unit_values =& $GLOBALS['csstidy']['unit_values'];
|
374 |
+
$color_values =& $GLOBALS['csstidy']['color_values'];
|
375 |
+
|
376 |
+
// for font:1em/1em sans-serif...;
|
377 |
+
if($this->property == 'font')
|
378 |
+
{
|
379 |
+
$temp = explode('/',$subvalue);
|
380 |
+
}
|
381 |
+
else
|
382 |
+
{
|
383 |
+
$temp = array($subvalue);
|
384 |
+
}
|
385 |
+
for ($l = 0; $l < count($temp); $l++)
|
386 |
+
{
|
387 |
+
// continue if no numeric value
|
388 |
+
if (!(strlen($temp[$l]) > 0 && ( is_numeric($temp[$l]{0}) || $temp[$l]{0} == '+' || $temp[$l]{0} == '-' ) ))
|
389 |
+
{
|
390 |
+
continue;
|
391 |
+
}
|
392 |
+
|
393 |
+
// Fix bad colors
|
394 |
+
if (in_array($this->property, $color_values))
|
395 |
+
{
|
396 |
+
$temp[$l] = '#'.$temp[$l];
|
397 |
+
}
|
398 |
+
|
399 |
+
if (floatval($temp[$l]) == 0)
|
400 |
+
{
|
401 |
+
$temp[$l] = '0';
|
402 |
+
}
|
403 |
+
else
|
404 |
+
{
|
405 |
+
$unit_found = FALSE;
|
406 |
+
for ($m = 0, $size_4 = count($units); $m < $size_4; $m++)
|
407 |
+
{
|
408 |
+
if (strpos(strtolower($temp[$l]),$units[$m]) !== FALSE)
|
409 |
+
{
|
410 |
+
$temp[$l] = floatval($temp[$l]).$units[$m];
|
411 |
+
$unit_found = TRUE;
|
412 |
+
break;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
if (!$unit_found && in_array($this->property,$unit_values,TRUE))
|
416 |
+
{
|
417 |
+
$temp[$l] = floatval($temp[$l]).'px';
|
418 |
+
}
|
419 |
+
else if (!$unit_found)
|
420 |
+
{
|
421 |
+
$temp[$l] = floatval($temp[$l]);
|
422 |
+
}
|
423 |
+
// Remove leading zero
|
424 |
+
if (abs(floatval($temp[$l])) < 1) {
|
425 |
+
if (floatval($temp[$l]) < 0) {
|
426 |
+
$temp[$l] = '-' . substr($temp[$l], 2);
|
427 |
+
} else {
|
428 |
+
$temp[$l] = substr($temp[$l], 1);
|
429 |
+
}
|
430 |
+
}
|
431 |
+
}
|
432 |
+
}
|
433 |
+
|
434 |
+
return ((count($temp) > 1) ? $temp[0].'/'.$temp[1] : $temp[0]);
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Merges selectors with same properties. Example: a{color:red} b{color:red} -> a,b{color:red}
|
439 |
+
* Very basic and has at least one bug. Hopefully there is a replacement soon.
|
440 |
+
* @param array $array
|
441 |
+
* @return array
|
442 |
+
* @access public
|
443 |
+
* @version 1.2
|
444 |
+
*/
|
445 |
+
function merge_selectors(&$array)
|
446 |
+
{
|
447 |
+
$css = $array;
|
448 |
+
foreach($css as $key => $value)
|
449 |
+
{
|
450 |
+
if(!isset($css[$key]))
|
451 |
+
{
|
452 |
+
continue;
|
453 |
+
}
|
454 |
+
$newsel = '';
|
455 |
+
|
456 |
+
// Check if properties also exist in another selector
|
457 |
+
$keys = array();
|
458 |
+
// PHP bug (?) without $css = $array; here
|
459 |
+
foreach($css as $selector => $vali)
|
460 |
+
{
|
461 |
+
if($selector == $key)
|
462 |
+
{
|
463 |
+
continue;
|
464 |
+
}
|
465 |
+
|
466 |
+
if($css[$key] === $vali)
|
467 |
+
{
|
468 |
+
$keys[] = $selector;
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
if(!empty($keys))
|
473 |
+
{
|
474 |
+
$newsel = $key;
|
475 |
+
unset($css[$key]);
|
476 |
+
foreach($keys as $selector)
|
477 |
+
{
|
478 |
+
unset($css[$selector]);
|
479 |
+
$newsel .= ','.$selector;
|
480 |
+
}
|
481 |
+
$css[$newsel] = $value;
|
482 |
+
}
|
483 |
+
}
|
484 |
+
$array = $css;
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Dissolves properties like padding:10px 10px 10px to padding-top:10px;padding-bottom:10px;...
|
489 |
+
* @param string $property
|
490 |
+
* @param string $value
|
491 |
+
* @return array
|
492 |
+
* @version 1.0
|
493 |
+
* @see merge_4value_shorthands()
|
494 |
+
*/
|
495 |
+
function dissolve_4value_shorthands($property,$value)
|
496 |
+
{
|
497 |
+
$shorthands =& $GLOBALS['csstidy']['shorthands'];
|
498 |
+
if(!is_array($shorthands[$property]))
|
499 |
+
{
|
500 |
+
$return[$property] = $value;
|
501 |
+
return $return;
|
502 |
+
}
|
503 |
+
|
504 |
+
$important = '';
|
505 |
+
if(csstidy::is_important($value))
|
506 |
+
{
|
507 |
+
$value = csstidy::gvw_important($value);
|
508 |
+
$important = '!important';
|
509 |
+
}
|
510 |
+
$values = explode(' ',$value);
|
511 |
+
|
512 |
+
|
513 |
+
$return = array();
|
514 |
+
if(count($values) == 4)
|
515 |
+
{
|
516 |
+
for($i=0;$i<4;$i++)
|
517 |
+
{
|
518 |
+
$return[$shorthands[$property][$i]] = $values[$i].$important;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
elseif(count($values) == 3)
|
522 |
+
{
|
523 |
+
$return[$shorthands[$property][0]] = $values[0].$important;
|
524 |
+
$return[$shorthands[$property][1]] = $values[1].$important;
|
525 |
+
$return[$shorthands[$property][3]] = $values[1].$important;
|
526 |
+
$return[$shorthands[$property][2]] = $values[2].$important;
|
527 |
+
}
|
528 |
+
elseif(count($values) == 2)
|
529 |
+
{
|
530 |
+
for($i=0;$i<4;$i++)
|
531 |
+
{
|
532 |
+
$return[$shorthands[$property][$i]] = (($i % 2 != 0)) ? $values[1].$important : $values[0].$important;
|
533 |
+
}
|
534 |
+
}
|
535 |
+
else
|
536 |
+
{
|
537 |
+
for($i=0;$i<4;$i++)
|
538 |
+
{
|
539 |
+
$return[$shorthands[$property][$i]] = $values[0].$important;
|
540 |
+
}
|
541 |
+
}
|
542 |
+
|
543 |
+
return $return;
|
544 |
+
}
|
545 |
+
|
546 |
+
/**
|
547 |
+
* Explodes a string as explode() does, however, not if $sep is escaped or within a string.
|
548 |
+
* @param string $sep seperator
|
549 |
+
* @param string $string
|
550 |
+
* @return array
|
551 |
+
* @version 1.0
|
552 |
+
*/
|
553 |
+
function explode_ws($sep,$string)
|
554 |
+
{
|
555 |
+
$status = 'st';
|
556 |
+
$to = '';
|
557 |
+
|
558 |
+
$output = array();
|
559 |
+
$num = 0;
|
560 |
+
for($i = 0, $len = strlen($string);$i < $len; $i++)
|
561 |
+
{
|
562 |
+
switch($status)
|
563 |
+
{
|
564 |
+
case 'st':
|
565 |
+
if($string{$i} == $sep && !csstidy::escaped($string,$i))
|
566 |
+
{
|
567 |
+
++$num;
|
568 |
+
}
|
569 |
+
elseif($string{$i} == '"' || $string{$i} == '\'' || $string{$i} == '(' && !csstidy::escaped($string,$i))
|
570 |
+
{
|
571 |
+
$status = 'str';
|
572 |
+
$to = ($string{$i} == '(') ? ')' : $string{$i};
|
573 |
+
(isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i};
|
574 |
+
}
|
575 |
+
else
|
576 |
+
{
|
577 |
+
(isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i};
|
578 |
+
}
|
579 |
+
break;
|
580 |
+
|
581 |
+
case 'str':
|
582 |
+
if($string{$i} == $to && !csstidy::escaped($string,$i))
|
583 |
+
{
|
584 |
+
$status = 'st';
|
585 |
+
}
|
586 |
+
(isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i};
|
587 |
+
break;
|
588 |
+
}
|
589 |
+
}
|
590 |
+
|
591 |
+
if(isset($output[0]))
|
592 |
+
{
|
593 |
+
return $output;
|
594 |
+
}
|
595 |
+
else
|
596 |
+
{
|
597 |
+
return array($output);
|
598 |
+
}
|
599 |
+
}
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Merges Shorthand properties again, the opposite of dissolve_4value_shorthands()
|
603 |
+
* @param array $array
|
604 |
+
* @return array
|
605 |
+
* @version 1.2
|
606 |
+
* @see dissolve_4value_shorthands()
|
607 |
+
*/
|
608 |
+
function merge_4value_shorthands($array)
|
609 |
+
{
|
610 |
+
$return = $array;
|
611 |
+
$shorthands =& $GLOBALS['csstidy']['shorthands'];
|
612 |
+
|
613 |
+
foreach($shorthands as $key => $value)
|
614 |
+
{
|
615 |
+
if(isset($array[$value[0]]) && isset($array[$value[1]])
|
616 |
+
&& isset($array[$value[2]]) && isset($array[$value[3]]) && $value !== 0)
|
617 |
+
{
|
618 |
+
$return[$key] = '';
|
619 |
+
|
620 |
+
$important = '';
|
621 |
+
for($i = 0; $i < 4; $i++)
|
622 |
+
{
|
623 |
+
$val = $array[$value[$i]];
|
624 |
+
if(csstidy::is_important($val))
|
625 |
+
{
|
626 |
+
$important = '!important';
|
627 |
+
$return[$key] .= csstidy::gvw_important($val).' ';
|
628 |
+
}
|
629 |
+
else
|
630 |
+
{
|
631 |
+
$return[$key] .= $val.' ';
|
632 |
+
}
|
633 |
+
unset($return[$value[$i]]);
|
634 |
+
}
|
635 |
+
$return[$key] = csstidy_optimise::shorthand(trim($return[$key].$important));
|
636 |
+
}
|
637 |
+
}
|
638 |
+
return $return;
|
639 |
+
}
|
640 |
+
|
641 |
+
/**
|
642 |
+
* Dissolve background property
|
643 |
+
* @param string $str_value
|
644 |
+
* @return array
|
645 |
+
* @version 1.0
|
646 |
+
* @see merge_bg()
|
647 |
+
* @todo full CSS 3 compliance
|
648 |
+
*/
|
649 |
+
function dissolve_short_bg($str_value)
|
650 |
+
{
|
651 |
+
$background_prop_default =& $GLOBALS['csstidy']['background_prop_default'];
|
652 |
+
$repeat = array('repeat','repeat-x','repeat-y','no-repeat','space');
|
653 |
+
$attachment = array('scroll','fixed','local');
|
654 |
+
$clip = array('border','padding');
|
655 |
+
$origin = array('border','padding','content');
|
656 |
+
$pos = array('top','center','bottom','left','right');
|
657 |
+
$important = '';
|
658 |
+
$return = array('background-image' => NULL,'background-size' => NULL,'background-repeat' => NULL,'background-position' => NULL,'background-attachment'=>NULL,'background-clip' => NULL,'background-origin' => NULL,'background-color' => NULL);
|
659 |
+
|
660 |
+
if(csstidy::is_important($str_value))
|
661 |
+
{
|
662 |
+
$important = ' !important';
|
663 |
+
$str_value = csstidy::gvw_important($str_value);
|
664 |
+
}
|
665 |
+
|
666 |
+
$str_value = csstidy_optimise::explode_ws(',',$str_value);
|
667 |
+
for($i = 0; $i < count($str_value); $i++)
|
668 |
+
{
|
669 |
+
$have['clip'] = FALSE; $have['pos'] = FALSE;
|
670 |
+
$have['color'] = FALSE; $have['bg'] = FALSE;
|
671 |
+
|
672 |
+
$str_value[$i] = csstidy_optimise::explode_ws(' ',trim($str_value[$i]));
|
673 |
+
|
674 |
+
for($j = 0; $j < count($str_value[$i]); $j++)
|
675 |
+
{
|
676 |
+
if($have['bg'] === FALSE && (substr($str_value[$i][$j],0,4) == 'url(' || $str_value[$i][$j] === 'none'))
|
677 |
+
{
|
678 |
+
$return['background-image'] .= $str_value[$i][$j].',';
|
679 |
+
$have['bg'] = TRUE;
|
680 |
+
}
|
681 |
+
elseif(in_array($str_value[$i][$j],$repeat,TRUE))
|
682 |
+
{
|
683 |
+
$return['background-repeat'] .= $str_value[$i][$j].',';
|
684 |
+
}
|
685 |
+
elseif(in_array($str_value[$i][$j],$attachment,TRUE))
|
686 |
+
{
|
687 |
+
$return['background-attachment'] .= $str_value[$i][$j].',';
|
688 |
+
}
|
689 |
+
elseif(in_array($str_value[$i][$j],$clip,TRUE) && !$have['clip'])
|
690 |
+
{
|
691 |
+
$return['background-clip'] .= $str_value[$i][$j].',';
|
692 |
+
$have['clip'] = TRUE;
|
693 |
+
}
|
694 |
+
elseif(in_array($str_value[$i][$j],$origin,TRUE))
|
695 |
+
{
|
696 |
+
$return['background-origin'] .= $str_value[$i][$j].',';
|
697 |
+
}
|
698 |
+
elseif($str_value[$i][$j]{0} == '(')
|
699 |
+
{
|
700 |
+
$return['background-size'] .= substr($str_value[$i][$j],1,-1).',';
|
701 |
+
}
|
702 |
+
elseif(in_array($str_value[$i][$j],$pos,TRUE) || is_numeric($str_value[$i][$j]{0}) || $str_value[$i][$j]{0} === NULL)
|
703 |
+
{
|
704 |
+
$return['background-position'] .= $str_value[$i][$j];
|
705 |
+
if(!$have['pos']) $return['background-position'] .= ' '; else $return['background-position'].= ',';
|
706 |
+
$have['pos'] = TRUE;
|
707 |
+
}
|
708 |
+
elseif(!$have['color'])
|
709 |
+
{
|
710 |
+
$return['background-color'] .= $str_value[$i][$j].',';
|
711 |
+
$have['color'] = TRUE;
|
712 |
+
}
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
foreach($background_prop_default as $bg_prop => $default_value)
|
717 |
+
{
|
718 |
+
if($return[$bg_prop] !== NULL)
|
719 |
+
{
|
720 |
+
$return[$bg_prop] = substr($return[$bg_prop],0,-1).$important;
|
721 |
+
}
|
722 |
+
else $return[$bg_prop] = $default_value.$important;
|
723 |
+
}
|
724 |
+
return $return;
|
725 |
+
}
|
726 |
+
|
727 |
+
/**
|
728 |
+
* Merges all background properties
|
729 |
+
* @param array $input_css
|
730 |
+
* @return array
|
731 |
+
* @version 1.0
|
732 |
+
* @see dissolve_short_bg()
|
733 |
+
* @todo full CSS 3 compliance
|
734 |
+
*/
|
735 |
+
function merge_bg($input_css)
|
736 |
+
{
|
737 |
+
$background_prop_default =& $GLOBALS['csstidy']['background_prop_default'];
|
738 |
+
// Max number of background images. CSS3 not yet fully implemented
|
739 |
+
$number_of_values = @max(count(csstidy_optimise::explode_ws(',',$input_css['background-image'])),count(csstidy_optimise::explode_ws(',',$input_css['background-color'])),1);
|
740 |
+
// Array with background images to check if BG image exists
|
741 |
+
$bg_img_array = @csstidy_optimise::explode_ws(',',csstidy::gvw_important($input_css['background-image']));
|
742 |
+
$new_bg_value = '';
|
743 |
+
$important = '';
|
744 |
+
|
745 |
+
for($i = 0; $i < $number_of_values; $i++)
|
746 |
+
{
|
747 |
+
foreach($background_prop_default as $bg_property => $default_value)
|
748 |
+
{
|
749 |
+
// Skip if property does not exist
|
750 |
+
if(!isset($input_css[$bg_property]))
|
751 |
+
{
|
752 |
+
continue;
|
753 |
+
}
|
754 |
+
|
755 |
+
$cur_value = $input_css[$bg_property];
|
756 |
+
|
757 |
+
// Skip some properties if there is no background image
|
758 |
+
if((!isset($bg_img_array[$i]) || $bg_img_array[$i] === 'none')
|
759 |
+
&& ($bg_property === 'background-size' || $bg_property === 'background-position'
|
760 |
+
|| $bg_property === 'background-attachment' || $bg_property === 'background-repeat'))
|
761 |
+
{
|
762 |
+
continue;
|
763 |
+
}
|
764 |
+
|
765 |
+
// Remove !important
|
766 |
+
if(csstidy::is_important($cur_value))
|
767 |
+
{
|
768 |
+
$important = ' !important';
|
769 |
+
$cur_value = csstidy::gvw_important($cur_value);
|
770 |
+
}
|
771 |
+
|
772 |
+
// Do not add default values
|
773 |
+
if($cur_value === $default_value)
|
774 |
+
{
|
775 |
+
continue;
|
776 |
+
}
|
777 |
+
|
778 |
+
$temp = csstidy_optimise::explode_ws(',',$cur_value);
|
779 |
+
|
780 |
+
if(isset($temp[$i]))
|
781 |
+
{
|
782 |
+
if($bg_property == 'background-size')
|
783 |
+
{
|
784 |
+
$new_bg_value .= '('.$temp[$i].') ';
|
785 |
+
}
|
786 |
+
else
|
787 |
+
{
|
788 |
+
$new_bg_value .= $temp[$i].' ';
|
789 |
+
}
|
790 |
+
}
|
791 |
+
}
|
792 |
+
|
793 |
+
$new_bg_value = trim($new_bg_value);
|
794 |
+
if($i != $number_of_values-1) $new_bg_value .= ',';
|
795 |
+
}
|
796 |
+
|
797 |
+
// Delete all background-properties
|
798 |
+
foreach($background_prop_default as $bg_property => $default_value)
|
799 |
+
{
|
800 |
+
unset($input_css[$bg_property]);
|
801 |
+
}
|
802 |
+
|
803 |
+
// Add new background property
|
804 |
+
if($new_bg_value !== '') $input_css['background'] = $new_bg_value.$important;
|
805 |
+
|
806 |
+
return $input_css;
|
807 |
+
}
|
808 |
+
}
|
809 |
+
?>
|
css/CSSTidy/class.csstidy_print.php
ADDED
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* CSSTidy - CSS Parser and Optimiser
|
4 |
+
*
|
5 |
+
* CSS Printing class
|
6 |
+
* This class prints CSS data generated by csstidy.
|
7 |
+
*
|
8 |
+
* This file is part of CSSTidy.
|
9 |
+
*
|
10 |
+
* CSSTidy is free software; you can redistribute it and/or modify
|
11 |
+
* it under the terms of the GNU General Public License as published by
|
12 |
+
* the Free Software Foundation; either version 2 of the License, or
|
13 |
+
* (at your option) any later version.
|
14 |
+
*
|
15 |
+
* CSSTidy is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with CSSTidy; if not, write to the Free Software
|
22 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
23 |
+
*
|
24 |
+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
25 |
+
* @package csstidy
|
26 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
27 |
+
*/
|
28 |
+
|
29 |
+
/**
|
30 |
+
* CSS Printing class
|
31 |
+
*
|
32 |
+
* This class prints CSS data generated by csstidy.
|
33 |
+
*
|
34 |
+
* @package csstidy
|
35 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
|
36 |
+
* @version 1.0
|
37 |
+
*/
|
38 |
+
|
39 |
+
class csstidy_print
|
40 |
+
{
|
41 |
+
/**
|
42 |
+
* Saves the input CSS string
|
43 |
+
* @var string
|
44 |
+
* @access private
|
45 |
+
*/
|
46 |
+
var $input_css = '';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Saves the formatted CSS string
|
50 |
+
* @var string
|
51 |
+
* @access public
|
52 |
+
*/
|
53 |
+
var $output_css = '';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Saves the formatted CSS string (plain text)
|
57 |
+
* @var string
|
58 |
+
* @access public
|
59 |
+
*/
|
60 |
+
var $output_css_plain = '';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Constructor
|
64 |
+
* @param array $css contains the class csstidy
|
65 |
+
* @access private
|
66 |
+
* @version 1.0
|
67 |
+
*/
|
68 |
+
function csstidy_print(&$css)
|
69 |
+
{
|
70 |
+
$this->parser =& $css;
|
71 |
+
$this->css =& $css->css;
|
72 |
+
$this->template =& $css->template;
|
73 |
+
$this->tokens =& $css->tokens;
|
74 |
+
$this->charset =& $css->charset;
|
75 |
+
$this->import =& $css->import;
|
76 |
+
$this->namespace =& $css->namespace;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Resets output_css and output_css_plain (new css code)
|
81 |
+
* @access private
|
82 |
+
* @version 1.0
|
83 |
+
*/
|
84 |
+
function _reset()
|
85 |
+
{
|
86 |
+
$this->output_css = '';
|
87 |
+
$this->output_css_plain = '';
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Returns the CSS code as plain text
|
92 |
+
* @return string
|
93 |
+
* @access public
|
94 |
+
* @version 1.0
|
95 |
+
*/
|
96 |
+
function plain()
|
97 |
+
{
|
98 |
+
$this->_print(true);
|
99 |
+
return $this->output_css_plain;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Returns the formatted CSS code
|
104 |
+
* @return string
|
105 |
+
* @access public
|
106 |
+
* @version 1.0
|
107 |
+
*/
|
108 |
+
function formatted()
|
109 |
+
{
|
110 |
+
$this->_print(false);
|
111 |
+
return $this->output_css;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Returns the formatted CSS Code and saves it into $this->output_css and $this->output_css_plain
|
116 |
+
* @param bool $plain plain text or not
|
117 |
+
* @access private
|
118 |
+
* @version 2.0
|
119 |
+
*/
|
120 |
+
function _print($plain = false)
|
121 |
+
{
|
122 |
+
if ($this->output_css && $this->output_css_plain) {
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$output = '';
|
127 |
+
if (!$this->parser->get_cfg('preserve_css')) {
|
128 |
+
$this->_convert_raw_css();
|
129 |
+
}
|
130 |
+
|
131 |
+
$template =& $this->template;
|
132 |
+
|
133 |
+
if ($plain) {
|
134 |
+
$template = array_map('strip_tags', $template);
|
135 |
+
}
|
136 |
+
|
137 |
+
if ($this->parser->get_cfg('timestamp')) {
|
138 |
+
array_unshift($this->tokens, array(COMMENT, ' CSSTidy ' . $this->parser->version . ': ' . date('r') . ' '));
|
139 |
+
}
|
140 |
+
|
141 |
+
if (!empty($this->charset)) {
|
142 |
+
$output .= $template[0].'@charset '.$template[5].$this->charset.$template[6];
|
143 |
+
}
|
144 |
+
|
145 |
+
if (!empty($this->import)) {
|
146 |
+
for ($i = 0, $size = count($this->import); $i < $size; $i ++) {
|
147 |
+
$output .= $template[0].'@import '.$template[5].$this->import[$i].$template[6];
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
if (!empty($this->namespace)) {
|
152 |
+
$output .= $template[0].'@namespace '.$template[5].$this->namespace.$template[6];
|
153 |
+
}
|
154 |
+
|
155 |
+
$output .= $template[13];
|
156 |
+
$in_at_out = '';
|
157 |
+
$out =& $output;
|
158 |
+
|
159 |
+
foreach ($this->tokens as $key => $token)
|
160 |
+
{
|
161 |
+
switch ($token[0])
|
162 |
+
{
|
163 |
+
case AT_START:
|
164 |
+
$out .= $template[0].$this->_htmlsp($token[1], $plain).$template[1];
|
165 |
+
$out =& $in_at_out;
|
166 |
+
break;
|
167 |
+
|
168 |
+
case SEL_START:
|
169 |
+
if($this->parser->get_cfg('lowercase_s')) $token[1] = strtolower($token[1]);
|
170 |
+
$out .= ($token[1]{0} !== '@') ? $template[2].$this->_htmlsp($token[1], $plain) : $template[0].$this->_htmlsp($token[1], $plain);
|
171 |
+
$out .= $template[3];
|
172 |
+
break;
|
173 |
+
|
174 |
+
case PROPERTY:
|
175 |
+
if($this->parser->get_cfg('case_properties') == 2) $token[1] = strtoupper($token[1]);
|
176 |
+
if($this->parser->get_cfg('case_properties') == 1) $token[1] = strtolower($token[1]);
|
177 |
+
$out .= $template[4] . $this->_htmlsp($token[1], $plain) . ':' . $template[5];
|
178 |
+
break;
|
179 |
+
|
180 |
+
case VALUE:
|
181 |
+
$out .= $this->_htmlsp($token[1], $plain);
|
182 |
+
if($this->_seeknocomment($key, 1) == SEL_END && $this->parser->get_cfg('remove_last_;')) {
|
183 |
+
$out .= str_replace(';', '', $template[6]);
|
184 |
+
} else {
|
185 |
+
$out .= $template[6];
|
186 |
+
}
|
187 |
+
break;
|
188 |
+
|
189 |
+
case SEL_END:
|
190 |
+
$out .= $template[7];
|
191 |
+
if($this->_seeknocomment($key, 1) != AT_END) $out .= $template[8];
|
192 |
+
break;
|
193 |
+
|
194 |
+
case AT_END:
|
195 |
+
$out =& $output;
|
196 |
+
$out .= $template[10] . str_replace("\n", "\n" . $template[10], $in_at_out);
|
197 |
+
$in_at_out = '';
|
198 |
+
$out .= $template[9];
|
199 |
+
break;
|
200 |
+
|
201 |
+
case COMMENT:
|
202 |
+
$out .= $template[11] . '/*' . $this->_htmlsp($token[1], $plain) . '*/' . $template[12];
|
203 |
+
break;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
|
207 |
+
$output = trim($output);
|
208 |
+
|
209 |
+
if (!$plain) {
|
210 |
+
$this->output_css = $output;
|
211 |
+
$this->_print(true);
|
212 |
+
} else {
|
213 |
+
$this->output_css_plain = $output;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Gets the next token type which is $move away from $key, excluding comments
|
219 |
+
* @param integer $key current position
|
220 |
+
* @param integer $move move this far
|
221 |
+
* @return mixed a token type
|
222 |
+
* @access private
|
223 |
+
* @version 1.0
|
224 |
+
*/
|
225 |
+
function _seeknocomment($key, $move) {
|
226 |
+
$go = ($move > 0) ? 1 : -1;
|
227 |
+
for ($i = $key + 1; abs($key-$i)-1 < abs($move); $i += $go) {
|
228 |
+
if (!isset($this->tokens[$i])) {
|
229 |
+
return;
|
230 |
+
}
|
231 |
+
if ($this->tokens[$i][0] == COMMENT) {
|
232 |
+
$move += 1;
|
233 |
+
continue;
|
234 |
+
}
|
235 |
+
return $this->tokens[$i][0];
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Converts $this->css array to a raw array ($this->tokens)
|
241 |
+
* @access private
|
242 |
+
* @version 1.0
|
243 |
+
*/
|
244 |
+
function _convert_raw_css()
|
245 |
+
{
|
246 |
+
$this->tokens = array();
|
247 |
+
|
248 |
+
foreach ($this->css as $medium => $val)
|
249 |
+
{
|
250 |
+
if ($this->parser->get_cfg('sort_selectors')) ksort($val);
|
251 |
+
if ($medium != DEFAULT_AT) {
|
252 |
+
$this->parser->_add_token(AT_START, $medium, true);
|
253 |
+
}
|
254 |
+
|
255 |
+
foreach ($val as $selector => $vali)
|
256 |
+
{
|
257 |
+
if ($this->parser->get_cfg('sort_properties')) ksort($vali);
|
258 |
+
$this->parser->_add_token(SEL_START, $selector, true);
|
259 |
+
|
260 |
+
foreach ($vali as $property => $valj)
|
261 |
+
{
|
262 |
+
$this->parser->_add_token(PROPERTY, $property, true);
|
263 |
+
$this->parser->_add_token(VALUE, $valj, true);
|
264 |
+
}
|
265 |
+
|
266 |
+
$this->parser->_add_token(SEL_END, $selector, true);
|
267 |
+
}
|
268 |
+
|
269 |
+
if ($medium != DEFAULT_AT) {
|
270 |
+
$this->parser->_add_token(AT_END, $medium, true);
|
271 |
+
}
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Same as htmlspecialchars, only that chars are not replaced if $plain !== true. This makes print_code() cleaner.
|
277 |
+
* @param string $string
|
278 |
+
* @param bool $plain
|
279 |
+
* @return string
|
280 |
+
* @see csstidy_print::_print()
|
281 |
+
* @access private
|
282 |
+
* @version 1.0
|
283 |
+
*/
|
284 |
+
function _htmlsp($string, $plain)
|
285 |
+
{
|
286 |
+
if (!$plain) {
|
287 |
+
return htmlspecialchars($string);
|
288 |
+
}
|
289 |
+
return $string;
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Get compression ratio
|
294 |
+
* @access public
|
295 |
+
* @return float
|
296 |
+
* @version 1.2
|
297 |
+
*/
|
298 |
+
function get_ratio()
|
299 |
+
{
|
300 |
+
if (!$this->output_css_plain) {
|
301 |
+
$this->formatted();
|
302 |
+
}
|
303 |
+
return round((strlen($this->input_css) - strlen($this->output_css_plain)) / strlen($this->input_css), 3) * 100;
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Get difference between the old and new code in bytes and prints the code if necessary.
|
308 |
+
* @access public
|
309 |
+
* @return string
|
310 |
+
* @version 1.1
|
311 |
+
*/
|
312 |
+
function get_diff()
|
313 |
+
{
|
314 |
+
if (!$this->output_css_plain) {
|
315 |
+
$this->formatted();
|
316 |
+
}
|
317 |
+
|
318 |
+
$diff = strlen($this->output_css_plain) - strlen($this->input_css);
|
319 |
+
|
320 |
+
if ($diff > 0) {
|
321 |
+
return '+' . $diff;
|
322 |
+
} elseif ($diff == 0) {
|
323 |
+
return '+-' . $diff;
|
324 |
+
}
|
325 |
+
|
326 |
+
return $diff;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* Get the size of either input or output CSS in KB
|
331 |
+
* @param string $loc default is "output"
|
332 |
+
* @access public
|
333 |
+
* @return integer
|
334 |
+
* @version 1.0
|
335 |
+
*/
|
336 |
+
function size($loc = 'output')
|
337 |
+
{
|
338 |
+
if ($loc == 'output' && !$this->output_css) {
|
339 |
+
$this->formatted();
|
340 |
+
}
|
341 |
+
|
342 |
+
if ($loc == 'input') {
|
343 |
+
return (strlen($this->input_css) / 1000);
|
344 |
+
} else {
|
345 |
+
return (strlen($this->output_css_plain) / 1000);
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
?>
|
css/CSSTidy/css_optimiser.php
ADDED
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
header('Content-Type:text/html; charset=utf-8');
|
3 |
+
require('class.csstidy.php');
|
4 |
+
require('lang.inc.php');
|
5 |
+
|
6 |
+
|
7 |
+
if (isset($_REQUEST['css_text']) && get_magic_quotes_gpc()) {
|
8 |
+
$_REQUEST['css_text'] = stripslashes($_REQUEST['css_text']);
|
9 |
+
}
|
10 |
+
|
11 |
+
function rmdirr($dirname,$oc=0)
|
12 |
+
{
|
13 |
+
// Sanity check
|
14 |
+
if (!file_exists($dirname)) {
|
15 |
+
return false;
|
16 |
+
}
|
17 |
+
// Simple delete for a file
|
18 |
+
if (is_file($dirname) && (time()-fileatime($dirname))>3600) {
|
19 |
+
return unlink($dirname);
|
20 |
+
}
|
21 |
+
// Loop through the folder
|
22 |
+
if(is_dir($dirname))
|
23 |
+
{
|
24 |
+
$dir = dir($dirname);
|
25 |
+
while (false !== $entry = $dir->read()) {
|
26 |
+
// Skip pointers
|
27 |
+
if ($entry == '.' || $entry == '..') {
|
28 |
+
continue;
|
29 |
+
}
|
30 |
+
// Recurse
|
31 |
+
rmdirr("$dirname/$entry",$oc);
|
32 |
+
}
|
33 |
+
$dir->close();
|
34 |
+
}
|
35 |
+
// Clean up
|
36 |
+
if ($oc==1)
|
37 |
+
{
|
38 |
+
return rmdir($dirname);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
function options($options, $selected = null, $labelIsValue = false)
|
43 |
+
{
|
44 |
+
$html = '';
|
45 |
+
|
46 |
+
settype($selected, 'array');
|
47 |
+
settype($options, 'array');
|
48 |
+
|
49 |
+
foreach ($options as $value=>$label)
|
50 |
+
{
|
51 |
+
if (is_array($label)) {
|
52 |
+
$value = $label[0];
|
53 |
+
$label = $label[1];
|
54 |
+
}
|
55 |
+
$label = htmlspecialchars($label, ENT_QUOTES, "utf-8");
|
56 |
+
$value = $labelIsValue ? $label
|
57 |
+
: htmlspecialchars($value, ENT_QUOTES, "utf-8");
|
58 |
+
|
59 |
+
$html .= '<option value="'.$value.'"';
|
60 |
+
if (in_array($value, $selected)) {
|
61 |
+
$html .= ' selected="selected"';
|
62 |
+
}
|
63 |
+
$html .= '>'.$label.'</option>';
|
64 |
+
}
|
65 |
+
if (!$html) {
|
66 |
+
$html .= '<option value="0">---</option>';
|
67 |
+
}
|
68 |
+
|
69 |
+
return $html;
|
70 |
+
}
|
71 |
+
|
72 |
+
$css = new csstidy();
|
73 |
+
if(isset($_REQUEST['custom']) && !empty($_REQUEST['custom']))
|
74 |
+
{
|
75 |
+
setcookie ('custom_template', $_REQUEST['custom'], time()+360000);
|
76 |
+
}
|
77 |
+
rmdirr('temp');
|
78 |
+
|
79 |
+
if(isset($_REQUEST['case_properties'])) $css->set_cfg('case_properties',$_REQUEST['case_properties']);
|
80 |
+
if(isset($_REQUEST['lowercase'])) $css->set_cfg('lowercase_s',true);
|
81 |
+
if(!isset($_REQUEST['compress_c']) && isset($_REQUEST['post'])) $css->set_cfg('compress_colors',false);
|
82 |
+
if(!isset($_REQUEST['compress_fw']) && isset($_REQUEST['post'])) $css->set_cfg('compress_font-weight',false);
|
83 |
+
if(isset($_REQUEST['merge_selectors'])) $css->set_cfg('merge_selectors', $_REQUEST['merge_selectors']);
|
84 |
+
if(isset($_REQUEST['optimise_shorthands'])) $css->set_cfg('optimise_shorthands',$_REQUEST['optimise_shorthands']);
|
85 |
+
if(!isset($_REQUEST['rbs']) && isset($_REQUEST['post'])) $css->set_cfg('remove_bslash',false);
|
86 |
+
if(isset($_REQUEST['preserve_css'])) $css->set_cfg('preserve_css',true);
|
87 |
+
if(isset($_REQUEST['sort_sel'])) $css->set_cfg('sort_selectors',true);
|
88 |
+
if(isset($_REQUEST['sort_de'])) $css->set_cfg('sort_properties',true);
|
89 |
+
if(isset($_REQUEST['remove_last_sem'])) $css->set_cfg('remove_last_;',true);
|
90 |
+
if(isset($_REQUEST['discard'])) $css->set_cfg('discard_invalid_properties',true);
|
91 |
+
if(isset($_REQUEST['css_level'])) $css->set_cfg('css_level',$_REQUEST['css_level']);
|
92 |
+
if(isset($_REQUEST['timestamp'])) $css->set_cfg('timestamp',true);
|
93 |
+
|
94 |
+
?>
|
95 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
96 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
97 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
98 |
+
<head>
|
99 |
+
<title>
|
100 |
+
<?php echo $lang[$l][0]; echo $css->version; ?>)
|
101 |
+
</title>
|
102 |
+
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
103 |
+
<link rel="stylesheet" href="cssparse.css" type="text/css" />
|
104 |
+
<script type="text/javascript">
|
105 |
+
function enable_disable_preserve()
|
106 |
+
{
|
107 |
+
var inputs = new Array('sort_sel', 'sort_de', 'optimise_shorthands', 'merge_selectors', 'none');
|
108 |
+
var inputs_v = new Array( true, true, true, true, false);
|
109 |
+
for(var i = 0; i < inputs.length; i++)
|
110 |
+
{
|
111 |
+
if(document.getElementById('preserve_css').checked) {
|
112 |
+
document.getElementById(inputs[i]).disabled = inputs_v[i];
|
113 |
+
} else {
|
114 |
+
document.getElementById(inputs[i]).disabled = !inputs_v[i];
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
function ClipBoard()
|
119 |
+
{
|
120 |
+
window.clipboardData.setData('Text',document.getElementById("copytext").innerText);
|
121 |
+
}
|
122 |
+
</script>
|
123 |
+
</head>
|
124 |
+
<body onload="enable_disable_preserve()">
|
125 |
+
<div><h1 style="display:inline">
|
126 |
+
<?php echo $lang[$l][1]; ?>
|
127 |
+
</h1>
|
128 |
+
<?php echo $lang[$l][2]; ?> <a
|
129 |
+
href="http://csstidy.sourceforge.net/">csstidy</a> <?php echo $css->version; ?>)
|
130 |
+
</div><p>
|
131 |
+
<?php echo $lang[$l][39]; ?>: <a hreflang="en" href="?lang=en">English</a> <a hreflang="de" href="?lang=de">Deutsch</a> <a hreflang="fr" href="?lang=fr">French</a> <a hreflang="zh" href="?lang=zh">Chinese</a></p>
|
132 |
+
<p><?php echo $lang[$l][4]; ?>
|
133 |
+
<?php echo $lang[$l][6]; ?>
|
134 |
+
</p>
|
135 |
+
|
136 |
+
<form method="post" action="">
|
137 |
+
<div>
|
138 |
+
<fieldset id="field_input">
|
139 |
+
<legend><?php echo $lang[$l][8]; ?></legend> <label for="css_text"
|
140 |
+
class="block"><?php echo $lang[$l][9]; ?></label><textarea id="css_text" name="css_text" rows="20" cols="35"><?php if(isset($_REQUEST['css_text'])) echo htmlspecialchars($_REQUEST['css_text']); ?></textarea>
|
141 |
+
<label for="url"><?php echo $lang[$l][10]; ?></label> <input type="text"
|
142 |
+
name="url" id="url" <?php if(isset($_REQUEST['url']) &&
|
143 |
+
!empty($_REQUEST['url'])) echo 'value="'.$_REQUEST['url'].'"'; ?>
|
144 |
+
size="35" /><br />
|
145 |
+
<input type="submit" value="<?php echo $lang[$l][35]; ?>" id="submit" />
|
146 |
+
</fieldset>
|
147 |
+
<div id="rightcol">
|
148 |
+
<fieldset id="code_layout">
|
149 |
+
<legend><?php echo $lang[$l][11]; ?></legend> <label for="template"
|
150 |
+
class="block"><?php echo $lang[$l][12]; ?></label> <select
|
151 |
+
id="template" name="template" style="margin-bottom:1em;">
|
152 |
+
<?php
|
153 |
+
$num = ($_REQUEST['template']) ? intval($_REQUEST['template']) : 1;
|
154 |
+
echo options(array(3 => $lang[$l][13], 2 => $lang[$l][14], 1 => $lang[$l][15], 0 => $lang[$l][16], 4 => $lang[$l][17]), $num);
|
155 |
+
?>
|
156 |
+
</select><br />
|
157 |
+
<label for="custom" class="block">
|
158 |
+
<?php echo $lang[$l][18]; ?> </label> <textarea id="custom"
|
159 |
+
name="custom" cols="33" rows="4"><?php
|
160 |
+
if(isset($_REQUEST['custom']) && !empty($_REQUEST['custom'])) echo
|
161 |
+
htmlspecialchars($_REQUEST['custom']);
|
162 |
+
elseif(isset($_COOKIE['custom_template']) &&
|
163 |
+
!empty($_COOKIE['custom_template'])) echo
|
164 |
+
htmlspecialchars($_COOKIE['custom_template']);
|
165 |
+
?></textarea>
|
166 |
+
</fieldset>
|
167 |
+
<fieldset id="options">
|
168 |
+
<legend><?php echo $lang[$l][19]; ?></legend>
|
169 |
+
|
170 |
+
<input onchange="enable_disable_preserve()" type="checkbox" name="preserve_css" id="preserve_css"
|
171 |
+
<?php if($css->get_cfg('preserve_css')) echo 'checked="checked"'; ?> />
|
172 |
+
<label for="preserve_css" title="<?php echo $lang[$l][52]; ?>" class="help"><?php echo $lang[$l][51]; ?></label><br />
|
173 |
+
|
174 |
+
|
175 |
+
<input type="checkbox" name="sort_sel" id="sort_sel"
|
176 |
+
<?php if($css->get_cfg('sort_selectors')) echo 'checked="checked"'; ?> />
|
177 |
+
<label for="sort_sel" title="<?php echo $lang[$l][41]; ?>" class="help"><?php echo $lang[$l][20]; ?></label><br />
|
178 |
+
|
179 |
+
|
180 |
+
<input type="checkbox" name="sort_de" id="sort_de"
|
181 |
+
<?php if($css->get_cfg('sort_properties')) echo 'checked="checked"'; ?> />
|
182 |
+
<label for="sort_de"><?php echo $lang[$l][21]; ?></label><br />
|
183 |
+
|
184 |
+
|
185 |
+
<label for="merge_selectors"><?php echo $lang[$l][22]; ?></label>
|
186 |
+
<select style="width:15em;" name="merge_selectors" id="merge_selectors">
|
187 |
+
<?php echo options(array('0' => $lang[$l][47], '1' => $lang[$l][48], '2' => $lang[$l][49]), $css->get_cfg('merge_selectors')); ?>
|
188 |
+
</select><br />
|
189 |
+
|
190 |
+
<label for="optimise_shorthands"><?php echo $lang[$l][23]; ?></label>
|
191 |
+
<select name="optimise_shorthands" id="optimise_shorthands">
|
192 |
+
<?php echo options(array($lang[$l][54], $lang[$l][55], $lang[$l][56]), $css->get_cfg('optimise_shorthands')); ?>
|
193 |
+
</select><br />
|
194 |
+
|
195 |
+
|
196 |
+
<input type="checkbox" name="compress_c" id="compress_c"
|
197 |
+
<?php if($css->get_cfg('compress_colors')) echo 'checked="checked"';?> />
|
198 |
+
<label for="compress_c"><?php echo $lang[$l][24]; ?></label><br />
|
199 |
+
|
200 |
+
|
201 |
+
<input type="checkbox" name="compress_fw" id="compress_fw"
|
202 |
+
<?php if($css->get_cfg('compress_font-weight')) echo 'checked="checked"';?> />
|
203 |
+
<label for="compress_fw"><?php echo $lang[$l][45]; ?></label><br />
|
204 |
+
|
205 |
+
|
206 |
+
<input type="checkbox" name="lowercase" id="lowercase" value="lowercase"
|
207 |
+
<?php if($css->get_cfg('lowercase_s')) echo 'checked="checked"'; ?> />
|
208 |
+
<label title="<?php echo $lang[$l][30]; ?>" class="help" for="lowercase"><?php echo $lang[$l][25]; ?></label><br />
|
209 |
+
|
210 |
+
|
211 |
+
<?php echo $lang[$l][26]; ?><br />
|
212 |
+
<input type="radio" name="case_properties" id="none" value="0"
|
213 |
+
<?php if($css->get_cfg('case_properties') == 0) echo 'checked="checked"'; ?> />
|
214 |
+
<label for="none"><?php echo $lang[$l][53]; ?></label>
|
215 |
+
<input type="radio" name="case_properties" id="lower_yes" value="1"
|
216 |
+
<?php if($css->get_cfg('case_properties') == 1) echo 'checked="checked"'; ?> />
|
217 |
+
<label for="lower_yes"><?php echo $lang[$l][27]; ?></label>
|
218 |
+
<input type="radio" name="case_properties" id="upper_yes" value="2"
|
219 |
+
<?php if($css->get_cfg('case_properties') == 2) echo 'checked="checked"'; ?> />
|
220 |
+
<label for="upper_yes"><?php echo $lang[$l][29]; ?></label><br />
|
221 |
+
|
222 |
+
<input type="checkbox" name="rbs" id="rbs"
|
223 |
+
<?php if($css->get_cfg('remove_bslash')) echo 'checked="checked"'; ?> />
|
224 |
+
<label for="rbs"><?php echo $lang[$l][31]; ?></label><br />
|
225 |
+
|
226 |
+
|
227 |
+
<input type="checkbox" id="remove_last_sem" name="remove_last_sem"
|
228 |
+
<?php if($css->get_cfg('remove_last_;')) echo 'checked="checked"'; ?> />
|
229 |
+
<label for="remove_last_sem"><?php echo $lang[$l][42]; ?></label><br />
|
230 |
+
|
231 |
+
|
232 |
+
<input type="checkbox" id="discard" name="discard"
|
233 |
+
<?php if($css->get_cfg('discard_invalid_properties')) echo 'checked="checked"'; ?> />
|
234 |
+
<label for="discard"><?php echo $lang[$l][43]; ?></label>
|
235 |
+
<select name="css_level"><?php echo options(array('CSS2.1','CSS2.0','CSS1.0'),$css->get_cfg('css_level'), true); ?></select><br />
|
236 |
+
|
237 |
+
|
238 |
+
<input type="checkbox" id="timestamp" name="timestamp"
|
239 |
+
<?php if($css->get_cfg('timestamp')) echo 'checked="checked"'; ?> />
|
240 |
+
<label for="timestamp"><?php echo $lang[$l][57]; ?></label><br />
|
241 |
+
|
242 |
+
|
243 |
+
<input type="checkbox" name="file_output" id="file_output" value="file_output"
|
244 |
+
<?php if(isset($_REQUEST['file_output'])) echo 'checked="checked"'; ?> />
|
245 |
+
<label class="help" title="<?php echo $lang[$l][34]; ?>" for="file_output">
|
246 |
+
<strong><?php echo $lang[$l][33]; ?></strong>
|
247 |
+
</label><br />
|
248 |
+
|
249 |
+
</fieldset>
|
250 |
+
<input type="hidden" name="post" />
|
251 |
+
</div>
|
252 |
+
</div>
|
253 |
+
</form>
|
254 |
+
<?php
|
255 |
+
|
256 |
+
$file_ok = false;
|
257 |
+
$result = false;
|
258 |
+
|
259 |
+
$url = (isset($_REQUEST['url']) && !empty($_REQUEST['url'])) ? $_REQUEST['url'] : false;
|
260 |
+
|
261 |
+
if(isset($_REQUEST['template']))
|
262 |
+
{
|
263 |
+
switch($_REQUEST['template'])
|
264 |
+
{
|
265 |
+
case 4:
|
266 |
+
if(isset($_REQUEST['custom']) && !empty($_REQUEST['custom']))
|
267 |
+
{
|
268 |
+
$css->load_template($_REQUEST['custom'],false);
|
269 |
+
}
|
270 |
+
break;
|
271 |
+
|
272 |
+
case 3:
|
273 |
+
$css->load_template('highest_compression');
|
274 |
+
break;
|
275 |
+
|
276 |
+
case 2:
|
277 |
+
$css->load_template('high_compression');
|
278 |
+
break;
|
279 |
+
|
280 |
+
case 0:
|
281 |
+
$css->load_template('low_compression');
|
282 |
+
break;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
if($url)
|
287 |
+
{
|
288 |
+
if(substr($_REQUEST['url'],0,7) != 'http://')
|
289 |
+
{
|
290 |
+
$_REQUEST['url'] = 'http://'.$_REQUEST['url'];
|
291 |
+
}
|
292 |
+
$result = $css->parse_from_url($_REQUEST['url'],0);
|
293 |
+
}
|
294 |
+
elseif(isset($_REQUEST['css_text']) && strlen($_REQUEST['css_text'])>5)
|
295 |
+
{
|
296 |
+
$result = $css->parse($_REQUEST['css_text']);
|
297 |
+
}
|
298 |
+
|
299 |
+
if($result)
|
300 |
+
{
|
301 |
+
$ratio = $css->print->get_ratio();
|
302 |
+
$diff = $css->print->get_diff();
|
303 |
+
if(isset($_REQUEST['file_output']))
|
304 |
+
{
|
305 |
+
$filename = md5(mt_rand().time().mt_rand());
|
306 |
+
$handle = fopen('temp/'.$filename.'.css','w');
|
307 |
+
if($handle) {
|
308 |
+
if(fwrite($handle,$css->print->plain()))
|
309 |
+
{
|
310 |
+
$file_ok = true;
|
311 |
+
}
|
312 |
+
}
|
313 |
+
fclose($handle);
|
314 |
+
}
|
315 |
+
if($ratio>0) $ratio = '<span style="color:green;">'.$ratio.'%</span>
|
316 |
+
('.$diff.' Bytes)'; else $ratio = '<span
|
317 |
+
style="color:red;">'.$ratio.'%</span> ('.$diff.' Bytes)';
|
318 |
+
if(count($css->log) > 0): ?>
|
319 |
+
<fieldset id="messages"><legend>Messages</legend>
|
320 |
+
<div><dl><?php
|
321 |
+
foreach($css->log as $line => $array)
|
322 |
+
{
|
323 |
+
echo '<dt>'.$line.'</dt>';
|
324 |
+
for($i = 0; $i < count($array); $i++)
|
325 |
+
{
|
326 |
+
echo '<dd class="'.$array[$i]['t'].'">'.$array[$i]['m'].'</dd>';
|
327 |
+
}
|
328 |
+
}
|
329 |
+
?></dl></div>
|
330 |
+
</fieldset>
|
331 |
+
<?php endif;
|
332 |
+
echo '<fieldset><legend>'.$lang[$l][37].': '.$css->print->size('input').'KB, '.$lang[$l][38].':'.$css->print->size('output').'KB, '.$lang[$l][36].': '.$ratio;
|
333 |
+
if($file_ok)
|
334 |
+
{
|
335 |
+
echo ' - <a href="temp/'.$filename.'.css">Download</a>';
|
336 |
+
}
|
337 |
+
echo ' - <a href="javascript:ClipBoard()">Copy to clipboard</a>';
|
338 |
+
echo '</legend>';
|
339 |
+
echo '<pre><code id="copytext">';
|
340 |
+
echo $css->print->formatted();
|
341 |
+
echo '</code></pre>';
|
342 |
+
echo '</fieldset><p><a href="javascript:scrollTo(0,0)">↑ Back to top</a></p>';
|
343 |
+
}
|
344 |
+
elseif(isset($_REQUEST['css_text']) || isset($_REQUEST['url'])) {
|
345 |
+
echo '<p class="important">'.$lang[$l][28].'</p>';
|
346 |
+
}
|
347 |
+
?>
|
348 |
+
<p style="text-align:center;font-size:0.8em;clear:both;">
|
349 |
+
For bugs and suggestions feel free to <a
|
350 |
+
href="http://csstidy.sourceforge.net/contact.php">contact me</a>.
|
351 |
+
</p>
|
352 |
+
</body>
|
353 |
+
</html>
|
css/CSSTidy/cssparse.css
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body {
|
2 |
+
font:0.8em Verdana,Helvetica,sans-serif;
|
3 |
+
background:#F8F8F6;
|
4 |
+
}
|
5 |
+
|
6 |
+
code {
|
7 |
+
font-size:1.2em;
|
8 |
+
}
|
9 |
+
|
10 |
+
div#rightcol {
|
11 |
+
padding-left:32em;
|
12 |
+
}
|
13 |
+
|
14 |
+
fieldset {
|
15 |
+
display:block;
|
16 |
+
margin:0.5em 0;
|
17 |
+
padding:1em;
|
18 |
+
border:solid #7284AB 2px;
|
19 |
+
}
|
20 |
+
|
21 |
+
h1 {
|
22 |
+
font-size:2em;
|
23 |
+
}
|
24 |
+
|
25 |
+
small {
|
26 |
+
font-size:0.7em;
|
27 |
+
}
|
28 |
+
|
29 |
+
fieldset#field_input {
|
30 |
+
float:left;
|
31 |
+
margin:0 0.5em 1em 0;
|
32 |
+
}
|
33 |
+
|
34 |
+
fieldset#options,fieldset#code_layout {
|
35 |
+
width:31em;
|
36 |
+
}
|
37 |
+
|
38 |
+
input#submit {
|
39 |
+
clear:both;
|
40 |
+
display:block;
|
41 |
+
margin:1em;
|
42 |
+
}
|
43 |
+
|
44 |
+
select {
|
45 |
+
margin:2px 0 0;
|
46 |
+
}
|
47 |
+
|
48 |
+
label.block {
|
49 |
+
display:block;
|
50 |
+
}
|
51 |
+
|
52 |
+
legend {
|
53 |
+
background:#c4E1C3;
|
54 |
+
padding:2px 4px;
|
55 |
+
border:dashed 1px;
|
56 |
+
}
|
57 |
+
|
58 |
+
span.at {
|
59 |
+
color:darkblue;
|
60 |
+
}
|
61 |
+
|
62 |
+
span.format {
|
63 |
+
color:gray;
|
64 |
+
}
|
65 |
+
|
66 |
+
span.property {
|
67 |
+
color:green;
|
68 |
+
}
|
69 |
+
|
70 |
+
span.selector {
|
71 |
+
color:blue;
|
72 |
+
}
|
73 |
+
|
74 |
+
span.value {
|
75 |
+
color:red;
|
76 |
+
}
|
77 |
+
|
78 |
+
span.comment {
|
79 |
+
color:orange;
|
80 |
+
}
|
81 |
+
|
82 |
+
textarea#css_text {
|
83 |
+
width:27em;
|
84 |
+
height:370px;
|
85 |
+
display:block;
|
86 |
+
margin-right:1em;
|
87 |
+
}
|
88 |
+
|
89 |
+
.help {
|
90 |
+
cursor:help;
|
91 |
+
}
|
92 |
+
|
93 |
+
p.important {
|
94 |
+
border:solid 1px red;
|
95 |
+
font-weight:bold;
|
96 |
+
padding:1em;
|
97 |
+
background:white;
|
98 |
+
}
|
99 |
+
|
100 |
+
p {
|
101 |
+
margin:1em 0;
|
102 |
+
}
|
103 |
+
|
104 |
+
dl {
|
105 |
+
padding-left:0.5em;
|
106 |
+
}
|
107 |
+
|
108 |
+
dt {
|
109 |
+
font-weight:bold;
|
110 |
+
margin:0;
|
111 |
+
float:left;
|
112 |
+
clear:both;
|
113 |
+
height:1.5em;
|
114 |
+
}
|
115 |
+
|
116 |
+
dd {
|
117 |
+
margin:0 0 0 4em;
|
118 |
+
height:1.5em;
|
119 |
+
}
|
120 |
+
|
121 |
+
fieldset#messages {
|
122 |
+
background:white;
|
123 |
+
padding:0 0 0 1em;
|
124 |
+
}
|
125 |
+
|
126 |
+
fieldset#messages div {
|
127 |
+
height:10em;
|
128 |
+
overflow:auto;
|
129 |
+
}
|
130 |
+
|
131 |
+
dd.Warning {
|
132 |
+
color:orange;
|
133 |
+
}
|
134 |
+
|
135 |
+
dd.Information {
|
136 |
+
color:green;
|
137 |
+
}
|
css/CSSTidy/data.inc.php
ADDED
@@ -0,0 +1,473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Various CSS Data for CSSTidy
|
4 |
+
*
|
5 |
+
* This file is part of CSSTidy.
|
6 |
+
*
|
7 |
+
* CSSTidy is free software; you can redistribute it and/or modify
|
8 |
+
* it under the terms of the GNU General Public License as published by
|
9 |
+
* the Free Software Foundation; either version 2 of the License, or
|
10 |
+
* (at your option) any later version.
|
11 |
+
*
|
12 |
+
* CSSTidy is distributed in the hope that it will be useful,
|
13 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
+
* GNU General Public License for more details.
|
16 |
+
*
|
17 |
+
* You should have received a copy of the GNU General Public License
|
18 |
+
* along with CSSTidy; if not, write to the Free Software
|
19 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
20 |
+
*
|
21 |
+
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
22 |
+
* @package csstidy
|
23 |
+
* @author Florian Schmitz (floele at gmail dot com) 2005
|
24 |
+
*/
|
25 |
+
|
26 |
+
define('AT_START', 1);
|
27 |
+
define('AT_END', 2);
|
28 |
+
define('SEL_START', 3);
|
29 |
+
define('SEL_END', 4);
|
30 |
+
define('PROPERTY', 5);
|
31 |
+
define('VALUE', 6);
|
32 |
+
define('COMMENT', 7);
|
33 |
+
define('DEFAULT_AT', 41);
|
34 |
+
|
35 |
+
/**
|
36 |
+
* All whitespace allowed in CSS
|
37 |
+
*
|
38 |
+
* @global array $GLOBALS['csstidy']['whitespace']
|
39 |
+
* @version 1.0
|
40 |
+
*/
|
41 |
+
$GLOBALS['csstidy']['whitespace'] = array(' ',"\n","\t","\r","\x0B");
|
42 |
+
|
43 |
+
/**
|
44 |
+
* All CSS tokens used by csstidy
|
45 |
+
*
|
46 |
+
* @global string $GLOBALS['csstidy']['tokens']
|
47 |
+
* @version 1.0
|
48 |
+
*/
|
49 |
+
$GLOBALS['csstidy']['tokens'] = '/@}{;:=\'"(,\\!$%&)*+.<>?[]^`|~';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* All CSS units (CSS 3 units included)
|
53 |
+
*
|
54 |
+
* @see compress_numbers()
|
55 |
+
* @global array $GLOBALS['csstidy']['units']
|
56 |
+
* @version 1.0
|
57 |
+
*/
|
58 |
+
$GLOBALS['csstidy']['units'] = array('in','cm','mm','pt','pc','px','rem','em','%','ex','gd','vw','vh','vm','deg','grad','rad','ms','s','khz','hz');
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Available at-rules
|
62 |
+
*
|
63 |
+
* @global array $GLOBALS['csstidy']['at_rules']
|
64 |
+
* @version 1.0
|
65 |
+
*/
|
66 |
+
$GLOBALS['csstidy']['at_rules'] = array('page' => 'is','font-face' => 'is','charset' => 'iv', 'import' => 'iv','namespace' => 'iv','media' => 'at');
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Properties that need a value with unit
|
70 |
+
*
|
71 |
+
* @todo CSS3 properties
|
72 |
+
* @see compress_numbers();
|
73 |
+
* @global array $GLOBALS['csstidy']['unit_values']
|
74 |
+
* @version 1.2
|
75 |
+
*/
|
76 |
+
$GLOBALS['csstidy']['unit_values'] = array ('background', 'background-position', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-width',
|
77 |
+
'border-top-width', 'border-right-width', 'border-left-width', 'border-bottom-width', 'bottom', 'border-spacing', 'font-size',
|
78 |
+
'height', 'left', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'max-height', 'max-width',
|
79 |
+
'min-height', 'min-width', 'outline-width', 'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left',
|
80 |
+
'position', 'right', 'top', 'text-indent', 'letter-spacing', 'word-spacing', 'width');
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Properties that allow <color> as value
|
84 |
+
*
|
85 |
+
* @todo CSS3 properties
|
86 |
+
* @see compress_numbers();
|
87 |
+
* @global array $GLOBALS['csstidy']['color_values']
|
88 |
+
* @version 1.0
|
89 |
+
*/
|
90 |
+
$GLOBALS['csstidy']['color_values'] = array();
|
91 |
+
$GLOBALS['csstidy']['color_values'][] = 'background-color';
|
92 |
+
$GLOBALS['csstidy']['color_values'][] = 'border-color';
|
93 |
+
$GLOBALS['csstidy']['color_values'][] = 'border-top-color';
|
94 |
+
$GLOBALS['csstidy']['color_values'][] = 'border-right-color';
|
95 |
+
$GLOBALS['csstidy']['color_values'][] = 'border-bottom-color';
|
96 |
+
$GLOBALS['csstidy']['color_values'][] = 'border-left-color';
|
97 |
+
$GLOBALS['csstidy']['color_values'][] = 'color';
|
98 |
+
$GLOBALS['csstidy']['color_values'][] = 'outline-color';
|
99 |
+
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Default values for the background properties
|
103 |
+
*
|
104 |
+
* @todo Possibly property names will change during CSS3 development
|
105 |
+
* @global array $GLOBALS['csstidy']['background_prop_default']
|
106 |
+
* @see dissolve_short_bg()
|
107 |
+
* @see merge_bg()
|
108 |
+
* @version 1.0
|
109 |
+
*/
|
110 |
+
$GLOBALS['csstidy']['background_prop_default'] = array();
|
111 |
+
$GLOBALS['csstidy']['background_prop_default']['background-image'] = 'none';
|
112 |
+
$GLOBALS['csstidy']['background_prop_default']['background-size'] = 'auto';
|
113 |
+
$GLOBALS['csstidy']['background_prop_default']['background-repeat'] = 'repeat';
|
114 |
+
$GLOBALS['csstidy']['background_prop_default']['background-position'] = '0 0';
|
115 |
+
$GLOBALS['csstidy']['background_prop_default']['background-attachment'] = 'scroll';
|
116 |
+
$GLOBALS['csstidy']['background_prop_default']['background-clip'] = 'border';
|
117 |
+
$GLOBALS['csstidy']['background_prop_default']['background-origin'] = 'padding';
|
118 |
+
$GLOBALS['csstidy']['background_prop_default']['background-color'] = 'transparent';
|
119 |
+
|
120 |
+
/**
|
121 |
+
* A list of non-W3C color names which get replaced by their hex-codes
|
122 |
+
*
|
123 |
+
* @global array $GLOBALS['csstidy']['replace_colors']
|
124 |
+
* @see cut_color()
|
125 |
+
* @version 1.0
|
126 |
+
*/
|
127 |
+
$GLOBALS['csstidy']['replace_colors'] = array();
|
128 |
+
$GLOBALS['csstidy']['replace_colors']['aliceblue'] = '#F0F8FF';
|
129 |
+
$GLOBALS['csstidy']['replace_colors']['antiquewhite'] = '#FAEBD7';
|
130 |
+
$GLOBALS['csstidy']['replace_colors']['aquamarine'] = '#7FFFD4';
|
131 |
+
$GLOBALS['csstidy']['replace_colors']['azure'] = '#F0FFFF';
|
132 |
+
$GLOBALS['csstidy']['replace_colors']['beige'] = '#F5F5DC';
|
133 |
+
$GLOBALS['csstidy']['replace_colors']['bisque'] = '#FFE4C4';
|
134 |
+
$GLOBALS['csstidy']['replace_colors']['blanchedalmond'] = '#FFEBCD';
|
135 |
+
$GLOBALS['csstidy']['replace_colors']['blueviolet'] = '#8A2BE2';
|
136 |
+
$GLOBALS['csstidy']['replace_colors']['brown'] = '#A52A2A';
|
137 |
+
$GLOBALS['csstidy']['replace_colors']['burlywood'] = '#DEB887';
|
138 |
+
$GLOBALS['csstidy']['replace_colors']['cadetblue'] = '#5F9EA0';
|
139 |
+
$GLOBALS['csstidy']['replace_colors']['chartreuse'] = '#7FFF00';
|
140 |
+
$GLOBALS['csstidy']['replace_colors']['chocolate'] = '#D2691E';
|
141 |
+
$GLOBALS['csstidy']['replace_colors']['coral'] = '#FF7F50';
|
142 |
+
$GLOBALS['csstidy']['replace_colors']['cornflowerblue'] = '#6495ED';
|
143 |
+
$GLOBALS['csstidy']['replace_colors']['cornsilk'] = '#FFF8DC';
|
144 |
+
$GLOBALS['csstidy']['replace_colors']['crimson'] = '#DC143C';
|
145 |
+
$GLOBALS['csstidy']['replace_colors']['cyan'] = '#00FFFF';
|
146 |
+
$GLOBALS['csstidy']['replace_colors']['darkblue'] = '#00008B';
|
147 |
+
$GLOBALS['csstidy']['replace_colors']['darkcyan'] = '#008B8B';
|
148 |
+
$GLOBALS['csstidy']['replace_colors']['darkgoldenrod'] = '#B8860B';
|
149 |
+
$GLOBALS['csstidy']['replace_colors']['darkgray'] = '#A9A9A9';
|
150 |
+
$GLOBALS['csstidy']['replace_colors']['darkgreen'] = '#006400';
|
151 |
+
$GLOBALS['csstidy']['replace_colors']['darkkhaki'] = '#BDB76B';
|
152 |
+
$GLOBALS['csstidy']['replace_colors']['darkmagenta'] = '#8B008B';
|
153 |
+
$GLOBALS['csstidy']['replace_colors']['darkolivegreen'] = '#556B2F';
|
154 |
+
$GLOBALS['csstidy']['replace_colors']['darkorange'] = '#FF8C00';
|
155 |
+
$GLOBALS['csstidy']['replace_colors']['darkorchid'] = '#9932CC';
|
156 |
+
$GLOBALS['csstidy']['replace_colors']['darkred'] = '#8B0000';
|
157 |
+
$GLOBALS['csstidy']['replace_colors']['darksalmon'] = '#E9967A';
|
158 |
+
$GLOBALS['csstidy']['replace_colors']['darkseagreen'] = '#8FBC8F';
|
159 |
+
$GLOBALS['csstidy']['replace_colors']['darkslateblue'] = '#483D8B';
|
160 |
+
$GLOBALS['csstidy']['replace_colors']['darkslategray'] = '#2F4F4F';
|
161 |
+
$GLOBALS['csstidy']['replace_colors']['darkturquoise'] = '#00CED1';
|
162 |
+
$GLOBALS['csstidy']['replace_colors']['darkviolet'] = '#9400D3';
|
163 |
+
$GLOBALS['csstidy']['replace_colors']['deeppink'] = '#FF1493';
|
164 |
+
$GLOBALS['csstidy']['replace_colors']['deepskyblue'] = '#00BFFF';
|
165 |
+
$GLOBALS['csstidy']['replace_colors']['dimgray'] = '#696969';
|
166 |
+
$GLOBALS['csstidy']['replace_colors']['dodgerblue'] = '#1E90FF';
|
167 |
+
$GLOBALS['csstidy']['replace_colors']['feldspar'] = '#D19275';
|
168 |
+
$GLOBALS['csstidy']['replace_colors']['firebrick'] = '#B22222';
|
169 |
+
$GLOBALS['csstidy']['replace_colors']['floralwhite'] = '#FFFAF0';
|
170 |
+
$GLOBALS['csstidy']['replace_colors']['forestgreen'] = '#228B22';
|
171 |
+
$GLOBALS['csstidy']['replace_colors']['gainsboro'] = '#DCDCDC';
|
172 |
+
$GLOBALS['csstidy']['replace_colors']['ghostwhite'] = '#F8F8FF';
|
173 |
+
$GLOBALS['csstidy']['replace_colors']['gold'] = '#FFD700';
|
174 |
+
$GLOBALS['csstidy']['replace_colors']['goldenrod'] = '#DAA520';
|
175 |
+
$GLOBALS['csstidy']['replace_colors']['greenyellow'] = '#ADFF2F';
|
176 |
+
$GLOBALS['csstidy']['replace_colors']['honeydew'] = '#F0FFF0';
|
177 |
+
$GLOBALS['csstidy']['replace_colors']['hotpink'] = '#FF69B4';
|
178 |
+
$GLOBALS['csstidy']['replace_colors']['indianred'] = '#CD5C5C';
|
179 |
+
$GLOBALS['csstidy']['replace_colors']['indigo'] = '#4B0082';
|
180 |
+
$GLOBALS['csstidy']['replace_colors']['ivory'] = '#FFFFF0';
|
181 |
+
$GLOBALS['csstidy']['replace_colors']['khaki'] = '#F0E68C';
|
182 |
+
$GLOBALS['csstidy']['replace_colors']['lavender'] = '#E6E6FA';
|
183 |
+
$GLOBALS['csstidy']['replace_colors']['lavenderblush'] = '#FFF0F5';
|
184 |
+
$GLOBALS['csstidy']['replace_colors']['lawngreen'] = '#7CFC00';
|
185 |
+
$GLOBALS['csstidy']['replace_colors']['lemonchiffon'] = '#FFFACD';
|
186 |
+
$GLOBALS['csstidy']['replace_colors']['lightblue'] = '#ADD8E6';
|
187 |
+
$GLOBALS['csstidy']['replace_colors']['lightcoral'] = '#F08080';
|
188 |
+
$GLOBALS['csstidy']['replace_colors']['lightcyan'] = '#E0FFFF';
|
189 |
+
$GLOBALS['csstidy']['replace_colors']['lightgoldenrodyellow'] = '#FAFAD2';
|
190 |
+
$GLOBALS['csstidy']['replace_colors']['lightgrey'] = '#D3D3D3';
|
191 |
+
$GLOBALS['csstidy']['replace_colors']['lightgreen'] = '#90EE90';
|
192 |
+
$GLOBALS['csstidy']['replace_colors']['lightpink'] = '#FFB6C1';
|
193 |
+
$GLOBALS['csstidy']['replace_colors']['lightsalmon'] = '#FFA07A';
|
194 |
+
$GLOBALS['csstidy']['replace_colors']['lightseagreen'] = '#20B2AA';
|
195 |
+
$GLOBALS['csstidy']['replace_colors']['lightskyblue'] = '#87CEFA';
|
196 |
+
$GLOBALS['csstidy']['replace_colors']['lightslateblue'] = '#8470FF';
|
197 |
+
$GLOBALS['csstidy']['replace_colors']['lightslategray'] = '#778899';
|
198 |
+
$GLOBALS['csstidy']['replace_colors']['lightsteelblue'] = '#B0C4DE';
|
199 |
+
$GLOBALS['csstidy']['replace_colors']['lightyellow'] = '#FFFFE0';
|
200 |
+
$GLOBALS['csstidy']['replace_colors']['limegreen'] = '#32CD32';
|
201 |
+
$GLOBALS['csstidy']['replace_colors']['linen'] = '#FAF0E6';
|
202 |
+
$GLOBALS['csstidy']['replace_colors']['magenta'] = '#FF00FF';
|
203 |
+
$GLOBALS['csstidy']['replace_colors']['mediumaquamarine'] = '#66CDAA';
|
204 |
+
$GLOBALS['csstidy']['replace_colors']['mediumblue'] = '#0000CD';
|
205 |
+
$GLOBALS['csstidy']['replace_colors']['mediumorchid'] = '#BA55D3';
|
206 |
+
$GLOBALS['csstidy']['replace_colors']['mediumpurple'] = '#9370D8';
|
207 |
+
$GLOBALS['csstidy']['replace_colors']['mediumseagreen'] = '#3CB371';
|
208 |
+
$GLOBALS['csstidy']['replace_colors']['mediumslateblue'] = '#7B68EE';
|
209 |
+
$GLOBALS['csstidy']['replace_colors']['mediumspringgreen'] = '#00FA9A';
|
210 |
+
$GLOBALS['csstidy']['replace_colors']['mediumturquoise'] = '#48D1CC';
|
211 |
+
$GLOBALS['csstidy']['replace_colors']['mediumvioletred'] = '#C71585';
|
212 |
+
$GLOBALS['csstidy']['replace_colors']['midnightblue'] = '#191970';
|
213 |
+
$GLOBALS['csstidy']['replace_colors']['mintcream'] = '#F5FFFA';
|
214 |
+
$GLOBALS['csstidy']['replace_colors']['mistyrose'] = '#FFE4E1';
|
215 |
+
$GLOBALS['csstidy']['replace_colors']['moccasin'] = '#FFE4B5';
|
216 |
+
$GLOBALS['csstidy']['replace_colors']['navajowhite'] = '#FFDEAD';
|
217 |
+
$GLOBALS['csstidy']['replace_colors']['oldlace'] = '#FDF5E6';
|
218 |
+
$GLOBALS['csstidy']['replace_colors']['olivedrab'] = '#6B8E23';
|
219 |
+
$GLOBALS['csstidy']['replace_colors']['orangered'] = '#FF4500';
|
220 |
+
$GLOBALS['csstidy']['replace_colors']['orchid'] = '#DA70D6';
|
221 |
+
$GLOBALS['csstidy']['replace_colors']['palegoldenrod'] = '#EEE8AA';
|
222 |
+
$GLOBALS['csstidy']['replace_colors']['palegreen'] = '#98FB98';
|
223 |
+
$GLOBALS['csstidy']['replace_colors']['paleturquoise'] = '#AFEEEE';
|
224 |
+
$GLOBALS['csstidy']['replace_colors']['palevioletred'] = '#D87093';
|
225 |
+
$GLOBALS['csstidy']['replace_colors']['papayawhip'] = '#FFEFD5';
|
226 |
+
$GLOBALS['csstidy']['replace_colors']['peachpuff'] = '#FFDAB9';
|
227 |
+
$GLOBALS['csstidy']['replace_colors']['peru'] = '#CD853F';
|
228 |
+
$GLOBALS['csstidy']['replace_colors']['pink'] = '#FFC0CB';
|
229 |
+
$GLOBALS['csstidy']['replace_colors']['plum'] = '#DDA0DD';
|
230 |
+
$GLOBALS['csstidy']['replace_colors']['powderblue'] = '#B0E0E6';
|
231 |
+
$GLOBALS['csstidy']['replace_colors']['rosybrown'] = '#BC8F8F';
|
232 |
+
$GLOBALS['csstidy']['replace_colors']['royalblue'] = '#4169E1';
|
233 |
+
$GLOBALS['csstidy']['replace_colors']['saddlebrown'] = '#8B4513';
|
234 |
+
$GLOBALS['csstidy']['replace_colors']['salmon'] = '#FA8072';
|
235 |
+
$GLOBALS['csstidy']['replace_colors']['sandybrown'] = '#F4A460';
|
236 |
+
$GLOBALS['csstidy']['replace_colors']['seagreen'] = '#2E8B57';
|
237 |
+
$GLOBALS['csstidy']['replace_colors']['seashell'] = '#FFF5EE';
|
238 |
+
$GLOBALS['csstidy']['replace_colors']['sienna'] = '#A0522D';
|
239 |
+
$GLOBALS['csstidy']['replace_colors']['skyblue'] = '#87CEEB';
|
240 |
+
$GLOBALS['csstidy']['replace_colors']['slateblue'] = '#6A5ACD';
|
241 |
+
$GLOBALS['csstidy']['replace_colors']['slategray'] = '#708090';
|
242 |
+
$GLOBALS['csstidy']['replace_colors']['snow'] = '#FFFAFA';
|
243 |
+
$GLOBALS['csstidy']['replace_colors']['springgreen'] = '#00FF7F';
|
244 |
+
$GLOBALS['csstidy']['replace_colors']['steelblue'] = '#4682B4';
|
245 |
+
$GLOBALS['csstidy']['replace_colors']['tan'] = '#D2B48C';
|
246 |
+
$GLOBALS['csstidy']['replace_colors']['thistle'] = '#D8BFD8';
|
247 |
+
$GLOBALS['csstidy']['replace_colors']['tomato'] = '#FF6347';
|
248 |
+
$GLOBALS['csstidy']['replace_colors']['turquoise'] = '#40E0D0';
|
249 |
+
$GLOBALS['csstidy']['replace_colors']['violet'] = '#EE82EE';
|
250 |
+
$GLOBALS['csstidy']['replace_colors']['violetred'] = '#D02090';
|
251 |
+
$GLOBALS['csstidy']['replace_colors']['wheat'] = '#F5DEB3';
|
252 |
+
$GLOBALS['csstidy']['replace_colors']['whitesmoke'] = '#F5F5F5';
|
253 |
+
$GLOBALS['csstidy']['replace_colors']['yellowgreen'] = '#9ACD32';
|
254 |
+
|
255 |
+
|
256 |
+
/**
|
257 |
+
* A list of all shorthand properties that are devided into four properties and/or have four subvalues
|
258 |
+
*
|
259 |
+
* @global array $GLOBALS['csstidy']['shorthands']
|
260 |
+
* @todo Are there new ones in CSS3?
|
261 |
+
* @see dissolve_4value_shorthands()
|
262 |
+
* @see merge_4value_shorthands()
|
263 |
+
* @version 1.0
|
264 |
+
*/
|
265 |
+
$GLOBALS['csstidy']['shorthands'] = array();
|
266 |
+
$GLOBALS['csstidy']['shorthands']['border-color'] = array('border-top-color','border-right-color','border-bottom-color','border-left-color');
|
267 |
+
$GLOBALS['csstidy']['shorthands']['border-style'] = array('border-top-style','border-right-style','border-bottom-style','border-left-style');
|
268 |
+
$GLOBALS['csstidy']['shorthands']['border-width'] = array('border-top-width','border-right-width','border-bottom-width','border-left-width');
|
269 |
+
$GLOBALS['csstidy']['shorthands']['margin'] = array('margin-top','margin-right','margin-bottom','margin-left');
|
270 |
+
$GLOBALS['csstidy']['shorthands']['padding'] = array('padding-top','padding-right','padding-bottom','padding-left');
|
271 |
+
$GLOBALS['csstidy']['shorthands']['-moz-border-radius'] = 0;
|
272 |
+
|
273 |
+
/**
|
274 |
+
* All CSS Properties. Needed for csstidy::property_is_next()
|
275 |
+
*
|
276 |
+
* @global array $GLOBALS['csstidy']['all_properties']
|
277 |
+
* @todo Add CSS3 properties
|
278 |
+
* @version 1.0
|
279 |
+
* @see csstidy::property_is_next()
|
280 |
+
*/
|
281 |
+
$GLOBALS['csstidy']['all_properties'] = array();
|
282 |
+
$GLOBALS['csstidy']['all_properties']['background'] = 'CSS1.0,CSS2.0,CSS2.1';
|
283 |
+
$GLOBALS['csstidy']['all_properties']['background-color'] = 'CSS1.0,CSS2.0,CSS2.1';
|
284 |
+
$GLOBALS['csstidy']['all_properties']['background-image'] = 'CSS1.0,CSS2.0,CSS2.1';
|
285 |
+
$GLOBALS['csstidy']['all_properties']['background-repeat'] = 'CSS1.0,CSS2.0,CSS2.1';
|
286 |
+
$GLOBALS['csstidy']['all_properties']['background-attachment'] = 'CSS1.0,CSS2.0,CSS2.1';
|
287 |
+
$GLOBALS['csstidy']['all_properties']['background-position'] = 'CSS1.0,CSS2.0,CSS2.1';
|
288 |
+
$GLOBALS['csstidy']['all_properties']['border'] = 'CSS1.0,CSS2.0,CSS2.1';
|
289 |
+
$GLOBALS['csstidy']['all_properties']['border-top'] = 'CSS1.0,CSS2.0,CSS2.1';
|
290 |
+
$GLOBALS['csstidy']['all_properties']['border-right'] = 'CSS1.0,CSS2.0,CSS2.1';
|
291 |
+
$GLOBALS['csstidy']['all_properties']['border-bottom'] = 'CSS1.0,CSS2.0,CSS2.1';
|
292 |
+
$GLOBALS['csstidy']['all_properties']['border-left'] = 'CSS1.0,CSS2.0,CSS2.1';
|
293 |
+
$GLOBALS['csstidy']['all_properties']['border-color'] = 'CSS1.0,CSS2.0,CSS2.1';
|
294 |
+
$GLOBALS['csstidy']['all_properties']['border-top-color'] = 'CSS2.0,CSS2.1';
|
295 |
+
$GLOBALS['csstidy']['all_properties']['border-bottom-color'] = 'CSS2.0,CSS2.1';
|
296 |
+
$GLOBALS['csstidy']['all_properties']['border-left-color'] = 'CSS2.0,CSS2.1';
|
297 |
+
$GLOBALS['csstidy']['all_properties']['border-right-color'] = 'CSS2.0,CSS2.1';
|
298 |
+
$GLOBALS['csstidy']['all_properties']['border-style'] = 'CSS1.0,CSS2.0,CSS2.1';
|
299 |
+
$GLOBALS['csstidy']['all_properties']['border-top-style'] = 'CSS2.0,CSS2.1';
|
300 |
+
$GLOBALS['csstidy']['all_properties']['border-right-style'] = 'CSS2.0,CSS2.1';
|
301 |
+
$GLOBALS['csstidy']['all_properties']['border-left-style'] = 'CSS2.0,CSS2.1';
|
302 |
+
$GLOBALS['csstidy']['all_properties']['border-bottom-style'] = 'CSS2.0,CSS2.1';
|
303 |
+
$GLOBALS['csstidy']['all_properties']['border-width'] = 'CSS1.0,CSS2.0,CSS2.1';
|
304 |
+
$GLOBALS['csstidy']['all_properties']['border-top-width'] = 'CSS1.0,CSS2.0,CSS2.1';
|
305 |
+
$GLOBALS['csstidy']['all_properties']['border-right-width'] = 'CSS1.0,CSS2.0,CSS2.1';
|
306 |
+
$GLOBALS['csstidy']['all_properties']['border-left-width'] = 'CSS1.0,CSS2.0,CSS2.1';
|
307 |
+
$GLOBALS['csstidy']['all_properties']['border-bottom-width'] = 'CSS1.0,CSS2.0,CSS2.1';
|
308 |
+
$GLOBALS['csstidy']['all_properties']['border-collapse'] = 'CSS2.0,CSS2.1';
|
309 |
+
$GLOBALS['csstidy']['all_properties']['border-spacing'] = 'CSS2.0,CSS2.1';
|
310 |
+
$GLOBALS['csstidy']['all_properties']['bottom'] = 'CSS2.0,CSS2.1';
|
311 |
+
$GLOBALS['csstidy']['all_properties']['caption-side'] = 'CSS2.0,CSS2.1';
|
312 |
+
$GLOBALS['csstidy']['all_properties']['content'] = 'CSS2.0,CSS2.1';
|
313 |
+
$GLOBALS['csstidy']['all_properties']['clear'] = 'CSS1.0,CSS2.0,CSS2.1';
|
314 |
+
$GLOBALS['csstidy']['all_properties']['clip'] = 'CSS1.0,CSS2.0,CSS2.1';
|
315 |
+
$GLOBALS['csstidy']['all_properties']['color'] = 'CSS1.0,CSS2.0,CSS2.1';
|
316 |
+
$GLOBALS['csstidy']['all_properties']['counter-reset'] = 'CSS2.0,CSS2.1';
|
317 |
+
$GLOBALS['csstidy']['all_properties']['counter-increment'] = 'CSS2.0,CSS2.1';
|
318 |
+
$GLOBALS['csstidy']['all_properties']['cursor'] = 'CSS2.0,CSS2.1';
|
319 |
+
$GLOBALS['csstidy']['all_properties']['empty-cells'] = 'CSS2.0,CSS2.1';
|
320 |
+
$GLOBALS['csstidy']['all_properties']['display'] = 'CSS1.0,CSS2.0,CSS2.1';
|
321 |
+
$GLOBALS['csstidy']['all_properties']['direction'] = 'CSS2.0,CSS2.1';
|
322 |
+
$GLOBALS['csstidy']['all_properties']['float'] = 'CSS1.0,CSS2.0,CSS2.1';
|
323 |
+
$GLOBALS['csstidy']['all_properties']['font'] = 'CSS1.0,CSS2.0,CSS2.1';
|
324 |
+
$GLOBALS['csstidy']['all_properties']['font-family'] = 'CSS1.0,CSS2.0,CSS2.1';
|
325 |
+
$GLOBALS['csstidy']['all_properties']['font-style'] = 'CSS1.0,CSS2.0,CSS2.1';
|
326 |
+
$GLOBALS['csstidy']['all_properties']['font-variant'] = 'CSS1.0,CSS2.0,CSS2.1';
|
327 |
+
$GLOBALS['csstidy']['all_properties']['font-weight'] = 'CSS1.0,CSS2.0,CSS2.1';
|
328 |
+
$GLOBALS['csstidy']['all_properties']['font-stretch'] = 'CSS2.0';
|
329 |
+
$GLOBALS['csstidy']['all_properties']['font-size-adjust'] = 'CSS2.0';
|
330 |
+
$GLOBALS['csstidy']['all_properties']['font-size'] = 'CSS1.0,CSS2.0,CSS2.1';
|
331 |
+
$GLOBALS['csstidy']['all_properties']['height'] = 'CSS1.0,CSS2.0,CSS2.1';
|
332 |
+
$GLOBALS['csstidy']['all_properties']['left'] = 'CSS1.0,CSS2.0,CSS2.1';
|
333 |
+
$GLOBALS['csstidy']['all_properties']['line-height'] = 'CSS1.0,CSS2.0,CSS2.1';
|
334 |
+
$GLOBALS['csstidy']['all_properties']['list-style'] = 'CSS1.0,CSS2.0,CSS2.1';
|
335 |
+
$GLOBALS['csstidy']['all_properties']['list-style-type'] = 'CSS1.0,CSS2.0,CSS2.1';
|
336 |
+
$GLOBALS['csstidy']['all_properties']['list-style-image'] = 'CSS1.0,CSS2.0,CSS2.1';
|
337 |
+
$GLOBALS['csstidy']['all_properties']['list-style-position'] = 'CSS1.0,CSS2.0,CSS2.1';
|
338 |
+
$GLOBALS['csstidy']['all_properties']['margin'] = 'CSS1.0,CSS2.0,CSS2.1';
|
339 |
+
$GLOBALS['csstidy']['all_properties']['margin-top'] = 'CSS1.0,CSS2.0,CSS2.1';
|
340 |
+
$GLOBALS['csstidy']['all_properties']['margin-right'] = 'CSS1.0,CSS2.0,CSS2.1';
|
341 |
+
$GLOBALS['csstidy']['all_properties']['margin-bottom'] = 'CSS1.0,CSS2.0,CSS2.1';
|
342 |
+
$GLOBALS['csstidy']['all_properties']['margin-left'] = 'CSS1.0,CSS2.0,CSS2.1';
|
343 |
+
$GLOBALS['csstidy']['all_properties']['marks'] = 'CSS1.0,CSS2.0';
|
344 |
+
$GLOBALS['csstidy']['all_properties']['marker-offset'] = 'CSS2.0';
|
345 |
+
$GLOBALS['csstidy']['all_properties']['max-height'] = 'CSS2.0,CSS2.1';
|
346 |
+
$GLOBALS['csstidy']['all_properties']['max-width'] = 'CSS2.0,CSS2.1';
|
347 |
+
$GLOBALS['csstidy']['all_properties']['min-height'] = 'CSS2.0,CSS2.1';
|
348 |
+
$GLOBALS['csstidy']['all_properties']['min-width'] = 'CSS2.0,CSS2.1';
|
349 |
+
$GLOBALS['csstidy']['all_properties']['overflow'] = 'CSS1.0,CSS2.0,CSS2.1';
|
350 |
+
$GLOBALS['csstidy']['all_properties']['orphans'] = 'CSS2.0,CSS2.1';
|
351 |
+
$GLOBALS['csstidy']['all_properties']['outline'] = 'CSS2.0,CSS2.1';
|
352 |
+
$GLOBALS['csstidy']['all_properties']['outline-width'] = 'CSS2.0,CSS2.1';
|
353 |
+
$GLOBALS['csstidy']['all_properties']['outline-style'] = 'CSS2.0,CSS2.1';
|
354 |
+
$GLOBALS['csstidy']['all_properties']['outline-color'] = 'CSS2.0,CSS2.1';
|
355 |
+
$GLOBALS['csstidy']['all_properties']['padding'] = 'CSS1.0,CSS2.0,CSS2.1';
|
356 |
+
$GLOBALS['csstidy']['all_properties']['padding-top'] = 'CSS1.0,CSS2.0,CSS2.1';
|
357 |
+
$GLOBALS['csstidy']['all_properties']['padding-right'] = 'CSS1.0,CSS2.0,CSS2.1';
|
358 |
+
$GLOBALS['csstidy']['all_properties']['padding-bottom'] = 'CSS1.0,CSS2.0,CSS2.1';
|
359 |
+
$GLOBALS['csstidy']['all_properties']['padding-left'] = 'CSS1.0,CSS2.0,CSS2.1';
|
360 |
+
$GLOBALS['csstidy']['all_properties']['page-break-before'] = 'CSS1.0,CSS2.0,CSS2.1';
|
361 |
+
$GLOBALS['csstidy']['all_properties']['page-break-after'] = 'CSS1.0,CSS2.0,CSS2.1';
|
362 |
+
$GLOBALS['csstidy']['all_properties']['page-break-inside'] = 'CSS2.0,CSS2.1';
|
363 |
+
$GLOBALS['csstidy']['all_properties']['page'] = 'CSS2.0';
|
364 |
+
$GLOBALS['csstidy']['all_properties']['position'] = 'CSS1.0,CSS2.0,CSS2.1';
|
365 |
+
$GLOBALS['csstidy']['all_properties']['quotes'] = 'CSS2.0,CSS2.1';
|
366 |
+
$GLOBALS['csstidy']['all_properties']['right'] = 'CSS2.0,CSS2.1';
|
367 |
+
$GLOBALS['csstidy']['all_properties']['size'] = 'CSS1.0,CSS2.0';
|
368 |
+
$GLOBALS['csstidy']['all_properties']['speak-header'] = 'CSS2.0,CSS2.1';
|
369 |
+
$GLOBALS['csstidy']['all_properties']['table-layout'] = 'CSS2.0,CSS2.1';
|
370 |
+
$GLOBALS['csstidy']['all_properties']['top'] = 'CSS1.0,CSS2.0,CSS2.1';
|
371 |
+
$GLOBALS['csstidy']['all_properties']['text-indent'] = 'CSS1.0,CSS2.0,CSS2.1';
|
372 |
+
$GLOBALS['csstidy']['all_properties']['text-align'] = 'CSS1.0,CSS2.0,CSS2.1';
|
373 |
+
$GLOBALS['csstidy']['all_properties']['text-decoration'] = 'CSS1.0,CSS2.0,CSS2.1';
|
374 |
+
$GLOBALS['csstidy']['all_properties']['text-shadow'] = 'CSS2.0';
|
375 |
+
$GLOBALS['csstidy']['all_properties']['letter-spacing'] = 'CSS1.0,CSS2.0,CSS2.1';
|
376 |
+
$GLOBALS['csstidy']['all_properties']['word-spacing'] = 'CSS1.0,CSS2.0,CSS2.1';
|
377 |
+
$GLOBALS['csstidy']['all_properties']['text-transform'] = 'CSS1.0,CSS2.0,CSS2.1';
|
378 |
+
$GLOBALS['csstidy']['all_properties']['white-space'] = 'CSS1.0,CSS2.0,CSS2.1';
|
379 |
+
$GLOBALS['csstidy']['all_properties']['unicode-bidi'] = 'CSS2.0,CSS2.1';
|
380 |
+
$GLOBALS['csstidy']['all_properties']['vertical-align'] = 'CSS1.0,CSS2.0,CSS2.1';
|
381 |
+
$GLOBALS['csstidy']['all_properties']['visibility'] = 'CSS1.0,CSS2.0,CSS2.1';
|
382 |
+
$GLOBALS['csstidy']['all_properties']['width'] = 'CSS1.0,CSS2.0,CSS2.1';
|
383 |
+
$GLOBALS['csstidy']['all_properties']['widows'] = 'CSS2.0,CSS2.1';
|
384 |
+
$GLOBALS['csstidy']['all_properties']['z-index'] = 'CSS1.0,CSS2.0,CSS2.1';
|
385 |
+
/* Speech */
|
386 |
+
$GLOBALS['csstidy']['all_properties']['volume'] = 'CSS2.0,CSS2.1';
|
387 |
+
$GLOBALS['csstidy']['all_properties']['speak'] = 'CSS2.0,CSS2.1';
|
388 |
+
$GLOBALS['csstidy']['all_properties']['pause'] = 'CSS2.0,CSS2.1';
|
389 |
+
$GLOBALS['csstidy']['all_properties']['pause-before'] = 'CSS2.0,CSS2.1';
|
390 |
+
$GLOBALS['csstidy']['all_properties']['pause-after'] = 'CSS2.0,CSS2.1';
|
391 |
+
$GLOBALS['csstidy']['all_properties']['cue'] = 'CSS2.0,CSS2.1';
|
392 |
+
$GLOBALS['csstidy']['all_properties']['cue-before'] = 'CSS2.0,CSS2.1';
|
393 |
+
$GLOBALS['csstidy']['all_properties']['cue-after'] = 'CSS2.0,CSS2.1';
|
394 |
+
$GLOBALS['csstidy']['all_properties']['play-during'] = 'CSS2.0,CSS2.1';
|
395 |
+
$GLOBALS['csstidy']['all_properties']['azimuth'] = 'CSS2.0,CSS2.1';
|
396 |
+
$GLOBALS['csstidy']['all_properties']['elevation'] = 'CSS2.0,CSS2.1';
|
397 |
+
$GLOBALS['csstidy']['all_properties']['speech-rate'] = 'CSS2.0,CSS2.1';
|
398 |
+
$GLOBALS['csstidy']['all_properties']['voice-family'] = 'CSS2.0,CSS2.1';
|
399 |
+
$GLOBALS['csstidy']['all_properties']['pitch'] = 'CSS2.0,CSS2.1';
|
400 |
+
$GLOBALS['csstidy']['all_properties']['pitch-range'] = 'CSS2.0,CSS2.1';
|
401 |
+
$GLOBALS['csstidy']['all_properties']['stress'] = 'CSS2.0,CSS2.1';
|
402 |
+
$GLOBALS['csstidy']['all_properties']['richness'] = 'CSS2.0,CSS2.1';
|
403 |
+
$GLOBALS['csstidy']['all_properties']['speak-punctuation'] = 'CSS2.0,CSS2.1';
|
404 |
+
$GLOBALS['csstidy']['all_properties']['speak-numeral'] = 'CSS2.0,CSS2.1';
|
405 |
+
|
406 |
+
/**
|
407 |
+
* An array containing all predefined templates.
|
408 |
+
*
|
409 |
+
* @global array $GLOBALS['csstidy']['predefined_templates']
|
410 |
+
* @version 1.0
|
411 |
+
* @see csstidy::load_template()
|
412 |
+
*/
|
413 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '<span class="at">'; //string before @rule
|
414 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '</span> <span class="format">{</span>'."\n"; //bracket after @-rule
|
415 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '<span class="selector">'; //string before selector
|
416 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '</span> <span class="format">{</span>'."\n"; //bracket after selector
|
417 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '<span class="property">'; //string before property
|
418 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '</span><span class="value">'; //string after property+before value
|
419 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '</span><span class="format">;</span>'."\n"; //string after value
|
420 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '<span class="format">}</span>'; //closing bracket - selector
|
421 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = "\n\n"; //space between blocks {...}
|
422 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = "\n".'<span class="format">}</span>'. "\n\n"; //closing bracket @-rule
|
423 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = ''; //indent in @-rule
|
424 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '<span class="comment">'; // before comment
|
425 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = '</span>'."\n"; // after comment
|
426 |
+
$GLOBALS['csstidy']['predefined_templates']['default'][] = "\n"; // after last line @-rule
|
427 |
+
|
428 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="at">';
|
429 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span> <span class="format">{</span>'."\n";
|
430 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="selector">';
|
431 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">{</span>';
|
432 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="property">';
|
433 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="value">';
|
434 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span><span class="format">;</span>';
|
435 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="format">}</span>';
|
436 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
437 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n". '<span class="format">}'."\n".'</span>';
|
438 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '';
|
439 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
|
440 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = '</span>'; // after comment
|
441 |
+
$GLOBALS['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
442 |
+
|
443 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="at">';
|
444 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">{</span>';
|
445 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="selector">';
|
446 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">{</span>';
|
447 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="property">';
|
448 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="value">';
|
449 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span><span class="format">;</span>';
|
450 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
451 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '';
|
452 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
453 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '';
|
454 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '<span class="comment">'; // before comment
|
455 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '</span>'; // after comment
|
456 |
+
$GLOBALS['csstidy']['predefined_templates']['highest_compression'][] = '';
|
457 |
+
|
458 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '<span class="at">';
|
459 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '</span> <span class="format">{</span>'."\n";
|
460 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '<span class="selector">';
|
461 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '</span>'."\n".'<span class="format">{</span>'."\n";
|
462 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ' <span class="property">';
|
463 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="value">';
|
464 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '</span><span class="format">;</span>'."\n";
|
465 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '<span class="format">}</span>';
|
466 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = "\n\n";
|
467 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = "\n".'<span class="format">}</span>'."\n\n";
|
468 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = ' ';
|
469 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '<span class="comment">'; // before comment
|
470 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = '</span>'."\n"; // after comment
|
471 |
+
$GLOBALS['csstidy']['predefined_templates']['low_compression'][] = "\n";
|
472 |
+
|
473 |
+
?>
|
css/CSSTidy/lang.inc.php
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(isset($_GET['lang'])) {
|
3 |
+
$l = $_GET['lang'];
|
4 |
+
} else {
|
5 |
+
$l = getenv('HTTP_ACCEPT_LANGUAGE');
|
6 |
+
$l = strtolower(substr($l,0,2));
|
7 |
+
}
|
8 |
+
$l = ($l == 'de' || $l == 'fr' || $l == 'zh') ? $l : 'en';
|
9 |
+
|
10 |
+
$lang = array();
|
11 |
+
$lang['en'][0] = 'CSS Formatter and Optimiser/Optimizer (based on CSSTidy ';
|
12 |
+
$lang['de'][0] = 'CSS Formatierer und Optimierer (basierend auf CSSTidy ';
|
13 |
+
$lang['en'][1] = 'CSS Formatter and Optimiser';
|
14 |
+
$lang['de'][1] = 'CSS Formatierer und Optimierer';
|
15 |
+
$lang['en'][2] = '(based on';
|
16 |
+
$lang['de'][2] = '(basierend auf';
|
17 |
+
$lang['en'][3] = '(plaintext)';
|
18 |
+
$lang['de'][3] = '(Textversion)';
|
19 |
+
$lang['en'][4] = 'Important Note:';
|
20 |
+
$lang['de'][4] = 'Wichtiger Hinweis:';
|
21 |
+
$lang['en'][6] = 'Your code should be well-formed. This is <strong>no validator</strong> which points out errors in your CSS code. To make sure that your code is valid, use the <a href="http://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
|
22 |
+
$lang['de'][6] = 'Der CSS Code sollte wohlgeformt sein. Der CSS Code wird <strong>nicht auf Gültigkeit überprüft</strong>. Um sicherzugehen dass dein Code valide ist, benutze den <a href="http://jigsaw.w3.org/css-validator/">W3C Validierungsservice</a>.';
|
23 |
+
$lang['en'][7] = 'all comments are removed';
|
24 |
+
$lang['de'][7] = 'alle Kommentare werden entfernt';
|
25 |
+
$lang['en'][8] = 'CSS Input:';
|
26 |
+
$lang['de'][8] = 'CSS Eingabe:';
|
27 |
+
$lang['en'][9] = 'CSS-Code:';
|
28 |
+
$lang['de'][9] = 'CSS-Code:';
|
29 |
+
$lang['en'][10] = 'CSS from URL:';
|
30 |
+
$lang['de'][10] = 'CSS von URL:';
|
31 |
+
$lang['en'][11] = 'Code Layout:';
|
32 |
+
$lang['de'][11] = 'Code Layout:';
|
33 |
+
$lang['en'][12] = 'Compression (code layout):';
|
34 |
+
$lang['de'][12] = 'Komprimierung (Code Layout):';
|
35 |
+
$lang['en'][13] = 'Highest (no readability, smallest size)';
|
36 |
+
$lang['de'][13] = 'Höchste (keine Lesbarkeit, niedrigste Größe)';
|
37 |
+
$lang['en'][14] = 'High (moderate readability, smaller size)';
|
38 |
+
$lang['de'][14] = 'Hoch (mittelmäßige Lesbarkeit, geringe Größe)';
|
39 |
+
$lang['en'][15] = 'Standard (balance between readability and size)';
|
40 |
+
$lang['de'][15] = 'Standard (Kompromiss zwischen Lesbarkeit und Größe)';
|
41 |
+
$lang['en'][16] = 'Low (higher readability)';
|
42 |
+
$lang['de'][16] = 'Niedrig (höhere Lesbarkeit)';
|
43 |
+
$lang['en'][17] = 'Custom (enter below)';
|
44 |
+
$lang['de'][17] = 'Benutzerdefiniert (unten eingeben)';
|
45 |
+
$lang['en'][18] = 'Custom <a href="http://csstidy.sourceforge.net/templates.php">template</a>';
|
46 |
+
$lang['de'][18] = 'Benutzerdefinierte <a href="http://csstidy.sourceforge.net/templates.php">Vorlage</a>';
|
47 |
+
$lang['en'][19] = 'Options';
|
48 |
+
$lang['de'][19] = 'Optionen';
|
49 |
+
$lang['en'][20] = 'Sort Selectors (caution)';
|
50 |
+
$lang['de'][20] = 'Selektoren sortieren (Vorsicht)';
|
51 |
+
$lang['en'][21] = 'Sort Properties';
|
52 |
+
$lang['de'][21] = 'Eigenschaften sortieren';
|
53 |
+
$lang['en'][22] = 'Regroup selectors';
|
54 |
+
$lang['de'][22] = 'Selektoren umgruppieren';
|
55 |
+
$lang['en'][23] = 'Optimise shorthands';
|
56 |
+
$lang['de'][23] = 'Shorthands optimieren';
|
57 |
+
$lang['en'][24] = 'Compress colors';
|
58 |
+
$lang['de'][24] = 'Farben komprimieren';
|
59 |
+
$lang['en'][25] = 'Lowercase selectors';
|
60 |
+
$lang['de'][25] = 'Selektoren in Kleinbuchstaben';
|
61 |
+
$lang['en'][26] = 'Case for properties:';
|
62 |
+
$lang['de'][26] = 'Groß-/Kleinschreibung für Eigenschaften';
|
63 |
+
$lang['en'][27] = 'Lowercase';
|
64 |
+
$lang['de'][27] = 'Kleinbuchstaben';
|
65 |
+
$lang['en'][28] = 'No or invalid CSS input or wrong URL!';
|
66 |
+
$lang['de'][28] = 'Keine oder ungültige CSS Eingabe oder falsche URL!';
|
67 |
+
$lang['en'][29] = 'Uppercase';
|
68 |
+
$lang['de'][29] = 'Großbuchstaben';
|
69 |
+
$lang['en'][30] = 'lowercase elementnames needed for XHTML';
|
70 |
+
$lang['de'][30] = 'kleingeschriebene Elementnamen benötigt für XHTML';
|
71 |
+
$lang['en'][31] = 'Remove unnecessary backslashes';
|
72 |
+
$lang['de'][31] = 'Unnötige Backslashes entfernen';
|
73 |
+
$lang['en'][32] = 'convert !important-hack';
|
74 |
+
$lang['de'][32] = '!important-Hack konvertieren';
|
75 |
+
$lang['en'][33] = 'Output as file';
|
76 |
+
$lang['de'][33] = 'Als Datei ausgeben';
|
77 |
+
$lang['en'][34] = 'Bigger compression because of smaller newlines (copy & paste doesn\'t work)';
|
78 |
+
$lang['de'][34] = 'Größere Komprimierung augrund von kleineren Neuezeile-Zeichen';
|
79 |
+
$lang['en'][35] = 'Process CSS';
|
80 |
+
$lang['de'][35] = 'CSS verarbeiten';
|
81 |
+
$lang['en'][36] = 'Compression Ratio';
|
82 |
+
$lang['de'][36] = 'Komprimierungsrate';
|
83 |
+
$lang['en'][37] = 'Input';
|
84 |
+
$lang['de'][37] = 'Eingabe';
|
85 |
+
$lang['en'][38] = 'Output';
|
86 |
+
$lang['de'][38] = 'Ausgabe';
|
87 |
+
$lang['en'][39] = 'Language';
|
88 |
+
$lang['de'][39] = 'Sprache';
|
89 |
+
$lang['en'][41] = 'Attention: This may change the behaviour of your CSS Code!';
|
90 |
+
$lang['de'][41] = 'Achtung: Dies könnte das Verhalten ihres CSS-Codes verändern!';
|
91 |
+
$lang['en'][42] = 'Remove last ;';
|
92 |
+
$lang['de'][42] = 'Letztes ; entfernen';
|
93 |
+
$lang['en'][43] = 'Discard invalid properties';
|
94 |
+
$lang['de'][43] = 'Ungültige Eigenschaften entfernen';
|
95 |
+
$lang['en'][44] = 'Only safe optimisations';
|
96 |
+
$lang['de'][44] = 'Nur sichere Optimierungen';
|
97 |
+
$lang['en'][45] = 'Compress font-weight';
|
98 |
+
$lang['de'][45] = 'font-weight komprimieren';
|
99 |
+
$lang['en'][46] = 'Save comments';
|
100 |
+
$lang['de'][46] = 'Kommentare beibehalten';
|
101 |
+
$lang['en'][47] = 'Do not change anything';
|
102 |
+
$lang['en'][48] = 'Only seperate selectors (split at ,)';
|
103 |
+
$lang['en'][49] = 'Merge selectors with the same properties (fast)';
|
104 |
+
$lang['en'][50] = 'Merge selectors intelligently (slow)';
|
105 |
+
$lang['de'][47] = 'Nichts ändern';
|
106 |
+
$lang['de'][48] = 'Selektoren nur trennen (am Komma)';
|
107 |
+
$lang['de'][49] = 'Selektoren mit gleichen Eigenschaften zusammenfassen (schnell)';
|
108 |
+
$lang['de'][50] = 'Selektoren intelligent zusammenfassen (langsam!)';
|
109 |
+
$lang['en'][51] = 'Preserve CSS';
|
110 |
+
$lang['de'][51] = 'CSS erhalten';
|
111 |
+
$lang['en'][52] = 'Save comments, hacks, etc. Most optimisations can *not* be applied if this is enabled.';
|
112 |
+
$lang['de'][52] = 'Kommentare, Hacks, etc. speichern. Viele Optimierungen sind dann aber nicht mehr möglich.';
|
113 |
+
$lang['en'][53] = 'None';
|
114 |
+
$lang['de'][53] = 'Keine';
|
115 |
+
$lang['en'][54] = 'Don\'t optimise';
|
116 |
+
$lang['de'][54] = 'Nicht optimieren';
|
117 |
+
$lang['en'][55] = 'Safe optimisations';
|
118 |
+
$lang['de'][55] = 'Sichere Optimierungen';
|
119 |
+
$lang['en'][56] = 'All optimisations';
|
120 |
+
$lang['de'][56] = 'Alle Optimierungen';
|
121 |
+
$lang['en'][57] = 'Add timestamp';
|
122 |
+
$lang['de'][57] = 'Zeitstempel hinzufügen';
|
123 |
+
|
124 |
+
$lang['fr'][0] = 'CSS Formatteur et Optimiseur (basé sur CSSTidy ';
|
125 |
+
$lang['fr'][1] = 'CSS Formatteur et Optimiseur';
|
126 |
+
$lang['fr'][2] = '(basé sur ';
|
127 |
+
$lang['fr'][3] = '(Version Text)';
|
128 |
+
$lang['fr'][4] = 'notes Importantes:';
|
129 |
+
$lang['fr'][5] = 'les mêmes sélecteurs et les propriétés sont automatiquement fusionnés';
|
130 |
+
$lang['fr'][6] = 'votre code doit être Valide. Ce n\'est <strong>pas un validateur</strong> qui signale des erreurs dans votre code de CSS. Assurez-vous que votre code est correct en utilisant le le validateur : <a href="http://jigsaw.w3.org/css-validator/">W3C Validator</a>';
|
131 |
+
$lang['fr'][7] = 'tous les commentaires sont enlevés';
|
132 |
+
$lang['fr'][8] = 'Champ CSS:';
|
133 |
+
$lang['fr'][9] = 'CSS-Code:';
|
134 |
+
$lang['fr'][10] = 'CSS en provenance d\'une URL:<br />';
|
135 |
+
$lang['fr'][11] = 'Mise en page du code:';
|
136 |
+
$lang['fr'][12] = 'Compression (Mise en page du code):';
|
137 |
+
$lang['fr'][13] = 'Le plus compact (aucune lisibilité, plus petite taille)';
|
138 |
+
$lang['fr'][14] = 'Trés compact (lisibilité modérée, plus petite taille)';
|
139 |
+
$lang['fr'][15] = 'Normale (équilibre entre la lisibilité et la taille)';
|
140 |
+
$lang['fr'][16] = 'Peu compact (une lisibilité plus élevée)';
|
141 |
+
$lang['fr'][17] = 'Sur mesure (entrer ci-dessous)';
|
142 |
+
$lang['fr'][18] = 'Sur mesure <a href="http://csstidy.sourceforge.net/templates.php">Gabarit</a>';
|
143 |
+
$lang['fr'][19] = 'Options';
|
144 |
+
$lang['fr'][20] = 'Trier les sélecteurs (attention)';
|
145 |
+
$lang['fr'][21] = 'Trier les propriétés';
|
146 |
+
$lang['fr'][22] = 'Fusionner les sélecteurs';
|
147 |
+
$lang['fr'][23] = 'Optimise shorthands';
|
148 |
+
$lang['fr'][24] = 'Compresser les couleurs';
|
149 |
+
$lang['fr'][25] = 'Sélecteurs en minuscules';
|
150 |
+
$lang['fr'][26] = 'Cases (Minuscules & Majuscule) pour les propriétés:';
|
151 |
+
$lang['fr'][27] = 'Minuscules';
|
152 |
+
$lang['fr'][28] = 'CSS non valide ou URL incorrecte!';
|
153 |
+
$lang['fr'][29] = 'Majuscule';
|
154 |
+
$lang['fr'][30] = 'les noms des éléments en minuscules (indispensables pour XHTML)';
|
155 |
+
$lang['fr'][31] = 'enlever les antislashs inutiles';
|
156 |
+
$lang['fr'][32] = 'convertir !important-hack';
|
157 |
+
$lang['fr'][33] = 'Sauver en tant que fichier';
|
158 |
+
$lang['fr'][34] = 'Une plus grande compression en raison de plus petits caractères';
|
159 |
+
$lang['fr'][35] = 'Compresser le CSS';
|
160 |
+
$lang['fr'][36] = 'Facteur de Compression';
|
161 |
+
$lang['fr'][37] = 'Entrée';
|
162 |
+
$lang['fr'][38] = 'Sortie';
|
163 |
+
$lang['fr'][39] = 'Language';
|
164 |
+
$lang['fr'][41] = 'Attention : ceci peut changer le comportement de votre code de CSS !';
|
165 |
+
$lang['fr'][42] = 'Enlever le dernier ;';
|
166 |
+
$lang['fr'][43] = 'Supprimer les propriétés non valide';
|
167 |
+
$lang['fr'][44] = 'Seulement les optimisations sûres';
|
168 |
+
$lang['fr'][45] = 'Compresser font-weight';
|
169 |
+
$lang['fr'][46] = 'Sauvegarder les commentaires ';
|
170 |
+
$lang['fr'][47] = 'Ne changer rien';
|
171 |
+
$lang['fr'][48] = 'Sépare les sélecteurs (sépare au niveau de ,)';
|
172 |
+
$lang['fr'][49] = 'Fusionne les sélecteurs avec les mêmes propriétés (rapides)';
|
173 |
+
$lang['fr'][50] = 'Fusionne les sélecteurs intelligemment (lent)';
|
174 |
+
$lang['fr'][51] = 'Preserve CSS';
|
175 |
+
$lang['fr'][52] = 'Save comments, hacks, etc. Most optimisations can *not* be applied if this is enabled.';
|
176 |
+
$lang['fr'][53] = 'None';
|
177 |
+
$lang['fr'][54] = 'Don\'t optimise';
|
178 |
+
$lang['fr'][55] = 'Safe optimisations';
|
179 |
+
$lang['fr'][56] = 'All optimisations';
|
180 |
+
$lang['fr'][57] = 'Add timestamp';
|
181 |
+
|
182 |
+
$lang['zh'][0] = 'CSS整形與最佳化工具(使用 CSSTidy ';
|
183 |
+
$lang['zh'][1] = 'CSS整形與最佳化工具';
|
184 |
+
$lang['zh'][2] = '(使用';
|
185 |
+
$lang['zh'][3] = '(純文字)';
|
186 |
+
$lang['zh'][4] = '重要事項:';
|
187 |
+
$lang['zh'][6] = '你的原始碼必須是良構的(well-formed). 這個工具<strong>沒有內建驗證器(validator)</strong>. 驗證器能夠指出你CSS原始碼裡的錯誤. 請使用 <a href="http://jigsaw.w3.org/css-validator/">W3C 驗證器</a>, 確保你的原始碼合乎規範.';
|
188 |
+
$lang['zh'][7] = '所有註解都移除了';
|
189 |
+
$lang['zh'][8] = 'CSS 輸入:';
|
190 |
+
$lang['zh'][9] = 'CSS 原始碼:';
|
191 |
+
$lang['zh'][10] = 'CSS 檔案網址(URL):';
|
192 |
+
$lang['zh'][11] = '原始碼規劃:';
|
193 |
+
$lang['zh'][12] = '壓縮程度(原始碼規劃):';
|
194 |
+
$lang['zh'][13] = '最高 (沒有辦法讀, 檔案最小)';
|
195 |
+
$lang['zh'][14] = '高 (適度的可讀性, 檔案小)';
|
196 |
+
$lang['zh'][15] = '標準 (兼顧可讀性與檔案大小)';
|
197 |
+
$lang['zh'][16] = '低 (注重可讀性)';
|
198 |
+
$lang['zh'][17] = '自訂 (在下方設定)';
|
199 |
+
$lang['zh'][18] = '自訂<a href="http://csstidy.sourceforge.net/templates.php">樣板</a>';
|
200 |
+
$lang['zh'][19] = '選項';
|
201 |
+
$lang['zh'][20] = '整理選擇符(請謹慎使用)';
|
202 |
+
$lang['zh'][21] = '整理屬性';
|
203 |
+
$lang['zh'][22] = '重組選擇符';
|
204 |
+
$lang['zh'][23] = '速記法(shorthand)最佳化';
|
205 |
+
$lang['zh'][24] = '壓縮色彩語法';
|
206 |
+
$lang['zh'][25] = '改用小寫選擇符';
|
207 |
+
$lang['zh'][26] = '屬性的字形:';
|
208 |
+
$lang['zh'][27] = '小寫';
|
209 |
+
$lang['zh'][28] = '沒有輸入CSS, 語法不符合規定, 或是網址錯誤!';
|
210 |
+
$lang['zh'][29] = '大寫';
|
211 |
+
$lang['zh'][30] = 'XHTML必須使用小寫的元素名稱';
|
212 |
+
$lang['zh'][31] = '移除不必要的反斜線';
|
213 |
+
$lang['zh'][32] = '轉換 !important-hack';
|
214 |
+
$lang['zh'][33] = '輸出成檔案形式';
|
215 |
+
$lang['zh'][34] = '由於比較少換行字元, 會有更大的壓縮比率(複製&貼上沒有用)';
|
216 |
+
$lang['zh'][35] = '執行';
|
217 |
+
$lang['zh'][36] = '壓縮比率';
|
218 |
+
$lang['zh'][37] = '輸入';
|
219 |
+
$lang['zh'][38] = '輸出';
|
220 |
+
$lang['zh'][39] = '語言';
|
221 |
+
$lang['zh'][41] = '注意: 這或許會變更你CSS原始碼的行為!';
|
222 |
+
$lang['zh'][42] = '除去最後一個分號';
|
223 |
+
$lang['zh'][43] = '拋棄不符合規定的屬性';
|
224 |
+
$lang['zh'][44] = '只安全地最佳化';
|
225 |
+
$lang['zh'][45] = '壓縮 font-weight';
|
226 |
+
$lang['zh'][46] = '保留註解';
|
227 |
+
$lang['zh'][47] = '什麼都不要改';
|
228 |
+
$lang['zh'][48] = '只分開原本用逗號分隔的選擇符';
|
229 |
+
$lang['zh'][49] = '合併有相同屬性的選擇符(快速)';
|
230 |
+
$lang['zh'][50] = '聰明地合併選擇符(慢速)';
|
231 |
+
$lang['zh'][51] = '保護CSS';
|
232 |
+
$lang['zh'][52] = '保留註解與 hack 等等. 如果啟用這個選項, 大多數的最佳化程序都不會執行.';
|
233 |
+
$lang['zh'][53] = '不改變';
|
234 |
+
$lang['zh'][54] = '不做最佳化';
|
235 |
+
$lang['zh'][55] = '安全地最佳化';
|
236 |
+
$lang['zh'][56] = '全部最佳化';
|
237 |
+
$lang['zh'][57] = '加上時間戳記';
|
238 |
+
?>
|
html/DashboardPage.php
CHANGED
@@ -4,9 +4,9 @@
|
|
4 |
<?php
|
5 |
global $wpdb;
|
6 |
$Slug_Base = get_option("EWD_UFAQ_Slug_Base");
|
7 |
-
|
8 |
//start review box
|
9 |
-
if (isset($_POST['hide_ufaq_review_box_hidden'])) {update_option('EWD_UFAQ_Hide_Dash_Review_Ask', $_POST['hide_ufaq_review_box_hidden']);}
|
10 |
$hideReview = get_option('EWD_UFAQ_Hide_Dash_Review_Ask');
|
11 |
$Ask_Review_Date = get_option('EWD_UFAQ_Ask_Review_Date');
|
12 |
if ($Ask_Review_Date == "") {$Ask_Review_Date = time() - 3600*24;}
|
4 |
<?php
|
5 |
global $wpdb;
|
6 |
$Slug_Base = get_option("EWD_UFAQ_Slug_Base");
|
7 |
+
|
8 |
//start review box
|
9 |
+
if (isset($_POST['hide_ufaq_review_box_hidden'])) {update_option('EWD_UFAQ_Hide_Dash_Review_Ask', sanitize_text_field($_POST['hide_ufaq_review_box_hidden']));}
|
10 |
$hideReview = get_option('EWD_UFAQ_Hide_Dash_Review_Ask');
|
11 |
$Ask_Review_Date = get_option('EWD_UFAQ_Ask_Review_Date');
|
12 |
if ($Ask_Review_Date == "") {$Ask_Review_Date = time() - 3600*24;}
|
js/ewd-ufaq-js.js
CHANGED
@@ -168,7 +168,6 @@ function Ufaq_Ajax_Reload() {
|
|
168 |
|
169 |
var data = 'Q=' + Question + '&include_category=' + include_cat + '&exclude_category=' + exclude_cat + '&orderby=' + orderby + '&order=' + order + '&post_count=' + post_count + '&request_count=' + RequestCount + '¤t_url=' + current_url + '&action=ufaq_search';
|
170 |
jQuery.post(ajaxurl, data, function(response) {
|
171 |
-
response = response.substring(0, response.length - 1);
|
172 |
var parsed_response = jQuery.parseJSON(response);
|
173 |
if (parsed_response.request_count == RequestCount) {
|
174 |
jQuery('#ufaq-ajax-results').html(parsed_response.message);
|
168 |
|
169 |
var data = 'Q=' + Question + '&include_category=' + include_cat + '&exclude_category=' + exclude_cat + '&orderby=' + orderby + '&order=' + order + '&post_count=' + post_count + '&request_count=' + RequestCount + '¤t_url=' + current_url + '&action=ufaq_search';
|
170 |
jQuery.post(ajaxurl, data, function(response) {
|
|
|
171 |
var parsed_response = jQuery.parseJSON(response);
|
172 |
if (parsed_response.request_count == RequestCount) {
|
173 |
jQuery('#ufaq-ajax-results').html(parsed_response.message);
|
readme.txt
CHANGED
@@ -268,6 +268,10 @@ Video 3 - FAQs Ordering
|
|
268 |
|
269 |
|
270 |
== Changelog ==
|
|
|
|
|
|
|
|
|
271 |
= 1.6.3 =
|
272 |
- Added a nonce field to the settings form
|
273 |
|
268 |
|
269 |
|
270 |
== Changelog ==
|
271 |
+
= 1.6.4 =
|
272 |
+
- Removed unnecessary code from AJAX processing file
|
273 |
+
- Improved admin data processing
|
274 |
+
|
275 |
= 1.6.3 =
|
276 |
- Added a nonce field to the settings form
|
277 |
|