Plugin Directory

Changeset 2493843


Ignore:
Timestamp:
03/12/2021 06:28:50 AM (5 years ago)
Author:
brainiacx
Message:

3.1 update

Location:
consolety/trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • consolety/trunk/classes/API.php

    r2489086 r2493843  
    157157              get_permalink( $post_before->ID ) != get_permalink( $post_after->ID ) ||
    158158              $post_before->ID != $post_after->ID
    159             ) && $post_after->post_status == 'publish' ) ) {
     159            ) && $post_after->post_status == 'publish' )
     160             && get_post_meta( $post_ID,'consolety-export',true)!=='on' ) {
    160161            $data[]   = [
    161162                'post_id'         => $post_after->ID,
     
    174175                }
    175176            }
    176             if ( $after_in ) {
     177            if ( $after_in && get_post_meta( $post_ID,'consolety-export',true)!=='on') {
    177178                $this->post( $data );
    178179            } elseif ( get_post_meta( $post_after->ID, 'exported_to_consolety' ) && get_site_option( 'consolety_connected', false )) {
     
    184185
    185186    public function post_publish( $new_status, $old_status, \WP_Post $post ) {
    186         if ( $new_status == 'publish' && $old_status !== 'publish' && get_site_option( 'consolety_connected', false )) {
     187        if ( $new_status == 'publish' && $old_status !== 'publish' && get_site_option( 'consolety_connected', false ) && get_post_meta( $post->ID,'consolety-export',true)!=='on') {
    187188            $data[] = [
    188189                'post_id'         => $post->ID,
     
    195196            ];
    196197            $this->post( $data );
    197         } elseif ( $new_status != 'publish' && $old_status === 'publish' && get_site_option( 'consolety_connected', false )) {
     198        } elseif ( $new_status != 'publish' && $old_status === 'publish') {
    198199            $this->delete( $post->ID );
    199200        }
     
    201202
    202203    public function post_delete( $post_id, $post ) {
     204        //&& get_post_meta( $post_ID,'consolety-export',true)!=='on' if it was exported before - it must be deleted.
    203205        if(get_site_option( 'consolety_connected', false )){
    204206            $this->delete( $post_id );
     
    328330                'post_status'    => 'publish',
    329331                'offset'         => $offset,
     332                'meta_key' =>       'consolety-export',
     333                'meta_compare' => 'NOT EXISTS',
    330334                'date_query'     => array(
    331335                    'after' => date( 'Y-m-d', strtotime( $_POST['date'] ) )
    332336                ),
    333                 'category__in'  =>$categories
     337                'category__in'  =>$categories,
     338                'category__not_in' =>[1] //remove uncategorized
    334339            ];
    335340            $posts = new \WP_Query( $args );
  • consolety/trunk/classes/Initialization.php

    r2489086 r2493843  
    103103                            <?php
    104104                            foreach ( get_categories( array( 'hide_empty' => 0, 'parent' => 0 ) ) as $category ) {
    105                                 $checked = in_array( $category->term_id, $this->get_categories() ) ? 'checked="checked"' : '';
     105                                $disabled = $category->term_id===1;
     106                                $checked = (in_array( $category->term_id, $this->get_categories() ) && $category->term_id!==1)? 'checked="checked"' : '';
    106107                                ?>
    107                                 <input type="checkbox" class="consolety-categories" value="<?= $category->term_id ?>"
     108                                <input <?=($disabled?'disabled':'')?> type="checkbox" class="consolety-categories" value="<?= $category->term_id ?>"
    108109                                       name="<?php echo self::$opt_categories; ?>[]"
    109110                                       id="consolety_<?php echo $category->term_id ?>" <?php echo $checked; ?> />
     
    120121                                        foreach ( $subcategories as $subcategory ) {
    121122                                            $checked = in_array( $subcategory->term_id, $this->get_categories() ) ? 'checked="checked"' : '';
     123
    122124                                            ?>
    123                                             <input class="consolety-categories" value="<?= $subcategory->term_id ?>"
     125                                            <input <?=($disabled?'disabled':'')?> class="consolety-categories" value="<?= $subcategory->term_id ?>"
    124126                                                   type="checkbox" name="<?php echo self::$opt_categories; ?>[]"
    125127                                                   id="consolety_<?php echo $subcategory->term_id ?>" <?php echo $checked; ?> />
     
    142144                    <tr>
    143145                        <th class="row">Start date:</th>
    144                         <td><input type="input" id="consolety_datepicker" name="consolety_datepicker"
    145                                    value="<?= date( 'd F Y' ) ?>" class="consolety-datepicker"/>
     146                        <?php
     147                        $posts = get_posts(array(
     148                            'post_type' => 'post',
     149                            'numberposts'=>1,
     150                            'order_by' => 'publish_date',
     151                            'order' => 'ASC'
     152                        ));
     153                        if(isset($posts[0])){
     154                            $date = $posts[0]->post_date;
     155                            $date= date('m-d-Y',strtotime($date)-86400);
     156                        }else{
     157                            $date = date('m-d-Y',time()-86400);
     158                        }
     159                        ?>
     160                        <td><input  id="consolety_datepicker" name="consolety_datepicker"
     161                                   value="<?= $date ?>" class="consolety-datepicker"/>
    146162                            <div id="consolety_progress_block">
    147163                                <div class="consolety_bar_progress">
     
    153169                            </div>
    154170                            <div id="consolety_error_export"></div>
    155                             <p class="description">Select a date to manually export old posts.<br/></p><br/></td>
     171                            <p class="description">Select the start date for manual export of posts. By default, the date of the first post is set. Uncategorized posts cannot be exported.<br/></p><br/></td>
    156172                    </tr>
    157173
     
    172188                </table>
    173189            </form>
     190            <script>
     191            jQuery(document).ready(function ($) {
     192                $('.consolety-datepicker').datepicker({ dateFormat: 'yy-mm-dd' }).datepicker("setDate", new Date('<?=$date?>'));
     193            });
     194            </script>
    174195            <?php
    175196        } else {
  • consolety/trunk/consolety.php

    r2489086 r2493843  
    22declare(strict_types=1);
    33namespace Consolety;
    4 /**
     4use Consolety\Admin\Posts\ConsoletyExportCheckbox;/**
    55 * Plugin Name: Consolety plugin
    66 * Description: Consolety Plugin - Link Exchange plugin for WordPress creates backlinks automatically based on matching titles, categories, tags, content & language.
    7  * Version: 3.0.0
     7 * Version: 3.1.0
    88 * Author: Consolety
    99 * Author URI: https://profiles.wordpress.org/brainiacx
     
    3535        Initialization::getInstance();
    3636        DisplayBlock::getInstance();
     37        ConsoletyExportCheckbox::getInstance();
    3738        //ContentMarketing::getInstance();
    3839        SettingsDesignBlock::getInstance();
     
    7374
    7475        ?>
    75         <div class="consolety consolety-<?=!(\Consolety\API::getInstance()->check_site_connected() || !self::$installed)?'install':'installed'?>">
     76        <div class="consolety consolety-<?=(!\Consolety\API::getInstance()->check_site_connected() || !self::$installed)?'install':'installed'?>">
    7677        <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
    7778        <div class="tabs">
  • consolety/trunk/js/admin.js

    r2489086 r2493843  
    2121        jQuery('#consolety_exported_val').text(r.offset);
    2222        jQuery('#consolety_exported_total').text(r.total);
    23         if (r.error !== null) {
     23        if(r.offset>0 && r.total==0){
     24            jQuery('#consolety_error_export').text('Starting from the selected date, there are no available posts available for export! To use our system, you need to export at least one post.').show();
     25        }else
     26            if (r.error !== null) {
    2427            jQuery('#consolety_progress_block').hide();
    2528            jQuery('#consolety_error_export').show().text(r.message);
    2629            return false;
    2730        }
     31        console.log('total:'+r.total);
     32        console.log('offset:'+r.offset);
     33
    2834        if (r.offset < r.total) {
    2935            consolety_start_export(r.offset, r.total);
     
    3844
    3945jQuery(document).ready(function ($) {
    40     $('.consolety-datepicker').datepicker();
    41 
    4246    $('.consolety-styles-color').wpColorPicker();
    4347    $('#consolety-select-all').click(function (event) {
  • consolety/trunk/readme.txt

    r2489086 r2493843  
    33Tags: Backlinks, SEO, Link Partner, Link Building, Link Exchange
    44Requires at least: 5.0
    5 Tested up to: 5.6.2
    6 Stable tag: 3.0.0
     5Tested up to: 5.7.0
     6Stable tag: 3.1.0
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    1291291. Plugin overview
    1301302. Change style of block
     1313. How to disable post export
    131132
    132133== Changelog ==
     134
     135= 3.1.0 =
     136*Release Date - 12 March 2021*
     137
     138* IMPORTANT It is necessary to reactivate the plugin after updating from version 2.x
     139* Added: Ability to exclude posts from my.consolety.net indexing and export
     140* Changed: "Uncategorized" posts in categories cannot be exported
     141* Changed: By default, the date for exporting a post is set to the date of the first post on the site -1 day
     142* Fixed: design & descriptions
     143
    133144
    134145= 3.0.0 =
Note: See TracChangeset for help on using the changeset viewer.