From 63b135e3edb36d216faca8ff03df79bba2768722 Mon Sep 17 00:00:00 2001 From: Chris Normansell Date: Mon, 22 Jul 2024 14:49:50 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Renamed=20the=20rest=20of=20the?= =?UTF-8?q?=20filters=20with=20gc=20to=20cwby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gathercontent-importer.php | 12 ++--- includes/classes/admin/ajax/handlers.php | 2 +- includes/classes/admin/enqueue.php | 6 +-- includes/classes/admin/mapping-wizard.php | 2 +- includes/classes/admin/mapping/base.php | 10 ++-- .../admin/mapping/field-types/types.php | 6 +-- .../admin/mapping/field-types/wpseo.php | 2 +- .../classes/admin/mapping/template-mapper.php | 2 +- includes/classes/api.php | 4 +- includes/classes/debug.php | 8 ++-- .../classes/post-types/template-mappings.php | 10 ++-- includes/classes/settings/form-section.php | 6 +-- includes/classes/sync/base.php | 4 +- includes/classes/sync/pull.php | 46 +++++++++---------- includes/classes/sync/push.php | 12 ++--- includes/classes/utils.php | 4 +- includes/classes/views/view.php | 2 +- includes/functions/core.php | 4 +- includes/functions/functions.php | 8 ++-- includes/views/system-info.php | 4 +- includes/views/tmpl-gc-mapping-tab-row.php | 6 +-- tests/phpunit/Core_Tests.php | 4 +- 22 files changed, 81 insertions(+), 83 deletions(-) diff --git a/gathercontent-importer.php b/gathercontent-importer.php index b3d2308a..03fec2c2 100644 --- a/gathercontent-importer.php +++ b/gathercontent-importer.php @@ -41,12 +41,12 @@ if ( version_compare( phpversion(), '7.0', '<' ) ) { // Womp womp.. PHP needs to be updated! - add_action( 'all_admin_notices', 'gathercontent_importer_php_version_too_low_notice' ); + add_action( 'all_admin_notices', 'cwby_importer_php_version_too_low_notice' ); } elseif ( version_compare( $GLOBALS['wp_version'], '5.8.2', '<' ) ) { // Sad Trombone.. WordPress needs to be updated! - add_action( 'all_admin_notices', 'gathercontent_importer_wp_version_too_low_notice' ); + add_action( 'all_admin_notices', 'cwby_importer_wp_version_too_low_notice' ); } else { // Include files @@ -62,7 +62,7 @@ * @since 3.0.0 * */ -function gathercontent_importer_php_version_too_low_notice() { +function cwby_importer_php_version_too_low_notice() { $message = esc_html__( 'Sorry, the Content Workflow plugin requires a minimum PHP version of 5.3. Please contact your host and ask them to upgrade. For convenience, you can use the note provided on the WordPress recommended host supports page: ', 'content-workflow-by-bynder' ); echo '
@@ -81,7 +81,7 @@ function gathercontent_importer_php_version_too_low_notice() { * @since 3.0.0 * */ -function gathercontent_importer_wp_version_too_low_notice() { +function cwby_importer_wp_version_too_low_notice() { printf( '

%s

', esc_html__( 'Sorry, for security and performance reasons, the Content Workflow plugin requires a minimum WordPress version of 4.4. Please update WordPress to the most recent version.', 'content-workflow-by-bynder' ) @@ -101,11 +101,11 @@ function gathercontent_importer_wp_version_too_low_notice() { * @since 3.0.0 * */ -function gathercontent_importer_i18n() { +function cwby_importer_i18n() { $text_domain = GATHERCONTENT_SLUG; $locale = apply_filters( 'plugin_locale', get_locale(), $text_domain ); load_textdomain( $text_domain, WP_LANG_DIR . "/{$text_domain}/{$text_domain}-{$locale}.mo" ); load_plugin_textdomain( $text_domain, false, plugin_basename( GATHERCONTENT_PATH ) . '/languages/' ); } -add_action( 'init', 'gathercontent_importer_i18n' ); +add_action( 'init', 'cwby_importer_i18n' ); diff --git a/includes/classes/admin/ajax/handlers.php b/includes/classes/admin/ajax/handlers.php index a8eeaaf0..88868fcd 100644 --- a/includes/classes/admin/ajax/handlers.php +++ b/includes/classes/admin/ajax/handlers.php @@ -161,7 +161,7 @@ public function cwby_get_posts_cb() { ); } - wp_send_json_success( apply_filters( 'gc_prepare_js_update_data_for_posts', $post_updates ) ); + wp_send_json_success( apply_filters( 'cwby_prepare_js_update_data_for_posts', $post_updates ) ); } /** diff --git a/includes/classes/admin/enqueue.php b/includes/classes/admin/enqueue.php index 6aa9376b..2781c21e 100644 --- a/includes/classes/admin/enqueue.php +++ b/includes/classes/admin/enqueue.php @@ -71,7 +71,7 @@ public function admin_enqueue_script() { do_action( 'cwby_admin_enqueue_script' ); - // Localize in footer so that 'gathercontent_localized_data' filter is more useful. + // Localize in footer so that 'cwby_localized_data' filter is more useful. add_action( 'admin_footer', array( $this, 'script_localize' ), 1 ); } @@ -91,12 +91,12 @@ public function script_localize() { */ $queryArgs = $this->_get_vals( [ 'flush_cache', 'mapping' ] ); - wp_localize_script( 'gathercontent', 'GatherContent', apply_filters( 'gathercontent_localized_data', array( + wp_localize_script( 'gathercontent', 'GatherContent', apply_filters( 'cwby_localized_data', array( 'debug' => Utils::script_debug(), // @codingStandardsIgnoreStart 'queryargs' => $queryArgs, // @codingStandardsIgnoreEnd - '_type_names' => Utils::gc_field_type_name( 'all' ), + '_type_names' => Utils::cwby_field_type_name( 'all' ), ) ) ); } } diff --git a/includes/classes/admin/mapping-wizard.php b/includes/classes/admin/mapping-wizard.php index 16d7f7b7..3fddcafa 100644 --- a/includes/classes/admin/mapping-wizard.php +++ b/includes/classes/admin/mapping-wizard.php @@ -14,7 +14,7 @@ */ class Mapping_Wizard extends Base { - const SLUG = 'gathercontent-import-add-new-template'; + const SLUG = 'cwby-import-add-new-template'; const ACCOUNT = 0; const PROJECT = 1; const TEMPLATE = 2; diff --git a/includes/classes/admin/mapping/base.php b/includes/classes/admin/mapping/base.php index 3e82defe..53d0a3ab 100644 --- a/includes/classes/admin/mapping/base.php +++ b/includes/classes/admin/mapping/base.php @@ -126,7 +126,7 @@ public function ui() { // Hook in the underscores templates. add_action( 'admin_footer', array( $this, 'footer_mapping_js_templates' ) ); - add_filter( 'gathercontent_localized_data', array( $this, 'localize_data' ) ); + add_filter( 'cwby_localized_data', array( $this, 'localize_data' ) ); $script_id = $this->script_id(); @@ -240,7 +240,7 @@ protected function post_options() { protected function custom_field_keys() { global $wpdb; - $meta_keys = get_transient( 'gathercontent_importer_custom_field_keys' ); + $meta_keys = get_transient( 'cwby_importer_custom_field_keys' ); if ( ! $meta_keys || $this->_get_val( 'delete-trans' ) ) { // Retrieve custom field keys to include in the Custom Fields weight table select. @@ -253,11 +253,11 @@ protected function custom_field_keys() { " ); - set_transient( 'gathercontent_importer_custom_field_keys', $meta_keys, DAY_IN_SECONDS ); + set_transient( 'cwby_importer_custom_field_keys', $meta_keys, DAY_IN_SECONDS ); } // Allow devs to filter this list. - $meta_keys = array_unique( apply_filters( 'gathercontent_importer_custom_field_keys', $meta_keys ) ); + $meta_keys = array_unique( apply_filters( 'cwby_importer_custom_field_keys', $meta_keys ) ); // Sort the keys alphabetically. if ( $meta_keys ) { @@ -272,7 +272,7 @@ protected function custom_field_keys() { * @var array */ $meta_keys_blacklist = apply_filters( - 'gathercontent_importer_custom_field_keys_blacklist', + 'cwby_importer_custom_field_keys_blacklist', array( '_wp_attachment_image_alt' => 1, '_wp_attachment_metadata' => 1, diff --git a/includes/classes/admin/mapping/field-types/types.php b/includes/classes/admin/mapping/field-types/types.php index e317a533..337a1704 100644 --- a/includes/classes/admin/mapping/field-types/types.php +++ b/includes/classes/admin/mapping/field-types/types.php @@ -36,7 +36,7 @@ public function __construct( array $core_types ) { * @since 3.0.0 */ public function register() { - $field_types = apply_filters( 'gathercontent_register_field_types_handlers', $this->core_types ); + $field_types = apply_filters( 'cwby_register_field_types_handlers', $this->core_types ); foreach ( $field_types as $type ) { if ( ! ( $type instanceof Type ) ) { @@ -44,11 +44,11 @@ public function register() { } $this->field_types[ $type->type_id() ] = $type; - add_action( 'gathercontent_field_type_option_underscore_template', array( + add_action( 'cwby_field_type_option_underscore_template', array( $type, 'option_underscore_template' ) ); - add_action( 'gathercontent_field_type_underscore_template', array( $type, 'underscore_template' ) ); + add_action( 'cwby_field_type_underscore_template', array( $type, 'underscore_template' ) ); } return $this; diff --git a/includes/classes/admin/mapping/field-types/wpseo.php b/includes/classes/admin/mapping/field-types/wpseo.php index 1c0b2527..cbe4cd62 100644 --- a/includes/classes/admin/mapping/field-types/wpseo.php +++ b/includes/classes/admin/mapping/field-types/wpseo.php @@ -55,7 +55,7 @@ public function __construct( array $post_types ) { $this->seo_options = $this->get_seo_options(); $this->option_label = __( 'SEO', 'content-workflow-by-bynder' ); - add_filter( 'gathercontent_importer_custom_field_keys_blacklist', array( $this, 'remove_wpseo_keys' ) ); + add_filter( 'cwby_importer_custom_field_keys_blacklist', array( $this, 'remove_wpseo_keys' ) ); } protected function get_seo_options() { diff --git a/includes/classes/admin/mapping/template-mapper.php b/includes/classes/admin/mapping/template-mapper.php index 41fae7fc..783ec6a3 100644 --- a/includes/classes/admin/mapping/template-mapper.php +++ b/includes/classes/admin/mapping/template-mapper.php @@ -450,7 +450,7 @@ private function format_fields( $field, $post_type, string $component_name = '', $field->type = $field_type === 'attachment' ? 'files' : $field_type; } - $field->typeName = Utils::gc_field_type_name( $field_type ); + $field->typeName = Utils::cwby_field_type_name( $field_type ); if ( $val = $this->get_value( $field->uuid ) ) { $field->field_type = isset( $val['type'] ) ? $val['type'] : ''; diff --git a/includes/classes/api.php b/includes/classes/api.php index 56144338..620c5698 100644 --- a/includes/classes/api.php +++ b/includes/classes/api.php @@ -642,7 +642,7 @@ public function get( $endpoint, $args = array(), $response_type = '', $query_par */ public function cache_get( $endpoint, $expiration = HOUR_IN_SECONDS, $args = array(), $method = 'get', $query_params = array() ) { - $trans_key = 'gctr-' . md5( serialize( compact( 'endpoint', 'args', 'method', 'query_params' ) ) ); + $trans_key = 'cwbytr-' . md5( serialize( compact( 'endpoint', 'args', 'method', 'query_params' ) ) ); $response = get_transient( $trans_key ); if ( $this->only_cached ) { @@ -698,7 +698,7 @@ public function request( $endpoint, $args = array(), $method = 'GET', $query_par try { $args = $this->request_args( $args ); } catch ( \Exception $e ) { - return new WP_Error( 'gc_api_setup_fail', $e->getMessage() ); + return new WP_Error( 'cwby_api_setup_fail', $e->getMessage() ); } if ( Debug::debug_mode() ) { diff --git a/includes/classes/debug.php b/includes/classes/debug.php index 45da1421..1c89601c 100644 --- a/includes/classes/debug.php +++ b/includes/classes/debug.php @@ -262,11 +262,11 @@ public function do_debug_options_actions( $settings ) { } elseif ( $settings['delete_gc_log_file'] ) { - return $this->delete_gc_log_file( $back_button ); + return $this->delete_cwby_log_file( $back_button ); } elseif ( $settings['view_gc_log_file'] ) { - return $this->view_gc_log_file( $back_button ); + return $this->view_cwby_log_file( $back_button ); } elseif ( $settings['disable_debug_mode'] ) { @@ -332,7 +332,7 @@ public function handle_stuck_statuses( $settings, $back_button ) { * @since 3.0.1 * */ - public function delete_gc_log_file( $back_button ) { + public function delete_cwby_log_file( $back_button ) { if ( wp_delete_file( self::$log_path ) ) { wp_die( esc_html__( 'Content Workflow log file deleted.', 'content-workflow-by-bynder' ) . wp_kses_post( $back_button ), esc_html__( 'Debug Mode', 'content-workflow-by-bynder' ) ); } @@ -349,7 +349,7 @@ public function delete_gc_log_file( $back_button ) { * @since 3.0.1 * */ - public function view_gc_log_file( $back_button ) { + public function view_cwby_log_file( $back_button ) { $log_contents = file_exists( self::$log_path ) ? wp_remote_get( self::$log_path ) : ''; if ( ! $log_contents ) { diff --git a/includes/classes/post-types/template-mappings.php b/includes/classes/post-types/template-mappings.php index 014992e4..3b0c27db 100644 --- a/includes/classes/post-types/template-mappings.php +++ b/includes/classes/post-types/template-mappings.php @@ -317,7 +317,7 @@ public function modify_mapping_post_edit_link( $link, $post ) { if ( $project_id && $template_id ) { $link = admin_url( sprintf( - 'admin.php?page=gathercontent-import-add-new-template&project=%s&template=%s&mapping=%s', + 'admin.php?page=cwby-import-add-new-template&project=%s&template=%s&mapping=%s', $project_id, $template_id, $post_id @@ -433,9 +433,9 @@ function ( $opt ) { public function trigger_pre_actions( $ignore, $post_data ) { if ( self::SLUG === $post_data['post_type'] ) { if ( ! empty( $post_data['ID'] ) ) { - do_action( 'gc_mapping_pre_post_update', $post_data ); + do_action( 'cwby_mapping_pre_post_update', $post_data ); } else { - do_action( 'gc_mapping_pre_post_create', $post_data ); + do_action( 'cwby_mapping_pre_post_create', $post_data ); } add_action( 'save_post_' . self::SLUG, array( __CLASS__, 'store_post_type_references' ), 10, 3 ); @@ -587,7 +587,7 @@ public function get_account_projects_with_mappings( $account_id, $mapping_ids = } if ( empty( $projects ) ) { - new WP_Error( 'gc_no_projects', esc_html__( 'No projects were found for this account.', 'content-workflow-by-bynder' ) ); + new WP_Error( 'cwby_no_projects', esc_html__( 'No projects were found for this account.', 'content-workflow-by-bynder' ) ); } $all_projects = array(); @@ -626,7 +626,7 @@ public function get_accounts_with_mappings() { } if ( empty( $accounts ) ) { - new WP_Error( 'gc_no_accounts', esc_html__( 'No accounts were found.', 'content-workflow-by-bynder' ) ); + new WP_Error( 'cwby_no_accounts', esc_html__( 'No accounts were found.', 'content-workflow-by-bynder' ) ); } $all_accounts = array(); diff --git a/includes/classes/settings/form-section.php b/includes/classes/settings/form-section.php index e38e0476..6a0fc98f 100644 --- a/includes/classes/settings/form-section.php +++ b/includes/classes/settings/form-section.php @@ -18,7 +18,7 @@ public function __construct( $id, $title, $callback, $page, $is_current = false $this->page = $page; $section = compact( 'id', 'title', 'callback', 'is_current' ); - $section = apply_filters( "gathercontent_importer_section_{$id}", $section, $this ); + $section = apply_filters( "cwby_importer_section_{$id}", $section, $this ); $this->id = $section['id']; $this->title = $section['title']; @@ -101,7 +101,7 @@ public function add_field( $id, $title, $callback, $args = array() ) { ); $field = compact( 'id', 'title', 'callback', 'args' ); - $field = apply_filters( "gathercontent_importer_field_{$this->id}_{$id}", $field, $this ); + $field = apply_filters( "cwby_importer_field_{$this->id}_{$id}", $field, $this ); $this->fields[ $field['id'] ] = $field; } @@ -121,5 +121,3 @@ public static function get_sections( $page ) { } } - - diff --git a/includes/classes/sync/base.php b/includes/classes/sync/base.php index b2cabedc..47d6e464 100644 --- a/includes/classes/sync/base.php +++ b/includes/classes/sync/base.php @@ -309,7 +309,7 @@ protected function check_mapping_data() { protected function get_element_value() { $val = $this->get_value_for_element( $this->element ); - return apply_filters( 'gc_get_element_value', $val, $this->element, $this->item ); + return apply_filters( 'cwby_get_element_value', $val, $this->element, $this->item ); } /** @@ -604,7 +604,7 @@ protected function format_selected_options_data( $metadata, $field_value ): arra protected function type_can_append( $field ) { $can_append = in_array( $field, $this->append_types, true ); - return apply_filters( "gc_can_append_{$field}", $can_append, $this->element, $this->item ); + return apply_filters( "cwby_can_append_{$field}", $can_append, $this->element, $this->item ); } /** diff --git a/includes/classes/sync/pull.php b/includes/classes/sync/pull.php index 97d6484c..ace2f9f1 100644 --- a/includes/classes/sync/pull.php +++ b/includes/classes/sync/pull.php @@ -47,7 +47,7 @@ public function __construct( API $api ) { * */ public static function init_plugins_loaded_hooks() { - add_action( 'gc_associate_hierarchy', array( __CLASS__, 'associate_hierarchy' ) ); + add_action( 'cwby_associate_hierarchy', array( __CLASS__, 'associate_hierarchy' ) ); } /** @@ -80,7 +80,7 @@ public function maybe_pull_item( $mapping_post, $item_id ) { $this->mapping = Mapping_Post::get( $mapping_post, true ); $result = $this->do_item( $item_id ); } catch ( \Exception $e ) { - $result = new WP_Error( 'gc_pull_item_fail_' . $e->getCode(), $e->getMessage(), $e->get_data() ); + $result = new WP_Error( 'cwby_pull_item_fail_' . $e->getCode(), $e->getMessage(), $e->get_data() ); } return $result; @@ -199,7 +199,7 @@ protected function do_item( $id ) { // And if we do, compare them to see if GC item is newer. && ( $is_up_to_date = strtotime( $this->item->updated_at ) <= strtotime( $updated_at ) ) // If it's not newer, then don't update (unless asked to via filter). - && $is_up_to_date && apply_filters( 'gc_only_update_if_newer', true ) + && $is_up_to_date && apply_filters( 'cwby_only_update_if_newer', true ) ) { throw new Exception( sprintf( esc_html__( 'WordPress has most recent changes for %1$s (Item ID: %2$d):', 'content-workflow-by-bynder' ), esc_html( $this->item->name ), esc_html( $this->item->id ) ), @@ -217,7 +217,7 @@ protected function do_item( $id ) { $roundTwo = true; } - $post_data = $this->map_gc_data_to_wp_data( $post_data ); + $post_data = $this->map_cwby_data_to_wp_data( $post_data ); if ( ! empty( $post_data['attachments'] ) ) { $attachments = $post_data['attachments']; @@ -281,7 +281,7 @@ protected function do_item( $id ) { $updated_post_data = array(); if ( $attachments ) { - $attachments = apply_filters( 'gc_media_objects', $attachments, $post_data ); + $attachments = apply_filters( 'cwby_media_objects', $attachments, $post_data ); $replacements = $this->sideload_attachments( $attachments, $post_data ); if ( ! empty( $replacements ) ) { @@ -340,7 +340,7 @@ function ( $meta ) { * @since 3.0.0 * */ - protected function map_gc_data_to_wp_data( $post_data = array() ) { + protected function map_cwby_data_to_wp_data( $post_data = array() ) { $this->check_mapping_data( $this->mapping ); @@ -1046,7 +1046,7 @@ protected function get_element_terms( $taxonomy ) { } } - return apply_filters( 'gc_get_element_terms', $terms, $this->element, $this->item ); + return apply_filters( 'cwby_get_element_terms', $terms, $this->element, $this->item ); } /** @@ -1058,7 +1058,7 @@ protected function get_element_terms( $taxonomy ) { * */ protected function sanitize_element_meta() { - return apply_filters( 'gc_sanitize_meta_field', $this->element->value, $this->element, $this->item ); + return apply_filters( 'cwby_sanitize_meta_field', $this->element->value, $this->element, $this->item ); } /* @@ -1074,7 +1074,7 @@ protected function sanitize_element_meta() { * */ protected function sanitize_element_media() { - return apply_filters( 'gc_sanitize_media_field', $this->element->value, $this->element, $this->item ); + return apply_filters( 'cwby_sanitize_media_field', $this->element->value, $this->element, $this->item ); } /** @@ -1140,7 +1140,7 @@ protected function sideload_attachments( $attachments, $post_data ) { $img = $maybe_image ? $maybe_image : $image; // Replace the GC "shortcode" with the image/link. - $img = apply_filters( 'gc_content_image', $img, $media, $attach_id, $post_data, $atts ); + $img = apply_filters( 'cwby_content_image', $img, $media, $attach_id, $post_data, $atts ); $replacements[ $field ][ $replace_val ] = $img; } @@ -1149,7 +1149,7 @@ protected function sideload_attachments( $attachments, $post_data ) { } else { // Replace the token with the image. - $image = apply_filters( 'gc_content_image', $image, $media, $attach_id, $post_data, $atts ); + $image = apply_filters( 'cwby_content_image', $image, $media, $attach_id, $post_data, $atts ); $replacements[ $field ][ $token ] = $image; } } elseif ( 'gallery' === $attachment['destination'] ) { @@ -1178,7 +1178,7 @@ protected function sideload_attachments( $attachments, $post_data ) { foreach ( $media_replace as $replace_val => $atts ) { // Replace the GC "shortcode" with the file/link. - $link = apply_filters( 'gc_content_file', $link, $media, $attach_id, $post_data, $atts ); + $link = apply_filters( 'cwby_content_file', $link, $media, $attach_id, $post_data, $atts ); $replacements[ $field ][ $replace_val ] = $link; } @@ -1187,7 +1187,7 @@ protected function sideload_attachments( $attachments, $post_data ) { } else { // Replace the token with the image. - $link = apply_filters( 'gc_content_file', $link, $media, $attach_id, $post_data, $atts ); + $link = apply_filters( 'cwby_content_file', $link, $media, $attach_id, $post_data, $atts ); $replacements[ $field ][ $token ] = $link; } } else { @@ -1225,12 +1225,12 @@ protected function sideload_attachments( $attachments, $post_data ) { if ( ! empty( $gallery_ids ) ) { $shortcode = '[gallery link="file" size="full" ids="' . implode( ',', $gallery_ids ) . '"]'; - $shortcode = apply_filters( 'gc_content_gallery_shortcode', $shortcode, $gallery_ids, $post_data ); + $shortcode = apply_filters( 'cwby_content_gallery_shortcode', $shortcode, $gallery_ids, $post_data ); $replacements['post_content'][ $gallery_token ] = $shortcode; } - return apply_filters( 'gc_media_replacements', $replacements, $attachments, $post_data ); + return apply_filters( 'cwby_media_replacements', $replacements, $attachments, $post_data ); } /** @@ -1263,7 +1263,7 @@ protected function maybe_sideload_file( $media, $post_id ) { // Check if updated time-stamp is newer than previous updated timestamp. if ( $new_updated > $old_updated ) { - $replace_data = apply_filters( 'gc_replace_attachment_data_on_update', false, $attachment ); + $replace_data = apply_filters( 'cwby_replace_attachment_data_on_update', false, $attachment ); // @todo How to handle failures? $attach_id = $this->sideload_and_update_attachment( $media->id, $media->filename, $media->download_url, $attachment, $replace_data, $media->alt_text ); @@ -1470,7 +1470,7 @@ protected static function post_update_no_revision( $post_data ) { * */ public function should_map_hierarchy( $post_type ) { - return apply_filters( 'gc_map_hierarchy', is_post_type_hierarchical( $post_type ), $post_type, $this ); + return apply_filters( 'cwby_map_hierarchy', is_post_type_hierarchical( $post_type ), $post_type, $this ); } /** @@ -1484,7 +1484,7 @@ public function should_map_hierarchy( $post_type ) { */ public function schedule_hierarchy_update( $post_id ) { - $option = "gc_associate_hierarchy_{$this->mapping->ID}"; + $option = "cwby_associate_hierarchy_{$this->mapping->ID}"; // Check we have existing pending hierchies to set. $pending = get_option( "gc_associate_hierarchy_{$this->mapping->ID}", array() ); @@ -1500,15 +1500,15 @@ public function schedule_hierarchy_update( $post_id ) { $args = array( $this->mapping->ID ); // We'll want to restart our 'timer'. - if ( wp_next_scheduled( 'gc_associate_hierarchy', $args ) ) { - wp_clear_scheduled_hook( 'gc_associate_hierarchy', $args ); + if ( wp_next_scheduled( 'cwby_associate_hierarchy', $args ) ) { + wp_clear_scheduled_hook( 'cwby_associate_hierarchy', $args ); } /* * Schedule an event to associate hierarchy for these posts. * Will likely never be hit, as the cwby_pull_complete event will take precedence. */ - wp_schedule_single_event( time() + 60, 'gc_associate_hierarchy', $args ); + wp_schedule_single_event( time() + 60, 'cwby_associate_hierarchy', $args ); } /** @@ -1562,8 +1562,8 @@ public static function associate_hierarchy( $mapping ) { } // We'll want to clear any scheduled events, since we completed them. - if ( wp_next_scheduled( 'gc_associate_hierarchy', array( $mapping_id ) ) ) { - wp_clear_scheduled_hook( 'gc_associate_hierarchy', array( $mapping_id ) ); + if ( wp_next_scheduled( 'cwby_associate_hierarchy', array( $mapping_id ) ) ) { + wp_clear_scheduled_hook( 'cwby_associate_hierarchy', array( $mapping_id ) ); } return delete_option( $opt_name ); diff --git a/includes/classes/sync/push.php b/includes/classes/sync/push.php index 1a0b25b7..6ac317ee 100644 --- a/includes/classes/sync/push.php +++ b/includes/classes/sync/push.php @@ -96,7 +96,7 @@ public function maybe_push_item( $mapping_post_id ) { $result = $this->do_item( $post->ID ); } catch ( \Exception $e ) { - $result = new WP_Error( 'gc_push_item_fail_' . $e->getCode(), $e->getMessage(), $e->get_data() ); + $result = new WP_Error( 'cwby_push_item_fail_' . $e->getCode(), $e->getMessage(), $e->get_data() ); } return $result; @@ -121,7 +121,7 @@ protected function do_item( $id ) { $this->set_item( \GatherContent\Importer\get_post_item_id( $this->post->ID ), true ); - $config_update = $this->map_wp_data_to_gc_data(); + $config_update = $this->map_wp_data_to_cwby_data(); // No updated data, so bail. if ( empty( $config_update ) ) { @@ -297,10 +297,10 @@ protected function set_item( $item_id, $exclude_status = false ) { * @since 3.0.0 * */ - protected function map_wp_data_to_gc_data() { + protected function map_wp_data_to_cwby_data() { $config = $this->loop_item_elements_and_map(); - return apply_filters( 'gc_update_gc_config_data', $config, $this ); + return apply_filters( 'cwby_update_cwby_config_data', $config, $this ); } /** @@ -553,7 +553,7 @@ protected function set_post_field_value( $post_column ) { $el_value = $this->element->value; $value = ! empty( $this->post->{$post_column} ) ? self::remove_zero_width( $this->post->{$post_column} ) : false; - $value = apply_filters( "gc_get_{$post_column}", $value, $this ); + $value = apply_filters( "cwby_get_{$post_column}", $value, $this ); // Make element value match the WP versions formatting, to see if they are equal. switch ( $post_column ) { @@ -778,7 +778,7 @@ function ( $label ) use ( $meta_value ) { } - return apply_filters( 'gc_config_meta_field_value_updated', $updated, $meta_value, $meta_key, $this ); + return apply_filters( 'cwby_config_meta_field_value_updated', $updated, $meta_value, $meta_key, $this ); } diff --git a/includes/classes/utils.php b/includes/classes/utils.php index e57bf6ff..c01f786c 100644 --- a/includes/classes/utils.php +++ b/includes/classes/utils.php @@ -170,12 +170,12 @@ public static function relative_date( $utc_date ) { * @since 3.0.0 * */ - public static function gc_field_type_name( $type ) { + public static function cwby_field_type_name( $type ) { static $types = null; if ( null === $types ) { $types = apply_filters( - 'gc_field_type_names', + 'cwby_field_type_names', array( 'text' => __( 'Text', 'content-workflow-by-bynder' ), 'text_rich' => __( 'Rich Text', 'content-workflow-by-bynder' ), diff --git a/includes/classes/views/view.php b/includes/classes/views/view.php index dbdfaf65..8c7abd93 100644 --- a/includes/classes/views/view.php +++ b/includes/classes/views/view.php @@ -57,7 +57,7 @@ public function __construct( $template, array $args = array() ) { public function load( $echo = true ) { // Filter args before outputting template. - $this->args = apply_filters( "gc_template_args_for_{$this->template}", $this->args, $this ); + $this->args = apply_filters( "cwby_template_args_for_{$this->template}", $this->args, $this ); $id = md5( $this->template . serialize( $this->args ) ); if ( ! isset( self::$views[ $id ] ) ) { diff --git a/includes/functions/core.php b/includes/functions/core.php index d012a3b4..9ce1ce9b 100644 --- a/includes/functions/core.php +++ b/includes/functions/core.php @@ -72,7 +72,7 @@ function setup() { add_action( 'init', $n( 'init' ) ); } - do_action( 'gathercontent_loaded' ); + do_action( 'cwby_loaded' ); add_action( 'plugins_loaded', $n( 'General::init_plugins_loaded_hooks' ) ); } @@ -91,7 +91,7 @@ function init() { $general = General::get_instance(); $general->init_hooks(); - do_action( 'gathercontent_init', $general ); + do_action( 'cwby_init', $general ); } /** diff --git a/includes/functions/functions.php b/includes/functions/functions.php index 8e33e43d..619bbee4 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -291,7 +291,7 @@ function prepare_js_data( $args, $item = null, $type = 'post' ) { : (object) array(); $args['typeName'] = isset( $item->type ) - ? Utils::gc_field_type_name( $item->type ) + ? Utils::cwby_field_type_name( $item->type ) : ''; if ( isset( $item->updated_at ) ) { @@ -307,7 +307,7 @@ function prepare_js_data( $args, $item = null, $type = 'post' ) { $args['current'] = \GatherContent\Importer\post_is_current( $args['post_id'], $item ); } - return apply_filters( "gc_prepare_js_data_for_$type", $args, $type, $item ); + return apply_filters( "cwby_prepare_js_data_for_$type", $args, $type, $item ); } /** @@ -409,7 +409,7 @@ function user_allowed() { * */ function view_capability() { - return apply_filters( 'gathercontent_settings_view_capability', 'publish_pages' ); + return apply_filters( 'cwby_settings_view_capability', 'publish_pages' ); } /** @@ -423,7 +423,7 @@ function view_capability() { function available_mapping_post_types() { $post_types = get_post_types( array( 'public' => true ) ); - return apply_filters( 'gathercontent_mapping_post_types', $post_types ); + return apply_filters( 'cwby_mapping_post_types', $post_types ); } /** diff --git a/includes/views/system-info.php b/includes/views/system-info.php index b27c95c3..a51a7527 100644 --- a/includes/views/system-info.php +++ b/includes/views/system-info.php @@ -9,7 +9,7 @@ ### Begin System Info ### ## Please include this information when getting in touch with the Content Workflow (by Bynder) support team ## - + Multisite: get( 'multisite' ) ), "\n"; ?> @@ -74,7 +74,7 @@ Plugin Options: get( 'gc_options' ) ), "\n"; ?> - + ### End System Info ###

diff --git a/includes/views/tmpl-gc-mapping-tab-row.php b/includes/views/tmpl-gc-mapping-tab-row.php index 79f9ad5b..66b0d788 100644 --- a/includes/views/tmpl-gc-mapping-tab-row.php +++ b/includes/views/tmpl-gc-mapping-tab-row.php @@ -54,9 +54,9 @@ class="<# if (data.typeName === 'component') { #>gc-component gc-component-disab - + - + @@ -115,7 +115,7 @@ class="<# if (data.typeName === 'component') { #>gc-component gc-component-disab class="component-child wp-subfield-select" data-index="{{index}}" name="output( 'option_base' ); ?>[mapping][{{ data.name }}][sub_fields][{{index}}]"> - + diff --git a/tests/phpunit/Core_Tests.php b/tests/phpunit/Core_Tests.php index 267643b6..f67d4618 100644 --- a/tests/phpunit/Core_Tests.php +++ b/tests/phpunit/Core_Tests.php @@ -29,7 +29,7 @@ public function test_setup() { // Setup \WP_Mock::expectActionAdded( 'init', 'GatherContent\Importer\Core\i18n' ); \WP_Mock::expectActionAdded( 'init', 'GatherContent\Importer\Core\init' ); - \WP_Mock::expectAction( 'gathercontent_loaded' ); + \WP_Mock::expectAction( 'cwby_loaded' ); // Act setup(); @@ -75,7 +75,7 @@ public function test_i18n() { */ public function test_init() { // Setup - \WP_Mock::expectAction( 'gathercontent_init' ); + \WP_Mock::expectAction( 'cwby_init' ); // Act init();