update(
$wpdb->prefix.'a2g_tm_kategorie',
array(
'catDesc' => $a2g_new_kat_content,
'catSort' => $a2g_update_kategorie_sort
),
array( 'catID' => $a2g_update_kategorie_id ), array( '%s', '%d' ),
array( '%d' )
);
$a2g_tm_message_out = __('
');
}
// Handle EDIT Text
if($_GET['action']=="updatetext" AND (is_admin())) {
$a2g_new_text_content = sanitize_text_field( htmlentities( $_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'
)
);
$a2g_tm_message_out = __('');
}
// Handle EDIT Output CSS
if($_GET['action']=="editoutcss" AND (is_admin())) {
$a2g_new_css_content = sanitize_text_field( htmlentities( $_POST["css-output"] ));
update_option( 'a2g_tm_output_css', $a2g_new_css_content, $autoload );
$a2g_tm_message_out = __('');
}
// 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
'';
} else {
$a2g_tm_message_out =
'';
}
}
// Handle DEL Document
if($_GET['action']=="deldocument" AND (is_admin())) {
$a2g_tm_get_document_to_del = esc_url( $_GET['path'] );
unlink($a2g_tm_get_document_to_del);
$a2g_tm_message_out =
'';
}
// 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) {
$a2g_tm_message_out =
'';
} else {
$a2g_tm_message_out =
'';
}
}
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'] );
$a2g_filter_input_catsort = a2g_tm_get_highest_cat_sort()+1;
$wpdb->insert($table,
array('catID' => '',
'catName' => $a2g_filter_input_catname,
'catDesc' => $a2g_filter_input_catdesc,
'catSort' => $a2g_filter_input_catsort
));
$a2g_tm_message_out = '';
}
// 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
));
$a2g_tm_message_out = '';
}
}
// create selectlist for categorys
global $wpdb;
$a2g_text_kats = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."a2g_tm_kategorie");
$a2g_out_kat .= '';
if(empty($a2g_text_kats)) {
$a2g_out_kat = "".__( 'Noch keine Kategorien angelegt', 'ada2go-text-modules' )."";
$a2g_tm_kat_exist = false;
}
?>
' );
$a2g_tm_get_editcat = a2g_tm_edit_cat_by_catid( $a2g_tm_get_id );
echo wp_editor( html_entity_decode( $a2g_tm_get_editcat ), 'edit-kat' );
echo __( '
Sortierung:
' );
}
if($_GET["action"]=="edittext") {
// Get the Text ID
$a2g_tm_get_id = sanitize_text_field( $_GET["id"] );
echo __( '