HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/thread-self/root/proc/self/cwd/wp-content/themes/ronneby/inc/widgets/widget-search.php
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
class crum_search_widget extends WP_Widget {

	/*
	function crum_search_widget() {

		// Widget settings.

		$widget_ops = array('classname' => 'widget_search', 'description' => __('Search widget', 'dfd'));

		// Widget control settings.

		$control_ops = array('id_base' => 'crum_search_widget');

		// Create the widget.

		$this->WP_Widget('crum_search_widget', 'Widget: Search widget', $widget_ops, $control_ops);
	}*/
	
	function __construct() {
		parent::__construct(
            'crum_search_widget', // Base ID
            'Widget: Search widget', // Name
            array(
				'classname' => 'widget_search',
                'description' => __('Search widget', 'dfd')
            ) // Args
        );
	}

	function widget($args, $instance) {

		//get theme options

		if (isset($instance['title'])) {

			$title = $instance['title'];
		}

		if (isset($instance['text'])) {

			$text = $instance['text'];
		}

		extract($args);


		/* show the widget content without any headers or wrappers */

		echo $before_widget;

		if ($title) {

			echo $before_title;
			echo $title;
			echo $after_title;
		}
		?>

		<?php $id_s = uniqid('s_'); ?>
		<form role="search" method="get" id="<?php echo esc_attr(uniqid('searchform_')); ?>" class="form-search" action="<?php echo home_url('/'); ?>">
			<label class="hide" for="<?php echo esc_attr($id_s); ?>"><?php _e('Search for:', 'dfd'); ?></label>
			<input type="text" value="" name="s" id="<?php echo esc_attr($id_s); ?>" class="s-field" placeholder="<?php echo esc_attr($text); ?>">
			<input type="submit" value="<?php _e('Search', 'dfd'); ?>" class="btn">
		</form>

		<?php
		echo $after_widget;
	}

	function update($new_instance, $old_instance) {

		$instance = $old_instance;

		$instance['title'] = strip_tags($new_instance['title']);

		/* Strip tags (if needed) and update the widget settings. */

		$instance['text'] = strip_tags($new_instance['text']);


		return $instance;
	}

	function form($instance) {

		$title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';

		$text = isset($instance['text']) ? $instance['text'] : '';

		/* Set up some default widget settings. */

		$defaults = array('text' => 'Enter request...');

		$instance = wp_parse_args((array) $instance, $defaults);
		?>


		<p>
			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'dfd'); ?></label>
			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
		</p>

		<p>
			<label for="<?php echo esc_attr($this->get_field_id('text')); ?>"><?php _e('Placeholder', 'dfd'); ?></label><br/>
			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('text')); ?>" name="<?php echo esc_attr($this->get_field_name('text')); ?>" type="text" value="<?php echo esc_attr($text); ?>"/>
		</p>

		<?php
	}

}