| @@ -6,11 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace WPE\FaustWP\Settings; |
| 9 | 9 | |
| 10 | -use function WPE\FaustWP\Telemetry\generate_telemetry_client_id; | |
| 11 | -use function WPE\FaustWP\Telemetry\get_telemetry_client_id; | |
| 12 | - | |
| 13 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | 11 | exit; |
| 15 | 12 | } |
| 16 | 13 | |
| @@ -32,17 +29,8 @@ | ||
| 32 | 29 | return '1' === faustwp_get_setting( 'enable_rewrites' ); |
| 33 | 30 | } |
| 34 | 31 | |
| 35 | 32 | /** |
| 36 | - * Determines if posts and category URLs should link to the WP site. | |
| 37 | - * | |
| 38 | - * @return bool | |
| 39 | - */ | |
| 40 | -function use_wp_domain_for_post_and_category_urls() { | |
| 41 | - return ! is_rewrites_enabled(); | |
| 42 | -} | |
| 43 | - | |
| 44 | -/** | |
| 45 | 33 | * Determine if themes are disabled. |
| 46 | 34 | * |
| 47 | 35 | * @return bool True if themes are disabled, false if else. |
| 48 | 36 | */ |
| @@ -58,27 +46,10 @@ | ||
| 58 | 46 | function is_image_source_replacement_enabled() { |
| 59 | 47 | return '1' === faustwp_get_setting( 'enable_image_source' ); |
| 60 | 48 | } |
| 61 | 49 | |
| 62 | -/** | |
| 63 | - * Determine if sourcing images from WP domain is enabled. | |
| 64 | - * | |
| 65 | - * @return bool True if image sources from WP are enabled, false if else. | |
| 66 | - */ | |
| 67 | -function use_wp_domain_for_media() { | |
| 68 | - return is_image_source_replacement_enabled(); | |
| 69 | -} | |
| 70 | 50 | |
| 71 | 51 | /** |
| 72 | - * Determine if Faust telemetry is enabled. | |
| 73 | - * | |
| 74 | - * @return bool True if telemetry is enabled, false if else. | |
| 75 | - */ | |
| 76 | -function is_telemetry_enabled() { | |
| 77 | - return '1' === faustwp_get_setting( 'enable_telemetry' ); | |
| 78 | -} | |
| 79 | - | |
| 80 | -/** | |
| 81 | 52 | * Get the secret key setting. |
| 82 | 53 | * |
| 83 | 54 | * @return string The secret key. |
| 84 | 55 | */ |
| @@ -88,15 +59,15 @@ | ||
| 88 | 59 | |
| 89 | 60 | /** |
| 90 | 61 | * Get a Faust setting by name. |
| 91 | 62 | * |
| 92 | - * @param string $name The setting name. | |
| 93 | - * @param mixed $default_value Optional setting value. Default false. | |
| 63 | + * @param string $name The setting name. | |
| 64 | + * @param mixed $default Optional setting value. Default false. | |
| 94 | 65 | * |
| 95 | 66 | * @return mixed The setting value. |
| 96 | 67 | */ |
| 97 | -function faustwp_get_setting( $name, $default_value = false ) { | |
| 98 | - $value = $default_value; | |
| 68 | +function faustwp_get_setting( $name, $default = false ) { | |
| 69 | + $value = $default; | |
| 99 | 70 | $settings = faustwp_get_settings(); |
| 100 | 71 | |
| 101 | 72 | if ( isset( $settings[ $name ] ) ) { |
| 102 | 73 | $value = $settings[ $name ]; |
| @@ -106,11 +77,11 @@ | ||
| 106 | 77 | * Filter 'faustwp_get_setting'. |
| 107 | 78 | * |
| 108 | 79 | * @param mixed $value The setting value. |
| 109 | 80 | * @param string $name The setting name. |
| 110 | - * @param mixed $default_value Optional setting value. | |
| 81 | + * @param mixed $default Optional setting value. | |
| 111 | 82 | */ |
| 112 | - return apply_filters( 'faustwp_get_setting', $value, $name, $default_value ); | |
| 83 | + return apply_filters( 'faustwp_get_setting', $value, $name, $default ); | |
| 113 | 84 | } |
| 114 | 85 | |
| 115 | 86 | /** |
| 116 | 87 | * Update a Faust setting value. |
| @@ -150,17 +121,15 @@ | ||
| 150 | 121 | * |
| 151 | 122 | * @return void |
| 152 | 123 | */ |
| 153 | 124 | function maybe_set_default_settings() { |
| 154 | - $secret_key = get_secret_key(); | |
| 155 | - $settings = faustwp_get_settings(); | |
| 156 | - $telemetry_client_id = get_telemetry_client_id(); | |
| 125 | + $secret_key = get_secret_key(); | |
| 126 | + $settings = faustwp_get_settings(); | |
| 157 | 127 | |
| 158 | 128 | if ( empty( $settings ) ) { |
| 159 | 129 | faustwp_update_setting( 'disable_theme', '0' ); |
| 160 | 130 | faustwp_update_setting( 'enable_rewrites', '1' ); |
| 161 | 131 | faustwp_update_setting( 'enable_redirects', '1' ); |
| 162 | - faustwp_update_setting( 'enable_image_source', '1' ); | |
| 163 | 132 | |
| 164 | 133 | // Force WP to regenerate rewrite rules without calling flush_rewrite_rules which breaks |
| 165 | 134 | // things when used inside of `switch_to_blog()`. |
| 166 | 135 | if ( is_multisite() ) { |
| @@ -169,12 +138,8 @@ | ||
| 169 | 138 | } |
| 170 | 139 | |
| 171 | 140 | if ( ! $secret_key ) { |
| 172 | 141 | faustwp_update_setting( 'secret_key', wp_generate_uuid4() ); |
| 173 | - } | |
| 174 | - | |
| 175 | - if ( ! $telemetry_client_id ) { | |
| 176 | - generate_telemetry_client_id(); | |
| 177 | 142 | } |
| 178 | 143 | } |
| 179 | 144 | |
| 180 | 145 | /** |