'; } return strip_tags($new_field_value, $encrypted_lite_widgets_allowed_tags); // No allowed tags for all other fields } elseif ($encrypted_lite_widgets_field_type == 'url') { return esc_url_raw($new_field_value); } else { return strip_tags($new_field_value); } } function encrypted_lite_widgets_show_widget_field($instance = '', $widget_field = '', $athm_field_value = '') { // Store Posts in array $encrypted_lite_postlist[0] = array( 'value' => 0, 'label' => '--choose--' ); $arg = array('posts_per_page' => -1); $encrypted_lite_posts = get_posts($arg); foreach ($encrypted_lite_posts as $encrypted_lite_post) : $encrypted_lite_postlist[$encrypted_lite_post->ID] = array( 'value' => $encrypted_lite_post->ID, 'label' => $encrypted_lite_post->post_title ); endforeach; extract($widget_field); switch ($encrypted_lite_widgets_field_type) { // Standard text field case 'text' : ?>



/>

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





get_field_id($encrypted_lite_widgets_name); $class = ''; $int = ''; $value = $athm_field_value; $name = $instance->get_field_name($encrypted_lite_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.', 'encrypted-lite') . '

'; } $output .= '
' . "\n"; if ($value != '') { $remove = 'Remove'; $attachment_id = encrypted_get_attachment_id_from_url($value); $image_array = wp_get_attachment_image_src( $attachment_id, 'medium'); $image = preg_match('/(^.*\.jpg|jpeg|png|gif|ico*)/i', $value); if ($image) { $output .= '' . $remove; } 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', 'encrypted-lite'); $output .= ''; } } $output .= '
' . "\n"; echo $output; break; case 'icon' : add_thickbox(); ?>



__('Upload', 'encrypted-lite'), 'remove' => __('Remove', 'encrypted-lite') )); } add_action('admin_enqueue_scripts', 'encrypted_widget_media_scriptss');