Plugin Directory

Changeset 2904458


Ignore:
Timestamp:
04/26/2023 12:18:09 PM (3 years ago)
Author:
zluck
Message:
  • Import all articles
  • Added pagination
Location:
automatic-articles-importer/trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • automatic-articles-importer/trunk/assets/css/style-admin.css

    r2849583 r2904458  
    1 .menu-icon-zl_ziai_article div img{
     1.menu-icon-zl_ziai_article div img {
    22    width: 100%;
    33    height: auto;
     
    5959}
    6060
     61
    6162/* Tool tip icon start*/
     63
    6264.hint {
    6365    display: inline-block;
     
    6769}
    6870
     71
    6972/* background style for 'i' */
     73
    7074.hint-icon {
    7175    background: #a5acb5;
     
    8286}
    8387
     88
    8489/* hint icon hover style */
     90
    8591.hint-icon:hover {
    8692    background: #1170be;
     
    8894}
    8995
     96
    9097/* Displays the hint. important! Do not remove. */
     98
    9199.hint:hover .hint-description,
    92100.hint:focus .hint-description {
     
    94102}
    95103
     104
    96105/* position of the hint  */
     106
    97107.hint-description {
    98108    display: none;
     
    114124}
    115125
     126
    116127/* styling for the arrow */
     128
    117129.hint-description:before,
    118130.hint-description:after {
     
    127139}
    128140
     141
    129142/* overlay styling */
    130 .hint-description:after {
     143
     144
     145/* .hint-description:after {
    131146    left: 50%;
    132147    border-top-color: #f6f8fa;
    133148    bottom: -20px;
    134149}
     150
     151.lds-dual-ring.hidden {
     152    display: none;
     153}
     154
     155.lds-dual-ring {
     156    display: inline-block;
     157    width: 80px;
     158    height: 80px;
     159}
     160
     161.lds-dual-ring:after {
     162    content: " ";
     163    display: block;
     164    width: 64px;
     165    height: 64px;
     166    margin: 23%;
     167    margin-left: 51%;
     168    border-radius: 50%;
     169    border: 6px solid #fff;
     170    border-color: #fff transparent #fff transparent;
     171    animation: lds-dual-ring 1.2s linear infinite;
     172}
     173
     174@keyframes lds-dual-ring {
     175    0% {
     176        transform: rotate(0deg);
     177    }
     178    100% {
     179        transform: rotate(360deg);
     180    }
     181}
     182
     183.overlay {
     184    position: fixed;
     185    top: 0;
     186    left: 0;
     187    width: 100%;
     188    height: 100vh;
     189    background: rgba(0, 0, 0, .8);
     190    z-index: 999;
     191    opacity: 1;
     192    transition: all 0.5s;
     193} */
     194
     195@keyframes spin {
     196    from {
     197        transform: rotate(0deg);
     198    }
     199    to {
     200        transform: rotate(360deg);
     201    }
     202}
     203
     204.zl-spinner::before {
     205    content: '';
     206    position: absolute;
     207    background-color: #fbfbfc;
     208    top: 4px;
     209    left: 4px;
     210    width: 6px;
     211    height: 6px;
     212    border: none;
     213    border-radius: 100%;
     214    transform-origin: 8px 8px;
     215    animation-name: spin;
     216    animation-duration: 1000ms;
     217    animation-timing-function: linear;
     218    animation-iteration-count: infinite;
     219}
     220
     221.zl-spinner {
     222    visibility: visible;
     223    display: inline-block;
     224    background-color: #23282d;
     225    opacity: 0.75;
     226    width: 24px;
     227    height: 24px;
     228    border: none;
     229    border-radius: 100%;
     230    padding: 0;
     231    margin: 0 24px;
     232    position: relative;
     233}
  • automatic-articles-importer/trunk/assets/js/zl-admin-custom.js

    r2849583 r2904458  
    1 jQuery(document).ready(function() {
    2     var post_type = jQuery("select[name='zl_post_type_get']").val();
     1jQuery(document).ready(function($) {
     2    var post_type = $("select[name='zl_post_type_get']").val();
     3    var progressBar = $("#progressbar");
     4    var bulkImportBtn = $('#bulk-import');
    35    GetCategoryziai(post_type);
    46
    5     jQuery("select[name='zl_post_type_get']").on("change", function(){
    6         var post_type = jQuery(this).val();
     7    $("select[name='zl_post_type_get']").on("change", function() {
     8        var post_type = $(this).val();
    79        GetCategoryziai(post_type);
    810    });
    911
     12    $(progressBar).progressbar({
     13        value: 0
     14    });
     15
     16    $(bulkImportBtn).click(function() {
     17        fireBulkImporter();
     18    });
     19
     20
    1021    function GetCategoryziai(post_type) {
    11         jQuery.ajax({
     22        $.ajax({
    1223            type: "POST",
    1324            url: wpAjax.ajaxUrl,
    1425            data: { action: "ziai_category_get", post_type: post_type },
    15             beforeSend: function () {
    16                 jQuery(".zl-ajax-loader").css({ display: "inline-block" });
     26            beforeSend: function() {
     27                $(".zl-ajax-loader").css({ display: "inline-block" });
    1728            },
    18             success: function (result) {
    19                 jQuery(".post_type_category").html(result);
    20                 jQuery(".zl-ajax-loader").css({ display: "none" });
     29            success: function(result) {
     30                $(".post_type_category").html(result);
     31                $(".zl-ajax-loader").css({ display: "none" });
    2132            },
    2233        });
    2334    }
     35
     36    function fireBulkImporter() {
     37        let author = jQuery("#zl_default_author").val();
     38        let category = jQuery(".post_type_category [name='zl_taxonomie']").val();
     39        let api_key = jQuery("#ziai_access_token").val();
     40        $.ajax({
     41            type: "POST",
     42            url: wpAjax.ajaxUrl,
     43            data: { action: "ziai_bulk_importer_init", api_key: api_key, post_type: post_type, author: author, category: category },
     44            beforeSend: function() {
     45                $(bulkImportBtn).toggleClass('disabled');
     46                $(bulkImportBtn).prop('disabled', true);
     47                $('.zl-button .submit span').addClass('zl-spinner');
     48            },
     49            success: function(result) {
     50                // makes it <result.pages.total_pages irl
     51                result = JSON.parse(result);
     52                let currentPage = result.pages.page + 1;
     53                let maxPage = result.pages.total_pages; // set the maximum number of pages here
     54                $(progressBar).progressbar({
     55                    value: (result.pages.page / result.pages.total_pages) * 100
     56                });
     57
     58                function nextPage() {
     59                    if (currentPage <= maxPage) {
     60                        bulkImporterNextPage(currentPage, currentPage + 1, function() {
     61                            currentPage++;
     62                            nextPage();
     63                        });
     64                    }
     65                }
     66
     67                nextPage();
     68            },
     69        });
     70    }
     71
     72    function bulkImporterNextPage(currentPage, nextPage, callback) {
     73        $.ajax({
     74            type: "POST",
     75            url: wpAjax.ajaxUrl,
     76            data: {
     77                action: "ziai_bulk_importer_get_page",
     78                currentPage: currentPage,
     79                nextPage: nextPage
     80            },
     81            success: function(result) {
     82                result = JSON.parse(result);
     83                if (callback) {
     84                    callback();
     85                }
     86                $(progressBar).progressbar({
     87                    value: (result.pages.page / result.pages.total_pages) * 100
     88                });
     89                if (result.pages.page === result.pages.total_pages) {
     90                    bulkImporterComplete();
     91                }
     92            },
     93            error: function(jqXHR, textStatus, errorThrown) {
     94                console.log("Error:", textStatus, errorThrown);
     95            }
     96        });
     97    }
     98
     99    function bulkImporterComplete() {
     100        $(bulkImportBtn).toggleClass('disabled');
     101        $(bulkImportBtn).prop('disabled', false);
     102        $('.zl-button .submit span').removeClass('zl-spinner');
     103        $(progressBar).progressbar({
     104            value: 0
     105        });
     106    }
    24107});
  • automatic-articles-importer/trunk/automatic-articles-importer.php

    r2849583 r2904458  
    55 * Description: This plugin is used to import articles from Intercom Service.
    66 * Plugin URI: https://www.zluck.com/
    7  * Version: 1.0
     7 * Version: 1.1
    88 * Author: Zluck Solutions
    99 * Author URI: https://profiles.wordpress.org/zluck
     
    2222include_once('classes/class-ziai-cron.php');
    2323
    24 ZIAI_Modules::ziai_init();
     24$ZIAI_Modules  = new ZIAI_Modules();
     25$ZIAI_Modules->ziai_init();
    2526ZIAI_CronJob::ziai_cron_init();
  • automatic-articles-importer/trunk/classes/class-admin-menu.php

    r2849583 r2904458  
    11<?php
    22class ZIAI_Modules {
    3     public static function ziai_init() {
    4         add_action( 'admin_enqueue_scripts', array( __CLASS__, 'ziai_load_admin_style' ) );
    5         add_action( 'admin_menu', array( __CLASS__, 'ziai_register_menu_page' ) );
    6         add_action('wp_ajax_ziai_category_get', array( __CLASS__, 'ziai_category_get' ));
    7         add_action('wp_ajax_nopriv_ziai_category_get', array( __CLASS__, 'ziai_category_get' ));
    8         add_action('init', array( __CLASS__, 'ziai_register_post_type' ));
    9     }
    10 
    11     public static function ziai_register_menu_page() {
     3    public function ziai_init() {
     4        add_action( 'admin_enqueue_scripts', array( $this, 'ziai_load_admin_style' ) );
     5        add_action( 'admin_menu', array( $this, 'ziai_register_menu_page' ) );
     6        add_action('wp_ajax_ziai_category_get', array( $this, 'ziai_category_get' ));
     7        add_action('wp_ajax_ziai_bulk_importer_init', array( $this, 'ziai_bulk_importer_init' ));
     8        add_action('wp_ajax_ziai_bulk_importer_get_page', array( $this, 'ziai_bulk_importer_get_page' ));
     9        add_action('wp_ajax_nopriv_ziai_category_get', array( $this, 'ziai_category_get' ));
     10        add_action('init', array( $this, 'ziai_register_post_type' ));
     11    }
     12
     13    public function ziai_register_menu_page() {
    1214        add_submenu_page(
    1315            'edit.php?post_type=zl_ziai_article',
     
    1618            'manage_options',
    1719            'ziai-articles',
    18             array( __CLASS__, 'ziai_admin_show_data' )
    19         );
    20     }
    21 
    22     public static function ziai_load_admin_style() {
     20            array( $this, 'ziai_admin_show_data' )
     21        );
     22    }
     23
     24    public function ziai_load_admin_style() {
     25        wp_enqueue_style( 'jquery-ui-progressbar', ZIAI_FILE_URL . 'assets/css/jquery-ui.css');
    2326        wp_enqueue_style( 'ziai_admin_style_css', ZIAI_FILE_URL . 'assets/css/style-admin.css');
     27        wp_enqueue_script('jquery-ui-progressbar');
    2428        wp_enqueue_script('zl_admin_custom_script', ZIAI_FILE_URL . 'assets/js/zl-admin-custom.js', array('jquery'), '1.0', true);
    2529        wp_localize_script('zl_admin_custom_script', 'wpAjax', array('ajaxUrl' => admin_url('admin-ajax.php')));
    2630    }
    2731
    28     public static function ziai_admin_show_data() {
     32    public function ziai_admin_show_data() {
    2933        if ( is_file(ZIAI_FILE_PATH . 'includes/wp-ziai-article-form.php') ) {
     34            $errormsg = false;
    3035            $token                      = get_option('zl_ziai_access_token');
    3136            $post_type                  = get_option('zl_post_type_get');
     
    5762                $errormsg = "Articles settings updated successfully!!";
    5863                if (isset($_POST['runnow'])) {
    59                     $arry = array(
    60                         "access_token" => $token,
    61                         "import_post_type" => $post_type,
    62                         "import_author" => $zl_default_author,
    63                         "import_taxonomy" => $taxonomies,
    64                     );
     64                    $arry = $this->get_ziai_options_array();
    6565                    $importer_article   = new ZIAI_Handler($arry);
    66                     $response           = $importer_article->ziai_import_article();
    67                     if ($response['status'] == 'errors') {
    68                         $errormsg = $response['message'];
    69                     } else {
    70                         $errormsg = 'Message:- ' . $response['message'] . '<br>';
    71                         $errormsg .= 'Episodes:- ' . $response['count'] .' Article Import';
    72                         //$errormsg .= 'Episodes:- '.$response['episodes'];
     66                    $response = $importer_article->sync_articles();
     67                    if($response){
     68                        if ($response['status'] == 'errors') {
     69                            $errormsg = $response['message'];
     70                        } else {
     71                            $errormsg = 'Message:- ' . $response['message'] . '<br>';
     72                            $errormsg .= 'Episodes:- ' . $response['count'] .' Article Import';
     73                        }
    7374                    }
    7475                }
     
    7879    }
    7980
     81    public function get_ziai_options_array(){
     82        $token                      = get_option('zl_ziai_access_token');
     83        $post_type                  = get_option('zl_post_type_get');
     84        $taxonomies                 = get_option('zl_taxonomy_get');
     85        $zl_default_author          = get_option('zl_default_author');
     86        return array(
     87            "access_token" => $token,
     88            "import_post_type" => $post_type,
     89            "import_author" => $zl_default_author,
     90            "import_taxonomy" => $taxonomies,
     91        );
     92    }
     93
    8094    //Post Category Get
    81     public static function ziai_category_get()
     95    public function ziai_category_get()
    8296    {
    8397        $post_type      = 'zl_ziai_article';
     
    99113    }
    100114
     115    public function ziai_bulk_importer_init()
     116    {
     117        update_option('zl_taxonomy_get', $_POST['category']);
     118        update_option('zl_default_author', $_POST['author']);
     119        update_option('zl_post_type_get', $_POST['post_type']);
     120        update_option('zl_ziai_access_token', $_POST['api_key']);
     121       
     122        $arry = $this->get_ziai_options_array();
     123        $importer_article   = new ZIAI_Handler($arry);
     124        $response = $importer_article->get_articles(1, 25);
     125        echo json_encode($response);
     126        die();
     127    }
     128
     129    public function ziai_bulk_importer_get_page()
     130    {
     131        $page = $_POST['currentPage'];
     132        $arry = $this->get_ziai_options_array();
     133        $importer_article   = new ZIAI_Handler($arry);
     134        $response = $importer_article->get_articles($page, 25);
     135        echo json_encode($response);
     136        die();
     137    }
     138
    101139    //custom Post Type
    102     public static function ziai_register_post_type()
     140    public function ziai_register_post_type()
    103141    {
    104142        $cpt_name = 'Automatic Articles Importer';
     
    135173            'hierarchical' => true,
    136174        );
     175
    137176        register_post_type('zl_ziai_article', $args);
     177
    138178        $taxonomys = 'Collection';
    139179        $taxonomyp = 'Collections';
     
    152192            'not_found' => __('No ' . $taxonomys . ' found.'),
    153193        );
     194
    154195        register_taxonomy('article-cat', array('zl_ziai_article'), array(
    155196            'hierarchical' => true,
  • automatic-articles-importer/trunk/classes/class-article-import.php

    r2849583 r2904458  
    1717    }
    1818
    19     public function ziai_import_article()
    20     {
    21         $response = wp_remote_get( 'https://api.intercom.io/articles/?per_page=-1',
     19    public function sync_articles(){
     20        $response = $this->get_articles(1, 25);
     21        if($response['pages']['total_pages'] > 1){
     22            $this->get_more_articles($response['pages']['page']+1, $response['pages']['total_pages']);
     23        }
     24    }
     25
     26    private function get_more_articles($current_page, $max_page) {
     27        if ($current_page > $max_page) {
     28            return;
     29        }
     30
     31        $this->get_articles($current_page, $current_page + 1,
     32            function($current_page, $max_page) {
     33                $current_page++;
     34                $this->get_more_articles($current_page, $max_page);
     35            });
     36    }
     37
     38    public function get_articles($page=null, $per_page=null, $callback=false){
     39        $endpoint = 'https://api.intercom.io/articles/';
     40        $params = http_build_query(array(
     41            'page' => $page,
     42            'per_page' => $per_page
     43        ));
     44        if($params){
     45            $endpoint .= '?'.$params;
     46        }
     47        $response = wp_remote_get( $endpoint,
    2248            array(
    2349                'method' => 'GET',
     
    3056        $response = json_decode($response['body'], true);
    3157        if(!isset($response['errors'])){
     58            $imported_articles = $this->ziai_import_articles($response);
     59            if($callback){
     60                $callback($page, $response['pages']['total_pages']);
     61            } else {
     62                return $response;
     63            }
     64        } else {
     65            return array(
     66                'status'   => 'errors',
     67                'message'  => $response['errors'][0]->message,
     68            );
     69        }
     70    }
     71
     72    public function ziai_import_articles($response)
     73    {
     74        if (isset($response['errors'])) {
     75            return [
     76                'status' => 'errors',
     77                'message' => $response['errors'][0]->message,
     78            ];
     79        } else {
     80            // Get collection data from api for given article parent_id
    3281            foreach($response['data'] as $data){
    33                 $collection = wp_remote_get( 'https://api.intercom.io/help_center/collections/'.$data['parent_id'].'',
    34                     array(
    35                         'method' => 'GET',
    36                         'headers' => array(
    37                             'Authorization' => 'Bearer ' . $this->access_token
    38                         )
    39                     )
    40                 );
    41                
    42                 $collection = json_decode($collection['body'], true);
    43                 $article = array(
    44                     'id' => $data['id'],
    45                     'title' => $data['title'],
    46                     'content' => $data['body'],
    47                     'status'  => $data['state'],
    48                     'collection' => $collection['name']
    49                 );
    50                 $this->ziai_create_article($article);
     82                // If the article exists, we don't need to call for the collection data
     83                $article_exists = $this->is_article_imported($data['id']);
     84                $collection = null;
     85                if(!$article_exists){
     86                    $this->create_update_article($data);
     87                } else {
     88                    //$article_wp_object = get_post($article_exists);
     89                    $out_of_date = $this->is_article_outdated($article_exists, $data);
     90                    if($out_of_date){
     91                        $this->create_update_article($data);
     92                    }
     93                }
    5194            }
    5295            return array(
     
    5699                'episodes' => $this->ziai_imported,
    57100            );
    58         }else{
    59             return array(
    60                 'status'   => 'errors',
    61                 'message'  => $response['errors'][0]->message,
    62             );
    63         }
    64     }
    65 
     101        }
     102    }
     103
     104    /**
     105     * Checks if a WordPress article is out of date with Intercom.
     106     *
     107     * @param int $article_id The post ID of the article.
     108     * @param array $data An array of article data from the Intercom API.
     109     * @return bool True if the article is outdated, false otherwise.
     110     */
     111    public function is_article_outdated(int $article_id, array $data): bool {
     112        $article_wp_date_modified = get_post_meta($article_id, 'intercom_updated_at', true);
     113        return ($data['updated_at'] > $article_wp_date_modified);
     114    }
     115
     116    public function get_collection_data($data){
     117        $collection = wp_remote_get( 'https://api.intercom.io/help_center/collections/'.$data['parent_id'].'',
     118            array(
     119                'method' => 'GET',
     120                'headers' => array(
     121                    'Authorization' => 'Bearer ' . $this->access_token
     122                )
     123            )
     124        );
     125
     126        return json_decode($collection['body'], true);
     127    }
     128
     129    /**
     130     * Checks to see if an article has been previously imported into WordPress
     131     *
     132     * @param int $article_id The article_id as provided by the Intercom API
     133     * @return int|bool The post ID of the matching post if found, or false if not found.
     134     */
     135    public function is_article_imported(int $article_id): bool|int
     136    {
     137        $exists = false;
     138        $args = array(
     139            'post_type' => $this->post_type,
     140            'post_status' => array('publish', 'draft'),
     141            'meta_query' => array(
     142                array(
     143                    'key' => 'zl_ziai_id',
     144                    'value' => $article_id,
     145                    'compare' => '=',
     146                )
     147            )
     148        );
     149
     150        $already_added = get_posts($args);
     151        if ($already_added) {
     152            $exists = $already_added[0]->ID;
     153        }
     154
     155        return $exists;
     156    }
     157
     158    public function create_update_article($data){
     159        if(isset($data['parent_id'])){
     160            $collection = $this->get_collection_data($data);
     161        }
     162
     163        $article = array(
     164            'id' => $data['id'],
     165            'title' => $data['title'],
     166            'content' => $data['body'],
     167            'status'  => $data['state'],
     168            'created_at'  => $data['created_at'],
     169            'updated_at'  => $data['updated_at'],
     170            'collection'=> $collection['name'] ?? null,
     171        );
     172
     173        $this->ziai_create_article($article);
     174    }
    66175    protected function ziai_create_article($article)
    67176    {
     
    83192    }
    84193
     194
    85195    public function ziai_get_post_data($article)
    86196    {
    87         $term_a      = term_exists($article['collection'], $this->taxonomy);
    88         $term_a_id   = $term_a['term_id'];
    89         if(empty($term_a_id)){
    90             wp_insert_term(
    91                 $article['collection'],
    92                 $this->taxonomy,
    93                 array(
    94                     // 'description'=> 'Some description.',
    95                     'slug' => str_replace(" ", "-", $article['collection']),
    96                 )
    97             );
     197        $term_a = false;
     198        $post_data                  = array();
     199        if(isset($article['collection'])){
     200            $term_a      = term_exists($article['collection'], $this->taxonomy);
     201            $term_a_id   = $term_a['term_id'];
     202            if(empty($term_a_id)){
     203                wp_insert_term(
     204                    $article['collection'],
     205                    $this->taxonomy,
     206                    array(
     207                        // 'description'=> 'Some description.',
     208                        'slug' => str_replace(" ", "-", $article['collection']),
     209                    )
     210                );
     211            }
     212            $term_a                     = term_exists($article['collection'], $this->taxonomy);
     213            $term_id                    = $term_a['term_id'];
     214            $post_data['post_category'] = array($term_id);
    98215        }
    99216
    100217        $status                     = ($article['status'] == 'published') ? $article['status'] = 'publish' : $article['status'];
    101         $term_a                     = term_exists($article['collection'], $this->taxonomy);
    102         $term_id                    = $term_a['term_id'];
    103         $post_data                  = array();
    104218        $post_data['post_content']  = $article['content'];
    105219        $post_data['post_title']    = $article['title'];
     
    107221        $post_data['post_author']   = $this->post_author;
    108222        $post_data['post_type']     = $this->post_type;
    109         $post_data['post_category'] = array($term_id);
     223
    110224        $post_data['meta_input']    = array(
    111225            'zl_ziai_id' => $article['id'],
    112         );
    113 
    114         $args = array(
    115             'post_type' => $this->post_type,
    116             'post_status' => array('publish', 'draft'),
    117             'meta_query' => array(
    118                 array(
    119                     'key' => 'zl_ziai_id',
    120                     'value' => $article['id'],
    121                     'compare' => '=',
    122                 )
    123             )
    124         );
    125 
    126         $already_added = new WP_Query($args);
    127         if ($already_added->have_posts()) {
    128             $already_added->the_post();
    129             $post_id = get_the_ID();
    130             $post_data['ID'] = $post_id;
     226            'intercom_created_at' => $article['created_at'],
     227            'intercom_updated_at' => $article['updated_at']
     228        );
     229
     230        // Find the article in WP
     231        $article_exists = $this->is_article_imported($article['id']);
     232        if($article_exists ){
     233            $post_data['ID'] = $article_exists;
    131234        }
    132235
  • automatic-articles-importer/trunk/classes/class-ziai-cron.php

    r2849583 r2904458  
    5252    public static function ziai_get_articles_using_cron()
    5353    {
    54         // here's the function we'd like to call with our cron job
    55         $token                      = get_option('zl_ziai_access_token');
    56         $post_type                  = get_option('zl_post_type_get');
    57         $category                   = get_option('zl_category_get');
    58         $taxonomies                 = get_option('zl_taxonomy_get');
    59         $zl_default_author          = get_option('zl_default_author');
    60         $arry = array(
    61             "access_token" => $token,
    62             "import_post_type" => $post_type,
    63             "import_author" => $zl_default_author,
    64             "import_taxonomy" => $taxonomies,
    65         );
    66         $importer_article   = new ZIAI_Handler($arry);
    67         $importer_article->ziai_import_article();
     54        $ZIAI_Modules = new ZIAI_Modules();
     55        $arry = $ZIAI_Modules->get_ziai_options_array();
     56        $importer_article   = new ZIAI_Handler($arry);
     57        $importer_article->sync_articles();
    6858    }
    6959}
  • automatic-articles-importer/trunk/includes/wp-ziai-article-form.php

    r2849583 r2904458  
    11<div class="wrap wp-ziai-article">
    22    <h1><?php esc_html_e('Automatic Articles Settings', 'ziai-articles'); ?></h1>
     3    <?php
     4    // wp_enqueue_script('jquery-ui-progressbar');
     5    // $wp_scripts = wp_scripts();
     6    // wp_enqueue_style('plugin_name-admin-ui-css',
     7    //     'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $wp_scripts->registered['jquery-ui-core']->ver . '/themes/smoothness/jquery-ui.css',
     8    //     false,
     9    //     1.0,
     10    //     false);
     11    ?>
    312    <div id="wpbody" role="main">
    413        <div id="wpbody-content">
     
    1019                        <div class="col-wrap">
    1120                            <div class="form-wrap">
    12                                 <p><?php _e($errormsg, 'ziai-articles'); ?></p>
     21                                <?php
     22                                if($errormsg) { ?>
     23                                    <p><?php _e($errormsg, 'ziai-articles'); ?></p>
     24                                <?php
     25                                }
     26                                ?>
    1327                                <form method="post" action="" class="validate zl-admin-form">
     28                                    <div id="loader" class="lds-dual-ring hidden overlay"></div>
     29                                    <div id="progressbar"></div><br>
    1430                                    <div class="zl-ziai-setting zl-setting-2">
    1531                                        <div class="form-field form-required term-name-wrap">
     
    2036                                                </div>
    2137                                            </label>
    22                                             <input name="ziai_access_token" id="ziai_access_token" type="text" value="<?php echo esc_attr($token); ?>" aria-required="true" required/>
     38                                            <input name="ziai_access_token" id="ziai_access_token" type="text" <?php if($token != ''){ ?> value="<?php echo esc_attr($token); ?>" <?php } ?> aria-required="true" required/>
     39                                        </div>
     40                                        <br>
     41                                        <div class="zl-button">
     42                                            <!-- <div style="padding: 10px 0;"> -->
     43                                            <p class="submit">
     44                                                <button type="button" class="button button-primary" id="bulk-import">Import All</button><span class=""></span>
     45                                            </p>
     46                                            <!-- </div> -->
     47                                            <div></div>
    2348                                        </div>
    2449                                    </div>
     
    6691                                            wp_nonce_field('zl-ziai-settings-save', 'zl-ziai-settings');
    6792                                            submit_button('Save Changes', 'primary', 'savechanges');
    68                                             submit_button('Save & Run Now', 'primary runnow', 'runnow');
     93                                            //submit_button('Save & Run Now', 'primary runnow', 'runnow');
    6994                                            ?>
     95                                            <!-- <div style="padding: 10px 0;"> -->
     96                                            <!-- <p class="submit">
     97                                                <button type="button" class="button button-primary" id="bulk-import">Import All</button><span class=""></span>
     98                                            </p> -->
     99                                            <!-- </div> -->
    70100                                            <div></div>
    71101                                        </div>
    72102                                    </div>
    73103                                </form>
     104                                <!-- <div>
     105                                    <h5>Bulk Importer</h5>
     106                                    <div id="progressbar"></div>
     107                                    <div style="padding: 10px 0;">
     108                                        <button class="button button-primary" id="bulk-import">Import All</button>
     109                                    </div>
     110                                </div> -->
    74111                            </div>
    75112                        </div>
  • automatic-articles-importer/trunk/readme.txt

    r2849660 r2904458  
    1414    == Description ==
    1515
    16     Automatic Articles Importer is an easy, quick and advanced plugin to import intercom articles. This plugin gives you ability to import the Intercom articles in your website easily. This plugin collects the intercom articles & collections from intercom and import on your website by collection wise.
     16    Automatic Articles Importer is an easy, quick and advanced plugin to import intercom articles.
     17
     18    This plugin gives you ability to import the Intercom articles in your website easily. This plugin collects the intercom articles & collections from intercom and import on your website by collection wise.
    1719
    1820
    1921    == Key Features ==
    2022
    21     * Scheduled import process
    22     * Import intercom articles
    23     * Import intercom collection
    24     * Sync articles regulary by cron
     23    - Scheduled import process
     24    - Import intercom articles
     25    - Import intercom collection
     26    - Sync articles regulary by cron
    2527
    2628
     
    6365    == Changelog ==
    6466
     67    = 1.1 =
     68    * Ability to import all articles
     69    * Added pagination
     70    * Other minor bugs fixes
     71   
    6572    = 1.0 =
    6673    * Initial Launch
Note: See TracChangeset for help on using the changeset viewer.