Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions wp/wp-content/plugins/taxonomy-terms-order/css/to.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold}

#order-terms {}
#order-terms img {vertical-align: middle}
#order-terms #tto_sortable { list-style-type: none; margin: 20px 0 0; padding: 0; width: 100%; }
#order-terms ul {list-style: none;}
#order-terms ul.children {margin-left: 25px}
.term_type_li .item {background-color: #f9f9f9;
border: 1px solid #dddddd;
cursor: move;
margin: 4px 0;
padding: 2px 0;}
.term_type_li .item span { background: none repeat scroll 0 0 #F7F7F7; color: #555555; display: block; font-weight: bold; padding: 5px 15px; font-size: 13px;}
.term_type_li .item span.edit {position: absolute; right: 10px; top: 6px; padding: 0px; margin: 0px}
#order-terms .placeholder{border: dashed 2px #ccc;height:30px; background-color: #FFF;}
.term_type_li ul {margin-top: 6px}
#dragHelper li, #dragHelper ul {background: transparent !important;}
#dragHelper ul {list-style: none;}

.wp-list-taxonomy {width: 100%}
.wp-list-taxonomy thead tr th{padding: 10px 0;}
.wp-list-taxonomy tr {background-color: #FCFCFC;}
.wp-list-taxonomy tbody th.check-column { padding: 9px 0 22px;}
.wp-list-taxonomy td { color: #555555;}
.wp-list-taxonomy td, .wp-list-taxonomy th { border-bottom-color: #DFDFDF; border-top-color: #FFFFFF;}
.wp-list-taxonomy th, .wp-list-taxonomy td { overflow: hidden;}
.wp-list-taxonomy td { padding: 9px 7px 4px 7px; vertical-align: top;}
.wp-list-taxonomy td, .wp-list-taxonomy th { border-style: solid; border-width: 1px 0;}
.wp-list-taxonomy * { word-wrap: break-word;}

#cpt_info_box {padding: 0 10px; border: 1px dashed #6aadcc; background-color: #FFF; margin-top: 10px;
-webkit-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);
-moz-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);
box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);}
#cpt_info_box p {font-size: 12px}
#cpt_info_box a {text-decoration: none}
#cpt_info_box #donate_form {float: right; padding: 10px 0 17px; text-align: center; width: 100%;}
#p_right {float: right; width: 210px; background-color:#f5f5f5; border-left: 1px dashed #dedede; border-right: 1px dashed #dedede}
.p_s_item {float: right; padding: 0px 5px; margin-top: 15px; margin-bottom: 5px; }
.p_s_item.s_gp {padding-top: 2px; margin-left: 5px}

#icon-settings {background-image:url("../images/admin-icon-settings.gif");background-repeat:no-repeat;}
.menu_tto {margin-right: 4px; display: inline; vertical-align: middle; margin-top: -1px;}

.clear {clear: both}


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions wp/wp-content/plugins/taxonomy-terms-order/include/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

/**
* @desc
*
* Return UserLevel
*
*/
function tto_userdata_get_user_level($return_as_numeric = FALSE)
{
global $userdata;

$user_level = '';
for ($i=10; $i >= 0;$i--)
{
if (current_user_can('level_' . $i) === TRUE)
{
$user_level = $i;
if ($return_as_numeric === FALSE)
$user_level = 'level_'.$i;
break;
}
}
return ($user_level);
}

function tto_info_box()
{
?>
<div id="cpt_info_box">
<div id="p_right">

<div id="p_socialize">
<div class="p_s_item s_gp">
<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>

<!-- Place this tag where you want the +1 button to render -->
<div class="g-plusone" data-size="small" data-annotation="none" data-href="http://nsp-code.com/"></div>
</div>
<div class="p_s_item s_t">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.nsp-code.com" data-text="Define custom order for your post types through an easy to use javascript AJAX drag and drop interface. No theme code updates are necessarily, this plugin will take care of query update." data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
</div>

<div class="p_s_item s_f">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nsp-code.com%2F&amp;send=false&amp;layout=button_count&amp;width=82&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:82px; height:21px;" allowTransparency="true"></iframe>
</div>

<div class="clear"></div>
</div>

<div id="donate_form">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="CU22TFDKJMLAE">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</div>

<p><?php _e( "Did you find this plugin useful? Please support our work with a donation or write an article about this plugin in your blog with a link to our site", 'tto' ) ?> <br /><strong>http://www.nsp-code.com/</strong>.</p>
<h4><?php _e( "Did you know there is available an advanced version of this plug-in?", 'tto' ) ?> <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-taxonomy-terms-order/"><?php _e( "Read more", 'tto' ) ?></a></h4>
<p><?php _e('Check our', 'tto') ?> <a target="_blank" href="https://wordpress.org/plugins/post-terms-order/">Post Terms Order</a> <?php _e('plugin which allow to custom sort categories and custom taxonomies terms per post basis', 'tto') ?> </p>
<p><?php _e( "Check our", 'tto' ) ?> <a target="_blank" href="https://wordpress.org/plugins/post-types-order/">Post Types Order</a> <?php _e( "plugin which allow to custom sort all posts, pages, custom post types", 'tto' ) ?> </p>

<div class="clear"></div>
</div>

<?php
}

?>
245 changes: 245 additions & 0 deletions wp/wp-content/plugins/taxonomy-terms-order/include/interface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
<?php


function TOPluginInterface()
{
global $wpdb, $wp_locale;

$taxonomy = isset($_GET['taxonomy']) ? sanitize_key($_GET['taxonomy']) : '';
$post_type = isset($_GET['post_type']) ? sanitize_key($_GET['post_type']) : '';
if(empty($post_type))
{
$screen = get_current_screen();

if(isset($screen->post_type) && !empty($screen->post_type))
$post_type = $screen->post_type;
else
{
switch($screen->parent_file)
{
case "upload.php" :
$post_type = 'attachment';
break;

default:
$post_type = 'post';
}
}
}

$post_type_data = get_post_type_object($post_type);

if (!taxonomy_exists($taxonomy))
$taxonomy = '';

?>
<div class="wrap">
<div class="icon32" id="icon-edit"><br></div>
<h2><?php _e( "Taxonomy Order", 'tto' ) ?></h2>

<?php tto_info_box() ?>

<div id="ajax-response"></div>

<noscript>
<div class="error message">
<p><?php _e( "This plugin can't work without javascript, because it's use drag and drop and AJAX.", 'tto' ) ?></p>
</div>
</noscript>

<div class="clear"></div>

<?php

$current_section_parent_file = '';
switch($post_type)
{

case "attachment" :
$current_section_parent_file = "upload.php";
break;

default :
$current_section_parent_file = "edit.php";
break;
}


?>

<form action="<?php echo $current_section_parent_file ?>" method="get" id="to_form">
<input type="hidden" name="page" value="to-interface-<?php echo esc_attr($post_type) ?>" />
<?php

if (!in_array($post_type, array('post', 'attachment')))
echo '<input type="hidden" name="post_type" value="'. esc_attr($post_type) .'" />';

//output all available taxonomies for this post type

$post_type_taxonomies = get_object_taxonomies($post_type);

foreach ($post_type_taxonomies as $key => $taxonomy_name)
{
$taxonomy_info = get_taxonomy($taxonomy_name);
if ($taxonomy_info->hierarchical !== TRUE)
unset($post_type_taxonomies[$key]);
}

//use the first taxonomy if emtpy taxonomy
if ($taxonomy == '' || !taxonomy_exists($taxonomy))
{
reset($post_type_taxonomies);
$taxonomy = current($post_type_taxonomies);
}

if (count($post_type_taxonomies) > 1)
{

?>

<h2 class="subtitle"><?php echo ucfirst($post_type_data->labels->name) ?> <?php _e( "Taxonomies", 'tto' ) ?></h2>
<table cellspacing="0" class="wp-list-taxonomy">
<thead>
<tr>
<th style="" class="column-cb check-column" id="cb" scope="col">&nbsp;</th><th style="" class="" id="author" scope="col"><?php _e( "Taxonomy Title", 'tto' ) ?></th><th style="" class="manage-column" id="categories" scope="col"><?php _e( "Total Posts", 'tto' ) ?></th> </tr>
</thead>


<tbody id="the-list">
<?php

$alternate = FALSE;
foreach ($post_type_taxonomies as $post_type_taxonomy)
{
$taxonomy_info = get_taxonomy($post_type_taxonomy);

$alternate = $alternate === TRUE ? FALSE :TRUE;

$taxonomy_terms = get_terms($key);

?>
<tr valign="top" class="<?php if ($alternate === TRUE) {echo 'alternate ';} ?>" id="taxonomy-<?php echo esc_attr($taxonomy) ?>">
<th class="check-column" scope="row"><input type="radio" onclick="to_change_taxonomy(this)" value="<?php echo $post_type_taxonomy ?>" <?php if ($post_type_taxonomy == $taxonomy) {echo 'checked="checked"';} ?> name="taxonomy">&nbsp;</th>
<td class="categories column-categories"><b><?php echo $taxonomy_info->label ?></b> (<?php echo $taxonomy_info->labels->singular_name; ?>)</td>
<td class="categories column-categories"><?php echo count($taxonomy_terms) ?></td>
</tr>

<?php
}
?>
</tbody>
</table>
<br />
<?php
}
?>

<div id="order-terms">



<div id="post-body">

<ul class="sortable" id="tto_sortable">
<?php
listTerms($taxonomy);
?>
</ul>

<div class="clear"></div>
</div>

<div class="alignleft actions">
<p class="submit">
<a href="javascript:;" class="save-order button-primary"><?php _e( "Update", 'tto' ) ?></a>
</p>
</div>

</div>

</form>

<script type="text/javascript">
jQuery(document).ready(function() {

var NestedSortableSerializedData;
jQuery("ul.sortable").sortable({
'tolerance':'intersect',
'cursor':'pointer',
'items':'> li',
'axi': 'y',
'placeholder':'placeholder',
'nested': 'ul'
});
});


jQuery(".save-order").bind( "click", function() {

var mySortable = new Array();
jQuery(".sortable").each( function(){

var serialized = jQuery(this).sortable("serialize");

var parent_tag = jQuery(this).parent().get(0).tagName;
parent_tag = parent_tag.toLowerCase()
if (parent_tag == 'li')
{
//
var tag_id = jQuery(this).parent().attr('id');
mySortable[tag_id] = serialized;
}
else
{
//
mySortable[0] = serialized;
}
});

//serialize the array
var serialize_data = serialize(mySortable);

jQuery.post( ajaxurl, { action:'update-taxonomy-order', order: serialize_data, taxonomy : '<?php echo $taxonomy ?>' }, function() {
jQuery("#ajax-response").html('<div class="message updated fade"><p><?php _e( "Items Order Updated", 'tto' ) ?></p></div>');
jQuery("#ajax-response div").delay(3000).hide("slow");
});
});
</script>

</div>
<?php


}


function listTerms($taxonomy)
{

// Query pages.
$args = array(
'orderby' => 'term_order',
'depth' => 0,
'child_of' => 0,
'hide_empty' => 0
);
$taxonomy_terms = get_terms($taxonomy, $args);

$output = '';
if (count($taxonomy_terms) > 0)
{
$output = TOwalkTree($taxonomy_terms, $args['depth'], $args);
}

echo $output;

}

function TOwalkTree($taxonomy_terms, $depth, $r)
{
$walker = new TO_Terms_Walker;
$args = array($taxonomy_terms, $depth, $r);
return call_user_func_array(array(&$walker, 'walk'), $args);
}

?>
Loading