@@ -235,50 +235,50 @@ discard block |
||
| 235 | 235 | return $line; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $convmap = false; |
|
| 238 | + $convmap = false; |
|
| 239 | 239 | |
| 240 | 240 | switch ( self::$to_encoding ) { |
| 241 | - case 'macintosh': |
|
| 241 | + case 'macintosh': |
|
| 242 | 242 | // this map was derived from the differences between the MacRoman and UTF-8 Charsets |
| 243 | 243 | // Reference: |
| 244 | 244 | // - http://www.alanwood.net/demos/macroman.html |
| 245 | - $convmap = array( |
|
| 246 | - 256, 304, 0, 0xffff, |
|
| 247 | - 306, 337, 0, 0xffff, |
|
| 248 | - 340, 375, 0, 0xffff, |
|
| 249 | - 377, 401, 0, 0xffff, |
|
| 250 | - 403, 709, 0, 0xffff, |
|
| 251 | - 712, 727, 0, 0xffff, |
|
| 252 | - 734, 936, 0, 0xffff, |
|
| 253 | - 938, 959, 0, 0xffff, |
|
| 254 | - 961, 8210, 0, 0xffff, |
|
| 255 | - 8213, 8215, 0, 0xffff, |
|
| 256 | - 8219, 8219, 0, 0xffff, |
|
| 257 | - 8227, 8229, 0, 0xffff, |
|
| 258 | - 8231, 8239, 0, 0xffff, |
|
| 259 | - 8241, 8248, 0, 0xffff, |
|
| 260 | - 8251, 8259, 0, 0xffff, |
|
| 261 | - 8261, 8363, 0, 0xffff, |
|
| 262 | - 8365, 8481, 0, 0xffff, |
|
| 263 | - 8483, 8705, 0, 0xffff, |
|
| 264 | - 8707, 8709, 0, 0xffff, |
|
| 265 | - 8711, 8718, 0, 0xffff, |
|
| 266 | - 8720, 8720, 0, 0xffff, |
|
| 267 | - 8722, 8729, 0, 0xffff, |
|
| 268 | - 8731, 8733, 0, 0xffff, |
|
| 269 | - 8735, 8746, 0, 0xffff, |
|
| 270 | - 8748, 8775, 0, 0xffff, |
|
| 271 | - 8777, 8799, 0, 0xffff, |
|
| 272 | - 8801, 8803, 0, 0xffff, |
|
| 273 | - 8806, 9673, 0, 0xffff, |
|
| 274 | - 9675, 63742, 0, 0xffff, |
|
| 275 | - 63744, 64256, 0, 0xffff, |
|
| 276 | - ); |
|
| 277 | - break; |
|
| 278 | - case 'ISO-8859-1': |
|
| 279 | - $convmap = array( 256, 10000, 0, 0xffff ); |
|
| 280 | - break; |
|
| 281 | - } |
|
| 245 | + $convmap = array( |
|
| 246 | + 256, 304, 0, 0xffff, |
|
| 247 | + 306, 337, 0, 0xffff, |
|
| 248 | + 340, 375, 0, 0xffff, |
|
| 249 | + 377, 401, 0, 0xffff, |
|
| 250 | + 403, 709, 0, 0xffff, |
|
| 251 | + 712, 727, 0, 0xffff, |
|
| 252 | + 734, 936, 0, 0xffff, |
|
| 253 | + 938, 959, 0, 0xffff, |
|
| 254 | + 961, 8210, 0, 0xffff, |
|
| 255 | + 8213, 8215, 0, 0xffff, |
|
| 256 | + 8219, 8219, 0, 0xffff, |
|
| 257 | + 8227, 8229, 0, 0xffff, |
|
| 258 | + 8231, 8239, 0, 0xffff, |
|
| 259 | + 8241, 8248, 0, 0xffff, |
|
| 260 | + 8251, 8259, 0, 0xffff, |
|
| 261 | + 8261, 8363, 0, 0xffff, |
|
| 262 | + 8365, 8481, 0, 0xffff, |
|
| 263 | + 8483, 8705, 0, 0xffff, |
|
| 264 | + 8707, 8709, 0, 0xffff, |
|
| 265 | + 8711, 8718, 0, 0xffff, |
|
| 266 | + 8720, 8720, 0, 0xffff, |
|
| 267 | + 8722, 8729, 0, 0xffff, |
|
| 268 | + 8731, 8733, 0, 0xffff, |
|
| 269 | + 8735, 8746, 0, 0xffff, |
|
| 270 | + 8748, 8775, 0, 0xffff, |
|
| 271 | + 8777, 8799, 0, 0xffff, |
|
| 272 | + 8801, 8803, 0, 0xffff, |
|
| 273 | + 8806, 9673, 0, 0xffff, |
|
| 274 | + 9675, 63742, 0, 0xffff, |
|
| 275 | + 63744, 64256, 0, 0xffff, |
|
| 276 | + ); |
|
| 277 | + break; |
|
| 278 | + case 'ISO-8859-1': |
|
| 279 | + $convmap = array( 256, 10000, 0, 0xffff ); |
|
| 280 | + break; |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | 283 | if ( is_array( $convmap ) ) { |
| 284 | 284 | $line = mb_encode_numericentity( $line, $convmap, self::$charset ); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | return self::escape_csv( $line ); |
| 292 | - } |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | 295 | * Escape a " in a csv with another " |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class FrmCSVExportHelper{ |
|
| 3 | +class FrmCSVExportHelper { |
|
| 4 | 4 | protected static $separator = ', '; |
| 5 | 5 | protected static $column_separator = ','; |
| 6 | 6 | protected static $line_break = 'return'; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | header( 'Content-Description: File Transfer' ); |
| 64 | 64 | header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); |
| 65 | 65 | header( 'Content-Type: text/csv; charset=' . self::$charset, true ); |
| 66 | - header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' ); |
|
| 66 | + header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) . ' GMT' ); |
|
| 67 | 67 | header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
| 68 | 68 | header( 'Cache-Control: no-cache, must-revalidate' ); |
| 69 | 69 | header( 'Pragma: no-cache' ); |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | private static function csv_headings( &$headings ) { |
| 88 | 88 | foreach ( self::$fields as $col ) { |
| 89 | 89 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) { |
| 90 | - $headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 90 | + $headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $headings[ $col->id ] = strip_tags( $col->name ); |
|
| 93 | + $headings[$col->id] = strip_tags( $col->name ); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | if ( self::$comment_count ) { |
| 97 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 98 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 99 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 100 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 97 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 98 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 99 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 100 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 101 | 101 | } |
| 102 | - unset($i); |
|
| 102 | + unset( $i ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $headings['created_at'] = __( 'Timestamp', 'formidable' ); |
@@ -146,45 +146,45 @@ discard block |
||
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 150 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 151 | - } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 149 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 150 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 151 | + } else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 152 | 152 | // if the data is here, it should be an array but if this field has collected data |
| 153 | 153 | // both while inside and outside of the repeating section, it's possible this is a string |
| 154 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 154 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | //add the repeated values |
| 158 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 158 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 159 | 159 | } |
| 160 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 160 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // add the embedded form id |
| 164 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 165 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 164 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 165 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 166 | 166 | } |
| 167 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 167 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | private static function add_field_values_to_csv( &$row ) { |
| 171 | 171 | foreach ( self::$fields as $col ) { |
| 172 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 172 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 173 | 173 | |
| 174 | 174 | $field_value = maybe_unserialize( $field_value ); |
| 175 | - $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator, ) ); |
|
| 175 | + $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator,) ); |
|
| 176 | 176 | |
| 177 | 177 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] ) { |
| 178 | 178 | $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array( |
| 179 | 179 | 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false, |
| 180 | 180 | 'entry_id' => self::$entry->id, 'sep' => self::$separator, |
| 181 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
| 181 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
| 182 | 182 | ) ); |
| 183 | - $row[ $col->id . '_label' ] = $sep_value; |
|
| 183 | + $row[$col->id . '_label'] = $sep_value; |
|
| 184 | 184 | unset( $sep_value ); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $row[ $col->id ] = $field_value; |
|
| 187 | + $row[$col->id] = $field_value; |
|
| 188 | 188 | |
| 189 | 189 | unset( $col, $field_value ); |
| 190 | 190 | } |
@@ -205,9 +205,9 @@ discard block |
||
| 205 | 205 | $col_count = count( $rows ); |
| 206 | 206 | $this_col = 0; |
| 207 | 207 | foreach ( $rows as $k => $row ) { |
| 208 | - $this_col++; |
|
| 208 | + $this_col ++; |
|
| 209 | 209 | |
| 210 | - if ( ! isset( self::$headings[ $k ] ) ) { |
|
| 210 | + if ( ! isset( self::$headings[$k] ) ) { |
|
| 211 | 211 | // this column has been removed from the csv, so skip it |
| 212 | 212 | continue; |
| 213 | 213 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | class FrmXMLController { |
| 4 | 4 | |
| 5 | 5 | public static function menu() { |
| 6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
| 6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' ); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | public static function add_default_templates() { |
@@ -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)) |
@@ -64,48 +64,48 @@ discard block |
||
| 64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
| 65 | 65 | ) ); |
| 66 | 66 | |
| 67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
| 67 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' ); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public static function import_xml() { |
| 71 | 71 | $errors = array(); |
| 72 | 72 | $message = ''; |
| 73 | 73 | |
| 74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
| 74 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' ); |
|
| 75 | 75 | if ( $permission_error !== false ) { |
| 76 | 76 | $errors[] = $permission_error; |
| 77 | - self::form($errors); |
|
| 77 | + self::form( $errors ); |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
| 81 | + if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
| 82 | 82 | $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
| 83 | - self::form($errors); |
|
| 83 | + self::form( $errors ); |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $file = $_FILES['frm_import_file']['tmp_name']; |
| 88 | 88 | |
| 89 | 89 | if ( ! is_uploaded_file( $file ) ) { |
| 90 | - unset($file); |
|
| 90 | + unset( $file ); |
|
| 91 | 91 | $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
| 92 | - self::form($errors); |
|
| 92 | + self::form( $errors ); |
|
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
| 97 | 97 | |
| 98 | - $export_format = apply_filters('frm_export_formats', array( |
|
| 98 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
| 99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
| 100 | 100 | ) ); |
| 101 | 101 | |
| 102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
| 103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
| 102 | + $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) ); |
|
| 103 | + if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) { |
|
| 104 | 104 | // allow other file types to be imported |
| 105 | - do_action('frm_before_import_'. $file_type ); |
|
| 105 | + do_action( 'frm_before_import_' . $file_type ); |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | - unset($file_type); |
|
| 108 | + unset( $file_type ); |
|
| 109 | 109 | |
| 110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
| 111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,12 +124,12 @@ discard block |
||
| 124 | 124 | libxml_use_internal_errors( $set_err ); |
| 125 | 125 | libxml_disable_entity_loader( $loader ); |
| 126 | 126 | |
| 127 | - self::form($errors, $message); |
|
| 127 | + self::form( $errors, $message ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public static function export_xml() { |
| 131 | 131 | $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
| 132 | - if ( ! empty($error) ) { |
|
| 132 | + if ( ! empty( $error ) ) { |
|
| 133 | 133 | wp_die( $error ); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ( $format == 'xml' ) { |
| 146 | - self::generate_xml($type, compact('ids')); |
|
| 146 | + self::generate_xml( $type, compact( 'ids' ) ); |
|
| 147 | 147 | } if ( $format == 'csv' ) { |
| 148 | - self::generate_csv( compact('ids') ); |
|
| 148 | + self::generate_csv( compact( 'ids' ) ); |
|
| 149 | 149 | } else { |
| 150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
| 150 | + do_action( 'frm_export_format_' . $format, compact( 'ids' ) ); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | wp_die(); |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | global $wpdb; |
| 158 | 158 | |
| 159 | 159 | $type = (array) $type; |
| 160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
| 160 | + if ( in_array( 'items', $type ) && ! in_array( 'forms', $type ) ) { |
|
| 161 | 161 | // make sure the form is included if there are entries |
| 162 | 162 | $type[] = 'forms'; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( in_array( 'forms', $type) ) { |
|
| 165 | + if ( in_array( 'forms', $type ) ) { |
|
| 166 | 166 | // include actions with forms |
| 167 | 167 | $type[] = 'actions'; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $tables = array( |
| 171 | - 'items' => $wpdb->prefix .'frm_items', |
|
| 172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
| 171 | + 'items' => $wpdb->prefix . 'frm_items', |
|
| 172 | + 'forms' => $wpdb->prefix . 'frm_forms', |
|
| 173 | 173 | 'posts' => $wpdb->posts, |
| 174 | 174 | 'styles' => $wpdb->posts, |
| 175 | 175 | 'actions' => $wpdb->posts, |
@@ -199,31 +199,31 @@ discard block |
||
| 199 | 199 | foreach ( $type as $tb_type ) { |
| 200 | 200 | $where = array(); |
| 201 | 201 | $join = ''; |
| 202 | - $table = $tables[ $tb_type ]; |
|
| 202 | + $table = $tables[$tb_type]; |
|
| 203 | 203 | |
| 204 | - $select = $table .'.id'; |
|
| 204 | + $select = $table . '.id'; |
|
| 205 | 205 | $query_vars = array(); |
| 206 | 206 | |
| 207 | 207 | switch ( $tb_type ) { |
| 208 | 208 | case 'forms': |
| 209 | 209 | //add forms |
| 210 | 210 | if ( $args['ids'] ) { |
| 211 | - $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
|
| 211 | + $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] ); |
|
| 212 | 212 | } else { |
| 213 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 213 | + $where[$table . '.status !'] = 'draft'; |
|
| 214 | 214 | } |
| 215 | 215 | break; |
| 216 | 216 | case 'actions': |
| 217 | - $select = $table .'.ID'; |
|
| 217 | + $select = $table . '.ID'; |
|
| 218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
| 219 | - if ( ! empty($args['ids']) ) { |
|
| 219 | + if ( ! empty( $args['ids'] ) ) { |
|
| 220 | 220 | $where['menu_order'] = $args['ids']; |
| 221 | 221 | } |
| 222 | 222 | break; |
| 223 | 223 | case 'items': |
| 224 | 224 | //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 225 | 225 | if ( $args['ids'] ) { |
| 226 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 226 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 227 | 227 | } |
| 228 | 228 | break; |
| 229 | 229 | case 'styles': |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | unset( $form_id, $form_data ); |
| 240 | 240 | } |
| 241 | - $select = $table .'.ID'; |
|
| 241 | + $select = $table . '.ID'; |
|
| 242 | 242 | $where['post_type'] = 'frm_styles'; |
| 243 | 243 | |
| 244 | 244 | // Only export selected styles |
@@ -247,11 +247,11 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | break; |
| 249 | 249 | default: |
| 250 | - $select = $table .'.ID'; |
|
| 250 | + $select = $table . '.ID'; |
|
| 251 | 251 | $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
| 252 | 252 | $where['pm.meta_key'] = 'frm_form_id'; |
| 253 | 253 | |
| 254 | - if ( empty($args['ids']) ) { |
|
| 254 | + if ( empty( $args['ids'] ) ) { |
|
| 255 | 255 | $where['pm.meta_value >'] = 1; |
| 256 | 256 | } else { |
| 257 | 257 | $where['pm.meta_value'] = $args['ids']; |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | break; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 263 | - unset($tb_type); |
|
| 262 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 263 | + unset( $tb_type ); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
|
| 267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
| 266 | + echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n"; |
|
| 267 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' ); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' ); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - if ( ! ini_get('safe_mode') ) { |
|
| 293 | - set_time_limit(0); //Remove time limit to execute this function |
|
| 294 | - $mem_limit = str_replace('M', '', ini_get('memory_limit')); |
|
| 292 | + if ( ! ini_get( 'safe_mode' ) ) { |
|
| 293 | + set_time_limit( 0 ); //Remove time limit to execute this function |
|
| 294 | + $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) ); |
|
| 295 | 295 | if ( (int) $mem_limit < 256 ) { |
| 296 | - ini_set('memory_limit', '256M'); |
|
| 296 | + ini_set( 'memory_limit', '256M' ); |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | if ( ! is_array( $csv_fields ) ) { |
| 311 | 311 | $csv_fields = explode( ',', $csv_fields ); |
| 312 | 312 | } |
| 313 | - if ( ! empty($csv_fields) ) { |
|
| 313 | + if ( ! empty( $csv_fields ) ) { |
|
| 314 | 314 | $where['fi.id'] = $csv_fields; |
| 315 | 315 | } |
| 316 | 316 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) ); |
| 337 | 337 | |
| 338 | - $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query ); |
|
| 338 | + $entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query ); |
|
| 339 | 339 | unset( $query ); |
| 340 | 340 | |
| 341 | 341 | if ( empty( $entry_ids ) ) { |