Ejemplo n.º 1
0
 private static function _spawn_instance()
 {
     if (self::$_instance) {
         return false;
     }
     self::$_instance = new Bpfb_Data_Container();
 }
Ejemplo n.º 2
0
 /**
  * Processes video-type shortcode and create proper markup.
  * Relies on `wp_oembed_get()` for markup rendering.
  */
 function process_video_tag($atts, $content)
 {
     return wp_oembed_get($content, array('width' => Bpfb_Data::get('oembed_width', 450)));
 }
    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 
    }
Ejemplo n.º 4
0
 /**
  * This is where the plugin registers itself.
  */
 function add_hooks()
 {
     add_action('init', array($this, '_add_js_css_hooks'));
     // Step2: Add AJAX request handlers
     add_action('wp_ajax_bpfb_preview_video', array($this, 'ajax_preview_video'));
     add_action('wp_ajax_bpfb_preview_link', array($this, 'ajax_preview_link'));
     add_action('wp_ajax_bpfb_preview_photo', array($this, 'ajax_preview_photo'));
     add_action('wp_ajax_bpfb_preview_remote_image', array($this, 'ajax_preview_remote_image'));
     add_action('wp_ajax_bpfb_remove_temp_images', array($this, 'ajax_remove_temp_images'));
     add_action('wp_ajax_bpfb_update_activity_contents', array($this, 'ajax_update_activity_contents'));
     do_action('bpfb_add_ajax_hooks');
     // Step 3: Register and process shortcodes
     BpfbCodec::register();
     if (Bpfb_Data::get('cleanup_images')) {
         add_action('bp_before_activity_delete', array($this, 'remove_activity_images'));
     }
 }