Skip to content

Commit

Permalink
Fixed the upload urls and fixed the https value in $_SERVER
Browse files Browse the repository at this point in the history
  • Loading branch information
alecszaharia committed Jul 6, 2018
1 parent d3cfef4 commit b870c08
Show file tree
Hide file tree
Showing 68 changed files with 34 additions and 203,025 deletions.
Empty file added admin/upload-dir
Empty file.
22 changes: 22 additions & 0 deletions admin/upload-dir.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class Brizy_Admin_UploadDir {

static public function getUploadDir( $time = null, $create_dir = true, $refresh_cache = false ) {
add_filter('upload_dir',array('Brizy_Admin_UploadDir','fixUrlSchema'));
$dir = wp_upload_dir( $time, $create_dir, $refresh_cache );
remove_filter('upload_dir',array('Brizy_Admin_UploadDir','fixUrlSchema'));

return $dir;
}

static public function fixUrlSchema( $uploadDir ) {

$uploadDir['url'] = set_url_scheme($uploadDir['url']);
$uploadDir['baseurl'] = set_url_scheme($uploadDir['baseurl']);

return $uploadDir;

}

}
7 changes: 7 additions & 0 deletions brizy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
* Domain Path: /languages
*/

/**
* This will fix the url protocol for websites that are working behind a load balancer
*/
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && stripos( $_SERVER['HTTP_X_FORWARDED_PROTO'], 'https' ) !== false ) {
$_SERVER['HTTPS'] = 'on';
}

define( 'BRIZY_DEVELOPMENT', false );
define( 'BRIZY_LOG', false );
define( 'BRIZY_VERSION', '1.0.18' );
Expand Down
2 changes: 1 addition & 1 deletion editor/helper/post-static.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function save_path() {
}

private function uploads_dir() {
$upload_dir = wp_upload_dir();
$upload_dir = Brizy_Admin_UploadDir::getUploadDir();

return $upload_dir['baseurl'];
}
Expand Down
4 changes: 2 additions & 2 deletions editor/uploads-dir.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static function get_uploads_url() {
static $uri;

if ( ! $uri ) {
$uploads = wp_upload_dir();
$uploads = Brizy_Admin_UploadDir::getUploadDir();
$uri = $uploads['baseurl'];
}

Expand All @@ -41,7 +41,7 @@ private static function get_uploads_path() {
static $uri;

if ( ! $uri ) {
$uploads = wp_upload_dir();
$uploads = Brizy_Admin_UploadDir::getUploadDir();
$uri = $uploads['basedir'];
}

Expand Down
2 changes: 1 addition & 1 deletion editor/url-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct( $project = null, $post = null ) {

$this->project = $project;
$this->post = $post;
$this->upload_dir = wp_upload_dir( null, true );
$this->upload_dir = Brizy_Admin_UploadDir::getUploadDir(null,true);
}

public function application_form_url() {
Expand Down
13 changes: 1 addition & 12 deletions editor/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,18 +331,7 @@ public function compile_page( $project, $post ) {
$page_html = $this->get_client()->compile_page( $project, $editor_data, $config );

return $page_html;
//
// $asset_storage = new Brizy_Editor_Asset_AssetProxyStorage( $project, $post, $config );
// $media_storage = new Brizy_Editor_Asset_MediaProxyStorage( $project, $post, $config );
//
// $asset_processors = array();
// $asset_processors[] = new Brizy_Editor_Asset_AssetProxyProcessor( $asset_storage );
// $asset_processors[] = new Brizy_Editor_Asset_MediaAssetProcessor( $media_storage );
//
// $brizy_editor_compiled_html = new Brizy_Editor_CompiledHtml( $page_html );
// $brizy_editor_compiled_html->setProcessors( $asset_processors );
//
// return $brizy_editor_compiled_html;

}

/**
Expand Down
9 changes: 0 additions & 9 deletions public/editor-build/1.0.38/editor/css/editor.css

This file was deleted.

148 changes: 0 additions & 148 deletions public/editor-build/1.0.38/editor/js/brizy-init.js

This file was deleted.

Loading

0 comments on commit b870c08

Please sign in to comment.