コード例 #1
0
        /**
         * Method displays a list of meta attachments
         *
         */
        function _renderListAttachments()
        {
            global $post;
            //delete action prior to pulling new listings
            if (isset($_REQUEST['redrokkdelete']) && $_REQUEST['redrokkdelete']) {
                redrokk_metabox_class::deleteMetaListing($this->_category_name, $_REQUEST['redrokkdelete'], $post);
            }
            //pull new listings
            $metaListings = redrokk_metabox_class::getMetaListings($this->_category_name, $post);
            if (!empty($metaListings)) {
                ?>
		<table class="wp-list-table form-table widefat" style="border:none;">
			<tbody id="the-list">
			<?php 
                foreach ((array) $metaListings as $meta_id => $video) {
                    ?>
			<?php 
                    $video = apply_filters('redrokk_metabox_class::_renderListAttachments', $video, $meta_id);
                    ?>

			<tr id="<?php 
                    echo $this->_category_name;
                    ?>
_<?php 
                    echo $meta_id;
                    ?>
">
				<th scope="row" style="width: 140px">
					<div style="padding:10px;background:whiteSmoke;">
						<?php 
                    if (isset($video['link'])) {
                        echo apply_filters('the_content', $video['link'][0]);
                    }
                    ?>
					</div>
				</th>
				<td>
					<b><?php 
                    if (isset($video['post_title'])) {
                        echo $video['post_title'][0];
                    }
                    ?>
</b>
					<p><?php 
                    if (isset($video['post_content'])) {
                        echo $video['post_content'][0];
                    }
                    ?>
</p>

					<div class="row-actions">
						<span class="inline">
							<a href="#" id="edit_<?php 
                    echo $this->_category_name;
                    ?>
_<?php 
                    echo $meta_id;
                    ?>
">
							Edit</a> |
						</span>
						<span class="trash">
							<a class="submitdelete"
								onclick="return showNotice.warn();"
								href="<?php 
                    echo site_url("wp-admin/post.php?post={$post->ID}" . "&action=edit" . "&redrokkdelete={$meta_id}");
                    ?>
">
							Delete Permanently</a>
						</span>
					</div>
<script>
jQuery('#edit_<?php 
                    echo $this->_category_name;
                    ?>
_<?php 
                    echo $meta_id;
                    ?>
').click(function(){
	var data = {
	<?php 
                    $data = array();
                    //making sure all fields will be cleared
                    foreach ((array) $this->_fields as $field) {
                        if (!isset($field['id']) || !isset($field['type'])) {
                            continue;
                        }
                        if (!in_array($field['type'], array('text', 'file', 'image', 'textarea', 'hidden'))) {
                            continue;
                        }
                        $id = str_replace($this->_id . '_', '', $field['id']);
                        $data[$id] = "'{$id}':''";
                    }
                    //adding our values to the array
                    foreach ((array) $video as $vp => $vv) {
                        if (isset($vv[0])) {
                            $vv = $vv[0];
                        }
                        $data[$vp] = "'{$vp}':'{$vv}'";
                    }
                    //adding the meta ID to the array
                    $data[$id] = "'metaid':'{$meta_id}'";
                    echo implode(',', $data);
                    ?>
	};

	jQuery.each(data, function(key, value){
		jQuery('#<?php 
                    echo $this->_id;
                    ?>
_'+key).val( value );
	});
	return false;
});
</script>
				</td>
				<?php 
                    do_action('redrokk_metabox_class::_renderListAttachments::rows', $video, $meta_id, $this);
                    ?>
			</tr>
			<?php 
                }
                ?>
			</tbody>
		</table>
		<?php 
            }
        }
コード例 #2
0
ファイル: testimonials-widget.php プロジェクト: josh73/docker
 public function add_meta_box_testimonials_widget()
 {
     require_once 'lib/metabox.class.php';
     $fields = array(array('name' => __('Title', 'testimonials-widget'), 'id' => 'testimonials-widget-title', 'type' => 'text', 'desc' => ''), array('name' => __('Email', 'testimonials-widget'), 'id' => 'testimonials-widget-email', 'type' => 'text', 'desc' => ''), array('name' => __('Company', 'testimonials-widget'), 'id' => 'testimonials-widget-company', 'type' => 'text', 'desc' => ''), array('name' => __('URL', 'testimonials-widget'), 'id' => 'testimonials-widget-url', 'type' => 'text', 'desc' => ''));
     $fields = apply_filters('testimonials_widget_meta_box', $fields);
     $meta_box = redrokk_metabox_class::getInstance('testimonialswidget', array('title' => __('Testimonial Data', 'testimonials-widget'), 'description' => '', '_object_types' => 'testimonials-widget', 'priority' => 'high', '_fields' => $fields));
 }
コード例 #3
0
 /**
  *
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public static function add_meta_box_testimonials_widget()
 {
     $fields = array(array('name' => esc_html__('Author', 'testimonials-widget'), 'id' => 'testimonials-widget-author', 'type' => 'text', 'desc' => esc_html__('Use when the testimonial title is not the authors\' name.', 'testimonials-widget')), array('name' => esc_html__('Job Title', 'testimonials-widget'), 'id' => 'testimonials-widget-title', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('Location', 'testimonials-widget'), 'id' => 'testimonials-widget-location', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('Company', 'testimonials-widget'), 'id' => 'testimonials-widget-company', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('Email', 'testimonials-widget'), 'id' => 'testimonials-widget-email', 'type' => 'text', 'desc' => esc_html__('If an email is provided, but not an image, a Gravatar icon will be attempted to be loaded.', 'testimonials-widget')), array('name' => esc_html__('URL', 'testimonials-widget'), 'id' => 'testimonials-widget-url', 'type' => 'text', 'desc' => ''));
     $fields = apply_filters('tw_meta_box', $fields);
     $meta_box = redrokk_metabox_class::getInstance(self::ID, array('title' => esc_html__('Testimonial Data', 'testimonials-widget'), 'description' => '', '_object_types' => 'testimonials-widget', 'priority' => 'high', '_fields' => $fields));
 }
コード例 #4
0
 /**
  *
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public static function add_meta_box_testimonials_widget()
 {
     $fields = array(array('name' => esc_html__('Job Title', 'testimonials-widget'), 'id' => 'testimonials-widget-title', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('Location', 'testimonials-widget'), 'id' => 'testimonials-widget-location', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('Email', 'testimonials-widget'), 'id' => 'testimonials-widget-email', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('Company', 'testimonials-widget'), 'id' => 'testimonials-widget-company', 'type' => 'text', 'desc' => ''), array('name' => esc_html__('URL', 'testimonials-widget'), 'id' => 'testimonials-widget-url', 'type' => 'text', 'desc' => ''));
     $fields = apply_filters('testimonials_widget_meta_box', $fields);
     $meta_box = redrokk_metabox_class::getInstance(self::ID, array('title' => esc_html__('Testimonial Data', 'testimonials-widget'), 'description' => '', '_object_types' => 'testimonials-widget', 'priority' => 'high', '_fields' => $fields));
 }