Plugin Directory

Changeset 3117072


Ignore:
Timestamp:
07/12/2024 01:52:32 PM (21 months ago)
Author:
seowriting
Message:

New version of plugin: 1.7.1

Location:
seowriting
Files:
2 edited
12 copied

Legend:

Unmodified
Added
Removed
  • seowriting/tags/1.7.1/readme.txt

    r3112420 r3117072  
    22Contributors: SEOWriting
    33Tags: seo writing, AI tool, AI writing, generation text
    4 Tested up to: 6.5
     4Tested up to: 6.5.5
    55Requires at least: 4.9
    66Requires PHP: 5.6.20
    7 Stable tag: 1.7.0
     7Stable tag: 1.7.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2222
    2323== Changelog ==
     24
     25= 1.7.1 (2024/07/12) =
     26
     27Feature:
     28* Paginated export posts to create knowledge base.
    2429
    2530= 1.7.0 (2024/07/04) =
  • seowriting/tags/1.7.1/seowriting.php

    r3112420 r3117072  
    99 * Plugin Name:       SEOWriting
    1010 * Description:       SEOWriting - AI Writing Tool Plugin For Text Generation
    11  * Version:           1.7.0
     11 * Version:           1.7.1
    1212 * Author:            SEOWriting
    1313 * Author URI:        https://seowriting.ai/?utm_source=wp_plugin
     
    2828        public $plugin_slug;
    2929        public $plugin_path;
    30         public $version = '1.7.0';
     30        public $version = '1.7.1';
    3131        /**
    3232         * @var \SEOWriting\APIClient|null
     
    423423                        $rs = [
    424424                            'result' => 1,
    425                             'posts' => $this->getPosts()
     425                            'posts' => $this->getPosts(
     426                                intval(isset($post['page']) ? sanitize_text_field($post['page']) : '1'),
     427                                intval(isset($post['per_page']) ? sanitize_text_field($post['per_page']) : '50')
     428                            )
    426429                        ];
    427430                    } elseif ($action === 'get_post') {
     
    797800        }
    798801
    799         public function getPosts()
    800         {
    801             $pages = get_pages();
    802             $posts = array_merge(get_posts([
    803                 'numberposts' => -1,
    804                 'post_type' => 'post',
    805             ]), $pages === false ? [] : $pages);
    806 
     802        public function getPosts($page = 1, $per_page = 50)
     803        {
    807804            $result = [];
    808             foreach ($posts as $post) {
    809                 if (!($post instanceof WP_Post) || $post->post_status !== 'publish') {
    810                     continue;
    811                 }
    812                 /** @var WP_Post $post */
    813                 $result[] = [
    814                     'id' => (int)$post->ID,
    815                     'content' => $post->post_content,
    816                     'title' => $post->post_title,
    817                     'url' => get_permalink($post->ID),
    818                 ];
    819             }
     805
     806            $query = new WP_Query([
     807                'post_type' => ['page', 'post'],
     808                'post_status' => 'publish',
     809                'posts_per_page' => $per_page,
     810                'paged' => $page,
     811                'order' => 'DESC',
     812                'orderby' => 'ID'
     813            ]);
     814            if ($query->have_posts()) {
     815                while ($query->have_posts()) {
     816                    $query->the_post();
     817                    $result[] = [
     818                        'id' => intval(get_the_ID()),
     819                        'content' => get_the_content(),
     820                        'title' => get_the_title(),
     821                        'url' => get_permalink()
     822                    ];
     823                }
     824            }
     825            wp_reset_postdata();
    820826
    821827            return $result;
  • seowriting/trunk/readme.txt

    r3112420 r3117072  
    22Contributors: SEOWriting
    33Tags: seo writing, AI tool, AI writing, generation text
    4 Tested up to: 6.5
     4Tested up to: 6.5.5
    55Requires at least: 4.9
    66Requires PHP: 5.6.20
    7 Stable tag: 1.7.0
     7Stable tag: 1.7.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2222
    2323== Changelog ==
     24
     25= 1.7.1 (2024/07/12) =
     26
     27Feature:
     28* Paginated export posts to create knowledge base.
    2429
    2530= 1.7.0 (2024/07/04) =
  • seowriting/trunk/seowriting.php

    r3112420 r3117072  
    99 * Plugin Name:       SEOWriting
    1010 * Description:       SEOWriting - AI Writing Tool Plugin For Text Generation
    11  * Version:           1.7.0
     11 * Version:           1.7.1
    1212 * Author:            SEOWriting
    1313 * Author URI:        https://seowriting.ai/?utm_source=wp_plugin
     
    2828        public $plugin_slug;
    2929        public $plugin_path;
    30         public $version = '1.7.0';
     30        public $version = '1.7.1';
    3131        /**
    3232         * @var \SEOWriting\APIClient|null
     
    423423                        $rs = [
    424424                            'result' => 1,
    425                             'posts' => $this->getPosts()
     425                            'posts' => $this->getPosts(
     426                                intval(isset($post['page']) ? sanitize_text_field($post['page']) : '1'),
     427                                intval(isset($post['per_page']) ? sanitize_text_field($post['per_page']) : '50')
     428                            )
    426429                        ];
    427430                    } elseif ($action === 'get_post') {
     
    797800        }
    798801
    799         public function getPosts()
    800         {
    801             $pages = get_pages();
    802             $posts = array_merge(get_posts([
    803                 'numberposts' => -1,
    804                 'post_type' => 'post',
    805             ]), $pages === false ? [] : $pages);
    806 
     802        public function getPosts($page = 1, $per_page = 50)
     803        {
    807804            $result = [];
    808             foreach ($posts as $post) {
    809                 if (!($post instanceof WP_Post) || $post->post_status !== 'publish') {
    810                     continue;
    811                 }
    812                 /** @var WP_Post $post */
    813                 $result[] = [
    814                     'id' => (int)$post->ID,
    815                     'content' => $post->post_content,
    816                     'title' => $post->post_title,
    817                     'url' => get_permalink($post->ID),
    818                 ];
    819             }
     805
     806            $query = new WP_Query([
     807                'post_type' => ['page', 'post'],
     808                'post_status' => 'publish',
     809                'posts_per_page' => $per_page,
     810                'paged' => $page,
     811                'order' => 'DESC',
     812                'orderby' => 'ID'
     813            ]);
     814            if ($query->have_posts()) {
     815                while ($query->have_posts()) {
     816                    $query->the_post();
     817                    $result[] = [
     818                        'id' => intval(get_the_ID()),
     819                        'content' => get_the_content(),
     820                        'title' => get_the_title(),
     821                        'url' => get_permalink()
     822                    ];
     823                }
     824            }
     825            wp_reset_postdata();
    820826
    821827            return $result;
Note: See TracChangeset for help on using the changeset viewer.