public function settings_page()
    {
        $theme = Bpfb_Data::get('theme');
        list($thumb_w, $thumb_h) = Bpfb_Data::get_thumbnail_size();
        $oembed_width = Bpfb_Data::get('oembed_width', 450);
        $alignment = Bpfb_Data::get('alignment', 'left');
        $cleanup_images = Bpfb_Data::get('cleanup_images', false);
        ?>
<div class="wrap bpfb">
	<?php 
        screen_icon('buddypress');
        ?>
	<h2><?php 
        echo get_admin_page_title();
        ?>
</h2>
	<form action="" method="POST">
		
		<fieldset class="appearance section">
			<legend><?php 
        _e('Appearance', 'bpfb');
        ?>
</legend>

			<?php 
        if (current_theme_supports('bpfb_interface_style') || current_theme_supports('bpfb_toolbar_icons')) {
            ?>
			<div class="updated below-h2">
				<p><?php 
            _e('Your BuddyPress theme incorporates Activity Plus style overrides. Respecting the selection you make in the &quot;Appearance&quot; section is entirely up to your theme.', 'bpfb');
            ?>
</p>
			</div>
			<?php 
        }
        ?>

			<fieldset class="theme option">
				<legend><?php 
        _e('Theme', 'bpfb');
        ?>
</legend>
				<label for="bpfb-theme-default">
					<img src="<?php 
        echo BPFB_PLUGIN_URL;
        ?>
/img/system/theme-legacy.png" />
					<input type="radio" id="bpfb-theme-default" name="bpfb[theme]" value="" <?php 
        checked($theme, '');
        ?>
 />
					<?php 
        _e('Default (legacy)', 'bpfb');
        ?>
				</label>
				<label for="bpfb-theme-new">
					<img src="<?php 
        echo BPFB_PLUGIN_URL;
        ?>
/img/system/theme-new.png" />
					<input type="radio" id="bpfb-theme-new" name="bpfb[theme]" value="new" <?php 
        checked($theme, 'new');
        ?>
 />
					<?php 
        _e('New', 'bpfb');
        ?>
				</label>
				<label for="bpfb-theme-round">
					<img src="<?php 
        echo BPFB_PLUGIN_URL;
        ?>
/img/system/theme-round.png" />
					<input type="radio" id="bpfb-theme-round" name="bpfb[theme]" value="round" <?php 
        checked($theme, 'round');
        ?>
 />
					<?php 
        _e('Round', 'bpfb');
        ?>
				</label>
			</fieldset>
			<fieldset class="alignment option">
				<legend><?php 
        _e('Alignment', 'bpfb');
        ?>
</legend>
				<label for="bpfb-theme-alignment-left">
					<input type="radio" id="bpfb-theme-alignment-left" name="bpfb[alignment]" value="left" <?php 
        checked($alignment, 'left');
        ?>
 />
					<?php 
        _e('Left', 'bpfb');
        ?>
				</label>
				<label for="bpfb-theme-alignment-right">
					<input type="radio" id="bpfb-theme-alignment-right" name="bpfb[alignment]" value="right" <?php 
        checked($alignment, 'right');
        ?>
 />
					<?php 
        _e('Right', 'bpfb');
        ?>
				</label>
			</fieldset>
		</fieldset>

		
		<fieldset class="functional section">
			<legend><?php 
        _e('Functional', 'bpfb');
        ?>
</legend>
			
			<fieldset class="oembed option">
				<legend><?php 
        _e('oEmbed', 'bpfb');
        ?>
</legend>
				<?php 
        if (defined('BPFB_THUMBNAIL_IMAGE_SIZE')) {
            ?>
					<div class="updated below-h2">
						<p><?php 
            printf(__('Your oEmbed dimensions will be dictated by the <code>BPFB_OEMBED_WIDTH</code> define value (%s). Remove this define to enable this option.', 'bpfb'), BPFB_OEMBED_WIDTH);
            ?>
</p>
					</div>
				<?php 
        }
        ?>
				<label for="bpfb-oembed-width">
					<?php 
        _e('Width', 'bpfb');
        ?>
					<input type="text" id="bpfb-oembed-width" name="bpfb[oembed_width]" size="4" value="<?php 
        echo (int) $oembed_width;
        ?>
" <?php 
        echo defined('BPFB_OEMBED_WIDTH') ? 'disabled="disabled"' : '';
        ?>
 /> px
				</label>
			</fieldset>
			<fieldset class="thumbnail option">
				<legend><?php 
        _e('Image thumbnails', 'bpfb');
        ?>
</legend>
				<?php 
        if (defined('BPFB_THUMBNAIL_IMAGE_SIZE')) {
            ?>
					<div class="updated below-h2">
						<p><?php 
            printf(__('Your thumbnail dimensions will be dictated by the <code>BPFB_THUMBNAIL_IMAGE_SIZE</code> define value (%s). Remove this define to enable these options.', 'bpfb'), BPFB_THUMBNAIL_IMAGE_SIZE);
            ?>
</p>
					</div>
				<?php 
        }
        ?>
				<label for="bpfb-thumbnail_size-width">
					<?php 
        _e('Width', 'bpfb');
        ?>
					<input type="text" id="bpfb-thumbnail_size-width" name="bpfb[thumbnail_size_width]" size="4" value="<?php 
        echo (int) $thumb_w;
        ?>
" <?php 
        echo defined('BPFB_THUMBNAIL_IMAGE_SIZE') ? 'disabled="disabled"' : '';
        ?>
 /> px
				</label>
				<label for="bpfb-thumbnail_size-height">
					<?php 
        _e('Height', 'bpfb');
        ?>
					<input type="text" id="bpfb-thumbnail_size-height" name="bpfb[thumbnail_size_height]" size="4" value="<?php 
        echo (int) $thumb_h;
        ?>
" <?php 
        echo defined('BPFB_THUMBNAIL_IMAGE_SIZE') ? 'disabled="disabled"' : '';
        ?>
 /> px
				</label>
			</fieldset>
			<fieldset class="bpfb-misc option">
				<legend><?php 
        _e('Misc', 'bpfb');
        ?>
</legend>
				<label for="bpfb-cleanup_images">
					<input type="checkbox" id="bpfb-cleanup_images" name="bpfb[cleanup_images]" value="1" <?php 
        checked($cleanup_images, true);
        ?>
 />
					<?php 
        _e('Clean up images?', 'bpfb');
        ?>
				</label>
			</fieldset>
		</fieldset>

		<p>
			<?php 
        wp_nonce_field($this->_page_hook);
        ?>
			<button class="button button-primary"><?php 
        _e('Save');
        ?>
</button>
		</p>
	</form>
</div>
		<?php 
    }
 /**
  * Image moving and resizing routine.
  *
  * Relies on WP built-in image resizing.
  *
  * @param array Image paths to move from temp directory
  * @return mixed Array of new image paths, or (bool)false on failure.
  * @access private
  */
 function move_images($imgs)
 {
     if (!$imgs) {
         return false;
     }
     if (!is_array($imgs)) {
         $imgs = array($imgs);
     }
     global $bp;
     $ret = array();
     list($thumb_w, $thumb_h) = Bpfb_Data::get_thumbnail_size();
     $processed = 0;
     foreach ($imgs as $img) {
         $processed++;
         if (BPFB_IMAGE_LIMIT && $processed > BPFB_IMAGE_LIMIT) {
             break;
         }
         // Do not even bother to process more.
         if (preg_match('!^https?:\\/\\/!i', $img)) {
             // Just add remote images
             $ret[] = $img;
             continue;
         }
         $pfx = $bp->loggedin_user->id . '_' . preg_replace('/[^0-9]/', '-', microtime());
         $tmp_img = realpath(BPFB_TEMP_IMAGE_DIR . $img);
         $new_img = BPFB_BASE_IMAGE_DIR . "{$pfx}_{$img}";
         if (@rename($tmp_img, $new_img)) {
             if (function_exists('wp_get_image_editor')) {
                 // New way of resizing the image
                 $image = wp_get_image_editor($new_img);
                 if (!is_wp_error($image)) {
                     $thumb_filename = $image->generate_filename('bpfbt');
                     $image->resize($thumb_w, $thumb_h, false);
                     // Alright, now let's rotate if we can
                     if (function_exists('exif_read_data')) {
                         $exif = exif_read_data($new_img);
                         // Okay, we now have the data
                         if (!empty($exif['Orientation']) && 3 === (int) $exif['Orientation']) {
                             $image->rotate(180);
                         } else {
                             if (!empty($exif['Orientation']) && 6 === (int) $exif['Orientation']) {
                                 $image->rotate(-90);
                             } else {
                                 if (!empty($exif['Orientation']) && 8 === (int) $exif['Orientation']) {
                                     $image->rotate(90);
                                 }
                             }
                         }
                     }
                     $image->save($thumb_filename);
                 }
             } else {
                 // Old school fallback
                 image_resize($new_img, $thumb_w, $thumb_h, false, 'bpfbt');
             }
             $ret[] = pathinfo($new_img, PATHINFO_BASENAME);
         } else {
             return false;
         }
     }
     return $ret;
 }