'; foreach ($the100_widgets_field_options as $athm_option_name => $athm_option_title) { ?> />

get_field_id($the100_widgets_name)); $class = ''; $int = ''; $value = esc_url($athm_field_value); $name = esc_attr($instance->get_field_name($the100_widgets_name)); if ($value) { $class = ' has-file'; } $output .= '
'; $output .= '
'; $output .= '' . "\n"; if (function_exists('wp_enqueue_media')) { if (( $value == '')) { $output .= '' . "\n"; } else { $output .= '' . "\n"; } } else { $output .= '

' . __('Upgrade your version of WordPress for full media support.', 'the100') . '

'; } $output .= '
' . "\n"; if ($value != '') { $image = preg_match('/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value); if ($image) { $output .= ''.__('Remove','the100').''; } else { $parts = explode("/", $value); for ($i = 0; $i < sizeof($parts); ++$i) { $title = $parts[$i]; } // No output preview if it's not an image. $output .= ''; // Standard generic output if it's not an image. $title = __('View File', 'the100'); $output .= ''; } } $output .= '
' . "\n"; echo wp_kses_post($output); break; } } function the100_widgets_updated_field_value($widget_field, $new_field_value) { extract($widget_field); // Allow only integers in number fields if ($the100_widgets_field_type == 'number') { return absint($new_field_value); } elseif ($the100_widgets_field_type == 'textarea') { // Check if field array specifed allowed tags if (!isset($the100_widgets_allowed_tags)) { // If not, fallback to default tags $the100_widgets_allowed_tags = '

'; } return strip_tags($new_field_value, $the100_widgets_allowed_tags); // No allowed tags for all other fields } elseif ($the100_widgets_field_type == 'url') { return esc_url_raw($new_field_value); } else { return strip_tags($new_field_value); } } if(is_admin()): /** * Enqueue scripts for file uploader */ function the100_widgets_media_scripts($hook) { wp_enqueue_style( 'the100-admin-style', get_template_directory_uri() . '/css/admin-style.css' ); if ( 'customize.php' == $hook || 'widgets.php' == $hook ) { if (function_exists('wp_enqueue_media')) wp_enqueue_media(); wp_register_script('the100-admin-scripts', get_template_directory_uri() . '/js/admin-scripts.js', array('jquery'), 1.0,true); wp_enqueue_script('the100-admin-scripts'); wp_localize_script('the100-admin-scripts', 'the100Uploader', array( 'upload' => __('Upload', 'the100'), 'remove' => __('Remove', 'the100') )); } else{ return; } } add_action('admin_enqueue_scripts', 'the100_widgets_media_scripts'); endif; require get_template_directory() . '/inc/widgets/the100_cta.php';