equal
deleted
inserted
replaced
125 if ( null !== $post_value ) { |
125 if ( null !== $post_value ) { |
126 return $post_value; |
126 return $post_value; |
127 } |
127 } |
128 } |
128 } |
129 $id_base = $this->id_data['base']; |
129 $id_base = $this->id_data['base']; |
130 $value = ''; |
130 $value = ''; |
131 $post = wp_get_custom_css_post( $this->stylesheet ); |
131 $post = wp_get_custom_css_post( $this->stylesheet ); |
132 if ( $post ) { |
132 if ( $post ) { |
133 $value = $post->post_content; |
133 $value = $post->post_content; |
134 } |
134 } |
135 if ( empty( $value ) ) { |
135 if ( empty( $value ) ) { |
136 $value = $this->default; |
136 $value = $this->default; |
159 |
159 |
160 if ( preg_match( '#</?\w+#', $css ) ) { |
160 if ( preg_match( '#</?\w+#', $css ) ) { |
161 $validity->add( 'illegal_markup', __( 'Markup is not allowed in CSS.' ) ); |
161 $validity->add( 'illegal_markup', __( 'Markup is not allowed in CSS.' ) ); |
162 } |
162 } |
163 |
163 |
164 if ( empty( $validity->errors ) ) { |
164 if ( ! $validity->has_errors() ) { |
165 $validity = parent::validate( $css ); |
165 $validity = parent::validate( $css ); |
166 } |
166 } |
167 return $validity; |
167 return $validity; |
168 } |
168 } |
169 |
169 |
178 public function update( $css ) { |
178 public function update( $css ) { |
179 if ( empty( $css ) ) { |
179 if ( empty( $css ) ) { |
180 $css = ''; |
180 $css = ''; |
181 } |
181 } |
182 |
182 |
183 $r = wp_update_custom_css_post( $css, array( |
183 $r = wp_update_custom_css_post( |
184 'stylesheet' => $this->stylesheet, |
184 $css, |
185 ) ); |
185 array( |
|
186 'stylesheet' => $this->stylesheet, |
|
187 ) |
|
188 ); |
186 |
189 |
187 if ( $r instanceof WP_Error ) { |
190 if ( $r instanceof WP_Error ) { |
188 return false; |
191 return false; |
189 } |
192 } |
190 $post_id = $r->ID; |
193 $post_id = $r->ID; |