daily pastebin goal
16%
SHARE
TWEET

Updated ibox links

a guest Aug 13th, 2013 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. Section: iBox
  4. Author: PageLines
  5. Author URI: http://www.pagelines.com
  6. Description: An easy way to create and configure several box type sections at once.
  7. Class Name: pliBox
  8. Filter: component
  9. Loading: active
  10. */
  11.  
  12.  
  13. class pliBox extends PageLinesSection {
  14.  
  15. var $default_limit = 4;
  16.  
  17. function section_opts(){
  18.  
  19. $options = array();
  20.  
  21. $options[] = array(
  22.  
  23. 'title' => __( 'iBox Configuration', 'pagelines' ),
  24. 'type' => 'multi',
  25. 'opts' => array(
  26. array(
  27. 'key' => 'ibox_count',
  28. 'type' => 'count_select',
  29. 'count_start' => 1,
  30. 'count_number' => 12,
  31. 'default' => 4,
  32. 'label' => __( 'Number of iBoxes to Configure', 'pagelines' ),
  33. ),
  34. array(
  35. 'key' => 'ibox_cols',
  36. 'type' => 'count_select',
  37. 'count_start' => 1,
  38. 'count_number' => 12,
  39. 'default' => '3',
  40. 'label' => __( 'Number of Columns for Each Box (12 Col Grid)', 'pagelines' ),
  41. ),
  42. array(
  43. 'key' => 'ibox_media',
  44. 'type' => 'select',
  45. 'opts' => array(
  46. 'icon' => array( 'name' => __( 'Icon Font', 'pagelines' ) ),
  47. 'image' => array( 'name' => __( 'Images', 'pagelines' ) ),
  48. 'text' => array( 'name' => __( 'Text Only, No Media', 'pagelines' ) )
  49. ),
  50. 'default' => 'icon',
  51. 'label' => __( 'Select iBox Media Type', 'pagelines' ),
  52. ),
  53. array(
  54. 'key' => 'ibox_format',
  55. 'type' => 'select',
  56. 'opts' => array(
  57. 'top' => array( 'name' => __( 'Media on Top', 'pagelines' ) ),
  58. 'left' => array( 'name' => __( 'Media at Left', 'pagelines' ) ),
  59. ),
  60. 'default' => 'top',
  61. 'label' => __( 'Select the iBox Media Location', 'pagelines' ),
  62. ),
  63. )
  64.  
  65. );
  66.  
  67. $slides = ($this->opt('ibox_count')) ? $this->opt('ibox_count') : $this->default_limit;
  68. $media = ($this->opt('ibox_media')) ? $this->opt('ibox_media') : 'icon';
  69.  
  70. for($i = 1; $i <= $slides; $i++){
  71.  
  72. $opts = array(
  73.  
  74. array(
  75. 'key' => 'ibox_title_'.$i,
  76. 'label' => __( 'iBox Title', 'pagelines' ),
  77. 'type' => 'text'
  78. ),
  79. array(
  80. 'key' => 'ibox_text_'.$i,
  81. 'label' => __( 'iBox Text', 'pagelines' ),
  82. 'type' => 'textarea'
  83. ),
  84. array(
  85. 'key' => 'ibox_link_'.$i,
  86. 'label' => __( 'iBox Link (Optional)', 'pagelines' ),
  87. 'type' => 'text'
  88. ),
  89. );
  90.  
  91. if($media == 'icon'){
  92. $opts[] = array(
  93. 'key' => 'ibox_icon_'.$i,
  94. 'label' => __( 'iBox Icon', 'pagelines' ),
  95. 'type' => 'select_icon',
  96. );
  97. } elseif($media == 'image'){
  98. $opts[] = array(
  99. 'key' => 'ibox_image_'.$i,
  100. 'label' => __( 'iBox Image', 'pagelines' ),
  101. 'type' => 'image_upload',
  102. );
  103. }
  104.  
  105.  
  106. $options[] = array(
  107. 'title' => __( 'iBox ', 'pagelines' ) . $i,
  108. 'type' => 'multi',
  109. 'opts' => $opts,
  110.  
  111. );
  112.  
  113. }
  114.  
  115. return $options;
  116. }
  117.  
  118.  
  119.  
  120. function section_template( ) {
  121.  
  122. $boxes = ($this->opt('ibox_count')) ? $this->opt('ibox_count') : $this->default_limit;
  123. $cols = ($this->opt('ibox_cols')) ? $this->opt('ibox_cols') : 3;
  124.  
  125. $media_type = ($this->opt('ibox_media')) ? $this->opt('ibox_media') : 'icon';
  126. $media_format = ($this->opt('ibox_format')) ? $this->opt('ibox_format') : 'top';
  127.  
  128. $width = 0;
  129. $output = '';
  130.  
  131. for($i = 1; $i <= $boxes; $i++):
  132.  
  133. // TEXT
  134. $text = ($this->opt('ibox_text_'.$i)) ? $this->opt('ibox_text_'.$i) : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean id lectus sem. Cras consequat lorem.';
  135.  
  136. $text = sprintf('<div data-sync="ibox_text_%s">%s</div>', $i, $text );
  137.  
  138. $title = ($this->opt('ibox_title_'.$i)) ? $this->opt('ibox_title_'.$i) : __('iBox '.$i, 'pagelines');
  139. $title = sprintf('<h4 data-sync="ibox_title_%s">%s</h4>', $i, $title );
  140.  
  141. // LINK
  142. $link = $this->opt('ibox_link_'.$i);
  143. $media_link = ($link) ? sprintf('href="%s"', $link) : '';
  144.  
  145.  
  146. $format_class = ($media_format == 'left') ? 'media left-aligned' : 'top-aligned';
  147. $media_class = 'media-type-'.$media_type;
  148.  
  149. $media_bg = '';
  150. $media_html = '';
  151.  
  152. if( $media_type == 'icon' ){
  153. $media = ($this->opt('ibox_icon_'.$i)) ? $this->opt('ibox_icon_'.$i) : false;
  154. if(!$media){
  155. $icons = pl_icon_array();
  156. $media = $icons[ array_rand($icons) ];
  157. }
  158. $media_html = sprintf('<span class="ibox-icon-border media-type-icon"><i class="icon-3x icon-%s"></i></span>', $media);
  159.  
  160. } elseif( $media_type == 'image' ){
  161.  
  162. $media = ($this->opt('ibox_image_'.$i)) ? $this->opt('ibox_image_'.$i) : false;
  163.  
  164. $media_html = '';
  165.  
  166. $media_bg = ($media) ? sprintf('background-image: url(%s);', $media) : '';
  167.  
  168. }
  169.  
  170.  
  171.  
  172. if($width == 0)
  173. $output .= '<div class="row fix">';
  174.  
  175.  
  176.  
  177. $output .= sprintf(
  178. '<div class="span%s ibox %s fix">
  179. <div class="ibox-media img">
  180. <span class="ibox-icon-border pl-animation pl-appear pl-contrast %s" style="%s">
  181. <a %s>
  182. %s</a>
  183. </span>
  184. </div>
  185. <div class="ibox-text bd">
  186. %s
  187. <div class="ibox-desc">
  188. %s
  189. %s
  190. </div>
  191. </div>
  192. </div>',
  193. $cols,
  194. $format_class,
  195. $media_class,
  196. $media_bg,
  197. $media_link,
  198. $media_html,
  199. $title,
  200. $text,
  201. $text_link
  202. );
  203.  
  204. $width += $cols;
  205.  
  206. if($width >= 12 || $i == $boxes){
  207. $width = 0;
  208. $output .= '</div>';
  209. }
  210.  
  211.  
  212. endfor;
  213.  
  214. printf('<div class="ibox-wrapper pl-animation-group">%s</div>', $output);
  215.  
  216. }
  217.  
  218.  
  219. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top