JezK
Edit File: ElementorLibrarySync.php
<?php defined('AUTOUPDATER_LIB') or die; class AutoUpdater_Task_ElementorLibrarySync extends AutoUpdater_Task_Base { const ELEMENTOR_PREFIX = 'Elementor '; /** * @return array */ public function doTask() { AutoUpdater_Loader::loadClass('Helper_Extension'); $validation = AutoUpdater_Helper_Extension::validateElementorSlug($this->input('slug')); if ($validation !== null) { return $validation; } /** @see https://plugins.svn.wordpress.org/elementor/trunk/ */ $plugin_file = WP_PLUGIN_DIR . '/elementor/elementor.php'; $api_file = WP_PLUGIN_DIR . '/elementor/includes/api.php'; $data = get_file_data($plugin_file, array('Version' => 'Version')); $version = $data['Version']; if (version_compare($version, '2.0.0', '<')) { return array( 'success' => true, 'message' => self::ELEMENTOR_PREFIX . $version . ' is too old.', ); } if (file_exists($plugin_file) && file_exists($api_file)) { include_once $plugin_file; // phpcs:ignore include_once $api_file; // phpcs:ignore } /** @since 1.0.0 */ $api_class = '\Elementor\Api'; if (!class_exists($api_class)) { return array( 'success' => true, 'needs_refactor' => true, 'message' => $api_class . ' class not found. Version ' . $version, ); } $api = new $api_class(); /** @since 2.0.0 released on Feb, 2018 */ if (!method_exists($api_class, 'get_library_data')) { return array( 'success' => true, 'needs_refactor' => true, 'message' => $api_class . '::get_library_data method not found. Version ' . $version, ); } $data = $api->get_library_data(true); if (empty($data)) { return array( 'success' => false, 'message' => self::ELEMENTOR_PREFIX . $version . ' library sync failed.', ); } return array( 'success' => true, 'message' => self::ELEMENTOR_PREFIX . $version . ' library sync was successful.', ); } }