wordpress/wp-content/themes/basic/themify/themify-builder/classes/class-themify-global-styles.php
/**
	 * Import GS attached file after builder export
	 *
	 * @param array $data exported gs attached file data
	 * @return array
	 */
Import GS attached file after builder export
@param array $data exported gs attached file data
@return array
Import GS attached file after builder export @param array $data exported gs attached file data @return array
public static function builder_import( $data,$onlySave=false) {
		$data = is_object( $data ) ? json_decode( json_encode( $data ), true ) : $data;
		$used_gs = $exist_posts = array();
		if ( is_array( $data ) && !empty( $data ) ) {
			foreach ( $data as $slug=>$post ) {
				$post_id = get_page_by_path( $slug, OBJECT, self::$post_type );
				if ( is_null( $post_id ) ) {
					$args = array(
						'style-name' => $post['title'], 
						'style-type' => $post['type'], 
						'styles' => $post['data'],
						'slug' => $slug
					);
					if ( $gsPost = self::add_new( $args ) ) {
						$used_gs[$slug] = $gsPost;
					}
				} elseif($onlySave===false){
					$exist_posts[] = $post_id->ID;
				}
			}
			if ( $onlySave===false && !empty( $exist_posts )) {
				$args = array(
					'limit' => -1, 
					'data' => true, 
					'include' => $exist_posts
				);
				$exist_posts = self::get_global_styles( $args );
				if ( !empty( $exist_posts ) ) {
					$used_gs = array_merge( $used_gs, $exist_posts );
				}
			}
		}
		return $used_gs;
	}
public static function builder_import ( $ data , $ onlySave = false ) { $ data = is_object ( $ data ) ? json_decode ( json_encode ( $ data ) , true ) : $ data ; $ used_gs = $ exist_posts = array ( ) ; if ( is_array ( $ data ) && ! empty ( $ data ) ) { foreach ( $ data as $ slug => $ post ) { $ post_id = get_page_by_path ( $ slug , OBJECT , self :: $ post_type ) ; if ( is_null ( $ post_id ) ) { $ args = array ( 'style-name' => $ post [ 'title' ] , 'style-type' => $ post [ 'type' ] , 'styles' => $ post [ 'data' ] , 'slug' => $ slug ) ; if ( $ gsPost = self :: add_new ( $ args ) ) { $ used_gs [ $ slug ] = $ gsPost ; } } elseif ( $ onlySave === false ) { $ exist_posts [ ] = $ post_id -> ID ; } } if ( $ onlySave === false && ! empty ( $ exist_posts ) ) { $ args = array ( 'limit' => - 1 , 'data' => true , 'include' => $ exist_posts ) ; $ exist_posts = self :: get_global_styles ( $ args ) ; if ( ! empty ( $ exist_posts ) ) { $ used_gs = array_merge ( $ used_gs , $ exist_posts ) ; } } } return $ used_gs ; }
Import GS attached file after builder export
 @param array $data exported gs attached file data
 @return array
Import GS attached file after builder export @param array $data exported gs attached file data @return array