Guest User

Untitled

a guest
Aug 17th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.22 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. <style>
  118. .item {
  119. position: relative;
  120. }
  121. .item img {
  122. -moz-transition: all 0.3s;
  123. -webkit-transition: all 0.3s;
  124. transition: all 0.3s;
  125. }
  126. .item:hover img {
  127. -moz-transform: scale(1.1);
  128. -webkit-transform: scale(1.1);
  129. transform: scale(1.1);
  130. }
  131. </style>
  132. <div class="row sidebar-service">
  133. <?php }
  134. if ( ! empty( $rambo_service_content ) ) {
  135.  
  136. $allowed_html = array(
  137. 'br' => array(),
  138. 'em' => array(),
  139. 'strong' => array(),
  140. 'b' => array(),
  141. 'i' => array(),
  142. );
  143. $rambo_service_content = json_decode( $rambo_service_content );
  144.  
  145. foreach ( $rambo_service_content as $service_item ) :
  146. $icon = ! empty( $service_item->icon_value ) ? apply_filters( 'rambo_translate_single_string', $service_item->icon_value, 'service section' ) : '';
  147. $title = ! empty( $service_item->title ) ? apply_filters( 'rambo_translate_single_string', $service_item->title, 'service section' ) : '';
  148. $text = ! empty( $service_item->text ) ? apply_filters( 'rambo_translate_single_string', $service_item->text, 'service section' ) : '';
  149. $link = ! empty( $service_item->link ) ? apply_filters( 'rambo_translate_single_string', $service_item->link, 'service section' ) : '';
  150. $image = ! empty( $service_item->image_url ) ? apply_filters( 'rambo_translate_single_string', $service_item->image_url, 'service section' ) : '';
  151. $buttontext = ! empty( $service_item->button_text ) ? apply_filters( 'rambo_translate_single_string', $service_item->button_text, 'service section' ) : '';
  152. $opennewtab = ! empty( $service_item->open_new_tab) ? apply_filters('rambo_translate_single_string',$service_item->open_new_tab, 'service section' ) : '';
  153.  
  154. $color = '';
  155. if ( is_customize_preview() && ! empty( $service_item->color ) ) {
  156. $color = $service_item->color;
  157. }
  158.  
  159.  
  160. ?>
  161. <div class="span3 home_service">
  162. <?php if ( ! empty( $image ) ) : ?>
  163. <?php if ( ! empty( $link ) ) {?>
  164. <a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab == 'yes'){ echo 'target="_blank"';}?>>
  165. <?php } ?>
  166. <figure class="post-thumbnail item">
  167. <img class="services_cols_mn_icon"
  168. src="<?php echo esc_url( $image ); ?>" <?php if ( ! empty( $title ) ) : ?> alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" <?php endif; ?> />
  169. </figure>
  170. <?php if ( ! empty( $link ) ) {?>
  171. </a>
  172. <?php }?>
  173. <?php endif; ?>
  174.  
  175.  
  176. <?php if ( ! empty( $icon ) ) :?>
  177. <span class="fa-stack fa-4x icon_align_center">
  178. <i class="fa <?php echo esc_html( $icon ); ?> home_media_icon_1x fa-inverse" ></i>
  179. </span>
  180. <?php endif; ?>
  181.  
  182. <?php if ( ! empty( $title ) ) : ?>
  183. <a <?php if(!empty($link)){?> href="<?php echo esc_url( $link ); ?>" <?php } ?><?php if($opennewtab == 'yes'){ echo 'target="_blank"';}?>>
  184. <h2 class="widget-title"><?php echo esc_html( $title ); ?></h2>
  185. </a><?php endif; ?>
  186. <?php if ( ! empty( $text ) ) : ?>
  187. <p><?php echo wp_kses( html_entity_decode( $text ), $allowed_html ); ?></p>
  188. <?php endif; ?>
  189. <?php if(!empty($buttontext)):?>
  190. <?php if(!empty($link)):?>
  191. <p><strong><a href="<?php echo esc_url( $link ); ?>" <?php if($opennewtab =='yes'){echo "target='_blank'";} ?> ><?php echo esc_html($buttontext); ?></a></strong></p>
  192. <?php else: ?>
  193. <p><strong><a><?php echo esc_html($buttontext); ?></a></strong></p>
  194. <?php endif; ?>
  195. <?php endif; ?>
  196.  
  197. </div>
  198. <?php
  199. endforeach;
  200. }
  201. else
  202. {
  203. $colors = array('#f22853','#6dc82b','#fe8000', '#1abac8');
  204. $title = array (__('Incredibly Flexible','rambo'), __('Powerful Admin','rambo'), __('Easy To Use','rambo'), __('Responsive Design','rambo'));
  205. $icon = array('fa fa-camera','fa fa-cogs','fa fa-user','fa fa-desktop');
  206. for($i=0; $i<=3; $i++) {
  207. ?>
  208.  
  209. <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>
  210. </div>
  211. <?php }
  212. }
  213. if ( ! $is_callback ) { ?>
  214. </div>
  215. <?php
  216.  
  217. }
  218. } ?>
  219. <div class="home_service_section">
  220. <div class="container">
  221. <?php if( $current_options['service_section_title'] != '' || $current_options['service_section_descritpion'] != ''){ ?>
  222. <div class="row-fluid featured_port_title">
  223.  
  224. <?php if( $current_options['service_section_title'] != '') { ?>
  225. <h1><?php echo $current_options['service_section_title']; ?></h1>
  226. <?php } ?>
  227.  
  228. <?php if( $current_options['service_section_descritpion'] != '') { ?>
  229. <p><?php echo $current_options['service_section_descritpion']; ?></p>
  230. <?php } ?>
  231.  
  232. </div>
  233. <?php }?>
  234. <!-- /Home Service Section -->
  235. <?php rambo_service_content( $rambo_service_content ); ?>
  236. <!-- /Home Service Section -->
  237. </div>
  238. </div>
  239. <?php } ?>
Add Comment
Please, Sign In to add comment