Adds new properties to the parent (KickAssets) file JSON

@return array
6155
protected function buildJSON()
    {
        $json = $this->parent->createFileJson($this->file);
        $json['created'] = $this->file->obj('Created')->FormatFromSettings();
        $json['lastEdited'] = $this->file->obj('LastEdited')->FormatFromSettings();
        $json['url'] = $this->file->getAbsoluteURL();

        $json['size'] = $this->file->getSize();
        $json['folder'] = $this->file->Parent()->Filename;

        if ($this->file instanceof Image) {
            $preview = $this->file->Fill(400, 133);
            $detail = $this->file->getKickAssetsDetailImage();
            $json['previewImage'] = $preview ? $preview->URL : $this->file->getPreviewThumbnail(128, 128)->URL;
            $json['detailImage'] = $detail ? $detail->URL : $this->file->getPreviewThumbnail(128, 128)->URL;
        }

        return $json;
    }
1224432
public function updateProperties($properties = array())
    {
        //check whether worksheet name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');

        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/workbook/worksheets/' . $this->worksheetName;

        $signedURI = Utils::sign($strURI);

        $json_data = json_encode($properties);

        $responseStream = Utils::processCommand($signedURI, 'POST', 'json', $json_data);
        $json = json_decode($responseStream);
        if ($json->Code == 200)
            return $json->Worksheet;
        else
            return false;

    }
954395
public function getProperties()
    {
        $url      = UrlHelper::buildUrl(Urls::URL_QUERY_CACHE);
        $response = $this->getConnection()->get($url);

        return $response->getJson();
    }
561611
private function create_json() {
		$packages = $this->list_directory( $this->packages_dir );
		$arr      = array();

		foreach ( $packages as $package ) {
			foreach ( $this->translations as $translation ) {
				if ( false !== stripos( $package, $translation ) ) {
					$locale                       = ltrim( strrchr( $translation, '-' ), '-' );
					$arr[ $locale ]['slug']       = stristr( $translation, strrchr( $translation, '-' ), true );
					$arr[ $locale ]['language']   = $locale;
					$arr[ $locale ]['updated']    = $this->get_po_revision( $translation . '.po' );
					$arr[ $locale ]['package']    = '/packages/' . $package;
					$arr[ $locale ]['autoupdate'] = '1';
				}
			}
		}

		file_put_contents( $this->root_dir . '/language-pack.json', json_encode( $arr ) );
		printf( "\n<br>" . 'language-pack.json created.' . "\n<br>" );
	}
731500
public function getMutatedAttributes()
    {
        $attributes = parent::getMutatedAttributes();
        $jsonAttributes = array_keys($this->jsonAttributes);

        return array_merge($attributes, $jsonAttributes);
    }
121801
public function jsonSerialize()
    {
        $json = parent::jsonSerialize();
        $json['fileSize'] = $this->getFileSize();
        $json['mimeType'] = $this->getMimeType();
        $json['fileModifiedAt'] = $this->getFileModifiedAt();
        $json['type'] = static::getType();

        return $json;
    }
230180
public static function getProperties()
    {
        return [
            'AttachmentID' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
            'FileName' => [true, self::PROPERTY_TYPE_STRING, null, false, false],
            'Url' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
            'MimeType' => [false, self::PROPERTY_TYPE_STRING, null, false, false],
            'ContentLength' => [false, self::PROPERTY_TYPE_INT, null, false, false],
        ];
    }
979483
private function loadProperties()
    {
        try {
            $properties = new Properties();
            $properties->load($this->file);
        } catch (IOException $ioe) {
            throw new BuildException($ioe);
        }
        return $properties;
    }
1126279
def bulk_create
      propertiesJSON = params["propertiesJSON"]
      unless propertiesJSON.is_a? Array
        propertiesJSON = JSON.parse propertiesJSON
      end
      new_props = []
      existing_props = []
      errors = []
      properties_params(propertiesJSON).each_with_index do |property_params, index|
        propertyJSON = propertiesJSON[index]
        if Pwb::Prop.where(reference: propertyJSON["reference"]).exists?
          existing_props.push Pwb::Prop.find_by_reference propertyJSON["reference"]
          # propertyJSON
        else
          begin
            new_prop = Pwb::Prop.create(property_params)
            # new_prop = Pwb::Prop.create(propertyJSON.except("features", "property_photos", "image_urls", "last_retrieved_at"))

            # create will use website defaults for currency and area_unit
            # need to override that
            if propertyJSON["currency"]
              new_prop.currency = propertyJSON["currency"]
              new_prop.save!
            end
            if propertyJSON["area_unit"]
              new_prop.area_unit = propertyJSON["area_unit"]
              new_prop.save!
            end

            # TODO - go over supported locales and save title and description
            # into them

            # if propertyJSON["features"]
            # TODO - process feature (currently not retrieved by PWS so not important) 
            #   new_prop.set_features=propertyJSON["features"]
            # end
            if propertyJSON["property_photos"]
              # uploading images can slow things down so worth setting a limit
              max_photos_to_process = 20
              # TODO - retrieve above as a param
              propertyJSON["property_photos"].each_with_index do |property_photo, index|
                if index > max_photos_to_process
                  return
                end
                photo = PropPhoto.create
                photo.sort_order = property_photo["sort_order"] || nil
                photo.remote_image_url = property_photo["url"]
                # photo.remote_image_url = property_photo["image"]["url"] || property_photo["url"]
                photo.save!
                new_prop.prop_photos.push photo
              end
            end

            new_props.push new_prop
          rescue => err
            errors.push err.message
            # logger.error err.message
          end
        end
      end

      return render json: {
        new_props: new_props,
        existing_props: existing_props,
        errors: errors
      }
    end
1098956
public function jsonSerialize()
    {
        ob_start();
        echo $this->renderSearchField();
        $field = ob_get_contents();
        ob_end_clean();

        $ag = ResponseAssetGroup::get();
        $assetsResponse = [];
        foreach ($ag->getAssetsToOutput() as $position => $assets) {
            foreach ($assets as $asset) {
                if (is_object($asset)) {
                    $assetsResponse[$asset->getAssetType()][] = $asset->getAssetURL();
                }
            }
        }

        return [
            'key' => $this->getKey(),
            'label' => $this->getDisplayName(),
            'element' => $field,
            'data' => $this->data,
            'assets' => $assetsResponse,
        ];
    }
691645
public function build()
    {
        $params = [
            'badge' => $this->badge,
            'alert' => $this->alert,
            'sound' => $this->sound,
            'category' => $this->category,
            'expiry' => $this->expiryDate ? $this->expiryDate->format('c') : null,
            'custom_uri' => $this->uri,
            'message_variation_id' => $this->messageVariationId,
            'asset_url' => $this->assetUrl,
            'asset_file_type' => $this->assetFileType,
        ];

        if (!empty($this->extra)) {
            $params['extra'] = $this->extra;
        }

        return array_filter($params, function ($param) {
            return $param !== null;
        });
    }
987647
public function toJson() {
		$instanceArray['name'] = $this->name;
		$instanceArray['class'] = $this->getClassName();
		$instanceArray['anonymous'] = $this->isAnonymous();
		$instanceArray['type'] = $this->getType();
		
		if ($instanceArray['type'] == self::TYPE_DECLARATIVE) {
			$classDescriptor = $this->getClassDescriptor();
			
			$instanceArray['constructorArguments'] = array();
			foreach ($classDescriptor->getInjectablePropertiesByConstructor() as $propertyName=>$moufProperty) {
				$instanceArray['constructorArguments'][$propertyName] = $this->getConstructorArgumentProperty($propertyName)->toJson();
			}
	
			$instanceArray['properties'] = array();
			foreach ($classDescriptor->getInjectablePropertiesByPublicProperty() as $propertyName=>$moufProperty) {
				$instanceArray['properties'][$propertyName] = $this->getPublicFieldProperty($propertyName)->toJson();
			}
			
			$instanceArray['setters'] = array();
			foreach ($classDescriptor->getInjectablePropertiesBySetter() as $propertyName=>$moufProperty) {
				$instanceArray['setters'][$propertyName] = $this->getSetterProperty($propertyName)->toJson();
			}
			
			// Now, let's search for properties that would be declared in the configuration but that
			// would not exist in the code (this can happen if the property has been renamed in the code)
			$definedPublicProperties = $this->moufManager->getParameterNames($this->name);
			if ($definedPublicProperties) {
				$missingPublicProperties = array_diff($definedPublicProperties, array_keys($instanceArray['properties']));
				foreach ($missingPublicProperties as $missingPublicPropertyName) {
					$instanceArray['properties'][$missingPublicPropertyName] = [
						'warning' => "The public property '".$missingPublicPropertyName."' is declared but does not exist. It is likely it once existed but was renamed or removed.",
						'orphan' => true,
						'type' => null,
						'value' => null,
						'isset' => true,
						'origin' => null,
						'metadata' => null
					];
				}
			}
			
			$definedSetters = $this->moufManager->getParameterNamesForSetter($this->name);
			if ($definedSetters) {
				$missingSetters = array_diff($definedSetters, array_keys($instanceArray['setters']));
				foreach ($missingSetters as $missingSetterName) {
					$instanceArray['setters'][$missingSetterName] = [
					'warning' => "The setter '".$missingSetterName."' is declared but does not exist. It is likely it once existed but was renamed or removed.",
					'orphan' => true,
					'type' => null,
					'value' => null,
					'isset' => true,
					'origin' => null,
					'metadata' => null
					];
				}
			}
				
			$definedConstructorArguments = $this->moufManager->getParameterNamesForConstructor($this->name);
			if ($definedConstructorArguments) {
				$constructor = $classDescriptor->getConstructor();
				if ($constructor) {
					$nbParameters = $classDescriptor->getConstructor()->getNumberOfParameters();
				} else {
					$nbParameters = 0;
				}
				$missingConstructorArguments = array_filter($definedConstructorArguments, function($nb) use ($nbParameters) { return $nbParameters <= $nb; });
				foreach ($missingConstructorArguments as $missingConstructorArgument) {
					$instanceArray['constructorArguments'][$missingConstructorArgument] = [
					'warning' => "The constructor argument n°'".$missingConstructorArgument."' is declared but does not exist. It is likely it once existed but was removed.",
					'orphan' => true,
					'type' => null,
					'value' => null,
					'isset' => true,
					'origin' => null,
					'metadata' => null
					];
				}
			}
			
		} else {
			$instanceArray['code'] = $this->getCode();
		}
		
		return $instanceArray;
	}
1291768
public function getProperties()
    {
        //build URI to merge Docs
        $strURI = Product::$baseProductUri . '/words/' . $this->getFileName() . '/documentProperties';

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');

        $json = json_decode($responseStream);


        if ($json->Code == 200) {
            return $json->DocumentProperties->List;
        }
        
        AsposeApp::getLogger()->warning('Error occured, http 200 code was not found.', array(
            'json-code' => $json->Code,
        ));
        return false;
    }
638447
public function fetchProperties()
    {
        $result = $this->_client->fetchProperties($this->_id);

        $this->_parentId = '' != $result->parent_id ?
            (string) $result->parent_id : null;

        $this->_name = $result->name;

        $this->_description = '' != $result->description ?
            (string) $result->description : null;

        $this->_size = (int) $result->size;

        /** @todo Handle volatile existence (eg. present only for files). */
        $this->_source = (string) $result->source;

        $this->_createdTime = strtotime($result->created_time);
        $this->_updatedTime = strtotime($result->updated_time);

        return $result;
    }
847089
public function add_attribute()
    {
        $allowed = $this->assignment->getAttributesAllowedArray();
        $ak = CollectionAttributeKey::getByID($_REQUEST['akID']);
        if (is_object($ak) && in_array($ak->getAttributeKeyID(), $allowed)) {
            $obj = $this->getAttributeJSONRepresentation($ak, 'add');
            $obj->pending = true;
            $obj->assets = array();
            $ag = ResponseAssetGroup::get();
            foreach ($ag->getAssetsToOutput() as $position => $assets) {
                foreach ($assets as $asset) {
                    if (is_object($asset)) {
                        // have to do a check here because we might be included a dumb javascript call like i18n_js
                        $obj->assets[$asset->getAssetType()][] = $asset->getAssetURL();
                    }
                }
            }
            Loader::helper('ajax')->sendResult($obj);
        }
    }
51433
protected function buildDataProperties()
    {
        $properties = '';
        $hasAutoincrement = false;

        foreach ($this->columns as $column) {
            $properties .= "\n" . $column->getProperty();
            $hasAutoincrement |= $column->isAutoIncrement();
        }

        if ($hasAutoincrement) {
            $properties = '
    /**
     * @var bool $hasAutoIncrement If data has auto increment value.
     */
    protected $hasAutoIncrement = true;' . $properties;
        }

        $this->vars['properties'] = $properties;
    }
532119
public function toArray() {
        $arr              = parent::toArray();
        $arr['json']      = $this->json;
        $arr['file_name'] = $this->fileName;
        $arr['file_path'] = $this->path;
        return $arr;
    }