'array', 'sanitize_callback' => 'swapfeed_sanitize_settings', 'default' => swapfeed_default_settings(), ) ); } ); function swapfeed_sanitize_settings( $in ) { $d = swapfeed_default_settings(); $in = is_array( $in ) ? $in : array(); $out = array(); $out['per_page'] = max( 1, min( 48, absint( isset( $in['per_page'] ) ? $in['per_page'] : $d['per_page'] ) ) ); $out['columns'] = max( 1, min( 6, absint( isset( $in['columns'] ) ? $in['columns'] : $d['columns'] ) ) ); $out['excerpt_words'] = max( 5, min( 80, absint( isset( $in['excerpt_words'] ) ? $in['excerpt_words'] : $d['excerpt_words'] ) ) ); $out['radius'] = max( 0, min( 40, absint( isset( $in['radius'] ) ? $in['radius'] : $d['radius'] ) ) ); $pt = sanitize_key( isset( $in['post_type'] ) ? $in['post_type'] : 'post' ); $out['post_type'] = post_type_exists( $pt ) ? $pt : 'post'; foreach ( array( 'show_image', 'show_excerpt', 'show_date', 'show_term', 'allow_term', 'show_hint', 'stats' ) as $k ) { $out[ $k ] = empty( $in[ $k ] ) ? 0 : 1; } $out['accent'] = sanitize_hex_color( isset( $in['accent'] ) ? $in['accent'] : '' ) ?: $d['accent']; foreach ( array( 'label_dismiss', 'label_hint', 'label_more' ) as $k ) { $out[ $k ] = sanitize_text_field( isset( $in[ $k ] ) ? $in[ $k ] : '' ); } return $out; } function swapfeed_admin_page() { $tab = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'settings'; // phpcs:ignore WordPress.Security.NonceVerification $base = admin_url( 'options-general.php?page=swapfeed' ); ?>
[swapfeed]
count="12" | |
columns="3" | |
post_type="post" | |
category="news,reviews" | |
tag="apple" | |
exclude="12,34" | |
offset="5" | |
filters="yes" | |
image / excerpt / date / term="no" | |
allow_term="no" | |
title="Latest" |
Mario Fajt' ) ); ?>