sprintf( '' . __( 'Purge from cache', 'w3-total-cache' ) . '', Util_Nonce::admin_nonce_url( sprintf( 'admin.php?page=w3tc_dashboard&w3tc_flush_post&post_id=%d&force=true', $post->ID ), 'w3tc_flush_post' ) ), ) ); } return $actions; } /** * Filter for page_row_actions * * @param array $actions Actions. * @param object $post Post. * * @return array */ public function page_row_actions( $actions, $post ) { $capability = apply_filters( 'w3tc_capability_row_action_w3tc_flush_post', 'manage_options' ); /** * Floor the filterable cap at manage_options to prevent a * downstream filter from exposing the row action to non-admins *. * * @since 2.10.0 */ if ( empty( $capability ) || ! \current_user_can( 'manage_options' ) ) { return $actions; } if ( current_user_can( $capability ) ) { $actions = array_merge( $actions, array( 'w3tc_flush_post' => sprintf( '' . __( 'Purge from cache', 'w3-total-cache' ) . '', Util_Nonce::admin_nonce_url( sprintf( 'admin.php?page=w3tc_dashboard&w3tc_flush_post&post_id=%d&force=true', $post->ID ), 'w3tc_flush_post' ) ), ) ); } return $actions; } /** * Display Purge from cache on Page/Post post.php. * * @return void */ public function post_submitbox_start() { if ( current_user_can( 'manage_options' ) ) { global $post; if ( ! is_null( $post ) ) { $w3tc_url = Util_Ui::url( array( 'page' => 'w3tc_dashboard', 'w3tc_flush_post' => 'y', 'post_id' => $post->ID, 'force' => true, ) ); printf( '
', esc_url( $w3tc_url ), esc_html__( 'Purge from cache', 'w3-total-cache' ) ); } } } }