'All - Top', 'id' => 'pp-sidebar-top', 'before_widget' => '
options = get_option( 'pp_widget_project_team' ) ) { $this->options = array(); } add_action( 'widgets_init', array( $this, 'init' ) ); } function init() { $widget_options = array( 'classname' => 'pp-widget-project-team', 'description' => __( 'Display all project team members in the current project', 'prologue-projects' ) ); $control_options = array( 'height' => 350, 'id_base' => 'pp-widget-project-team' ); if ( ! is_countable( $this->options ) || ! count($this->options) ) { $options = array(-1 => false); } else { $options = $this->options; } foreach ( $options as $instance => $option ) { wp_register_sidebar_widget( 'pp-widget-project-team-' . $instance, __('Project Team', 'prologue-projects'), array($this, 'display'), $widget_options, array( 'number' => $instance ) ); wp_register_widget_control( 'pp-widget-project-team-' . $instance, __('Project Team', 'prologue-projects'), array($this, 'control'), $control_options, array( 'number' => $instance ) ); } } function display( $args, $instance = false ) { $before_widget = null; $before_title = null; $after_title = null; $category_id = null; $after_widget = null; if ( is_array( $instance ) ) { $instance = $instance['number']; } if ( !$instance || !is_numeric( $instance ) || 1 > $instance ) { return; } extract( $args ); echo $before_widget; $title = $this->options[$instance]['title'] ? $this->options[$instance]['title'] : __( 'Project Team', 'prologue-projects' ); echo $before_title; echo $title; echo $after_title; $data = pp_get_project_data( $category_id ); if ( $members = pp_get_project_members( $data['id'] ) ) { if ( is_countable( $members ) && count( $members ) ) { echo '
' . __( 'No team members assigned', 'prologue-projects' ) . '
' . "\n"; } echo $after_widget; } function control( $instance = false ) { if ( is_array( $instance ) ) { $instance = $instance['number']; } if ( !$instance || !is_numeric($instance) || 1 > $instance ) { $instance = '%i%'; } $options = $this->options; if ( 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['pp_widget_project_team'] ) ) { foreach ( $_POST['pp_widget_project_team'] as $_instance => $_value ) { if ( !$_value ) { continue; } $options[$_instance]['title'] = strip_tags( stripslashes( $_POST['pp_widget_project_team'][$_instance]['title'] ) ); } if ( $this->options != $options ) { $this->options = $options; update_option('pp_widget_project_team', $this->options); } } $options['%i%']['title'] = ''; $title = attribute_escape( stripslashes( $options[$instance]['title'] ) ); ?>options = get_option( 'pp_widget_featured_project' ) ) { $this->options = array(); } add_action( 'widgets_init', array( $this, 'init' ) ); } function init() { $widget_options = array( 'classname' => 'pp-widget-featured-project', 'description' => __( 'Display the description of the currently featured project', 'prologue-projects' ) ); $control_options = array( 'height' => 350, 'id_base' => 'pp-widget-featured-project' ); if ( ! is_countable( $this->options ) || ! count($this->options) ) { $options = array(-1 => false); } else { $options = $this->options; } foreach ( $options as $instance => $option ) { wp_register_sidebar_widget( 'pp-widget-featured-project-' . $instance, __('Featured Project', 'prologue-projects'), array($this, 'display'), $widget_options, array( 'number' => $instance ) ); wp_register_widget_control( 'pp-widget-featured-project-' . $instance, __('Featured Project', 'prologue-projects'), array($this, 'control'), $control_options, array( 'number' => $instance ) ); } } function display( $args, $instance = false ) { $before_widget = null; $before_title = null; $after_title = null; $after_widget = null; if ( is_array( $instance ) ) { $instance = $instance['number']; } if ( !$instance || !is_numeric( $instance ) || 1 > $instance ) { return; } extract( $args ); if ( !$featured_project_id = pp_get_option( 'featured_project' ) ) { return; } if ( !$featured_project = pp_get_project_data( $featured_project_id ) ) { return; } echo $before_widget; $title = $this->options[$instance]['title'] ? $this->options[$instance]['title'] : __( 'Featured Project', 'prologue-projects' ); echo $before_title; echo $title; echo $after_title; echo '
' . __( 'No team members assigned', 'prologue-projects' ) . '
' . "\n"; } } echo '' . __( '» Visit project', 'prologue-projects' ) . '
'; echo ''; echo $after_widget; } function control( $instance = false ) { if ( is_array( $instance ) ) { $instance = $instance['number']; } if ( !$instance || !is_numeric($instance) || 1 > $instance ) { $instance = '%i%'; } $options = $this->options; if ( 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['pp_widget_featured_project'] ) ) { foreach ( $_POST['pp_widget_featured_project'] as $_instance => $_value ) { if ( !$_value ) { continue; } $options[$_instance]['title'] = strip_tags( stripslashes( $_POST['pp_widget_featured_project'][$_instance]['title'] ) ); if ( isset( $_POST['pp_widget_featured_project'][$_instance]['show_team'] ) && $_POST['pp_widget_featured_project'][$_instance]['show_team'] ) { $options[$_instance]['show_team'] = 1; } else { $options[$_instance]['show_team'] = 0; } } if ( $this->options != $options ) { $this->options = $options; update_option('pp_widget_featured_project', $this->options); } } $options['%i%']['title'] = ''; $options['%i%']['show_team'] = ''; $title = attribute_escape( stripslashes( $options[$instance]['title'] ) ); if ( $options[$instance]['show_team'] ) { $show_team_checked = ' checked="checked"'; } ?>
options = get_option( 'pp_widget_user_projects' ) ) { $this->options = array(); } add_action( 'widgets_init', array( $this, 'init' ) ); } function init() { $widget_options = array( 'classname' => 'pp-widget-user-projects', 'description' => __( 'Displays the current user\'s projects', 'prologue-projects' ) ); $control_options = array( 'height' => 350, 'id_base' => 'pp-widget-user-projects' ); if ( ! is_countable( $this->options ) || ! count($this->options) ) { $options = array(-1 => false); } else { $options = $this->options; } foreach ( $options as $instance => $option ) { wp_register_sidebar_widget( 'pp-widget-user-projects-' . $instance, __('User Projects', 'prologue-projects'), array($this, 'display'), $widget_options, array( 'number' => $instance ) ); wp_register_widget_control( 'pp-widget-user-projects-' . $instance, __('User Projects', 'prologue-projects'), array($this, 'control'), $control_options, array( 'number' => $instance ) ); } } function display( $args, $instance = false ) { $before_widget = null; $title = null; $before_title = null; $after_title = null; $after_widget = null; if ( is_array( $instance ) ) { $instance = $instance['number']; } if ( !$instance || !is_numeric( $instance ) || 1 > $instance ) { return; } extract( $args ); global $is_author, $author_id; if ( !$is_author || !$author_id ) { return; } if ( !$user = new WP_User( $author_id ) ) { return; } echo $before_widget; $title_name = trim( $user->display_name ); if ( !$title_name ) { $title_name = __( 'This User\'s Projects', 'prologue-projects' ); } else { if ( substr( $title_name, '-1' ) === 's' ) { $title_name .= "'"; } else { $title_name .= "'s"; } $title = sprintf( __( '%s Projects', 'prologue-projects' ), $title_name ); } $title = $this->options[$instance]['title'] ? $this->options[$instance]['title'] : $title; $first_name = trim($user->first_name); if ( !$first_name ) { $empty = __( 'This user is not a member of any project teams', 'prologue-projects' ); } else { $empty = sprintf( __( '%s is not a member of any project teams', 'prologue-projects' ), wp_specialchars( $first_name ) ); } echo $before_title; echo $title; echo $after_title; if ( $projects = pp_get_user_projects( $author_id ) ) { echo '
' . $empty . '
' . "\n"; } echo $after_widget; } function control( $instance = false ) { if ( is_array( $instance ) ) { $instance = $instance['number']; } if ( !$instance || !is_numeric($instance) || 1 > $instance ) { $instance = '%i%'; } $options = $this->options; if ( 'POST' == strtoupper( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['pp_widget_user_projects'] ) ) { foreach ( $_POST['pp_widget_user_projects'] as $_instance => $_value ) { if ( !$_value ) { continue; } $options[$_instance]['title'] = strip_tags( stripslashes( $_POST['pp_widget_user_projects'][$_instance]['title'] ) ); } if ( $this->options != $options ) { $this->options = $options; update_option('pp_widget_user_projects', $this->options); } } $options['%i%']['title'] = ''; $title = attribute_escape( stripslashes( $options[$instance]['title'] ) ); if ( !$project_category_id = pp_get_category_id( 'projects' ) ) { ?>