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

', - __( '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.', 'gathercontent-import' ) + __( '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' ) ); } diff --git a/includes/classes/admin/admin.php b/includes/classes/admin/admin.php index 2ea9d582..20e56487 100644 --- a/includes/classes/admin/admin.php +++ b/includes/classes/admin/admin.php @@ -58,10 +58,10 @@ public function __construct( API $api ) { $response = $this->api()->get_last_response(); - $message = __( 'We had trouble connecting to the Content Workflow API. Please check your settings.', 'gathercontent-import' ); + $message = __( 'We had trouble connecting to the Content Workflow API. Please check your settings.', 'content-workflow' ); if ( is_wp_error( $response ) ) { - $message .= '

' . 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/' ) . '

'; + echo '

' . 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/' ) . '

'; if ( $slug = get_option( $key . '_api_url' ) ) { $this->settings()->options['platform_url_slug'] = $slug; } } else { - echo '

' . 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 ) { underscore_options( $options ); ?> - underscore_empty_option( __( 'Do Not Import', 'gathercontent-import' ) ); ?> + underscore_empty_option( __( 'Do Not Import', 'content-workflow' ) ); ?> <# } #> option_label = __( 'Custom Fields', 'gathercontent-import' ); + $this->option_label = __( 'Custom Fields', 'content-workflow' ); } public function underscore_template( View $view ) { @@ -37,7 +37,7 @@ public function underscore_template( View $view ) { <# _.each( data.metaKeys, function( key ) { #> <# }); #> - underscore_empty_option( __( 'Do Not Import', 'gathercontent-import' ) ); ?> + underscore_empty_option( __( 'Do Not Import', 'content-workflow' ) ); ?> <# } #> 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 ) { #> <# } #> post_types = $post_types; - $this->option_label = __( 'Taxonomy/Terms', 'gathercontent-import' ); + $this->option_label = __( 'Taxonomy/Terms', 'content-workflow' ); } public function underscore_options( $tax_array ) { @@ -40,10 +40,10 @@ public function underscore_template( View $view ) { <# if ( 'e_type_id(); ?>' === data.field_type && 'name; ?>' === data.post_type ) { #> <# } #> diff --git a/includes/classes/admin/mapping/field-types/wpseo.php b/includes/classes/admin/mapping/field-types/wpseo.php index 9b509245..af73306b 100644 --- a/includes/classes/admin/mapping/field-types/wpseo.php +++ b/includes/classes/admin/mapping/field-types/wpseo.php @@ -52,7 +52,7 @@ class WPSEO extends Base implements Type { public function __construct( array $post_types ) { $this->post_types = $post_types; $this->seo_options = $this->get_seo_options(); - $this->option_label = __( 'SEO', 'gathercontent-import' ); + $this->option_label = __( 'SEO', 'content-workflow' ); add_filter( 'gathercontent_importer_custom_field_keys_blacklist', array( $this, 'remove_wpseo_keys' ) ); } @@ -146,7 +146,7 @@ public function underscore_template( View $view ) { underscore_options( $options ); ?> <# } #> - underscore_empty_option( __( 'Do Not Import', 'gathercontent-import' ) ); ?> + underscore_empty_option( __( 'Do Not Import', 'content-workflow' ) ); ?> <# } #>

'; $msg .= $part; - $msg .= '

'; + $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 . '

' . $msg . '

'; + $msg = $main . '

' . $msg . '

'; $notices[] = array( 'id' => 'gc-import-errors', @@ -102,7 +102,7 @@ protected function error_parts( $error ) { $msg_parts[] = '

' . print_r( $error->get_error_data(), true ) . ''; } else { - $msg_parts[] = __( 'Error!', 'gathercontent-import' ); + $msg_parts[] = __( 'Error!', 'content-workflow' ); $msg_parts[] = ' ' . print_r( $error, true ) . ' '; } @@ -142,7 +142,7 @@ public function ui_page() { ?> -

+

@@ -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' => '

' . __( 'Select your Post Type', 'gathercontent-import' ) . '

' . __( 'To get started, select your default Post Type for this mapping.', 'gathercontent-import' ) . '

', + 'select_type' => '

' . __( 'Select your Post Type', 'content-workflow' ) . '

' . __( 'To get started, select your default Post Type for this mapping.', 'content-workflow' ) . '

', 'select_tab_how_to' => '', 'map_status_how_to' => '', 'refresh_connection' => '', @@ -280,16 +280,16 @@ protected function get_pointers( $initial ) { if ( $initial ) { if ( ! in_array( 'gc_select_tab_how_to', $dismissed, 1 ) ) { - $content = '

' . __( 'Template Tabs and Fields', 'gathercontent-import' ) . '

'; - $content .= '

' . __( 'You\'ll find the tabs from the Content Workflow Template here. Select a tab to start mapping the Template fields.', 'gathercontent-import' ) . '

'; + $content = '

' . __( 'Template Tabs and Fields', 'content-workflow' ) . '

'; + $content .= '

' . __( 'You\'ll find the tabs from the Content Workflow Template here. Select a tab to start mapping the Template fields.', 'content-workflow' ) . '

'; $pointers['select_tab_how_to'] = $content; $enqueue = true; } if ( ! in_array( 'gc_map_status_how_to', $dismissed, 1 ) ) { - $content = '

' . __( 'Content Workflow Status ↠ WordPress Status', 'gathercontent-import' ) . '

'; - $content .= '

' . __( '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' ) . '

'; + $content = '

' . __( 'Content Workflow Status ↠ WordPress Status', 'content-workflow' ) . '

'; + $content .= '

' . __( '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' ) . '

'; $pointers['map_status_how_to'] = $content; $enqueue = true; @@ -297,9 +297,9 @@ protected function get_pointers( $initial ) { } else { if ( ! in_array( 'gc_refresh_connection', $dismissed, 1 ) ) { - $content = '

' . __( 'Refresh data from Content Workflow', 'gathercontent-import' ) . '

'; - $content .= '

' . __( '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' ) . '

'; - $content .= '

' . __( 'For more help, click the "Help" tab in the upper-right-hand corner.', 'gathercontent-import' ) . '

'; + $content = '

' . __( 'Refresh data from Content Workflow', 'content-workflow' ) . '

'; + $content .= '

' . __( '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' ) . '

'; + $content .= '

' . __( 'For more help, click the "Help" tab in the upper-right-hand corner.', 'content-workflow' ) . '

'; $pointers['refresh_connection'] = $content; $enqueue = true; @@ -387,7 +387,7 @@ protected function get_tabs() { $default_tab = [ 'id' => 'mapping-defaults', - 'label' => __('Mapping Defaults', 'gathercontent-import'), + 'label' => __('Mapping Defaults', 'content-workflow'), 'hidden' => true, 'navClasses' => 'alignright', 'rows' => $this->post_options(), diff --git a/includes/classes/admin/support.php b/includes/classes/admin/support.php index c5036f46..e21b9164 100644 --- a/includes/classes/admin/support.php +++ b/includes/classes/admin/support.php @@ -69,8 +69,8 @@ public function initialize_settings_sections() {} public function admin_menu() { add_submenu_page( self::SLUG, - __( 'Support', 'gathercontent-import' ), - __( 'Support', 'gathercontent-import' ), + __( 'Support', 'content-workflow' ), + __( 'Support', 'content-workflow' ), \GatherContent\Importer\view_capability(), self::SLUG . '-support', array( $this, 'admin_page' ) diff --git a/includes/classes/api.php b/includes/classes/api.php index e3521171..43d68484 100644 --- a/includes/classes/api.php +++ b/includes/classes/api.php @@ -715,7 +715,7 @@ public function request( $endpoint, $args = array(), $method = 'GET', $query_par if ( 500 === $response['response']['code'] && ( $error = wp_remote_retrieve_body( $response ) ) ) { $error = json_decode( $error ); - $message = isset( $error->message ) ? $error->message : __( 'Unknown Error', 'gathercontent-import' ); + $message = isset( $error->message ) ? $error->message : __( 'Unknown Error', 'content-workflow' ); $response = new WP_Error( 'gc_api_error', $message, @@ -727,7 +727,7 @@ public function request( $endpoint, $args = array(), $method = 'GET', $query_par } elseif ( 401 === $response['response']['code'] && ( $error = wp_remote_retrieve_body( $response ) ) ) { - $message = $error ? $error : __( 'Unknown Error', 'gathercontent-import' ); + $message = $error ? $error : __( 'Unknown Error', 'content-workflow' ); $response = new WP_Error( 'gc_api_error', $message, @@ -769,7 +769,7 @@ public function request_args( $args ) { $this->set_user( $settings['account_email'] ); $this->set_api_key( $settings['api_key'] ); } else { - throw new \Exception( __( 'The Content Workflow API connection is not set up.', 'gathercontent-import' ) ); + throw new \Exception( __( 'The Content Workflow API connection is not set up.', 'content-workflow' ) ); } } diff --git a/includes/classes/debug.php b/includes/classes/debug.php index 1e4abe91..4271bef0 100644 --- a/includes/classes/debug.php +++ b/includes/classes/debug.php @@ -13,8 +13,6 @@ /** * GatherContent Plugin Debug * - * Docs: https://github.com/gathercontent/wordpress-plugin/wiki/Developer-Debug-Mode - * * @since 3.0.1 */ class Debug extends Base { @@ -126,7 +124,7 @@ public function log_sync_results( $maybe_error, $sync ) { * @return void */ public function debug_disabled_notice() { - $msg = esc_html__( 'Content Workflow Debug Mode: Disabled', 'gathercontent-import' ); + $msg = esc_html__( 'Content Workflow Debug Mode: Disabled', 'content-workflow' ); echo '

' . $msg . '

'; } @@ -138,7 +136,7 @@ public function debug_disabled_notice() { * @return void */ public function debug_enabled_notice() { - $msg = esc_html__( 'Content Workflow Debug Mode: Enabled', 'gathercontent-import' ); + $msg = esc_html__( 'Content Workflow Debug Mode: Enabled', 'content-workflow' ); echo '

' . $msg . '

'; } @@ -150,44 +148,44 @@ public function debug_enabled_notice() { public function add_debug_fields() { $section = new Form_Section( 'debug', - __( 'Debug Mode', 'gathercontent-import' ), - sprintf( __( 'Debug file location: %s', 'gathercontent-import' ), '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 ? '

' . __( 'Go Back', 'gathercontent-import' ) . '

' : ''; + $back_button = $back_url ? '

' . __( 'Go Back', 'content-workflow' ) . '

' : ''; if ( $settings['review_stuck_status'] || $settings['delete_stuck_status'] ) { @@ -279,7 +277,7 @@ public function do_debug_options_actions( $settings ) { return $orig_settings; } - wp_die( '' . __LINE__ . ') $settings: ' . print_r( $settings, true ) . '' . $back_button, __( 'Debug Mode', 'gathercontent-import' ) ); + wp_die( '' . __LINE__ . ') $settings: ' . print_r( $settings, true ) . '' . $back_button, __( 'Debug Mode', 'content-workflow' ) ); } /** @@ -306,7 +304,7 @@ public function handle_stuck_statuses( $settings, $back_button ) { ); } } else { - wp_die( __( 'There are no stuck statuses.', 'gathercontent-import' ) . $back_button, __( 'Debug Mode', 'gathercontent-import' ) ); + wp_die( __( 'There are no stuck statuses.', 'content-workflow' ) . $back_button, __( 'Debug Mode', 'content-workflow' ) ); } if ( $settings['delete_stuck_status'] ) { @@ -315,7 +313,7 @@ public function handle_stuck_statuses( $settings, $back_button ) { } } - wp_die( '' . __LINE__ . ') $options: ' . print_r( $options, true ) . '' . $back_button, __( 'Debug Mode', 'gathercontent-import' ) ); + wp_die( '' . __LINE__ . ') $options: ' . print_r( $options, true ) . '' . $back_button, __( 'Debug Mode', 'content-workflow' ) ); } /** @@ -329,10 +327,10 @@ public function handle_stuck_statuses( $settings, $back_button ) { */ public function delete_gc_log_file( $back_button ) { if ( unlink( self::$log_path ) ) { - wp_die( __( 'Content Workflow log file deleted.', 'gathercontent-import' ) . $back_button, __( 'Debug Mode', 'gathercontent-import' ) ); + wp_die( __( 'Content Workflow log file deleted.', 'content-workflow' ) . $back_button, __( 'Debug Mode', 'content-workflow' ) ); } - wp_die( __( 'Failed to delete Content Workflow log file.' . $back_button, 'gathercontent-import' ), __( 'Debug Mode', 'gathercontent-import' ) ); + wp_die( __( 'Failed to delete Content Workflow log file.' . $back_button, 'content-workflow' ), __( 'Debug Mode', 'content-workflow' ) ); } /** @@ -348,7 +346,7 @@ public function view_gc_log_file( $back_button ) { $log_contents = file_exists( self::$log_path ) ? file_get_contents( self::$log_path ) : ''; if ( ! $log_contents ) { - wp_die( __( 'Content Workflow log file is empty.', 'gathercontent-import' ) . $back_button, __( 'Debug Mode', 'gathercontent-import' ) ); + wp_die( __( 'Content Workflow log file is empty.', 'content-workflow' ) . $back_button, __( 'Debug Mode', 'content-workflow' ) ); } die( '' . $back_button . '
' ); @@ -401,10 +399,10 @@ public static function toggle_debug_mode( $debug_enabled ) { if ( $changed ) { $status = self::$debug_mode - ? esc_html__( 'Enabled', 'gathercontent-import' ) - : esc_html__( 'Disabled', 'gathercontent-import' ); + ? esc_html__( 'Enabled', 'content-workflow' ) + : esc_html__( 'Disabled', 'content-workflow' ); - self::_debug_log( sprintf( esc_html__( 'Content Workflow Debug Mode: %s', 'gathercontent-import' ), $status ) ); + self::_debug_log( sprintf( esc_html__( 'Content Workflow Debug Mode: %s', 'content-workflow' ), $status ) ); } return self::$debug_mode; diff --git a/includes/classes/post-types/template-mappings.php b/includes/classes/post-types/template-mappings.php index b3041ef9..ef380048 100644 --- a/includes/classes/post-types/template-mappings.php +++ b/includes/classes/post-types/template-mappings.php @@ -34,25 +34,25 @@ public function __construct( $parent_menu_slug, API $api ) { parent::__construct( array( - 'name' => _x( 'Template Mappings', 'post type general name', 'gathercontent-import' ), - 'singular_name' => _x( 'Template Mapping', 'post type singular name', 'gathercontent-import' ), - 'add_new' => _x( 'Add New', 'post', 'gathercontent-import' ), - 'add_new_item' => __( 'Add New Template Mapping', 'gathercontent-import' ), - 'edit_item' => __( 'Edit Template Mapping', 'gathercontent-import' ), - 'new_item' => __( 'New Template Mapping', 'gathercontent-import' ), - 'view_item' => __( 'View Template Mapping', 'gathercontent-import' ), - 'item_updated' => __( 'Template Mapping updated', 'gathercontent-import' ), - 'item_saved' => __( 'Template Mapping saved', 'gathercontent-import' ), - 'search_items' => __( 'Search Template Mappings', 'gathercontent-import' ), - 'not_found' => __( 'No template mappings found.', 'gathercontent-import' ), - 'not_found_in_trash' => __( 'No template mappings found in Trash.', 'gathercontent-import' ), - 'all_items' => __( 'Template Mappings', 'gathercontent-import' ), - 'archives' => __( 'Template Mapping Archives', 'gathercontent-import' ), - 'insert_into_item' => __( 'Insert into template mapping', 'gathercontent-import' ), - 'uploaded_to_this_item' => __( 'Uploaded to this template mapping', 'gathercontent-import' ), - 'filter_items_list' => __( 'Filter template mappings list', 'gathercontent-import' ), - 'items_list_navigation' => __( 'Template Mappings list navigation', 'gathercontent-import' ), - 'items_list' => __( 'Template Mappings list', 'gathercontent-import' ), + 'name' => _x( 'Template Mappings', 'post type general name', 'content-workflow' ), + 'singular_name' => _x( 'Template Mapping', 'post type singular name', 'content-workflow' ), + 'add_new' => _x( 'Add New', 'post', 'content-workflow' ), + 'add_new_item' => __( 'Add New Template Mapping', 'content-workflow' ), + 'edit_item' => __( 'Edit Template Mapping', 'content-workflow' ), + 'new_item' => __( 'New Template Mapping', 'content-workflow' ), + 'view_item' => __( 'View Template Mapping', 'content-workflow' ), + 'item_updated' => __( 'Template Mapping updated', 'content-workflow' ), + 'item_saved' => __( 'Template Mapping saved', 'content-workflow' ), + 'search_items' => __( 'Search Template Mappings', 'content-workflow' ), + 'not_found' => __( 'No template mappings found.', 'content-workflow' ), + 'not_found_in_trash' => __( 'No template mappings found in Trash.', 'content-workflow' ), + 'all_items' => __( 'Template Mappings', 'content-workflow' ), + 'archives' => __( 'Template Mapping Archives', 'content-workflow' ), + 'insert_into_item' => __( 'Insert into template mapping', 'content-workflow' ), + 'uploaded_to_this_item' => __( 'Uploaded to this template mapping', 'content-workflow' ), + 'filter_items_list' => __( 'Filter template mappings list', 'content-workflow' ), + 'items_list_navigation' => __( 'Template Mappings list navigation', 'content-workflow' ), + 'items_list' => __( 'Template Mappings list', 'content-workflow' ), ), array( 'show_ui' => true, @@ -142,9 +142,9 @@ public function clear_out_updated_at( $post_id ) { * @param array $columns Array of registered columns for the mapping post-type. */ public function register_column_headers( $columns ) { - $columns['account'] = __( 'Account slug', 'gathercontent-import' ); - $columns['project'] = __( 'Project id', 'gathercontent-import' ); - $columns['template'] = __( 'Template id', 'gathercontent-import' ); + $columns['account'] = __( 'Account slug', 'content-workflow' ); + $columns['project'] = __( 'Project id', 'content-workflow' ); + $columns['template'] = __( 'Template id', 'content-workflow' ); return $columns; } @@ -268,14 +268,14 @@ protected function column_post_data( $post_id ) { public function output_mapping_data( $post ) { if ( self::SLUG === $post->post_type ) { echo '

'; - 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 '

'; @@ -342,8 +342,8 @@ function remove_quick_edit( $actions, $post ) { $actions['sync-items'] = sprintf( '%s', add_query_arg( 'sync-items', 1, get_edit_post_link( $post->ID, 'raw' ) ), - esc_attr( __( 'Review Items for Import', 'gathercontent-import' ) ), - __( 'Review Items for Import', 'gathercontent-import' ) + esc_attr( __( 'Review Items for Import', 'content-workflow' ) ), + __( 'Review Items for Import', 'content-workflow' ) ); } diff --git a/includes/classes/sync/base.php b/includes/classes/sync/base.php index 9b2af107..b7d27a07 100644 --- a/includes/classes/sync/base.php +++ b/includes/classes/sync/base.php @@ -180,7 +180,7 @@ protected function _sync_items( $mapping_post ) { $in_progress = get_option( $progress_option_key ); if ( $in_progress ) { - return new WP_Error( "gc_{$this->direction}_item_in_progress", sprintf( __( 'Currently in progress: %d', 'gathercontent-import' ), $id ) ); + return new WP_Error( "gc_{$this->direction}_item_in_progress", sprintf( __( 'Currently in progress: %d', 'content-workflow' ), $id ) ); } try { @@ -231,7 +231,7 @@ protected function _sync_items( $mapping_post ) { protected function get_post( $post_id ) { $post = $post_id instanceof WP_Post ? $post_id : get_post( $post_id ); if ( ! $post ) { - throw new Exception( sprintf( __( 'No post object by that id: %d', 'gathercontent-import' ), $post_id ), __LINE__ ); + throw new Exception( sprintf( __( 'No post object by that id: %d', 'content-workflow' ), $post_id ), __LINE__ ); } return $post; @@ -254,7 +254,7 @@ protected function set_item( $item_id, $exclude_status = false ) { if ( ! isset( $this->item->id ) ) { // @todo maybe check if error was temporary. - throw new Exception( sprintf( __( 'Content Workflow could not get an item for that item id: %d', 'gathercontent-import' ), $item_id ), __LINE__, $this->item ); + throw new Exception( sprintf( __( 'Content Workflow could not get an item for that item id: %d', 'content-workflow' ), $item_id ), __LINE__, $this->item ); } return $this->item; @@ -273,7 +273,7 @@ protected function get_items_to_sync() { $items = $this->mapping->get_items_to_sync( $this->direction ); if ( empty( $items['pending'] ) ) { - throw new Exception( sprintf( __( 'No items to %1$s for: %2$s', 'gathercontent-import' ), $this->direction, $this->mapping->ID ), __LINE__ ); + throw new Exception( sprintf( __( 'No items to %1$s for: %2$s', 'content-workflow' ), $this->direction, $this->mapping->ID ), __LINE__ ); } return $items; @@ -292,7 +292,7 @@ protected function check_mapping_data() { $mapping_data = $this->mapping->data(); if ( empty( $mapping_data ) ) { // @todo maybe check if error was temporary. - throw new Exception( sprintf( __( 'No mapping data found for: %s', 'gathercontent-import' ), $this->mapping->ID ), __LINE__ ); + throw new Exception( sprintf( __( 'No mapping data found for: %s', 'content-workflow' ), $this->mapping->ID ), __LINE__ ); } } diff --git a/includes/classes/sync/pull.php b/includes/classes/sync/pull.php index dba60f37..46a6689e 100644 --- a/includes/classes/sync/pull.php +++ b/includes/classes/sync/pull.php @@ -107,7 +107,7 @@ protected function do_item( $id ) { $attachments = $tax_terms = false; if ( $existing = \GatherContent\Importer\get_post_by_item_id( $id ) ) { - + // Check if item is up-to-date and if pull is necessary. $meta = \GatherContent\Importer\get_post_item_meta( $existing->ID ); $updated_at = isset( $meta['updated_at'] ) ? $meta['updated_at'] : 0; @@ -121,7 +121,7 @@ protected function do_item( $id ) { && $is_up_to_date && apply_filters( 'gc_only_update_if_newer', true ) ) { throw new Exception( - sprintf( __( 'WordPress has most recent changes for %1$s (Item ID: %2$d):', 'gathercontent-import' ), $this->item->name, $this->item->id ), + sprintf( __( 'WordPress has most recent changes for %1$s (Item ID: %2$d):', 'content-workflow' ), $this->item->name, $this->item->id ), __LINE__, array( 'post' => $existing->ID, @@ -135,7 +135,7 @@ protected function do_item( $id ) { $post_data['ID'] = 0; $roundTwo = true; } - + $post_data = $this->map_gc_data_to_wp_data( $post_data ); if ( ! empty( $post_data['attachments'] ) ) { @@ -147,13 +147,13 @@ protected function do_item( $id ) { $tax_terms = $post_data['tax_input']; unset( $post_data['tax_input'] ); } - + $post_id = wp_insert_post( $post_data, 1 ); if ( is_wp_error( $post_id ) ) { throw new Exception( $post_id->get_error_message(), __LINE__, $post_id->get_error_data() ); } - + $post_data['ID'] = $post_id; // Store item ID reference to post-meta. @@ -224,7 +224,7 @@ function ( $meta ) { // Update the GC item status. $this->api->set_item_status( $id, $status ); } - + // Call methods the second time to get post working for the acf fields. // Componentes are attached to posts, meaning we need the post ID to attach the component. // When we first create a post (not exisiting), we set the ID = 0 before we later create the wp_post and then update the post_ID @@ -270,7 +270,7 @@ protected function map_gc_data_to_wp_data( $post_data = array() ) { if ( $this->should_map_hierarchy( $post_data['post_type'] ) && isset( $this->item->position ) ) { $post_data['menu_order'] = absint( $this->item->position ); } - + $post_data = $this->loop_item_elements_and_map( $post_data ); // Put the backup data back. @@ -283,7 +283,7 @@ protected function map_gc_data_to_wp_data( $post_data = array() ) { if ( $this->should_update_title_with_item_name( $post_data ) ) { $post_data['post_title'] = sanitize_text_field( $this->item->name ); } - + if ( ! empty( $post_data['ID'] ) ) { $post_data = apply_filters( 'gc_update_wp_post_data', $post_data, $this ); } else { @@ -377,9 +377,9 @@ protected function loop_item_elements_and_map( $post_data ) { $metadata = $field->metadata; $is_component_repeatable = ( is_object( $metadata ) && isset( $metadata->repeatable ) ) ? $metadata->repeatable->isRepeatable : false; } - + $componentProcessed = false; // Initialize flag outside the loop - + foreach ($fields_data as $field_data) { $this->element = (object) $this->format_element_data($field_data, $component_uuid, true, $is_component_repeatable); $uuid = $this->element->name; @@ -586,14 +586,14 @@ protected function set_media_field_value( $destination, $post_data ) { * * @return array $post_data The modified WP Post data array. */ - + protected function set_acf_field_value( $post_data ) { // We are not sure of the incoming post_ID so let's get the current post ID $post_id = $post_data['ID']; // Initialize an array to store updated post data $updated_post_data = $post_data; - + // Loop through the mapping data array foreach ($this->mapping->data as $key => $value) { // When it is a component, the key sandwiches '_component_' so let's get the key itself @@ -601,13 +601,13 @@ protected function set_acf_field_value( $post_data ) { // Check if the item has type wp-type-acf. We are assuming some items managed to skip the case check in the set_post_values function so we double check here. if (isset($value['type']) && $value['type'] === 'wp-type-acf') { - + // Fetch the corresponding value from $this->item->content $field_value = isset($this->item->content->{$content_key}) ? $this->item->content->{$content_key} : ''; - + // Check if item has subfields. If it has then it is a component from GC if (isset($value['sub_fields'])) { - + // Prepare the subfield data $subfield_keys = array(); foreach ($value['sub_fields'] as $sub_field_key) { @@ -622,7 +622,7 @@ protected function set_acf_field_value( $post_data ) { $row_index = 0; foreach ($field_value as $subfield){ - + $row_index ++; if (!is_object($subfield)) { // When components are not set to be repeatable in GC we may end up getting non objects subfields. @@ -644,7 +644,7 @@ protected function set_acf_field_value( $post_data ) { // Convert object to associative array $component_row_data = json_decode(json_encode($component_row_data), true); add_row($value['field'], $component_row_data, $post_id); - + $subfield_key_id = -1; foreach ($subfield as $key => $subsubfield){ @@ -653,7 +653,7 @@ protected function set_acf_field_value( $post_data ) { $item = get_field_object($item_key); if (is_array($subsubfield)){ - + if ($item['parent']){ $parent_key = $item['parent']; } @@ -671,22 +671,22 @@ protected function set_acf_field_value( $post_data ) { $checkbox_labels[] = $checkbox->label; } } - + foreach ($subsubfield as $subsubfield_field){ - + if ($item['type'] == 'image'){ $upload_dir = wp_upload_dir(); $image_url = $subsubfield_field->url; $image_data = file_get_contents( $image_url ); $filename = $subsubfield_field->filename; - + // Check if the attachment already exists global $wpdb; $existing_attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' AND post_title = %s", sanitize_file_name( $filename ) ) ); - + if ( $existing_attachment_id ) { // If the attachment already exists, use its ID $attach_id = $existing_attachment_id; @@ -696,39 +696,39 @@ protected function set_acf_field_value( $post_data ) { } else { $file = $upload_dir['basedir'] . '/' . $filename; } - + file_put_contents( $file, $image_data ); - + $wp_filetype = wp_check_filetype( $filename, null ); - + $attachment = array( 'post_mime_type' => $wp_filetype['type'], 'post_title' => sanitize_file_name( $filename ), 'post_content' => '', 'post_status' => 'inherit' ); - + $attach_id = wp_insert_attachment( $attachment, $file ); require_once( ABSPATH . 'wp-admin/includes/image.php' ); - + // Check if the attachment insertion was successful if (!is_wp_error($attach_id)) { // Generate attachment metadata $attach_data = wp_generate_attachment_metadata($attach_id, $file); - + // Update attachment metadata wp_update_attachment_metadata($attach_id, $attach_data); - + } else { // Log an error or handle the case where attachment insertion fails } } - + update_row($parent_key, $row_index, [$item_key => $attach_id],$post_id); // Break out of the loop after processing the first image break; } - + if ($item['type'] === 'repeater'){ foreach ($children as $child_key){ @@ -737,7 +737,7 @@ protected function set_acf_field_value( $post_data ) { } } - if ($item['type'] === 'checkbox'){ + if ($item['type'] === 'checkbox'){ update_row($parent_key, $row_index, [$item_key => $checkbox_labels],$post_id); } @@ -749,11 +749,11 @@ protected function set_acf_field_value( $post_data ) { } } } - + } $updated_post_data = $this->maybe_append($value['field'], $field_value, $updated_post_data); - + }else { // If it's not a component, update the single ACF field normally $field_data = array(); @@ -766,12 +766,12 @@ protected function set_acf_field_value( $post_data ) { } array_push($fields_data, $field_data); } - + $field_key = $value['field']; - + // Get information about the field $field = get_field_object($field_key); - + // Let's hope the field exists and is really not a component if ($field) { if (!empty($field['sub_fields'])) { @@ -785,16 +785,16 @@ protected function set_acf_field_value( $post_data ) { } else { // Field does not exist. We will decide what to do in that case later. } - - // This part can get more interesting if someone setup ACF fields of different structure than the structure in GC and maps them. + + // This part can get more interesting if someone setup ACF fields of different structure than the structure in GC and maps them. // This might be a secondary case to look at, so we are keeping things in arrays so we can later just improve on it to handle those wild cases. - + $key_value_mapping = []; foreach ($fields_data[0] as $value) { // Assign each value to a sub-array with the key from subsubfield_keys $key_value_mapping[] = [$subsubfield_keys[0] => $value]; } - + foreach ($key_value_mapping as $key_value){ add_row($field_key, $key_value, $post_id); } @@ -802,18 +802,18 @@ protected function set_acf_field_value( $post_data ) { // lets do updated_post_data in a way that will work $updated_post_data = $this->maybe_append($field_key, $key_value_mapping, $updated_post_data); - + } } } $updated_post_data['ID'] = $post_id; - + return $updated_post_data; } - + /** * If field can append, then append the data, else set the data directly. * @@ -860,14 +860,14 @@ protected function sanitize_post_field( $field, $value, $post_data ) { switch ( $field ) { case 'ID': - throw new Exception( __( 'Cannot override post IDs', 'gathercontent-import' ), __LINE__ ); + throw new Exception( __( 'Cannot override post IDs', 'content-workflow' ), __LINE__ ); case 'post_date': case 'post_date_gmt': case 'post_modified': case 'post_modified_gmt': if ( ! is_string( $value ) && ! is_numeric( $value ) ) { - throw new Exception( sprintf( __( '%s field requires a numeric timestamp, or date string.', 'gathercontent-import' ), $field ), __LINE__ ); + throw new Exception( sprintf( __( '%s field requires a numeric timestamp, or date string.', 'content-workflow' ), $field ), __LINE__ ); } $value = is_numeric( $value ) ? $value : strtotime( $value ); @@ -877,7 +877,7 @@ protected function sanitize_post_field( $field, $value, $post_data ) { : date( 'Y-m-d H:i:s', $value ); case 'post_format': if ( isset( $post_data['post_type'] ) && ! post_type_supports( $post_data['post_type'], 'post-formats' ) ) { - throw new Exception( sprintf( __( 'The %s post-type does not support post-formats.', 'gathercontent-import' ), $post_data['post_type'] ), __LINE__ ); + throw new Exception( sprintf( __( 'The %s post-type does not support post-formats.', 'content-workflow' ), $post_data['post_type'] ), __LINE__ ); } case 'post_title': $value = strip_tags( $value, '' ); 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 @@

- HTTP authentication for this site.', 'gathercontent-import' ); ?> + HTTP authentication for this site.', 'content-workflow' ); ?>
- +

- +

diff --git a/includes/views/existing-mapping-notice.php b/includes/views/existing-mapping-notice.php index 34431b82..0044736e 100644 --- a/includes/views/existing-mapping-notice.php +++ b/includes/views/existing-mapping-notice.php @@ -1,3 +1,3 @@
-

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' ) ); ?>

diff --git a/includes/views/gc-items-list.php b/includes/views/gc-items-list.php index 38640e5b..a480f678 100644 --- a/includes/views/gc-items-list.php +++ b/includes/views/gc-items-list.php @@ -1,4 +1,4 @@ - +