Code Duplication    Length = 17-20 lines in 2 locations

class.jetpack-options.php 1 location

@@ 452-471 (lines=20) @@
449
	 *
450
	 * @return mixed Option value, or null if option is not found and default is not specified.
451
	 */
452
	static function get_raw_option( $name, $default = null ) {
453
		if ( self::bypass_raw_option( $name ) ) {
454
			return get_option( $name, $default );
455
		}
456
457
		global $wpdb;
458
		$value = $wpdb->get_var(
459
			$wpdb->prepare(
460
				"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
461
				$name
462
			)
463
		);
464
		$value = maybe_unserialize( $value );
465
466
		if ( $value === null && $default !== null ) {
467
			return $default;
468
		}
469
470
		return $value;
471
	}
472
473
	/**
474
	 * This function checks for a constant that, if present, will disable direct DB queries Jetpack uses to manage certain options and force Jetpack to always use Options API instead.

packages/options/src/Manager.php 1 location

@@ 256-272 (lines=17) @@
253
	 *
254
	 * @return mixed Option value, or null if option is not found and default is not specified.
255
	 */
256
	function get_raw_option( $name, $default = null ) {
257
		if ( $this->bypass_raw_option( $name ) ) {
258
			return get_option( $name, $default );
259
		}
260
		global $wpdb;
261
		$value = $wpdb->get_var(
262
			$wpdb->prepare(
263
				"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
264
				$name
265
			)
266
		);
267
		$value = maybe_unserialize( $value );
268
		if ( $value === null && $default !== null ) {
269
			return $default;
270
		}
271
		return $value;
272
	}
273
	/**
274
	 * This function checks for a constant that, if present, will disable direct DB queries Jetpack uses to manage certain options and force Jetpack to always use Options API instead.
275
	 * Options can be selectively managed via a blacklist by filtering option names via the jetpack_disabled_raw_option filter.