Code Duplication    Length = 44-45 lines in 2 locations

modules/custom-css/custom-css-4.7.php 1 location

@@ 1133-1177 (lines=45) @@
1130
1131
Jetpack_Custom_CSS_Enhancements::add_hooks();
1132
1133
if ( ! function_exists( 'safecss_class' ) ) :
1134
	/**
1135
	 * Load in the class only when needed.  Makes lighter load by having one less class in memory.
1136
	 */
1137
	function safecss_class() {
1138
		// Wrapped so we don't need the parent class just to load the plugin.
1139
		if ( class_exists( 'safecss' ) ) {
1140
			return;
1141
		}
1142
1143
		require_once( dirname( __FILE__ ) . '/csstidy/class.csstidy.php' );
1144
1145
		/**
1146
		 * Class safecss
1147
		 */
1148
		class safecss extends csstidy_optimise {
1149
1150
			/**
1151
			 * Optimises $css after parsing.
1152
			 */
1153
			function postparse() {
1154
1155
				/** This action is documented in modules/custom-css/custom-css.php */
1156
				do_action( 'csstidy_optimize_postparse', $this );
1157
1158
				return parent::postparse();
1159
			}
1160
1161
			/**
1162
			 * Optimises a sub-value.
1163
			 */
1164
			function subvalue() {
1165
1166
				/** This action is documented in modules/custom-css/custom-css.php */
1167
				do_action( 'csstidy_optimize_subvalue', $this );
1168
1169
				return parent::subvalue();
1170
			}
1171
		}
1172
	}
1173
endif;
1174

modules/custom-css/custom-css.php 1 location

@@ 1820-1863 (lines=44) @@
1817
	return Jetpack_Custom_CSS::restore_revision( $_post_id, $_revision_id );
1818
}
1819
1820
if ( ! function_exists( 'safecss_class' ) ) :
1821
function safecss_class() {
1822
	// Wrapped so we don't need the parent class just to load the plugin
1823
	if ( class_exists('safecss') )
1824
		return;
1825
1826
	require_once( dirname( __FILE__ ) . '/csstidy/class.csstidy.php' );
1827
1828
	class safecss extends csstidy_optimise {
1829
1830
		function postparse() {
1831
1832
			/**
1833
			 * Fires after parsing the css.
1834
			 *
1835
			 * @module custom-css
1836
			 *
1837
			 * @since 1.8.0
1838
			 *
1839
			 * @param obj $this CSSTidy object.
1840
			 */
1841
			do_action( 'csstidy_optimize_postparse', $this );
1842
1843
			return parent::postparse();
1844
		}
1845
1846
		function subvalue() {
1847
1848
			/**
1849
			 * Fires before optimizing the Custom CSS subvalue.
1850
			 *
1851
			 * @module custom-css
1852
			 *
1853
			 * @since 1.8.0
1854
			 *
1855
			 * @param obj $this CSSTidy object.
1856
			 **/
1857
			do_action( 'csstidy_optimize_subvalue', $this );
1858
1859
			return parent::subvalue();
1860
		}
1861
	}
1862
}
1863
endif;
1864
1865
if ( ! function_exists( 'safecss_filter_attr' ) ) {
1866
	function safecss_filter_attr( $css, $element = 'div' ) {