PageRenderTime 58ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/themes/lifeline/framework/helpers/shortcodes.php

https://bitbucket.org/acipriani/madeinapulia.com
PHP | 2876 lines | 2546 code | 153 blank | 177 comment | 265 complexity | 834353c4d733dc37f5b571ce0c749483 MD5 | raw file
Possible License(s): GPL-3.0, MIT, BSD-3-Clause, LGPL-2.1, GPL-2.0, Apache-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. class SH_Shortcodes
  3. {
  4. protected $keys;
  5. protected $toggle_count = 0;
  6. function __construct()
  7. {
  8. $GLOBALS['sh_toggle_count'] = 0;
  9. add_action('init', array($this, 'add'));
  10. }
  11. function add()
  12. {
  13. include(SH_FRW_DIR . 'resource/shortcodes.php');
  14. $this->keys = array_keys($options);
  15. foreach ($this->keys as $k) {
  16. if (method_exists($this, $k)) add_shortcode('sh_' . $k, array($this, $k));
  17. }
  18. }
  19. function recent_news($atts, $content = null)
  20. {
  21. extract(shortcode_atts(array(
  22. 'number' => '',
  23. 'title' => __('Recent News', SH_NAME),
  24. 'category' => '',
  25. 'sort_by' => 'date',
  26. 'sorting_order' => 'DESC',
  27. 'heading_style' => 'simple',
  28. ), $atts)
  29. );
  30. $News = $Thumb = '';
  31. wp_reset_query();
  32. $args = array('post_type' => 'post', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order, 'cat' => (int)$category);
  33. //if($category != '') $args['category'] = array($category);
  34. $query = new WP_Query($args);
  35. //printr($query);
  36. $i = 1;
  37. if ($query->have_posts()): while ($query->have_posts()): $query->the_post();
  38. $Settings = get_post_meta(get_the_ID(), '_post_settings', true);
  39. if ($video_link = sh_set($Settings, 'video_link')) {
  40. $opt = get_post_meta(get_the_ID(), '_dictate_gal_videos', true);
  41. $video_data = sh_grab_video($video_link, $opt);
  42. $PostMedia = '<div class="image">
  43. <img src="' . sh_set($video_data, 'thumb') . '" style="width:261px; height:207px;" alt="' . sh_set($video_data, 'title') . '" />
  44. <a class="html5lightbox" rel="prettyPhoto" href="' . $video_link . '" title="' . sh_set($video_data, 'title') . '">
  45. <span><i class="icon-play"></i></span>
  46. </a>
  47. </div>';
  48. $CarouselThumb = '<img src="' . sh_set($video_data, 'thumb') . '" style="width:131px; height:78px;" alt="' . sh_set($video_data, 'title') . '" />';
  49. } else {
  50. $PostAttchment = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'large');
  51. $PostMedia = '<div class="image">
  52. ' . get_the_post_thumbnail(get_the_ID(), '370x252') . '
  53. <a title="" href="' . sh_set($PostAttchment, 0) . '" rel="prettyPhoto" class="html5lightbox"><i class="icon-picture"></i></a>
  54. </div>';
  55. $CarouselThumb = get_the_post_thumbnail(get_the_ID(), '270x155');
  56. }
  57. $News .= '<div id="news' . $i . '">
  58. <div class="row">
  59. <div class="col-md-6 desc">
  60. <h3><a href="' . get_permalink() . '" title="">' . sh_character_limit(35, get_the_title()) . '</a></h3>
  61. <p>' . sh_character_limit(340, get_the_content()) . '</p>
  62. </div>
  63. <div class="col-md-6">
  64. ' . $PostMedia . '
  65. </div>
  66. </div>
  67. </div>';
  68. $Thumb .= '<a href="#news' . $i . '">' . $CarouselThumb . '<span class="carusal-our-news">' . sh_character_limit(17, get_the_title()) . '</span></a>';
  69. $i++;
  70. endwhile;
  71. endif;
  72. wp_reset_query();
  73. wp_enqueue_script('carofredcsel');
  74. $output = '';
  75. $output .= '<div class="carusal-slider">
  76. <div id="carousel-wrapper">
  77. <div id="carousel">
  78. ' . $News . '
  79. </div>
  80. </div>
  81. <div id="thumbs-wrapper">
  82. <div id="thumbs">' . $Thumb . '</div>
  83. <a id="prev" href="#"><i class="icon-angle-left"></i></a> <a id="next" href="#"><i class="icon-angle-right"></i></a> </div>
  84. </div>
  85. <script>
  86. jQuery(document).ready(function($){
  87. $(\'#carousel\').carouFredSel({
  88. responsive: true,
  89. circular: false,
  90. auto: false,
  91. items: {
  92. visible: 1,
  93. width: 20,
  94. },
  95. scroll: {
  96. fx: \'directscroll\'
  97. }
  98. });
  99. $(\'#thumbs\').carouFredSel({
  100. responsive: true,
  101. circular: false,
  102. infinite: false,
  103. auto: false,
  104. prev: \'#prev\',
  105. next: \'#next\',
  106. items: {
  107. visible: {
  108. min: 1,
  109. max: 6
  110. },
  111. width: 200,
  112. height: \'80%\'
  113. }
  114. });
  115. $(\'#thumbs a\').click(function() {
  116. $(\'#carousel\').trigger(\'slideTo\', \'#\' + this.href.split(\'#\').pop() );
  117. $(\'#thumbs a\').removeClass(\'selected\');
  118. $(this).addClass(\'selected\');
  119. return false;
  120. });
  121. });
  122. </script>
  123. ';
  124. return $output;
  125. }
  126. function our_causes($atts, $content = null)
  127. {
  128. extract(shortcode_atts(array(
  129. 'number' => '',
  130. 'title' => __('Our Causes', SH_NAME),
  131. 'cat' => '',
  132. 'sort_by' => 'date',
  133. 'sorting_order' => 'ASC',
  134. 'donate_sec' => '',
  135. 'heading_style' => 'simple',
  136. ), $atts)
  137. );
  138. $paypal_res = '';
  139. $single_page = (sh_set($_SESSION, 'sh_causes_page')) ? sh_set($_SESSION, 'sh_causes_page') : false;
  140. if ($single_page == true) unset($_SESSION['sh_causes_page']);
  141. if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
  142. $paypal_res = require_once(get_template_directory() . '/framework/modules/pp_recurring/review.php');
  143. }
  144. $return_url = (is_home()) ? home_url() : get_permalink();
  145. $args = array('post_type' => 'post', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
  146. if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => (int)$cat));
  147. $Posts = query_posts($args);
  148. $chunk_num = ($donate_sec == 'true') ? 3 : 4;
  149. $col_class_outer = ($donate_sec == 'true') ? 'col-md-9' : 'col-md-12';
  150. $col_class_inner = ($donate_sec == 'true') ? 'col-md-4' : 'col-md-4';
  151. $postdate =
  152. $chunk = array_chunk($Posts, $chunk_num);
  153. $output = '';
  154. $output .= '<div class="row"><div class="' . $col_class_outer . '">';
  155. $output .= '<div class="our-causes">
  156. <ul class="slides">';
  157. foreach ($chunk as $p) {
  158. $output .= '<li><div class="row">';
  159. foreach ($p as $pos) {
  160. $output .= '<div class="' . $col_class_inner . '">
  161. <div class="causes-image">'
  162. . get_the_post_thumbnail(sh_set($pos, 'ID'), '') . '
  163. <div class="cause-heading">
  164. <h3>' . sh_excerpt(sh_set($pos, 'post_title'), 50) . '</h3>
  165. <div class="meta-news">' .mysql2date('d F Y', sh_set($pos, 'post_date')). '</div>
  166. </div>
  167. <a href="' . get_permalink(sh_set($pos, 'ID')) . '" title="' . sh_set($pos, 'post_title') . '">
  168. <div class="our-causes-hover">
  169. <h3>' . sh_excerpt(sh_set($pos, 'post_title'), 27) . '</h3>
  170. <div class="meta-news">' .mysql2date('d F Y', sh_set($pos, 'post_date')). '</div>
  171. <p>' . sh_excerpt($pos, 150) . '</p>
  172. </div>
  173. </a>
  174. </div>
  175. </div>';
  176. }
  177. $output .= '</div></li>
  178. <script>
  179. jQuery(document).ready(function($){
  180. if( $(\'.our-causes\').length ){
  181. $(\'.our-causes\').flexslider({
  182. animation: "slide",
  183. animationLoop: false,
  184. controlNav: true,
  185. maxItems: 1,
  186. pausePlay: false,
  187. mousewheel:false,
  188. start: function(slider){
  189. $(\'body\').removeClass(\'loading\');
  190. }
  191. });
  192. }
  193. });
  194. </script>
  195. ';
  196. }
  197. wp_reset_query();
  198. $paypal = $GLOBALS['_sh_base']->donation;
  199. if ($notif = $paypal->_paypal->handleNotification()) $paypal_res = $paypal->single_pament_result($notif);
  200. $output .= '</ul></div></div>';
  201. $donation_data = get_option(SH_NAME);
  202. $percent = (sh_set($donation_data, 'paypal_target')) ? (int)str_replace(',', '', sh_set($donation_data, 'paypal_raised')) / (int)str_replace(',', '', sh_set($donation_data, 'paypal_target')) : 0;
  203. $donation_percentage = $percent * 100;
  204. $symbol = (sh_set($donation_data, 'paypal_currency')) ? sh_set($donation_data, 'paypal_currency') : '$';
  205. $donation = '<div class="col-md-3">';
  206. $donation .= '<div class="donate-us-box">
  207. <h5>' . __('Give Your Donations', SH_NAME) . '</h5>
  208. <span>' . __('Donation Needed', SH_NAME) . '</span> <span class="amount-figures"><strong>' . $symbol . '</strong> ' . sh_set($donation_data, 'paypal_target') . '!</span> <span>' . __('Collected Donation', SH_NAME) . '</span> <span class="amount-figures coloured"><strong>' . $symbol . '</strong> ' . sh_set($donation_data, 'paypal_raised') . '!</span>
  209. <span class="cell"><i class="icon-phone"></i>' . sh_set($donation_data, 'paypal_contact') . '</span>';
  210. if (sh_set($donation_data, 'donate_method') == 'true') {
  211. $donation .= '<a data-toggle="modal" data-target="#myModal" class="donate-btn" title="">Donate Us</a>';
  212. } else {
  213. $donation .= $paypal->button(array('currency_code' => sh_set($donation_data, 'paypal_currency_code'), 'item_name' => get_bloginfo('name'), 'return' => $return_url));
  214. }
  215. $donation .= '</div>
  216. </div>';
  217. $output .= ($donate_sec == 'true') ? $donation : '';
  218. $output .= '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
  219. if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
  220. $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
  221. $output .= '<script>
  222. jQuery(document).ready(function($){
  223. $(".donate-us-box a.donate-btn").trigger("click");
  224. });
  225. </script>';
  226. } elseif ($notif = $paypal->_paypal->handleNotification() && isset($notif->ok)) {
  227. $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
  228. $output .= '<script>
  229. jQuery(document).ready(function($){
  230. $(".donate-us-box a.donate-btn").trigger("click");
  231. });
  232. </script>';
  233. } else {
  234. $Settings = get_option(SH_NAME);
  235. //printr($Settings);
  236. $value = sh_set($Settings, 'transactions_detail');
  237. $output .= '<div class="donate-popup">
  238. <div class="cause-bar">
  239. <div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_target') . '</h3><i>' . __('NEEDED DONATION', SH_NAME) . '</i></div>
  240. <div class="cause-progress">
  241. <div class="progress-report">
  242. <h6>' . __('PHASES', SH_NAME) . '</h6>
  243. <span>' . $donation_percentage . '%</span>
  244. <div class="progress pattern">
  245. <div class="progress-bar" style="width: ' . $donation_percentage . '%"></div>
  246. </div>
  247. </div>
  248. </div>
  249. <div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_raised') . '</h3><i>' . __('COLLECTED DONATION', SH_NAME) . '</i></div>
  250. <div class="cause-box donate-drop-btn"><h4>' . __('DONATE NOW', SH_NAME) . '</h4></div>
  251. </div>
  252. <div class="donate-drop-down">
  253. <div class="recursive-periods" align="center">';
  254. if ($value) {
  255. foreach ($value as $val) {
  256. $output .= '<a style="cursor:pointer;">' . ucwords(str_replace('_', ' ', $val)) . '</a>';
  257. }
  258. }
  259. $output .= '</div>
  260. <div class="amount-btns">';
  261. if (intval(sh_set($Settings, 'pop_up_1st_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_1st_value') . '</span></a>';
  262. if (intval(sh_set($Settings, 'pop_up_2nd_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_2nd_value') . '</span></a>';
  263. if (intval(sh_set($Settings, 'pop_up_3rd_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_3rd_value') . '</span></a>';
  264. if (intval(sh_set($Settings, 'pop_up_4th_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_4th_value') . '</span></a>';
  265. if (intval(sh_set($Settings, 'pop_up_5th_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_5th_value') . '</span></a>';
  266. $output .= '</div><div class="other-amount">
  267. ' . $paypal->button(array('item_name' => get_bloginfo('name'), 'amount' => 30, 'return' => $return_url)) . '
  268. </div>';
  269. if (!is_user_logged_in()) {
  270. $output .= '<form id="login" action="" method="post">
  271. <h1>Please Login OR Register first to make recursive donation</h1>
  272. <p class="status"></p>
  273. <label for="username">Username</label>
  274. <input id="username" type="text" name="username">
  275. <label for="password">Password</label>
  276. <input id="password" type="password" name="password">
  277. <a class="lost" href="' . wp_registration_url() . '">Register Now</a>
  278. <input class="submit_button" type="submit" value="Login" name="submit">
  279. <a class="close" href="">(close)</a>
  280. ' . wp_nonce_field('ajax-login-nonce', 'security') . '
  281. </form>';
  282. }
  283. $output .= '</div>
  284. </div>
  285. </div></div>';
  286. }
  287. return $output;
  288. }
  289. function our_causes_2($atts, $content = null)
  290. {
  291. extract(shortcode_atts(array(
  292. 'number' => '',
  293. 'title' => 'Our Causes',
  294. 'bg' => '',
  295. 'blackish' => '',
  296. 'cat' => '',
  297. 'sort_by' => 'date',
  298. 'heading_style' => 'simple',
  299. 'sorting_order' => 'ASC'), $atts)
  300. );
  301. wp_enqueue_script('layersliderscript1');
  302. wp_enqueue_script('layersliderscript2');
  303. $args = array('post_type' => 'dict_causes', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
  304. if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'causes_category', 'field' => 'id', 'terms' => $cat));
  305. $black_layer = ($blackish) ? 'blackish' : '';
  306. $Posts = query_posts($args);
  307. $attach = ($bg) ? wp_get_attachment_image_src($bg, 'large') : '';
  308. $bgimg = ($attach) ? sh_set($attach, 0) : get_template_directory_uri() . '/images/moving-bg.png';
  309. $output = '';
  310. $output .= '<div class="posts-carousel">
  311. <ul class="slides">';
  312. $chunk = array_chunk($Posts, 4);
  313. foreach ($chunk as $p) {
  314. $output .= '<li><div class="row">';
  315. foreach ($p as $pos) {
  316. $Settings = get_post_meta(sh_set($pos, 'ID'), '_dict_causes_settings', true);
  317. if (sh_set($Settings, 'video_link') && sh_set($Settings, 'video_link') != '') {
  318. $video_link = sh_set($Settings, 'video_link');
  319. $video_data = sh_grab_video($video_link, $Settings);
  320. $PostMedia = '<div class="carou-post-img">
  321. <img src="' . sh_set($video_data, 'thumb') . '" style="width:277px; height:190px;" alt="' . sh_set($video_data, 'title') . '" />
  322. <a title="' . sh_set($video_data, 'title') . '" href="' . $video_link . '" class="html5lightbox"><i class="icon-play"></i></a>
  323. </div>';
  324. } else if (sh_set($Settings, 'gallery')) {
  325. $GalleryAttachments = get_posts(array('post_type' => 'attachment', 'post__in' => explode(',', sh_set($Settings, 'gallery'))));
  326. $Slides = '';
  327. foreach ($GalleryAttachments as $Attachment) {
  328. $Thumb = sh_set(wp_get_attachment_image_src($Attachment->ID, '370x252'), '0');
  329. $LargeImage = sh_set(wp_get_attachment_image_src($Attachment->ID, 'large'), '0');
  330. $Slides .= '<li data-masterspeed="500" data-slotamount="7" data-transition="curtain-1">
  331. <img data-bgrepeat="no-repeat" data-bgposition="left top" data-bgfit="cover" alt="slidebg1" src="' . $Thumb . '" draggable="false"> </li>';
  332. //$i++;
  333. }
  334. $PostMedia = '<div class="carou-post-img"><div class="tp-banner2">
  335. <ul>
  336. ' . $Slides . '
  337. </ul>
  338. </div></div>';
  339. } else {
  340. $PostAttchment = wp_get_attachment_image_src(get_post_thumbnail_id(sh_set($pos, 'ID')), 'large');
  341. $PostMedia = '<div class="carou-post-img">
  342. ' . get_the_post_thumbnail(sh_set($pos, 'ID'), '370x252') . '
  343. <a title="" href="' . sh_set($PostAttchment, 0) . '" class="html5lightbox"><i class="icon-picture"></i></a>
  344. </div>';
  345. }
  346. $output .= '<div class="col-md-3">
  347. <div class="carou-post">
  348. ' . $PostMedia . '
  349. <h4>' . substr(strip_tags(sh_set($pos, 'post_title')), 0, 30) . '</h4>
  350. <p>' . substr(strip_tags(sh_set($pos, 'post_content')), 0, 200) . '</p>
  351. <a href="' . get_permalink(sh_set($pos, 'ID')) . '" title="">' . __('Read More', SH_NAME) . '</a>
  352. </div>
  353. </div>';
  354. }
  355. $output .= '</div></li>';
  356. }
  357. $output .= ' </ul>
  358. </div>
  359. </div>
  360. <script>
  361. jQuery(document).ready(function($){
  362. if( $(".posts-carousel").length > 0 ){
  363. $(".posts-carousel").flexslider({
  364. animation: "slide",
  365. animationLoop: false,
  366. controlNav: false,
  367. maxItems: 1,
  368. pausePlay: false,
  369. mousewheel:false,
  370. start: function(slider){
  371. $("body").removeClass("loading");
  372. }
  373. });
  374. }
  375. });
  376. </script>
  377. ';
  378. wp_reset_query();
  379. return $output;
  380. }
  381. function our_causes_3($atts, $content = null)
  382. {
  383. extract(shortcode_atts(array(
  384. 'number' => '',
  385. 'title' => 'Our Causes',
  386. 'cat' => '',
  387. 'sort_by' => 'date',
  388. 'sorting_order' => 'ASC',
  389. 'heading_style' => 'simple',
  390. ), $atts)
  391. );
  392. wp_enqueue_script(array('bootstrap'));
  393. $args = array('post_type' => 'dict_causes', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
  394. if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'causes_category', 'field' => 'id', 'terms' => $cat));
  395. $Posts = query_posts($args);
  396. $i = 1;
  397. $Cause = '';
  398. $PostNav = '';
  399. if (have_posts()): while (have_posts()): the_post();
  400. $PostClass = ($i == 1) ? 'tab-pane fade in active' : 'tab-pane fade';
  401. $NavClass = ($i == 1) ? 'active' : '';
  402. $Settings = get_post_meta(get_the_ID(), '_dict_causes_settings', true);
  403. $Cause .= '<div id="tab' . $i . '" class="' . $PostClass . '">
  404. <div class="cause-image">
  405. ' . get_the_post_thumbnail(get_the_ID(), '1170x312') . '
  406. <div class="meta"> <span>' . __('In', SH_NAME) . ' <i>' . sh_set($Settings, 'location') . '</i></span> </div>
  407. <div class="cause-title">
  408. <h2><a href="' . get_permalink() . '">' . sh_excerpt(get_the_title(), 100) . '</a></h2>
  409. </div>
  410. </div>
  411. <div class="details">
  412. <div class="needed-amount">
  413. <h5><i>' . sh_set($Settings, 'currency_symbol') . '</i>' . sh_set($Settings, 'donation_needed') . '<span>' . __('Donation Needed', SH_NAME) . '</span></h5>
  414. </div>
  415. <p>' . sh_excerpt(get_the_content(), 500) . '</p>
  416. </div>
  417. </div>';
  418. $PostNav[] = '<li class="col-md-4"> <a data-toggle="tab" href="#tab' . $i . '"> ' . get_the_post_thumbnail(get_the_ID(), '1170x455') . ' <span>' . sh_excerpt(get_the_title(), 35) . '</span> </a> </li>';
  419. $i++;
  420. endwhile;
  421. endif;
  422. wp_reset_query();
  423. $nav = '';
  424. if ($PostNav) {
  425. foreach (array_chunk($PostNav, 3) as $chunk) {
  426. $nav .= '<li>
  427. <ul class="nav nav-tabs cause-tabber">';
  428. if (is_array($chunk)) {
  429. foreach ($chunk as $ch) {
  430. $nav .= $ch;
  431. }
  432. }
  433. $nav .= '</ul>
  434. </li>';
  435. }
  436. }
  437. $output = '';
  438. $output .= '<div class="our-cause-sec">';
  439. $output .= '<div class="tab-content" id="myTabContent">' . $Cause . '</div>
  440. <div class="causes-carousel">
  441. <ul class="slides">
  442. ' . $nav . '
  443. </ul>
  444. </div>
  445. </div>
  446. <script>
  447. jQuery(document).ready(function($){
  448. if( $(\'.causes-carousel\').length > 0 )
  449. {
  450. $(\'.causes-carousel\').flexslider({
  451. animation: "slide",
  452. animationLoop: false,
  453. controlNav: false,
  454. pausePlay: false,
  455. mousewheel:false,
  456. start: function(slider){
  457. $(\'body\').removeClass(\'loading\');
  458. }
  459. });
  460. }
  461. });
  462. </script>
  463. ';
  464. return $output;
  465. }
  466. function our_causes_4($atts, $content = null)
  467. {
  468. extract(shortcode_atts(array(
  469. 'number' => '',
  470. 'title' => 'Our Causes',
  471. 'cat' => '',
  472. 'sort_by' => 'date',
  473. 'sorting_order' => 'ASC',
  474. 'heading_style' => 'simple',
  475. ), $atts)
  476. );
  477. $args = array('post_type' => 'dict_causes', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
  478. if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'causes_category', 'field' => 'id', 'terms' => $cat));
  479. $Posts = query_posts($args);
  480. $TotalPosts = count($Posts);
  481. $PostBatch = 2;
  482. $EndingTagAppended = FALSE;
  483. $StrtingTag = '<div class="col-md-4">';
  484. $CloseTag = '</div>';
  485. $i = 1;
  486. $Cause = '';
  487. $NextBatch = TRUE;
  488. if (have_posts()): while (have_posts()): the_post();
  489. $NewSecStrtTag = ($TotalPosts < $PostBatch || $i == 1 || $EndingTagAppended === TRUE) ? $StrtingTag : '';
  490. if (!empty($NewSecStrtTag) && $NextBatch === TRUE) {
  491. $ImageSize = '370x491';
  492. $NextBatch = FALSE;
  493. $AlterStyle = TRUE;
  494. } else if (!empty($NewSecStrtTag) && $NextBatch === FALSE) {
  495. $ImageSize = '370x252';
  496. $NextBatch = TRUE;
  497. $AlterStyle = FALSE;
  498. } else if (empty($NewSecStrtTag) && $AlterStyle === TRUE) {
  499. $ImageSize = '370x252';
  500. $AlterStyle = FALSE;
  501. } else if (empty($NewSecStrtTag) && $AlterStyle === FALSE) {
  502. $ImageSize = '370x491';
  503. $AlterStyle = TRUE;
  504. }
  505. $NewSecCloseTag = ($i == $TotalPosts || ($TotalPosts < $PostBatch && $i == $TotalPosts) || ($i % $PostBatch == 0 && $i !== 1)) ? $CloseTag : '';
  506. $EndingTagAppended = ($i == $TotalPosts || ($TotalPosts < $PostBatch && $i == $TotalPosts) || ($i % $PostBatch == 0 && $i !== 1)) ? TRUE : FALSE;
  507. $Cause .= $NewSecStrtTag .
  508. '<div class="portfolio" data-cat="' . $i . '">
  509. <a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), $ImageSize) . '</a>
  510. <div class="port-desc">
  511. <h4><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . sh_excerpt(get_the_title(), 40) . '</a></h4>
  512. <p>' . sh_excerpt(get_the_content(), 300) . '</p>
  513. </div>
  514. </div>'
  515. . $NewSecCloseTag;
  516. $i++;
  517. endwhile;
  518. endif;
  519. wp_reset_query();
  520. $output = '';
  521. $output .= '
  522. <div id="Grid">
  523. <div class="row">
  524. ' . $Cause . '
  525. </div>
  526. </div>';
  527. return $output;
  528. }
  529. function donation($atts, $content = null)
  530. {
  531. extract(shortcode_atts(array(
  532. 'title' => 'Donate Us',
  533. 'heading_style' => 'simple',
  534. ), $atts));
  535. $paypal = $GLOBALS['_sh_base']->donation;
  536. $donation_data = get_option(SH_NAME);
  537. $output = '';
  538. $output .= '<div class="pull-right">';
  539. $output .= '
  540. <div class="donate-us-box">
  541. <h5>' . __('Give Your Donations', SH_NAME) . '</h5>
  542. <span>' . __('Donation Needed', SH_NAME) . '</span> <span class="amount-figures"><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong>
  543. ' . sh_set($donation_data, 'paypal_target') . '!</span> <span>' . __('Collection Donation', SH_NAME) . '</span>
  544. <span class="amount-figures coloured"><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong>
  545. ' . sh_set($donation_data, 'paypal_raised') . '!</span> <span class="cell"><i class="icon-phone"></i>
  546. ' . sh_set($donation_data, 'paypal_contact') . '</span>
  547. <a data-toggle="modal" data-target="#myModal" class="donate-btn" title="">Donate Us</a>
  548. </div>
  549. </div>';
  550. return $output;
  551. }
  552. function donation_2($atts, $content = null)
  553. {
  554. extract(shortcode_atts(array(
  555. ), $atts));
  556. $paypal = $GLOBALS['_sh_base']->donation;
  557. $paypal_res = '';
  558. $single_page = (sh_set($_SESSION, 'sh_causes_page')) ? sh_set($_SESSION, 'sh_causes_page') : false;
  559. if ($single_page == true) unset($_SESSION['sh_causes_page']);
  560. if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
  561. $paypal_res = require_once(get_template_directory() . '/framework/modules/pp_recurring/review.php');
  562. }
  563. $donation_data = get_option(SH_NAME);
  564. if ($notif = $paypal->_paypal->handleNotification()) $paypal_res = $paypal->single_pament_result($notif);
  565. $return_url = (is_home()) ? home_url() : get_permalink();
  566. $percent = (sh_set($donation_data, 'paypal_target')) ? (int)str_replace(',', '', sh_set($donation_data, 'paypal_raised')) / (int)str_replace(',', '', sh_set($donation_data, 'paypal_target')) : 0;
  567. $donation_percentage = $percent * 100;
  568. $symbol = (sh_set($donation_data, 'paypal_currency')) ? sh_set($donation_data, 'paypal_currency') : '$';
  569. $output = '';
  570. $output .= '<div class="donation-bar">
  571. <div class="amount pull-left">
  572. <p>' . __('Dontaions Needed', SH_NAME) . '</p>
  573. <span><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> ' . sh_set($donation_data, 'paypal_target') . '!</span> </div>
  574. <div class="donate-now">';
  575. if (sh_set($donation_data, 'donate_method') == 'true') {
  576. $output .= '<a data-toggle="modal" data-target="#myModal" class="donate-btn" title="">Donate Us</a>';
  577. } else {
  578. $output .= $paypal->button(array('currency_code' => sh_set($donation_data, 'paypal_currency_code'), 'item_name' => get_bloginfo('name'), 'return' => $return_url));
  579. }
  580. $output .= '</div>
  581. <div class="amount pull-right">
  582. <p>' . __('Collected Donations', SH_NAME) . '</p>
  583. <span><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> ' . sh_set($donation_data, 'paypal_raised') . '!</span>
  584. </div>
  585. </div>';
  586. $output .= '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
  587. if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
  588. $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
  589. $output .= '<script>
  590. jQuery(document).ready(function($){
  591. $(".donation-bar a.donate-btn").trigger("click");
  592. });
  593. </script>';
  594. } elseif ($notif = $paypal->_paypal->handleNotification() && isset($notif->ok)) {
  595. $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
  596. $output .= '<script>
  597. jQuery(document).ready(function($){
  598. $(".donation-bar a.donate-btn").trigger("click");
  599. });
  600. </script>';
  601. } else {
  602. $output .= '<div class="donate-popup">
  603. <div class="cause-bar">
  604. <div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_target') . '</h3><i>' . __('NEEDED DONATION', SH_NAME) . '</i></div>
  605. <div class="cause-progress">
  606. <div class="progress-report">
  607. <h6>' . __('PHASES', SH_NAME) . '</h6>
  608. <span>' . $donation_percentage . '%</span>
  609. <div class="progress pattern">
  610. <div class="progress-bar" style="width: ' . $donation_percentage . '%"></div>
  611. </div>
  612. </div>
  613. </div>
  614. <div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_raised') . '</h3><i>' . __('COLLECTED DONATION', SH_NAME) . '</i></div>
  615. <div class="cause-box donate-drop-btn"><h4>' . __('DONATE NOW', SH_NAME) . '</h4></div>
  616. </div>
  617. <div class="donate-drop-down">
  618. <div class="recursive-periods">';
  619. $Settings = get_option(SH_NAME);
  620. $value = sh_set($Settings , 'transactions_detail');
  621. if($value)
  622. {
  623. foreach($value as $val )
  624. {
  625. $txt = ucwords(str_replace('_', ' ', $val));
  626. $output .= '<a style="cursor:pointer;">'.__( $txt, SH_NAME ).'</a>';
  627. }
  628. }
  629. $output .='</div>
  630. <div class="amount-btns">';
  631. if( intval ( sh_set($Settings , 'pop_up_1st_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_1st_value').'</span></a>';
  632. if(intval ( sh_set($Settings , 'pop_up_2nd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_2nd_value').'</span></a>';
  633. if(intval ( sh_set($Settings , 'pop_up_3rd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_3rd_value').'</span></a>';
  634. if(intval ( sh_set($Settings , 'pop_up_4th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_4th_value').'</span></a>';
  635. if(intval ( sh_set($Settings , 'pop_up_5th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_5th_value').'</span></a>';
  636. $output .= '</div>';
  637. $output .= '<div class="other-amount">
  638. ' . $paypal->button(array('item_name' => get_bloginfo('name'), 'amount' => 30, 'return' => $return_url)) . '
  639. </div>';
  640. if (!is_user_logged_in()) {
  641. $output .= '<form id="login" action="" method="post">
  642. <h1>Please Login OR Register first to make recursive donation</h1>
  643. <p class="status"></p>
  644. <label for="username">Username</label>
  645. <input id="username" type="text" name="username">
  646. <label for="password">Password</label>
  647. <input id="password" type="password" name="password">
  648. <a class="lost" href="' . wp_registration_url() . '">Register Now</a>
  649. <input class="submit_button" type="submit" value="Login" name="submit">
  650. <a class="close" href="">(close)</a>
  651. ' . wp_nonce_field('ajax-login-nonce', 'security') . '
  652. </form>';
  653. }
  654. $output .= '</div>
  655. </div>';
  656. }
  657. $output .= '</div>';
  658. return $output;
  659. }
  660. function donation_3($atts, $content = null)
  661. {
  662. extract(shortcode_atts(array(
  663. 'title' => '',
  664. ), $atts));
  665. $paypal_res = '';
  666. $single_page = (sh_set($_SESSION, 'sh_causes_page')) ? sh_set($_SESSION, 'sh_causes_page') : false;
  667. if ($single_page == true) unset($_SESSION['sh_causes_page']);
  668. if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
  669. $paypal_res = require_once(get_template_directory() . '/framework/modules/pp_recurring/review.php');
  670. }
  671. $paypal = $GLOBALS['_sh_base']->donation;
  672. if ($notif = $paypal->_paypal->handleNotification()) $paypal_res = $paypal->single_pament_result($notif);
  673. $return_url = (is_home()) ? home_url() : get_permalink();
  674. $donation_data = get_option(SH_NAME);
  675. $percent = (sh_set($donation_data, 'paypal_target')) ? (int)str_replace(',', '', sh_set($donation_data, 'paypal_raised')) / (int)str_replace(',', '', sh_set($donation_data, 'paypal_target')) : 0;
  676. $donation_percentage = $percent * 100;
  677. $symbol = (sh_set($donation_data, 'paypal_currency')) ? sh_set($donation_data, 'paypal_currency') : '$';
  678. $output = '';
  679. $output .= '<div class="donate-us">
  680. <h3>' . sh_character_limit(20, $title) . '</h3>
  681. <span><i class="icon-phone"></i>' . sh_set($donation_data, 'paypal_contact') . '</span>
  682. <div class="collected">
  683. <p>' . __('Collected Dontaions', SH_NAME) . '</p>
  684. <span><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> ' . sh_set($donation_data, 'paypal_raised') . '!</span> </div>
  685. <div class="d-now">';
  686. if (sh_set($donation_data, 'donate_method') == 'true') {
  687. $output .= '<a data-toggle="modal" data-target="#myModal" class="donate-btn" title="">Donate Us</a>';
  688. } else {
  689. $output .= $paypal->button(array('currency_code' => sh_set($donation_data, 'paypal_currency_code'), 'item_name' => get_bloginfo('name'), 'return' => $return_url));
  690. }
  691. $output .= '</div>
  692. </div>';
  693. $output .= '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
  694. if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
  695. $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
  696. $output .= '<script>
  697. jQuery(document).ready(function($){
  698. $(".donate-us a.donate-btn").trigger("click");
  699. });
  700. </script>';
  701. } elseif ($notif = $paypal->_paypal->handleNotification() && isset($notif->ok)) {
  702. $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
  703. $output .= '<script>
  704. jQuery(document).ready(function($){
  705. $(".donate-us a.donate-btn").trigger("click");
  706. });
  707. </script>';
  708. } else {
  709. $output .= '<div class="donate-popup">
  710. <div class="cause-bar">
  711. <div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_target') . '</h3><i>' . __('NEEDED DONATION', SH_NAME) . '</i></div>
  712. <div class="cause-progress">
  713. <div class="progress-report">
  714. <h6>' . __('PHASES', SH_NAME) . '</h6>
  715. <span>' . $donation_percentage . '%</span>
  716. <div class="progress pattern">
  717. <div class="progress-bar" style="width: ' . $donation_percentage . '%"></div>
  718. </div>
  719. </div>
  720. </div>
  721. <div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_raised') . '</h3><i>' . __('COLLECTED DONATION', SH_NAME) . '</i></div>
  722. <div class="cause-box donate-drop-btn"><h4>' . __('DONATE NOW', SH_NAME) . '</h4></div>
  723. </div>
  724. <div class="donate-drop-down">
  725. <div class="recursive-periods">';
  726. $Settings = get_option(SH_NAME);
  727. $value = sh_set($Settings , 'transactions_detail');
  728. if($value)
  729. {
  730. foreach($value as $val )
  731. {
  732. $txt = ucwords(str_replace('_', ' ', $val));
  733. $output .= '<a style="cursor:pointer;">'.__( $txt, SH_NAME ).'</a>';
  734. }
  735. }
  736. $output .= '</div>
  737. <div class="amount-btns">';
  738. if( intval ( sh_set($Settings , 'pop_up_1st_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_1st_value').'</span></a>';
  739. if(intval ( sh_set($Settings , 'pop_up_2nd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_2nd_value').'</span></a>';
  740. if(intval ( sh_set($Settings , 'pop_up_3rd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_3rd_value').'</span></a>';
  741. if(intval ( sh_set($Settings , 'pop_up_4th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_4th_value').'</span></a>';
  742. if(intval ( sh_set($Settings , 'pop_up_5th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_5th_value').'</span></a>';
  743. $output .= '</div>';
  744. $output .= '<div class="other-amount">
  745. ' . $paypal->button(array('item_name' => get_bloginfo('name'), 'amount' => 30, 'return' => $return_url)) . '
  746. </div>';
  747. if (!is_user_logged_in()) {
  748. $output .= '<form id="login" action="" method="post">
  749. <h1>Please Login OR Register first to make recursive donation</h1>
  750. <p class="status"></p>
  751. <label for="username">Username</label>
  752. <input id="username" type="text" name="username">
  753. <label for="password">Password</label>
  754. <input id="password" type="password" name="password">
  755. <a class="lost" href="' . wp_registration_url() . '">Register Now</a>
  756. <input class="submit_button" type="submit" value="Login" name="submit">
  757. <a class="close" href="">(close)</a>
  758. ' . wp_nonce_field('ajax-login-nonce', 'security') . '
  759. </form>';
  760. }
  761. $output .= '</div>
  762. </div>';
  763. }
  764. $output .= '</div>';
  765. return $output;
  766. }
  767. function start_regular_donation($atts, $content = null)
  768. {
  769. extract(shortcode_atts(array(
  770. 'title' => '',
  771. 'sub_title' => '',
  772. 'image' => '',
  773. 'currency' => '$',
  774. 'donation_needed' => '',
  775. 'link_caption' => '',
  776. 'text' => '',
  777. 'heading_style' => 'simple',
  778. ), $atts));
  779. $title = sh_character_limit(25, $title);
  780. $SubTitle = (!empty($sub_title)) ? '<h5>' . sh_character_limit(26, $sub_title) . '</h5>' : '';
  781. $DonationNeeded = (!empty($donation_needed) || !empty($currency)) ? '<span>' . $currency . $donation_needed . ' </span>' : '';
  782. $output = '';
  783. $output .= '
  784. <div class="donate-message">
  785. ' . wp_get_attachment_image($image, '270x155') . '
  786. ' . $SubTitle . '
  787. <p>' . $DonationNeeded . sh_character_limit(100, $text) . '</p>
  788. <a href="" title="">' . sh_character_limit(25, $link_caption) . '</a>
  789. </div>
  790. ';
  791. return $output;
  792. }
  793. function ceo_message($atts, $content = null)
  794. {
  795. extract(shortcode_atts(array(
  796. 'number' => '',
  797. 'category' => '',
  798. 'sort_by' => 'date',
  799. 'sorting_order' => 'ASC',
  800. 'overlap' => '',
  801. ), $atts)
  802. );
  803. $args = array('post_type' => 'dict_testimonials', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
  804. if ($category != '') $args['tax_query'] = array(array('taxonomy' => 'testimonial_category', 'field' => 'id', 'terms' => $category));
  805. //$Query = 'post_type=dict_testimonials&posts_per_page='.$number.'&orderby='.$sort_by.'&order='.$sorting_order;
  806. //$Query .= (!empty( $category ) ) ? '&testimonial_category='.$category: '';
  807. $Posts = query_posts($args);
  808. $i = 1;
  809. $Message = $MessageNav = '';
  810. if (have_posts()): while (have_posts()): the_post();
  811. $Settings = get_post_meta(get_the_ID(), '_dict_testimonials_settings', true);
  812. $Message .= '<li>
  813. <div class="carusal-image-thumb">
  814. ' . get_the_post_thumbnail(get_the_ID(), '150x150') . '
  815. <strong>' . sh_set($Settings, 'name') . ',</strong>
  816. <span class="carusal-image-thumb-name"> ' . sh_set($Settings, 'designation') . ' </span>
  817. </div>
  818. <p>' . get_the_content() . '</p></a>
  819. </li>';
  820. $i++;
  821. endwhile;
  822. endif;
  823. wp_reset_query();
  824. $output = '';
  825. $output .= '<div class="testimonial';
  826. if( $overlap == 'true' ): $output .= ' overlap'; endif;
  827. $output .= '">
  828. <div class="slideshow">
  829. <ul class="slides">
  830. ' . $Message . '
  831. </ul>
  832. </div>
  833. </div>
  834. <script>
  835. jQuery(document).ready(function($){
  836. if( $(\'.slideshow\').length ){
  837. $(\'.slideshow\').flexslider({
  838. animation: "fade",
  839. animationLoop: false,
  840. slideShow:false,
  841. controlNav: true,
  842. maxItems: 1,
  843. pausePlay: false,
  844. mousewheel:false,
  845. start: function(slider){
  846. $(\'body\').removeClass(\'loading\');
  847. }
  848. });
  849. }
  850. });
  851. </script>';
  852. return $output;
  853. }
  854. /*function recent_news( $atts, $content = null )
  855. {
  856. extract( shortcode_atts( array(
  857. 'number' => '',
  858. 'title' => __('Recent News', SH_NAME),
  859. 'category' => '',
  860. 'sort_by' => 'date',
  861. 'sorting_order' => 'DESC',
  862. 'heading_style' => 'simple' ,
  863. 'margins' =>'' ), $atts )
  864. );
  865. $marginsarr = explode(',' , $margins);
  866. $News = $Thumb = '';
  867. wp_reset_query();
  868. $args = array('post_type' => 'post' , 'posts_per_page'=> $number , 'orderby' => $sort_by , 'order' => $sorting_order, 'category' => $category);
  869. //if($category != '') $args['category'] = array($category);
  870. $query = new WP_Query($args);
  871. //printr($query);
  872. $i = 1;
  873. if( $query->have_posts()): while( $query->have_posts() ): $query->the_post();
  874. $Settings = get_post_meta( get_the_ID(), '_post_settings', true );
  875. if( $video_link = sh_set( $Settings, 'video_link' ) )
  876. {
  877. $opt = get_post_meta( get_the_ID(), '_dictate_gal_videos', true );
  878. $video_data = sh_grab_video( $video_link, $opt );
  879. $PostMedia = '<div class="image">
  880. <img src="'.sh_set( $video_data, 'thumb').'" style="width:261px; height:207px;" alt="'.sh_set( $video_data, 'title' ).'" />
  881. <a class="html5lightbox" rel="prettyPhoto" href="'.$video_link.'" title="'.sh_set( $video_data, 'title' ).'">
  882. <span><i class="icon-play"></i></span>
  883. </a>
  884. </div>';
  885. $CarouselThumb = '<img src="'.sh_set( $video_data, 'thumb').'" style="width:131px; height:78px;" alt="'.sh_set( $video_data, 'title' ).'" />';
  886. }
  887. else
  888. {
  889. $PostAttchment = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'large' );
  890. $PostMedia = '<div class="image">
  891. '.get_the_post_thumbnail( get_the_ID(), '370x252' ).'
  892. <a title="" href="'.sh_set( $PostAttchment, 0 ).'" rel="prettyPhoto" class="html5lightbox"><i class="icon-picture"></i></a>
  893. </div>';
  894. $CarouselThumb = get_the_post_thumbnail( get_the_ID(), '270x155' );
  895. }
  896. $News .= '<div id="news'.$i.'">
  897. <div class="row">
  898. <div class="col-md-6 desc">
  899. <h3><a href="'.get_permalink().'" title="">'.sh_character_limit( 35, get_the_title() ).'</a></h3>
  900. <p>'.sh_character_limit( 340, get_the_content() ).'</p>
  901. </div>
  902. <div class="col-md-6">
  903. '.$PostMedia.'
  904. </div>
  905. </div>
  906. </div>';
  907. $Thumb .= '<a href="#news'.$i.'">'.$CarouselThumb.'<span class="carusal-our-news">'.sh_character_limit( 17, get_the_title() ).'</span></a>';
  908. $i++;
  909. endwhile;
  910. endif;
  911. wp_reset_query();
  912. wp_enqueue_script('carofredcsel');
  913. $output = '' ;
  914. $output.= ( in_array('top' , (array)$marginsarr)) ? '<div class="block"></div>' : '';
  915. $output .= ($heading_style == 'underline')? '<div class="sec-heading">
  916. '.sh_get_title( $title, 'h2', 'strong', TRUE ).'
  917. </div>' : '' ;
  918. $output .= ($heading_style == 'modern')? '<div class="sec-title">
  919. '.sh_get_title( $title, 'h1', 'span', FALSE ).'
  920. </div>' : '' ;
  921. $output .= ($heading_style == 'simple')? '<div class="sec-heading2">
  922. '.sh_get_title( $title, 'h2', 'strong', TRUE ).'
  923. </div>' : '' ;
  924. $output .= '<div class="carusal-slider">
  925. <div id="carousel-wrapper">
  926. <div id="carousel">
  927. '.$News.'
  928. </div>
  929. </div>
  930. <div id="thumbs-wrapper">
  931. <div id="thumbs">'.$Thumb.'</div>
  932. <a id="prev" href="#"><i class="icon-angle-left"></i></a> <a id="next" href="#"><i class="icon-angle-right"></i></a> </div>
  933. </div>
  934. <script>
  935. jQuery(document).ready(function($){
  936. $(\'#carousel\').carouFredSel({
  937. responsive: true,
  938. circular: false,
  939. auto: false,
  940. items: {
  941. visible: 1,
  942. width: 20,
  943. },
  944. scroll: {
  945. fx: \'directscroll\'
  946. }
  947. });
  948. $(\'#thumbs\').carouFredSel({
  949. responsive: true,
  950. circular: false,
  951. infinite: false,
  952. auto: false,
  953. prev: \'#prev\',
  954. next: \'#next\',
  955. items: {
  956. visible: {
  957. min: 1,
  958. max: 6
  959. },
  960. width: 200,
  961. height: \'80%\'
  962. }
  963. });
  964. $(\'#thumbs a\').click(function() {
  965. $(\'#carousel\').trigger(\'slideTo\', \'#\' + this.href.split(\'#\').pop() );
  966. $(\'#thumbs a\').removeClass(\'selected\');
  967. $(this).addClass(\'selected\');
  968. return false;
  969. });
  970. });
  971. </script>
  972. ';
  973. $output.= ( in_array('bottom' , (array)$marginsarr)) ? '<div class="block"></div>' : '';
  974. return $output ;
  975. }
  976. */
  977. function recent_events($atts, $content = null)
  978. {
  979. extract(shortcode_atts(array(
  980. 'title' => 'Recent Events',
  981. 'number' => '',
  982. 'category' => '',
  983. 'sort_by' => 'date',
  984. 'sorting_order' => 'ASC',
  985. 'heading_style' => 'simple',
  986. ), $atts)
  987. );
  988. $args = array('post_type' => 'dict_event', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
  989. if ($category) $args['tax_query'] = array(array('taxonomy' => 'event_category', 'field' => 'id', 'terms' => $category));
  990. query_posts($args);
  991. $Events = '';
  992. $i = 1;
  993. if (have_posts()): while (have_posts()): the_post();
  994. $Settings = get_post_meta(get_the_ID(), '_dict_event_settings', true);
  995. $PostThumbSize1 = ($i == 1) ? 'style="width:570px; height:184px;"' : 'style="width:100px; height:100px;"';
  996. $PostThumbSize2 = ($i == 1) ? '570x220' : '150x150';
  997. $EventOrganizer = ($i == 1 && sh_set($Settings, 'organizer')) ? '<li><a href="#" title=""><i class="icon-user"></i>' . __('by', SH_NAME) . ' ' . sh_set($Settings, 'organizer') . '</a></li>' : '';
  998. $EventdateDetails = '';
  999. if (sh_set($Settings, 'video_link')) {
  1000. $video_link = sh_set($Settings, 'video_link');
  1001. $video_data = sh_grab_video($video_link, $Settings);
  1002. $PostMedia = '<div class="carou-post-img">
  1003. <img src="' . sh_set($video_data, 'thumb') . '" ' . $PostThumbSize1 . ' alt="' . sh_set($video_data, 'title') . '" />
  1004. <a title="' . sh_set($video_data, 'title') . '" href="' . $video_link . '" class="html5lightbox"><i class="icon-play"></i></a>
  1005. </div>';
  1006. } else {
  1007. //$PostMedia = get_the_post_thumbnail( get_the_ID(), $PostThumbSize );
  1008. $PostAttchment = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'large');
  1009. $PostMedia = '<div class="carou-post-img">
  1010. ' . get_the_post_thumbnail(get_the_ID(), $PostThumbSize2) . '
  1011. <a title="" href="' . sh_set($PostAttchment, 0) . '" class="html5lightbox"><i class="icon-picture"></i></a>
  1012. </div>';
  1013. }
  1014. if (!empty($Settings['start_date'])) {
  1015. $Eventdate = new DateTime($Settings['start_date']);
  1016. $EventdateDetails = '<li><a href="' . get_permalink() . '" title=""><i class="icon-calendar-empty"></i><span>' . $Eventdate->format('F') . '</span> ' . $Eventdate->format('d, Y') . '</a></li>';
  1017. } else if (!empty($Settings['end_date'])) {
  1018. $Eventdate = new DateTime($Settings['end_date']);
  1019. $EventdateDetails = '<li><a href="' . get_permalink() . '" title=""><i class="icon-calendar-empty"></i><span>' . $Eventdate->format('F') . '</span> ' . $Eventdate->format('d, Y') . '</a></li>';
  1020. }
  1021. $Class = ($i == 1) ? 'recent-event' : 'recent-event previous-event';
  1022. $md_class = ($i == 1) ? 'col-md-12' : 'col-md-6';
  1023. $Location = (sh_set($Settings, 'location')) ? '<li><a href="' . get_permalink() . '" title=""><i class="icon-map-marker"></i>in ' . sh_set($Settings, 'location') . '</a></li>' : '';
  1024. $TitleLength = ($i == 1) ? 35 : 20;
  1025. $Events .= '<div class="' . $md_class . '">
  1026. <div class="' . $Class . '">
  1027. <div class="recent-event-img">

Large files files are truncated, but you can click here to view the full file