diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5a48b92..b25d71b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -40,7 +40,7 @@ jobs: - name: Zip the plugin run: | - zip -r sm-post-connector-package.zip . -x "*.git*" -x "*.github*" -x "*.yml" -x "phpunit.xml" -x "tests/**" -x "docs/**" + zip -r blog-post-connector-package.zip . -x "*.git*" -x "*.github*" -x "*.yml" -x "phpunit.xml" -x "tests/**" -x "docs/**" - name: Create Release id: create_release @@ -50,7 +50,7 @@ jobs: with: tag_name: ${{ env.VERSION }} # Use the validated version tag release_name: SM Plugin ${{ env.VERSION }} - body: "Release of SM Post Connector plugin version ${{ env.VERSION }}." + body: "Release of Blog Post Connector plugin version ${{ env.VERSION }}." draft: false prerelease: false @@ -60,6 +60,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./sm-post-connector-package.zip - asset_name: sm-post-connector-package.zip + asset_path: ./blog-post-connector-package.zip + asset_name: blog-post-connector-package.zip asset_content_type: application/zip \ No newline at end of file diff --git a/sm-post-connector.php b/blog-post-connector.php similarity index 77% rename from sm-post-connector.php rename to blog-post-connector.php index d632388..d62f8e5 100644 --- a/sm-post-connector.php +++ b/blog-post-connector.php @@ -1,10 +1,10 @@
-

+

- +
handle_generate_token_request(); ?> @@ -222,7 +222,7 @@ public function render_post_type_field() { * Renders the field for selecting the default author. */ public function render_author_field() { - $authors = get_users(['who' => 'authors']); + $authors = get_users( ['capability' => 'edit_posts'] ); $default_author = get_option('sm_post_connector_default_author', ''); ?> @@ -261,7 +261,7 @@ public function render_logo_field() { $logo = get_option('sm_post_connector_logo'); // Retrieve the logo option ?> - +
@@ -280,9 +280,9 @@ public function render_logo_field() { } mediaUploader = wp.media.frames.file_frame = wp.media({ - title: '', + title: '', button: { - text: '' + text: '' }, multiple: false }); diff --git a/includes/Endpoints/CreatePost.php b/includes/Endpoints/CreatePost.php index e11ecb7..e291da9 100644 --- a/includes/Endpoints/CreatePost.php +++ b/includes/Endpoints/CreatePost.php @@ -1,15 +1,15 @@ __('Status information retrieved successfully', 'sm-post-connector'), - 'post_created' => __('Post created successfully', 'sm-post-connector'), - 'post_updated' => __('Post updated successfully', 'sm-post-connector'), - 'post_deleted' => __('Post deleted successfully', 'sm-post-connector'), - 'categories_retrieved' => __('Categories retrieved successfully', 'sm-post-connector'), - 'tags_retrieved' => __('Tags retrieved successfully', 'sm-post-connector'), - 'authors_retrieved' => __('Authors retrieved successfully', 'sm-post-connector'), - 'invalid_author_id' => __('Invalid author ID', 'sm-post-connector'), - 'post_id_required' => __('Post ID is required', 'sm-post-connector'), - 'post_not_found' => __('Post not found', 'sm-post-connector'), - 'post_moved_to_trash' => __('Post moved to trash successfully', 'sm-post-connector'), - 'post_permanently_deleted' => __('Post permanently deleted successfully', 'sm-post-connector'), - 'failed_to_delete_post' => __('Failed to delete post', 'sm-post-connector'), - 'missing_required_parameters' => __('Missing required parameters', 'sm-post-connector'), - 'invalid_post_status' => __('Invalid post status', 'sm-post-connector'), - 'date_required_for_future_posts' => __('Date is required for future posts', 'sm-post-connector'), - 'date_for_publish_status_must_be_past' => __('Date for publish status must be in the past', 'sm-post-connector'), - 'post_with_title_exists' => __('A post with the same title already exists', 'sm-post-connector'), - 'post_updated_successfully' => __('Post updated successfully', 'sm-post-connector'), - 'post_created_successfully' => __('Post created successfully', 'sm-post-connector'), - 'failed_to_update_post' => __('Failed to update post', 'sm-post-connector'), - 'failed_to_create_post' => __('Failed to create post', 'sm-post-connector'), - 'error' => __('An error occurred', 'sm-post-connector') + 'status_retrieved' => __('Status information retrieved successfully', 'blog-post-connector'), + 'post_created' => __('Post created successfully', 'blog-post-connector'), + 'post_updated' => __('Post updated successfully', 'blog-post-connector'), + 'post_deleted' => __('Post deleted successfully', 'blog-post-connector'), + 'categories_retrieved' => __('Categories retrieved successfully', 'blog-post-connector'), + 'tags_retrieved' => __('Tags retrieved successfully', 'blog-post-connector'), + 'authors_retrieved' => __('Authors retrieved successfully', 'blog-post-connector'), + 'invalid_author_id' => __('Invalid author ID', 'blog-post-connector'), + 'post_id_required' => __('Post ID is required', 'blog-post-connector'), + 'post_not_found' => __('Post not found', 'blog-post-connector'), + 'post_moved_to_trash' => __('Post moved to trash successfully', 'blog-post-connector'), + 'post_permanently_deleted' => __('Post permanently deleted successfully', 'blog-post-connector'), + 'failed_to_delete_post' => __('Failed to delete post', 'blog-post-connector'), + 'missing_required_parameters' => __('Missing required parameters', 'blog-post-connector'), + 'invalid_post_status' => __('Invalid post status', 'blog-post-connector'), + 'date_required_for_future_posts' => __('Date is required for future posts', 'blog-post-connector'), + 'date_for_publish_status_must_be_past' => __('Date for publish status must be in the past', 'blog-post-connector'), + 'post_with_title_exists' => __('A post with the same title already exists', 'blog-post-connector'), + 'post_updated_successfully' => __('Post updated successfully', 'blog-post-connector'), + 'post_created_successfully' => __('Post created successfully', 'blog-post-connector'), + 'failed_to_update_post' => __('Failed to update post', 'blog-post-connector'), + 'failed_to_create_post' => __('Failed to create post', 'blog-post-connector'), + 'error' => __('An error occurred', 'blog-post-connector') ]; - return $messages[$key] ?? __( $key , 'sm-post-connector'); + return $messages[$key] ?? __( $key , 'blog-post-connector'); } /** diff --git a/includes/Helper/Response.php b/includes/Helper/Response.php index f86adc1..7270da4 100644 --- a/includes/Helper/Response.php +++ b/includes/Helper/Response.php @@ -1,9 +1,9 @@ 403)); + return new WP_Error('rest_forbidden', __('Authorization header not found or malformed.', 'blog-post-connector'), array('status' => 403)); } // Extract the token from the 'Authorization' header @@ -44,7 +44,7 @@ public function permissions_check(WP_REST_Request $request) { // Validate the token if (empty($saved_token) || !hash_equals($saved_token, $token)) { - return new WP_Error('rest_forbidden', __('Invalid token.', 'sm-post-connector'), array('status' => 403)); + return new WP_Error('rest_forbidden', __('Invalid token.', 'blog-post-connector'), array('status' => 403)); } // If the token is valid, grant permission diff --git a/includes/Updater/Update.php b/includes/Updater/Update.php index 8d59471..fdc13d4 100644 --- a/includes/Updater/Update.php +++ b/includes/Updater/Update.php @@ -1,8 +1,8 @@ - + ./tests/includes tests/phpunit/multisite diff --git a/readme.md b/readme.md index 184e055..76882fc 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,6 @@ -# SM Post Connector Plugin +# Blog Post Connector Plugin -The SM Post Connector plugin bridges the gap between WordPress and Social Marketing tools, enabling users to manage blog posts directly from their Social Marketing platform. +The Blog Post Connector plugin bridges the gap between WordPress and Social Marketing tools, enabling users to manage blog posts directly from their Social Marketing platform. ## Features @@ -11,7 +11,7 @@ The SM Post Connector plugin bridges the gap between WordPress and Social Market ## Usage 1. **Configure Settings**: - - Navigate to WordPress Admin Panel › SM Post Connector › Settings. + - Navigate to WordPress Admin Panel › Blog Post Connector › Settings. - Set up your access token and default settings for post type, author, and category. 2. **API Endpoints**: diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e8a1e0c..dd2dc81 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -7,7 +7,7 @@ WP_Mock::setUsePatchwork( true ); WP_Mock::bootstrap(); -define( 'SM_PLUGIN_BASENAME', basename( __DIR__ . '/../sm-post-connector.php' ) ); +define( 'SM_PLUGIN_BASENAME', basename( __DIR__ . '/../blog-post-connector.php' ) ); if ( defined( 'WP_TESTS_MULTISITE' ) ) { // Tells the plugin it is network active. @@ -20,4 +20,4 @@ * Now we include any plugin files that we need to be able to run the tests. This * should be files that define the functions and classes you're going to test. */ -require_once __DIR__ . '/../sm-post-connector.php'; \ No newline at end of file +require_once __DIR__ . '/../blog-post-connector.php'; \ No newline at end of file diff --git a/tests/includes/Auth/TokenTest.php b/tests/includes/Auth/TokenTest.php index ed4b3ad..dab64c6 100644 --- a/tests/includes/Auth/TokenTest.php +++ b/tests/includes/Auth/TokenTest.php @@ -1,8 +1,8 @@