Esempio n. 1
0
 function __construct()
 {
     if (!bp_docs_enable_attachments()) {
         return;
     }
     add_action('template_redirect', array($this, 'catch_attachment_request'), 20);
     add_filter('redirect_canonical', array($this, 'redirect_canonical'), 10, 2);
     add_filter('upload_dir', array($this, 'filter_upload_dir'));
     add_action('bp_docs_doc_saved', array($this, 'check_privacy'));
     add_filter('wp_handle_upload_prefilter', array($this, 'maybe_create_rewrites'));
     add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
     add_action('pre_get_posts', array($this, 'filter_gallery_posts'));
     add_action('pre_get_posts', array($this, 'filter_directory_posts'));
     // Add the tags filter markup
     add_filter('bp_docs_filter_types', array($this, 'filter_type'));
     add_filter('bp_docs_filter_sections', array($this, 'filter_markup'));
     // Icon display
     add_filter('icon_dir', 'BP_Docs_Attachments::icon_dir');
     add_filter('icon_dir_uri', 'BP_Docs_Attachments::icon_dir_uri');
     // Catch delete request
     add_action('bp_actions', array($this, 'catch_delete_request'));
     // Ensure that all logged-in users have the 'upload_files' cap
     add_filter('map_meta_cap', array(__CLASS__, 'map_meta_cap'), 10, 4);
     // Admin notice about directory accessibility
     add_action('admin_init', array($this, 'admin_notice_init'));
     require dirname(__FILE__) . '/attachments-ajax.php';
 }
Esempio n. 2
0
    public function enable_attachments_setting_markup()
    {
        $enabled = bp_docs_enable_attachments();
        ?>
		<select name="bp-docs-enable-attachments" id="bp-docs-enable-attachments">
			<option value="yes" <?php 
        selected($enabled, true);
        ?>
><?php 
        _e('Enabled', 'bp-docs');
        ?>
</option>
			<option value="no" <?php 
        selected($enabled, false);
        ?>
><?php 
        _e('Disabled', 'bp-docs');
        ?>
</option>
		</select>
		<p class="description"><?php 
        _e("Allow users to add attachments to their Docs.", 'bp-docs');
        ?>
</p>

		<?php 
    }
Esempio n. 3
0
    do_action('bp_docs_loop_additional_th');
    ?>
		</tr>
        </thead>

        <tbody>
	<?php 
    while (bp_docs_has_docs()) {
        bp_docs_the_doc();
        ?>
 		<tr<?php 
        bp_docs_doc_row_classes();
        ?>
>
			<?php 
        if (bp_docs_enable_attachments()) {
            ?>
				<td class="attachment-clip-cell">
					<?php 
            bp_docs_attachment_icon();
            ?>
				</td>
			<?php 
        }
        ?>

			<td class="title-cell">
				<a href="<?php 
        bp_docs_doc_link();
        ?>
"><?php 
	<?php 
do_action('bp_docs_before_doc_content');
?>

	<div class="doc-content">
		<?php 
bp_docs_the_content();
?>
	</div>

	<?php 
do_action('bp_docs_after_doc_content');
?>

	<?php 
if (bp_docs_enable_attachments() && bp_docs_doc_has_attachments()) {
    ?>
		<div class="doc-attachments">
			<h3><?php 
    _e('Attachments', 'bp-docs');
    ?>
</h3>
			<?php 
    include bp_docs_locate_template('single/attachments.php');
    ?>
		</div>
	<?php 
}
?>

	<div class="doc-meta">