get_items(); $choices = array(); foreach($forms as $item){ // fallback to name if empty title $item['title'] = !empty($item['title']) ? $item['title'] : $item['name']; if(empty($allowed) || in_array($item['name'], $allowed, true)){ $choices[ $item['name'] ] = $item['title']; } } return $choices; } /** * acfe_form_decrypt_args * * Wrapper to decrypt ACF & ACFE Forms arguments * * @return false|mixed */ function acfe_form_decrypt_args(){ if(!acf_maybe_get_POST('_acf_form')){ return false; } $form = json_decode(acf_decrypt($_POST['_acf_form']), true); if(empty($form)){ return false; } return $form; } /** * acfe_is_form_success * * Check if the current page is a success form page * * @param false $form_name * * @return bool */ function acfe_is_form_success($form_name = false){ if(!acf_maybe_get_POST('_acf_form')){ return false; } $form = acfe_form_decrypt_args(); if(empty($form)){ return false; } if(!empty($form_name) && acf_maybe_get($form, 'name') !== $form_name){ return false; } // avoid multiple submissions if(headers_sent()){ // check filter if(!acf_is_filter_enabled('acfe/form/is_success')){ ?> 1){ $name = "{$name}-{$acfe_form_uniqid[ $type ]}"; } $acfe_form_uniqid[ $type ]++; return $name; } /** * acfe_form_get_actions * * Retrieve all actions output * * @return array|false|string[] */ function acfe_form_get_actions(){ // get actions $actions = acf_get_form_data('acfe/form/actions'); $actions = acf_get_array($actions); // return return $actions; } /** * acfe_form_get_action * * Retrieve the latest action output * * @param false $name * @param false $key * * @return false|mixed|null */ function acfe_form_get_action($name = false, $key = false){ // get actions $actions = acfe_form_get_actions(); // no action if(empty($actions)){ return false; } // get last action $return = end($actions); // get by action name if(!empty($name)){ $return = acf_maybe_get($actions, $name, false); } if($return && !acf_is_empty($key)){ $return = acfe_array_get($return, $key); } return $return; } /** * acfe_form_is_admin * * Check if current screen is back-end * * @return bool * * @deprecated */ function acfe_form_is_admin(){ _deprecated_function('ACF Extended: acfe_form_is_admin()', '0.8.8', "acfe_is_admin()"); return acfe_is_admin(); } /** * acfe_form_is_front * * Check if current screen is front-end * * @return bool * * @deprecated */ function acfe_form_is_front(){ _deprecated_function('ACF Extended: acfe_form_is_front()', '0.8.8', "acfe_is_front()"); return acfe_is_front(); }