Plugin Directory

Changeset 2859001


Ignore:
Timestamp:
02/02/2023 01:33:52 PM (3 years ago)
Author:
stacks
Message:

version 5, global headers, footers and custom views

Location:
stacks-mobile-app-builder/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • stacks-mobile-app-builder/trunk/api/builder/image.php

    r2739350 r2859001  
    2929            mkdir($uploaddir, 0755, true);
    3030        }
    31         if (move_uploaded_file( sanitize_text_field( $_FILES['file']['tmp_name'] ), $uploadfile)) {
     31        if( $_SERVER['SERVER_NAME'] == 'localhost' ) {
     32            move_uploaded_file( sanitize_text_field( $_FILES['file']['tmp_name'] ), $uploadfile);
     33            return esc_url(stripslashes($uploadfile_url));
     34        } else if ( move_uploaded_file( sanitize_text_field( $_FILES['file']['tmp_name'] ), $uploadfile)) {
    3235            return esc_url(stripslashes(str_replace("http://", "https://", $uploadfile_url)));
    3336        } else {
  • stacks-mobile-app-builder/trunk/api/builder/posts.php

    r2823455 r2859001  
    3131        ]
    3232      ];
     33    } else if( $args['source'] == 'by_category' ) {
     34      $args['tax_query'] = [
     35        [
     36          'taxonomy' =>  'category',
     37          'field' => 'term_id',
     38          'terms' => $args['category'], /// Where term_id of Term 1 is "1".
     39        ]
     40      ];
    3341    }
     42   
    3443    $wp_query= null;
    3544    $wp_query = new WP_Query();
  • stacks-mobile-app-builder/trunk/api/builder/views.php

    r2836674 r2859001  
    2929      )
    3030    );
     31
     32    register_rest_route(
     33      $namespace,
     34      '/delete-all-views/',
     35      array(
     36        'methods' => 'POST',
     37        'callback' => array($this, 'delete_all_views'),
     38        'args' => array(),
     39      )
     40    );
    3141  }
    3242
    3343  public function stacks_update_view($request) {
    3444    $response = $GLOBALS['stacks_builder']->update_view( sanitize_text_field( $request['view_id'] ), $request['data'], sanitize_text_field( $request['project_id'] ), sanitize_text_field( $request['view_name'] ), sanitize_text_field( $request['status'] ));
     45    return wp_send_json_success( $response );
     46  }
     47
     48  public function delete_all_views($request) {
     49    $response = $GLOBALS['stacks_builder']->delete_all_views( $request['project_id'] );
    3550    return wp_send_json_success( $response );
    3651  }
  • stacks-mobile-app-builder/trunk/api/mobile/woocommerce/api/v1/pages/views/views-controller.php

    r2836674 r2859001  
    194194                'builder_data' => $GLOBALS['stacks_builder']->get_view( $view_name, $project_id )
    195195            ];
    196 
    197196            $home_response_items['builder_data'] = $this->add_data_to_view_widgets($home_response_items['builder_data'], $page_widgets = []);
    198197
  • stacks-mobile-app-builder/trunk/index.php

    r2836674 r2859001  
    66 * Author URI: stacksmarket.co
    77 * Description: Enjoy the fast and easy experience of building your Ecommerce mobile application
    8  * Version: 4.8.3
     8 * Version: 5.0
    99 */
    1010class stacks_app_builder {
  • stacks-mobile-app-builder/trunk/modules/db.php

    r2836674 r2859001  
    129129              view_id int UNSIGNED NOT NULL,
    130130              view_name text NULL,
    131               data text NULL,
     131              data LONGTEXT NULL,
    132132              created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    133133              updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
     
    166166
    167167
    168     public function db_column_checker($table, $column_name, $type = 'VARCHAR(255) NULL') {
     168    public function db_column_checker($table, $column_name, $type = 'VARCHAR(255) NULL', $modify = false) {
    169169        global $wpdb;
    170170        $row = $wpdb->get_results("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='{$table}' AND column_name='{$column_name}'");
    171171        if (empty($row)) {
    172172            $wpdb->query("ALTER TABLE {$table} ADD $column_name $type");
     173        }
     174        if($modify) {
     175            $row_modified = $wpdb->get_results("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='{$table}' AND column_name='{$column_name}' AND DATA_TYPE='{$type}'");
     176            if (empty($row_modified)) {
     177                $wpdb->query("ALTER TABLE {$table} MODIFY $column_name $type");
     178            }
    173179        }
    174180        return true;
     
    219225        global $wpdb;
    220226        $table = $wpdb->prefix . 'stacks_builder_views';
     227        $this->db_column_checker($table, 'data', 'LONGTEXT NULL', true);
    221228        $data = json_encode($data);
    222         $project = $wpdb->get_results(sprintf("SELECT * FROM {$table} WHERE view_id = %d AND project_id = %d", $view_id, $project_id), ARRAY_A);
    223         if (!empty($project)) {
    224             $wpdb->update($table, array('data' => $data, 'updated_at' => date("Y-m-d H:i:s"), 'status' => $status, 'view_name' => $view_name), array('view_id' => $view_id, 'project_id' => $project_id));
     229        $project = $wpdb->get_results( sprintf( "SELECT * FROM {$table} WHERE view_name = '{$view_name}' AND project_id = %d", $project_id ), ARRAY_A );
     230        if( $project ) {
     231            $wpdb->update( $table, array( 'data' => $data, 'updated_at' => date("Y-m-d H:i:s"), 'status' => $status ), array( 'view_name' => $view_name, 'project_id' => $project_id ) );
    225232        } else {
    226233            $wpdb->insert(
     
    348355        return $wpdb->insert_id;
    349356    }
     357
     358    public function delete_all_views($project_id) {
     359        global $wpdb ;
     360        $table = $wpdb->prefix.'stacks_builder_views';
     361        $wpdb->delete( $table, array( 'project_id' => $project_id ) );
     362    }
    350363}
    351364
  • stacks-mobile-app-builder/trunk/readme.txt

    r2836674 r2859001  
    66Requires PHP: 5.6
    77WC tested up to: 6.5.1
    8 Stable tag: 4.8.3
     8Stable tag: 5.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    122122== Changelog ==
    123123
     124= 5.0 (01 February, 2023) =
     125* Rest of Views are Editable
     126* Possibility to add, edit or delete custom view
     127* Link from any view to another
     128* Add Global Header
     129* Add Header per view
     130* Possibility to disable Footer on specific views
     131* Add Global Footer
     132* Add Footer per view
     133* Possibility to disable Footer on specific views
     134
    124135= 4.8.3 (20 December, 2022) =
    125136* Handle multiple projects connected to the same site
Note: See TracChangeset for help on using the changeset viewer.