PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3.8
Post Views Counter v1.3.8
1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.2 1.3.2.1 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9
post-views-counter / includes / class-functions.php
post-views-counter / includes Last commit date
ajax.php 7 years ago class-admin.php 4 years ago class-columns.php 4 years ago class-counter.php 4 years ago class-crawler-detect.php 4 years ago class-cron.php 4 years ago class-dashboard.php 4 years ago class-frontend.php 4 years ago class-functions.php 4 years ago class-query.php 4 years ago class-settings-api.php 4 years ago class-settings.php 4 years ago class-update.php 4 years ago class-widgets.php 4 years ago columns.php 6 years ago counter.php 6 years ago crawler-detect.php 6 years ago cron.php 6 years ago dashboard.php 6 years ago frontend.php 6 years ago functions.php 4 years ago query.php 6 years ago settings.php 6 years ago update.php 6 years ago widgets.php 6 years ago
class-functions.php
71 lines
1 <?php
2 // exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) )
4 exit;
5
6 /**
7 * Post_Views_Counter_Functions class.
8 *
9 * @class Post_Views_Counter_Functions
10 */
11 class Post_Views_Counter_Functions {
12
13 /**
14 * Class constructor.
15 *
16 * @return void
17 */
18 public function __construct() {}
19
20 /**
21 * Get post types available for counting.
22 *
23 * @return array
24 */
25 public function get_post_types() {
26 $post_types = [];
27
28 // built in public post types
29 foreach ( get_post_types( [ '_builtin' => true, 'public' => true ], 'objects', 'and' ) as $key => $post_type ) {
30 $post_types[$key] = $post_type->labels->name;
31 }
32
33 // public custom post types
34 foreach ( get_post_types( [ '_builtin' => false, 'public' => true ], 'objects', 'and' ) as $key => $post_type ) {
35 $post_types[$key] = $post_type->labels->name;
36 }
37
38 // remove bbPress replies
39 if ( class_exists( 'bbPress' ) && isset( $post_types['reply'] ) )
40 unset( $post_types['reply'] );
41
42 // filter post types
43 $post_types = apply_filters( 'pvc_available_post_types', $post_types );
44
45 // sort post types alphabetically with their keys
46 asort( $post_types, SORT_STRING );
47
48 return $post_types;
49 }
50
51 /**
52 * Get all user roles.
53 *
54 * @global object $wp_roles
55 * @return array
56 */
57 public function get_user_roles() {
58 global $wp_roles;
59
60 $roles = [];
61
62 foreach ( apply_filters( 'editable_roles', $wp_roles->roles ) as $role => $details ) {
63 $roles[$role] = translate_user_role( $details['name'] );
64 }
65
66 // sort user roles alphabetically with their keys
67 asort( $roles, SORT_STRING );
68
69 return $roles;
70 }
71 }