wordpress/wp-content/themes/basic/themify/themify-builder/classes/class-builder-data-manager.php
/**
	 * Network Builder Data update page.
	 * 
	 * @access public
	 */
Network Builder Data update page.

@access public
Network Builder Data update page . @access public
public static function network_builder_data_updater_page() { ?>
		<div class="wrap">
			<h2><?php esc_html_e( 'Themify Builder Data Updater', 'themify' );?></h2>
			<?php
			$action = isset($_GET['tb_action']) ? $_GET['tb_action'] : 'show'; 
			switch ( $action ) {
				case 'update':
					$n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0;
					$limit = 5;
					$site_ids = get_sites( array(
						'spam'       => 0,
						'deleted'    => 0,
						'archived'   => 0,
						'network_id' => get_current_network_id(),
						'number'     => $limit,
						'offset'     => $n,
						'fields'     => 'ids',
						'order'      => 'DESC',
						'orderby'    => 'ID',
					) );
					if ( empty( $site_ids ) ) {
						echo '<p>' . __( 'All done!', 'themify' ) . '</p>';
						break;
					}
					echo '<ul>';
					foreach ( (array) $site_ids as $site_id ) {
						switch_to_blog( $site_id );
						$siteurl = site_url();
						$upgrade_url = add_query_arg( array( 'page' => 'themify', 'do_update_themify_builder_static_content' => true ), admin_url('admin.php') );
						$cookies = array();
						foreach ( $_COOKIE as $name => $value ) {
							$cookies[] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value ) );
						}
						restore_current_blog();
						echo "<li>$siteurl</li>";
						$response = wp_remote_get( $upgrade_url, array(
							'timeout' => 10000, 
							'cookies' => $cookies,
							'httpversion' => '1.1',
							'sslverify'   => false
						) );
						if ( is_wp_error( $response ) ) {
							wp_die( sprintf(
								__( 'Warning! Problem updating builder data in %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s', 'themify' ),
								$siteurl,
								'<em>' . $response->get_error_message() . '</em>'
							) );
						}
					}
					echo '</ul>';
					$action_url = add_query_arg( array(
						'page'   => 'themify-builder-data-updater',
						'tb_action' => 'update',
						'n' => $n+$limit
					), network_admin_url( 'admin.php' ) );
					?><p><?php _e( 'If your browser doesn&#8217;t start loading the next page automatically, click this link:', 'themify' ); ?> <a class="button" href="<?php echo $action_url; ?>"><?php _e('Next Sites', 'themify'); ?></a></p>
					<script type="text/javascript">
					<!--
					function nextpage() {
						document.location.href = "<?php echo $action_url; ?>";
					}
					setTimeout( "nextpage()", 250 );
					//-->
					</script><?php
				break;
				case 'show':
				default: ?>
					<p><?php _e( 'Run updater to convert your existing posts and pages to support Builder static content (<a href="https://themify.me/docs/builder#static-content" target="_blank">learn more</a>).', 'themify' ); ?></p>
					<p><?php _e( 'The update process may take a little while, so please be patient.', 'themify' ); ?></p>
					<p><a class="button button-primary" href="<?php echo network_admin_url( 'admin.php?page=themify-builder-data-updater&tb_action=update' );?>"><?php _e( 'Update Builder Data Now', 'themify' ); ?></a></p>
					<?php
				break;
			} ?>
		</div>
	<?php
	}
public static function network_builder_data_updater_page ( ) { ?> <div class="wrap">
			<h2> <?php esc_html_e ( 'Themify Builder Data Updater' , 'themify' ) ; ?> </h2>
			
			 <?php $ action = isset ( $ _GET [ 'tb_action' ] ) ? $ _GET [ 'tb_action' ] : 'show' ; switch ( $ action ) { case 'update' : $ n = ( isset ( $ _GET [ 'n' ] ) ) ? intval ( $ _GET [ 'n' ] ) : 0 ; $ limit = 5 ; $ site_ids = get_sites ( array ( 'spam' => 0 , 'deleted' => 0 , 'archived' => 0 , 'network_id' => get_current_network_id ( ) , 'number' => $ limit , 'offset' => $ n , 'fields' => 'ids' , 'order' => 'DESC' , 'orderby' => 'ID' , ) ) ; if ( empty ( $ site_ids ) ) { echo '<p>' . __ ( 'All done!' , 'themify' ) . '</p>' ; break ; } echo '<ul>' ; foreach ( ( array ) $ site_ids as $ site_id ) { switch_to_blog ( $ site_id ) ; $ siteurl = site_url ( ) ; $ upgrade_url = add_query_arg ( array ( 'page' => 'themify' , 'do_update_themify_builder_static_content' => true ) , admin_url ( 'admin.php' ) ) ; $ cookies = array ( ) ; foreach ( $ _COOKIE as $ name => $ value ) { $ cookies [ ] = new WP_Http_Cookie ( array ( 'name' => $ name , 'value' => $ value ) ) ; } restore_current_blog ( ) ; echo " <li> $ siteurl </li> " ; $ response = wp_remote_get ( $ upgrade_url , array ( 'timeout' => 10000 , 'cookies' => $ cookies , 'httpversion' => '1.1' , 'sslverify' => false ) ) ; if ( is_wp_error ( $ response ) ) { wp_die ( sprintf ( __ ( 'Warning! Problem updating builder data in %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' , 'themify' ) , $ siteurl , '<em>' . $ response -> get_error_message ( ) . '</em>' ) ) ; } } echo '</ul>' ; $ action_url = add_query_arg ( array ( 'page' => 'themify-builder-data-updater' , 'tb_action' => 'update' , 'n' => $ n + $ limit ) , network_admin_url ( 'admin.php' ) ) ; ?> <p> <?php _e ( 'If your browser doesn&#8217;t start loading the next page automatically, click this link:' , 'themify' ) ; ?> <a class="button" href=" <?php echo $ action_url ; ?> "> <?php _e ( 'Next Sites' , 'themify' ) ; ?> </a></p>
					<script type="text/javascript">
					<!--
					function nextpage() {
						document.location.href = " <?php echo $ action_url ; ?> ";
					}
					setTimeout( "nextpage()", 250 );
					//-->
					</script> <?php break ; case 'show' : default : ?> <p> <?php _e ( 'Run updater to convert your existing posts and pages to support Builder static content (<a href="https://themify.me/docs/builder#static-content" target="_blank">learn more</a>).' , 'themify' ) ; ?> </p>
					
					<p> <?php _e ( 'The update process may take a little while, so please be patient.' , 'themify' ) ; ?> </p>
					<p><a class="button button-primary" href=" <?php echo network_admin_url ( 'admin.php?page=themify-builder-data-updater&tb_action=update' ) ; ?> "> <?php _e ( 'Update Builder Data Now' , 'themify' ) ; ?> </a></p>
					
					 <?php break ; } ?> </div>
	 <?php }
Network Builder Data update page.
Network Builder Data update page .