Changeset 3031710
- Timestamp:
- 02/05/2024 02:56:09 PM (6 months ago)
- 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 1 1 <?php 2 3 4 2 5 // If check class exists. 3 6 if ( ! class_exists( 'NGD_wpSimplePostView_Admin' ) ) { … … 22 25 23 26 $isPostCountExists = get_post_meta( 'post_view' ); 24 25 27 if( ! isset( $isPostCountExists ) && empty( $isPostCountExists ) ) { 26 28 return $vars; … … 46 48 $wp_simple_post_view_text = esc_attr( get_option('wp_simple_post_view_text') ); 47 49 if( empty( $wp_simple_post_view_text ) ) { 48 $wp_simple_post_view_text = 'Post View';50 $wp_simple_post_view_text = ; 49 51 } 50 52 51 $columns['post_view'] = __( $wp_simple_post_view_text, 'wp-simple-post-view' );53 $columns['post_view'] = __( , 'wp-simple-post-view' ); 52 54 return $columns; 53 55 } -
wp-simple-post-view/trunk/includes/customFunctions.php
r2978524 r3031710 1 1 <?php 2 3 4 2 5 // If check class exists. 3 6 if ( ! class_exists( 'NGD_wpSimplePostView_Admin_AddMetaBox' ) ) { … … 16 19 public static function ngd_postViewAddMetaBoxFun() { 17 20 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 ); 30 30 } 31 31 } -
wp-simple-post-view/trunk/includes/postSimplePostView.php
r2862108 r3031710 1 1 <?php 2 3 4 2 5 // If check class exists. 3 6 if ( ! class_exists( 'NGD_wpSimplePostView' ) ) { … … 40 43 public function ngd_insertProcessPostviewFun() { 41 44 42 global $user_ID, $post; 43 45 global $user_ID, $post; 44 46 45 47 if ( is_int( $post ) ) { … … 103 105 104 106 global $user_ID, $post; 105 106 if(get_post_type($post->ID) != 'post') { 107 if( get_post_type($post->ID) != 'post' ) { 107 108 return; 108 109 } -
wp-simple-post-view/trunk/readme.txt
r3026441 r3031710 3 3 Tags: 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 4 4 Requires at least: 4.5 5 Tested up to: 6.4. 26 Stable tag: 1.8.45 Tested up to: 6.4. 6 Stable tag: 7 7 Author: Naresh Parmar 8 8 Author URI: https://profiles.wordpress.org/nareshparmar827/ 9 9 Plugin URI: https://wordpress.org/plugins/wp-simple-post-view/ 10 Version: 1.8.410 Version: 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 77 77 * Bug Fix 78 78 79 80 81 79 82 80 83 == Screenshots == -
wp-simple-post-view/trunk/wp-simple-post-view.php
r2978526 r3031710 1 1 <?php 2 2 /* 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 24 it under the terms of the GNU General Public License as published by 25 the Free Software Foundation, either version 2 of the License, or 26 any later version. 27 28 {Post View Count} is distributed in the hope that it will be useful, 29 but WITHOUT ANY WARRANTY; without even the implied warranty of 30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 GNU General Public License for more details. 32 33 You should have received a copy of the GNU General Public License 34 along with {Post View Count}. If not, see {https://www.gnu.org/licenses/gpl-3.0.html}. 17 35 */ 18 36 19 37 if ( ! defined( 'ABSPATH' ) ) { 20 exit; 38 exit; 21 39 } 22 40 … … 29 47 if ( ! defined( 'NGD_WP_SIMPLE_POST_VIEW_BASENAME' ) ) { 30 48 define( 'NGD_WP_SIMPLE_POST_VIEW_BASENAME', plugin_basename( __FILE__ ) ); 31 } 49 } 50 32 51 /** 33 52 * Plugin textdomain. 34 53 */ 35 36 add_action( 'plugins_loaded', 'ngd_wpSimplePostView_textdomain' ); 37 if ( ! function_exists( 'ngd_wpSimplePostView_textdomain' ) ) { 38 39 function ngd_wpSimplePostView_textdomain() { 54 add_action( 'plugins_loaded', 'ngd_wp_simple_post_view_textdomain' ); 55 if ( ! function_exists( 'ngd_wp_simple_post_view_textdomain' ) ) { 56 function ngd_wp_simple_post_view_textdomain() { 40 57 load_plugin_textdomain( 'wp-simple-post-view', false, basename( dirname( __FILE__ ) ) . '/languages' ); 41 58 } 42 43 59 } 44 60 … … 46 62 * Plugin activation. 47 63 */ 48 49 register_activation_hook( __FILE__, 'ngd_wpSimplePostViewActivation' ); 50 if ( ! function_exists( 'ngd_wpSimplePostViewActivation' ) ) { 51 52 function ngd_wpSimplePostViewActivation() { 64 register_activation_hook( __FILE__, 'ngd_wp_simple_post_view_activation' ); 65 if ( ! function_exists( 'ngd_wp_simple_post_view_activation' ) ) { 66 function ngd_wp_simple_post_view_activation() { 53 67 // Activation code here. 54 68 } 55 56 69 } 57 70 … … 59 72 * Plugin deactivation. 60 73 */ 61 62 register_deactivation_hook( __FILE__, 'ngd_wpSimplePostViewDeactivation' ); 63 if ( ! function_exists( 'ngd_wpSimplePostViewDeactivation' ) ) { 64 65 function ngd_wpSimplePostViewDeactivation() { 74 register_deactivation_hook( __FILE__, 'ngd_wp_simple_post_view_deactivation' ); 75 if ( ! function_exists( 'ngd_wp_simple_post_view_deactivation' ) ) { 76 function ngd_wp_simple_post_view_deactivation() { 66 77 // Deactivation code here. 67 78 } 68 69 79 } 70 80 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"); 81 require_once( NGD_WP_SIMPLE_POST_VIEW_PLUGIN_DIR . 'includes/postSimplePostView.php'); 82 if ( 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 } 74 87 75 88 add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'wp_simple_post_view_add_plugin_page_settings_link'); 76 89 function 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>'; 80 91 return $links; 81 92 } 82 93 83 94 /** 84 * Register a custommenu page.95 * Register a menu page. 85 96 */ 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 97 function 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', '' ); 95 99 add_action( 'admin_init', 'register_wp_simple_post_view_settings' ); 96 100 } 97 add_action( 'admin_menu', 'wp_simple_post_view_register_m y_custom_menu_page' );101 add_action( 'admin_menu', 'wp_simple_post_view_register_menu_page' ); 98 102 99 103 function register_wp_simple_post_view_settings() { 100 //register our settings101 104 register_setting( 'wp-simple-post-view-settings-group', 'wp_simple_post_view_text' ); 102 105 } … … 104 107 function wp_simple_post_view_settings(){ 105 108 106 if( isset( $_ REQUEST['wp-spv-save-settings'] ) && isset( $_REQUEST['page'] ) ){109 if( isset( $_ST['page'] ) ){ 107 110 global $wpdb; 108 111 $q = "DELETE FROM {$wpdb->prefix}postmeta WHERE meta_key='post_view' or meta_key='is_post_view'"; … … 125 128 <div class="wrap"> 126 129 <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();"> 128 131 <?php submit_button( __( 'Reset Post view Data', 'wp-simple-post-view' ), 'primary', 'wp-spv-save-settings' ); ?> 129 132 </form> … … 141 144 </script> 142 145 </div> 143 144 146 <div class="wrap"> 145 <h1>Text Edit Settings</h1> 146 147 <h1><?php _e( 'Text Edit Settings', 'wp-simple-post-view' ); ?></h1> 147 148 <form method="post" action="options.php"> 148 149 <?php settings_fields( 'wp-simple-post-view-settings-group' ); ?> 149 150 <?php do_settings_sections( 'wp-simple-post-view-settings-group' ); ?> 150 <input name="form_nonce" type="hidden" value="<?=wp_create_nonce('test-nonce')?>" />151 151 <table class="form-table"> 152 152 <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 } 159 159 ?> 160 160 <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> 165 163 <?php submit_button(); ?> 166 167 164 </form> 168 165 </div> 169 166 <?php 170 167 }
Note: See TracChangeset
for help on using the changeset viewer.