PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3.10
Post Views Counter v1.3.10
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
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 functions.php 4 years ago
class-functions.php
66 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 // get public post types
29 foreach ( get_post_types( [ 'public' => true ], 'objects', 'and' ) as $key => $post_type ) {
30 $post_types[$key] = $post_type->labels->name;
31 }
32
33 // remove bbPress replies
34 if ( class_exists( 'bbPress' ) && isset( $post_types['reply'] ) )
35 unset( $post_types['reply'] );
36
37 // filter post types
38 $post_types = apply_filters( 'pvc_available_post_types', $post_types );
39
40 // sort post types alphabetically
41 asort( $post_types, SORT_STRING );
42
43 return $post_types;
44 }
45
46 /**
47 * Get all user roles.
48 *
49 * @global object $wp_roles
50 * @return array
51 */
52 public function get_user_roles() {
53 global $wp_roles;
54
55 $roles = [];
56
57 foreach ( apply_filters( 'editable_roles', $wp_roles->roles ) as $role => $details ) {
58 $roles[$role] = translate_user_role( $details['name'] );
59 }
60
61 // sort user roles alphabetically
62 asort( $roles, SORT_STRING );
63
64 return $roles;
65 }
66 }