/** * Determine the type of the current optin(s) needed. * * @return array Array of current in use types in form of type => theme */ static function determine_type() { $types = array_keys(Prompt_Optins::types()); $themes = array_keys(Prompt_Optins::themes()); $options = self::optins_options(); $current_types = array(); foreach ($types as $type) { $field = "optins_{$type}_enable"; if ($options[$field]) { $theme_key = "optins_{$type}_theme"; $theme = $options[$theme_key]; $current_types[$type] = $theme; } } return $current_types; }
/** * @since 2.0.0 * @param string $id * @param string $name * @param string $prompt * @param array|string $values * @return string */ protected function theme_chooser_html($id, $name, $prompt, $values) { $radio_buttons = array(); foreach (Prompt_Optins::themes() as $slug => $label) { $input_attributes = array('type' => 'radio', 'name' => $name, 'value' => $slug); $value = is_array($values) ? $values[$name] : $values; if ($value === $slug) { $input_attributes['checked'] = 'checked'; } $radio_buttons[] = html('label', array('class' => $slug), html('input', $input_attributes), $label); } return html('div class="theme-chooser"', array('id' => $id), html('h3', $prompt), implode('', $radio_buttons)); }