Plugin Directory

Changeset 3135881


Ignore:
Timestamp:
08/15/2024 04:08:52 AM (20 months ago)
Author:
mi13
Message:

test to 6.6.1

Location:
mi13-access-by-link/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mi13-access-by-link/trunk/mi13-access-by-link.php

    r3001601 r3135881  
    11<?php
    22/*
    3 Plugin Name:   mi13-access-by-link
    4 Plugin URI:      https://wordpress.org/plugins/mi13-access-by-link/
    5 Description:      Access to your posts (pending) by link.
    6 Version:            1.1
    7 Author:             mi13
    8  
    9 Copyright 2018-2022  Mihail Nebov  (email: mihail_teo@mail.ru)
    10 
    11 This program is free software; you can redistribute it and/or modify
    12 it under the terms of the GNU General Public License as published by
    13 the Free Software Foundation; either version 2 of the License, or
    14 (at your option) any later version.
    15 
    16 This program is distributed in the hope that it will be useful,
    17 but WITHOUT ANY WARRANTY; without even the implied warranty of
    18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    19 GNU General Public License for more details.
    20 
    21 You should have received a copy of the GNU General Public License
    22 along with this program; if not, write to the Free Software
    23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     3Plugin Name: mi13-access-by-link
     4Plugin URI:  https://wordpress.org/plugins/mi13-access-by-link/
     5Description: Access to your posts (pending) by link.
     6Version:     1.2
     7Author:      mi13
     8License:     GPL v2 or later
     9License URI: https://www.gnu.org/licenses/gpl-2.0.html
     10
    2411*/
    2512
     
    9481function mi13_access_by_link_link($id,$key_on) {
    9582    $key = '';
    96     if ($key_on=='1') {
     83    if($key_on=='1') {
    9784        $key = get_post_meta($id,'mi13-access-by-link-key',true);
    98         if (empty($key)) {
     85        if(empty($key)) {
    9986            $key = wp_generate_password( 12, false );
    10087            add_post_meta( $id, 'mi13-access-by-link-key', $key, true );
     
    10895function mi13_access_by_link_meta_box_callback($post) {
    10996    $text = '';
    110     if ($post->post_status == 'pending') {   
     97    if($post->post_status == 'pending') {   
    11198        $id = $post->ID;
    11299        $key_on = get_option('mi13_access_by_link')['key'];
     
    142129    </main><!-- #main -->
    143130</div><!-- #primary -->';
    144     $settings['header' ] = isset($settings['header']) ? intval($settings['header']) : 0;
    145     $settings['footer'  ] = isset($settings['footer']) ? intval($settings['footer']) : 0;
    146     $settings['filters'  ] = strip_tags($settings['filters']);
    147     $settings['html'    ] = isset($settings['html']) ? force_balance_tags( $settings['html'] ) : $html;
    148     $settings['key'     ] = isset($settings['key']) ? intval($settings['key']) : 0;
     131    $settings['header'] = isset($settings['header']) ? intval($settings['header']) : 0;
     132    $settings['footer'] = isset($settings['footer']) ? intval($settings['footer']) : 0;
     133    $settings['filters'] = wp_strip_all_tags($settings['filters']);
     134    $settings['html'] = isset($settings['html']) ? force_balance_tags( $settings['html'] ) : $html;
     135    $settings['key'] = isset($settings['key']) ? intval($settings['key']) : 0;
    149136    $settings['publish'] = isset($settings['publish']) ? intval($settings['publish']) : 0;
    150137    return $settings;
     
    248235        $filters = explode(',',$filters);
    249236        foreach ($filters as $filter) {
    250             if ( !function_exists($filter) ) mi13_access_by_link_error($filter);
     237            if( !function_exists($filter) ) wp_admin_notice( $filter. ' - ' . __('This function was not found! Please, edit "filters" field.','mi13-access-by-link'),['type' => 'error']);
    251238        }
    252239        $key_on = $settings['key'];
     
    257244}
    258245
    259 function mi13_access_by_link_error($filter) {
    260     if (!empty($filter)) echo '<div class="error"><p>' .$filter. ' - ' .__('This function was not found! Please, edit "filters" field.','mi13-access-by-link'). '</p></div>';
    261 }
    262 
    263 add_action('wp_ajax_mi13_access_by_link', 'mi13_access_by_link_ajax');
    264 add_action('wp_ajax_nopriv_mi13_access_by_link', 'mi13_access_by_link_ajax');
    265 
    266246function mi13_access_by_link_ajax() {
    267247    $settings = get_option('mi13_access_by_link');
    268248    $key = '';
    269     $id = $_GET['id'];
    270     if ( isset($_GET['key']) ) $key = $_GET['key'];
    271 
    272     if ( $settings['key'] == '1' ) {
     249    $id = '';
     250    if( isset($_GET['id']) ) $id .= sanitize_text_field($_GET['id']);
     251    if( isset($_GET['key']) ) $key .= sanitize_text_field($_GET['key']);
     252    if( $settings['key'] == '1' ) {
    273253        $key1 = get_post_meta($id,'mi13-access-by-link-key',true);
    274254        if( empty($key1) ) wp_die('Error: key_not_found');
    275         if( !empty($key1) && ( $key != $key1 ) ) wp_die('Error: invalid key');
    276     }
    277 
     255        if( $key !== $key1 ) wp_die('Error: invalid key');
     256    }
    278257    $post = get_post( $id );
    279     if ($post) {
     258    if($post) {
    280259        if( ($post->post_status != 'pending') || ($post->post_type != 'post') || (!empty($post->post_password)) ) wp_die('Error: Access denied');         
    281260        $content = $post->post_content;
     
    298277        $html = str_replace('$cat',$cat,$html);
    299278        $html = str_replace('$thumbnail',$thumbnail,$html);
    300         if ( $settings['header']=='1' ) get_header();
     279        if( $settings['header']=='1' ) get_header();
    301280        echo $html;
    302         if ( $settings['footer']=='1' ) get_footer();
     281        if( $settings['footer']=='1' ) get_footer();
    303282    } else wp_die('Error: invalid id');
    304283    wp_die();   
    305284}
     285add_action('wp_ajax_mi13_access_by_link', 'mi13_access_by_link_ajax');
     286add_action('wp_ajax_nopriv_mi13_access_by_link', 'mi13_access_by_link_ajax');
    306287
    307288?>
  • mi13-access-by-link/trunk/readme.txt

    r3001601 r3135881  
    22Contributors: mi13
    33Tags: access by link, privacy link, pending
    4 Requires at least: 4.7
    5 Tested up to: 6.3.2
    6 Stable tag: 1.1
     4Requires at least: 6.4.0
     5Tested up to: 6.6.1
     6Stable tag: 1.2
     7License: GPLv2 or later
     8License URI: https://www.gnu.org/licenses/gpl-2.0.html
    79
    8 Доступ к Вашим постам (на утверждении) по ссылке
     10Доступ к Вашим постам (на утверждении) по ссылке для модераторов.
    911
    1012== Description ==
     
    5052* fix bug.
    5153= 1.1 =
    52 * Доработан код. Удален пойск мета в тексте, так как для этого есть фильтры.
     54* Доработан код. Удален пойск мета в тексте, так как для этого есть фильтры.
     55= 1.2 =
     56* Доработан код.
Note: See TracChangeset for help on using the changeset viewer.