G!A 1A G!A P1A @q6A 1A h A @q6A 1A H 7A p1A 7A p1A P 7A P1A 7A P1A u1A X u1A G!A (1,A @ 0A @ @ Ȭ0A 0A H u1A 8m1A Pb6A в1A ` `1A P1,A P1,A ` P1,A P1,A P x IA 1A @ h h IA 1A 8 0 0 IA 1A ` IA 1A p G!A P1A A @q6A 1A ` G!A P1A A @q6A 1A 0 ( خ P P IA 1A ( ( IA 1A P A ( l1A 7A u1A P G!A 1A 0 x X X IA 1A IA 1A ȯ IA 1A IA 1A FA A x ( G!A l1A ȕ P G!A (1,A FA 00A pgLA @ 00A h A 0A u1A ns::verifyNonce() ) {
unset( $_REQUEST['action'] );
unset( $_REQUEST[ rtTPG()->nonceId() ] );
unset( $_REQUEST['_wp_http_referer'] );
unset( $_REQUEST['uid'] );
update_option( rtTPG()->options['settings'], wp_unslash( $_REQUEST ) );
$response = [
'error' => false,
'msg' => esc_html__( 'Settings successfully updated', 'the-post-grid' ),
];
} else {
$response = [
'error' => $error,
'msg' => esc_html__( 'Session Error !!', 'the-post-grid' ),
];
}
wp_send_json( $response );
die();
}
/**
* Taxonomy list.
*
* @return void
*/
public function rtTPGTaxonomyListByPostType() {
$error = true;
$msg = $data = null;
$is_ok = true;
if ( ! current_user_can( 'edit_posts' ) ) {
$is_ok = false;
}
if ( ! Fns::verifyNonce() ) {
$is_ok = false;
}
if ( $is_ok ) {
$error = false;
$taxonomies = Fns::rt_get_all_taxonomy_by_post_type( $_REQUEST['post_type'] );
if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
$data .= Fns::rtFieldGenerator(
[
'tpg_taxonomy' => [
'type' => 'checkbox',
'label' => esc_html__( 'Taxonomy', 'the-post-grid' ),
'id' => 'post-taxonomy',
'multiple' => true,
'value' => isset( $_REQUEST['taxonomy'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['taxonomy'] ) ) : [],
'options' => $taxonomies,
],
]
);
} else {
$data = '
' . esc_html__( 'No Taxonomy found', 'the-post-grid' ) . '
';
}
} else {
$msg = esc_html__( 'Security error', 'the-post-grid' );
}
wp_send_json(
[
'error' => $error,
'msg' => $msg,
'data' => $data,
]
);
die();
}
/**
* Isotope Filter
*
* @return void
*/
public function rtTPGIsotopeFilter() {
$error = true;
$msg = $data = null;
$is_ok = true;
if ( ! current_user_can( 'edit_posts' ) ) {
$is_ok = false;
}
if ( ! Fns::verifyNonce() ) {
$is_ok = false;
}
if ( $is_ok ) {
$error = false;
$post_type = isset( $_REQUEST['post_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post_type'] ) ) : null;
$taxonomies = Fns::rt_get_taxonomy_for_filter( $post_type );
if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
foreach ( $taxonomies as $tKey => $tax ) {
$data .= '';
}
}
} else {
$msg = esc_html__( 'Security error', 'the-post-grid' );
}
wp_send_json(
[
'error' => $error,
'msg' => $msg,
'data' => $data,
]
);
die();
}
/**
* Term list
*
* @return void
*/
public function rtTPGTermListByTaxonomy() {
$error = true;
$msg = $data = null;
$is_ok = true;
if ( ! current_user_can( 'edit_posts' ) ) {
$is_ok = false;
}
if ( ! Fns::verifyNonce() ) {
$is_ok = false;
}
if ( $is_ok ) {
$error = false;
$taxonomy = isset( $_REQUEST['taxonomy'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['taxonomy'] ) ) : null;
$data .= "";
$data .= Fns::rtFieldGenerator(
[
'term_' . $taxonomy => [
'type' => 'select',
'label' => ucfirst( str_replace( '_', ' ', $taxonomy ) ),
'class' => 'rt-select2 full',
'id' => 'term-' . wp_rand(),
'holderClass' => "term-filter-item {$taxonomy}",
'value' => null,
'multiple' => true,
'options' => Fns::rt_get_all_term_by_taxonomy( $taxonomy ),
],
]
);
$data .= Fns::rtFieldGenerator(
[
'term_operator_' . $taxonomy => [
'type' => 'select',
'label' => esc_html__( 'Operator', 'the-post-grid' ),
'class' => 'rt-select2 full',
'holderClass' => "term-filter-item-operator {$taxonomy}",
'options' => Options::rtTermOperators(),
],
]
);
$data .= '
';
} else {
$msg = esc_html__( 'Security error', 'the-post-grid' );
}
wp_send_json(
[
'error' => $error,
'msg' => $msg,
'data' => $data,
]
);
die();
}
/**
* Shortcode list
*
* @return void
*/
public function shortCodeList() {
$is_ok = true;
if ( ! current_user_can( 'edit_posts' ) ) {
$is_ok = false;
}
if ( $is_ok ) {
$html = null;
$scQ = new \WP_Query(
apply_filters(
'tpg_sc_list_query_args',
[
'post_type' => rtTPG()->post_type,
'order_by' => 'title',
'order' => 'DESC',
'post_status' => 'publish',
'posts_per_page' => - 1,
]
)
);
if ( $scQ->have_posts() ) {
$html .= "';
} else {
$html .= '' . esc_html__( 'No shortCode found.', 'the-post-grid' ) . '
';
}
Fns::print_html( $html, true );
} else {
echo esc_html__( 'Security error', 'the-post-grid' );
}
die();
}
}