adelObj = new active_directory_employee_list_output; add_action( 'admin_print_styles-widgets.php', array( &$this, 'enqueue_admin_styles' ) ); add_action( 'admin_print_scripts-widget.php', array( &$this, 'enqueue_admin_styles' ) ); $widget_ops = array( 'classname' => 'adel-list', 'description' => 'Display information about a specific user in active directory.' ); $control_ops = array( 'width' => 450, 'height' => 350, 'id_base' => 'adel-list-widget' ); parent::WP_Widget( 'adel-list-widget', 'AD List Widget', $widget_ops, $control_ops ); } function enqueue_admin_styles() { wp_enqueue_style( 'ad-employee-list-admin-style' ); wp_enqueue_script( 'ad-employee-list-admin' ); } function send_admin_js_vars() { print( "\n\n" ); print( "\n\n" ); print( "\n\n" ); } function widget( $args, $instance ) { $this->adelObj->_get_options(); $this->adelObj->output_built = null; $this->adelObj->employee_list = null; $_REQUEST['widget_adeq'] = isset( $_REQUEST['widget_adeq'] ) ? $_REQUEST['widget_adeq'] : ''; $_REQUEST['widget_adep'] = isset( $_REQUEST['widget_adep'] ) ? $_REQUEST['widget_adep'] : ''; if( isset( $_REQUEST['widget_adeq'] ) ) { $tmp['adeq'] = isset( $_REQUEST['adeq'] ) ? $_REQUEST['adeq'] : null; $_REQUEST['adeq'] = $_REQUEST['widget_adeq']; } if( isset( $_REQUEST['widget_adep'] ) ) { $tmp['adep'] = isset( $_REQUEST['adep'] ) ? $_REQUEST['adep'] : null; $_REQUEST['adep'] = $_REQUEST['widget_adep']; } extract( $args ); $title = apply_filters( 'widget_title', $instance['title'] ); echo $before_widget; if( $title ) echo $before_title . $title . $after_title; unset( $instance['title'] ); if( !isset( $instance['include_search'] ) ) $instance['include_search'] = false; echo str_replace( array( 'adep=', 'name="adeq"', 'id="adeq"' ), array( 'widget_adep=', 'name="widget_adeq"', 'id="widget_adeq"' ), $this->adelObj->render_shortcode( $instance ) ); echo $after_widget; foreach( $tmp as $k=>$v ) { $_REQUEST[$k] = $v; } return; } function update( $new_instance, $old_instance ) { /** * Fields are: * + title * + include_search * + username * + group * + fields * + preset * + output_builder */ $instance = $old_instance; $instance['title'] = empty( $new_instance['title'] ) ? null : strip_tags( $new_instance['title'] ); $instance['include_search'] = 'on' == $new_instance['include_search'] ? true : false; $instance['username'] = null; $instance['group'] = empty( $new_instance['group'] ) ? null : strip_tags( $new_instance['group'] ); $instance['preset'] = empty( $new_instance['preset'] ) ? null : $new_instance['preset']; $instance['fields'] = empty( $new_instance['fields'] ) ? null : $new_instance['fields']; $instance['output_builder'] = empty( $new_instance['output_builder'] ) ? null : stripslashes_deep( $new_instance['output_builder'] ); return $instance; } function form( $instance ) { $this->adelObj->_get_options(); /** * Fields are: * + title * + username * + group * + fields * + output_builder */ $instance = array_merge( array( 'title'=>null, 'username'=>null, 'group'=>null, 'fields'=>array(), 'order' => '', 'output_builder'=>null, 'preset'=>'' ), $instance ); ?>
/>