| @@ -18,9 +18,10 @@ | ||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function uploadFeatureImg($file, $entryID, $postID) |
| 21 | 21 | { |
| 22 | - $_upload_dir = FileHandler::getEntriesFileUploadDir($this->_formID, $entryID); | |
| 22 | + require_once ABSPATH . 'wp-load.php'; | |
| 23 | + $_upload_dir = $this->_bitformsUploadBaseDir . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . $this->_formID . DIRECTORY_SEPARATOR . $entryID; | |
| 23 | 24 | $files = is_string($file) ? json_decode($file) : $file; |
| 24 | 25 | $IMGFileName = $files[0]; |
| 25 | 26 | $IMGFilePath = $_upload_dir . DIRECTORY_SEPARATOR . $IMGFileName; |
| 26 | 27 | if (file_exists($IMGFilePath)) { |
| @@ -49,9 +50,10 @@ | ||
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | public function singleFileMoveWpMedia($entryID, $fileValues, $post_id) |
| 52 | 53 | { |
| 53 | - $_upload_dir = FileHandler::getEntriesFileUploadDir($this->_formID, $entryID); | |
| 54 | + $_upload_dir = $this->_bitformsUploadBaseDir . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . $this->_formID . DIRECTORY_SEPARATOR . $entryID; | |
| 55 | + require_once ABSPATH . 'wp-load.php'; | |
| 54 | 56 | $files = is_string($fileValues) ? json_decode($fileValues) : $fileValues; |
| 55 | 57 | |
| 56 | 58 | $IMGFileName = $files[0]; |
| 57 | 59 | $IMGFilePath = $_upload_dir . DIRECTORY_SEPARATOR . $IMGFileName; |
| @@ -81,9 +83,10 @@ | ||
| 81 | 83 | } |
| 82 | 84 | |
| 83 | 85 | public function multiFileMoveWpMedia($entryID, $fileValues, $post_id) |
| 84 | 86 | { |
| 85 | - $_upload_dir = FileHandler::getEntriesFileUploadDir($this->_formID, $entryID); | |
| 87 | + $_upload_dir = $this->_bitformsUploadBaseDir . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . $this->_formID . DIRECTORY_SEPARATOR . $entryID; | |
| 88 | + require_once ABSPATH . 'wp-load.php'; | |
| 86 | 89 | $attachMentId = []; |
| 87 | 90 | $files = is_string($fileValues) ? json_decode($fileValues) : $fileValues; |
| 88 | 91 | foreach ($files as $file) { |
| 89 | 92 | $IMGFileName = $file; |
| @@ -117,19 +120,20 @@ | ||
| 117 | 120 | } |
| 118 | 121 | return $attachMentId; |
| 119 | 122 | } |
| 120 | 123 | |
| 121 | - public function taxonomyData($formFields, $fieldValues) | |
| 124 | + public function getTaxonomies($formFields, $fieldValues) | |
| 122 | 125 | { |
| 123 | - $taxanomyData = []; | |
| 126 | + $taxonomies = []; | |
| 124 | 127 | foreach ($formFields as $fieldKey => $field) { |
| 128 | + $field = 'object' === gettype($field) ? (array) $field : $field; | |
| 125 | 129 | $customType = isset($field['customType']) ? $field['customType'] : null; |
| 126 | - $customType = (!isset($customType) && 'select' === $field->type && isset($field->customTypeList)) ? $field->customTypeList[0] : $customType; | |
| 130 | + $customType = (!isset($customType) && 'select' === $field['type'] && isset($field['customTypeList'])) ? $field['customTypeList'][0] : $customType; | |
| 127 | 131 | if (isset($customType)) { |
| 128 | 132 | if (isset($customType->isTaxonomy) && !empty($fieldValues[$field['key']]) && isset($customType->isHierarchical)) { |
| 129 | 133 | if (true === $customType->isTaxonomy) { |
| 130 | 134 | if (true === $customType->isHierarchical) { |
| 131 | - $taxanomyData[$fieldKey]['value'] = $fieldValues[$field['key']]; | |
| 135 | + $taxonomies[$fieldKey]['value'] = $fieldValues[$field['key']]; | |
| 132 | 136 | } else { |
| 133 | 137 | $slug = ''; |
| 134 | 138 | |
| 135 | 139 | if (is_array($fieldValues[$field['key']])) { |
| @@ -147,14 +151,14 @@ | ||
| 147 | 151 | $slug = $exists->slug; |
| 148 | 152 | } |
| 149 | 153 | } |
| 150 | 154 | |
| 151 | - $taxanomyData[$fieldKey]['value'] = $slug; | |
| 155 | + $taxonomies[$fieldKey]['value'] = $slug; | |
| 152 | 156 | } |
| 153 | - $taxanomyData[$fieldKey]['term'] = $customType->filter->taxanomy; | |
| 157 | + $taxonomies[$fieldKey]['term'] = $customType->filter->taxanomy; | |
| 154 | 158 | } |
| 155 | 159 | } |
| 156 | 160 | } |
| 157 | 161 | } |
| 158 | - return $taxanomyData; | |
| 162 | + return $taxonomies; | |
| 159 | 163 | } |
| 160 | 164 | } |