* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ # now you can define to for people list to not include the visual editor for # there are other plugins that do that quite well # like http://wordpress.org/extend/plugins/visual-biography-editor/ if(!defined("PEOPLE_LIST_VISUAL_EDITOR")); define("PEOPLE_LIST_VISUAL_EDITOR", true); add_action('admin_print_styles-settings_page_people_lists', 'people_list_options_init_style' ); add_action('admin_print_scripts-settings_page_people_lists', 'people_list_options_init_script' ); if(PEOPLE_LIST_VISUAL_EDITOR): add_action('admin_print_scripts-user-edit.php', 'people_lists_tinymce_init_script'); add_action('admin_print_scripts-profile.php', 'people_lists_tinymce_init_script'); add_action('admin_print_styles-user-edit.php', 'people_lists_tinymce_init_style'); add_action('admin_print_styles-profile.php', 'people_lists_tinymce_init_style'); // add wysiwig textarea to to add_action('show_user_profile', 'people_list_edit_user_profile_bio_field', 10, 1); add_action('edit_user_profile', 'people_list_edit_user_profile_bio_field', 10 ,1); add_action("admin_init",'people_list_edit_user_profile_bio_init'); add_filter( 'get_the_author_description', 'people_list_edit_user_profile_bio_filter' ); // for the media buttons - I think this could probably be removed add_action('admin_footer-user-edit.php', 'people_lists_media_buttons', 40 ); add_action('admin_footer-profile.php', 'people_lists_media_buttons', 40 ); endif; add_action('admin_footer-user-edit.php', 'wp_preload_dialogs', 30 ); add_action('admin_footer-profile.php', 'wp_preload_dialogs', 30 ); add_action('admin_init', 'people_list_register_options_init'); add_action('admin_menu', 'people_list_options_add_page'); add_action('wp_ajax_people_list_save', 'people_list_saving_list'); add_action('wp_ajax_people_settings_save', 'people_list_saving_settings'); add_action('media_buttons_context', 'people_lists_overlay_button'); add_action('admin_footer', 'people_lists_overlay_popup_form'); add_shortcode('people-lists', 'people_lists_shortcode'); add_filter('widget_text', 'do_shortcode'); add_filter('user_contactmethods','people_lists_user_fields_filter'); function people_list_edit_user_profile_bio_field($user) { $news_user = new WP_User( $user->ID ); ?>
description, "description-1", array('textarea_name'=>'description')); ?>
$list){ $user_field_added[$index] = stripslashes($list); } endif; if(empty($people_list_option['settings'])){ return $user_fields; } else{ return array_merge($user_field_added,$user_fields); } } /** * people_list_saving_settings function. * Description: Storing the new fields information in the database and saving sorting of that list. * @access public * @return void */ function people_list_saving_settings() { $option_name = 'people-lists'; $people_list = get_option($option_name); wp_parse_str( urldecode($_POST['field_info']), $field_info ); $final_field_array = array(); $count = 0; if( is_array($field_info['field_slug_list']) ): foreach($field_info['field_slug_list'] as $slug) { $final_field_array[$slug] = $field_info['field_name_list'][$count]; $count++; } endif; $people_list['settings'] = $final_field_array; update_option( $option_name, $people_list); } /** * people_list_saving_list function. * Description: Storing list information in the database for new and updated lists to track any sorting of the lists. * @access public * @return void */ function people_list_saving_list() { $option_name = 'people-lists'; $people_list['lists'] = array(); $people_list = get_option($option_name); wp_parse_str( $_POST['list'], $list ); wp_parse_str($_POST['form'], $data); // set the list to be something nice $data['list'] = $list; if(!is_numeric($data['avatar_size'])) $data['avatar_size'] = 96; if( is_numeric( $data['list_id'] ) || is_array( $people_list['lists'][$data['list_id']] )): // make sure that the slug is beeing passed on $data['slug'] = $people_list['lists'][$data['list_id']]['slug']; $people_list['lists'][$data['list_id']] = $data; echo 'update'; else: $slug = people_lists_slug( $data['title'] ); // Check if the slug exists $counter = 1; while( people_lists_slug_exists($slug,$people_list['lists']) ) { $slug = people_lists_slug($data['title'])."-".$counter; $counter += 1; } $data['slug'] = $slug; // Saving for the first time $people_list['lists'][] = $data; echo 'new'; endif; update_option( $option_name, $people_list); die(); // thats it } /** * people_lists_slug function. * Description: Creating a slug (shortcode list name) using the list name provided by the user. * @access public * @param mixed $str * @return void */ function people_lists_slug($str) { $str = strtolower(trim($str)); $str = preg_replace('/[^a-z0-9-]/', '-', $str); $str = preg_replace('/-+/', "-", $str); return $str; } /** * people_lists_slug_exists function. * Description: Check if a slug (shortcode list name) exists. * @access public * @param mixed $slug * @param mixed $people_list['lists'] * @return void */ function people_lists_slug_exists($slug,$people_list) { if( is_array($people_list) ): foreach($people_list as $list): if($list['slug'] == $slug) return $list; endforeach; endif; return false; } /** * people_lists_field_slug_exists function. * Description: Check if a field slug with that name exists. * @access public * @param mixed $slug * @param mixed $people_list['lists'] * @return void */ function people_lists_field_slug_exists($field_slug,$people_list) { if( is_array($people_list) ): foreach($people_list as $fields): if($fields['field_slug'] == $field_slug) return $fields; endforeach; endif; return false; } /** * people_lists_media_buttons function. * add media buttons if they need to be there * @access public * @return void */ function people_lists_media_buttons() { if ( !current_user_can( 'upload_files' ) ) return; echo '
'; } /** * people_lists_tinymce_init_script function. * Description: Calling the appropriate JS files to initialize tinyMCE on profile page. * @access public * @return void */ function people_lists_tinymce_init_script(){ // wp_enqueue_script('tiny_mce'); // add_action('admin_print_footer_scripts', 'wp_tiny_mce', 25 ); wp_enqueue_script('people-lists-tinymce', plugins_url('/people-lists/js/people-lists-tinymce.js'),'jquery'); // add_filter( 'tiny_mce_before_init', 'people_lists_tiny_filter_remove_fullscreen'); } /** * people_lists_tinymce_init_style function. * Description: Calling the appropriate CSS files to initialize tinyMCE on profile page. * @access public * @return void */ function people_lists_tinymce_init_style(){ // wp_enqueue_style('people-lists-tinymce', plugins_url('/people-lists/css/people-lists-tinymce.css'),'css'); } /** * people_list_register_options_init function. * Description: Registering People Lists Settings Page * @access public * @return void */ function people_list_register_options_init(){ register_setting( 'people_lists_options', 'people_lists', 'people_list_validate_admin_page' ); // set the language load_plugin_textdomain( 'people-list', false , basename( dirname( __FILE__ ) ) . '/languages' ); } /** * people_list_options_init_style function. * Description: Calling the appropriate CSS files to initialize functionality on the People Lists Settings page. * @access public * @return void */ function people_list_options_init_style(){ wp_enqueue_style('people-lists-style', plugins_url('/people-lists/css/people-lists.css'),'css'); } /** * people_list_options_init_script function. * Description: Calling the appropriate JS files to initialize functionality on the People Lists Settings page. * @access public * @return void */ function people_list_options_init_script(){ wp_enqueue_script('people-lists-jquery-sortable', plugins_url('/people-lists/js/jquery-ui.min.js'), array('jquery','jquery-ui-tabs','jquery-ui-sortable')); wp_enqueue_script('people-lists', plugins_url('/people-lists/js/people-lists.js'), array('jquery','jquery-ui-tabs','jquery-ui-sortable')); } /** * people_list_options_add_page function. * Description: Initialize People Lists Option page. * @access public * @return void */ function people_list_options_add_page() { $page = add_options_page('People Lists', 'People Lists', 'manage_options', 'people_lists', 'people_list_admin_page'); add_action('admin_print_styles-' . $page,'people_lists_admin_styles'); } /** * people_lists_admin_styles function. * Description: JQuery Sortable initialization call. * @access public * @return void */ function people_lists_admin_styles() { wp_enqueue_script('people-lists-jquery-sortable'); wp_enqueue_script('people-lists'); wp_enqueue_style( 'people-lists-style'); wp_enqueue_script('jquery-ui-tabs'); } /** * people_lists_overlay_button function. * Description: For adding the People Lists "Insert List" button to the pages & posts editing screens. * @access public * @param mixed $context * @return void */ function people_lists_overlay_button($context){ $people_lists_overlay_image_button = plugins_url('/people-lists/img/form-button.png'); $output_link = '' . __('; return $context.$output_link; } /** * people_lists_overlay_popup_form function. * Description: For displaying the overlay to insert a People List to the pages & posts editing screens. * @access public * @return void */ function people_lists_overlay_popup_form(){ $option_name = 'people-lists'; $people_list_option = get_option($option_name); ?>


  • %nickname% -
  • %email% -
  • %bio% -
  • %firstname% -
  • %lastname% -
  • %username% -
  • %thumbnail% -
  • %website% -
  • %aim% -
  • %yahooim% -
  • %jabbergoogle% -
  • %id% -
  • %authorurl%
    $field_slug): ?>
  • %%
  • '.$item.''; endforeach; endif; ?>
  • beforeafter
  • $field_slug): $before = ( isset($list['before'][$item]) ? $list['before'][$item]: '' ); $after = ( isset($list['after'][$item]) ? $list['after'][$item]: '' ); people_lists_before_after_item( $field_slug, $list['before'][$item], $list['after'][$item], $item ); endforeach; $item = null; $filter_array = array(); $filter_array = apply_filters('people_list_custom_fields',$filter_array); if(is_array($filter_array)): foreach ( $filter_array as $item): $before = ( isset($list['before'][$item]) ? $list['before'][$item]: '' ); $after = ( isset($list['after'][$item]) ? $list['after'][$item]: '' ); people_lists_before_after_item( $item, $list['before'][$item], $list['after'][$item], $item ); endforeach; endif; ?>

    ID, $list['list']['uid'])): ?>
  • ID, 32); ?> display_name; ?>user_email; ?>
  • ID] = $person; endif; endforeach; endif; ?>

  • ID, 32); ?> display_name; ?>user_email; ?>



Drag & Drop to change the order of their display in Your Profile.','people-list');?>


  • %thumbnail% \n"; $html .= "
    %nickname%
    \n"; $html .= "
    %email%
    \n"; $html .= "
    %bio%
    \n"; return $html; } /** * people_lists_shortcode function. * Description: Creation of the [people-lists list=example-list] shortcode and conversion of the template codes into the * selected display option selected by the user. * @access public * @param mixed $atts * @return void */ function people_lists_shortcode($atts) { $option_name = 'people-lists'; $people_list_option = get_option($option_name); extract(shortcode_atts(array( 'list' => null, ), $atts)); if( !isset($list) ) return "Empty list - Please remove the [people-lists] code."; // $people_lists = get_option('people-lists'); $found_people_list = people_lists_slug_exists($list,$people_list_option['lists']); if(!$found_people_list) return "This list is non-existent - Please remove the [people-lists list=".$list."] code."; $users_of_blog = get_users_of_blog(); $input_template = array(); $input_template[0] = "%nickname%"; $input_template[1] = "%email%"; $input_template[2] = "%bio%"; $input_template[3] = "%firstname%"; $input_template[4] = "%lastname%"; $input_template[5] = "%username%"; $input_template[6] = "%thumbnail%"; $input_template[7] = "%website%"; $input_template[8] = "%aim%"; $input_template[9] = "%yahooim%"; $input_template[10] = "%jabbergoogle%"; $input_template[11] = "%id%"; $input_template[12] = "%authorurl%"; $counter = 13; if( is_array($people_list_option['settings']) ): foreach($people_list_option['settings'] as $index => $field_slug): $input_template[$counter] = "%".$index."%"; $counter++; endforeach; endif; $input_template = apply_filters('people_list_custom_fields',$input_template); if( is_array($found_people_list['list']['uid']) ): foreach($found_people_list['list']['uid'] as $id): $replacements = array(); $user_data = get_userdata($id); $replacements[0] = ( !empty($user_data->nickname) ? $found_people_list['before']['nickname']. $user_data->nickname. $found_people_list['after']['nickname']:""); $replacements[1] = ( !empty($user_data->user_email) ? $found_people_list['before']['email']. $user_data->user_email. $found_people_list['after']['email']:""); $replacements[2] = ( !empty($user_data->description) ? $found_people_list['before']['bio']. $user_data->description. $found_people_list['after']['bio']:""); $replacements[3] = ( !empty($user_data->first_name) ? $found_people_list['before']['firstname'].$user_data->first_name. $found_people_list['after']['firstname']:""); $replacements[4] = ( !empty($user_data->last_name) ? $found_people_list['before']['lastname']. $user_data->last_name. $found_people_list['after']['lastname']:""); $replacements[5] = ( !empty($user_data->user_login) ? $found_people_list['before']['username']. $user_data->user_login. $found_people_list['after']['username']:""); $replacements[6] = $found_people_list['before']['thumbnail'].get_avatar($id,$found_people_list['avatar_size']). $found_people_list['after']['thumbnail']; $replacements[7] = ( !empty($user_data->user_url) ? $found_people_list['before']['website']. $user_data->user_url. $found_people_list['after']['website']:""); $replacements[8] = ( !empty($user_data->aim) ? $found_people_list['before']['aim']. $user_data->aim. $found_people_list['after']['aim']:""); $replacements[9] = ( !empty($user_data->yim) ? $found_people_list['before']['yahooim']. $user_data->yim. $found_people_list['after']['yahooim']:""); $replacements[10] = ( !empty($user_data->jabber) ? $found_people_list['before']['jabbergoogle'].$user_data->jabber. $found_people_list['after']['jabbergoogle']:""); $replacements[11] = $found_people_list['before']['id']. $id. $found_people_list['after']['id']; $replacements[12] = $found_people_list['before']['authorurl'].get_author_posts_url($id).$found_people_list['after']['authorurl']; $counter = 13; if( is_array($people_list_option['settings']) ): foreach($people_list_option['settings'] as $index => $field_slug): $replacements[$counter] = ( !empty( $user_data->$index) ? $found_people_list['before'][$index]. $user_data->$index.$found_people_list['after'][$index]: ""); $counter++; endforeach; endif; $replacements = apply_filters('people_list_fields_display',$replacements, $user_data, $found_people_list ); $html = '
    '; $html .= stripslashes($found_people_list['template']); $html .= '
    '; $html2 .= apply_filters("people_list_shortcode", str_replace($input_template, $replacements, $html)); endforeach; endif; return $html2; } if ( function_exists('register_uninstall_hook') ) register_uninstall_hook(__FILE__, 'people_lists_uninstall_hook'); /** * people_lists_uninstall_hook function. * Delete options once the plugin is disabled * @access public * @return void */ function people_lists_uninstall_hook() { $option_name = 'people-lists'; delete_option($option_name); } /** * people_lists_tiny_filter_remove_fullscreen function. * * @access public * @param mixed $initArray * @return void */ function people_lists_tiny_filter_remove_fullscreen($initArray){ $initArray["theme_advanced_buttons1"] = str_replace(',fullscreen', '', $initArray["theme_advanced_buttons1"]); return $initArray; } /* --- End of File --- */