Code Duplication    Length = 44-45 lines in 2 locations

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

@@ 1797-1840 (lines=44) @@
1794
	return Jetpack_Custom_CSS::restore_revision( $_post_id, $_revision_id );
1795
}
1796
1797
if ( ! function_exists( 'safecss_class' ) ) :
1798
function safecss_class() {
1799
	// Wrapped so we don't need the parent class just to load the plugin
1800
	if ( class_exists('safecss') )
1801
		return;
1802
1803
	require_once( dirname( __FILE__ ) . '/csstidy/class.csstidy.php' );
1804
1805
	class safecss extends csstidy_optimise {
1806
1807
		function postparse() {
1808
1809
			/**
1810
			 * Fires after parsing the css.
1811
			 *
1812
			 * @module custom-css
1813
			 *
1814
			 * @since 1.8.0
1815
			 *
1816
			 * @param obj $this CSSTidy object.
1817
			 */
1818
			do_action( 'csstidy_optimize_postparse', $this );
1819
1820
			return parent::postparse();
1821
		}
1822
1823
		function subvalue() {
1824
1825
			/**
1826
			 * Fires before optimizing the Custom CSS subvalue.
1827
			 *
1828
			 * @module custom-css
1829
			 *
1830
			 * @since 1.8.0
1831
			 *
1832
			 * @param obj $this CSSTidy object.
1833
			 **/
1834
			do_action( 'csstidy_optimize_subvalue', $this );
1835
1836
			return parent::subvalue();
1837
		}
1838
	}
1839
}
1840
endif;
1841
1842
if ( ! function_exists( 'safecss_filter_attr' ) ) {
1843
	function safecss_filter_attr( $css, $element = 'div' ) {

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

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