PluginProbe ʕ •ᴥ•ʔ
Admin Columns / 7.1.4
Admin Columns v7.1.4
7.1.4 7.0.19 2.3.5 2.4 2.4.1 2.4.10 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.6.1 2.5.6.2 2.5.6.3 2.5.6.4 3.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.7 3.1 3.1.1 3.1.10 3.1.2 3.1.3 3.1.5 3.2.3 3.2.7 3.3.1 3.4.1 3.4.6 3.4.8 4.0.1 4.0.3 4.1.6 4.2.2 4.2.5 4.3 4.3.2 4.4.1 4.4.4 4.4.5 4.5.5 4.6.1 4.7.18 4.7.19 4.7.20 4.7.7 7.0.13 7.0.14 7.0.16 trunk 1.0 1.1 1.1.3 1.2 1.2.1 1.3 1.3.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.5.1 1.4.6 1.4.6.1 1.4.6.2 1.4.6.3 1.4.6.4 1.4.7 1.4.8 1.4.9 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.1.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.5.1 2.2.6 2.2.6.1 2.2.6.2 2.2.6.3 2.2.6.4 2.2.7 2.2.8 2.2.8.1 2.2.9 2.3.1 2.3.2 2.3.3
codepress-admin-columns / classes / Helper / Post.php
codepress-admin-columns / classes / Helper Last commit date
Image 2 days ago Select 2 days ago Arrays.php 2 days ago AvailableTranslations.php 2 days ago Creatable.php 2 days ago Dashicon.php 2 days ago Date.php 2 days ago Html.php 2 days ago Icon.php 2 days ago Image.php 2 days ago LocalFile.php 2 days ago Mbstring.php 2 days ago MediaIdResolver.php 2 days ago Menu.php 2 days ago Network.php 2 days ago Post.php 2 days ago Strings.php 2 days ago Taxonomy.php 2 days ago User.php 2 days ago UserRoles.php 2 days ago WpDateFormat.php 2 days ago
Post.php
73 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AC\Helper;
6
7 use AC\Formatter\Post\PostStatusIcon;
8 use AC\Type\Value;
9 use WP_Post;
10
11 class Post extends Creatable
12 {
13 /**
14 * @param string[]|null $post_types
15 * @param string[]|null $post_stati
16 */
17 public function count_user_posts(int $user_id, ?array $post_types = null, ?array $post_stati = null): int
18 {
19 global $wpdb;
20
21 $where = ['post_author = %d'];
22 $params = [$user_id];
23
24 if ($post_stati) {
25 $where[] = sprintf('post_status IN (%s)', implode(',', array_fill(0, count($post_stati), '%s')));
26 $params = array_merge($params, array_values($post_stati));
27 }
28 if ($post_types) {
29 $where[] = sprintf('post_type IN (%s)', implode(',', array_fill(0, count($post_types), '%s')));
30 $params = array_merge($params, array_values($post_types));
31 }
32
33 $sql = sprintf("SELECT COUNT(*) FROM $wpdb->posts WHERE %s", implode(' AND ', $where));
34
35 return (int)$wpdb->get_var($wpdb->prepare($sql, $params));
36 }
37
38 /**
39 * @deprecated 7.0.13 Use get_post_field( $field, $id, 'raw' ) instead.
40 */
41 public function get_raw_field(string $field, int $id): ?string
42 {
43 _deprecated_function(__METHOD__, '7.0.13', "get_post_field( \$field, \$id, 'raw' )");
44
45 $value = get_post_field($field, $id, 'raw');
46
47 return is_string($value) && '' !== $value
48 ? $value
49 : null;
50 }
51
52 /*
53 * @deprecated since 7.0.9
54 */
55 public function get_status_icon(WP_Post $post): ?string
56 {
57 _deprecated_function(__METHOD__, '7.0.9');
58
59 return (string)(new PostStatusIcon())->format(new Value($post->ID, $post));
60 }
61
62 /*
63 * @deprecated since 7.0.9
64 */
65 public function get_title(): string
66 {
67 _deprecated_function(__METHOD__, '7.0.9');
68
69 return '';
70 }
71
72 }
73