diff --git a/README.md b/README.md index a9e46daf..718374c5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Content Workflow (by Bynder) Plugin - Version 1.0.0 # +# Content Workflow (by Bynder) - Version 1.0.0 # This plugin allows you to transfer content from your Content Workflow projects into your WordPress site and vice-versa. diff --git a/composer.json b/composer.json index 3c85bc9b..36c0224a 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,6 @@ "version": "1.0.0", "type": "wordpress-plugin", "keywords": [], - "homepage": "https://www.bynder.com/en/products/content-workflow/", "license": "GPL-2.0+", "authors": [ { diff --git a/gathercontent-importer.php b/gathercontent-importer.php index 597211ab..80464aa9 100644 --- a/gathercontent-importer.php +++ b/gathercontent-importer.php @@ -1,7 +1,6 @@
%s
', - __( '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: https://wordpress.org/about/requirements/', 'gathercontent-import' ) + __( '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: https://wordpress.org/about/requirements/', 'content-workflow' ) ); } @@ -80,7 +79,7 @@ function gathercontent_importer_php_version_too_low_notice() { function gathercontent_importer_wp_version_too_low_notice() { printf( '%s
' . sprintf( esc_html__( 'The error received: %s', 'gathercontent-import' ), $response->get_error_message() ); + $message .= '
' . sprintf( esc_html__( 'The error received: %s', 'content-workflow' ), $response->get_error_message() ); } $this->add_settings_error( $this->option_name, 'gc-api-connect-fail', $message, 'error' ); @@ -78,7 +78,7 @@ public function __construct( API $api ) { && ! $this->get_setting( 'auth_verified' ) ) { - $message = __( 'The provided authentication username and/or password is incorrect. If you\'re not sure what this is, please contact your site adminstrator.', 'gathercontent-import' ); + $message = __( 'The provided authentication username and/or password is incorrect. If you\'re not sure what this is, please contact your site adminstrator.', 'content-workflow' ); $this->add_settings_error( $this->option_name, 'gc-http-auth-fail', $message, 'error' ); } @@ -185,7 +185,7 @@ public function admin_menu() { */ public function settings_link( $links ) { - $links[] = sprintf( '%s', $this->url, __( 'Settings', 'gathercontent-import' ) ); + $links[] = sprintf( '%s', $this->url, __( 'Settings', 'content-workflow' ) ); return $links; } @@ -230,46 +230,46 @@ public function api_setup_settings() { $section = new Form_Section( 'step_1', - esc_html__( 'API Credentials', 'gathercontent-import' ), + esc_html__( 'API Credentials', 'content-workflow' ), array( $this, 'api_setup_settings_cb' ), self::SLUG ); $section->add_field( 'account_email', - esc_html__( 'Content Workflow Email Address', 'gathercontent-import' ), + esc_html__( 'Content Workflow Email Address', 'content-workflow' ), array( $this, 'account_email_field_cb' ) ); $section->add_field( 'platform_url_slug', - esc_html__( 'Platform URL', 'gathercontent-import' ), + esc_html__( 'Platform URL', 'content-workflow' ), array( $this, 'platform_url_slug_field_cb' ) ); $section->add_field( 'api_key', - esc_html__( 'API Key', 'gathercontent-import' ), + esc_html__( 'API Key', 'content-workflow' ), array( $this, 'api_key_field_cb' ) ); if ( \GatherContent\Importer\auth_enabled() ) { $section = new Form_Section( 'auth', - esc_html__( 'HTTP Authentication Credentials', 'gathercontent-import' ), + esc_html__( 'HTTP Authentication Credentials', 'content-workflow' ), $this->view( 'auth-enabled-desc', array(), false ), self::SLUG ); $section->add_field( 'auth_username', - esc_html__( 'Username', 'gathercontent-import' ), + esc_html__( 'Username', 'content-workflow' ), array( $this, 'auth_username_field_cb' ) ); $section->add_field( 'auth_pw', - esc_html__( 'Password', 'gathercontent-import' ), + esc_html__( 'Password', 'content-workflow' ), array( $this, 'auth_pw_field_cb' ) ); } @@ -277,13 +277,13 @@ public function api_setup_settings() { public function api_setup_settings_cb() { if ( $key = $this->should_migrate() ) { - echo '
' . esc_html__( 'NOTE:', 'gathercontent-import' ) . ' ' . sprintf( __( 'It looks like you are migrating from a previous version of the GatherContent plugin.
You will need to set up new GatherContent API credentials to continue. Instructions for getting your API key can be found here.', 'gathercontent-import' ), 'https://gathercontent.com/developers/authentication/' ) . '
' . esc_html__( 'NOTE:', 'content-workflow' ) . ' ' . sprintf( __( 'It looks like you are migrating from a previous version of the GatherContent plugin.
You will need to set up new GatherContent API credentials to continue. Instructions for getting your API key can be found here.', 'content-workflow' ), 'https://gathercontent.com/developers/authentication/' ) . '
' . sprintf( __( 'Enter your Content Workflow API credentials. Instructions for getting your API key can be found here.', 'gathercontent-import' ), 'https://gathercontent.com/developers/authentication/' ) . '
'; + echo '' . sprintf( __( 'Enter your Content Workflow API credentials. Instructions for getting your API key can be found here.', 'content-workflow' ), 'https://gathercontent.com/developers/authentication/' ) . '
'; } } @@ -332,7 +332,7 @@ public function api_key_field_cb( $field ) { 'name' => $this->option_name . '[' . $id . ']', 'value' => esc_attr( $this->get_setting( $id ) ), 'placeholder' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', - 'desc' => '' . __( 'How to get your API key', 'gathercontent-import' ) . '', + 'desc' => '' . __( 'How to get your API key', 'content-workflow' ) . '', ) ); @@ -401,7 +401,7 @@ public function api_setup_complete_cb() { $data = (array) $user; - $data['message'] = esc_html__( "You've successfully connected to the Content Workflow API", 'gathercontent-import' ); + $data['message'] = esc_html__( "You've successfully connected to the Content Workflow API", 'content-workflow' ); $data['avatar'] = ! empty( $data['avatar'] ) ? 'https://gathercontent-production-avatars.s3-us-west-2.amazonaws.com/' . $data['avatar'] @@ -409,7 +409,7 @@ public function api_setup_complete_cb() { if ( $this->set_my_account() ) { - $data['message'] .= ' ' . sprintf( esc_html__( 'and the %s account.', 'gathercontent-import' ), '' . esc_html( $this->account->name ) . '' ); + $data['message'] .= ' ' . sprintf( esc_html__( 'and the %s account.', 'content-workflow' ), '' . esc_html( $this->account->name ) . '' ); } $this->view( 'user-profile', $data ); @@ -444,8 +444,8 @@ public function should_migrate() { */ public function prev_option_key() { $prefixes = array( - 'gathercontent-import', // from wordpress.org/plugins/gathercontent-import - 'wordpress-plugin', // from github.com/gathercontent/wordpress-plugin + 'content-workflow', // from wordpress.org/plugins/content-workflow-by-bynder + 'wordpress-plugin', // from github.com/Bynder/cw-wordpress-plugin 'gathercontent-import-old', // local copy ); diff --git a/includes/classes/admin/ajax/sync-bulk.php b/includes/classes/admin/ajax/sync-bulk.php index e64fe7d0..e655e7d8 100644 --- a/includes/classes/admin/ajax/sync-bulk.php +++ b/includes/classes/admin/ajax/sync-bulk.php @@ -37,7 +37,7 @@ protected function verify_request() { if ( ! isset( $_REQUEST['data'], $_REQUEST['nonce'] ) ) { wp_send_json_error( sprintf( - __( 'Error %d: Missing required data.', 'gathercontent-import' ), + __( 'Error %d: Missing required data.', 'content-workflow' ), __LINE__ ) ); @@ -86,7 +86,7 @@ protected function set_mapping_posts() { } catch ( \Exception $e ) { wp_send_json_error( sprintf( - __( 'Error %1$d: Cannot find a mapping by that id: %2$d', 'gathercontent-import' ), + __( 'Error %1$d: Cannot find a mapping by that id: %2$d', 'content-workflow' ), __LINE__, $mapping_id ) diff --git a/includes/classes/admin/ajax/sync-items.php b/includes/classes/admin/ajax/sync-items.php index 328ee03b..3979f962 100644 --- a/includes/classes/admin/ajax/sync-items.php +++ b/includes/classes/admin/ajax/sync-items.php @@ -33,7 +33,7 @@ protected function verify_request() { if ( ! isset( $_REQUEST['data'], $_REQUEST['id'], $_REQUEST['nonce'] ) ) { wp_send_json_error( sprintf( - __( 'Error %d: Missing required data.', 'gathercontent-import' ), + __( 'Error %d: Missing required data.', 'content-workflow' ), __LINE__ ) ); @@ -48,7 +48,7 @@ protected function check_http_auth() { ) { wp_send_json_error( array( - 'message' => __( 'Syncing is disabled until authentication credentials are provided. Redirecting to the settings page.', 'gathercontent-import' ), + 'message' => __( 'Syncing is disabled until authentication credentials are provided. Redirecting to the settings page.', 'content-workflow' ), 'url' => add_query_arg( 'auth-required', 1, $admin->url ), ) ); @@ -63,7 +63,7 @@ protected function verify_nonce() { if ( ! wp_verify_nonce( $this->_post_val( 'nonce' ), $opt_group . '-options' ) ) { wp_send_json_error( sprintf( - __( 'Error %d: Missing security nonce.', 'gathercontent-import' ), + __( 'Error %d: Missing security nonce.', 'content-workflow' ), __LINE__ ) ); @@ -79,7 +79,7 @@ protected function set_mapping_post() { wp_send_json_error( sprintf( - __( 'Error %1$d: Cannot find a mapping by that id: %2$d', 'gathercontent-import' ), + __( 'Error %1$d: Cannot find a mapping by that id: %2$d', 'content-workflow' ), __LINE__, absint( $this->_post_val( 'id' ) ) ) @@ -141,7 +141,7 @@ protected function get_fields() { if ( empty( $data ) || ! is_string( $data ) ) { wp_send_json_error( sprintf( - __( 'Error %d: Missing form data.', 'gathercontent-import' ), + __( 'Error %d: Missing form data.', 'content-workflow' ), __LINE__ ) ); @@ -158,7 +158,7 @@ protected function get_fields() { ) { wp_send_json_error( sprintf( - __( 'Error %d: Missing required form data.', 'gathercontent-import' ), + __( 'Error %d: Missing required form data.', 'content-workflow' ), __LINE__ ) ); diff --git a/includes/classes/admin/bulk.php b/includes/classes/admin/bulk.php index 1de5315b..b975e584 100644 --- a/includes/classes/admin/bulk.php +++ b/includes/classes/admin/bulk.php @@ -292,16 +292,16 @@ protected function get_underscore_templates() { 'tmpl-gc-select2-item' => array(), 'tmpl-gc-modal-window' => array( 'nav' => array( - $this->wizard->parent_url => __( 'Settings', 'gathercontent-import' ), + $this->wizard->parent_url => __( 'Settings', 'content-workflow' ), $this->wizard->mappings->listing_url => $this->wizard->mappings->args->label, $this->wizard->url => $this->wizard->mappings->args->labels->new_item, ), 'headers' => array( - 'status' => __( 'Status', 'gathercontent-import' ), - 'itemName' => __( 'Item', 'gathercontent-import' ), - 'updated_at' => __( 'Updated', 'gathercontent-import' ), - 'mappingName' => __( 'Template Mapping', 'gathercontent-import' ), - 'post_title' => __( 'WordPress Title', 'gathercontent-import' ), + 'status' => __( 'Status', 'content-workflow' ), + 'itemName' => __( 'Item', 'content-workflow' ), + 'updated_at' => __( 'Updated', 'content-workflow' ), + 'mappingName' => __( 'Template Mapping', 'content-workflow' ), + 'post_title' => __( 'WordPress Title', 'content-workflow' ), ), ), 'tmpl-gc-item' => array( @@ -354,7 +354,7 @@ protected function get_localize_data() { ); $data['_text'] = array( - 'no_items' => esc_html__( 'No items found.', 'gathercontent-import' ), + 'no_items' => esc_html__( 'No items found.', 'content-workflow' ), ); return $data; diff --git a/includes/classes/admin/mapping-wizard.php b/includes/classes/admin/mapping-wizard.php index c71867d0..1a05cf36 100644 --- a/includes/classes/admin/mapping-wizard.php +++ b/includes/classes/admin/mapping-wizard.php @@ -102,7 +102,7 @@ public function admin_menu() { $page = add_submenu_page( $this->parent_page_slug, $this->get_step_label(), - __( 'New Mapping', 'gathercontent-import' ), + __( 'New Mapping', 'content-workflow' ), \GatherContent\Importer\view_capability(), self::SLUG, array( $this, 'admin_page' ) @@ -145,17 +145,17 @@ public function add_help_tabs() { $screen->add_help_tab( array( 'id' => 'gc-help-me', - 'title' => __( 'Content Workflow', 'gathercontent-import' ), + 'title' => __( 'Content Workflow', 'content-workflow' ), 'content' => __( 'Thank you for using the Content Workflow WordPress plugin!
' . 'To make the plugin more speedy, we cache the requests to GatherContent for 1 day, but if you find that you need to update the data from Content Workflow, just hit the "Refresh" button.
', - 'gathercontent-import' + 'content-workflow' ) . '' . $this->refresh_connection_link() . '
', ) ); $screen->set_help_sidebar( - '' . __( 'For more information:', 'gathercontent-import' ) . '
' . + '' . __( 'For more information:', 'content-workflow' ) . '
' . '' . __( 'Content Workflow WordPress Integration' ) . '
' . '' . __( 'Support Forums' ) . '
' ); @@ -165,8 +165,8 @@ public function add_help_tabs() { $screen->add_help_tab( array( 'id' => 'gc-field-details', - 'title' => __( 'Mapping Fields', 'gathercontent-import' ), - 'content' => __( 'Note: If mapping more than one GatherContent field to one WordPress field, you will not be able to "push" that content back to Content Workflow, as there is not currently a way to split the fields back to individual fields.
', 'gathercontent-import' ), + 'title' => __( 'Mapping Fields', 'content-workflow' ), + 'content' => __( 'Note: If mapping more than one GatherContent field to one WordPress field, you will not be able to "push" that content back to Content Workflow, as there is not currently a way to split the fields back to individual fields.
', 'content-workflow' ), ) ); } @@ -181,14 +181,14 @@ public function admin_page() { 'logo' => $this->logo, 'option_group' => $this->option_group, 'settings_sections' => Form_Section::get_sections( self::SLUG ), - 'go_back_button_text' => __( 'Previous Step', 'gathercontent-import' ), + 'go_back_button_text' => __( 'Previous Step', 'content-workflow' ), 'refresh_button' => $this->refresh_connection_link(), - 'submit_button_text' => __( 'Next Step', 'gathercontent-import' ), + 'submit_button_text' => __( 'Next Step', 'content-workflow' ), ); switch ( $this->step ) { case self::ACCOUNT: - $args['go_back_button_text'] = __( 'Back to API setup', 'gathercontent-import' ); + $args['go_back_button_text'] = __( 'Back to API setup', 'content-workflow' ); $args['go_back_url'] = $this->parent_url; break; @@ -198,11 +198,11 @@ public function admin_page() { case self::TEMPLATE: $args['go_back_url'] = remove_query_arg( 'template', remove_query_arg( 'mapping' ) ); - $args['submit_button_text'] = __( 'Save Mapping', 'gathercontent-import' ); + $args['submit_button_text'] = __( 'Save Mapping', 'content-workflow' ); break; case self::SYNC: - $args['submit_button_text'] = __( 'Import Selected Items', 'gathercontent-import' ); + $args['submit_button_text'] = __( 'Import Selected Items', 'content-workflow' ); break; } @@ -217,7 +217,7 @@ public function register_notices() { if ( get_option( 'gc-api-updated' ) ) { $notices[] = array( 'id' => 'gc-api-connection-reset', - 'message' => __( 'We refreshed the data from the Content Workflow API.', 'gathercontent-import' ), + 'message' => __( 'We refreshed the data from the Content Workflow API.', 'content-workflow' ), 'type' => 'updated', ); delete_option( 'gc-api-updated' ); @@ -228,7 +228,7 @@ public function register_notices() { if ( $this->_get_val( 'sync-items' ) ) { $notices[] = array( 'id' => 'gc-mapping-updated', - 'message' => __( 'Items Import complete!', 'gathercontent-import' ), + 'message' => __( 'Items Import complete!', 'content-workflow' ), 'type' => 'updated', ); @@ -317,7 +317,7 @@ public function initialize_settings_sections() { public function select_project() { $section = new Form_Section( 'select_project', - __( 'First, choose a project from an account.', 'gathercontent-import' ), + __( 'First, choose a project from an account.', 'content-workflow' ), '', self::SLUG ); @@ -336,7 +336,7 @@ public function select_project_fields_ui( $field ) { $accounts = $this->api()->get_accounts(); if ( ! $accounts ) { - return $this->add_settings_error( $this->option_name, 'gc-missing-accounts', sprintf( __( 'We couldn\'t find any accounts associated with your Content Workflow API credentials. Please check your settings.', 'gathercontent-import' ), $this->parent_url ) ); + return $this->add_settings_error( $this->option_name, 'gc-missing-accounts', sprintf( __( 'We couldn\'t find any accounts associated with your Content Workflow API credentials. Please check your settings.', 'content-workflow' ), $this->parent_url ) ); } $tabs = array(); @@ -374,7 +374,7 @@ public function select_project_fields_ui( $field ) { $tabs[] = array( 'id' => $account->id, - 'label' => sprintf( __( '%s', 'gathercontent-import' ), isset( $account->name ) ? $account->name : '' ), + 'label' => sprintf( __( '%s', 'content-workflow' ), isset( $account->name ) ? $account->name : '' ), 'nav_class' => $first ? 'nav-tab-active' : '', 'tab_class' => $first ? '' : 'hidden', 'content' => $this->view( @@ -413,7 +413,7 @@ public function select_template() { $section = new Form_Section( 'select_template', - __( 'Next, select a template to map.', 'gathercontent-import' ), + __( 'Next, select a template to map.', 'content-workflow' ), $this->project_name_and_edit_link( $project ), self::SLUG ); @@ -569,14 +569,14 @@ public function map_template() { $title = isset( $template->data->name ) ? $template->data->name - : __( 'Unknown Template', 'gathercontent-import' ); + : __( 'Unknown Template', 'content-workflow' ); if ( $sync_items ) { - $title_prefix = __( 'Import Items for: %s', 'gathercontent-import' ); + $title_prefix = __( 'Import Items for: %s', 'content-workflow' ); } elseif ( $mapping_id ) { - $title_prefix = __( 'Edit Mapping for: %s', 'gathercontent-import' ); + $title_prefix = __( 'Edit Mapping for: %s', 'content-workflow' ); } else { - $title_prefix = __( 'Create Mapping for: %s', 'gathercontent-import' ); + $title_prefix = __( 'Create Mapping for: %s', 'content-workflow' ); } $title = sprintf( $title_prefix, $title ); @@ -737,7 +737,7 @@ protected function save_mapping_post_and_redirect( $project, $template, $options $post_id = $this->create_or_update_mapping_post( $options ); if ( is_wp_error( $post_id ) ) { - wp_die( $post_id->get_error_message(), __( 'Failed creating mapping!', 'gathercontent-import' ) ); + wp_die( $post_id->get_error_message(), __( 'Failed creating mapping!', 'content-workflow' ) ); } $edit_url = get_edit_post_link( $post_id, 'raw' ); @@ -764,7 +764,7 @@ public function project_name_and_edit_link( $project ) { if ( isset( $project->name ) ) { $url = $this->platform_url( 'templates/' . $project->id ); - $project_name = '' . sprintf( _x( 'Project: %s', 'Content Workflow project name', 'gathercontent-import' ), $project->name ) . ' | ' . __( 'edit project templates', 'gathercontent-import' ) . '
'; + $project_name = '' . sprintf( _x( 'Project: %s', 'Content Workflow project name', 'content-workflow' ), $project->name ) . ' | ' . __( 'edit project templates', 'content-workflow' ) . '
'; } return $project_name; diff --git a/includes/classes/admin/mapping/base.php b/includes/classes/admin/mapping/base.php index c692fc2f..50ee06b9 100644 --- a/includes/classes/admin/mapping/base.php +++ b/includes/classes/admin/mapping/base.php @@ -183,11 +183,11 @@ protected function get_default_field_options( $col ) { break; case 'post_status': $select_options = array( - 'publish' => __( 'Published', 'gathercontent-import' ), - 'draft' => __( 'Draft', 'gathercontent-import' ), - 'pending' => __( 'Pending', 'gathercontent-import' ), - 'private' => __( 'Private', 'gathercontent-import' ), - 'nochange' => __( 'Do not change', 'gathercontent-import' ), + 'publish' => __( 'Published', 'content-workflow' ), + 'draft' => __( 'Draft', 'content-workflow' ), + 'pending' => __( 'Pending', 'content-workflow' ), + 'private' => __( 'Private', 'content-workflow' ), + 'nochange' => __( 'Do not change', 'content-workflow' ), ); break; case 'post_type': @@ -343,40 +343,40 @@ protected function post_column_option_is_blacklisted( $col ) { protected function post_column_label( $col ) { switch ( $col ) { case 'ID': - return __( 'Author', 'gathercontent-import' ); + return __( 'Author', 'content-workflow' ); case 'post_author': - return __( 'Author', 'gathercontent-import' ); + return __( 'Author', 'content-workflow' ); case 'post_date': - return __( 'Post Date', 'gathercontent-import' ); + return __( 'Post Date', 'content-workflow' ); return 'post_date'; case 'post_date_gmt': - return __( 'Post Date (GMT)', 'gathercontent-import' ); + return __( 'Post Date (GMT)', 'content-workflow' ); case 'post_content': - return __( 'Post Content', 'gathercontent-import' ); + return __( 'Post Content', 'content-workflow' ); case 'post_title': - return __( 'Post Title', 'gathercontent-import' ); + return __( 'Post Title', 'content-workflow' ); case 'post_excerpt': - return __( 'Post Excerpt', 'gathercontent-import' ); + return __( 'Post Excerpt', 'content-workflow' ); case 'post_status': - return __( 'Post Status', 'gathercontent-import' ); + return __( 'Post Status', 'content-workflow' ); case 'comment_status': - return __( 'Comment Status', 'gathercontent-import' ); + return __( 'Comment Status', 'content-workflow' ); case 'ping_status': - return __( 'Ping Status', 'gathercontent-import' ); + return __( 'Ping Status', 'content-workflow' ); case 'post_password': - return __( 'Post Password', 'gathercontent-import' ); + return __( 'Post Password', 'content-workflow' ); case 'post_name': - return __( 'Post Name (Slug)', 'gathercontent-import' ); + return __( 'Post Name (Slug)', 'content-workflow' ); case 'post_modified': - return __( 'Post Modified Date', 'gathercontent-import' ); + return __( 'Post Modified Date', 'content-workflow' ); case 'post_modified_gmt': - return __( 'Post Modified Date (GMT)', 'gathercontent-import' ); + return __( 'Post Modified Date (GMT)', 'content-workflow' ); case 'post_parent': - return __( 'Post Parent', 'gathercontent-import' ); + return __( 'Post Parent', 'content-workflow' ); case 'menu_order': - return __( 'Menu Order', 'gathercontent-import' ); + return __( 'Menu Order', 'content-workflow' ); case 'post_type': - return __( 'Post Type', 'gathercontent-import' ); + return __( 'Post Type', 'content-workflow' ); default: return $col; } @@ -402,7 +402,7 @@ protected function post_types() { $type->taxonomies = array(); foreach ( get_object_taxonomies( $type->name, 'objects' ) as $tax ) { if ( 'post_format' === $tax->name ) { - $tax->label = __( 'Post Formats', 'gathercontent-import' ); + $tax->label = __( 'Post Formats', 'content-workflow' ); } $type->taxonomies[] = $tax; diff --git a/includes/classes/admin/mapping/field-types/acf.php b/includes/classes/admin/mapping/field-types/acf.php index c92b4101..f6d9abb4 100644 --- a/includes/classes/admin/mapping/field-types/acf.php +++ b/includes/classes/admin/mapping/field-types/acf.php @@ -26,7 +26,7 @@ class ACF extends Base implements Type { * @since 3.0.0 */ public function __construct() { - $this->option_label = __( 'ACF Field Groups', 'gathercontent-import' ); + $this->option_label = __( 'ACF Field Groups', 'content-workflow' ); } public function underscore_template ( View $view ) { @@ -47,28 +47,28 @@ public function underscore_template ( View $view ) { $groupIds = array_map(function ($group) use ($wpdb) { return $wpdb->prepare('%d', $group->ID); }, $group_results); - + $groupIds = implode(',', $groupIds); - + // Prepare and execute query to get all fields for all groups $fields_query = "SELECT * FROM {$wpdb->posts} WHERE post_type = 'acf-field' AND post_content LIKE '%repeater%' AND post_parent IN ($groupIds)"; $fields_results = $wpdb->get_results($fields_query); - + // Group the field results by parent group $grouped_field_results = []; foreach ($fields_results as $field) { $grouped_field_results[$field->post_parent][] = $field; } - + foreach($group_results as $group) { // Set the top level field group array of options $options_acf_groups[$group->post_name] = $group->post_title; // Create a blank array based on the group id to define the groups fields $options_acf_groups_fields[$group->post_name] = array(); - + // Get the fields for the current group from grouped results $fields_for_group = $grouped_field_results[$group->ID] ?? []; - + // Loop fields within each ACF Field Group foreach($fields_for_group as $field) { // Build array of fields based on parent group @@ -85,7 +85,7 @@ public function underscore_template ( View $view ) { <# } #> post_options = $post_options; - $this->option_label = __( 'Post Data', 'gathercontent-import' ); + $this->option_label = __( 'Post Data', 'content-workflow' ); } public function underscore_template( View $view ) { @@ -35,7 +35,7 @@ public function underscore_template( View $view ) { <# if ( 'e_type_id(); ?>' === data.field_type ) { #>';
+ $msg .= ' ';
}
$notices[] = array(
@@ -67,7 +67,7 @@ public function register_import_errors( $notices ) {
if ( $item_errors ) {
if ( is_array( $item_errors ) ) {
$msg = '';
- $main = __( 'There were some errors with the item import:', 'gathercontent-import' );
+ $main = __( 'There were some errors with the item import:', 'content-workflow' );
$msg .= ' ';
+ $msg = $main . ' ';
$notices[] = array(
'id' => 'gc-import-errors',
@@ -102,7 +102,7 @@ protected function error_parts( $error ) {
$msg_parts[] = '
@@ -163,7 +163,7 @@ protected function get_localize_data() {
'percent' => $this->mapping->get_pull_percent(),
'_items' => $this->items,
'_text' => array(
- 'no_items' => esc_html__( 'No items found.', 'gathercontent-import' ),
+ 'no_items' => esc_html__( 'No items found.', 'content-workflow' ),
),
);
}
@@ -181,11 +181,11 @@ protected function get_underscore_templates() {
'tmpl-gc-table-nav' => array(),
'tmpl-gc-items-sync' => array(
'headers' => array(
- 'status' => __( 'Status', 'gathercontent-import' ),
- 'itemName' => __( 'Item', 'gathercontent-import' ),
- 'updated_at' => __( 'Updated', 'gathercontent-import' ),
- 'mappingName' => __( 'Template Mapping', 'gathercontent-import' ),
- 'post_title' => __( 'WordPress Title', 'gathercontent-import' ),
+ 'status' => __( 'Status', 'content-workflow' ),
+ 'itemName' => __( 'Item', 'content-workflow' ),
+ 'updated_at' => __( 'Updated', 'content-workflow' ),
+ 'mappingName' => __( 'Template Mapping', 'content-workflow' ),
+ 'post_title' => __( 'WordPress Title', 'content-workflow' ),
),
),
'tmpl-gc-item' => array(
diff --git a/includes/classes/admin/mapping/template-mapper.php b/includes/classes/admin/mapping/template-mapper.php
index f74c84dc..d4a76a00 100644
--- a/includes/classes/admin/mapping/template-mapper.php
+++ b/includes/classes/admin/mapping/template-mapper.php
@@ -87,7 +87,7 @@ public function ui_page() {
'type' => 'hidden',
'id' => 'gc-template-title',
'name' => $this->option_name . '[title]',
- 'value' => esc_attr( isset( $this->template->data->name ) ? $this->template->data->name : __( 'Mapped Template', 'gathercontent-import' ) ),
+ 'value' => esc_attr( isset( $this->template->data->name ) ? $this->template->data->name : __( 'Mapped Template', 'content-workflow' ) ),
)
);
@@ -163,25 +163,25 @@ protected function get_localize_data() {
'default' => array(
'gc' => array(
'id' => 'gc-field-th',
- 'label' => __( 'Content Workflow Field', 'gathercontent-import' ),
+ 'label' => __( 'Content Workflow Field', 'content-workflow' ),
),
'wp' => array(
'id' => 'wp-field-th',
- 'label' => __( 'Mapped WordPress Field', 'gathercontent-import' ),
+ 'label' => __( 'Mapped WordPress Field', 'content-workflow' ),
),
),
'status' => array(
'gc' => array(
'id' => 'gc-status-th',
- 'label' => __( 'Content Workflow Status', 'gathercontent-import' ),
+ 'label' => __( 'Content Workflow Status', 'content-workflow' ),
),
'wp' => array(
'id' => 'wp-status-th',
- 'label' => __( 'Mapped WordPress Status', 'gathercontent-import' ),
+ 'label' => __( 'Mapped WordPress Status', 'content-workflow' ),
),
'gcafter' => array(
'id' => 'gcafter-status-th',
- 'label' => __( 'On Import, Change Status', 'gathercontent-import' ),
+ 'label' => __( 'On Import, Change Status', 'content-workflow' ),
),
),
),
@@ -208,7 +208,7 @@ protected function get_underscore_templates() {
'tmpl-gc-mapping-defaults-tab' => array(
'post_author_label' => $this->post_column_label( 'post_author' ),
'post_status_options' => $post_status_options,
- 'post_status_label' => __( 'Default Status', 'gathercontent-import' ),
+ 'post_status_label' => __( 'Default Status', 'content-workflow' ),
'post_type_label' => $this->post_column_label( 'post_type' ),
'post_type_options' => $this->get_default_field_options( 'post_type' ),
'gc_status_options' => $this->statuses,
@@ -271,7 +271,7 @@ protected function get_pointers( $initial ) {
$dismissed = explode( ',', (string) $dismissed );
$pointers = array(
- 'select_type' => ' ' . __( 'To get started, select your default Post Type for this mapping.', 'gathercontent-import' ) . ' ' . __( 'To get started, select your default Post Type for this mapping.', 'content-workflow' ) . ' ' . __( 'You\'ll find the tabs from the Content Workflow Template here. Select a tab to start mapping the Template fields.', 'gathercontent-import' ) . ' ' . __( 'You\'ll find the tabs from the Content Workflow Template here. Select a tab to start mapping the Template fields.', 'content-workflow' ) . ' ' . __( 'Here you\'ll be able to map each individual Content Workflow status to a WordPress status, and optionally, change the Content Workflow status when your items are imported to WordPress.', 'gathercontent-import' ) . ' ' . __( 'Here you\'ll be able to map each individual Content Workflow status to a WordPress status, and optionally, change the Content Workflow status when your items are imported to WordPress.', 'content-workflow' ) . ' ' . __( 'To make the plugin more speedy, we cache the requests to Content Workflow for 1 day, but if you find that you need to update the data from Content Workflow, just hit the "Refresh" button.', 'gathercontent-import' ) . ' ' . __( 'For more help, click the "Help" tab in the upper-right-hand corner.', 'gathercontent-import' ) . ' ' . __( 'To make the plugin more speedy, we cache the requests to Content Workflow for 1 day, but if you find that you need to update the data from Content Workflow, just hit the "Refresh" button.', 'content-workflow' ) . ' ' . __( 'For more help, click the "Help" tab in the upper-right-hand corner.', 'content-workflow' ) . ' ' . $msg . ' ' . $msg . ' ' . __( 'Go Back', 'gathercontent-import' ) . ' ' . __( 'Go Back', 'content-workflow' ) . ' ';
- echo '' . __( 'Project ID:', 'gathercontent-import' ) . ' ' . get_post_meta( get_the_id(), '_gc_project', 1 );
+ echo '' . __( 'Project ID:', 'content-workflow' ) . ' ' . get_post_meta( get_the_id(), '_gc_project', 1 );
echo ', ';
- echo '' . __( 'Template ID:', 'gathercontent-import' ) . ' ' . get_post_meta( get_the_id(), '_gc_template', 1 );
+ echo '' . __( 'Template ID:', 'content-workflow' ) . ' ' . get_post_meta( get_the_id(), '_gc_template', 1 );
if ( $account = get_post_meta( get_the_id(), '_gc_account', 1 ) ) {
$account = 'https://' . $account . '.gathercontent.com/';
echo ', ';
- echo '' . __( 'Account:', 'gathercontent-import' ) . ' ' . esc_url( $account ) . '';
+ echo '' . __( 'Account:', 'content-workflow' ) . ' ' . esc_url( $account ) . '';
}
echo '
- HTTP authentication for this site.', 'gathercontent-import' ); ?>
+ HTTP authentication for this site.', 'content-workflow' ); ?>
-
+
NOTE: There can be only one %1$s per project template. You are editing an existing mapping (ID: %2$d).', 'gathercontent-import' ), $this->get( 'name' ), $this->get( 'id' ) ); ?> NOTE: There can be only one %1$s per project template. You are editing an existing mapping (ID: %2$d).', 'content-workflow' ), $this->get( 'name' ), $this->get( 'id' ) ); ?>';
foreach ( $item_errors as $error ) {
$parts = $this->error_parts( $error );
@@ -76,7 +76,7 @@ public function register_import_errors( $notices ) {
}
$msg .= '
';
- $msg = $main . '' . __( 'Select your Post Type', 'gathercontent-import' ) . '
' . __( 'Select your Post Type', 'content-workflow' ) . '
' . __( 'Template Tabs and Fields', 'gathercontent-import' ) . '
';
- $content .= '' . __( 'Template Tabs and Fields', 'content-workflow' ) . '
';
+ $content .= '' . __( 'Content Workflow Status ↠ WordPress Status', 'gathercontent-import' ) . '
';
- $content .= '' . __( 'Content Workflow Status ↠ WordPress Status', 'content-workflow' ) . '
';
+ $content .= '' . __( 'Refresh data from Content Workflow', 'gathercontent-import' ) . '
';
- $content .= '' . __( 'Refresh data from Content Workflow', 'content-workflow' ) . '
';
+ $content .= 'wp-content/' . self::$log_file . '
' ),
+ __( 'Debug Mode', 'content-workflow' ),
+ sprintf( __( 'Debug file location: %s', 'content-workflow' ), 'wp-content/' . self::$log_file . '
' ),
Admin::SLUG
);
$section->add_field(
'log_importer_requests',
- __( 'Log Importer Requests?', 'gathercontent-import' ),
+ __( 'Log Importer Requests?', 'content-workflow' ),
array( $this, 'debug_checkbox_field_cb' )
);
$section->add_field(
'review_stuck_status',
- __( 'Review stuck sync statuses?', 'gathercontent-import' ),
+ __( 'Review stuck sync statuses?', 'content-workflow' ),
array( $this, 'debug_checkbox_field_cb' )
);
$section->add_field(
'delete_stuck_status',
- __( 'Delete stuck sync statuses?', 'gathercontent-import' ),
+ __( 'Delete stuck sync statuses?', 'content-workflow' ),
array( $this, 'debug_checkbox_field_cb' )
);
$section->add_field(
'view_gc_log_file',
- __( 'View contents of the Content Workflow debug log file?', 'gathercontent-import' ),
+ __( 'View contents of the Content Workflow debug log file?', 'content-workflow' ),
array( $this, 'debug_checkbox_field_cb' )
);
$section->add_field(
'delete_gc_log_file',
- __( 'Delete Content Workflow debug log file?', 'gathercontent-import' ),
+ __( 'Delete Content Workflow debug log file?', 'content-workflow' ),
array( $this, 'debug_checkbox_field_cb' )
);
$section->add_field(
'disable_debug_mode',
- __( 'Disable Debug Mode?', 'gathercontent-import' ),
+ __( 'Disable Debug Mode?', 'content-workflow' ),
array( $this, 'debug_checkbox_field_cb' )
);
@@ -254,7 +252,7 @@ public function do_debug_options_actions( $settings ) {
);
$back_url = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '';
- $back_button = $back_url ? '' );
diff --git a/includes/classes/sync/push.php b/includes/classes/sync/push.php
index 37dc820d..97d1be6c 100644
--- a/includes/classes/sync/push.php
+++ b/includes/classes/sync/push.php
@@ -126,7 +126,7 @@ protected function do_item( $id ) {
if ( empty( $config_update ) ) {
throw new Exception(
- sprintf( __( 'No update data found for that post ID: %d', 'gathercontent-import' ), $this->post->ID ),
+ sprintf( __( 'No update data found for that post ID: %d', 'content-workflow' ), $this->post->ID ),
__LINE__,
array(
'post_id' => $this->post->ID,
@@ -202,7 +202,7 @@ public function maybe_do_item_update( $update ) {
$decoded_value = [];
}
}
-
+
// Handle repeatable components
$i = 0;
foreach ($decoded_value as $value) {
@@ -214,7 +214,7 @@ public function maybe_do_item_update( $update ) {
}else {
$config->content->$component_uuid->$element_id = $updated_element->value;
}
-
+
} else {
$config->content->$element_id = $updated_element->value;
@@ -311,9 +311,9 @@ public function loop_item_elements_and_map() {
}
$structure_groups = isset( $this->item_config->related ) ? $this->item_config->related->structure->groups : $this->item_config->structure->groups;
-
+
$this->item_config = array();
-
+
if ( ! isset( $structure_groups ) || empty( $structure_groups ) ) {
return false;
}
@@ -323,14 +323,14 @@ public function loop_item_elements_and_map() {
if ( ! isset( $tab->fields ) || ! $tab->fields ) {
continue;
}
-
+
// to handle fields in a tab
foreach ( $tab->fields as $element_index => $field ) {
// to handle components with multiple fields inside
$fields_data = $field->component->fields ?? array( $field );
$component_uuid = 'component' === $field->field_type ? $field->uuid : '';
-
+
$is_component_repeatable = false;
if($component_uuid) {
$metadata = $field->metadata;
@@ -340,7 +340,7 @@ public function loop_item_elements_and_map() {
foreach ( $fields_data as $field_data ) {
$this->element = (object) $this->format_element_data( $field_data, $component_uuid, false, $is_component_repeatable );
-
+
if ( $component_uuid ) {
$this->element->component_uuid = $component_uuid;
}
@@ -353,7 +353,7 @@ public function loop_item_elements_and_map() {
$source = $this->mapping->data( $uuid );
$source_type = isset( $source['type'] ) ? $source['type'] : '';
-
+
// Check if $source['field'] exists, then use it as the key
if (isset($source['field'])) {
// not sure if the field can be empty, will need to check that later on
@@ -542,7 +542,7 @@ protected function set_featured_image_alt( $source_key ) {
*/
protected function set_post_field_value( $post_column ) {
$updated = false;
- $el_value = $this->element->value;
+ $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 );
@@ -660,7 +660,7 @@ function( $label ) use ( $term_names ) {
protected function set_meta_field_value( $meta_key ) {
$updated = false;
$meta_value = get_post_meta( $this->post->ID, $meta_key, 1 );
-
+
$check = apply_filters( 'gc_config_pre_meta_field_value_updated', null, $meta_value, $meta_key, $this );
if ( null !== $check ) {
return $check;
@@ -716,25 +716,25 @@ function( $label ) use ( $meta_value ) {
* @param string $field_key The ACF field key.
* @param array $post_data The WP Post data array.
*
- * @return bool $updated Whether value was updated.
+ * @return bool $updated Whether value was updated.
*/
protected function set_acf_field_value($group_key) {
$updated = false;
-
+
// Get the post ID
$post_id = $this->post->ID;
-
+
// Fetch the ACF field group using the group key
$field_group = get_field($group_key, $post_id);
$el = $this->element;
- $el_value = $this->element->value;
+ $el_value = $this->element->value;
if (is_object($el) && property_exists($el, 'component_uuid')) {
// We have a component here
$structure_groups = $this->item->structure->groups;
$componentFieldsKeys = [];
-
+
foreach ($structure_groups as $group) {
$fields = $group->fields;
foreach ($fields as $field) {
@@ -757,7 +757,7 @@ protected function set_acf_field_value($group_key) {
$new_group = array_combine($componentFieldsKeys, $group);
$groupData[] = $new_group;
}
-
+
// Define a mapping between field types and processing functions
@@ -768,7 +768,7 @@ protected function set_acf_field_value($group_key) {
'choice_radio' => 'processChoiceRadioField',
// Add more field types and corresponding processing functions as needed
];
-
+
// Initialize an associative array to store grouped items
$groupedData = [];
// Iterate through each group data
@@ -784,7 +784,7 @@ protected function set_acf_field_value($group_key) {
$groupedData[$field_uuid][] = $field_value;
}
}
-
+
// Iterate through each field type and its corresponding field UUIDs
foreach ($groupedData as $field_uuid => $field_values) {
// Process field values based on field type
@@ -795,7 +795,7 @@ protected function set_acf_field_value($group_key) {
break; // Stop iterating once the field with the matching UUID is found
}
}
-
+
if (isset($fieldTypeProcessors[$field_type])) {
if ($this->element->name == $field_uuid){
// Call the corresponding processing function for each field UUID
@@ -812,7 +812,7 @@ protected function set_acf_field_value($group_key) {
$jsonValue = $processorResult;
}
}
-
+
// Assign the processed value to the corresponding element
if (($this->element->name == $field_uuid) && ($this->element->value != $jsonValue)){
@@ -841,14 +841,14 @@ protected function set_acf_field_value($group_key) {
$updated = true;
}
}
-
+
return $updated;
- }
-
+ }
+
protected function processTextField($field_value) {
// Handle text field type
$jsonValues = []; // Array to store JSON encoded values
-
+
// Check if the field value is an array
if (is_array($field_value)) {
foreach ($field_value as $item) {
@@ -880,17 +880,17 @@ protected function processTextField($field_value) {
$jsonValues[] = '"' . addslashes($trimmedValue) . '"';
}
}
-
+
} else {
// If the field value is not an array, encode it directly
$trimmedValue = rtrim($field_value, "\n\r");
$jsonValues[] = '"' . addslashes($trimmedValue) . '"';
}
-
+
// Return the JSON encoded values
return '[' . implode(',', $jsonValues) . ']';
}
-
+
protected function processAttachmentField($field_value) {
// Check if the field value is empty or not set
if (empty($field_value)) {
@@ -898,10 +898,10 @@ protected function processAttachmentField($field_value) {
return '[]'; // Send an empty array to remove all attachments
} else {
// Field value is not empty, meaning attachments are provided
-
+
// Initialize an array to store file IDs for attachments
$fileIds = [];
-
+
// Loop through each attachment data in the field value array
foreach ($field_value as $attachment) {
// Check if the attachment has an 'ID' key
@@ -912,86 +912,86 @@ protected function processAttachmentField($field_value) {
// If you want to upload new files, you can handle it here
// Upload the new files via multipart/form-data as described in the GatherContent API documentation
}
-
+
// Return the file IDs as a JSON array
return json_encode($fileIds);
}
}
-
+
protected function processChoiceCheckboxField($field_value) {
$options = $this->element->options; // Get the options
$result_options = []; // Array to store the result for options
$result_value = []; // Array to store the result for value
-
+
// Iterate through each item in the field value array
foreach ($field_value as $value) {
$selected_options = []; // Array to store options for this value
$selected_value = []; // Array to store value for this value
-
+
// Iterate through each option and set 'selected' property accordingly
foreach ($options as $option) {
$selected_option = clone $option; // Clone the option object
-
+
// Set 'selected' property based on whether the label matches any value in the current $field_value item
$selected_option->selected = in_array($option->label, $value) ? 1 : 0;
-
+
// Add the modified option to the array
$selected_options[] = $selected_option;
-
+
// If the label matches any value in the current $field_value item, store the value details
if (in_array($option->label, $value)) {
$selected_value[] = ['id' => $option->name, 'label' => $option->label];
}
}
-
+
// Add the array of options for this value to the result
$result_options[] = $selected_options;
-
+
// Add the value details to the result
$result_value[] = $selected_value;
}
-
+
return ['options' => $result_options, 'value' => $result_value]; // Return both results
}
-
+
protected function processChoiceRadioField($field_value) {
$options = $this->element->options; // Get the options
$result_options = []; // Array to store the result for options
$result_value = []; // Array to store the result for value
-
+
// Iterate through each item in the field value array
foreach ($field_value as $value) {
$selected_options = []; // Array to store options for this value
$selected_value = []; // Array to store value for this value
-
+
// Iterate through each option and set 'selected' property accordingly
foreach ($options as $option) {
$selected_option = clone $option; // Clone the option object
-
+
// Set 'selected' property based on whether the label matches the value
$selected_option->selected = ($option->label === $value) ? 1 : 0;
-
+
// Add the modified option to the array
$selected_options[] = $selected_option;
-
+
// If the label matches the value, store the value details
if ($option->label === $value) {
$selected_value[] = ['id' => $option->name, 'label' => $option->label];
}
}
-
+
// Add the array of options for this value to the result
$result_options[] = $selected_options;
-
+
// Add the value details to the result
$result_value[] = $selected_value;
}
-
+
return ['options' => $result_options, 'value' => $result_value]; // Return both results
}
-
-
-
+
+
+
/**
* Uses $callback to determine if each option value should be selected,
diff --git a/includes/classes/utils.php b/includes/classes/utils.php
index 659076f0..1f313d1c 100644
--- a/includes/classes/utils.php
+++ b/includes/classes/utils.php
@@ -176,12 +176,12 @@ public static function gc_field_type_name( $type ) {
$types = apply_filters(
'gc_field_type_names',
array(
- 'text' => __( 'Text', 'gathercontent-import' ),
- 'text_rich' => __( 'Rich Text', 'gathercontent-import' ),
- 'text_plain' => __( 'Plain Text', 'gathercontent-import' ),
- 'choice_radio' => __( 'Radio', 'gathercontent-import' ),
- 'choice_checkbox' => __( 'Checkboxes', 'gathercontent-import' ),
- 'files' => __( 'Attachment', 'gathercontent-import' ),
+ 'text' => __( 'Text', 'content-workflow' ),
+ 'text_rich' => __( 'Rich Text', 'content-workflow' ),
+ 'text_plain' => __( 'Plain Text', 'content-workflow' ),
+ 'choice_radio' => __( 'Radio', 'content-workflow' ),
+ 'choice_checkbox' => __( 'Checkboxes', 'content-workflow' ),
+ 'files' => __( 'Attachment', 'content-workflow' ),
)
);
}
diff --git a/includes/views/auth-enabled-desc.php b/includes/views/auth-enabled-desc.php
index 3bb14007..567bf9b7 100644
--- a/includes/views/auth-enabled-desc.php
+++ b/includes/views/auth-enabled-desc.php
@@ -1,10 +1,10 @@
-
+