Skip to content

Commit

Permalink
release: fixes
Browse files Browse the repository at this point in the history
### Fixes
- Clarified helper text in the taxonomy field
- Updated support dashboard page with new features
- Enhanced security
- Updated dependencies
  • Loading branch information
vytisbulkevicius authored Feb 2, 2024
2 parents 63cc3fa + c495b31 commit 56696c3
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 9 deletions.
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions includes/admin/feedzy-rss-feeds-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public function register_post_type() {
$supports = array(
'title',
);
$capability = feedzy_current_user_can();
$args = array(
'labels' => $labels,
'supports' => $supports,
Expand All @@ -280,6 +281,15 @@ public function register_post_type() {
'show_in_rest' => true,
'rest_base' => 'feedzy_categories',
'rest_controller_class' => 'WP_REST_Posts_Controller',
'map_meta_cap' => true,
'capabilities' => array(
'publish_posts' => $capability,
'edit_posts' => $capability,
'edit_others_posts' => $capability,
'delete_posts' => $capability,
'delete_others_posts' => $capability,
'read_private_posts' => $capability,
),
);
$args = apply_filters( 'feedzy_post_type_args', $args );
register_post_type( 'feedzy_categories', $args );
Expand Down
13 changes: 13 additions & 0 deletions includes/layouts/feedzy-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ class="pro-label">Developer & Agency plans</span></h3>
<span class="dashicons dashicons-saved"></span>
</li>
</ul>
<ul class="fz-pro-features-table-row">
<li class="features-info">
<h3 class="h3">OpenAI (ChatGPT) Support <span class="pro-label">Developer & Agency plans</span></h3>
<p>Using the OpenAI API integration, paraphrase, summarize, generate missing featured images, or apply your custom prompt to the imported content.
</p>
</li>
<li class="free" data-label="Free">
<span class="dashicons dashicons-no-alt"></span>
</li>
<li class="pro" data-label="Pro">
<span class="dashicons dashicons-saved"></span>
</li>
</ul>
<ul class="fz-pro-features-table-row">
<li class="features-info">
<h3 class="h3">WordAI & SpinnerChief integration <span class="pro-label">Agency plan</span></h3>
Expand Down
7 changes: 5 additions & 2 deletions includes/views/import-metabox-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class="dashicons dashicons-arrow-down-alt2"></span>
</select>
</div>
<div class="help-text pt-8">
<?php esc_html_e( 'The imported post will be assigned to a taxonomy (eg. "Post Category", "Post Tag" etc.). Leave blank, if unsure.', 'feedzy-rss-feeds' ); ?>
<?php esc_html_e( 'The imported post will be assigned to a selected taxonomy. Leave it blank if you don\'t need a taxonomy.', 'feedzy-rss-feeds' ); ?>
</div>
</div>
<?php if ( ! feedzy_is_pro() ) : ?>
Expand All @@ -333,7 +333,10 @@ class="dashicons dashicons-arrow-down-alt2"></span>
</div>
<?php endif; ?>
<div class="help-text pt-8">
<?php esc_html_e( 'You can use the magic tags, [#item_categories] and any customizable field like [#item_custom_category]', 'feedzy-rss-feeds' ); ?>
<?php
// phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment
echo wp_kses_post( sprintf( __( 'You can automatically create categories with a magic tag <strong>%1$s</strong> or use custom tag parsing %2$sRead More.%3$s', 'feedzy-rss-feeds' ), '[#item_categories]', '<a href="https://docs.themeisle.com/article/1154-how-to-use-feed-to-post-feature-in-feedzy#dynamic-post-taxonomy" target="_blank">', '</a>' ) );
?>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite>
<testsuite name="unit-tests">
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
Expand Down
65 changes: 65 additions & 0 deletions tests/test-post-access.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
/**
* WordPress unit test plugin.
*
* @package feedzy-rss-feeds-pro
* @subpackage Tests
* @copyright Copyright (c) 2017, Bogdan Preda
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.2.0
*/
class Test_Post_Access extends WP_UnitTestCase {

/**
* Utility method to generate a random 5 char string.
*
* @since 3.0.12
* @access private
* @return string
*/
private function get_rand_name() {
$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$result = '';
for ( $i = 0; $i < 5; $i ++ ) {
$result .= $characters[ mt_rand( 0, 61 ) ];
}

return $result;
}

public function test_custom_post_access() {
$random_name = $this->get_rand_name();
$admin_id = $this->factory->user->create(
array(
'role' => 'administrator',
)
);
wp_set_current_user( $admin_id );
$p = $this->factory->post->create_and_get(
array(
'post_title' => $random_name,
'post_type' => 'feedzy_categories',
'post_author' => $admin_id,
)
);
do_action( 'save_post', $p->ID, $p );
$this->assertEquals( $p->post_title, $random_name );
$this->assertEquals( $p->post_type, 'feedzy_categories' );

$this->assertTrue( feedzy_current_user_can() );
$this->assertTrue( current_user_can( 'edit_post', $p->ID ) );


$contributor_id = $this->factory->user->create(
array(
'role' => 'contributor',
)
);
wp_set_current_user( $contributor_id );

$this->assertFalse( feedzy_current_user_can() );
$this->assertFalse( current_user_can( 'edit_post', $p->ID ) );

}

}

0 comments on commit 56696c3

Please sign in to comment.