Plugin Directory

Changeset 3031710

Timestamp:
02/05/2024 02:56:09 PM (6 months ago)
Author:
dipakparmar443
Message:
  • UI & Code improvements
  • Issue fixed Cross Site Request Forgery (CSRF) vulnerability
Location:
wp-simple-post-view
Files:
21 added
5 edited

Legend:

Unmodified
Added
Removed
  • wp-simple-post-view/trunk/includes/add_post_column.php

    r2872537 r3031710  
    11<?php
     2
     3
     4
    25// If check class exists.
    36if ( ! class_exists( 'NGD_wpSimplePostView_Admin' ) ) {
     
    2225
    2326                $isPostCountExists = get_post_meta( 'post_view' );
    24 
    2527                if( ! isset( $isPostCountExists ) && empty( $isPostCountExists ) ) {
    2628                    return $vars;
     
    4648          $wp_simple_post_view_text = esc_attr( get_option('wp_simple_post_view_text') );
    4749          if( empty( $wp_simple_post_view_text ) ) {
    48             $wp_simple_post_view_text = 'Post View';
     50            $wp_simple_post_view_text = ;
    4951          }
    5052
    51           $columns['post_view'] = __( $wp_simple_post_view_text, 'wp-simple-post-view' );
     53          $columns['post_view'] = __( , 'wp-simple-post-view' );
    5254          return $columns;
    5355        }
  • wp-simple-post-view/trunk/includes/customFunctions.php

    r2978524 r3031710  
    11<?php
     2
     3
     4
    25// If check class exists.
    36if ( ! class_exists( 'NGD_wpSimplePostView_Admin_AddMetaBox' ) ) {
     
    1619        public static function ngd_postViewAddMetaBoxFun() {
    1720            global $post;
    18 
    19             if(get_post_type($post->ID) == 'post') {
    20                    
    21                     $postView = __( 'Post View', 'wp-simple-post-view' );
    22 
    23                     add_meta_box(
    24                         'add_post_view',           // Unique ID
    25                         $postView,  // Box title
    26                         array( 'NGD_wpSimplePostView_Admin_AddMetaBox', 'ngd_addPostViewMetaBoxHTMLFun'),  // Content callback, must be of type callable
    27                         'post',                   // Post type
    28                         'side'
    29                     );
     21            if( get_post_type($post->ID) == 'post' ) {                 
     22                $postView = __( 'Post View', 'wp-simple-post-view' );
     23                add_meta_box(
     24                    'add_post_view', // Unique ID
     25                    $postView,  // Box title
     26                    array( 'NGD_wpSimplePostView_Admin_AddMetaBox', 'ngd_addPostViewMetaBoxHTMLFun'),  // Content callback, must be of type callable
     27                    'post', // Post type
     28                    'side'
     29                );
    3030            }
    3131        }
  • wp-simple-post-view/trunk/includes/postSimplePostView.php

    r2862108 r3031710  
    11<?php
     2
     3
     4
    25// If check class exists.
    36if ( ! class_exists( 'NGD_wpSimplePostView' ) ) {
     
    4043        public function ngd_insertProcessPostviewFun() {
    4144           
    42             global $user_ID, $post;
    43            
     45            global $user_ID, $post;         
    4446           
    4547            if ( is_int( $post ) ) {
     
    103105
    104106            global $user_ID, $post;
    105 
    106             if(get_post_type($post->ID) != 'post') {
     107            if( get_post_type($post->ID) != 'post' ) {
    107108                return;
    108109            }
  • wp-simple-post-view/trunk/readme.txt

    r3026441 r3031710  
    33Tags: Post View Count, Page View Count,Custom post type View Count, Easy Post Views Count, post count, post views, custom post views, count, view, postviews, counter
    44Requires at least: 4.5
    5 Tested up to: 6.4.2
    6 Stable tag: 1.8.4
     5Tested up to: 6.4.
     6Stable tag:
    77Author: Naresh Parmar
    88Author URI: https://profiles.wordpress.org/nareshparmar827/
    99Plugin URI: https://wordpress.org/plugins/wp-simple-post-view/
    10 Version: 1.8.4
     10Version:
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7777* Bug Fix
    7878
     79
     80
     81
    7982
    8083== Screenshots ==
  • wp-simple-post-view/trunk/wp-simple-post-view.php

    r2978526 r3031710  
    11<?php
    22/*
    3  * Plugin Name:     Post View Count
    4  * Description:     Using this plugin, see how many views your posts have. [ngd-single-post-view] OR [ngd-single-post-view id="post_id"]
    5  * Text Domain:     wp-simple-post-view
    6  * Domain Path:     /languages
    7  * Version:     1.8.4
    8  * WordPress URI:   https://wordpress.org/plugins/wp-simple-post-view/
    9  * Plugin URI:      https://wordpress.org/plugins/wp-simple-post-view/
    10  * Contributors:    nareshparmar827, dipakparmar443
    11  * Author:      Naresh Parmar
    12  * Author URI:      https://profiles.wordpress.org/nareshparmar827/
    13  * Donate Link:     https://www.paypal.me/NARESHBHAIPARMAR
    14  * License:     GPL-3.0
    15  * License URI:     https://www.gnu.org/licenses/gpl-3.0.html
    16  * @copyright:      Naresh Parmar
     3 * Plugin Name: Post View Count
     4 * Description: Using this plugin, see how many views your posts have. [ngd-single-post-view] OR [ngd-single-post-view id="post_id"]
     5 * Text Domain: wp-simple-post-view
     6 * Domain Path: /languages
     7 * Version: 2.0
     8 * Requires PHP: 7.2
     9 * Requires at least: 5.2
     10 * WordPress URI: https://wordpress.org/plugins/wp-simple-post-view/
     11 * Plugin URI: https://wordpress.org/plugins/wp-simple-post-view/
     12 * Contributors: nareshparmar827, dipakparmar443
     13 * Author: Naresh Parmar
     14 * Author URI: https://profiles.wordpress.org/nareshparmar827/
     15 * Donate Link: https://www.paypal.me/NARESHBHAIPARMAR
     16 * License: GPL-3.0
     17 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
     18 * Update URI: https://wordpress.org/plugins/wp-simple-post-view/
     19 * @copyright: Naresh Parmar
     20*/
     21
     22/*
     23{Post View Count} is free software: you can redistribute it and/or modify
     24it under the terms of the GNU General Public License as published by
     25the Free Software Foundation, either version 2 of the License, or
     26any later version.
     27
     28{Post View Count} is distributed in the hope that it will be useful,
     29but WITHOUT ANY WARRANTY; without even the implied warranty of
     30MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     31GNU General Public License for more details.
     32
     33You should have received a copy of the GNU General Public License
     34along with {Post View Count}. If not, see {https://www.gnu.org/licenses/gpl-3.0.html}.
    1735*/
    1836
    1937if ( ! defined( 'ABSPATH' ) ) {
    20     exit;
     38    exit;
    2139}
    2240
     
    2947if ( ! defined( 'NGD_WP_SIMPLE_POST_VIEW_BASENAME' ) ) {
    3048    define( 'NGD_WP_SIMPLE_POST_VIEW_BASENAME', plugin_basename( __FILE__ ) );
    31 }   
     49}
     50
    3251/**
    3352 * Plugin textdomain.
    3453 */
    35 
    36 add_action( 'plugins_loaded', 'ngd_wpSimplePostView_textdomain' );
    37 if ( ! function_exists( 'ngd_wpSimplePostView_textdomain' ) ) {
    38 
    39     function ngd_wpSimplePostView_textdomain() {
     54add_action( 'plugins_loaded', 'ngd_wp_simple_post_view_textdomain' );
     55if ( ! function_exists( 'ngd_wp_simple_post_view_textdomain' ) ) {
     56    function ngd_wp_simple_post_view_textdomain() {
    4057        load_plugin_textdomain( 'wp-simple-post-view', false, basename( dirname( __FILE__ ) ) . '/languages' );
    4158    }
    42 
    4359}
    4460
     
    4662 * Plugin activation.
    4763 */
    48 
    49 register_activation_hook( __FILE__, 'ngd_wpSimplePostViewActivation' );
    50 if ( ! function_exists( 'ngd_wpSimplePostViewActivation' ) ) {
    51 
    52     function ngd_wpSimplePostViewActivation() {
     64register_activation_hook( __FILE__, 'ngd_wp_simple_post_view_activation' );
     65if ( ! function_exists( 'ngd_wp_simple_post_view_activation' ) ) {
     66    function ngd_wp_simple_post_view_activation() {
    5367        // Activation code here.
    5468    }
    55 
    5669}
    5770
     
    5972 * Plugin deactivation.
    6073 */
    61 
    62 register_deactivation_hook( __FILE__, 'ngd_wpSimplePostViewDeactivation' );
    63 if ( ! function_exists( 'ngd_wpSimplePostViewDeactivation' ) ) {
    64 
    65     function ngd_wpSimplePostViewDeactivation() {
     74register_deactivation_hook( __FILE__, 'ngd_wp_simple_post_view_deactivation' );
     75if ( ! function_exists( 'ngd_wp_simple_post_view_deactivation' ) ) {
     76    function ngd_wp_simple_post_view_deactivation() {
    6677        // Deactivation code here.
    6778    }
    68 
    6979}
    7080
    71 require_once(NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . "includes/postSimplePostView.php");
    72 require_once(NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . "includes/customFunctions.php");
    73 require_once(NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . "includes/add_post_column.php");
     81require_once( NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . 'includes/postSimplePostView.php');
     82if ( is_admin() ) {
     83    // we are in admin mode
     84    require_once( NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . 'includes/customFunctions.php');
     85    require_once( NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . 'includes/add_post_column.php');
     86}
    7487
    7588add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'wp_simple_post_view_add_plugin_page_settings_link');
    7689function wp_simple_post_view_add_plugin_page_settings_link( $links ) {
    77     $links[] = '<a href="' .
    78         admin_url( 'admin.php?page=wp-spv' ) .
    79         '">' . __('Settings') . '</a>';
     90    $links[] = '<a href="' . admin_url( 'admin.php?page=wp-spv' ) . '">' . __('Settings') . '</a>';
    8091    return $links;
    8192}
    8293
    8394/**
    84  * Register a custom menu page.
     95 * Register a menu page.
    8596 */
    86 function wp_simple_post_view_register_my_custom_menu_page() {
    87     add_menu_page(
    88         __( 'Post View Settings', 'textdomain' ),
    89         'Post View Settings',
    90         'manage_options',
    91         'wp-spv',
    92         'wp_simple_post_view_settings',
    93         '');
    94 
     97function wp_simple_post_view_register_menu_page() {
     98    add_menu_page( __( 'Post View Settings', 'textdomain' ), __( 'Post View Settings', 'textdomain' ), 'manage_options', 'wp-spv', 'wp_simple_post_view_settings', '' );
    9599    add_action( 'admin_init', 'register_wp_simple_post_view_settings' );
    96100}
    97 add_action( 'admin_menu', 'wp_simple_post_view_register_my_custom_menu_page' );
     101add_action( 'admin_menu', 'wp_simple_post_view_register_menu_page' );
    98102
    99103function register_wp_simple_post_view_settings() {
    100     //register our settings
    101104    register_setting( 'wp-simple-post-view-settings-group', 'wp_simple_post_view_text' );
    102105}
     
    104107function wp_simple_post_view_settings(){
    105108
    106     if( isset( $_REQUEST['wp-spv-save-settings'] ) && isset( $_REQUEST['page'] ) ){     
     109    if( isset( $_ST['page'] ) ){       
    107110        global $wpdb;
    108111        $q = "DELETE  FROM {$wpdb->prefix}postmeta WHERE meta_key='post_view' or meta_key='is_post_view'";
     
    125128    <div class="wrap">
    126129        <h1><?php _e( 'Post View Count Settings', 'wp-simple-post-view' ); ?></h1>
    127         <form method="POST" action="<?php echo admin_url( 'admin.php?page=wp-spv' ); ?>" onclick="return yes_no();">           
     130        <form method="POST" action="<?php echo admin_url( 'admin.php?page=wp-spv' ); ?>" onclick="return yes_no();">       
    128131            <?php submit_button( __( 'Reset Post view Data', 'wp-simple-post-view' ), 'primary', 'wp-spv-save-settings' ); ?>
    129132        </form>
     
    141144        </script>
    142145    </div>
    143 
    144146    <div class="wrap">
    145         <h1>Text Edit Settings</h1>
    146 
     147        <h1><?php _e( 'Text Edit Settings', 'wp-simple-post-view' ); ?></h1>
    147148        <form method="post" action="options.php">
    148149            <?php settings_fields( 'wp-simple-post-view-settings-group' ); ?>
    149150            <?php do_settings_sections( 'wp-simple-post-view-settings-group' ); ?>
    150             <input name="form_nonce" type="hidden" value="<?=wp_create_nonce('test-nonce')?>" />
    151151            <table class="form-table">
    152152                <tr valign="top">
    153                 <th scope="row">Post View Text</th>
    154                
    155                 <?php $wp_simple_post_view_text = esc_attr( get_option('wp_simple_post_view_text') );
    156                 if( empty( $wp_simple_post_view_text ) ) {
    157                     $wp_simple_post_view_text = 'Post View';
    158                 }
     153                <th scope="row">
     154               
     155        $wp_simple_post_view_text = esc_attr( get_option('wp_simple_post_view_text') );
     156                if( empty( $wp_simple_post_view_text ) ) {
     157        ;
     158                }
    159159                ?>
    160160                <td><input type="text" style="width: 60%;" name="wp_simple_post_view_text" value="<?php echo $wp_simple_post_view_text; ?>" /></td>
    161                 </tr>
    162                
    163             </table>
    164            
     161                </tr>               
     162            </table>           
    165163            <?php submit_button(); ?>
    166 
    167164        </form>
    168         </div>
     165    </div>
    169166    <?php
    170167}
Note: See TracChangeset for help on using the changeset viewer.