PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/advanced-custom-fields/core/api.php

https://github.com/sharpmachine/wakeupmedia.com
PHP | 1034 lines | 509 code | 244 blank | 281 comment | 70 complexity | 4d79d74b596ecf285e9c69288354c549 MD5 | raw file
  1. <?php
  2. // vars
  3. $GLOBALS['acf_field'] = array();
  4. /*--------------------------------------------------------------------------------------
  5. *
  6. * get_fields
  7. *
  8. * @author Elliot Condon
  9. * @since 1.0.3
  10. *
  11. *-------------------------------------------------------------------------------------*/
  12. function get_fields($post_id = false)
  13. {
  14. // vars
  15. global $post, $wpdb;
  16. if(!$post_id)
  17. {
  18. $post_id = $post->ID;
  19. }
  20. // allow for option == options
  21. if( $post_id == "option" )
  22. {
  23. $post_id = "options";
  24. }
  25. // vars
  26. $field_key = "";
  27. $value = array();
  28. // get field_names
  29. if( is_numeric($post_id) )
  30. {
  31. $keys = $wpdb->get_col($wpdb->prepare(
  32. "SELECT meta_key FROM $wpdb->postmeta WHERE post_id = %d and meta_key NOT LIKE %s",
  33. $post_id,
  34. '\_%'
  35. ));
  36. }
  37. elseif( strpos($post_id, 'user_') !== false )
  38. {
  39. $user_id = str_replace('user_', '', $post_id);
  40. $keys = $wpdb->get_col($wpdb->prepare(
  41. "SELECT meta_key FROM $wpdb->usermeta WHERE user_id = %d and meta_key NOT LIKE %s",
  42. $user_id,
  43. '\_%'
  44. ));
  45. }
  46. else
  47. {
  48. $keys = $wpdb->get_col($wpdb->prepare(
  49. "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s",
  50. $post_id . '\_%'
  51. ));
  52. }
  53. if($keys)
  54. {
  55. foreach($keys as $key)
  56. {
  57. $value[$key] = get_field($key, $post_id);
  58. }
  59. }
  60. // no value
  61. if(empty($value))
  62. {
  63. return false;
  64. }
  65. return $value;
  66. }
  67. /*--------------------------------------------------------------------------------------
  68. *
  69. * get_field
  70. *
  71. * @author Elliot Condon
  72. * @since 1.0.3
  73. *
  74. *-------------------------------------------------------------------------------------*/
  75. function get_field($field_key, $post_id = false)
  76. {
  77. global $post, $acf;
  78. if(!$post_id)
  79. {
  80. $post_id = $post->ID;
  81. }
  82. // allow for option == options
  83. if( $post_id == "option" )
  84. {
  85. $post_id = "options";
  86. }
  87. // return cache
  88. $cache = wp_cache_get('acf_get_field_' . $post_id . '_' . $field_key);
  89. if($cache)
  90. {
  91. return $cache;
  92. }
  93. // default
  94. $value = "";
  95. $field = array(
  96. 'type' => 'text',
  97. 'name' => $field_key
  98. );
  99. // is $field_name a name? pre 3.4.0
  100. if( strpos($field_key, "field_") === false )
  101. {
  102. // get field key
  103. if( is_numeric($post_id) )
  104. {
  105. $field_key = get_post_meta($post_id, '_' . $field_key, true);
  106. }
  107. elseif( strpos($post_id, 'user_') !== false )
  108. {
  109. $temp_post_id = str_replace('user_', '', $post_id);
  110. $field_key = get_user_meta($temp_post_id, '_' . $field_key, true);
  111. }
  112. else
  113. {
  114. $field_key = get_option('_' . $post_id . '_' . $field_key);
  115. }
  116. }
  117. // get field
  118. if( strpos($field_key, "field_") !== false )
  119. {
  120. $field = $acf->get_acf_field($field_key);
  121. }
  122. // load value
  123. $value = $acf->get_value_for_api($post_id, $field);
  124. // no value?
  125. if( $value == "" )
  126. {
  127. $value = false;
  128. }
  129. // update cache
  130. wp_cache_set('acf_get_field_' . $post_id . '_' . $field_key, $value);
  131. return $value;
  132. }
  133. /*--------------------------------------------------------------------------------------
  134. *
  135. * the_field
  136. *
  137. * @author Elliot Condon
  138. * @since 1.0.3
  139. *
  140. *-------------------------------------------------------------------------------------*/
  141. function the_field($field_name, $post_id = false)
  142. {
  143. $value = get_field($field_name, $post_id);
  144. if(is_array($value))
  145. {
  146. $value = @implode(', ',$value);
  147. }
  148. echo $value;
  149. }
  150. /*--------------------------------------------------------------------------------------
  151. *
  152. * has_sub_field
  153. *
  154. * @author Elliot Condon
  155. * @since 3.3.4
  156. *
  157. *-------------------------------------------------------------------------------------*/
  158. function has_sub_field($field_name, $post_id = false)
  159. {
  160. // needs a post_id
  161. global $post;
  162. if( !$post_id )
  163. {
  164. $post_id = $post->ID;
  165. }
  166. // empty?
  167. if( empty($GLOBALS['acf_field']) )
  168. {
  169. $GLOBALS['acf_field'][] = array(
  170. 'name' => $field_name,
  171. 'value' => get_field($field_name, $post_id),
  172. 'row' => -1,
  173. 'post_id' => $post_id,
  174. );
  175. }
  176. // vars
  177. $depth = count( $GLOBALS['acf_field'] ) - 1;
  178. $name = $GLOBALS['acf_field'][$depth]['name'];
  179. $value = $GLOBALS['acf_field'][$depth]['value'];
  180. $row = $GLOBALS['acf_field'][$depth]['row'];
  181. $id = $GLOBALS['acf_field'][$depth]['post_id'];
  182. // if ID has changed, this is a new repeater / flexible field!
  183. if( $post_id != $id )
  184. {
  185. // reset
  186. $GLOBALS['acf_field'] = array();
  187. return has_sub_field($field_name, $post_id);
  188. }
  189. // does the given $field_name match the current field?
  190. if( $field_name != $name )
  191. {
  192. // is this a "new" while loop refering to a sub field?
  193. if( isset($value[$row][$field_name]) )
  194. {
  195. $GLOBALS['acf_field'][] = array(
  196. 'name' => $field_name,
  197. 'value' => $value[$row][$field_name],
  198. 'row' => -1,
  199. 'post_id' => $post_id,
  200. );
  201. }
  202. elseif( isset($GLOBALS['acf_field'][$depth-1]) && $GLOBALS['acf_field'][$depth-1]['name'] == $field_name )
  203. {
  204. // if someone used break; We should see if the parent value has this field_name as a value.
  205. unset( $GLOBALS['acf_field'][$depth] );
  206. $GLOBALS['acf_field'] = array_values($GLOBALS['acf_field']);
  207. }
  208. else
  209. {
  210. // this was a break; (probably to get the first row only). Clear the repeater
  211. $GLOBALS['acf_field'] = array();
  212. return has_sub_field($field_name, $post_id);
  213. }
  214. }
  215. // update vars
  216. $depth = count( $GLOBALS['acf_field'] ) - 1;
  217. $value = $GLOBALS['acf_field'][$depth]['value'];
  218. $row = $GLOBALS['acf_field'][$depth]['row'];
  219. // increase row number
  220. $GLOBALS['acf_field'][$depth]['row']++;
  221. $row++;
  222. if( isset($value[$row]) )
  223. {
  224. // next row exists
  225. return true;
  226. }
  227. // no next row! Unset this array and return false to stop while loop
  228. unset( $GLOBALS['acf_field'][$depth] );
  229. $GLOBALS['acf_field'] = array_values($GLOBALS['acf_field']);
  230. return false;
  231. }
  232. /*--------------------------------------------------------------------------------------
  233. *
  234. * get_sub_field
  235. *
  236. * @author Elliot Condon
  237. * @since 1.0.3
  238. *
  239. *-------------------------------------------------------------------------------------*/
  240. function get_sub_field($field_name)
  241. {
  242. // no field?
  243. if( empty($GLOBALS['acf_field']) )
  244. {
  245. return false;
  246. }
  247. // vars
  248. $depth = count( $GLOBALS['acf_field'] ) - 1;
  249. $value = $GLOBALS['acf_field'][$depth]['value'];
  250. $row = $GLOBALS['acf_field'][$depth]['row'];
  251. // no value at i
  252. if( !isset($GLOBALS['acf_field'][$depth]['value'][$row][$field_name]) )
  253. {
  254. return false;
  255. }
  256. return $GLOBALS['acf_field'][$depth]['value'][$row][$field_name];
  257. }
  258. /*--------------------------------------------------------------------------------------
  259. *
  260. * the_sub_field
  261. *
  262. * @author Elliot Condon
  263. * @since 1.0.3
  264. *
  265. *-------------------------------------------------------------------------------------*/
  266. function the_sub_field($field_name)
  267. {
  268. $value = get_sub_field($field_name);
  269. if(is_array($value))
  270. {
  271. $value = implode(', ',$value);
  272. }
  273. echo $value;
  274. }
  275. /*--------------------------------------------------------------------------------------
  276. *
  277. * register_field
  278. *
  279. * @author Elliot Condon
  280. * @since 3.0.0
  281. *
  282. *-------------------------------------------------------------------------------------*/
  283. $GLOBALS['acf_register_field'] = array();
  284. function register_field($class = "", $url = "")
  285. {
  286. $GLOBALS['acf_register_field'][] = array(
  287. 'url' => $url,
  288. 'class' => $class,
  289. );
  290. }
  291. function acf_register_field($array)
  292. {
  293. $array = array_merge($array, $GLOBALS['acf_register_field']);
  294. return $array;
  295. }
  296. add_filter('acf_register_field', 'acf_register_field');
  297. /*--------------------------------------------------------------------------------------
  298. *
  299. * register_field_group
  300. *
  301. * @author Elliot Condon
  302. * @since 3.0.6
  303. *
  304. *-------------------------------------------------------------------------------------*/
  305. $GLOBALS['acf_register_field_group'] = array();
  306. function register_field_group($array)
  307. {
  308. // add id
  309. if(!isset($array['id']))
  310. {
  311. $array['id'] = uniqid();
  312. }
  313. // 3.2.5 - changed show_on_page option
  314. if( !isset($array['options']['hide_on_screen']) && isset($array['options']['show_on_page']) )
  315. {
  316. $show_all = array('the_content', 'discussion', 'custom_fields', 'comments', 'slug', 'author');
  317. $array['options']['hide_on_screen'] = array_diff($show_all, $array['options']['show_on_page']);
  318. unset( $array['options']['show_on_page'] );
  319. }
  320. $GLOBALS['acf_register_field_group'][] = $array;
  321. }
  322. function acf_register_field_group($array)
  323. {
  324. $array = array_merge($array, $GLOBALS['acf_register_field_group']);
  325. if( empty($GLOBALS['acf_register_field_group']) )
  326. {
  327. return $array;
  328. }
  329. // order field groups based on menu_order, title
  330. // Obtain a list of columns
  331. foreach ($array as $key => $row) {
  332. $menu_order[$key] = $row['menu_order'];
  333. $title[$key] = $row['title'];
  334. }
  335. // Sort the array with menu_order ascending
  336. // Add $array as the last parameter, to sort by the common key
  337. if(isset($menu_order))
  338. {
  339. array_multisort($menu_order, SORT_ASC, $title, SORT_ASC, $array);
  340. }
  341. return $array;
  342. }
  343. add_filter('acf_register_field_group', 'acf_register_field_group');
  344. /*--------------------------------------------------------------------------------------
  345. *
  346. * register_options_page
  347. *
  348. * @author Elliot Condon
  349. * @since 3.0.0
  350. *
  351. *-------------------------------------------------------------------------------------*/
  352. $GLOBALS['acf_register_options_page'] = array();
  353. function register_options_page($title = "")
  354. {
  355. $GLOBALS['acf_register_options_page'][] = array(
  356. 'title' => $title,
  357. 'slug' => 'acf-options-' . sanitize_title( $title ),
  358. );
  359. }
  360. function acf_register_options_page($array)
  361. {
  362. $array = array_merge($array, $GLOBALS['acf_register_options_page']);
  363. return $array;
  364. }
  365. add_filter('acf_register_options_page', 'acf_register_options_page');
  366. /*--------------------------------------------------------------------------------------
  367. *
  368. * get_row_layout
  369. *
  370. * @author Elliot Condon
  371. * @since 1.0.3
  372. *
  373. *-------------------------------------------------------------------------------------*/
  374. function get_row_layout()
  375. {
  376. // vars
  377. $value = get_sub_field('acf_fc_layout');
  378. return $value;
  379. }
  380. /*--------------------------------------------------------------------------------------
  381. *
  382. * shorcode support
  383. *
  384. * @author Elliot Condon
  385. * @since 1.1.1
  386. *
  387. *-------------------------------------------------------------------------------------*/
  388. function acf_shortcode( $atts )
  389. {
  390. // extract attributs
  391. extract( shortcode_atts( array(
  392. 'field' => "",
  393. 'post_id' => false,
  394. ), $atts ) );
  395. // $field is requird
  396. if( !$field || $field == "" )
  397. {
  398. return "";
  399. }
  400. // get value and return it
  401. $value = get_field( $field, $post_id );
  402. if(is_array($value))
  403. {
  404. $value = @implode( ', ',$value );
  405. }
  406. return $value;
  407. }
  408. add_shortcode( 'acf', 'acf_shortcode' );
  409. /*--------------------------------------------------------------------------------------
  410. *
  411. * Front end form Head
  412. *
  413. * @author Elliot Condon
  414. * @since 1.1.4
  415. *
  416. *-------------------------------------------------------------------------------------*/
  417. function acf_form_head()
  418. {
  419. // global vars
  420. global $acf, $post_id;
  421. // run database save first
  422. if( isset($_POST['acf_save']) )
  423. {
  424. // $post_id to save against
  425. $post_id = $_POST['post_id'];
  426. // allow for custom save
  427. $post_id = apply_filters('acf_form_pre_save_post', $post_id);
  428. // save the data
  429. do_action('acf_save_post', $post_id);
  430. // redirect
  431. if(isset($_POST['return']))
  432. {
  433. wp_redirect($_POST['return']);
  434. exit;
  435. }
  436. }
  437. // register css / javascript
  438. do_action('acf_print_scripts-input');
  439. do_action('acf_print_styles-input');
  440. // need wp styling
  441. wp_enqueue_style(array(
  442. 'colors-fresh'
  443. ));
  444. // form was not posted, load js head stuff
  445. add_action('wp_head', 'acf_form_wp_head');
  446. }
  447. function acf_form_wp_head()
  448. {
  449. // global vars
  450. global $post, $acf;
  451. // Style
  452. echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/global.css?ver=' . $acf->version . '" />';
  453. echo '<link rel="stylesheet" type="text/css" href="'.$acf->dir.'/css/input.css?ver=' . $acf->version . '" />';
  454. // Javascript
  455. echo '<script type="text/javascript" src="'.$acf->dir.'/js/input-actions.js?ver=' . $acf->version . '" ></script>';
  456. echo '<script type="text/javascript">acf.post_id = ' . $post->ID . ';</script>';
  457. // add user js + css
  458. do_action('acf_head-input');
  459. }
  460. /*--------------------------------------------------------------------------------------
  461. *
  462. * Front end form
  463. *
  464. * @author Elliot Condon
  465. * @since 1.1.4
  466. *
  467. *-------------------------------------------------------------------------------------*/
  468. function acf_form($options = null)
  469. {
  470. global $post, $acf;
  471. // defaults
  472. $defaults = array(
  473. 'post_id' => $post->ID, // post id to get field groups from and save data to
  474. 'field_groups' => array(), // this will find the field groups for this post
  475. 'form_attributes' => array( // attributes will be added to the form element
  476. 'class' => ''
  477. ),
  478. 'return' => add_query_arg( 'updated', 'true', get_permalink() ), // return url
  479. 'html_before_fields' => '', // html inside form before fields
  480. 'html_after_fields' => '', // html inside form after fields
  481. 'submit_value' => 'Update', // vale for submit field
  482. 'updated_message' => 'Post updated.', // default updated message. Can be false
  483. );
  484. // merge defaults with options
  485. if($options && is_array($options))
  486. {
  487. $options = array_merge($defaults, $options);
  488. }
  489. else
  490. {
  491. $options = $defaults;
  492. }
  493. // register post box
  494. if(!$options['field_groups'])
  495. {
  496. $options['field_groups'] = $acf->get_input_metabox_ids(array('post_id' => $options['post_id']), false);
  497. }
  498. // updated message
  499. if(isset($_GET['updated']) && $_GET['updated'] == 'true' && $options['updated_message'])
  500. {
  501. echo '<div id="message" class="updated"><p>' . $options['updated_message'] . '</p></div>';
  502. }
  503. // display form
  504. ?>
  505. <form action="" id="post" method="post" <?php if($options['form_attributes']){foreach($options['form_attributes'] as $k => $v){echo $k . '="' . $v .'" '; }} ?>>
  506. <div style="display:none">
  507. <input type="hidden" name="acf_save" value="true" />
  508. <input type="hidden" name="post_id" value="<?php echo $options['post_id']; ?>" />
  509. <input type="hidden" name="return" value="<?php echo $options['return']; ?>" />
  510. <?php wp_editor('', 'acf_settings'); ?>
  511. </div>
  512. <div id="poststuff">
  513. <?php
  514. // html before fields
  515. echo $options['html_before_fields'];
  516. $field_groups = $acf->get_field_groups();
  517. if($field_groups):
  518. foreach($field_groups as $field_group):
  519. if(!in_array($field_group['id'], $options['field_groups'])) continue;
  520. // defaults
  521. if(!$field_group['options'])
  522. {
  523. $field_group['options'] = array(
  524. 'layout' => 'default'
  525. );
  526. }
  527. if($field_group['fields'])
  528. {
  529. echo '<div id="acf_' . $field_group['id'] . '" class="postbox acf_postbox">';
  530. echo '<h3 class="hndle"><span>' . $field_group['title'] . '</span></h3>';
  531. echo '<div class="inside">';
  532. echo '<div class="options" data-layout="' . $field_group['options']['layout'] . '" data-show="true"></div>';
  533. $acf->render_fields_for_input($field_group['fields'], $options['post_id']);
  534. echo '</div></div>';
  535. }
  536. endforeach;
  537. endif;
  538. // html after fields
  539. echo $options['html_after_fields'];
  540. ?>
  541. <!-- Submit -->
  542. <div class="field">
  543. <input type="submit" value="<?php echo $options['submit_value']; ?>" />
  544. </div>
  545. <!-- / Submit -->
  546. </div><!-- <div id="poststuff"> -->
  547. </form>
  548. <?php
  549. }
  550. /*--------------------------------------------------------------------------------------
  551. *
  552. * update_field
  553. *
  554. * @author Elliot Condon
  555. * @since 3.1.9
  556. *
  557. *-------------------------------------------------------------------------------------*/
  558. function update_field($field_key, $value, $post_id = false)
  559. {
  560. global $post, $acf;
  561. if(!$post_id)
  562. {
  563. $post_id = $post->ID;
  564. }
  565. // allow for option == options
  566. if( $post_id == "option" )
  567. {
  568. $post_id = "options";
  569. }
  570. // is $field_name a name? pre 3.4.0
  571. if( strpos($field_key, "field_") === false )
  572. {
  573. // get field key
  574. if( is_numeric($post_id) )
  575. {
  576. $field_key = get_post_meta($post_id, '_' . $field_key, true);
  577. }
  578. elseif( strpos($post_id, 'user_') !== false )
  579. {
  580. $temp_post_id = str_replace('user_', '', $post_id);
  581. $field_key = get_user_meta($temp_post_id, '_' . $field_key, true);
  582. }
  583. else
  584. {
  585. $field_key = get_option('_' . $post_id . '_' . $field_key);
  586. }
  587. }
  588. // get field
  589. $field = $acf->get_acf_field($field_key);
  590. // backup if no field was found, save as a text field
  591. if( !$field )
  592. {
  593. return false;
  594. }
  595. // sub fields? They need formatted data
  596. $value = acf_convert_field_names_to_keys( $value, $field );
  597. $acf->update_value($post_id, $field, $value);
  598. return true;
  599. }
  600. /*--------------------------------------------------------------------------------------
  601. *
  602. * acf_convert_field_names_to_keys
  603. *
  604. * @description: Helper for the update_field function
  605. * @created: 30/09/12
  606. * @author Elliot Condon
  607. * @since 3.5.0
  608. *
  609. *-------------------------------------------------------------------------------------*/
  610. function acf_convert_field_names_to_keys( $value, $field )
  611. {
  612. // only if $field has sub fields
  613. if( !isset($field['sub_fields']) )
  614. {
  615. return $value;
  616. }
  617. // define sub field keys
  618. $sub_fields = array();
  619. if( $field['sub_fields'] )
  620. {
  621. foreach( $field['sub_fields'] as $sub_field )
  622. {
  623. $sub_fields[ $sub_field['name'] ] = $sub_field;
  624. }
  625. }
  626. // loop through the values and format the array to use sub field keys
  627. if( $value )
  628. {
  629. foreach( $value as $row_i => $row)
  630. {
  631. if( $row )
  632. {
  633. foreach( $row as $sub_field_name => $sub_field_value )
  634. {
  635. // sub field must exist!
  636. if( !isset($sub_fields[ $sub_field_name ]) )
  637. {
  638. continue;
  639. }
  640. // vars
  641. $sub_field = $sub_fields[ $sub_field_name ];
  642. $sub_field_value = acf_convert_field_names_to_keys( $sub_field_value, $sub_field );
  643. // set new value
  644. $value[$row_i][ $sub_field['key'] ] = $sub_field_value;
  645. // unset old value
  646. unset( $value[$row_i][$sub_field_name] );
  647. }
  648. // foreach( $row as $sub_field_name => $sub_field_value )
  649. }
  650. // if( $row )
  651. }
  652. // foreach( $value as $row_i => $row)
  653. }
  654. // if( $value )
  655. return $value;
  656. }
  657. /*--------------------------------------------------------------------------------------
  658. *
  659. * get_field_object
  660. *
  661. * @description: returns an array containing all the field data for a given field_name.
  662. * @created: 3/09/12
  663. * @author Elliot Condon
  664. * @since 3.4.0
  665. *
  666. * @return: Array in this format
  667. Array
  668. (
  669. [key] => field_5043fe0e3c58f
  670. [label] => Select
  671. [name] => select
  672. [type] => select
  673. [instructions] =>
  674. [required] => 1
  675. [choices] => Array
  676. (
  677. [yes] => Yes
  678. [no] => No
  679. [maybe] => Maybe
  680. )
  681. [default_value] =>
  682. [allow_null] => 1
  683. [multiple] => 1
  684. [order_no] => 4
  685. [value] => Array
  686. (
  687. [0] => Yes
  688. [1] => Maybe
  689. )
  690. )
  691. *-------------------------------------------------------------------------------------*/
  692. function get_field_object($field_key, $post_id = false, $options = array())
  693. {
  694. // defaults for options
  695. $defaults = array(
  696. 'load_value' => true,
  697. );
  698. $options = array_merge($defaults, $options);
  699. // vars
  700. global $post, $acf;
  701. if(!$post_id)
  702. {
  703. $post_id = $post->ID;
  704. }
  705. // allow for option == options
  706. if( $post_id == "option" )
  707. {
  708. $post_id = "options";
  709. }
  710. // is $field_name a name? pre 3.4.0
  711. if( strpos($field_key, "field_") === false )
  712. {
  713. // get field key
  714. if( is_numeric($post_id) )
  715. {
  716. $field_key = get_post_meta($post_id, '_' . $field_key, true);
  717. }
  718. elseif( strpos($post_id, 'user_') !== false )
  719. {
  720. $temp_post_id = str_replace('user_', '', $post_id);
  721. $field_key = get_user_meta($temp_post_id, '_' . $field_key, true);
  722. }
  723. else
  724. {
  725. $field_key = get_option('_' . $post_id . '_' . $field_key);
  726. }
  727. }
  728. // get field
  729. $field = $acf->get_acf_field($field_key);
  730. // backup if no field was found, save as a text field
  731. if( !$field )
  732. {
  733. return false;
  734. }
  735. if( $options['load_value'] )
  736. {
  737. $field['value'] = $acf->get_value_for_api($post_id, $field);
  738. }
  739. return $field;
  740. }
  741. /*
  742. * Depreceated Functions
  743. *
  744. * @description:
  745. * @created: 23/07/12
  746. */
  747. /*--------------------------------------------------------------------------------------
  748. *
  749. * reset_the_repeater_field
  750. *
  751. * @author Elliot Condon
  752. * @depreciated: 3.3.4 - now use has_sub_field
  753. * @since 1.0.3
  754. *
  755. *-------------------------------------------------------------------------------------*/
  756. function reset_the_repeater_field()
  757. {
  758. // do nothing
  759. }
  760. /*--------------------------------------------------------------------------------------
  761. *
  762. * the_repeater_field
  763. *
  764. * @author Elliot Condon
  765. * @depreciated: 3.3.4 - now use has_sub_field
  766. * @since 1.0.3
  767. *
  768. *-------------------------------------------------------------------------------------*/
  769. function the_repeater_field($field_name, $post_id = false)
  770. {
  771. return has_sub_field($field_name, $post_id);
  772. }
  773. /*--------------------------------------------------------------------------------------
  774. *
  775. * the_flexible_field
  776. *
  777. * @author Elliot Condon
  778. * @depreciated: 3.3.4 - now use has_sub_field
  779. * @since 3.?.?
  780. *
  781. *-------------------------------------------------------------------------------------*/
  782. function the_flexible_field($field_name, $post_id = false)
  783. {
  784. return has_sub_field($field_name, $post_id);
  785. }
  786. ?>