public function drawTagBox()
 {
     ?>
     <div class="keywords inside">
     <?php 
     post_tags_meta_box(get_post($GLOBALS['post_ID']), array('title' => __('Tags', 'fetch-tweets'), 'args' => array('taxonomy' => FetchTweets_Commons::TagSlug)));
     ?>
     </div>
     <?php 
 }
 /**
  * Display a single item sub page; prepare the form to 
  * change the meta data for a single attachment.
  * 
  * This function is not used in WordPress 3.5 and later.
  *
  * @since 0.1
  * 
  * @param	int		The WordPress Post ID of the attachment item
  *
  * @return	array	message and/or HTML content
  */
 private static function _display_single_item($post_id)
 {
     global $post;
     /*
      * This function sets the global $post
      */
     $post_data = MLAData::mla_get_attachment_by_id($post_id);
     if (!isset($post_data)) {
         return array('message' => 'ERROR: Could not retrieve Attachment.', 'body' => '');
     }
     if (!current_user_can('edit_post', $post_id)) {
         return array('message' => 'You are not allowed to edit this Attachment.', 'body' => '');
     }
     if (!empty($post_data['mla_wp_attachment_metadata'])) {
         $page_template_array = MLAData::mla_load_template(MLA_PLUGIN_PATH . 'tpls/admin-display-single-image.tpl');
         $width = isset($post_data['mla_wp_attachment_metadata']['width']) ? $post_data['mla_wp_attachment_metadata']['width'] : '';
         $height = isset($post_data['mla_wp_attachment_metadata']['height']) ? $post_data['mla_wp_attachment_metadata']['height'] : '';
         $image_meta = var_export($post_data['mla_wp_attachment_metadata'], true);
         if (!isset($post_data['mla_wp_attachment_image_alt'])) {
             $post_data['mla_wp_attachment_image_alt'] = '';
         }
     } else {
         $page_template_array = MLAData::mla_load_template(MLA_PLUGIN_PATH . 'tpls/admin-display-single-document.tpl');
         $width = '';
         $height = '';
         $image_meta = '';
     }
     if (array($page_template_array)) {
         $page_template = $page_template_array['page'];
         $authors_template = $page_template_array['authors'];
         $postbox_template = $page_template_array['postbox'];
     } else {
         error_log("ERROR: MLA::_display_single_item \$page_template_array = " . var_export($page_template_array, true), 0);
         $page_template = $page_template_array;
         $authors_template = '';
         $postbox_template = '';
     }
     if (empty($post_data['mla_references']['parent_title'])) {
         $parent_info = $post_data['mla_references']['parent_errors'];
     } else {
         $parent_info = sprintf('(%1$s) %2$s %3$s', $post_data['mla_references']['parent_type'], $post_data['mla_references']['parent_title'], $post_data['mla_references']['parent_errors']);
     }
     if ($authors = self::_authors_dropdown($post_data['post_author'], 'attachments[' . $post_data['ID'] . '][post_author]')) {
         $args = array('ID' => $post_data['ID'], 'authors' => $authors);
         $authors = MLAData::mla_parse_template($authors_template, $args);
     } else {
         $authors = '';
     }
     if (MLAOptions::$process_featured_in) {
         $features = '';
         foreach ($post_data['mla_references']['features'] as $feature_id => $feature) {
             if ($feature_id == $post_data['post_parent']) {
                 $parent = 'PARENT ';
             } else {
                 $parent = '';
             }
             $features .= sprintf('%1$s (%2$s %3$s), %4$s', $parent, $feature->post_type, $feature_id, $feature->post_title) . "\r\n";
         }
         // foreach $feature
     } else {
         $features = 'disabled';
     }
     if (MLAOptions::$process_inserted_in) {
         $inserts = '';
         foreach ($post_data['mla_references']['inserts'] as $file => $insert_array) {
             $inserts .= $file . "\r\n";
             foreach ($insert_array as $insert) {
                 if ($insert->ID == $post_data['post_parent']) {
                     $parent = '  PARENT ';
                 } else {
                     $parent = '  ';
                 }
                 $inserts .= sprintf('%1$s (%2$s %3$s), %4$s', $parent, $insert->post_type, $insert->ID, $insert->post_title) . "\r\n";
             }
             // foreach $insert
         }
         // foreach $file
     } else {
         $inserts = 'disabled';
     }
     if (MLAOptions::$process_gallery_in) {
         $galleries = '';
         foreach ($post_data['mla_references']['galleries'] as $gallery_id => $gallery) {
             if ($gallery_id == $post_data['post_parent']) {
                 $parent = 'PARENT ';
             } else {
                 $parent = '';
             }
             $galleries .= sprintf('%1$s (%2$s %3$s), %4$s', $parent, $gallery['post_type'], $gallery_id, $gallery['post_title']) . "\r\n";
         }
         // foreach $gallery
     } else {
         $galleries = 'disabled';
     }
     if (MLAOptions::$process_mla_gallery_in) {
         $mla_galleries = '';
         foreach ($post_data['mla_references']['mla_galleries'] as $gallery_id => $gallery) {
             if ($gallery_id == $post_data['post_parent']) {
                 $parent = 'PARENT ';
             } else {
                 $parent = '';
             }
             $mla_galleries .= sprintf('%1$s (%2$s %3$s), %4$s', $parent, $gallery['post_type'], $gallery_id, $gallery['post_title']) . "\r\n";
         }
         // foreach $gallery
     } else {
         $mla_galleries = 'disabled';
     }
     /*
      * WordPress doesn't look in hidden fields to set the month filter dropdown or sorting parameters
      */
     if (isset($_REQUEST['m'])) {
         $url_args = '&m=' . $_REQUEST['m'];
     } else {
         $url_args = '';
     }
     if (isset($_REQUEST['post_mime_type'])) {
         $url_args .= '&post_mime_type=' . $_REQUEST['post_mime_type'];
     }
     if (isset($_REQUEST['order'])) {
         $url_args .= '&order=' . $_REQUEST['order'];
     }
     if (isset($_REQUEST['orderby'])) {
         $url_args .= '&orderby=' . $_REQUEST['orderby'];
     }
     /*
      * Add the current view arguments
      */
     if (isset($_REQUEST['detached'])) {
         $view_args = '<input type="hidden" name="detached" value="' . $_REQUEST['detached'] . "\" />\r\n";
     } elseif (isset($_REQUEST['status'])) {
         $view_args = '<input type="hidden" name="status" value="' . $_REQUEST['status'] . "\" />\r\n";
     } else {
         $view_args = '';
     }
     if (isset($_REQUEST['paged'])) {
         $view_args .= sprintf('<input type="hidden" name="paged" value="%1$s" />', $_REQUEST['paged']) . "\r\n";
     }
     $side_info_column = '';
     $taxonomies = get_object_taxonomies('attachment', 'objects');
     foreach ($taxonomies as $tax_name => $tax_object) {
         ob_start();
         if ($tax_object->hierarchical && $tax_object->show_ui) {
             $box = array('id' => $tax_name . 'div', 'title' => esc_html($tax_object->labels->name), 'callback' => 'categories_meta_box', 'args' => array('taxonomy' => $tax_name), 'inside_html' => '');
             post_categories_meta_box($post, $box);
         } elseif ($tax_object->show_ui) {
             $box = array('id' => 'tagsdiv-' . $tax_name, 'title' => esc_html($tax_object->labels->name), 'callback' => 'post_tags_meta_box', 'args' => array('taxonomy' => $tax_name), 'inside_html' => '');
             post_tags_meta_box($post, $box);
         }
         $box['inside_html'] = ob_get_contents();
         ob_end_clean();
         $side_info_column .= MLAData::mla_parse_template($postbox_template, $box);
     }
     $page_values = array('ID' => $post_data['ID'], 'post_mime_type' => $post_data['post_mime_type'], 'menu_order' => $post_data['menu_order'], 'post_date' => $post_data['post_date'], 'post_modified' => $post_data['post_modified'], 'post_parent' => $post_data['post_parent'], 'menu_order' => $post_data['menu_order'], 'attachment_icon' => wp_get_attachment_image($post_id, array(160, 120), true), 'file_name' => esc_html($post_data['mla_references']['file']), 'width' => $width, 'height' => $height, 'post_title_attr' => esc_attr($post_data['post_title']), 'post_name_attr' => esc_attr($post_data['post_name']), 'image_alt_attr' => '', 'post_excerpt_attr' => esc_attr($post_data['post_excerpt']), 'post_content' => esc_textarea($post_data['post_content']), 'image_meta' => esc_textarea($image_meta), 'parent_info' => esc_attr($parent_info), 'guid_attr' => esc_attr($post_data['guid']), 'authors' => $authors, 'features' => esc_textarea($features), 'inserts' => esc_textarea($inserts), 'galleries' => esc_textarea($galleries), 'mla_galleries' => esc_textarea($mla_galleries), 'mla_admin_action' => self::MLA_ADMIN_SINGLE_EDIT_UPDATE, 'form_url' => admin_url('upload.php') . '?page=' . self::ADMIN_PAGE_SLUG . $url_args, 'view_args' => $view_args, 'wpnonce' => wp_nonce_field(self::MLA_ADMIN_NONCE, '_wpnonce', true, false), 'side_info_column' => $side_info_column);
     if (!empty($post_data['mla_wp_attachment_image_alt'])) {
         $page_values['image_alt_attr'] = esc_attr($post_data['mla_wp_attachment_image_alt']);
     }
     return array('message' => '', 'body' => MLAData::mla_parse_template($page_template, $page_values));
 }
Beispiel #3
0
    /**
     * Renderss the meta box
     *
     * @param unknown_type $post
     * @param unknown_type $box
     */
    public function render_relation_tags_meta_box($post, $box)
    {
        post_tags_meta_box($post, $box);
        ?>
    <p><strong><a id="how-to-use-relation-tags-title" href="#"><?php 
        _e('How to use relation tags?', 'g1_theme');
        ?>
</a></strong></p>
    <div id="how-to-use-relation-tags-content">
        <div style="padding: 9px 0;">
            <p>
                <?php 
        echo '<p>' . __('The relation tags are not displayed anywhere - use them to relate different content (posts, pages, etc.), so that you can benefit from special shortcodes ([related_posts], [related_pages], etc.) or widgets .', 'g1_theme') . '</p>' . '<p>' . __('It is strongly advised to prepend every relation tag with the <strong>r-</strong> prefix, to clearly differentiate these tags, thus keep their slugs unique.', 'g1_theme') . '</p>' . '<p><strong>' . __('Here is a sample usage:', 'g1_theme') . '</strong></p>' . '<ol>' . '<li>' . __('Assign the r-home tag to your home page.', 'g1_theme') . '</li>' . '<li>' . __('Assign the r-home tag to some blog posts.', 'g1_theme') . '</li>' . '<li>' . __('Insert the [related_posts] shortcode into the content editor, when editing the home page.', 'g1_theme') . '</li>' . '<li>' . __('Save changes and all related posts will be on your home page.', 'g1_theme') . '</li>' . '</ol>' . '<p>' . __('The relation tags are built using custom taxonomy functionality, so they are separated from the standard WordPress tags.', 'g1_theme') . '</p>';
        ?>
            </p>
        </div>
    </div>
    <?php 
    }
Beispiel #4
0
 function bfox_post_tags_meta_box($post, $box)
 {
     function bfox_wp_get_object_terms($terms)
     {
         $hidden_ref = new BfoxRef($_REQUEST['bfox_ref']);
         if ($hidden_ref->is_valid()) {
             $term = new stdClass();
             $term->name = $hidden_ref->get_string();
             $terms = array($term);
         }
         return $terms;
     }
     // We need our filter on wp_get_object_terms to get called, but it won't be if post->ID is 0, so we set it to -1
     add_action('wp_get_object_terms', 'bfox_wp_get_object_terms');
     post_tags_meta_box($post, $box);
     remove_action('wp_get_object_terms', 'bfox_wp_get_object_terms');
 }