Guest User

Untitled

a guest
Oct 8th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.07 KB | None | 0 0
  1. <?php
  2. /**
  3. * @Theme Name : Rambopro
  4. * @file : index-service.php
  5. * @license : license.txt
  6. * @filesource : wp-content/themes/rambopro/index-service.php
  7. */
  8. $current_options = wp_parse_args( get_option( 'rambo_pro_theme_options', array() ), theme_data_setup() );
  9.  
  10. if($current_options['home_service_enabled']==false)
  11. {
  12. $rambo_service_content = ! empty($current_options['rambo_service_content']) ? $current_options['rambo_service_content'] : '';
  13.  
  14. if(empty($rambo_service_content))
  15. {
  16. $ThemeData = get_option('rambo_pro_theme_options');
  17.  
  18. if (!empty($current_options['slider_category'])){
  19.  
  20. // Run this code section if user comes form pro old.
  21. //$ServiceOldData = get_option('widget_wbr_feature_page_widget');
  22. //if(sizeof($ServiceOldData)>1){
  23.  
  24. $ServiceOldData = get_option('rambo_feature_page_widget');
  25.  
  26. $the_sidebars = wp_get_sidebars_widgets();
  27.  
  28.  
  29. if(!empty($the_sidebars['sidebar-service'])){
  30.  
  31. $pro_service_data = array();
  32. foreach ($the_sidebars['sidebar-service'] as $data) {
  33.  
  34. $widget_data = explode('-',$data);
  35. $data = $widget_data[1];
  36. if($widget_data[0] == 'rambo_feature_page_widget'){
  37. $options = get_option( 'widget_rambo_feature_page_widget' );
  38.  
  39. $pro_service_data[] = array(
  40. 'icon_value' => isset($options[$widget_data[1]]['icon'])? $options[$widget_data[1]]['icon'] : '',
  41. 'image_url' => isset($options[$widget_data[1]]['selected_page'])? get_the_post_thumbnail_url($options[$widget_data[1]]['selected_page']) :'',
  42. 'title' => isset($options[$widget_data[1]]['selected_page'])? get_the_title( $options[$widget_data[1]]['selected_page'] ) : '',
  43. 'text' => isset($options[$widget_data[1]]['selected_page'])? get_post_field('post_content', $options[$widget_data[1]]['selected_page']) : '',
  44. 'color' => '#f22853',
  45. 'button_text' => isset($options[$widget_data[1]]['buttontext'])? $options[$widget_data[1]]['buttontext'] : '',
  46. 'link' => isset($options[$widget_data[1]]['servicelink'])? $options[$widget_data[1]]['servicelink'] : '',
  47. 'open_new_tab' => isset($options[$widget_data[1]]['target']) ? $options[$widget_data[1]]['target'] : '',
  48. 'id' => 'customizer_repeater_56d7ea7f40b56',
  49.  
  50. );
  51. }
  52.  
  53. }
  54. $rambo_service_content = json_encode($pro_service_data);
  55.  
  56. //}
  57.  
  58. }else
  59. {
  60.  
  61. $rambo_service_content = json_encode( array(
  62. array(
  63. 'icon_value' => 'fa fa-camera',
  64. 'image_url' => '',
  65. 'title' => esc_html__( 'Incredibly Flexible', 'rambo' ),
  66. 'text' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.',
  67. 'color' => '#f22853',
  68. 'button_text' => 'Read More',
  69. 'link' => '#',
  70. 'open_new_tab' => 'yes',
  71. 'id' => 'customizer_repeater_56d7ea7f40b56',
  72. ),
  73. array(
  74. 'icon_value' => 'fa fa-cogs',
  75. 'image_url' => '',
  76. 'title' => esc_html__( 'Powerful Admin', 'rambo' ),
  77. 'text' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.',
  78. 'color' => '#6dc82b',
  79. 'button_text' => 'Read More',
  80. 'link' => '#',
  81. 'open_new_tab' => 'yes',
  82. 'id' => 'customizer_repeater_56d7ea7f40b66',
  83. ),
  84. array(
  85. 'icon_value' => 'fa fa-user',
  86. 'image_url' => '',
  87. 'title' => esc_html__( 'Easy To Use', 'rambo' ),
  88. 'text' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.',
  89. 'color' => '#fe8000',
  90. 'button_text' => 'Read More',
  91. 'link' => '#',
  92. 'open_new_tab' => 'yes',
  93. 'id' => 'customizer_repeater_56d7ea7f40b76',
  94. ),
  95. array(
  96. 'icon_value' => 'fa fa-desktop',
  97. 'image_url' => '',
  98. 'title' => esc_html__( 'Responsive Design', 'rambo' ),
  99. 'text' => 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.',
  100. 'color' => '#1abac8',
  101. 'button_text' => 'Read More',
  102. 'link' => '#',
  103. 'open_new_tab' => 'yes',
  104. 'id' => 'customizer_repeater_56d7ea7f40b86',
  105. ),
  106.  
  107. ) );
  108. }
  109.  
  110.  
  111.  
  112.  
  113. }
  114. }
  115. function rambo_service_content( $rambo_service_content, $is_callback = false ) {
  116. if ( ! $is_callback ) { ?>
  117. <div class="row sidebar-service">
  118. <?php }
  119. if ( ! empty( $rambo_service_content ) ) {
  120.  
  121. $allowed_html = array(
  122. 'br' => array(),
  123. 'em' => array(),
  124. 'strong' => array(),
  125. 'b' => array(),
  126. 'i' => array(),
  127. );
  128. $rambo_service_content = json_decode( $rambo_service_content );
  129.  
  130. foreach ( $rambo_service_content as $service_item ) :
  131. $icon = ! empty( $service_item->icon_value ) ? apply_filters( 'rambo_translate_single_string', $service_item->icon_value, 'service section' ) : '';
  132. $title = ! empty( $service_item->title ) ? apply_filters( 'rambo_translate_single_string', $service_item->title, 'service section' ) : '';
  133. $text = ! empty( $service_item->text ) ? apply_filters( 'rambo_translate_single_string', $service_item->text, 'service section' ) : '';
  134. $link = ! empty( $service_item->link ) ? apply_filters( 'rambo_translate_single_string', $service_item->link, 'service section' ) : '';
  135. $image = ! empty( $service_item->image_url ) ? apply_filters( 'rambo_translate_single_string', $service_item->image_url, 'service section' ) : '';
  136. $buttontext = ! empty( $service_item->button_text ) ? apply_filters( 'rambo_translate_single_string', $service_item->button_text, 'service section' ) : '';
  137. $opennewtab = ! empty( $service_item->open_new_tab) ? apply_filters('rambo_translate_single_string',$service_item->open_new_tab, 'service section' ) : '';
  138.  
  139. $color = '';
  140. if ( is_customize_preview() && ! empty( $service_item->color ) ) {
  141. $color = $service_item->color;
  142. }
  143.  
  144.  
  145. ?>
  146. <div class="span4 home_service">
  147. <?php if ( ! empty( $image ) ) : ?>
  148. <?php if ( ! empty( $link ) ) {?>
  149. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab == 'yes'){ echo 'target="_blank"';}?>>
  150. <?php } ?>
  151. <figure class="post-thumbnail">
  152. <img class="services_cols_mn_icon"
  153. src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
  154. </figure>
  155. <?php if ( ! empty( $link ) ) {?>
  156. </a>
  157. <?php }?>
  158. <?php endif; ?>
  159.  
  160.  
  161. <?php if ( ! empty( $icon ) ) :?>
  162. <span class="fa-stack fa-4x icon_align_center">
  163. <i class="fa <?php echo esc_html( $icon ); ?> home_media_icon_1x fa-inverse" ></i>
  164. </span>
  165. <?php endif; ?>
  166.  
  167. <?php if ( ! empty( $title ) ) : ?>
  168. <a <?php if(!empty($link)){?> href="<?php echo esc_url( $link ); ?>" <?php } ?><?php if($opennewtab == 'yes'){ echo 'target="_blank"';}?>>
  169. <h2 class="widget-title"><?php echo esc_html( $title ); ?></h2>
  170. </a><?php endif; ?>
  171. <?php if ( ! empty( $text ) ) : ?>
  172. <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
  173. <?php endif; ?>
  174. <?php if(!empty($buttontext)):?>
  175. <?php if(!empty($link)):?>
  176. <p><strong><a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab =='yes'){echo "target='_blank'";} ?> ><?php echo esc_html($buttontext); ?></a></strong></p>
  177. <?php else: ?>
  178. <p><strong><a><?php echo esc_html($buttontext); ?></a></strong></p>
  179. <?php endif; ?>
  180. <?php endif; ?>
  181.  
  182. </div>
  183. <?php
  184. endforeach;
  185. }
  186. else
  187. {
  188. $colors = array('#f22853','#6dc82b','#fe8000', '#1abac8');
  189. $title = array (__('Incredibly Flexible','rambo'), __('Powerful Admin','rambo'), __('Easy To Use','rambo'), __('Responsive Design','rambo'));
  190. $icon = array('fa fa-camera','fa fa-cogs','fa fa-user','fa fa-desktop');
  191. for($i=0; $i<=3; $i++) {
  192. ?>
  193.  
  194. <div id="rambo_feature_page_widget-2" class="span3 home_service widget widget_rambo_feature_page_widget"><span class="fa-stack fa-4x icon_align_center"><a href="#" target="_blank"><i class="fa <?php echo $icon[$i]; ?> home_media_icon_1x fa-inverse"></i></a></span><a href="#" target="_blank"><h2 class="widget-title"><?php echo $title[$i]; ?></h2></a><p><?php echo 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters.'; ?></p><p><strong><a href="#"><?php _e('Read More','rambo'); ?></a></strong></p>
  195. </div>
  196. <?php }
  197. }
  198. if ( ! $is_callback ) { ?>
  199. </div>
  200. <?php
  201.  
  202. }
  203. } ?>
  204. <div class="home_service_section">
  205. <div class="container">
  206. <?php if( $current_options['service_section_title'] != '' || $current_options['service_section_descritpion'] != ''){ ?>
  207. <div class="row-fluid featured_port_title">
  208.  
  209. <?php if( $current_options['service_section_title'] != '') { ?>
  210. <h1><?php echo $current_options['service_section_title']; ?></h1>
  211. <?php } ?>
  212.  
  213. <?php if( $current_options['service_section_descritpion'] != '') { ?>
  214. <p><?php echo $current_options['service_section_descritpion']; ?></p>
  215. <?php } ?>
  216.  
  217. </div>
  218. <?php }?>
  219. <div class="service_btn ">
  220. <a class="callout_now_btn" href="Enter your url here " target="_blank">Purchase Now</a>
  221. </div>
  222. <!-- /Home Service Section -->
  223. <?php rambo_service_content( $rambo_service_content ); ?>
  224. <!-- /Home Service Section -->
  225. </div>
  226. </div>
  227. <?php } ?>
Add Comment
Please, Sign In to add comment