pratikshrestha

Sachet owes me Rs. 10,000

Jan 17th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.44 KB | None | 0 0
  1. foreach ( $images as $image ) {
  2.  
  3.                 $image['thumbnail_src'] = preg_replace( '/^https?\:/i', '', $image['thumbnail_src'] );
  4.                 $image['display_src']   = preg_replace( '/^https?\:/i', '', $image['display_src'] );
  5.  
  6.                 $image['thumbnail'] = preg_replace('#^https?:#', '', isset( $image['thumbnail_resources'][0]['src'] ) ? $image['thumbnail_resources'][0]['src'] : $image['thumbnail_src'] );
  7.  
  8.                 $image['small']     = preg_replace('#^https?:#', '', isset( $image['thumbnail_resources'][2]['src'] ) ? $image['thumbnail_resources'][2]['src'] : $image['thumbnail_src'] );
  9.  
  10.                 $image['large']     = preg_replace('#^https?:#', '', isset( $image['thumbnail_resources'][3]['src'] ) ? $image['thumbnail_resources'][3]['src'] : $image['thumbnail_src'] );
  11.  
  12.                 if ( $image['is_video'] == true ) {
  13.                     $type = 'video';
  14.                 }
  15.                 else {
  16.                     $type = 'image';
  17.                 }
  18.  
  19.                 $caption = esc_html__( 'Instagram Image', 'rock-star' );
  20.                 if ( ! empty( $image['caption'] ) ) {
  21.                     $caption = $image['caption'];
  22.                 }
  23.  
  24.                 $instagram[] = array(
  25.                     'description'   => $caption,
  26.                     'link'          => '//instagram.com/p/' . $image['code'],
  27.                     'time'          => $image['date'],
  28.                     'comments'      => $image['comments']['count'],
  29.                     'likes'         => $image['likes']['count'],
  30.                     'thumbnail'     => $image['thumbnail'],
  31.                     'small'         => $image['small'],
  32.                     'large'         => $image['large'],
  33.                     'original'      => $image['display_src'],
  34.                     'type'          => $type
  35.                 );
  36.             }
Advertisement
Add Comment
Please, Sign In to add comment