コード例 #1
0
ファイル: media_tags.php プロジェクト: vsalx/rattieinfo
 function register_taxonomy()
 {
     // Add new taxonomy, make it hierarchical (like categories)
     /*
     		$labels = mediatags_get_taxonomy_labels();
     		  $labels = array(
     		    'name' 				=> _x( 'Media-Tags', 			'taxonomy general name', 		MEDIA_TAGS_I18N_DOMAIN ),
     		    'singular_name' 	=> _x( 'Media-Tag', 			'taxonomy singular name', 		MEDIA_TAGS_I18N_DOMAIN ),
     		    'search_items' 		=> _x( 'Search Media-Tags', 	'taxonomy search items', 		MEDIA_TAGS_I18N_DOMAIN ),
     			'popular_items' 	=> _x( 'Popular Media-Tags', 	'taxonomy popular item', 		MEDIA_TAGS_I18N_DOMAIN),		
     		    'all_items' 		=> _x( 'All Media-Tags', 		'taxonomy all items', 			MEDIA_TAGS_I18N_DOMAIN ),
     		    'parent_item' 		=> _x( 'Parent Media-Tag', 		'taxonomy parent item', 		MEDIA_TAGS_I18N_DOMAIN ),
     		    'parent_item_colon' => _x( 'Parent Media-Tag:', 	'taxonomy parent item colon', 	MEDIA_TAGS_I18N_DOMAIN ),
     		    'edit_item' 		=> _x( 'Edit Media-Tag', 		'taxonomy edit item', 			MEDIA_TAGS_I18N_DOMAIN ), 
     		    'update_item' 		=> _x( 'Update Media-Tag', 		'taxonomy update item', 		MEDIA_TAGS_I18N_DOMAIN ),
     		    'add_new_item' 		=> _x( 'Add New Media-Tag', 	'taxonomy add new item', 		MEDIA_TAGS_I18N_DOMAIN ),
     		    'new_item_name' 	=> _x( 'New Media-Tag Name', 	'taxonomy new item name', 		MEDIA_TAGS_I18N_DOMAIN ),
     		  );
     */
     $labels = mediatags_get_taxonomy_labels();
     register_taxonomy(MEDIA_TAGS_TAXONOMY, MEDIA_TAGS_TAXONOMY, array('hierarchical' => false, 'labels' => $labels, 'show_ui' => false, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'query_var' => true, 'rewrite' => array('slug' => MEDIA_TAGS_URL, 'with_front' => true), 'capabilities' => $this->default_caps));
 }
コード例 #2
0
function mediatags_settings_panel()
{
    $update_message = "";
    if (isset($_REQUEST['mediatags_settings_panel']) && wp_verify_nonce($_REQUEST['mediatags_settings_panel'], 'mediatags_settings_panel')) {
        $update_message = "";
        //echo "_REQUEST<pre>"; print_r($_REQUEST); echo "</pre>";
        if (isset($_REQUEST['mediatag_labels'])) {
            update_option('mediatags_labels', $_REQUEST['mediatag_labels']);
        }
        if (isset($_REQUEST['mediatag_admin_bulk_library'])) {
            if (strtolower($_REQUEST['mediatag_admin_bulk_library']) == strtolower("yes")) {
                $mediatag_admin_bulk_library = "yes";
            } else {
                $mediatag_admin_bulk_library = "no";
            }
            update_option('mediatag_admin_bulk_library', $mediatag_admin_bulk_library);
            $update_message = "Media-Tags Settings have been updated.";
        }
        if (isset($_REQUEST['mediatag_admin_bulk_inline'])) {
            if (strtolower($_REQUEST['mediatag_admin_bulk_inline']) == strtolower("yes")) {
                $mediatag_admin_bulk_inline = "yes";
            } else {
                $mediatag_admin_bulk_inline = "no";
            }
            update_option('mediatag_admin_bulk_inline', $mediatag_admin_bulk_inline);
            $update_message = "Media-Tags Settings have been updated.";
        }
        if (isset($_REQUEST['mediatag_template_archive'])) {
            if (strtolower($_REQUEST['mediatag_template_archive']) == strtolower("yes")) {
                $mediatag_template_archive = "yes";
            } else {
                $mediatag_template_archive = "no";
            }
            update_option('mediatag_template_archive', $mediatag_template_archive);
            $update_message = "Media-Tags Settings have been updated.";
        }
        if (isset($_REQUEST['mediatag_rss_feed'])) {
            if (strtolower($_REQUEST['mediatag_rss_feed']) == strtolower("yes")) {
                $mediatag_rss_feed = "yes";
            } else {
                $mediatag_rss_feed = "no";
            }
            update_option('mediatag_rss_feed', $mediatag_rss_feed);
            $update_message = _x("Media-Tags Settings have been updated.", 'update message', MEDIA_TAGS_I18N_DOMAIN);
        }
    }
    $title = _x('Media-Tags Settings', 'settings panel title', MEDIA_TAGS_I18N_DOMAIN);
    ?>
	<form class="mediatags_settings_panel" method="get" action="#">
		<input type="hidden" name="page" value="mediatags_settings_panel" />	
		<?php 
    wp_nonce_field('mediatags_settings_panel', 'mediatags_settings_panel');
    ?>
	<div class="wrap nosubsub">
		<?php 
    //screen_icon();
    ?>
		<h2><?php 
    echo $title;
    ?>
</h2>
		<?php 
    if (strlen($update_message)) {
        ?>
<div id="message" class="updated fade"><p><?php 
        echo $update_message;
        ?>
</p></div><?php 
    }
    ?>
		
		<div id="poststuff" class="metabox-holder has-right-sidebar">
			<div class="inner-sidebar">
				<div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">
					<?php 
    mediatag_settings_sidebar();
    ?>
				</div>
			</div>
			<div class="has-sidebar sm-padded" >
				<div id="post-body-content" class="">			
					<div class="meta-box-sortabless">			


						<?php 
    $mediatag_admin_bulk_library = get_option('mediatag_admin_bulk_library', 'yes');
    if (!$mediatag_admin_bulk_library) {
        $mediatag_admin_bulk_library = "yes";
    }
    $mediatag_admin_bulk_inline = get_option('mediatag_admin_bulk_inline', 'yes');
    if (!$mediatag_admin_bulk_inline) {
        $mediatag_admin_bulk_inline = "yes";
    }
    mediatag_settings_boxheader('mediatag-settings-bulk-admin', __('Media-Tags Bulk Admin Interface', MEDIA_TAGS_I18N_DOMAIN));
    ?>

						<p><?php 
    _e("Turn On/Off the Media-Tags Bulk Admin Interfaces. There are two sections where some heavy JavaScript code is added to the page:", MEDIA_TAGS_I18N_DOMAIN);
    ?>
</p>

						<select id="mediatag_admin_bulk_library" name="mediatag_admin_bulk_library">
							<option selected="selected" value="no"><?php 
    echo _x('Off', 'select option', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
							<option <?php 
    if ($mediatag_admin_bulk_library == "yes") {
        echo ' selected="selected" ';
    }
    ?>
 
								value="yes"><?php 
    echo _e('On', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
						</select>&nbsp;
						<label for="mediatag_admin_bulk_library"><?php 
    _e('Media Library Page', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</label><br />

						<select id="mediatag_admin_bulk_inline" name="mediatag_admin_bulk_inline">
							<option selected="selected" value="no"><?php 
    echo _x('Off', 'select option', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
							<option <?php 
    if ($mediatag_admin_bulk_inline == "yes") {
        echo ' selected="selected" ';
    }
    ?>
 
									value="yes"><?php 
    echo _x('On', 'select option', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
						</select>&nbsp;
						<label for="mediatag_admin_bulk_inline"><?php 
    _e('Media Upload Popup (Gallery & Media Library Tabs)', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</label><br /><br />
						<?php 
    mediatag_settings_boxfooter(false);
    ?>



						<?php 
    $mediatag_template_archive = get_option('mediatag_template_archive', 'yes');
    if (!$mediatag_template_archive) {
        $mediatag_template_archive = "no";
    }
    ?>
						<?php 
    mediatag_settings_boxheader('mediatag-settings-template-archive', __('Media-Tags Archive Template display', MEDIA_TAGS_I18N_DOMAIN));
    ?>
						<p><?php 
    _e("When viewing an archive of Media-Tags like http://www.mysite.com/media-tags/some-tag-slug, the default output will be the list of attachments matching the media-tag. If the attachment is an image it will be displayed in the post item body. Using the select option below you can prevent this default action.", MEDIA_TAGS_I18N_DOMAIN);
    ?>
</p>
					
						<p><?php 
    _e("To understand the theme template files used by the Media-Tags plugin visit the help section.", MEDIA_TAGS_I18N_DOMAIN);
    ?>
</p>					
						<select id="mediatag_template_archive" name="mediatag_template_archive">
							<option selected="selected" value="no"><?php 
    echo _x('No', 'select option', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
							<option <?php 
    if ($mediatag_template_archive == "yes") {
        echo ' selected="selected" ';
    }
    ?>
 
								value="yes"><?php 
    echo _e('Yes', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
						</select>&nbsp;
						<label for="mediatag_template_archive"><?php 
    _e('Use the default Archive Template display?', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</label><br />
						
						<?php 
    mediatag_settings_boxfooter(false);
    ?>





						<?php 
    mediatag_settings_boxheader('mediatag-options-rssfeed', __('RSS Feed for Media-Tags', MEDIA_TAGS_I18N_DOMAIN));
    $mediatag_rss_feed = get_option('mediatag_rss_feed', 'yes');
    if (!$mediatag_rss_feed) {
        $mediatag_rss_feed = "yes";
    }
    ?>

						<p><?php 
    _e("The Media-Tags plugin now supports RSS feed when viewing an archive. For example when viewing the URL http://www.mysite.com/media-tags/some-tag/ you can now access the RSS listing by adding '/feed' to the end of the URL as in http://www.mysite.com/media-tags/some-tag/feed/", MEDIA_TAGS_I18N_DOMAIN);
    ?>
</p>
						<p><?php 
    _e("You can customize the RSS output by adding your own Media-Tags RSS template to your theme. Check the topic under the help section.", MEDIA_TAGS_I18N_DOMAIN);
    ?>
</p>

						<select id="mediatag_rss_feed" name="mediatag_rss_feed">
							<option selected="selected" value="yes"><?php 
    echo _x('On', 'select option', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
							<option <?php 
    if ($mediatag_rss_feed == "no") {
        echo ' selected="selected" ';
    }
    ?>
 value="no"><?php 
    echo _x('Off', 'select option', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</option>
						</select>
						<label for="mediatag_rss_feed"><?php 
    _e('Turn the Media-Tag RSS Feed option On/Off', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</label>
						<?php 
    mediatag_settings_boxfooter(false);
    ?>


						<?php 
    $mediatag_labels = mediatags_get_taxonomy_labels();
    $mediatag_labels_legend = array('name' => ' Used to control the label used on the HTML Title for Archives.');
    ?>
						<?php 
    mediatag_settings_boxheader('mediatag-settings-labels', __('Media-Tags Labels', MEDIA_TAGS_I18N_DOMAIN));
    ?>
						<p><?php 
    _e('This settings section lets you override some of the labels used. Most of these labels are used on the <a href="edit-tags.php?taxonomy=media-tags">Media-Tags</a> management page.', MEDIA_TAGS_I18N_DOMAIN);
    ?>
</p>

						<?php 
    foreach ($mediatag_labels as $label_key => $label_val) {
        $label_display = ucwords(strtolower(str_replace('_', ' ', $label_key)));
        ?>
								<label for="mediatag_label_<?php 
        echo $label_key;
        ?>
"><?php 
        echo $label_display;
        if (isset($mediatag_labels_legend[$label_key])) {
            echo ': ' . $mediatag_labels_legend[$label_key];
        }
        ?>
</label><br />
								<input id="mediatag_label_<?php 
        echo $label_key;
        ?>
" 
									name="mediatag_labels[<?php 
        echo $label_key;
        ?>
]" value="<?php 
        echo $label_val;
        ?>
" /><br /><br />
								<?php 
    }
    ?>
						<p><?php 
    _e('Please refer to the WordPress Codex page for <a target="_blank" href="http://codex.wordpress.org/Function_Reference/register_taxonomy">register_taxonomy</a> for full descriptions f the labels and how they are used.');
    ?>
</p>
						<?php 
    mediatag_settings_boxfooter(false);
    ?>



					</div>
				</div>
			</div>
		</div>
		<p class="submit">
		<input type="submit" name="Submit" value="<?php 
    _e('Update Options', MEDIA_TAGS_I18N_DOMAIN);
    ?>
" />
		</p>
	</form>
	</div>
	<?php 
}