芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/fluentform/app/Helpers/Helper.php
&$value) { $attribute = $attribute ? $attribute . '[' . $key . ']' : $key; $value = static::sanitizer($value, $attribute, $fields); $attribute = null; } } return $input; } public static function makeMenuUrl($page = 'fluent_forms_settings', $component = null) { $baseUrl = admin_url('admin.php?page=' . $page); $hash = ArrayHelper::get($component, 'hash', ''); if ($hash) { $baseUrl = $baseUrl . '#' . $hash; } $query = ArrayHelper::get($component, 'query'); if ($query) { $paramString = http_build_query($query); if ($hash) { $baseUrl .= '?' . $paramString; } else { $baseUrl .= '&' . $paramString; } } return $baseUrl; } public static function getHtmlElementClass($value1, $value2, $class = 'active', $default = '') { return $value1 === $value2 ? $class : $default; } /** * Determines if the given string is a valid json. * * @param $string * * @return bool */ public static function isJson($string) { json_decode($string); return JSON_ERROR_NONE === json_last_error(); } public static function isSlackEnabled() { $globalModules = get_option('fluentform_global_modules_status'); return $globalModules && isset($globalModules['slack']) && 'yes' == $globalModules['slack']; } public static function getEntryStatuses($form_id = false) { $statuses = [ 'unread' => __('Unread', 'fluentform'), 'read' => __('Read', 'fluentform'), 'favorites' => __('Favorites', 'fluentform'), ]; $statuses = apply_filters_deprecated( 'fluentform_entry_statuses_core', [ $statuses, $form_id ], FLUENTFORM_FRAMEWORK_UPGRADE, 'fluentform/entry_statuses_core', 'Use fluentform/entry_statuses_core instead of fluentform_entry_statuses_core.' ); $statuses = apply_filters('fluentform/entry_statuses_core', $statuses, $form_id); $statuses['trashed'] = 'Trashed'; return $statuses; } public static function getReportableInputs() { $data = [ 'select', 'input_radio', 'input_checkbox', 'ratings', 'net_promoter', 'select_country', 'net_promoter_score', ]; $data = apply_filters_deprecated( 'fluentform_reportable_inputs', [ $data ], FLUENTFORM_FRAMEWORK_UPGRADE, 'fluentform/reportable_inputs', 'Use fluentform/reportable_inputs instead of fluentform_reportable_inputs.' ); return apply_filters('fluentform/reportable_inputs', $data); } public static function getSubFieldReportableInputs() { $grid = apply_filters_deprecated( 'fluentform_subfield_reportable_inputs', [ ['tabular_grid'] ], FLUENTFORM_FRAMEWORK_UPGRADE, 'fluentform/subfield_reportable_inputs', 'Use fluentform/subfield_reportable_inputs instead of fluentform_subfield_reportable_inputs.' ); return apply_filters('fluentform/subfield_reportable_inputs', $grid); } public static function getFormMeta($formId, $metaKey, $default = '') { return FormMeta::retrieve($metaKey, $formId, $default); } public static function setFormMeta($formId, $metaKey, $value) { if ($meta = FormMeta::persist($formId, $metaKey, $value)) { return $meta->id; } return null; } public static function deleteFormMeta($formId, $metaKey) { try { FormMeta::remove($formId, $metaKey); return true; } catch (\Exception $ex) { return null; } } public static function getSubmissionMeta($submissionId, $metaKey, $default = false) { return SubmissionMeta::retrieve($metaKey, $submissionId, $default); } public static function setSubmissionMeta($submissionId, $metaKey, $value, $formId = false) { if ($meta = SubmissionMeta::persist($submissionId, $metaKey, $value, $formId)) { return $meta->id; } return null; } public static function isEntryAutoDeleteEnabled($formId) { if ( 'yes' == ArrayHelper::get(static::getFormMeta($formId, 'formSettings', []), 'delete_entry_on_submission', '') ) { return true; } return false; } public static function formExtraCssClass($form) { if (!$form->settings) { $formSettings = static::getFormMeta($form->id, 'formSettings'); } else { $formSettings = $form->settings; } if (!$formSettings) { return ''; } if ($extraClass = ArrayHelper::get($formSettings, 'form_extra_css_class')) { return esc_attr($extraClass); } return ''; } public static function getNextTabIndex($increment = 1) { if (static::isTabIndexEnabled()) { static::$tabIndex += $increment; return static::$tabIndex; } return ''; } public static function getFormInstaceClass($formId) { static::$formInstance += 1; return 'ff_form_instance_' . $formId . '_' . static::$formInstance; } public static function resetTabIndex() { static::$tabIndex = 0; } public static function isFluentAdminPage() { $fluentPages = [ 'fluent_forms', 'fluent_forms_all_entries', 'fluent_forms_transfer', 'fluent_forms_settings', 'fluent_forms_add_ons', 'fluent_forms_docs', 'fluent_forms_payment_entries', 'fluent_forms_smtp' ]; $status = true; $page = wpFluentForm('request')->get('page'); if (!$page || !in_array($page, $fluentPages)) { $status = false; } $status = apply_filters_deprecated( 'fluentform_is_admin_page', [ $status ], FLUENTFORM_FRAMEWORK_UPGRADE, 'fluentform/is_admin_page', 'Use fluentform/is_admin_page instead of fluentform_is_admin_page.' ); return apply_filters('fluentform/is_admin_page', $status); } public static function getShortCodeIds($content, $tag = 'fluentform', $selector = 'id') { if (false === strpos($content, '[')) { return []; } preg_match_all('/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER); if (empty($matches)) { return []; } $ids = []; $attributes = []; foreach ($matches as $shortcode) { if (count($shortcode) >= 2 && $tag === $shortcode[2]) { // Replace braces with empty string. $parsedCode = str_replace(['[', ']', '[', ']'], '', $shortcode[0]); $result = shortcode_parse_atts($parsedCode); if (!empty($result[$selector])) { if ($tag == 'fluentform' && !empty($result['type']) && $result['type'] == 'conversational') { continue; } $ids[$result[$selector]] = $result[$selector]; $theme = ArrayHelper::get($result, 'theme'); if ($theme) { $attributes[] = [ 'formId' => $result[$selector], 'theme' => $theme ]; } } } } if ($attributes) { $ids['attributes'] = $attributes; } return $ids; } public static function getFormsIdsFromBlocks($content) { $ids = []; $attributes = []; if (!function_exists('parse_blocks')) { return $ids; } $has_block = false !== strpos($content, '