Changeset 2493843
- Timestamp:
- 03/12/2021 06:28:50 AM (5 years ago)
- Location:
- consolety/trunk
- Files:
-
- 3 added
- 5 edited
-
classes/API.php (modified) (6 diffs)
-
classes/Admin (added)
-
classes/Admin/Posts (added)
-
classes/Admin/Posts/ConsoletyExportCheckbox.php (added)
-
classes/Initialization.php (modified) (5 diffs)
-
consolety.php (modified) (3 diffs)
-
js/admin.js (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
consolety/trunk/classes/API.php
r2489086 r2493843 157 157 get_permalink( $post_before->ID ) != get_permalink( $post_after->ID ) || 158 158 $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' ) { 160 161 $data[] = [ 161 162 'post_id' => $post_after->ID, … … 174 175 } 175 176 } 176 if ( $after_in ) {177 if ( $after_in && get_post_meta( $post_ID,'consolety-export',true)!=='on') { 177 178 $this->post( $data ); 178 179 } elseif ( get_post_meta( $post_after->ID, 'exported_to_consolety' ) && get_site_option( 'consolety_connected', false )) { … … 184 185 185 186 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') { 187 188 $data[] = [ 188 189 'post_id' => $post->ID, … … 195 196 ]; 196 197 $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') { 198 199 $this->delete( $post->ID ); 199 200 } … … 201 202 202 203 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. 203 205 if(get_site_option( 'consolety_connected', false )){ 204 206 $this->delete( $post_id ); … … 328 330 'post_status' => 'publish', 329 331 'offset' => $offset, 332 'meta_key' => 'consolety-export', 333 'meta_compare' => 'NOT EXISTS', 330 334 'date_query' => array( 331 335 'after' => date( 'Y-m-d', strtotime( $_POST['date'] ) ) 332 336 ), 333 'category__in' =>$categories 337 'category__in' =>$categories, 338 'category__not_in' =>[1] //remove uncategorized 334 339 ]; 335 340 $posts = new \WP_Query( $args ); -
consolety/trunk/classes/Initialization.php
r2489086 r2493843 103 103 <?php 104 104 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"' : ''; 106 107 ?> 107 <input type="checkbox" class="consolety-categories"value="<?= $category->term_id ?>"108 <input <?=($disabled?'disabled':'')?> type="checkbox" class="consolety-categories" value="<?= $category->term_id ?>" 108 109 name="<?php echo self::$opt_categories; ?>[]" 109 110 id="consolety_<?php echo $category->term_id ?>" <?php echo $checked; ?> /> … … 120 121 foreach ( $subcategories as $subcategory ) { 121 122 $checked = in_array( $subcategory->term_id, $this->get_categories() ) ? 'checked="checked"' : ''; 123 122 124 ?> 123 <input class="consolety-categories" value="<?= $subcategory->term_id ?>"125 <input <?=($disabled?'disabled':'')?> class="consolety-categories" value="<?= $subcategory->term_id ?>" 124 126 type="checkbox" name="<?php echo self::$opt_categories; ?>[]" 125 127 id="consolety_<?php echo $subcategory->term_id ?>" <?php echo $checked; ?> /> … … 142 144 <tr> 143 145 <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"/> 146 162 <div id="consolety_progress_block"> 147 163 <div class="consolety_bar_progress"> … … 153 169 </div> 154 170 <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> 156 172 </tr> 157 173 … … 172 188 </table> 173 189 </form> 190 <script> 191 jQuery(document).ready(function ($) { 192 $('.consolety-datepicker').datepicker({ dateFormat: 'yy-mm-dd' }).datepicker("setDate", new Date('<?=$date?>')); 193 }); 194 </script> 174 195 <?php 175 196 } else { -
consolety/trunk/consolety.php
r2489086 r2493843 2 2 declare(strict_types=1); 3 3 namespace Consolety; 4 /**4 use Consolety\Admin\Posts\ConsoletyExportCheckbox;/** 5 5 * Plugin Name: Consolety plugin 6 6 * Description: Consolety Plugin - Link Exchange plugin for WordPress creates backlinks automatically based on matching titles, categories, tags, content & language. 7 * Version: 3. 0.07 * Version: 3.1.0 8 8 * Author: Consolety 9 9 * Author URI: https://profiles.wordpress.org/brainiacx … … 35 35 Initialization::getInstance(); 36 36 DisplayBlock::getInstance(); 37 ConsoletyExportCheckbox::getInstance(); 37 38 //ContentMarketing::getInstance(); 38 39 SettingsDesignBlock::getInstance(); … … 73 74 74 75 ?> 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'?>"> 76 77 <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> 77 78 <div class="tabs"> -
consolety/trunk/js/admin.js
r2489086 r2493843 21 21 jQuery('#consolety_exported_val').text(r.offset); 22 22 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) { 24 27 jQuery('#consolety_progress_block').hide(); 25 28 jQuery('#consolety_error_export').show().text(r.message); 26 29 return false; 27 30 } 31 console.log('total:'+r.total); 32 console.log('offset:'+r.offset); 33 28 34 if (r.offset < r.total) { 29 35 consolety_start_export(r.offset, r.total); … … 38 44 39 45 jQuery(document).ready(function ($) { 40 $('.consolety-datepicker').datepicker();41 42 46 $('.consolety-styles-color').wpColorPicker(); 43 47 $('#consolety-select-all').click(function (event) { -
consolety/trunk/readme.txt
r2489086 r2493843 3 3 Tags: Backlinks, SEO, Link Partner, Link Building, Link Exchange 4 4 Requires at least: 5.0 5 Tested up to: 5. 6.26 Stable tag: 3. 0.05 Tested up to: 5.7.0 6 Stable tag: 3.1.0 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later … … 129 129 1. Plugin overview 130 130 2. Change style of block 131 3. How to disable post export 131 132 132 133 == 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 133 144 134 145 = 3.0.0 =
Note: See TracChangeset
for help on using the changeset viewer.