@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | return; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - $set_err = libxml_use_internal_errors(true); |
|
| 15 | + $set_err = libxml_use_internal_errors( true ); |
|
| 16 | 16 | $loader = libxml_disable_entity_loader( true ); |
| 17 | 17 | |
| 18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
| 19 | 19 | |
| 20 | 20 | foreach ( (array) $files as $file ) { |
| 21 | - FrmXMLHelper::import_xml($file); |
|
| 22 | - unset($file); |
|
| 21 | + FrmXMLHelper::import_xml( $file ); |
|
| 22 | + unset( $file ); |
|
| 23 | 23 | } |
| 24 | 24 | /* |
| 25 | 25 | if(is_wp_error($result)) |
@@ -70,41 +70,41 @@ discard block |
||
| 70 | 70 | $errors = array(); |
| 71 | 71 | $message = ''; |
| 72 | 72 | |
| 73 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
| 73 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' ); |
|
| 74 | 74 | if ( $permission_error !== false ) { |
| 75 | 75 | $errors[] = $permission_error; |
| 76 | - self::form($errors); |
|
| 76 | + self::form( $errors ); |
|
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
| 80 | + if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
| 81 | 81 | $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
| 82 | - self::form($errors); |
|
| 82 | + self::form( $errors ); |
|
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $file = $_FILES['frm_import_file']['tmp_name']; |
| 87 | 87 | |
| 88 | 88 | if ( ! is_uploaded_file( $file ) ) { |
| 89 | - unset($file); |
|
| 89 | + unset( $file ); |
|
| 90 | 90 | $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
| 91 | - self::form($errors); |
|
| 91 | + self::form( $errors ); |
|
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
| 96 | 96 | |
| 97 | - $export_format = apply_filters('frm_export_formats', array( |
|
| 97 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
| 98 | 98 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
| 99 | 99 | ) ); |
| 100 | 100 | |
| 101 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
| 102 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
| 101 | + $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) ); |
|
| 102 | + if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) { |
|
| 103 | 103 | // allow other file types to be imported |
| 104 | 104 | do_action( 'frm_before_import_' . $file_type ); |
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | - unset($file_type); |
|
| 107 | + unset( $file_type ); |
|
| 108 | 108 | |
| 109 | 109 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
| 110 | 110 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | libxml_use_internal_errors( $set_err ); |
| 124 | 124 | libxml_disable_entity_loader( $loader ); |
| 125 | 125 | |
| 126 | - self::form($errors, $message); |
|
| 126 | + self::form( $errors, $message ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public static function export_xml() { |
| 130 | 130 | $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
| 131 | - if ( ! empty($error) ) { |
|
| 131 | + if ( ! empty( $error ) ) { |
|
| 132 | 132 | wp_die( $error ); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if ( $format == 'xml' ) { |
| 145 | - self::generate_xml($type, compact('ids')); |
|
| 145 | + self::generate_xml( $type, compact( 'ids' ) ); |
|
| 146 | 146 | } if ( $format == 'csv' ) { |
| 147 | - self::generate_csv( compact('ids') ); |
|
| 147 | + self::generate_csv( compact( 'ids' ) ); |
|
| 148 | 148 | } else { |
| 149 | - do_action( 'frm_export_format_' . $format, compact('ids') ); |
|
| 149 | + do_action( 'frm_export_format_' . $format, compact( 'ids' ) ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | wp_die(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | foreach ( $type as $tb_type ) { |
| 190 | 190 | $where = array(); |
| 191 | 191 | $join = ''; |
| 192 | - $table = $tables[ $tb_type ]; |
|
| 192 | + $table = $tables[$tb_type]; |
|
| 193 | 193 | |
| 194 | 194 | $select = $table . '.id'; |
| 195 | 195 | $query_vars = array(); |
@@ -200,20 +200,20 @@ discard block |
||
| 200 | 200 | if ( $args['ids'] ) { |
| 201 | 201 | $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] ); |
| 202 | 202 | } else { |
| 203 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 203 | + $where[$table . '.status !'] = 'draft'; |
|
| 204 | 204 | } |
| 205 | 205 | break; |
| 206 | 206 | case 'actions': |
| 207 | 207 | $select = $table . '.ID'; |
| 208 | 208 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
| 209 | - if ( ! empty($args['ids']) ) { |
|
| 209 | + if ( ! empty( $args['ids'] ) ) { |
|
| 210 | 210 | $where['menu_order'] = $args['ids']; |
| 211 | 211 | } |
| 212 | 212 | break; |
| 213 | 213 | case 'items': |
| 214 | 214 | //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 215 | 215 | if ( $args['ids'] ) { |
| 216 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 216 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 217 | 217 | } |
| 218 | 218 | break; |
| 219 | 219 | case 'styles': |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
| 248 | 248 | $where['pm.meta_key'] = 'frm_form_id'; |
| 249 | 249 | |
| 250 | - if ( empty($args['ids']) ) { |
|
| 250 | + if ( empty( $args['ids'] ) ) { |
|
| 251 | 251 | $where['pm.meta_value >'] = 1; |
| 252 | 252 | } else { |
| 253 | 253 | $where['pm.meta_value'] = $args['ids']; |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | break; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 259 | - unset($tb_type); |
|
| 258 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 259 | + unset( $tb_type ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
|
| 262 | + echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n"; |
|
| 263 | 263 | include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' ); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' ); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - set_time_limit(0); //Remove time limit to execute this function |
|
| 301 | - $mem_limit = str_replace('M', '', ini_get('memory_limit')); |
|
| 300 | + set_time_limit( 0 ); //Remove time limit to execute this function |
|
| 301 | + $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) ); |
|
| 302 | 302 | if ( (int) $mem_limit < 256 ) { |
| 303 | - ini_set('memory_limit', '256M'); |
|
| 303 | + ini_set( 'memory_limit', '256M' ); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | global $wpdb; |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $no_export_fields = FrmField::no_save_fields(); |
| 371 | 371 | foreach ( $csv_fields as $k => $f ) { |
| 372 | 372 | if ( in_array( $f->type, $no_export_fields ) ) { |
| 373 | - unset( $csv_fields[ $k ] ); |
|
| 373 | + unset( $csv_fields[$k] ); |
|
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | 376 | } |