update(
$wpdb->prefix.'a2g_tm_kategorie',
array(
'catDesc' => $a2g_new_kat_content
),
array(
'catID' => $a2g_update_kategorie_id
),
array(
'%s'
),
array( '%s'
)
);
echo __('
'.__('Erldigt! Alles gespeichert!', 'ada2go-text-modules').'
');
}
// Handle EDIT Text
if($_GET['action']=="updatetext" AND (is_admin())) {
$a2g_new_text_content = sanitize_text_field( $_POST["edit-text"]);
$a2g_update_text_id = sanitize_text_field( $_GET["id"] );
$wpdb->update(
$wpdb->prefix.'a2g_tm_text',
array(
'text' => $a2g_new_text_content
),
array(
'textID' => $a2g_update_text_id
),
array(
'%s'
),
array( '%s'
)
);
echo __('
'.__('Erldigt! Alles gespeichert!', 'ada2go-text-modules').'
');
}
// Handle DEL Kat
if($_GET['action']=="delcat" AND (is_admin())) {
$table = $wpdb->prefix . 'a2g_tm_kategorie';
if( $wpdb->delete( $table, array( 'catID' => $_GET['id'] ) ) === FALSE) {
echo
'
' . __( 'Das hat leider nicht geklappt!', 'ada2go-text-modules' ) . '
';
} else {
echo
'
' . __( 'Kategorie wurde erfolgreich gelöscht!', 'ada2go-text-modules' ) . '
';
}
}
// Handle DEL Text
if($_GET['action']=="deltext" AND (is_admin())) {
$table = $wpdb->prefix . 'a2g_tm_text';
if( $wpdb->delete( $table, array( 'textID' => $_GET['id'] ) ) === FALSE) {
echo
'
' . __( 'Das hat leider nicht geklappt!', 'ada2go-text-modules' ) . '
';
} else {
echo
'
' . __( 'Text wurde erfolgreich gelöscht!', 'ada2go-text-modules' ) . '
';
}
}
if($_POST AND (is_admin())) {
// Handle INSERT Cat
if($_GET['action']=="addcat") {
$table = $wpdb->prefix . 'a2g_tm_kategorie';
$a2g_filter_input_catdesc = stripslashes( $_POST['kat-desc'] );
$a2g_filter_input_catname = sanitize_text_field( $_POST['cat-name'] );
$wpdb->insert($table,
array('catID' => '',
'catName' => $a2g_filter_input_catname,
'catDesc' => $a2g_filter_input_catdesc
));
echo '
' . __( 'Kategorie wurde erfolgreich angelegt!', 'ada2go-text-modules' ) . '
';
}
// Handle INSERT Text
if($_GET['action']=="addtext") {
$table = $wpdb->prefix . 'a2g_tm_text';
$a2g_filter_input_textcatid = sanitize_text_field( $_POST['text-kategorie'] );
$a2g_filter_input_textname = stripslashes( $_POST['text-desc'] );
$a2g_filter_input_textident = sanitize_text_field( $_POST['text-ident'] );
$wpdb->insert($table,
array('textID' => '',
'catID' =>$a2g_filter_input_textcatid,
'text' => $a2g_filter_input_textname,
'text_ueberschrift' => $a2g_filter_input_textident
));
echo '
' . __( 'Text wurde erfolgreich angelegt!', 'ada2go-text-modules' ) . '
';
}
}
// create selectlist for categorys
global $wpdb;
$a2g_text_kats = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."a2g_tm_kategorie");
$a2g_out_kat .= '';
?>
' );
$a2g_tm_get_editcat = a2g_tm_edit_cat_by_catid($a2g_tm_get_id);
echo wp_editor( $a2g_tm_get_editcat, 'edit-kat' );
echo esc_html( '
' );
}
if($_GET["action"]=="edittext") {
// Get the Text ID
$a2g_tm_get_id = sanitize_text_field( $_GET["id"] );
echo esc_html( '