Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 5a99e42

Browse files
committed
Merge pull request #173 from appirio-tech/sup-1498-onboarding
added plugin for communtiy
2 parents 4bd8373 + 03bc68c commit 5a99e42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3406
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold}
3+
4+
#order-terms {}
5+
#order-terms img {vertical-align: middle}
6+
#order-terms #tto_sortable { list-style-type: none; margin: 20px 0 0; padding: 0; width: 100%; }
7+
#order-terms ul {list-style: none;}
8+
#order-terms ul.children {margin-left: 25px}
9+
.term_type_li .item {background-color: #f9f9f9;
10+
border: 1px solid #dddddd;
11+
cursor: move;
12+
margin: 4px 0;
13+
padding: 2px 0;}
14+
.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;}
15+
.term_type_li .item span.edit {position: absolute; right: 10px; top: 6px; padding: 0px; margin: 0px}
16+
#order-terms .placeholder{border: dashed 2px #ccc;height:30px; background-color: #FFF;}
17+
.term_type_li ul {margin-top: 6px}
18+
#dragHelper li, #dragHelper ul {background: transparent !important;}
19+
#dragHelper ul {list-style: none;}
20+
21+
.wp-list-taxonomy {width: 100%}
22+
.wp-list-taxonomy thead tr th{padding: 10px 0;}
23+
.wp-list-taxonomy tr {background-color: #FCFCFC;}
24+
.wp-list-taxonomy tbody th.check-column { padding: 9px 0 22px;}
25+
.wp-list-taxonomy td { color: #555555;}
26+
.wp-list-taxonomy td, .wp-list-taxonomy th { border-bottom-color: #DFDFDF; border-top-color: #FFFFFF;}
27+
.wp-list-taxonomy th, .wp-list-taxonomy td { overflow: hidden;}
28+
.wp-list-taxonomy td { padding: 9px 7px 4px 7px; vertical-align: top;}
29+
.wp-list-taxonomy td, .wp-list-taxonomy th { border-style: solid; border-width: 1px 0;}
30+
.wp-list-taxonomy * { word-wrap: break-word;}
31+
32+
#cpt_info_box {padding: 0 10px; border: 1px dashed #6aadcc; background-color: #FFF; margin-top: 10px;
33+
-webkit-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);
34+
-moz-box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);
35+
box-shadow: 1px 1px 7px rgba(50, 50, 50, 0.17);}
36+
#cpt_info_box p {font-size: 12px}
37+
#cpt_info_box a {text-decoration: none}
38+
#cpt_info_box #donate_form {float: right; padding: 10px 0 17px; text-align: center; width: 100%;}
39+
#p_right {float: right; width: 210px; background-color:#f5f5f5; border-left: 1px dashed #dedede; border-right: 1px dashed #dedede}
40+
.p_s_item {float: right; padding: 0px 5px; margin-top: 15px; margin-bottom: 5px; }
41+
.p_s_item.s_gp {padding-top: 2px; margin-left: 5px}
42+
43+
#icon-settings {background-image:url("../images/admin-icon-settings.gif");background-repeat:no-repeat;}
44+
.menu_tto {margin-right: 4px; display: inline; vertical-align: middle; margin-top: -1px;}
45+
46+
.clear {clear: both}
47+
48+
1.99 KB
Loading
3.75 KB
Loading
723 Bytes
Loading
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
/**
4+
* @desc
5+
*
6+
* Return UserLevel
7+
*
8+
*/
9+
function tto_userdata_get_user_level($return_as_numeric = FALSE)
10+
{
11+
global $userdata;
12+
13+
$user_level = '';
14+
for ($i=10; $i >= 0;$i--)
15+
{
16+
if (current_user_can('level_' . $i) === TRUE)
17+
{
18+
$user_level = $i;
19+
if ($return_as_numeric === FALSE)
20+
$user_level = 'level_'.$i;
21+
break;
22+
}
23+
}
24+
return ($user_level);
25+
}
26+
27+
function tto_info_box()
28+
{
29+
?>
30+
<div id="cpt_info_box">
31+
<div id="p_right">
32+
33+
<div id="p_socialize">
34+
<div class="p_s_item s_gp">
35+
<!-- Place this tag in your head or just before your close body tag -->
36+
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
37+
38+
<!-- Place this tag where you want the +1 button to render -->
39+
<div class="g-plusone" data-size="small" data-annotation="none" data-href="http://nsp-code.com/"></div>
40+
</div>
41+
<div class="p_s_item s_t">
42+
<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>
43+
</div>
44+
45+
<div class="p_s_item s_f">
46+
<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>
47+
</div>
48+
49+
<div class="clear"></div>
50+
</div>
51+
52+
<div id="donate_form">
53+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
54+
<input type="hidden" name="cmd" value="_s-xclick">
55+
<input type="hidden" name="hosted_button_id" value="CU22TFDKJMLAE">
56+
<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!">
57+
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
58+
</form>
59+
</div>
60+
</div>
61+
62+
<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>
63+
<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>
64+
<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>
65+
<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>
66+
67+
<div class="clear"></div>
68+
</div>
69+
70+
<?php
71+
}
72+
73+
?>
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
<?php
2+
3+
4+
function TOPluginInterface()
5+
{
6+
global $wpdb, $wp_locale;
7+
8+
$taxonomy = isset($_GET['taxonomy']) ? sanitize_key($_GET['taxonomy']) : '';
9+
$post_type = isset($_GET['post_type']) ? sanitize_key($_GET['post_type']) : '';
10+
if(empty($post_type))
11+
{
12+
$screen = get_current_screen();
13+
14+
if(isset($screen->post_type) && !empty($screen->post_type))
15+
$post_type = $screen->post_type;
16+
else
17+
{
18+
switch($screen->parent_file)
19+
{
20+
case "upload.php" :
21+
$post_type = 'attachment';
22+
break;
23+
24+
default:
25+
$post_type = 'post';
26+
}
27+
}
28+
}
29+
30+
$post_type_data = get_post_type_object($post_type);
31+
32+
if (!taxonomy_exists($taxonomy))
33+
$taxonomy = '';
34+
35+
?>
36+
<div class="wrap">
37+
<div class="icon32" id="icon-edit"><br></div>
38+
<h2><?php _e( "Taxonomy Order", 'tto' ) ?></h2>
39+
40+
<?php tto_info_box() ?>
41+
42+
<div id="ajax-response"></div>
43+
44+
<noscript>
45+
<div class="error message">
46+
<p><?php _e( "This plugin can't work without javascript, because it's use drag and drop and AJAX.", 'tto' ) ?></p>
47+
</div>
48+
</noscript>
49+
50+
<div class="clear"></div>
51+
52+
<?php
53+
54+
$current_section_parent_file = '';
55+
switch($post_type)
56+
{
57+
58+
case "attachment" :
59+
$current_section_parent_file = "upload.php";
60+
break;
61+
62+
default :
63+
$current_section_parent_file = "edit.php";
64+
break;
65+
}
66+
67+
68+
?>
69+
70+
<form action="<?php echo $current_section_parent_file ?>" method="get" id="to_form">
71+
<input type="hidden" name="page" value="to-interface-<?php echo esc_attr($post_type) ?>" />
72+
<?php
73+
74+
if (!in_array($post_type, array('post', 'attachment')))
75+
echo '<input type="hidden" name="post_type" value="'. esc_attr($post_type) .'" />';
76+
77+
//output all available taxonomies for this post type
78+
79+
$post_type_taxonomies = get_object_taxonomies($post_type);
80+
81+
foreach ($post_type_taxonomies as $key => $taxonomy_name)
82+
{
83+
$taxonomy_info = get_taxonomy($taxonomy_name);
84+
if ($taxonomy_info->hierarchical !== TRUE)
85+
unset($post_type_taxonomies[$key]);
86+
}
87+
88+
//use the first taxonomy if emtpy taxonomy
89+
if ($taxonomy == '' || !taxonomy_exists($taxonomy))
90+
{
91+
reset($post_type_taxonomies);
92+
$taxonomy = current($post_type_taxonomies);
93+
}
94+
95+
if (count($post_type_taxonomies) > 1)
96+
{
97+
98+
?>
99+
100+
<h2 class="subtitle"><?php echo ucfirst($post_type_data->labels->name) ?> <?php _e( "Taxonomies", 'tto' ) ?></h2>
101+
<table cellspacing="0" class="wp-list-taxonomy">
102+
<thead>
103+
<tr>
104+
<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>
105+
</thead>
106+
107+
108+
<tbody id="the-list">
109+
<?php
110+
111+
$alternate = FALSE;
112+
foreach ($post_type_taxonomies as $post_type_taxonomy)
113+
{
114+
$taxonomy_info = get_taxonomy($post_type_taxonomy);
115+
116+
$alternate = $alternate === TRUE ? FALSE :TRUE;
117+
118+
$taxonomy_terms = get_terms($key);
119+
120+
?>
121+
<tr valign="top" class="<?php if ($alternate === TRUE) {echo 'alternate ';} ?>" id="taxonomy-<?php echo esc_attr($taxonomy) ?>">
122+
<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>
123+
<td class="categories column-categories"><b><?php echo $taxonomy_info->label ?></b> (<?php echo $taxonomy_info->labels->singular_name; ?>)</td>
124+
<td class="categories column-categories"><?php echo count($taxonomy_terms) ?></td>
125+
</tr>
126+
127+
<?php
128+
}
129+
?>
130+
</tbody>
131+
</table>
132+
<br />
133+
<?php
134+
}
135+
?>
136+
137+
<div id="order-terms">
138+
139+
140+
141+
<div id="post-body">
142+
143+
<ul class="sortable" id="tto_sortable">
144+
<?php
145+
listTerms($taxonomy);
146+
?>
147+
</ul>
148+
149+
<div class="clear"></div>
150+
</div>
151+
152+
<div class="alignleft actions">
153+
<p class="submit">
154+
<a href="javascript:;" class="save-order button-primary"><?php _e( "Update", 'tto' ) ?></a>
155+
</p>
156+
</div>
157+
158+
</div>
159+
160+
</form>
161+
162+
<script type="text/javascript">
163+
jQuery(document).ready(function() {
164+
165+
var NestedSortableSerializedData;
166+
jQuery("ul.sortable").sortable({
167+
'tolerance':'intersect',
168+
'cursor':'pointer',
169+
'items':'> li',
170+
'axi': 'y',
171+
'placeholder':'placeholder',
172+
'nested': 'ul'
173+
});
174+
});
175+
176+
177+
jQuery(".save-order").bind( "click", function() {
178+
179+
var mySortable = new Array();
180+
jQuery(".sortable").each( function(){
181+
182+
var serialized = jQuery(this).sortable("serialize");
183+
184+
var parent_tag = jQuery(this).parent().get(0).tagName;
185+
parent_tag = parent_tag.toLowerCase()
186+
if (parent_tag == 'li')
187+
{
188+
//
189+
var tag_id = jQuery(this).parent().attr('id');
190+
mySortable[tag_id] = serialized;
191+
}
192+
else
193+
{
194+
//
195+
mySortable[0] = serialized;
196+
}
197+
});
198+
199+
//serialize the array
200+
var serialize_data = serialize(mySortable);
201+
202+
jQuery.post( ajaxurl, { action:'update-taxonomy-order', order: serialize_data, taxonomy : '<?php echo $taxonomy ?>' }, function() {
203+
jQuery("#ajax-response").html('<div class="message updated fade"><p><?php _e( "Items Order Updated", 'tto' ) ?></p></div>');
204+
jQuery("#ajax-response div").delay(3000).hide("slow");
205+
});
206+
});
207+
</script>
208+
209+
</div>
210+
<?php
211+
212+
213+
}
214+
215+
216+
function listTerms($taxonomy)
217+
{
218+
219+
// Query pages.
220+
$args = array(
221+
'orderby' => 'term_order',
222+
'depth' => 0,
223+
'child_of' => 0,
224+
'hide_empty' => 0
225+
);
226+
$taxonomy_terms = get_terms($taxonomy, $args);
227+
228+
$output = '';
229+
if (count($taxonomy_terms) > 0)
230+
{
231+
$output = TOwalkTree($taxonomy_terms, $args['depth'], $args);
232+
}
233+
234+
echo $output;
235+
236+
}
237+
238+
function TOwalkTree($taxonomy_terms, $depth, $r)
239+
{
240+
$walker = new TO_Terms_Walker;
241+
$args = array($taxonomy_terms, $depth, $r);
242+
return call_user_func_array(array(&$walker, 'walk'), $args);
243+
}
244+
245+
?>

0 commit comments

Comments
 (0)