PageRenderTime 56ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/et-shortcodes/shortcodes.php

https://github.com/bfay/maniacal-kitten
PHP | 1346 lines | 1107 code | 238 blank | 1 comment | 109 complexity | 9fd59c6c353fc1c70162b439e83ebef5 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-3.0, LGPL-2.1
  1. <?php
  2. /********* Shortcodes v.3.0 ************/
  3. define('ET_SHORTCODES_VERSION', '3.0');
  4. add_action('wp_enqueue_scripts', 'et_shortcodes_css_and_js');
  5. function et_shortcodes_css_and_js(){
  6. $options = et_shortcodes_get_plugin_options();
  7. $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
  8. wp_enqueue_style( 'et-shortcodes-css', ET_SHORTCODES_PLUGIN_URI . '/css/shortcodes.css', false, ET_SHORTCODES_VERSION, 'all' );
  9. if ( 'on' == $options['responsive_layout'] ) wp_enqueue_style( 'et-shortcodes-responsive-css', ET_SHORTCODES_PLUGIN_URI . '/css/shortcodes_responsive.css', false, ET_SHORTCODES_VERSION, 'all' );
  10. wp_register_script( 'et-shortcodes-js', ET_SHORTCODES_PLUGIN_URI . "/js/et_shortcodes_frontend{$suffix}.js", array('jquery'), ET_SHORTCODES_VERSION, true );
  11. wp_localize_script( 'et-shortcodes-js', 'et_shortcodes_strings', array( 'previous' => __( 'Previous' ), 'next' => __( 'Next' ) ) );
  12. }
  13. function et_add_simple_buttons(){
  14. wp_print_scripts( 'quicktags' );
  15. $output = "<script type='text/javascript'>\n
  16. /* <![CDATA[ */ \n";
  17. $buttons = array();
  18. $buttons[] = array('name' => 'raw',
  19. 'options' => array(
  20. 'display_name' => 'raw',
  21. 'open_tag' => '\n[raw]',
  22. 'close_tag' => '[/raw]\n',
  23. 'key' => ''
  24. ));
  25. $buttons[] = array('name' => 'one_half',
  26. 'options' => array(
  27. 'display_name' => 'one half',
  28. 'open_tag' => '\n[one_half]',
  29. 'close_tag' => '[/one_half]\n',
  30. 'key' => ''
  31. ));
  32. $buttons[] = array('name' => 'one_half_last',
  33. 'options' => array(
  34. 'display_name' => 'one half last',
  35. 'open_tag' => '\n[one_half_last]',
  36. 'close_tag' => '[/one_half_last]\n',
  37. 'key' => ''
  38. ));
  39. $buttons[] = array('name' => 'one_third',
  40. 'options' => array(
  41. 'display_name' => 'one third',
  42. 'open_tag' => '\n[one_third]',
  43. 'close_tag' => '[/one_third]\n',
  44. 'key' => ''
  45. ));
  46. $buttons[] = array('name' => 'one_third_last',
  47. 'options' => array(
  48. 'display_name' => 'one third last',
  49. 'open_tag' => '\n[one_third_last]',
  50. 'close_tag' => '[/one_third_last]\n',
  51. 'key' => ''
  52. ));
  53. $buttons[] = array('name' => 'one_fourth',
  54. 'options' => array(
  55. 'display_name' => 'one fourth',
  56. 'open_tag' => '\n[one_fourth]',
  57. 'close_tag' => '[/one_fourth]\n',
  58. 'key' => ''
  59. ));
  60. $buttons[] = array('name' => 'one_fourth_last',
  61. 'options' => array(
  62. 'display_name' => 'one fourth last',
  63. 'open_tag' => '\n[one_fourth_last]',
  64. 'close_tag' => '[/one_fourth_last]\n',
  65. 'key' => ''
  66. ));
  67. $buttons[] = array('name' => 'two_third',
  68. 'options' => array(
  69. 'display_name' => 'two third',
  70. 'open_tag' => '\n[two_third]',
  71. 'close_tag' => '[/two_third]\n',
  72. 'key' => ''
  73. ));
  74. $buttons[] = array('name' => 'two_third_last',
  75. 'options' => array(
  76. 'display_name' => 'two third last',
  77. 'open_tag' => '\n[two_third_last]',
  78. 'close_tag' => '[/two_third_last]\n',
  79. 'key' => ''
  80. ));
  81. $buttons[] = array('name' => 'three_fourth',
  82. 'options' => array(
  83. 'display_name' => 'three fourth',
  84. 'open_tag' => '\n[three_fourth]',
  85. 'close_tag' => '[/three_fourth]\n',
  86. 'key' => ''
  87. ));
  88. $buttons[] = array('name' => 'three_fourth_last',
  89. 'options' => array(
  90. 'display_name' => 'three fourth last',
  91. 'open_tag' => '\n[three_fourth_last]',
  92. 'close_tag' => '[/three_fourth_last]\n',
  93. 'key' => ''
  94. ));
  95. $buttons[] = array('name' => 'three_fourth_last',
  96. 'options' => array(
  97. 'display_name' => 'three fourth last',
  98. 'open_tag' => '\n[three_fourth_last]',
  99. 'close_tag' => '[/three_fourth_last]\n',
  100. 'key' => ''
  101. ));
  102. $buttons[] = array('name' => 'box',
  103. 'options' => array(
  104. 'display_name' => 'box',
  105. 'open_tag' => '\n[box type="shadow"]',
  106. 'close_tag' => '[/box]\n',
  107. 'key' => ''
  108. ));
  109. $buttons[] = array('name' => 'tooltip',
  110. 'options' => array(
  111. 'display_name' => 'tooltip',
  112. 'open_tag' => '[tooltip text="Tooltip Text"]',
  113. 'close_tag' => '[/tooltip]',
  114. 'key' => ''
  115. ));
  116. $buttons[] = array('name' => 'learn_more',
  117. 'options' => array(
  118. 'display_name' => 'learn_more',
  119. 'open_tag' => '\n[learn_more caption="Click here to learn more"]',
  120. 'close_tag' => '[/learn_more]\n',
  121. 'key' => ''
  122. ));
  123. $buttons[] = array('name' => 'slider',
  124. 'options' => array(
  125. 'display_name' => 'slider',
  126. 'open_tag' => '\n[slider]',
  127. 'close_tag' => '[/slider]\n',
  128. 'key' => ''
  129. ));
  130. $buttons[] = array('name' => 'slide',
  131. 'options' => array(
  132. 'display_name' => 'slide',
  133. 'open_tag' => '\n[slide]',
  134. 'close_tag' => '[/slide]\n',
  135. 'key' => ''
  136. ));
  137. $buttons[] = array('name' => 'button',
  138. 'options' => array(
  139. 'display_name' => 'button',
  140. 'open_tag' => '\n[button link="#"]',
  141. 'close_tag' => '[/button]\n',
  142. 'key' => ''
  143. ));
  144. $buttons[] = array('name' => 'digg',
  145. 'options' => array(
  146. 'display_name' => 'digg',
  147. 'open_tag' => '\n[digg]',
  148. 'close_tag' => '[/digg]\n',
  149. 'key' => ''
  150. ));
  151. $buttons[] = array('name' => 'stumble',
  152. 'options' => array(
  153. 'display_name' => 'stumble',
  154. 'open_tag' => '\n[stumble]',
  155. 'close_tag' => '[/stumble]\n',
  156. 'key' => ''
  157. ));
  158. $buttons[] = array('name' => 'facebook',
  159. 'options' => array(
  160. 'display_name' => 'facebook',
  161. 'open_tag' => '\n[facebook]',
  162. 'close_tag' => '[/facebook]\n',
  163. 'key' => ''
  164. ));
  165. $buttons[] = array('name' => 'buzz',
  166. 'options' => array(
  167. 'display_name' => 'buzz',
  168. 'open_tag' => '\n[buzz]',
  169. 'close_tag' => '[/buzz]\n',
  170. 'key' => ''
  171. ));
  172. $buttons[] = array('name' => 'twitter',
  173. 'options' => array(
  174. 'display_name' => 'twitter',
  175. 'open_tag' => '\n[twitter name="name"]',
  176. 'close_tag' => '[/twitter]\n',
  177. 'key' => ''
  178. ));
  179. $buttons[] = array('name' => 'retweet',
  180. 'options' => array(
  181. 'display_name' => 'retweet',
  182. 'open_tag' => '\n[retweet]',
  183. 'close_tag' => '[/retweet]\n',
  184. 'key' => ''
  185. ));
  186. $buttons[] = array('name' => 'feedburner',
  187. 'options' => array(
  188. 'display_name' => 'feedburner',
  189. 'open_tag' => '\n[feedburner name="name"]',
  190. 'close_tag' => '[/feedburner]\n',
  191. 'key' => ''
  192. ));
  193. $buttons[] = array('name' => 'protected',
  194. 'options' => array(
  195. 'display_name' => 'protected',
  196. 'open_tag' => '\n[protected]',
  197. 'close_tag' => '[/protected]\n',
  198. 'key' => ''
  199. ));
  200. for ($i=0; $i <= (count($buttons)-1); $i++) {
  201. $output .= "edButtons[edButtons.length] = new edButton('ed_{$buttons[$i]['name']}'
  202. ,'{$buttons[$i]['options']['display_name']}'
  203. ,'{$buttons[$i]['options']['open_tag']}'
  204. ,'{$buttons[$i]['options']['close_tag']}'
  205. ,'{$buttons[$i]['options']['key']}'
  206. ); \n";
  207. }
  208. $output .= "\n /* ]]> */ \n
  209. </script>";
  210. echo $output;
  211. }
  212. add_shortcode('digg', 'et_digg');
  213. function et_digg($atts, $content = null) {
  214. $output = "<script type='text/javascript'>
  215. (function() {
  216. var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
  217. s.type = 'text/javascript';
  218. s.async = true;
  219. s.src = 'http://widgets.digg.com/buttons.js';
  220. s1.parentNode.insertBefore(s, s1);
  221. })();
  222. </script>
  223. <!-- Medium Button -->
  224. <a class='DiggThisButton DiggMedium'></a>";
  225. return $output;
  226. }
  227. add_shortcode('stumble','et_stumble');
  228. function et_stumble($atts, $content = null){
  229. $output = "<script src='http://www.stumbleupon.com/hostedbadge.php?s=5' type='text/javascript'></script>";
  230. return $output;
  231. }
  232. add_shortcode('facebook','et_facebook');
  233. function et_facebook($atts, $content = null){
  234. $output = "<a name='fb_share' type='button_count' href='http://www.facebook.com/sharer.php'>Share</a><script src='http://static.ak.fbcdn.net/connect.php/js/FB.Share' type='text/javascript'></script>";
  235. return $output;
  236. }
  237. add_shortcode('buzz','et_buzz');
  238. function et_buzz($atts, $content = null){
  239. $output = "<a title='Post to Google Buzz' class='google-buzz-button' href='http://www.google.com/buzz/post' data-button-style='normal-count'></a>
  240. <script type='text/javascript' src='http://www.google.com/buzz/api/button.js'></script>";
  241. return $output;
  242. }
  243. add_shortcode('twitter','et_twitter');
  244. function et_twitter($atts, $content = null){
  245. extract(shortcode_atts(array(
  246. "name" => 'name'
  247. ), $atts));
  248. $output = "<script type='text/javascript' src='" . esc_url( "http://twittercounter.com/embed/{$name}/ffffff/111111" ) . "'></script>";
  249. return $output;
  250. }
  251. add_shortcode('feedburner','et_feedburner');
  252. function et_feedburner($atts, $content = null){
  253. extract(shortcode_atts(array(
  254. "name" => 'name'
  255. ), $atts));
  256. $output = "<a href='" . esc_url( "http://feeds.feedburner.com/{$name}" ) . "'><img src='" . esc_url( "http://feeds.feedburner.com/~fc/{$name}?bg=99CCFF&amp;fg=444444&amp;anim=0" ) . "' height='26' width='88' style='border:0' alt='' />
  257. </a>";
  258. return $output;
  259. }
  260. add_shortcode('retweet','et_retweet');
  261. function et_retweet($atts, $content = null){
  262. $output = "<a href='http://twitter.com/share' class='twitter-share-button' data-count='vertical'>Tweet</a><script type='text/javascript' src='http://platform.twitter.com/widgets.js'></script>";
  263. return $output;
  264. }
  265. add_shortcode('protected','et_protected');
  266. function et_protected($atts, $content = null){
  267. global $themename, $user_login;
  268. if ( is_user_logged_in() ) {
  269. $content = et_content_helper($content);
  270. $output = $content;
  271. } else {
  272. $output = "<div class='et-protected'>
  273. <div class='et-protected-title'>" . esc_html__('Member Login',$themename) . "</div>
  274. <div class='et-protected-form'>
  275. <form action='" . esc_url( site_url('wp-login.php') ) . "' method='post'>
  276. <p><label>" . "<span>" . esc_html__('Username: ',$themename) . "</span>" . "<input type='text' name='log' id='log' value='" . esc_attr( $user_login ) . "' size='20' /><span class='et_protected_icon'></span></label></p>
  277. <p><label>" . "<span>" . esc_html__('Password: ',$themename) . "</span>" . "<input type='password' name='pwd' id='pwd' size='20' /><span class='et_protected_icon et_protected_password'></span></label></p>
  278. <input type='submit' name='submit' value='" . esc_html__('Login',$themename) . "' class='etlogin-button' />
  279. <input type='hidden' name='redirect_to' value='" . esc_url( get_permalink() ) . "'>
  280. </form>
  281. </div> <!-- .et-protected-form -->
  282. </div> <!-- .et-protected -->";
  283. }
  284. return $output;
  285. }
  286. add_shortcode('box', 'et_box');
  287. function et_box($atts, $content = null) {
  288. extract(shortcode_atts(array(
  289. "type" => 'shadow',
  290. "id" => '',
  291. "class" => ''
  292. ), $atts));
  293. $content = et_content_helper($content);
  294. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  295. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  296. $output = "<div{$id} class='et-box{$class} et-{$type}'>
  297. <div class='et-box-content'>";
  298. $output .= do_shortcode($content);
  299. $output .= "</div></div>";
  300. return $output;
  301. }
  302. add_shortcode('tooltip', 'et_tooltip');
  303. function et_tooltip($atts, $content = null) {
  304. global $themename;
  305. extract(shortcode_atts(array(
  306. "text" => esc_html__( 'Add a Tooltip Text', $themename ),
  307. "id" => '',
  308. "class" => ''
  309. ), $atts));
  310. wp_enqueue_script( 'et-shortcodes-js' );
  311. $content = et_content_helper($content);
  312. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  313. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  314. $output = "<span{$id} class='et-tooltip{$class}'>{$content}<span class='et-tooltip-box'>{$text}<span class='et-tooltip-arrow'></span></span></span>";
  315. return $output;
  316. }
  317. add_shortcode('learn_more', 'et_learnmore');
  318. function et_learnmore($atts, $content = null) {
  319. global $themename;
  320. extract(shortcode_atts(array(
  321. "caption" => __( 'Click here to learn more', $themename ),
  322. "state" => 'close',
  323. "id" => '',
  324. "class" => ''
  325. ), $atts));
  326. wp_enqueue_script( 'et-shortcodes-js' );
  327. $content = et_content_helper($content);
  328. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  329. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  330. $divClass = ($state == 'close') ? 'et-learn-more' : 'et-learn-more et-open';
  331. $hClass = ($state == 'close') ? 'heading-more' : 'heading-more open';
  332. $divClass .= ' clearfix';
  333. $output = "<div{$id} class='{$divClass}{$class}'>
  334. <h3 class='{$hClass}'>" . esc_html( $caption ) . "<span class='et_learnmore_arrow'><span></span></span></h3>
  335. <div class='learn-more-content'>{$content}</div>
  336. </div>";
  337. return $output;
  338. }
  339. add_shortcode('button', 'et_button');
  340. function et_button($atts, $content = null) {
  341. extract(shortcode_atts(array(
  342. "link" => "#",
  343. "color" => "blue",
  344. "type" => "small",
  345. "icon" => "download",
  346. "newwindow" => "no",
  347. "id" => '',
  348. "class" => '',
  349. "br" => 'no'
  350. ), $atts));
  351. $output = '';
  352. $target = ($newwindow == 'yes') ? ' target="_blank"' : '';
  353. $content = et_content_helper($content);
  354. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  355. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  356. if ($type == 'small')
  357. $output .= "<a{$id} href='{$link}' class='small-button small{$color}{$class}'{$target}>{$content}</a>";
  358. if ($type == 'big')
  359. $output .= "<a{$id} href='{$link}' class='big-button big{$color}{$class}'{$target}>{$content}</a>";
  360. if ($type == 'icon')
  361. $output .= "<a{$id} href='{$link}' class='icon-button {$icon}-icon{$class}'{$target}>{$content}<span class='et-icon'></span></a>";
  362. if ( $br == 'yes' ) $output .= '<br class="clear"/>';
  363. return $output;
  364. }
  365. add_shortcode('slide', 'et_slide');
  366. function et_slide($atts, $content = null) {
  367. extract(shortcode_atts(array(
  368. "id" => '',
  369. "class" => ''
  370. ), $atts));
  371. $content = et_content_helper($content);
  372. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  373. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  374. $output = "<div{$id} class='et-slide{$class}'>
  375. {$content}
  376. </div>";
  377. return $output;
  378. }
  379. add_shortcode('tabs', 'et_tabs');
  380. function et_tabs($atts, $content = null) {
  381. extract(shortcode_atts(array(
  382. "fx" => 'fade',
  383. "auto" => 'no',
  384. "autospeed" => '5000',
  385. "id" => '',
  386. "slidertype" => 'top tabs',
  387. "class" => ''
  388. ), $atts));
  389. wp_enqueue_script( 'et-shortcodes-js' );
  390. $auto = ( $auto == 'no' ) ? 'false' : 'true';
  391. $content = et_content_helper($content);
  392. $id = $id <> '' ? " id='{$id}'" : '';
  393. $class = ($class <> '') ? " {$class}" : '';
  394. $class .= " et_sliderfx_{$fx}" . " et_sliderauto_{$auto}" . " et_sliderauto_speed_{$autospeed}";
  395. if ($slidertype == 'top tabs') {
  396. $class .= ' et_slidertype_top_tabs';
  397. $output = "
  398. <div class='" . esc_attr( "et-tabs-container{$class}" ) ."'{$id}>
  399. {$content}
  400. </div> <!-- .et-tabs-container -->";
  401. } elseif ($slidertype == 'left tabs') {
  402. $class .= ' et_slidertype_left_tabs clearfix';
  403. $output = "
  404. <div class='" . esc_attr( "tabs-left{$class}" ) . "'{$id}>
  405. <div class='et_left_tabs_bg'></div>
  406. {$content}
  407. </div> <!-- .tabs-left -->";
  408. } elseif ($slidertype == 'simple') {
  409. $class .= ' et_slidertype_simple';
  410. $output = "
  411. <div class='" . esc_attr( "et-simple-slider{$class}" ) . "'{$id}>
  412. <div class='et-simple-slides'>
  413. <div class='et-tabs-content-wrapper'>
  414. {$content}
  415. </div>
  416. </div>
  417. </div> <!-- .et-simple-slider -->
  418. ";
  419. } elseif ($slidertype == 'images') {
  420. $class .= ' et_slidertype_images';
  421. $output = "
  422. <div class='" . esc_attr( "et-image-slider{$class}" ) . "'{$id}>
  423. <div class='et-image-slides'>
  424. <div class='et-tabs-content-wrapper'>
  425. {$content}
  426. </div>
  427. </div>
  428. </div> <!-- .et-image-slider -->
  429. ";
  430. }
  431. return $output;
  432. }
  433. add_shortcode('tabcontainer', 'et_tabcontainer');
  434. function et_tabcontainer($atts, $content = null) {
  435. $content = et_content_helper($content);
  436. $output = "
  437. <ul class='et-tabs-control'>
  438. {$content}
  439. </ul> <!-- .et-tabs-control -->";
  440. return $output;
  441. }
  442. add_shortcode('imagetabcontainer', 'et_imagetabcontainer');
  443. function et_imagetabcontainer($atts, $content = null) {
  444. extract(shortcode_atts(array(
  445. "id" => '',
  446. "class" => ''
  447. ), $atts));
  448. $content = et_content_helper($content);
  449. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  450. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  451. $output = "
  452. <div{$id} class='controllers-wrapper{$class}'>
  453. <div class='controllers'>
  454. <a class='left-arrow' href='#'>Previous</a>
  455. {$content}
  456. <a class='right-arrow' href='#'>Next</a>
  457. </div> <!-- end #controllers -->
  458. <div class='controllers-right'></div>
  459. </div><!-- end #controllers-wrapper -->";
  460. return $output;
  461. }
  462. add_shortcode('imagetabtext', 'et_imagetabtext');
  463. function et_imagetabtext($atts, $content = null) {
  464. $content = et_content_helper($content);
  465. $output = "
  466. <a href='#' class='switch'>
  467. {$content}
  468. </a>";
  469. return $output;
  470. }
  471. add_shortcode('tabtext', 'et_tabtext');
  472. function et_tabtext($atts, $content = null) {
  473. extract(shortcode_atts(array(
  474. "id" => '',
  475. "class" => ''
  476. ), $atts));
  477. $content = et_content_helper($content);
  478. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  479. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  480. $output = "
  481. <li{$id}{$class}><a href='#'>
  482. {$content}
  483. </a></li>";
  484. return $output;
  485. }
  486. add_shortcode('tabcontent', 'et_tabcontent');
  487. function et_tabcontent($atts, $content = null) {
  488. extract(shortcode_atts(array(
  489. "id" => '',
  490. "class" => ''
  491. ), $atts));
  492. $content = et_content_helper($content);
  493. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  494. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  495. $output = "
  496. <div{$id} class='et-tabs-content{$class}'>
  497. <div class='et-tabs-content-wrapper'>
  498. {$content}
  499. </div>
  500. </div>";
  501. return $output;
  502. }
  503. add_shortcode('tab', 'et_tab');
  504. function et_tab($atts, $content = null) {
  505. extract(shortcode_atts(array(
  506. "id" => '',
  507. "class" => ''
  508. ), $atts));
  509. $content = et_content_helper($content);
  510. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  511. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  512. $output = "
  513. <div{$id} class='et_slidecontent{$class}'>
  514. {$content}
  515. </div>";
  516. return $output;
  517. }
  518. add_shortcode('imagetab', 'et_imagetab');
  519. function et_imagetab($atts, $content = null) {
  520. extract(shortcode_atts(array(
  521. "width" => '',
  522. "height" => '',
  523. "id" => '',
  524. "class" => '',
  525. "link" => '',
  526. "newwindow" => ''
  527. ), $atts));
  528. $target = '' != $newwindow ? ' target="_blank"' : '';
  529. $content = et_content_helper($content);
  530. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  531. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  532. $output = "
  533. <div{$id} class='et_slidecontent et-image-slide{$class}'>" . ( '' != $link ? "<a href='" . esc_url( $link ) . "'{$target}>" : '' ) . et_new_thumb_resize( $content, $width, $height, '' ) . "<span class='et-image-overlay'> </span>" . ( '' != $link ? '</a>' : '' ) . "</div>";
  534. return $output;
  535. }
  536. add_shortcode('author', 'et_author');
  537. function et_author($atts, $content = null) {
  538. extract(shortcode_atts(array(
  539. 'id' => '',
  540. 'class' => '',
  541. 'name' => '',
  542. 'description' => ''
  543. ), $atts));
  544. $content = et_content_helper($content);
  545. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  546. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  547. $output = "
  548. <div{$id} class='author-shortcodes{$class}'>
  549. <div class='author-inner'>
  550. {$content}
  551. </div> <!-- .author-inner -->
  552. </div> <!-- .author-shortcodes -->";
  553. return $output;
  554. }
  555. add_shortcode('author_image', 'et_author_image');
  556. function et_author_image($atts, $content = null) {
  557. extract(shortcode_atts(array(
  558. "timthumb" => 'on'
  559. ), $atts));
  560. $content = et_content_helper($content);
  561. $src = ($timthumb == 'on') ? ( et_new_thumb_resize( $content, 60, 60, '', $forstyle = true ) ) : $content;
  562. $output = "
  563. <div class='author-image'>
  564. <img src='{$src}' alt='' />
  565. <div class='author-overlay'></div>
  566. </div> <!-- .author-image -->";
  567. return $output;
  568. }
  569. add_shortcode('author_info', 'et_author_info');
  570. function et_author_info($atts, $content = null) {
  571. $content = et_content_helper($content);
  572. $output = "
  573. <div class='author-info'>
  574. {$content}
  575. </div> <!-- .author-info -->";
  576. return $output;
  577. }
  578. add_shortcode('pricing_table', 'et_pricing_table');
  579. function et_pricing_table($atts, $content = null) {
  580. wp_enqueue_script( 'et-shortcodes-js' );
  581. $content = et_content_helper($content);
  582. $output = "
  583. <div class='et-pricing clearfix'>
  584. {$content}
  585. </div> <!-- end .et-pricing -->";
  586. return $output;
  587. }
  588. add_shortcode('custom_list', 'et_custom_list');
  589. function et_custom_list($atts, $content = null) {
  590. extract(shortcode_atts(array(
  591. "type" => 'checkmark'
  592. ), $atts));
  593. $content = et_content_helper($content);
  594. $type = ( $type <> 'checkmark' ) ? ' etlist-' . $type : '';
  595. $output = "
  596. <div class='et-custom-list{$type}'>
  597. {$content}
  598. </div> <!-- .et-custom-list -->";
  599. return $output;
  600. }
  601. add_shortcode('pricing', 'et_pricing');
  602. function et_pricing($atts, $content = null) {
  603. extract(shortcode_atts(array(
  604. "price" => '19.95',
  605. "title" => "professional",
  606. "desc" => "",
  607. "url" => "#",
  608. "window" => "",
  609. "moretext" => 'Join Now',
  610. "type" => "small",
  611. "currency" => "$"
  612. ), $atts));
  613. $content = et_content_helper($content);
  614. $separator_sign = ( strpos($price, '.') !== false ) ? '.' : ',';
  615. $price_array = explode($separator_sign, $price);
  616. $link_target = ( $window == 'new' ) ? ' target="_blank"' : '';
  617. $type = ( $type == 'big' ) ? ' pricing-big' : '';
  618. $output = "
  619. <div class='pricing-table{$type}'>
  620. <div class='pricing-table-wrap'>
  621. <div class='pricing-heading'>
  622. <h2 class='pricing-title'>{$title}</h2>
  623. <p>{$desc}</p>
  624. </div> <!-- end .pricing-heading -->
  625. <div class='pricing-content'>
  626. <ul class='pricing'>
  627. {$content}
  628. </ul>
  629. </div> <!-- end .pricing-content -->
  630. <div class='pricing-content-bottom'>
  631. <span class='et-price'><span class='dollar-sign'>{$currency}</span>{$price_array[0]}<sup>{$price_array[1]}</sup></span>
  632. </div> <!-- end .pricing-content-bottom -->
  633. <a href='" . esc_url( $url ) . "' class='icon-button'{$link_target}>{$moretext}</a>
  634. </div> <!-- end .pricing-table-wrap -->
  635. </div> <!-- end .pricing-table -->";
  636. return $output;
  637. }
  638. add_shortcode('feature', 'et_pricing_feature');
  639. function et_pricing_feature($atts, $content = null) {
  640. extract(shortcode_atts(array(
  641. "checkmark" => 'normal'
  642. ), $atts));
  643. $content = et_content_helper($content);
  644. $class = ( $checkmark == 'x' ) ? ' class="x-mark"' : '';
  645. $output = "<li{$class}>{$content}<span></span></li>";
  646. return $output;
  647. }
  648. add_shortcode('dropcap', 'et_dropcap');
  649. function et_dropcap($atts, $content = null) {
  650. extract(shortcode_atts(array(
  651. 'style' => '',
  652. 'id' => '',
  653. 'class' => ''
  654. ), $atts));
  655. $content = et_content_helper($content);
  656. $style = ( $style <> '' ) ? ' style="' . $style . '"' : '';
  657. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  658. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  659. $output = "<span{$id} class='et-dropcap{$class}'{$style}>{$content}</span>";
  660. return $output;
  661. }
  662. add_shortcode('testimonial', 'et_testimonial');
  663. function et_testimonial($atts, $content = null) {
  664. extract(shortcode_atts(array(
  665. 'style' => '',
  666. 'id' => '',
  667. 'class' => '',
  668. 'author' => '',
  669. 'company' => '',
  670. 'image' => '',
  671. 'timthumb' => 'on'
  672. ), $atts));
  673. $content = et_content_helper($content);
  674. $style = ( $style <> '' ) ? ' style="' . $style . '"' : '';
  675. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  676. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  677. $orig_name = $author;
  678. $author = ( $author <> '' ) ? "<span class='t-author'>{$author}</span>" : '';
  679. $company = ( $company <> '' ) ? "<span class='t-position'>{$company}</span>" : '';
  680. $image_markup = '';
  681. if ( $image <> '' ) {
  682. $image = ( $timthumb == 'on' ) ? et_new_thumb_resize( $image, 60, 60, '', $forstyle = true ) : $image;
  683. $image_markup = "
  684. <div class='t-img'>
  685. <img src='{$image}' alt='{$orig_name}' />
  686. <span class='t-overlay'></span>
  687. </div>
  688. ";
  689. }
  690. $output = "
  691. <div{$id} class='et-testimonial-box{$class}'{$style}>
  692. <div class='et-testimonial-author-info clearfix'>
  693. {$image_markup}
  694. {$author}
  695. {$company}
  696. </div>
  697. <div class='et-testimonial clearfix'>
  698. {$content}
  699. </div>
  700. <div class='t-bottom-arrow'></div>
  701. </div>";
  702. return $output;
  703. }
  704. add_shortcode('quote','et_quote');
  705. function et_quote($atts, $content = null) {
  706. extract(shortcode_atts(array(
  707. 'style' => '',
  708. 'id' => '',
  709. 'class' => '',
  710. 'type' => 'normal'
  711. ), $atts));
  712. $content = et_content_helper($content);
  713. $style = ( $style <> '' ) ? ' style="' . $style . '"' : '';
  714. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  715. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  716. if ( $type == 'center' ) $class = ' quote-center';
  717. $output = "
  718. <div{$id} class='et_quote{$class}'{$style}>
  719. <div class='et_right_quote'>
  720. {$content}
  721. " . ( 'center' == $type ? "<span class='et_quote_additional_sign'></span>" : '' ) . "
  722. </div>
  723. <span class='et_quote_sign'></span>
  724. </div>
  725. ";
  726. return $output;
  727. }
  728. add_shortcode('one_half', 'et_columns');
  729. add_shortcode('one_half_last', 'et_columns');
  730. add_shortcode('one_third', 'et_columns');
  731. add_shortcode('one_third_last', 'et_columns');
  732. add_shortcode('one_fourth', 'et_columns');
  733. add_shortcode('one_fourth_last', 'et_columns');
  734. add_shortcode('two_third', 'et_columns');
  735. add_shortcode('two_third_last', 'et_columns');
  736. add_shortcode('three_fourth', 'et_columns');
  737. add_shortcode('three_fourth_last', 'et_columns');
  738. function et_columns($atts, $content = null, $name='') {
  739. extract(shortcode_atts(array(
  740. "id" => '',
  741. "class" => ''
  742. ), $atts));
  743. $content = et_content_helper($content);
  744. $id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
  745. $class = ($class <> '') ? esc_attr( ' ' . $class ) : '';
  746. $pos = strpos($name,'_last');
  747. if($pos !== false)
  748. $name = str_replace('_last',' last',$name);
  749. $output = "<div{$id} class='{$name}{$class}'>
  750. {$content}
  751. </div>";
  752. if($pos !== false)
  753. $output .= "<div class='clear'></div>";
  754. return $output;
  755. }
  756. if ( ! function_exists( 'et_delete_htmltags' ) ){
  757. function et_delete_htmltags($content,$paragraph_tag=false,$br_tag=false){
  758. $content = preg_replace('#^<\/p>|^<br \/>|<p>$#', '', $content);
  759. $content = preg_replace('#<br \/>#', '', $content);
  760. if ( $paragraph_tag ) $content = preg_replace('#<p>|</p>#', '', $content);
  761. return trim($content);
  762. }
  763. }
  764. if ( ! function_exists( 'et_content_helper' ) ){
  765. function et_content_helper($content,$paragraph_tag=false,$br_tag=false){
  766. return et_delete_htmltags( do_shortcode(shortcode_unautop($content)), $paragraph_tag, $br_tag );
  767. }
  768. }
  769. add_action('admin_init', 'et_init_shortcodes');
  770. function et_init_shortcodes(){
  771. if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) {
  772. if ( in_array(basename($_SERVER['PHP_SELF']), array('post-new.php', 'page-new.php', 'post.php', 'page.php') ) ) {
  773. add_filter('mce_buttons', 'et_filter_mce_button');
  774. add_filter('mce_external_plugins', 'et_filter_mce_plugin');
  775. add_action('admin_head','et_add_simple_buttons');
  776. add_action('edit_form_advanced', 'et_advanced_buttons');
  777. add_action('edit_page_form', 'et_advanced_buttons');
  778. }
  779. }
  780. }
  781. function et_filter_mce_button($buttons) {
  782. array_push( $buttons, '|', 'et_learn_more', 'et_box', 'et_button', 'et_tabs', 'et_author' );
  783. return $buttons;
  784. }
  785. function et_filter_mce_plugin($plugins) {
  786. $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
  787. $plugins['et_quicktags'] = ET_SHORTCODES_PLUGIN_URI . "/js/editor_plugin{$suffix}.js";
  788. return $plugins;
  789. }
  790. function et_advanced_buttons(){
  791. global $themename; ?>
  792. <script type="text/javascript">
  793. var defaultSettings = {},
  794. outputOptions = '',
  795. selected ='',
  796. content = '';
  797. defaultSettings['learn_more'] = {
  798. caption: {
  799. name: '<?php esc_html_e( 'Caption', $themename ); ?>',
  800. defaultvalue: '<?php esc_html_e( 'Caption goes here', $themename ); ?>',
  801. description: '<?php esc_html_e( 'Caption title goes here', $themename ); ?>',
  802. type: 'text'
  803. },
  804. state: {
  805. name: '<?php esc_html_e( 'State', $themename ); ?>',
  806. defaultvalue: 'close',
  807. description: '<?php esc_html_e( 'Select between expanded and closed state', $themename ); ?>',
  808. type: 'select',
  809. options: 'open|close'
  810. },
  811. content: {
  812. name: '<?php esc_html_e( 'Content', $themename ); ?>',
  813. defaultvalue: '<?php esc_html_e( 'Content goes here', $themename ); ?>',
  814. description: '<?php esc_html_e( 'Content text or html', $themename ); ?>',
  815. type: 'textarea'
  816. }
  817. };
  818. defaultSettings['box'] = {
  819. type: {
  820. name: '<?php esc_html_e( 'Type', $themename ); ?>',
  821. defaultvalue: 'shadow',
  822. description: '<?php esc_html_e( 'Type of the box', $themename ); ?>',
  823. type: 'select',
  824. options: 'info|warning|download|bio|shadow'
  825. },
  826. content: {
  827. name: '<?php esc_html_e( 'Content', $themename ); ?>',
  828. defaultvalue: '<?php esc_html_e( 'Content goes here', $themename ); ?>',
  829. description: '<?php esc_html_e( 'Content text or html', $themename ); ?>',
  830. type: 'textarea'
  831. }
  832. };
  833. defaultSettings['button'] = {
  834. link: {
  835. name: '<?php esc_html_e( 'Link', $themename ); ?>',
  836. defaultvalue: '#',
  837. description: '<?php esc_html_e( 'URL', $themename ); ?>',
  838. type: 'text'
  839. },
  840. type: {
  841. name: '<?php esc_html_e( 'Type', $themename ); ?>',
  842. defaultvalue: 'small',
  843. description: '<?php esc_html_e( 'Choose button type', $themename ); ?>',
  844. type: 'select',
  845. options: 'small|big|icon'
  846. },
  847. color: {
  848. name: '<?php esc_html_e( 'Color', $themename ); ?>',
  849. defaultvalue: 'blue',
  850. description: '<?php esc_html_e( 'Choose button color', $themename ); ?>',
  851. type: 'select',
  852. options: 'blue|lightblue|teal|silver|black|pink|purple|orange|green|red'
  853. },
  854. content: {
  855. name: '<?php esc_html_e( 'Content', $themename ); ?>',
  856. defaultvalue: '<?php esc_html_e( 'Link text', $themename ); ?>',
  857. description: '<?php esc_html_e( 'Content text or html', $themename ); ?>',
  858. type: 'textarea'
  859. },
  860. icon: {
  861. name: '<?php esc_html_e( 'Icon', $themename ); ?>',
  862. defaultvalue: 'download',
  863. description: '<?php esc_html_e( 'Used for icon button type', $themename ); ?>',
  864. type: 'select',
  865. options: 'download|search|refresh|question|people|warning|mail|heart|paper|notice|stats|rss'
  866. },
  867. newwindow: {
  868. name: '<?php esc_html_e( 'Open link in new window', $themename ); ?>',
  869. defaultvalue: 'no',
  870. description: '<?php esc_html_e( 'Select yes if the link should be opened in a new window', $themename ); ?>',
  871. type: 'select',
  872. options: 'yes|no'
  873. }
  874. };
  875. defaultSettings['tabs'] = {
  876. slidertype: {
  877. name: '<?php esc_html_e( 'Slider Type', $themename ); ?>',
  878. defaultvalue: 'fade',
  879. description: '<?php esc_html_e( 'Select Slider Type here', $themename ); ?>',
  880. type: 'select',
  881. options: 'top tabs|left tabs|simple|images'
  882. },
  883. fx: {
  884. name: '<?php esc_html_e( 'Effect', $themename ); ?>',
  885. defaultvalue: 'fade',
  886. description: '<?php esc_html_e( 'Select Animation Effect', $themename ); ?>',
  887. type: 'select',
  888. options: 'fade|slide'
  889. },
  890. auto: {
  891. name: '<?php esc_html_e( 'Auto', $themename ); ?>',
  892. defaultvalue: 'no',
  893. description: '<?php esc_html_e( 'Choose yes if you want for automatic slider animation', $themename ); ?>',
  894. type: 'select',
  895. options: 'no|yes'
  896. },
  897. autospeed: {
  898. name: '<?php esc_html_e( 'Auto Speed', $themename ); ?>',
  899. defaultvalue: '5000',
  900. description: '<?php esc_html_e( 'Automattic slider speed (works only if Auto is set to yes)', $themename ); ?>',
  901. type: 'text'
  902. },
  903. tabtext: {
  904. name: '<?php esc_html_e( 'Tab Text', $themename ); ?>',
  905. defaultvalue: '',
  906. description: '',
  907. type: 'text',
  908. clone: 'cloned'
  909. },
  910. tabcontent: {
  911. name: '<?php esc_html_e( 'Tab Content', $themename ); ?>',
  912. defaultvalue: '<?php esc_html_e( 'Content goes here', $themename ); ?>',
  913. description: '<?php esc_html_e( 'Paste image url here, if you chose "images" slider type', $themename ); ?>',
  914. type: 'textarea',
  915. clone: 'cloned'
  916. }
  917. }
  918. defaultSettings['author'] = {
  919. imageurl: {
  920. name: '<?php esc_html_e( 'Image Url', $themename ); ?>',
  921. defaultvalue: '',
  922. description: '<?php esc_html_e( 'Author Image URL', $themename ); ?>',
  923. type: 'text'
  924. },
  925. timthumb: {
  926. name: '<?php esc_html_e( 'Use resizing', $themename ); ?>',
  927. defaultvalue: 'on',
  928. description: '',
  929. type: 'select',
  930. options: 'on|off'
  931. },
  932. content: {
  933. name: '<?php esc_html_e( 'Content', $themename ); ?>',
  934. defaultvalue: '<?php esc_html_e( 'Content goes here', $themename ); ?>',
  935. description: '',
  936. type: 'textarea'
  937. }
  938. }
  939. function CustomButtonClick(tag){
  940. var index = tag;
  941. for (var index2 in defaultSettings[index]) {
  942. if (defaultSettings[index][index2]['clone'] === 'cloned')
  943. outputOptions += '<tr class="cloned">\n';
  944. else if (index === 'button' && index2 === 'icon')
  945. outputOptions += '<tr class="hidden">\n';
  946. else
  947. outputOptions += '<tr>\n';
  948. outputOptions += '<th><label for="et-' + index2 + '">'+ defaultSettings[index][index2]['name'] +'</label></th>\n';
  949. outputOptions += '<td>';
  950. if (defaultSettings[index][index2]['type'] === 'select') {
  951. var optionsArray = defaultSettings[index][index2]['options'].split('|');
  952. outputOptions += '\n<select name="et-'+index2+'" id="et-'+index2+'">\n';
  953. for (var index3 in optionsArray) {
  954. selected = (optionsArray[index3] === defaultSettings[index][index2]['defaultvalue']) ? ' selected="selected"' : '';
  955. outputOptions += '<option value="'+optionsArray[index3]+'"'+ selected +'>'+optionsArray[index3]+'</option>\n';
  956. }
  957. outputOptions += '</select>\n';
  958. }
  959. if (defaultSettings[index][index2]['type'] === 'text') {
  960. cloned = '';
  961. if (defaultSettings[index][index2]['clone'] === 'cloned') cloned = "[]";
  962. outputOptions += '\n<input type="text" name="et-'+index2+cloned+'" id="et-'+index2+'" value="'+defaultSettings[index][index2]['defaultvalue']+'" />\n';
  963. }
  964. if (defaultSettings[index][index2]['type'] === 'textarea') {
  965. cloned = '';
  966. if (defaultSettings[index][index2]['clone'] === 'cloned') cloned = "[]";
  967. outputOptions += '<textarea name="et-'+index2+cloned+'" id="et-'+index2+'" cols="40" rows="10">'+defaultSettings[index][index2]['defaultvalue']+'</textarea>';
  968. }
  969. outputOptions += '\n<br/><small>'+ defaultSettings[index][index2]['description'] +'</small>';
  970. outputOptions += '\n</td>';
  971. }
  972. var width = jQuery(window).width(),
  973. tbHeight = jQuery(window).height(),
  974. tbWidth = ( 720 < width ) ? 720 : width;
  975. tbWidth = tbWidth - 80;
  976. tbHeight = tbHeight - 84;
  977. var tbOptions = "<div id='et_shortcodes_div'><form id='et_shortcodes'><table id='shortcodes_table' class='form-table et-"+ tag +"'>";
  978. tbOptions += outputOptions;
  979. tbOptions += '</table>\n<p class="submit">\n<input type="button" id="shortcodes-submit" class="button-primary" value="Ok" name="submit" /></p>\n</form></div>';
  980. var form = jQuery(tbOptions);
  981. var table = form.find('table');
  982. form.appendTo('body').hide();
  983. if (tag === 'tabs') {
  984. $moreTabs = jQuery('<p><a href="#" id="et_add_more_tabs"><?php esc_html_e( '+ Add One More Tab', $themename ); ?></a></p>').appendTo('form#et_shortcodes tbody');
  985. $moreTabsLink = jQuery('a#et_add_more_tabs');
  986. $moreTabsLink.bind('click',function() {
  987. var clonedElements = jQuery('form#et_shortcodes .cloned');
  988. newElements = clonedElements.slice(0,2).clone();
  989. var cloneNumber = clonedElements.length,
  990. labelNum = cloneNumber / 2;
  991. newElements.each(function(index){
  992. if ( index === 0 ) jQuery(this).css({'border-top':'1px solid #eeeeee'});
  993. var label = jQuery(this).find('label').attr('for'),
  994. newLabel = label + labelNum;
  995. jQuery(this).find('label').attr('for',newLabel);
  996. jQuery(this).find('input, textarea').attr('id',newLabel);
  997. });
  998. newElements.appendTo('form#et_shortcodes tbody');
  999. $moreTabs.appendTo('form#et_shortcodes tbody');
  1000. return false;
  1001. });
  1002. }
  1003. form.find('#shortcodes-submit').click(function(){
  1004. var shortcode = '['+tag;
  1005. for( var index in defaultSettings[tag]) {
  1006. var value = table.find('#et-' + index).val();
  1007. if (index === 'content') {
  1008. content = value;
  1009. continue;
  1010. }
  1011. if (defaultSettings[tag][index]['clone'] !== undefined) {
  1012. content = 'cloned';
  1013. continue;
  1014. }
  1015. if ( value !== defaultSettings[tag][index]['defaultvalue'] )
  1016. shortcode += ' ' + index + '="' + value + '"';
  1017. }
  1018. var $et_slidertype = jQuery('#et-slidertype').val();
  1019. shortcode += '] ' + "\n";
  1020. if (content != '') {
  1021. if (tag === 'tabs') {
  1022. var $et_form = jQuery('form#et_shortcodes'),
  1023. tabsOutput = '',
  1024. $et_slidertype = jQuery('#et-slidertype').val();
  1025. if ($et_slidertype === 'images') {
  1026. prefix = 'image';
  1027. dimensions = ' width="' + jQuery('#et-imagewidth').val() + '"'+' height="' + jQuery('#et-imageheight').val() + '"';
  1028. } else {
  1029. prefix = '';
  1030. dimensions = '';
  1031. }
  1032. tabsOutput += '['+prefix+'tabcontainer]\n';
  1033. $et_form.find("input[name='et-tabtext[]']").each(function(){
  1034. tabsOutput += '['+prefix+'tabtext]'+jQuery(this).val()+'[/'+prefix+'tabtext]\n';
  1035. });
  1036. tabsOutput += '[/'+prefix+'tabcontainer]\n';
  1037. if ($et_slidertype === 'simple' || $et_slidertype === 'images') tabsOutput = '';
  1038. if ($et_slidertype != 'simple' && $et_slidertype != 'images') tabsOutput += '[tabcontent]\n';
  1039. $et_form.find("textarea[name='et-tabcontent[]']").each(function(){
  1040. tabsOutput += '['+prefix+'tab'+dimensions+']'+jQuery(this).val()+'[/'+prefix+'tab]'+"\n";
  1041. });
  1042. if ($et_slidertype != 'simple' && $et_slidertype != 'images') tabsOutput += '[/tabcontent]\n';
  1043. content = tabsOutput;
  1044. }
  1045. if (tag === 'author') {
  1046. var $et_form = jQuery('form#et_shortcodes');
  1047. imageurl = $et_form.find('#et-imageurl').val();
  1048. timthumb = $et_form.find('#et-timthumb').val();
  1049. content = $et_form.find('#et-content').val();
  1050. shortcode = "[author]\n[author_image timthumb='"+timthumb+"']"+imageurl+"[/author_image]\n[author_info]"+content+"[/author_info]\n";
  1051. content = '';
  1052. }
  1053. shortcode += content;
  1054. shortcode += '[/'+tag+'] ' + "\n";
  1055. }
  1056. tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode + ' ');
  1057. tb_remove();
  1058. });
  1059. tb_show( 'ET ' + tag + ' Shortcode', '#TB_inline?width=' + tbWidth + '&height=' + tbHeight + '&inlineId=et_shortcodes_div' );
  1060. jQuery('#et_shortcodes_div').remove();
  1061. outputOptions = '';
  1062. }
  1063. jQuery(document).ready(function(){
  1064. var buttonTypeField = jQuery('table.et-button select#et-type');
  1065. buttonTypeField.live('change',function() {
  1066. var optionsSmallButton = ['blue','lightblue','teal','silver','black','pink','purple','orange','green','red'],
  1067. optionsBigButton = ['blue','purple','orange','green','red','teal'],
  1068. options = '';
  1069. if (jQuery(this).val() === 'big') {
  1070. for (var i = 0; i < optionsBigButton.length; i++) {
  1071. options += '<option value="' + optionsBigButton[i] + '">' + optionsBigButton[i] + '</option>';
  1072. }
  1073. if (!jQuery('select#et-icon').parents('tr.hidden').length) jQuery('select#et-icon').parents('tr').addClass('hidden');
  1074. if (jQuery('select#et-color').parents('tr.hidden').length) jQuery('select#et-color').parents('tr').removeClass('hidden');
  1075. }
  1076. if (jQuery(this).val() === 'small') {
  1077. for (var i = 0; i < optionsSmallButton.length; i++) {
  1078. options += '<option value="' + optionsSmallButton[i] + '">' + optionsSmallButton[i] + '</option>';
  1079. }
  1080. if (!jQuery('select#et-icon').parents('tr.hidden').length) jQuery('select#et-icon').parents('tr').addClass('hidden');
  1081. if (jQuery('select#et-color').parents('tr.hidden').length) jQuery('select#et-color').parents('tr').removeClass('hidden');
  1082. }
  1083. if (jQuery(this).val() === 'icon') {
  1084. if (jQuery('select#et-icon').parents('tr.hidden').length) jQuery('select#et-icon').parents('tr').removeClass('hidden');
  1085. if (!jQuery('select#et-color').parents('tr.hidden').length) jQuery('select#et-color').parents('tr').addClass('hidden');
  1086. }
  1087. if (options !== '') jQuery(this).parents('tbody').find('select#et-color').html(options);
  1088. });
  1089. var tabTypeField = jQuery('table.et-tabs select#et-slidertype');
  1090. tabTypeField.live('change',function() {
  1091. if (jQuery(this).val() === 'images') {
  1092. if (!jQuery('.et-tabs #et-imagewidth').length) {
  1093. $heightImage = jQuery('<tr><th><label for="et-imageheight"><?php esc_html_e( 'Image Height', $themename ); ?></label></th><td><input type="text" value="" id="et-imageheight" name="et-imageheight"><br><small></small></td></tr>').prependTo('form#et_shortcodes tbody');
  1094. $widthImage = jQuery('<tr><th><label for="et-imagewidth"><?php esc_html_e( 'Image Width', $themename ); ?></label></th><td><input type="text" value="" id="et-imagewidth" name="et-imagewidth"><br><small></small></td></tr>').prependTo('form#et_shortcodes tbody');
  1095. }
  1096. if (typeof $heightImage != 'undefined') $heightImage.show();
  1097. if (typeof $widthImage != 'undefined') $widthImage.show();
  1098. jQuery('input[name^="et-tabtext"]').parents('tr.cloned').hide(); //hide tab text
  1099. } else {
  1100. if (typeof $heightImage != 'undefined') $heightImage.hide();
  1101. if (typeof $widthImage != 'undefined') $widthImage.hide();
  1102. if(jQuery(this).val() != 'simple') jQuery('input[name^="et-tabtext"]').parents('tr.cloned:hidden').show(); //show tab text
  1103. else jQuery('input[name^="et-tabtext"]').parents('tr.cloned').hide();
  1104. }
  1105. });
  1106. });
  1107. </script>
  1108. <?php } ?>