Skip to content

Commit

Permalink
Merge pull request #4 from Bynder/naming/GC-4765
Browse files Browse the repository at this point in the history
[GC-4765] Tidy repository ready for submission
  • Loading branch information
CWDN authored May 16, 2024
2 parents 8fd10b3 + a35c77c commit 8aa54ee
Show file tree
Hide file tree
Showing 43 changed files with 339 additions and 344 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
9 changes: 4 additions & 5 deletions gathercontent-importer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
/**
* Plugin Name: Content Workflow (by Bynder) Plugin
* Plugin URI: https://www.bynder.com/products/content-workflow/
* Plugin Name: Content Workflow (by Bynder)
* Description: Imports items from Content Workflow to your Wordpress site
* Version: 1.0.0
* Author: Content Workflow (by Bynder)
Expand Down Expand Up @@ -33,7 +32,7 @@
// Useful global constants
define( 'GATHERCONTENT_VERSION', '1.0.0' );
define( 'GATHERCONTENT_ENQUEUE_VERSION', '1.0.0' );
define( 'GATHERCONTENT_SLUG', 'gathercontent-import' );
define( 'GATHERCONTENT_SLUG', 'content-workflow' );
define( 'GATHERCONTENT_PLUGIN', __FILE__ );
define( 'GATHERCONTENT_URL', plugin_dir_url( __FILE__ ) );
define( 'GATHERCONTENT_PATH', dirname( __FILE__ ) . '/' );
Expand Down Expand Up @@ -66,7 +65,7 @@
function gathercontent_importer_php_version_too_low_notice() {
printf(
'<div id="message" class="error"><p>%s</p></div>',
__( '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: <a href="https://wordpress.org/about/requirements/">https://wordpress.org/about/requirements/</a>', '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: <a href="https://wordpress.org/about/requirements/">https://wordpress.org/about/requirements/</a>', 'content-workflow' )
);
}

Expand All @@ -80,7 +79,7 @@ function gathercontent_importer_php_version_too_low_notice() {
function gathercontent_importer_wp_version_too_low_notice() {
printf(
'<div id="message" class="error"><p>%s</p></div>',
__( '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' )
);
}

Expand Down
36 changes: 18 additions & 18 deletions includes/classes/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 .= '</p><p>' . sprintf( esc_html__( 'The error received: %s', 'gathercontent-import' ), $response->get_error_message() );
$message .= '</p><p>' . 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' );
Expand All @@ -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' );
}
Expand Down Expand Up @@ -185,7 +185,7 @@ public function admin_menu() {
*/
public function settings_link( $links ) {

$links[] = sprintf( '<a href="%s">%s</a>', $this->url, __( 'Settings', 'gathercontent-import' ) );
$links[] = sprintf( '<a href="%s">%s</a>', $this->url, __( 'Settings', 'content-workflow' ) );

return $links;
}
Expand Down Expand Up @@ -230,60 +230,60 @@ 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' )
);
}
}

public function api_setup_settings_cb() {
if ( $key = $this->should_migrate() ) {
echo '<p><strong>' . esc_html__( 'NOTE:', 'gathercontent-import' ) . '</strong> ' . sprintf( __( 'It looks like you are migrating from a previous version of the GatherContent plugin.<br>You will need to set up new GatherContent API credentials to continue. Instructions for getting your API key can be found <a href="%s" target="_blank">here</a>.', 'gathercontent-import' ), 'https://gathercontent.com/developers/authentication/' ) . '</p>';
echo '<p><strong>' . esc_html__( 'NOTE:', 'content-workflow' ) . '</strong> ' . sprintf( __( 'It looks like you are migrating from a previous version of the GatherContent plugin.<br>You will need to set up new GatherContent API credentials to continue. Instructions for getting your API key can be found <a href="%s" target="_blank">here</a>.', 'content-workflow' ), 'https://gathercontent.com/developers/authentication/' ) . '</p>';

if ( $slug = get_option( $key . '_api_url' ) ) {
$this->settings()->options['platform_url_slug'] = $slug;
}
} else {
echo '<p>' . sprintf( __( 'Enter your Content Workflow API credentials. Instructions for getting your API key can be found <a href="%s" target="_blank">here</a>.', 'gathercontent-import' ), 'https://gathercontent.com/developers/authentication/' ) . '</p>';
echo '<p>' . sprintf( __( 'Enter your Content Workflow API credentials. Instructions for getting your API key can be found <a href="%s" target="_blank">here</a>.', 'content-workflow' ), 'https://gathercontent.com/developers/authentication/' ) . '</p>';
}
}

Expand Down Expand Up @@ -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' => '<a href="https://gathercontent.com/developers/authentication/" target="_blank">' . __( 'How to get your API key', 'gathercontent-import' ) . '</a>',
'desc' => '<a href="https://gathercontent.com/developers/authentication/" target="_blank">' . __( 'How to get your API key', 'content-workflow' ) . '</a>',
)
);

Expand Down Expand Up @@ -401,15 +401,15 @@ 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']
: 'https://app.gathercontent.com/assets/img/avatar.png';

if ( $this->set_my_account() ) {

$data['message'] .= ' ' . sprintf( esc_html__( 'and the %s account.', 'gathercontent-import' ), '<a href="' . esc_url( $this->platform_url() ) . '" target="_blank">' . esc_html( $this->account->name ) . '</a>' );
$data['message'] .= ' ' . sprintf( esc_html__( 'and the %s account.', 'content-workflow' ), '<a href="' . esc_url( $this->platform_url() ) . '" target="_blank">' . esc_html( $this->account->name ) . '</a>' );
}

$this->view( 'user-profile', $data );
Expand Down Expand Up @@ -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
);
Expand Down
4 changes: 2 additions & 2 deletions includes/classes/admin/ajax/sync-bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__
)
);
Expand Down Expand Up @@ -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
)
Expand Down
12 changes: 6 additions & 6 deletions includes/classes/admin/ajax/sync-items.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__
)
);
Expand All @@ -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 ),
)
);
Expand All @@ -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__
)
);
Expand All @@ -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' ) )
)
Expand Down Expand Up @@ -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__
)
);
Expand All @@ -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__
)
);
Expand Down
14 changes: 7 additions & 7 deletions includes/classes/admin/bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 8aa54ee

Please sign in to comment.