first commit
This commit is contained in:
26
wp-content/plugins/brizy/compatibilities/astra-addon.php
Normal file
26
wp-content/plugins/brizy/compatibilities/astra-addon.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
* https://wpastra.com/changelog/astra-pro-addon/
|
||||
* */
|
||||
class Brizy_Compatibilities_AstraAddon {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'brizy_preview_enqueue_scripts', [ $this, 'preview_enqueue_scripts' ] );
|
||||
}
|
||||
|
||||
public function preview_enqueue_scripts( Brizy_Editor_Post $editorPost ) {
|
||||
global $template;
|
||||
|
||||
if ( is_singular( 'astra-advanced-hook' ) || ! strpos( $template, Brizy_Config::BRIZY_BLANK_TEMPLATE_FILE_NAME ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$postId = $editorPost->getWpPost()->ID;
|
||||
|
||||
if ( ! in_array( get_post_meta( $postId, 'ast-advanced-hook-layout', true ), [ 'header', 'footer' ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Brizy_Public_AssetEnqueueManager::_init()->dequeuePost( $editorPost );
|
||||
}
|
||||
}
|
||||
20
wp-content/plugins/brizy/compatibilities/autoptimize.php
Normal file
20
wp-content/plugins/brizy/compatibilities/autoptimize.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_Autoptimize {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp', array( $this, 'disable_js_optimize' ), 11 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable noptimize param in the autoptimize plugin class autoptimizeScripts.
|
||||
* It is used to perfom some actions above js scripts like: minify, concatenate ...
|
||||
* When we are in post build mode with brizy we disable it.
|
||||
*/
|
||||
public function disable_js_optimize() {
|
||||
if ( isset( $_GET[ Brizy_Editor::prefix('-edit-iframe') ] ) ) {
|
||||
add_filter( 'autoptimize_filter_js_noptimize', '__return_true' );
|
||||
add_filter( 'autoptimize_filter_css_noptimize', '__return_true' );
|
||||
}
|
||||
}
|
||||
}
|
||||
70
wp-content/plugins/brizy/compatibilities/bbpress.php
Normal file
70
wp-content/plugins/brizy/compatibilities/bbpress.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_Bbpress {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'bbp_template_include', [ $this, 'bbp_template_include' ], 3 );
|
||||
add_action( 'bbp_get_forum_content', [ $this, 'bbp_get_forum_content' ], 10, 2 );
|
||||
add_action( 'brizy_settings_post_types', [ $this, 'settings_post_types' ] );
|
||||
}
|
||||
|
||||
public function bbp_template_include( $template ) {
|
||||
|
||||
if ( ! bbp_is_single_forum() && ! bbp_is_single_topic() && ! bbp_is_single_reply() ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$pid = Brizy_Editor::get()->currentPostId();
|
||||
$rmTpl = false;
|
||||
|
||||
try {
|
||||
if (
|
||||
$pid &&
|
||||
in_array( get_post_type( $pid ), Brizy_Editor::get()->supported_post_types() ) &&
|
||||
Brizy_Editor_Entity::isBrizyEnabled( $pid )
|
||||
) {
|
||||
$rmTpl = true;
|
||||
}
|
||||
} catch ( Exception $e ) {}
|
||||
|
||||
try {
|
||||
if ( Brizy_Admin_Templates::instance()->getTemplateForCurrentPage() ) {
|
||||
$rmTpl = true;
|
||||
}
|
||||
} catch ( Exception $e ) {}
|
||||
|
||||
if ( $rmTpl ) {
|
||||
remove_filter( 'bbp_template_include', 'bbp_template_include_theme_compat', 4 );
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not return html in the forums list admin panel if forum is edited with brizy.
|
||||
*/
|
||||
public function bbp_get_forum_content( $content, $forumId ) {
|
||||
|
||||
global $pagenow;
|
||||
|
||||
if ( ! is_admin() || 'edit.php' != $pagenow || ! isset( $_GET['post_type'] ) || bbp_get_forum_post_type() != $_GET['post_type'] || ! Brizy_Editor_Entity::isBrizyEnabled( $forumId ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not allow to edit replies with brizy, only creating templates for them is allowed.
|
||||
*/
|
||||
public function settings_post_types( $types ) {
|
||||
|
||||
$reply = bbp_get_reply_post_type();
|
||||
|
||||
if ( isset( $types[ $reply ] ) ) {
|
||||
unset( $types[ $reply ] );
|
||||
}
|
||||
|
||||
return $types;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_BrizyProCompatibility {
|
||||
|
||||
public function __construct() {
|
||||
if(version_compare(BRIZY_MINIMUM_PRO_VERSION, BRIZY_PRO_VERSION)>0) {
|
||||
$proMain = new BrizyPro_Main();
|
||||
add_action( 'wp_loaded', [ $proMain, 'wordpressLoaded' ], 11 );
|
||||
add_action( 'admin_notices', [ $this, 'brizypro_upgrade_required' ] );
|
||||
add_action( 'brizy_allow_plugin_included', '__return_false' );
|
||||
// Avoid fatal errors for pro versions older than 0.0.37
|
||||
remove_action( 'plugins_loaded', 'brizy_pro_load' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $upgrader_object
|
||||
* @param $options
|
||||
*/
|
||||
public function brizypro_upgrade_required() {
|
||||
?>
|
||||
<div class="notice notice-error is-dismissible">
|
||||
<p>
|
||||
<b><?php echo strtoupper( __bt( 'brizy', 'Brizy' ) ) ?> PRO IS NOT RUNNING. </b><br>
|
||||
Please update <?php echo __bt( 'brizy', 'Brizy' ) ?> PRO to the latest version.
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Broken Link Checker plugin: https://wordpress.org/plugins/broken-link-checker/
|
||||
*/
|
||||
class Brizy_Compatibilities_BrokenLinkChecker {
|
||||
|
||||
public function __construct() {
|
||||
$this->insert_exclusion();
|
||||
}
|
||||
|
||||
public function insert_exclusion() {
|
||||
|
||||
global $blc_config_manager;
|
||||
|
||||
if ( ! isset( $blc_config_manager->options['exclusion_list'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$excludeRules = array_diff( [ '_dc_', 'SITE_URL_PLACEHOLDER' ], $blc_config_manager->options['exclusion_list'] );
|
||||
$blc_config_manager->options['exclusion_list'] = array_merge( $blc_config_manager->options['exclusion_list'], $excludeRules );
|
||||
}
|
||||
}
|
||||
27
wp-content/plugins/brizy/compatibilities/events-manager.php
Normal file
27
wp-content/plugins/brizy/compatibilities/events-manager.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* https://wordpress.org/plugins/events-manager/
|
||||
*/
|
||||
class Brizy_Compatibilities_EventsManager {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'the_content', [ $this, 'the_content' ], 9 );
|
||||
}
|
||||
|
||||
public function the_content( $content ) {
|
||||
global $post;
|
||||
|
||||
$postTypes = [ EM_POST_TYPE_LOCATION, EM_POST_TYPE_EVENT ];
|
||||
$postType = $post->post_type;
|
||||
|
||||
if ( ! in_array( $postType, $postTypes ) || false === strpos( $content, 'brz-root__container' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$class = $postType == EM_POST_TYPE_LOCATION ? 'EM_Location_Post' : 'EM_Event_Post';
|
||||
|
||||
remove_filter( 'the_content', [ $class, 'the_content' ] );
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Compatibility with Fast Velocity Minify plugin: https://wordpress.org/plugins/fast-velocity-minify/
|
||||
*/
|
||||
class Brizy_Compatibilities_FastVelocityMinify {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'remove_actions' ), 9 );
|
||||
}
|
||||
|
||||
public function remove_actions() {
|
||||
|
||||
if ( ! isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) && ! isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
remove_action( 'wp_print_scripts', 'fastvelocity_min_merge_header_scripts', PHP_INT_MAX );
|
||||
remove_action( 'wp_print_footer_scripts', 'fastvelocity_min_merge_footer_scripts', 9.999999 );
|
||||
remove_action( 'wp_print_styles', 'fastvelocity_min_merge_header_css', PHP_INT_MAX );
|
||||
remove_action( 'wp_print_footer_scripts', 'fastvelocity_min_merge_footer_css', 9.999999 );
|
||||
remove_action( 'init', 'fastvelocity_min_disable_wp_emojicons' );
|
||||
remove_action( 'template_redirect', 'fastvelocity_min_html_compression_start', PHP_INT_MAX );
|
||||
remove_filter( 'style_loader_src', 'fastvelocity_remove_cssjs_ver', 10 );
|
||||
remove_filter( 'script_loader_tag', 'fastvelocity_min_defer_js', 10 );
|
||||
remove_filter( 'script_loader_tag', 'fastvelocity_min_defer_js_optimize', 10 );
|
||||
}
|
||||
}
|
||||
135
wp-content/plugins/brizy/compatibilities/gutenberg.php
Normal file
135
wp-content/plugins/brizy/compatibilities/gutenberg.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_Gutenberg {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'the_content', array( $this, 'filter_the_content' ), 5 );
|
||||
add_action( 'admin_print_scripts-edit.php', array( $this, 'add_edit_button_to_gutenberg' ), 12 );
|
||||
add_action( 'admin_init', array( $this, 'action_disable_gutenberg' ) );
|
||||
add_action( 'admin_footer', array( $this, 'print_admin_footer_tpls' ) );
|
||||
add_action( 'admin_head', [ $this, 'admin_head' ] );
|
||||
}
|
||||
|
||||
|
||||
public function filter_the_content( $content ) {
|
||||
remove_filter( 'the_content', 'gutenberg_wpautop', 6 );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function add_edit_button_to_gutenberg() {
|
||||
global $typenow;
|
||||
|
||||
$new_post_url = add_query_arg( array(
|
||||
'action' => 'brizy_new_post',
|
||||
'post_type' => $typenow,
|
||||
), set_url_scheme( admin_url( 'edit.php' ) ) );
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var dropdown = document.querySelector('#split-page-title-action .dropdown');
|
||||
|
||||
if (!dropdown) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = '<?php echo esc_attr( $new_post_url ); ?>';
|
||||
|
||||
dropdown.insertAdjacentHTML('afterbegin', '<a href="' + url + '">Brizy</a>');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function action_disable_gutenberg() {
|
||||
|
||||
global $pagenow;
|
||||
|
||||
if ( ! in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) || ! isset( $_GET['post'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! in_array( get_post_type( $_GET['post'] ), Brizy_Editor::get()->supported_post_types() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if ( Brizy_Editor_Entity::isBrizyEnabled($_GET['post']) ) {
|
||||
add_filter( 'gutenberg_can_edit_post_type', '__return_false' );
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function print_admin_footer_tpls() {
|
||||
|
||||
global $pagenow;
|
||||
|
||||
if ( ! in_array( $pagenow, array( 'post-new.php', 'post.php' ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! in_array( get_post_type(), Brizy_Editor::get()->supported_post_types() ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$continueUrl = add_query_arg(
|
||||
array( Brizy_Editor::prefix('-edit') => '' ),
|
||||
get_permalink( get_the_ID() )
|
||||
);
|
||||
|
||||
try {
|
||||
if ( Brizy_Editor_Entity::isBrizyEnabled( get_the_ID() ) ) {
|
||||
$edit_url = esc_url( admin_url( 'admin-post.php?action=_brizy_admin_editor_disable&post=' . get_the_ID() ) );
|
||||
?>
|
||||
<script id="brizy-gutenberg-btn-switch-mode" type="text/html">
|
||||
<div class="brizy-buttons">
|
||||
<a class="brizy-button brizy-button--primary enable-brizy-editor" href="<?php echo $edit_url ?>">
|
||||
<?php echo __( 'Back to WordPress Editor', 'brizy' ) ?>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
<script id="brizy-gutenberg-btn-middle" type="text/html">
|
||||
<div class="brizy-buttons brizy-buttons-gutenberg">
|
||||
<a href="<?php echo $continueUrl; ?>" class="">
|
||||
<div class="button button-primary button-large">
|
||||
<?php printf( esc_html__( 'Edit with %s', 'brizy' ), __bt( 'brizy', 'Brizy' ) ); ?>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
$edit_url = esc_url( admin_url( 'admin-post.php?action=_brizy_admin_editor_enable&post=' . get_the_ID() ) );
|
||||
|
||||
?>
|
||||
<script id="brizy-gutenberg-btn-switch-mode" type="text/html">
|
||||
<div class="brizy-buttons" >
|
||||
<a href="<?php echo $edit_url;?>" class="button button-primary button-large">
|
||||
<?php printf( esc_html__( 'Edit with %s', 'brizy' ), __bt( 'brizy', 'Brizy' ) ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
} catch ( Exception $e ) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function admin_head() {
|
||||
|
||||
echo
|
||||
'<style>
|
||||
.brizy-buttons .button::before {
|
||||
-webkit-mask: url(' . __bt( 'brizy-logo', plugins_url( '../admin/static/img/brizy-logo.svg', __FILE__ ) ) . ') no-repeat center;
|
||||
mask: url(' . __bt( 'brizy-logo', plugins_url( '../admin/static/img/brizy-logo.png', __FILE__ ) ) . ') no-repeat center;
|
||||
mask-size: contain;
|
||||
-webkit-mask-size: contain;
|
||||
}' .
|
||||
'</style>';
|
||||
}
|
||||
}
|
||||
152
wp-content/plugins/brizy/compatibilities/init.php
Normal file
152
wp-content/plugins/brizy/compatibilities/init.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_Init {
|
||||
|
||||
public function __construct() {
|
||||
$this->load_compatibilites();
|
||||
add_action( 'plugins_loaded', array( $this, 'action_plugins_loaded' ), 9 );
|
||||
add_action( 'after_setup_theme', [ $this, 'after_setup_theme' ] );
|
||||
}
|
||||
|
||||
private function load_compatibilites() {
|
||||
global $wp_version;
|
||||
|
||||
if ( function_exists( 'w3tc_add_ob_callback' ) || function_exists( 'w3tc_class_autoload' ) ) {
|
||||
new Brizy_Compatibilities_Wtc();
|
||||
}
|
||||
|
||||
$version_compare = version_compare( $wp_version, '5' );
|
||||
|
||||
if ( function_exists( 'gutenberg_init' ) || $version_compare >= 0 ) {
|
||||
new Brizy_Compatibilities_Gutenberg();
|
||||
}
|
||||
|
||||
if ( function_exists( 'autoptimize' ) ) {
|
||||
new Brizy_Compatibilities_Autoptimize();
|
||||
}
|
||||
|
||||
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_WPML();
|
||||
}
|
||||
|
||||
if ( function_exists( 'fvm_cachepath' ) ) {
|
||||
new Brizy_Compatibilities_FastVelocityMinify();
|
||||
}
|
||||
|
||||
if ( class_exists( 'Phast_Plugins_Bootstrap' ) ) {
|
||||
new Brizy_Compatibilities_Phastpress();
|
||||
}
|
||||
|
||||
new Brizy_Compatibilities_WordpressMuDomainMapping();
|
||||
|
||||
if ( $this->is_plugin_active( 'sg-cachepress/sg-cachepress.php' ) ) {
|
||||
new Brizy_Compatibilities_SgOptimizer();
|
||||
}
|
||||
|
||||
if ( defined( 'SEOPRESS_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_SeoPress();
|
||||
}
|
||||
|
||||
if ( function_exists( 'WPNCEasyWP' ) ) {
|
||||
new Brizy_Compatibilities_NcEasywp();
|
||||
}
|
||||
|
||||
if ( defined( 'ASTRA_EXT_FILE' ) ) {
|
||||
new Brizy_Compatibilities_AstraAddon();
|
||||
}
|
||||
}
|
||||
|
||||
public function action_plugins_loaded() {
|
||||
if ( function_exists( 'wpseo_auto_load' ) ) {
|
||||
new Brizy_Compatibilities_YoastSeo();
|
||||
}
|
||||
|
||||
if ( is_admin() ) {
|
||||
if ( class_exists( 'blcConfigurationManager' ) ) {
|
||||
new Brizy_Compatibilities_BrokenLinkChecker();
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined( 'LSCWP_V' ) ) {
|
||||
new Brizy_Compatibilities_LiteSpeed();
|
||||
}
|
||||
|
||||
if ( defined( 'TRP_GP_PLUGIN_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_TpAddOnLanguageByGetParameter();
|
||||
}
|
||||
|
||||
if ( defined( 'EM_POST_TYPE_LOCATION' ) ) {
|
||||
new Brizy_Compatibilities_EventsManager();
|
||||
}
|
||||
|
||||
if ( defined( 'POLYLANG_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_Polylang();
|
||||
}
|
||||
|
||||
if ( class_exists( 'TRP_Translate_Press' ) ) {
|
||||
new Brizy_Compatibilities_TranslatePress();
|
||||
}
|
||||
|
||||
if ( class_exists( 'WooCommerce' ) ) {
|
||||
new Brizy_Compatibilities_Woocommerce();
|
||||
}
|
||||
|
||||
if ( class_exists( 'bbPress' ) ) {
|
||||
new Brizy_Compatibilities_Bbpress();
|
||||
}
|
||||
|
||||
if ( class_exists( 'Tribe__Events__Main' ) ) {
|
||||
new Brizy_Compatibilities_TheEventsCalendar();
|
||||
}
|
||||
|
||||
if ( defined( 'BRIZY_PRO_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_BrizyProCompatibility();
|
||||
}
|
||||
|
||||
if ( defined( 'JOB_MANAGER_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_WpJobManager();
|
||||
}
|
||||
|
||||
if ( function_exists( 'wp_copyright_protection' ) ) {
|
||||
new Brizy_Compatibilities_WpCopyrightProtection();
|
||||
}
|
||||
|
||||
if ( defined( 'DS_LIVE_COMPOSER_VER' ) ) {
|
||||
new Brizy_Compatibilities_LiveComposerPageBuilder();
|
||||
}
|
||||
|
||||
if ( class_exists( 'Wp_Ultimo' ) ) {
|
||||
new Brizy_Compatibilities_WpUltimo();
|
||||
}
|
||||
|
||||
if ( defined( 'PERFMATTERS_VERSION' ) ) {
|
||||
new Brizy_Compatibilities_Perfmatters();
|
||||
}
|
||||
}
|
||||
|
||||
public function after_setup_theme() {
|
||||
if ( function_exists( 'tf_autoload' ) ) {
|
||||
new Brizy_Compatibilities_Tfuse();
|
||||
}
|
||||
}
|
||||
|
||||
private function is_plugin_active( $plugin_file ) {
|
||||
|
||||
$apply_filters = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
|
||||
if ( is_array( $apply_filters ) && in_array( $plugin_file, $apply_filters ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$plugins = get_site_option( 'active_sitewide_plugins' );
|
||||
|
||||
if ( isset( $plugins[ $plugin_file ] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
17
wp-content/plugins/brizy/compatibilities/lite-speed.php
Normal file
17
wp-content/plugins/brizy/compatibilities/lite-speed.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Compatibility with LiteSpeed plugin: https://wordpress.org/plugins/litespeed-cache/
|
||||
*/
|
||||
class Brizy_Compatibilities_LiteSpeed {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'litespeed_init', [ $this, 'litespeed_init' ] );
|
||||
}
|
||||
|
||||
public function litespeed_init() {
|
||||
if ( isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) || isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
do_action( 'litespeed_disable_all', 'brizy edit mode' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with Page Builder: Live Composer plugin: https://wordpress.org/plugins/live-composer-page-builder/
|
||||
*/
|
||||
class Brizy_Compatibilities_LiveComposerPageBuilder {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp', [ $this, 'wp' ] );
|
||||
}
|
||||
|
||||
public function wp() {
|
||||
if (
|
||||
! isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] )
|
||||
&&
|
||||
isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] )
|
||||
&&
|
||||
! Brizy_Editor_Entity::isBrizyEnabled( get_the_ID() )
|
||||
&&
|
||||
! Brizy_Admin_Templates::getTemplate()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Conflict with Live Composer builder when it has set a template for single post.
|
||||
remove_filter( 'the_content', 'dslc_filter_content', 101 );
|
||||
// Remove button "Edit Template" from single when it is builded with brizy.
|
||||
remove_filter( 'wp_footer', [ 'DSLC_EditorInterface', 'show_lc_button_on_front' ] );
|
||||
}
|
||||
}
|
||||
16
wp-content/plugins/brizy/compatibilities/nc-easywp.php
Normal file
16
wp-content/plugins/brizy/compatibilities/nc-easywp.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_NcEasywp {
|
||||
|
||||
public function __construct() {
|
||||
if ( class_exists( '\WPNCEasyWP\Http\Varnish\VarnishCache' ) ) {
|
||||
add_action( 'brizy_before_send_asset', [ $this, 'before_send_asset' ] );
|
||||
}
|
||||
}
|
||||
|
||||
public function before_send_asset() {
|
||||
do_action('clear_redis');
|
||||
do_action('clear_varnish');
|
||||
do_action('clear_opcache');
|
||||
}
|
||||
}
|
||||
31
wp-content/plugins/brizy/compatibilities/perfmatters.php
Normal file
31
wp-content/plugins/brizy/compatibilities/perfmatters.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Perfmatters plugin: https://perfmatters.io/
|
||||
*/
|
||||
class Brizy_Compatibilities_Perfmatters {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'after_setup_theme', [ $this, 'disablePluginOptions' ] );
|
||||
}
|
||||
|
||||
public function disablePluginOptions() {
|
||||
if ( ! isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) && ! isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'option_perfmatters_options', [ $this, 'removeOptions' ] );
|
||||
}
|
||||
|
||||
public function removeOptions( $options ) {
|
||||
if ( isset( $options['assets']['defer_js'] ) ) {
|
||||
unset( $options['assets']['defer_js'] );
|
||||
}
|
||||
|
||||
if ( isset( $options['assets']['delay_js'] ) ) {
|
||||
unset( $options['assets']['delay_js'] );
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
19
wp-content/plugins/brizy/compatibilities/phastpress.php
Normal file
19
wp-content/plugins/brizy/compatibilities/phastpress.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with PhastPress plugin: https://wordpress.org/plugins/phastpress/
|
||||
*/
|
||||
class Brizy_Compatibilities_Phastpress {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'plugins_loaded', array( $this, 'disable_phastpress' ), 9 );
|
||||
}
|
||||
|
||||
public function disable_phastpress() {
|
||||
|
||||
if ( ! isset( $_GET[Brizy_Editor::prefix('-edit')] ) && ! isset( $_GET[Brizy_Editor::prefix('-edit-iframe')] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'phastpress_disable', '__return_true' );
|
||||
}
|
||||
}
|
||||
16
wp-content/plugins/brizy/compatibilities/polylang.php
Normal file
16
wp-content/plugins/brizy/compatibilities/polylang.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/*
|
||||
* https://wordpress.org/plugins/polylang/
|
||||
*/
|
||||
class Brizy_Compatibilities_Polylang {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'brizy_post_loop_args', [ $this, 'post_loop_args' ] );
|
||||
}
|
||||
|
||||
public function post_loop_args( $args ) {
|
||||
$args['lang'] = '';
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
35
wp-content/plugins/brizy/compatibilities/seo-press.php
Normal file
35
wp-content/plugins/brizy/compatibilities/seo-press.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_SeoPress {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'rewrite_rules_array', array( $this, 'fixRewriteRules' ), 9998 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $rules
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fixRewriteRules( $rules ) {
|
||||
|
||||
foreach ( $rules as $regex => $rule ) {
|
||||
|
||||
$key_position = array_search( $regex, array_keys($rules) );
|
||||
$newRegex = str_replace( '(/page/(\d+))', '(?:/page/(\d+))', $regex );
|
||||
|
||||
unset($rules[$regex]);
|
||||
|
||||
$array_1 = array_slice( $rules, 0, $key_position, true );
|
||||
$array_slice = array_slice( $rules, $key_position, null, true );
|
||||
$rules = array_merge(
|
||||
$array_1,
|
||||
array( $newRegex => $rule ), // Notice the new key ends with "_db"
|
||||
$array_slice
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
19
wp-content/plugins/brizy/compatibilities/sg-optimizer.php
Normal file
19
wp-content/plugins/brizy/compatibilities/sg-optimizer.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with LiteSpeed plugin: https://wordpress.org/plugins/sg-cachepress/
|
||||
*/
|
||||
class Brizy_Compatibilities_SgOptimizer {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
if ( isset( $_GET[Brizy_Editor::prefix('-edit')] ) || isset( $_GET[Brizy_Editor::prefix('-edit-iframe')] ) || isset( $_GET[Brizy_Editor::prefix('_post')] ) ) {
|
||||
|
||||
add_filter( 'option_siteground_optimizer_optimize_html', '__return_false' );
|
||||
add_filter( 'option_siteground_optimizer_optimize_javascript', '__return_false' );
|
||||
add_filter( 'option_siteground_optimizer_optimize_css', '__return_false' );
|
||||
add_filter( 'option_siteground_optimizer_optimize_javascript_async', '__return_false' );
|
||||
add_filter( 'option_siteground_optimizer_lazyload_images', '__return_false' );
|
||||
add_filter( 'option_siteground_optimizer_combine_css', '__return_false' );
|
||||
}
|
||||
}
|
||||
}
|
||||
17
wp-content/plugins/brizy/compatibilities/tfuse.php
Normal file
17
wp-content/plugins/brizy/compatibilities/tfuse.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_Tfuse {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'the_content', [ $this, 'the_content' ] );
|
||||
}
|
||||
|
||||
public function the_content( $content ) {
|
||||
|
||||
if ( strpos( $content, 'brz-root__container' ) ) {
|
||||
remove_filter( 'the_content', 'tfuse_formatter', 99 );
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* https://wordpress.org/plugins/the-events-calendar/
|
||||
*/
|
||||
class Brizy_Compatibilities_TheEventsCalendar {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp_head', [ $this, 'wp_head' ], 99 );
|
||||
add_action( 'loop_start', [ $this, 'loop_start' ], 999 );
|
||||
}
|
||||
|
||||
public function wp_head() {
|
||||
if ( $this->isEvent() ) {
|
||||
remove_action( 'wp_head', [ 'Tribe__Events__Templates', 'maybeSpoofQuery' ], 100 );
|
||||
}
|
||||
}
|
||||
|
||||
public function loop_start() {
|
||||
if ( $this->isEvent() ) {
|
||||
add_action( 'tribe_events_views_v2_should_hijack_page_template', '__return_false' );
|
||||
}
|
||||
}
|
||||
|
||||
public function isEvent() {
|
||||
|
||||
if ( ! tribe_is_event_query() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) || isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( Brizy_Editor_Entity::isBrizyEnabled( get_the_ID() ) || Brizy_Admin_Templates::getTemplate() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with TranslatePress - Language by GET parameter Add-on: https://wordpress.org/plugins/sg-cachepress/
|
||||
*/
|
||||
class Brizy_Compatibilities_TpAddOnLanguageByGetParameter {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'brizy_content', [ $this, 'brizy_content' ] );
|
||||
}
|
||||
|
||||
public function brizy_content( $content ) {
|
||||
|
||||
add_filter( 'trp_home_url', [ $this, 'trp_home_url' ], 10, 2 );
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function trp_home_url( $new_url, $abs_home ) {
|
||||
return $abs_home;
|
||||
}
|
||||
}
|
||||
66
wp-content/plugins/brizy/compatibilities/translate-press.php
Normal file
66
wp-content/plugins/brizy/compatibilities/translate-press.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with TranslatePress – Translate Multilingual sites: https://wordpress.org/plugins/translatepress-multilingual/
|
||||
*/
|
||||
class Brizy_Compatibilities_TranslatePress {
|
||||
|
||||
static $url = '';
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'brizy_toolbar_link', [ $this, 'brizy_toolbar_link' ], 10, 2 );
|
||||
add_action( 'trp_translated_html', [ $this, 'trp_translated_html' ], 10 );
|
||||
add_action( 'home_url', [ $this, 'home_url' ] );
|
||||
add_action( 'brizy_create_editor_config_before', [ $this, 'rmLangPrefixFromHomeUrl' ] );
|
||||
add_action( 'brizy_create_editor_config_after', [ $this, 'rmFilterTrpHomeUrl' ] );
|
||||
add_action( 'brizy_before_send_asset', [ $this, 'clearBufferBeforeSendImg' ] );
|
||||
}
|
||||
|
||||
public function home_url( $url ) {
|
||||
return rtrim( $url, '/' );
|
||||
}
|
||||
|
||||
public function brizy_toolbar_link( $url, $post ) {
|
||||
|
||||
global $TRP_LANGUAGE;
|
||||
|
||||
$settings = new TRP_Settings();
|
||||
$settings = $settings->get_settings();
|
||||
|
||||
if ( $TRP_LANGUAGE == $settings['default-language'] && !trp_is_translation_editor() ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
add_filter( 'trp_home_url', [ $this, 'trp_home_url' ], 10, 5 );
|
||||
$url = base64_encode( preg_replace("(^https?://)", "", $post->edit_url() ) );
|
||||
self::$url = $url;
|
||||
remove_filter( 'trp_home_url', [ $this, 'trp_home_url' ] );
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function trp_translated_html( $html ) {
|
||||
return str_replace( self::$url, base64_decode( self::$url ), $html );
|
||||
}
|
||||
|
||||
public function trp_home_url( $new_url, $abs_home, $TRP_LANGUAGE, $path, $url ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove language prefix from the home url before compilation.
|
||||
* If the page is compilated on a non default language url(http://brizy.local/ro/about/) then images will have the url with the language prefix in the html.
|
||||
* background-image: url({@brizy_SITE_URL_PLACEHOLDER@}/ro/?brizy_media=wp-48eefa376f2dc71bb9eb5ce2bb5e0b48&brizy_crop=iW%3D5000%26iH%3Dany)
|
||||
* In this case Brizy_Editor_Asset_MediaAssetProcessor won't find all the images in the html.
|
||||
*/
|
||||
public function rmLangPrefixFromHomeUrl() {
|
||||
add_filter( 'trp_home_url', [ $this, 'trp_home_url' ], 10, 5 );
|
||||
}
|
||||
|
||||
public function rmFilterTrpHomeUrl() {
|
||||
remove_filter( 'trp_home_url', [ $this, 'trp_home_url' ] );
|
||||
}
|
||||
|
||||
public function clearBufferBeforeSendImg() {
|
||||
ob_end_clean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with Webcraftic Clearfy – WordPress optimization plugin: https://wordpress.org/plugins/clearfy/
|
||||
*/
|
||||
class Brizy_Compatibilities_WebcrafticClearfy {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wbcr/factory/populate_option_js_optimize', array( $this, 'disable_js_optimize' ), 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $is_minify
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function disable_js_optimize( $is_minify ) {
|
||||
|
||||
if ( isset( $_GET[Brizy_Editor::prefix('-edit')] ) || isset( $_GET[Brizy_Editor::prefix('-edit-iframe')] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $is_minify;
|
||||
}
|
||||
}
|
||||
64
wp-content/plugins/brizy/compatibilities/woocommerce.php
Normal file
64
wp-content/plugins/brizy/compatibilities/woocommerce.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_Woocommerce {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'woocommerce_checkout_terms_and_conditions', [ $this, 'woocommerce_checkout_terms_and_conditions' ], 29 );
|
||||
add_action( 'wp_enqueue_scripts', [ $this, 'wp_enqueue_scripts' ], 11 );
|
||||
add_filter( 'brizy_html_entity_decode', '__return_false' );
|
||||
add_filter( 'brizy_template_content_compiled', [ $this, 'insertWooNotice' ] );
|
||||
}
|
||||
|
||||
/*
|
||||
* Dont allow woo to render post_content of the terms page if it is edited with the brizy,
|
||||
* will lead to the display of the unformatted our html above the place order button on checkout page.
|
||||
*/
|
||||
public function woocommerce_checkout_terms_and_conditions() {
|
||||
$terms_page_id = wc_terms_and_conditions_page_id();
|
||||
|
||||
if ( ! $terms_page_id || ! Brizy_Editor_Entity::isBrizyEnabled( $terms_page_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 );
|
||||
}
|
||||
|
||||
public function wp_enqueue_scripts() {
|
||||
|
||||
if ( ! isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) && ! isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'geolocation_ajax' === get_option( 'woocommerce_default_customer_address' ) ) {
|
||||
wp_dequeue_script( 'wc-geolocation' );
|
||||
}
|
||||
}
|
||||
|
||||
public function insertWooNotice( $content ) {
|
||||
|
||||
$notices = wc_print_notices( true );
|
||||
|
||||
if ( empty( $content ) || empty( $notices ) || false == strpos( $content, 'brz-section__header ' ) ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$dom = Brizy_Parser_Pquery::parseStr( $content );
|
||||
|
||||
$dom->query('section.brz-section__header')->after( $notices );
|
||||
|
||||
return $dom->html();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with WordPress MU Domain Mapping plugin: https://wordpress.org/plugins/wordpress-mu-domain-mapping/
|
||||
*/
|
||||
class Brizy_Compatibilities_WordpressMuDomainMapping {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'template_redirect', array( $this, 'remove_redirect_to_mapped_domain' ), 9 );
|
||||
}
|
||||
|
||||
public function remove_redirect_to_mapped_domain() {
|
||||
|
||||
if ( isset( $_GET[Brizy_Editor::prefix('-edit')] ) || isset( $_GET[Brizy_Editor::prefix('-edit-iframe')] ) ) {
|
||||
remove_action( 'template_redirect', 'redirect_to_mapped_domain' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Compatibility with LiteSpeed plugin: https://wordpress.org/plugins/wp-copyright-protection/
|
||||
* This plugin loads a script js which disable the right click on frontend.
|
||||
* Its purpose is to prevent users from copying the text from the site, a way to prevent copyright.
|
||||
*/
|
||||
class Brizy_Compatibilities_WpCopyrightProtection {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp', [ $this, 'disable_js_optimize' ] );
|
||||
}
|
||||
|
||||
public function disable_js_optimize() {
|
||||
if ( isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) || isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
remove_action('wp_head', 'wp_copyright_protection');
|
||||
}
|
||||
}
|
||||
}
|
||||
28
wp-content/plugins/brizy/compatibilities/wp-job-manager.php
Normal file
28
wp-content/plugins/brizy/compatibilities/wp-job-manager.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* https://wordpress.org/plugins/wp-job-manager/
|
||||
*/
|
||||
class Brizy_Compatibilities_WpJobManager {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'the_content', [ $this, 'the_content' ], 9 );
|
||||
}
|
||||
|
||||
public function the_content( $content ) {
|
||||
global $post;
|
||||
|
||||
if ( ! is_singular( 'job_listing' ) || ! in_the_loop() || 'job_listing' !== $post->post_type ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
if ( ! Brizy_Editor_Entity::isBrizyEnabled( get_the_ID() ) && ! Brizy_Admin_Templates::getTemplate() ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
$jobManager = WP_Job_Manager_Post_Types::instance();
|
||||
|
||||
remove_filter( 'the_content', [ $jobManager, 'job_content' ] );
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
36
wp-content/plugins/brizy/compatibilities/wp-ultimo.php
Normal file
36
wp-content/plugins/brizy/compatibilities/wp-ultimo.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_WpUltimo {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'init', [ $this, 'init' ] );
|
||||
}
|
||||
|
||||
public function init() {
|
||||
if ( isset( $_GET[ Brizy_Editor::prefix( '-edit' ) ] ) || isset( $_GET[ Brizy_Editor::prefix( '-edit-iframe' ) ] ) ) {
|
||||
add_filter( 'brizy_editor_config', [ $this, 'remappingAssetsUrl' ] );
|
||||
}
|
||||
}
|
||||
|
||||
public function remappingAssetsUrl( $config ) {
|
||||
|
||||
if ( ! class_exists( 'Mercator\Mapping' ) ) {
|
||||
return $config;
|
||||
}
|
||||
|
||||
$mapping = Mercator\Mapping::get_by_domain( $_SERVER['HTTP_HOST'] );
|
||||
|
||||
if ( empty( $mapping ) || ! $mapping->is_active() ) {
|
||||
return $config;
|
||||
}
|
||||
|
||||
$url_mapped = $mapping->get_domain();
|
||||
|
||||
$original_url = get_blog_option( $mapping->get_site_id(), 'siteurl' );
|
||||
$original_url = trim( preg_replace( '#^https?://#', '', $original_url ), '/' );
|
||||
|
||||
$config['urls']['assets'] = str_replace( $original_url, $url_mapped, $config['urls']['assets'] );
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
90
wp-content/plugins/brizy/compatibilities/wpml.php
Normal file
90
wp-content/plugins/brizy/compatibilities/wpml.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Compatibility with WPML
|
||||
*/
|
||||
class Brizy_Compatibilities_WPML {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp_insert_post', array( $this, 'insertNewPost' ), - 10000, 3 );
|
||||
add_action( 'wp_insert_post', array( $this, 'duplicatePosts' ), - 10000, 3 );
|
||||
add_action( 'pre_get_posts', [ $this, 'pre_get_posts' ], 11 );
|
||||
add_action( 'wp_ajax_wpml-ls-save-settings', [ $this, 'save_settings' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* This will duplicate the brizy data for bulk duplicate
|
||||
*
|
||||
* @param $postId
|
||||
* @param $post
|
||||
*
|
||||
* @throws Brizy_Editor_Exceptions_NotFound
|
||||
*/
|
||||
public function duplicatePosts( $postId, $post ) {
|
||||
global $wpml_post_translations;
|
||||
$postType = $post->post_type;
|
||||
|
||||
if ( isset( $_POST['langs'] ) ) {
|
||||
if ( $wpml_post_translations && is_post_type_translated( $postType ) ) {
|
||||
$currentBrizyPost = Brizy_Editor_Post::get( (int) $_POST['post_id'] );
|
||||
$currentBrizyPost->duplicateTo( (int) $postId );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This will duplicate the brizy post data when the plus sign is clicked
|
||||
*
|
||||
* @param $postId
|
||||
* @param $post
|
||||
*
|
||||
* @throws Brizy_Editor_Exceptions_NotFound
|
||||
*/
|
||||
public function insertNewPost( $postId, $post ) {
|
||||
global $wpml_post_translations;
|
||||
$postType = $post->post_type;
|
||||
|
||||
if ( isset( $_REQUEST['trid'] ) && isset( $_REQUEST['lang'] ) && isset( $_REQUEST['source_lang'] ) ) {
|
||||
if ( $wpml_post_translations && is_post_type_translated( $postType ) ) {
|
||||
$originalTranslation = $wpml_post_translations->get_element_id( $_REQUEST['source_lang'], $_REQUEST['trid'] );
|
||||
try {
|
||||
$originalBrizyPost = Brizy_Editor_Post::get( (int) $originalTranslation );
|
||||
$originalBrizyPost->duplicateTo( (int) $postId );
|
||||
} catch (Exception $e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $query
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pre_get_posts( $query ) {
|
||||
|
||||
if ( isset( $query->query['post_type'] ) && 'attachment' === $query->query['post_type'] && isset( $query->query['meta_query'] ) ) {
|
||||
array_walk_recursive(
|
||||
$query->query['meta_query'],
|
||||
function ( $value, $key ) use ( $query ) {
|
||||
if ( 'brizy-font-weight' === $value ) {
|
||||
$query->set( 'suppress_filters', true );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function save_settings() {
|
||||
|
||||
parse_str($_POST['settings'], $result);
|
||||
|
||||
if ( ! isset( $result['menus'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Brizy_Editor_Post::mark_all_for_compilation();
|
||||
}
|
||||
}
|
||||
17
wp-content/plugins/brizy/compatibilities/wtc.php
Normal file
17
wp-content/plugins/brizy/compatibilities/wtc.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* Compatibility with W3 Total Cache: https://wordpress.org/plugins/w3-total-cache/
|
||||
* Compatibility with A2 Fixed W3 Total Cache by a2hosting.com a plugin contains some bug fixes for W3 Total Cache ususally used only on a2hosting servers.
|
||||
*/
|
||||
class Brizy_Compatibilities_Wtc {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'wp_loaded', array( $this, 'action_disable_minify' ) );
|
||||
}
|
||||
|
||||
public function action_disable_minify() {
|
||||
if ( isset( $GLOBALS['_w3tc_ob_callbacks']['minify'] ) ) {
|
||||
unset( $GLOBALS['_w3tc_ob_callbacks']['minify'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
42
wp-content/plugins/brizy/compatibilities/yoast-seo.php
Normal file
42
wp-content/plugins/brizy/compatibilities/yoast-seo.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Compatibilities_YoastSeo {
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'wpseo_twitter_image', array( $this, 'wpseo_twitter_image' ) );
|
||||
add_filter( 'brizy_html_entity_decode', '__return_false' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Yoast has a feature to add twitter share image.
|
||||
* If this image or featured image is not added then
|
||||
* it takes the first image from the post content.
|
||||
* These action is made in the hook wp_head and we
|
||||
* haven't replaced the urls yet. Here's why we see:
|
||||
* <meta name="twitter:image" content="http://@brizy_SITE_URL_PLACEHOLDER@/?
|
||||
*
|
||||
* @param $img_url
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function wpseo_twitter_image( $img_url ) {
|
||||
|
||||
try {
|
||||
$project = Brizy_Editor_Project::get();
|
||||
$context = Brizy_Content_ContextFactory::createContext( $project, null, null, null );
|
||||
$urlBuilder = new Brizy_Editor_UrlBuilder( $project, null );
|
||||
$media_storage = new Brizy_Editor_Asset_MediaProxyStorage( $urlBuilder );
|
||||
$media_processor = new Brizy_Editor_Asset_MediaAssetProcessor( $media_storage );
|
||||
$domain_processor = new Brizy_Editor_Asset_DomainProcessor();
|
||||
$url = $domain_processor->process( $img_url, $context );
|
||||
$url = $media_processor->process( $url, $context );
|
||||
|
||||
return $url;
|
||||
} catch ( Exception $e ) {
|
||||
// do nothing... :) :)
|
||||
}
|
||||
|
||||
return $img_url;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user