Skip to content

Commit

Permalink
🚚 Renamed the rest of the filters with gc to cwby
Browse files Browse the repository at this point in the history
  • Loading branch information
CWDN committed Jul 22, 2024
1 parent da9863e commit 63b135e
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 83 deletions.
12 changes: 6 additions & 6 deletions gathercontent-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
if ( version_compare( phpversion(), '7.0', '<' ) ) {

// Womp womp.. PHP needs to be updated!
add_action( 'all_admin_notices', 'gathercontent_importer_php_version_too_low_notice' );
add_action( 'all_admin_notices', 'cwby_importer_php_version_too_low_notice' );

} elseif ( version_compare( $GLOBALS['wp_version'], '5.8.2', '<' ) ) {

// Sad Trombone.. WordPress needs to be updated!
add_action( 'all_admin_notices', 'gathercontent_importer_wp_version_too_low_notice' );
add_action( 'all_admin_notices', 'cwby_importer_wp_version_too_low_notice' );
} else {

// Include files
Expand All @@ -62,7 +62,7 @@
* @since 3.0.0
*
*/
function gathercontent_importer_php_version_too_low_notice() {
function cwby_importer_php_version_too_low_notice() {
$message = esc_html__( 'Sorry, the Content Workflow plugin requires a minimum PHP version of 5.3. Please contact your host and ask them to upgrade. For convenience, you can use the note provided on the WordPress recommended host supports page: ', 'content-workflow-by-bynder' );

echo '<div id="message" class="error">
Expand All @@ -81,7 +81,7 @@ function gathercontent_importer_php_version_too_low_notice() {
* @since 3.0.0
*
*/
function gathercontent_importer_wp_version_too_low_notice() {
function cwby_importer_wp_version_too_low_notice() {
printf(
'<div id="message" class="error"><p>%s</p></div>',
esc_html__( 'Sorry, for security and performance reasons, the Content Workflow plugin requires a minimum WordPress version of 4.4. Please update WordPress to the most recent version.', 'content-workflow-by-bynder' )
Expand All @@ -101,11 +101,11 @@ function gathercontent_importer_wp_version_too_low_notice() {
* @since 3.0.0
*
*/
function gathercontent_importer_i18n() {
function cwby_importer_i18n() {
$text_domain = GATHERCONTENT_SLUG;
$locale = apply_filters( 'plugin_locale', get_locale(), $text_domain );
load_textdomain( $text_domain, WP_LANG_DIR . "/{$text_domain}/{$text_domain}-{$locale}.mo" );
load_plugin_textdomain( $text_domain, false, plugin_basename( GATHERCONTENT_PATH ) . '/languages/' );
}

add_action( 'init', 'gathercontent_importer_i18n' );
add_action( 'init', 'cwby_importer_i18n' );
2 changes: 1 addition & 1 deletion includes/classes/admin/ajax/handlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function cwby_get_posts_cb() {
);
}

wp_send_json_success( apply_filters( 'gc_prepare_js_update_data_for_posts', $post_updates ) );
wp_send_json_success( apply_filters( 'cwby_prepare_js_update_data_for_posts', $post_updates ) );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions includes/classes/admin/enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function admin_enqueue_script() {

do_action( 'cwby_admin_enqueue_script' );

// Localize in footer so that 'gathercontent_localized_data' filter is more useful.
// Localize in footer so that 'cwby_localized_data' filter is more useful.
add_action( 'admin_footer', array( $this, 'script_localize' ), 1 );
}

Expand All @@ -91,12 +91,12 @@ public function script_localize() {
*/
$queryArgs = $this->_get_vals( [ 'flush_cache', 'mapping' ] );

wp_localize_script( 'gathercontent', 'GatherContent', apply_filters( 'gathercontent_localized_data', array(
wp_localize_script( 'gathercontent', 'GatherContent', apply_filters( 'cwby_localized_data', array(
'debug' => Utils::script_debug(),
// @codingStandardsIgnoreStart
'queryargs' => $queryArgs,
// @codingStandardsIgnoreEnd
'_type_names' => Utils::gc_field_type_name( 'all' ),
'_type_names' => Utils::cwby_field_type_name( 'all' ),
) ) );
}
}
2 changes: 1 addition & 1 deletion includes/classes/admin/mapping-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Mapping_Wizard extends Base {

const SLUG = 'gathercontent-import-add-new-template';
const SLUG = 'cwby-import-add-new-template';
const ACCOUNT = 0;
const PROJECT = 1;
const TEMPLATE = 2;
Expand Down
10 changes: 5 additions & 5 deletions includes/classes/admin/mapping/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function ui() {
// Hook in the underscores templates.
add_action( 'admin_footer', array( $this, 'footer_mapping_js_templates' ) );

add_filter( 'gathercontent_localized_data', array( $this, 'localize_data' ) );
add_filter( 'cwby_localized_data', array( $this, 'localize_data' ) );

$script_id = $this->script_id();

Expand Down Expand Up @@ -240,7 +240,7 @@ protected function post_options() {
protected function custom_field_keys() {
global $wpdb;

$meta_keys = get_transient( 'gathercontent_importer_custom_field_keys' );
$meta_keys = get_transient( 'cwby_importer_custom_field_keys' );

if ( ! $meta_keys || $this->_get_val( 'delete-trans' ) ) {
// Retrieve custom field keys to include in the Custom Fields weight table select.
Expand All @@ -253,11 +253,11 @@ protected function custom_field_keys() {
"
);

set_transient( 'gathercontent_importer_custom_field_keys', $meta_keys, DAY_IN_SECONDS );
set_transient( 'cwby_importer_custom_field_keys', $meta_keys, DAY_IN_SECONDS );
}

// Allow devs to filter this list.
$meta_keys = array_unique( apply_filters( 'gathercontent_importer_custom_field_keys', $meta_keys ) );
$meta_keys = array_unique( apply_filters( 'cwby_importer_custom_field_keys', $meta_keys ) );

// Sort the keys alphabetically.
if ( $meta_keys ) {
Expand All @@ -272,7 +272,7 @@ protected function custom_field_keys() {
* @var array
*/
$meta_keys_blacklist = apply_filters(
'gathercontent_importer_custom_field_keys_blacklist',
'cwby_importer_custom_field_keys_blacklist',
array(
'_wp_attachment_image_alt' => 1,
'_wp_attachment_metadata' => 1,
Expand Down
6 changes: 3 additions & 3 deletions includes/classes/admin/mapping/field-types/types.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ public function __construct( array $core_types ) {
* @since 3.0.0
*/
public function register() {
$field_types = apply_filters( 'gathercontent_register_field_types_handlers', $this->core_types );
$field_types = apply_filters( 'cwby_register_field_types_handlers', $this->core_types );

foreach ( $field_types as $type ) {
if ( ! ( $type instanceof Type ) ) {
throw new Exception( 'Field type handler needs to be of type GatherContent\\Importer\\Admin\\Mapping\Field_Types\\Type' );
}

$this->field_types[ $type->type_id() ] = $type;
add_action( 'gathercontent_field_type_option_underscore_template', array(
add_action( 'cwby_field_type_option_underscore_template', array(
$type,
'option_underscore_template'
) );
add_action( 'gathercontent_field_type_underscore_template', array( $type, 'underscore_template' ) );
add_action( 'cwby_field_type_underscore_template', array( $type, 'underscore_template' ) );
}

return $this;
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/admin/mapping/field-types/wpseo.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct( array $post_types ) {
$this->seo_options = $this->get_seo_options();
$this->option_label = __( 'SEO', 'content-workflow-by-bynder' );

add_filter( 'gathercontent_importer_custom_field_keys_blacklist', array( $this, 'remove_wpseo_keys' ) );
add_filter( 'cwby_importer_custom_field_keys_blacklist', array( $this, 'remove_wpseo_keys' ) );
}

protected function get_seo_options() {
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/admin/mapping/template-mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ private function format_fields( $field, $post_type, string $component_name = '',
$field->type = $field_type === 'attachment' ? 'files' : $field_type;
}

$field->typeName = Utils::gc_field_type_name( $field_type );
$field->typeName = Utils::cwby_field_type_name( $field_type );

if ( $val = $this->get_value( $field->uuid ) ) {
$field->field_type = isset( $val['type'] ) ? $val['type'] : '';
Expand Down
4 changes: 2 additions & 2 deletions includes/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public function get( $endpoint, $args = array(), $response_type = '', $query_par
*/
public function cache_get( $endpoint, $expiration = HOUR_IN_SECONDS, $args = array(), $method = 'get', $query_params = array() ) {

$trans_key = 'gctr-' . md5( serialize( compact( 'endpoint', 'args', 'method', 'query_params' ) ) );
$trans_key = 'cwbytr-' . md5( serialize( compact( 'endpoint', 'args', 'method', 'query_params' ) ) );
$response = get_transient( $trans_key );

if ( $this->only_cached ) {
Expand Down Expand Up @@ -698,7 +698,7 @@ public function request( $endpoint, $args = array(), $method = 'GET', $query_par
try {
$args = $this->request_args( $args );
} catch ( \Exception $e ) {
return new WP_Error( 'gc_api_setup_fail', $e->getMessage() );
return new WP_Error( 'cwby_api_setup_fail', $e->getMessage() );
}

if ( Debug::debug_mode() ) {
Expand Down
8 changes: 4 additions & 4 deletions includes/classes/debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ public function do_debug_options_actions( $settings ) {

} elseif ( $settings['delete_gc_log_file'] ) {

return $this->delete_gc_log_file( $back_button );
return $this->delete_cwby_log_file( $back_button );

} elseif ( $settings['view_gc_log_file'] ) {

return $this->view_gc_log_file( $back_button );
return $this->view_cwby_log_file( $back_button );

} elseif ( $settings['disable_debug_mode'] ) {

Expand Down Expand Up @@ -332,7 +332,7 @@ public function handle_stuck_statuses( $settings, $back_button ) {
* @since 3.0.1
*
*/
public function delete_gc_log_file( $back_button ) {
public function delete_cwby_log_file( $back_button ) {
if ( wp_delete_file( self::$log_path ) ) {
wp_die( esc_html__( 'Content Workflow log file deleted.', 'content-workflow-by-bynder' ) . wp_kses_post( $back_button ), esc_html__( 'Debug Mode', 'content-workflow-by-bynder' ) );
}
Expand All @@ -349,7 +349,7 @@ public function delete_gc_log_file( $back_button ) {
* @since 3.0.1
*
*/
public function view_gc_log_file( $back_button ) {
public function view_cwby_log_file( $back_button ) {
$log_contents = file_exists( self::$log_path ) ? wp_remote_get( self::$log_path ) : '';

if ( ! $log_contents ) {
Expand Down
10 changes: 5 additions & 5 deletions includes/classes/post-types/template-mappings.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function modify_mapping_post_edit_link( $link, $post ) {
if ( $project_id && $template_id ) {
$link = admin_url(
sprintf(
'admin.php?page=gathercontent-import-add-new-template&project=%s&template=%s&mapping=%s',
'admin.php?page=cwby-import-add-new-template&project=%s&template=%s&mapping=%s',
$project_id,
$template_id,
$post_id
Expand Down Expand Up @@ -433,9 +433,9 @@ function ( $opt ) {
public function trigger_pre_actions( $ignore, $post_data ) {
if ( self::SLUG === $post_data['post_type'] ) {
if ( ! empty( $post_data['ID'] ) ) {
do_action( 'gc_mapping_pre_post_update', $post_data );
do_action( 'cwby_mapping_pre_post_update', $post_data );
} else {
do_action( 'gc_mapping_pre_post_create', $post_data );
do_action( 'cwby_mapping_pre_post_create', $post_data );
}

add_action( 'save_post_' . self::SLUG, array( __CLASS__, 'store_post_type_references' ), 10, 3 );
Expand Down Expand Up @@ -587,7 +587,7 @@ public function get_account_projects_with_mappings( $account_id, $mapping_ids =
}

if ( empty( $projects ) ) {
new WP_Error( 'gc_no_projects', esc_html__( 'No projects were found for this account.', 'content-workflow-by-bynder' ) );
new WP_Error( 'cwby_no_projects', esc_html__( 'No projects were found for this account.', 'content-workflow-by-bynder' ) );
}

$all_projects = array();
Expand Down Expand Up @@ -626,7 +626,7 @@ public function get_accounts_with_mappings() {
}

if ( empty( $accounts ) ) {
new WP_Error( 'gc_no_accounts', esc_html__( 'No accounts were found.', 'content-workflow-by-bynder' ) );
new WP_Error( 'cwby_no_accounts', esc_html__( 'No accounts were found.', 'content-workflow-by-bynder' ) );
}

$all_accounts = array();
Expand Down
6 changes: 2 additions & 4 deletions includes/classes/settings/form-section.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct( $id, $title, $callback, $page, $is_current = false
$this->page = $page;

$section = compact( 'id', 'title', 'callback', 'is_current' );
$section = apply_filters( "gathercontent_importer_section_{$id}", $section, $this );
$section = apply_filters( "cwby_importer_section_{$id}", $section, $this );

$this->id = $section['id'];
$this->title = $section['title'];
Expand Down Expand Up @@ -101,7 +101,7 @@ public function add_field( $id, $title, $callback, $args = array() ) {
);

$field = compact( 'id', 'title', 'callback', 'args' );
$field = apply_filters( "gathercontent_importer_field_{$this->id}_{$id}", $field, $this );
$field = apply_filters( "cwby_importer_field_{$this->id}_{$id}", $field, $this );
$this->fields[ $field['id'] ] = $field;

}
Expand All @@ -121,5 +121,3 @@ public static function get_sections( $page ) {
}

}


4 changes: 2 additions & 2 deletions includes/classes/sync/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ protected function check_mapping_data() {
protected function get_element_value() {
$val = $this->get_value_for_element( $this->element );

return apply_filters( 'gc_get_element_value', $val, $this->element, $this->item );
return apply_filters( 'cwby_get_element_value', $val, $this->element, $this->item );
}

/**
Expand Down Expand Up @@ -604,7 +604,7 @@ protected function format_selected_options_data( $metadata, $field_value ): arra
protected function type_can_append( $field ) {
$can_append = in_array( $field, $this->append_types, true );

return apply_filters( "gc_can_append_{$field}", $can_append, $this->element, $this->item );
return apply_filters( "cwby_can_append_{$field}", $can_append, $this->element, $this->item );
}

/**
Expand Down
Loading

0 comments on commit 63b135e

Please sign in to comment.