Plugin Directory

Changeset 2568446

Timestamp:
07/20/2021 05:57:24 PM (3 years ago)
Author:
ada2go
Message:

Update to Version 1.4:

  • A bug has been fixed where in edit mode a click anywhere submitted the form
  • The "Sort" Row was added in "Edit Categorys" Table
  • You can change the Sort by edit the category
  • The Sort is simple and easy to use: Just insert a sort number, the lowest number is on the top
  • Change the view of "Category" Row in "Text edit" -> Now you see the Category Name, not the ID
  • I have add the delete-option for ducuments
  • Fixed a wrong output of html at the shortcode-site
  • Add sort option to categorys for output
Location:
ada2go-text-modules
Files:
9 added
4 edited

Legend:

Unmodified
Added
Removed
  • ada2go-text-modules/trunk/a2g_tm_result.php

    r2566592 r2568446  
    1414foreach ($_POST as $key => $value) {
    1515    $a2g_catid_textid = explode(",",$value);
    16     echo a2g_tm_get_text_by_textid($a2g_catid_textid[1]);
     16    echo );
    1717    echo "<br><br>";
    1818}
  • ada2go-text-modules/trunk/ada2go-text-modules.php

    r2566601 r2568446  
    2121    if($_GET["action"]=="result") { include "a2g_tm_result.php"; } else {
    2222      $a2g_tm_built_return .= "<form action=\"".get_permalink()."?action=result\" method=\"post\" target=\"_blank\">";
    23       $a2g_tm_get_categorys =   $wpdb->get_results("SELECT *  FROM ".$wpdb->prefix."a2g_tm_kategorie");
     23      $a2g_tm_get_categorys =   $wpdb->get_results("SELECT *  FROM ".$wpdb->prefix."a2g_tm_kategorie");
    2424      foreach ( $a2g_tm_get_categorys as $a2g_tm_get_category ) {
    25       $a2g_tm_built_return .= "<h2>".$a2g_tm_get_category->catName."</h2><small>".$a2g_tm_get_category->catDesc."</small><br><br>";
     25      $a2g_tm_built_return .= "<h2>".$a2g_tm_get_category->catName."</h2><small>".."</small><br><br>";
    2626      $a2g_tm_get_texts =   $wpdb->get_results("SELECT *  FROM ".$wpdb->prefix."a2g_tm_text WHERE catID = ".$a2g_tm_get_category->catID."");
    2727        $count = 0;
     
    8989              `catID` INT(11) NOT NULL AUTO_INCREMENT,
    9090              `catName` VARCHAR(255) NOT NULL,
    91               `catDesc` TEXT NOT NULL , 
     91              `catDesc` TEXT NOT NULL ,
     92              `catSort` TEXT NOT NULL ,
    9293              PRIMARY KEY (`catID`)
    9394              ) $charset_collate;
     
    114115    function a2g_tm_while_categorys() {
    115116    global $wpdb;
    116       $a2g_tm_get_categorys =   $wpdb->get_results("SELECT *  FROM ".$wpdb->prefix."a2g_tm_kategorie");
     117      $a2g_tm_get_categorys =   $wpdb->get_results("SELECT *  FROM ".$wpdb->prefix."a2g_tm_kategorie");
    117118      foreach ( $a2g_tm_get_categorys as $a2g_tm_get_category ) {
    118119        $a2g_built_category_table .= '<tr>
     
    124125        'l&ouml;schen', 'ada2go-text-modules' ) . '</a> | <a href="options-general.php?page=a2g_tm_settings&action=editkat&id='.$a2g_tm_get_category->catID.'">'. __(
    125126        'bearbeiten', 'ada2go-text-modules' ) .'</a></td>
    126         <td>' . $a2g_tm_get_category->catDesc . '</td></tr>';
     127        <td>' . $a2g_tm_get_category->catDesc . '</td>
     128        <td>' . $a2g_tm_get_category->catSort . '</td></tr>';
    127129      }
    128130      return $a2g_built_category_table;
     
    145147        'l&ouml;schen', 'ada2go-text-modules' ).'</a> | <a href="options-general.php?page=a2g_tm_settings&action=edittext&id='.$a2g_tm_get_text->textID.'">'. __(
    146148        'bearbeiten', 'ada2go-text-modules' ) . '</a></td>
    147         <td>' . $a2g_tm_get_text->catID . '</td></tr>';
     149        <td>' . . '</td></tr>';
    148150      }
    149151      return $a2g_built_text_table;
     
    163165            $path = parse_url($file, PHP_URL_PATH);
    164166            $path = basename($path);
    165             echo "<tr><td>Pfad: ".$file." <br><a href='../wp-content/plugins/ada2go-text-modules/reslut-safes/". $path . "' target='_blank'>Datei &ouml;ffnen</a> | <a href=\"#\">Datei l&ouml;schen</a>" . "</td></tr>";
     167            echo "<tr><td>Pfad: ".$file." <br><a href='../wp-content/plugins/ada2go-text-modules/reslut-safes/". $path . "' target='_blank'>Datei &ouml;ffnen</a> | <a href=\"\">Datei l&ouml;schen</a>" . "</td></tr>";
    166168        } 
    167169    return;
     
    175177      global $wpdb;
    176178      $a2g_the_text = $wpdb->get_var("SELECT text  FROM " . $wpdb->prefix . "a2g_tm_text WHERE textID = $a2g_tm_text");
    177     return $a2g_the_text;
     179    return ;
    178180    }
    179181   
     
    185187      global $wpdb;
    186188      $a2g_the_cat = $wpdb->get_var("SELECT catName  FROM " . $wpdb->prefix . "a2g_tm_kategorie WHERE catID = $a2g_tm_cat");
    187     return $a2g_the_cat;
     189    return ;
    188190    }
    189191   
     
    195197      global $wpdb;
    196198      $a2g_the_text = $wpdb->get_var("SELECT text  FROM " . $wpdb->prefix . "a2g_tm_text WHERE textID = $a2g_tm_text");
    197     return $a2g_the_text;
     199    return ;
    198200    }
    199201
     
    205207      global $wpdb;
    206208      $a2g_the_cat = $wpdb->get_var("SELECT catDesc  FROM " . $wpdb->prefix . "a2g_tm_kategorie WHERE catID = $a2g_tm_cat");
    207     return $a2g_the_cat;
    208     }
     209    return html_entity_decode( $a2g_the_cat );
     210    }
     211   
     212   
     213    /**
     214     * Function: a2g_tm_catsort_by_catid
     215     * => Return the sort number of a categoryID given
     216    */ 
     217    function a2g_tm_get_catsort_by_catid($a2g_tm_cat) {
     218      global $wpdb;
     219      $a2g_the_cat = $wpdb->get_var("SELECT catSort FROM " . $wpdb->prefix . "a2g_tm_kategorie WHERE catID = $a2g_tm_cat");
     220      return $a2g_the_cat;
     221    }
     222   
     223   
     224    function a2g_tm_get_select_options_for_catsort() {
     225      global $wpdb;
     226      $a2g_tm_db_get_cat_sorts  =   $wpdb->get_results("SELECT *  FROM " . $wpdb->prefix . "a2g_tm_kategorie");
     227      foreach ( $a2g_tm_db_get_cat_sorts as $a2g_tm_db_get_cat_sort ) {
     228        $a2g_tm_return_option_sort .= '<option value="'.$a2g_tm_db_get_cat_sort->catSort.'">'.$a2g_tm_db_get_cat_sort->catSort .'</option>';
     229      }
     230      return $a2g_tm_return_option_sort;
     231      }
     232     
     233     
     234    function a2g_tm_get_highest_cat_sort() {
     235    global $wpdb;
     236    $a2g_tm_get_highest_cat =   $wpdb->get_var("SELECT MAX(catSort) FROM " . $wpdb->prefix . "a2g_tm_kategorie");
     237    return $a2g_tm_get_highest_cat;
     238    }
  • ada2go-text-modules/trunk/readme.txt

    r2566601 r2568446  
    55Requires at least: 4.7
    66Tested up to: 5.8
    7 Stable tag: 1.3
     7Stable tag: 1.
    88Requires PHP: 7.0
    99License: GPLv3 or later
     
    1717
    1818(EN) Text Modules outputs a clickable form in the frontend to output predefined text. You can save texts in the settings, create categories and completely adapt the design in the customizer! If you need help, contact me via https://ada2go.de/kontakt/
     19
     20
    1921
    2022== Frequently Asked Questions ==
     
    3335
    3436== Changelog ==
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
    3548= 1.3 =
    3649* Fixed blemishes
    37 * Add HTML Output
    38 * Add Text-Module-List
    3950
    4051= 1.2 =
  • ada2go-text-modules/trunk/settings_page.php

    r2566597 r2568446  
    77    $a2g_new_kat_content = sanitize_text_field( htmlentities( $_POST["edit-kat"] ));
    88    $a2g_update_kategorie_id = sanitize_text_field( $_GET["id"]);
     9
     10
     11
     12
     13
     14
     15
    916          $wpdb->update(
    1017            $wpdb->prefix.'a2g_tm_kategorie', 
    1118            array(
    12                 'catDesc' => $a2g_new_kat_content
     19                'catDesc' => $a2g_new_kat_content,
     20              'catSort' => $a2g_update_kategorie_sort
    1321            ),
    14             array(
    15                 'catID' => $a2g_update_kategorie_id
    16             ),
    17             array(
    18                 '%s'
    19             ),
    20             array( '%s'
    21                  )
     22            array( 'catID' => $a2g_update_kategorie_id ), array( '%s', '%d' ),
     23            array( '%d' )
    2224          );
    2325            echo __('<div class="updated">
     
    7880    }
    7981   
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
    8093    // Handle DEL Text
    8194    if($_GET['action']=="deltext" AND (is_admin())) {
     
    100113          $a2g_filter_input_catdesc = stripslashes( $_POST['kat-desc'] );
    101114          $a2g_filter_input_catname = sanitize_text_field( $_POST['cat-name'] );
     115
    102116          $wpdb->insert($table,
    103117          array('catID' => '',
    104118          'catName' => $a2g_filter_input_catname,
    105           'catDesc' => $a2g_filter_input_catdesc
     119          'catDesc' => $a2g_filter_input_catdesc,
     120          'catSort' => $a2g_filter_input_catsort
    106121          ));
    107122          echo '<div class="updated">
     
    151166    $a2g_tm_get_id = sanitize_text_field( $_GET["id"] );
    152167    echo __( '<form action="?page=a2g_tm_settings&action=updatekat&id='. sanitize_text_field($a2g_tm_get_id) .'" method="post">' );
    153     $a2g_tm_get_editcat = a2g_tm_edit_cat_by_catid($a2g_tm_get_id);
    154     echo wp_editor( html_entity_decode($a2g_tm_get_editcat), 'edit-kat' );
    155     echo __( '<br /><input type="hidden" name="a2g-edit-id" value="'. sanitize_text_field($a2g_tm_get_id) .'">
     168    $a2g_tm_get_editcat = a2g_tm_edit_cat_by_catid( $a2g_tm_get_id );
     169    echo wp_editor( html_entity_decode( $a2g_tm_get_editcat ), 'edit-kat' );
     170    echo __( '<br />
     171    Sortierung: <input type="text" name="cat-sort"><br><br>
     172    <input type="hidden" name="a2g-edit-id" value="'. sanitize_text_field($a2g_tm_get_id) .'">
    156173    <input type="submit" name="submit" id="submit" class="button button-primary" value="'. __( 'Kategorie aktualisieren', 'ada2go-text-modules' ).'"><br /><br />' );
    157174}
     
    167184    <input type="submit" name="submit" id="submit" class="button button-primary" value="'. __( 'Text aktualisieren', 'ada2go-text-modules' ).'"><br /><br />' );
    168185}
     186
     187
    169188?>
    170189
     
    179198
    180199<!-- Tab content -->
    181 
    182200
    183201<div id="allgemein" class="tabcontent" style="display:block;">
     
    221239<th><?php echo __( 'Name', 'ada2go-text-modules' ); ?></th>
    222240<th><?php echo __( 'Beschreibung', 'ada2go-text-modules' ); ?></th>
     241
    223242</tr>
    224 <?php echo html_entity_decode (a2g_tm_while_categorys()); ?>
     243<?php echo html_entity_decode (); ?>
    225244</table>
    226245</div>
     
    237256<?php
    238257echo wp_editor( '', 'kat-desc'); ?>
    239 <br />
    240258<br />
    241259<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo __( 'Kategorie speichern', 'ada2go-text-modules' ); ?>">
     
    282300  <h3>Gespeicherte Ausgaben</h3>
    283301<div class="a2g-p-container">
    284 <?php
    285 if(empty(a2g_tm_while_safed_textes())) {
    286 echo __( 'Keine Dateien vorhanden.', 'ada2go-text-modules' );
    287 } else {
    288 ?>
    289302<table id="a2g-table">
    290303<tr>
     
    294307echo a2g_tm_while_safed_textes();
    295308
    296 }
    297309
    298310 ?>
     
    313325  <input type="submit" value="<?php esc_html_e( '&Ouml;ffne den Customizer in einem neuen Fenster', 'ada2go-text-modules' ); ?>" class="button"></a>
    314326</p>
     327
     328
     329
     330
    315331<script>
    316332function a2gSettingTab(evt, a2gSettingName) {
Note: See TracChangeset for help on using the changeset viewer.