&$value ) { if ( is_array( $value ) && isset( $result[ $key ] ) ) { $result[ $key ] = self::recursive_wp_parse_args( $value, $result[ $key ] ); } else { $result[ $key ] = $value; } } return $result; } /** * Get value for given device. * * If given data cannot be responsived, do not process. Returns itself. * * @param $data Given data. This can be anything. * @param string $device Given device. */ public static function get_device_value( $data, $device = 'desktop' ) { if ( StylesDataHelpers::is_responsive_data( $data ) ) { if ( ! isset( $data[ $device ] ) ) { return $data['desktop']; } else { return $data[ $device ]; } } return $data; } public static function replace_language_url( $lang ) { $current_url = self::get_currentUrl(); $origin_url = get_home_url(); return str_replace( $origin_url, $origin_url . '/' . $lang, $current_url ); } public static function get_currentUrl() { $protocol = is_ssl() ? 'https://' : 'http://'; return ( $protocol ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } }