Code Duplication    Length = 17-20 lines in 2 locations

class.jetpack-options.php 1 location

@@ 453-472 (lines=20) @@
450
	 *
451
	 * @return mixed Option value, or null if option is not found and default is not specified.
452
	 */
453
	static function get_raw_option( $name, $default = null ) {
454
		if ( self::bypass_raw_option( $name ) ) {
455
			return get_option( $name, $default );
456
		}
457
458
		global $wpdb;
459
		$value = $wpdb->get_var(
460
			$wpdb->prepare(
461
				"SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1",
462
				$name
463
			)
464
		);
465
		$value = maybe_unserialize( $value );
466
467
		if ( $value === null && $default !== null ) {
468
			return $default;
469
		}
470
471
		return $value;
472
	}
473
474
	/**
475
	 * 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.