| @@ -60,9 +60,9 @@ | ||
| 60 | 60 | |
| 61 | 61 | $post_types = wp_filter_object_list( $wp_post_types, array(), null, 'label' ); |
| 62 | 62 | $post_types = array_diff_key( $post_types, array_flip( $this->get_excluded_post_types() ) ); |
| 63 | 63 | |
| 64 | - add_action( 'registered_post_type', array( $this, '_registered_post_type' ), 10, 2 ); | |
| 64 | + add_action( 'registered_post_type', array( $this, 'registered_post_type' ), 10, 2 ); | |
| 65 | 65 | |
| 66 | 66 | return $post_types; |
| 67 | 67 | } |
| 68 | 68 | |
| @@ -70,9 +70,9 @@ | ||
| 70 | 70 | * Add action links to Stream drop row in admin list screen |
| 71 | 71 | * |
| 72 | 72 | * @filter wp_stream_action_links_{connector} |
| 73 | 73 | * |
| 74 | - * @param array $links Previous links registered | |
| 74 | + * @param array $links Previous links registered | |
| 75 | 75 | * @param Record $record Stream record |
| 76 | 76 | * |
| 77 | 77 | * @return array Action links |
| 78 | 78 | */ |
| @@ -104,14 +104,18 @@ | ||
| 104 | 104 | ), |
| 105 | 105 | sprintf( 'delete-post_%d', $post->ID ) |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | + // translators: Placeholder refers to a post type singular name (e.g. "Post") | |
| 108 | 109 | $links[ sprintf( esc_html_x( 'Restore %s', 'Post type singular name', 'stream' ), $post_type_name ) ] = $untrash; |
| 110 | + // translators: Placeholder refers to a post type singular name (e.g. "Post") | |
| 109 | 111 | $links[ sprintf( esc_html_x( 'Delete %s Permenantly', 'Post type singular name', 'stream' ), $post_type_name ) ] = $delete; |
| 110 | 112 | } else { |
| 113 | + // translators: Placeholder refers to a post type singular name (e.g. "Post") | |
| 111 | 114 | $links[ sprintf( esc_html_x( 'Edit %s', 'Post type singular name', 'stream' ), $post_type_name ) ] = get_edit_post_link( $post->ID ); |
| 112 | 115 | |
| 113 | - if ( $view_link = get_permalink( $post->ID ) ) { | |
| 116 | + $view_link = get_permalink( $post->ID ); | |
| 117 | + if ( $view_link ) { | |
| 114 | 118 | $links[ esc_html__( 'View', 'stream' ) ] = $view_link; |
| 115 | 119 | } |
| 116 | 120 | |
| 117 | 121 | $revision_id = absint( $record->get_meta( 'revision_id', true ) ); |
| @@ -126,9 +130,9 @@ | ||
| 126 | 130 | return $links; |
| 127 | 131 | } |
| 128 | 132 | |
| 129 | 133 | /** |
| 130 | - * Catch registeration of post_types after initial loading, to cache its labels | |
| 134 | + * Catch registration of post_types after initial loading, to cache its labels | |
| 131 | 135 | * |
| 132 | 136 | * @action registered_post_type |
| 133 | 137 | * |
| 134 | 138 | * @param string $post_type Post type slug |
| @@ -133,9 +137,9 @@ | ||
| 133 | 137 | * |
| 134 | 138 | * @param string $post_type Post type slug |
| 135 | 139 | * @param array $args Arguments used to register the post type |
| 136 | 140 | */ |
| 137 | - public function _registered_post_type( $post_type, $args ) { | |
| 141 | + public function registered_post_type( $post_type, $args ) { | |
| 138 | 142 | unset( $args ); |
| 139 | 143 | |
| 140 | 144 | $post_type_obj = get_post_type_object( $post_type ); |
| 141 | 145 | $label = $post_type_obj->label; |
| @@ -147,10 +151,10 @@ | ||
| 147 | 151 | * Log all post status changes ( creating / updating / trashing ) |
| 148 | 152 | * |
| 149 | 153 | * @action transition_post_status |
| 150 | 154 | * |
| 151 | - * @param mixed $new | |
| 152 | - * @param mixed $old | |
| 155 | + * @param mixed $new | |
| 156 | + * @param mixed $old | |
| 153 | 157 | * @param \WP_Post $post |
| 154 | 158 | */ |
| 155 | 159 | public function callback_transition_post_status( $new, $old, $post ) { |
| 156 | 160 | if ( in_array( $post->post_type, $this->get_excluded_post_types(), true ) ) { |
| @@ -161,8 +165,9 @@ | ||
| 161 | 165 | return; |
| 162 | 166 | } elseif ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
| 163 | 167 | return; |
| 164 | 168 | } elseif ( 'draft' === $new && 'publish' === $old ) { |
| 169 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 165 | 170 | $summary = _x( |
| 166 | 171 | '"%1$s" %2$s unpublished', |
| 167 | 172 | '1: Post title, 2: Post type singular name', |
| 168 | 173 | 'stream' |
| @@ -167,8 +172,9 @@ | ||
| 167 | 172 | '1: Post title, 2: Post type singular name', |
| 168 | 173 | 'stream' |
| 169 | 174 | ); |
| 170 | 175 | } elseif ( 'trash' === $old && 'trash' !== $new ) { |
| 176 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 171 | 177 | $summary = _x( |
| 172 | 178 | '"%1$s" %2$s restored from trash', |
| 173 | 179 | '1: Post title, 2: Post type singular name', |
| 174 | 180 | 'stream' |
| @@ -174,8 +180,9 @@ | ||
| 174 | 180 | 'stream' |
| 175 | 181 | ); |
| 176 | 182 | $action = 'untrashed'; |
| 177 | 183 | } elseif ( 'draft' === $new && 'draft' === $old ) { |
| 184 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 178 | 185 | $summary = _x( |
| 179 | 186 | '"%1$s" %2$s draft saved', |
| 180 | 187 | '1: Post title, 2: Post type singular name', |
| 181 | 188 | 'stream' |
| @@ -180,8 +187,9 @@ | ||
| 180 | 187 | '1: Post title, 2: Post type singular name', |
| 181 | 188 | 'stream' |
| 182 | 189 | ); |
| 183 | 190 | } elseif ( 'publish' === $new && 'draft' === $old ) { |
| 191 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 184 | 192 | $summary = _x( |
| 185 | 193 | '"%1$s" %2$s published', |
| 186 | 194 | '1: Post title, 2: Post type singular name', |
| 187 | 195 | 'stream' |
| @@ -186,8 +194,9 @@ | ||
| 186 | 194 | '1: Post title, 2: Post type singular name', |
| 187 | 195 | 'stream' |
| 188 | 196 | ); |
| 189 | 197 | } elseif ( 'draft' === $new ) { |
| 198 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 190 | 199 | $summary = _x( |
| 191 | 200 | '"%1$s" %2$s drafted', |
| 192 | 201 | '1: Post title, 2: Post type singular name', |
| 193 | 202 | 'stream' |
| @@ -192,8 +201,9 @@ | ||
| 192 | 201 | '1: Post title, 2: Post type singular name', |
| 193 | 202 | 'stream' |
| 194 | 203 | ); |
| 195 | 204 | } elseif ( 'pending' === $new ) { |
| 205 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 196 | 206 | $summary = _x( |
| 197 | 207 | '"%1$s" %2$s pending review', |
| 198 | 208 | '1: Post title, 2: Post type singular name', |
| 199 | 209 | 'stream' |
| @@ -198,8 +208,9 @@ | ||
| 198 | 208 | '1: Post title, 2: Post type singular name', |
| 199 | 209 | 'stream' |
| 200 | 210 | ); |
| 201 | 211 | } elseif ( 'future' === $new ) { |
| 212 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 202 | 213 | $summary = _x( |
| 203 | 214 | '"%1$s" %2$s scheduled for %3$s', |
| 204 | 215 | '1: Post title, 2: Post type singular name, 3: Scheduled post date', |
| 205 | 216 | 'stream' |
| @@ -204,8 +215,9 @@ | ||
| 204 | 215 | '1: Post title, 2: Post type singular name, 3: Scheduled post date', |
| 205 | 216 | 'stream' |
| 206 | 217 | ); |
| 207 | 218 | } elseif ( 'future' === $old && 'publish' === $new ) { |
| 219 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 208 | 220 | $summary = _x( |
| 209 | 221 | '"%1$s" scheduled %2$s published', |
| 210 | 222 | '1: Post title, 2: Post type singular name', |
| 211 | 223 | 'stream' |
| @@ -210,8 +222,9 @@ | ||
| 210 | 222 | '1: Post title, 2: Post type singular name', |
| 211 | 223 | 'stream' |
| 212 | 224 | ); |
| 213 | 225 | } elseif ( 'private' === $new ) { |
| 226 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 214 | 227 | $summary = _x( |
| 215 | 228 | '"%1$s" %2$s privately published', |
| 216 | 229 | '1: Post title, 2: Post type singular name', |
| 217 | 230 | 'stream' |
| @@ -216,8 +229,9 @@ | ||
| 216 | 229 | '1: Post title, 2: Post type singular name', |
| 217 | 230 | 'stream' |
| 218 | 231 | ); |
| 219 | 232 | } elseif ( 'trash' === $new ) { |
| 233 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 220 | 234 | $summary = _x( |
| 221 | 235 | '"%1$s" %2$s trashed', |
| 222 | 236 | '1: Post title, 2: Post type singular name', |
| 223 | 237 | 'stream' |
| @@ -223,8 +237,9 @@ | ||
| 223 | 237 | 'stream' |
| 224 | 238 | ); |
| 225 | 239 | $action = 'trashed'; |
| 226 | 240 | } else { |
| 241 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 227 | 242 | $summary = _x( |
| 228 | 243 | '"%1$s" %2$s updated', |
| 229 | 244 | '1: Post title, 2: Post type singular name', |
| 230 | 245 | 'stream' |
| @@ -288,9 +303,9 @@ | ||
| 288 | 303 | public function callback_deleted_post( $post_id ) { |
| 289 | 304 | $post = get_post( $post_id ); |
| 290 | 305 | |
| 291 | 306 | // We check if post is an instance of WP_Post as it doesn't always resolve in unit testing |
| 292 | - if ( ! ( $post instanceof \WP_Post ) || in_array( $post->post_type, $this->get_excluded_post_types(), true ) ) { | |
| 307 | + if ( ! ( $post instanceof \WP_Post ) || in_array( $post->post_type, $this->get_excluded_post_types(), true ) ) { | |
| 293 | 308 | return; |
| 294 | 309 | } |
| 295 | 310 | |
| 296 | 311 | // Ignore auto-drafts that are deleted by the system, see issue-293 |
| @@ -300,8 +315,9 @@ | ||
| 300 | 315 | |
| 301 | 316 | $post_type_name = strtolower( $this->get_post_type_name( $post->post_type ) ); |
| 302 | 317 | |
| 303 | 318 | $this->log( |
| 319 | + // translators: Placeholders refer to a post title, and a post type singular name (e.g. "Hello World", "Post") | |
| 304 | 320 | _x( |
| 305 | 321 | '"%1$s" %2$s deleted from trash', |
| 306 | 322 | '1: Post title, 2: Post type singular name', |
| 307 | 323 | 'stream' |
| @@ -352,9 +368,9 @@ | ||
| 352 | 368 | |
| 353 | 369 | /** |
| 354 | 370 | * Get an adjacent post revision ID |
| 355 | 371 | * |
| 356 | - * @param int $revision_id | |
| 372 | + * @param int $revision_id | |
| 357 | 373 | * @param bool $previous |
| 358 | 374 | * |
| 359 | 375 | * @return int $revision_id |
| 360 | 376 | */ |