Version Description
- Update some old crufty code
- Remove mass editor
Download this release
Release Info
Developer | johnny5 |
Plugin | HeadSpace2 SEO |
Version | 3.6.39 |
Comparing to | |
See all releases |
Code changes from version 3.6.38 to 3.6.39
- ajax.php +5 -2
- headspace.php +24 -96
- headspace_library.php +1 -2
- js/headspace.js +1 -2
- models/headspace.php +0 -1
- models/importer.php +0 -1
- models/inline_tags.php +0 -1
- models/mass_edit.php +0 -57
- models/pager.php +0 -439
- models/term_pager.php +0 -77
- modules/mass/description.php +0 -114
- modules/mass/keywords.php +0 -114
- modules/mass/more_text.php +0 -111
- modules/mass/page_slug.php +0 -93
- modules/mass/page_title.php +0 -113
- modules/mass/site_description.php +0 -111
- modules/mass/site_name.php +0 -111
- modules/mass/tags.php +0 -120
- modules/page/custom.php +3 -3
- modules/page/description.php +2 -2
- modules/page/javascript.php +3 -3
- modules/page/keywords.php +1 -1
- modules/page/more_text.php +3 -3
- modules/page/page-links.php +5 -5
- modules/page/page_title.php +2 -2
- modules/page/plugin.php +3 -3
- modules/page/raw-footer.php +1 -1
- modules/page/raw.php +1 -1
- modules/page/relative-links.php +5 -5
- modules/page/rss_name.php +1 -1
- modules/page/rss_tagline.php +1 -1
- modules/page/site_name.php +2 -2
- modules/page/site_tagline.php +1 -1
- modules/page/stylesheet.php +3 -3
- modules/page/tags.php +5 -6
- modules/page/theme.php +1 -1
- modules/site/103bees.php +21 -21
- modules/site/analytics.php +38 -38
- modules/site/apture.php +21 -21
- modules/site/awstats.php +22 -23
- modules/site/crazyegg.php +23 -23
- modules/site/disable_visual_editing.php +4 -5
- modules/site/feedburner-stats.php +10 -10
- modules/site/first-time-visitor.php +18 -18
- modules/site/frame-breaker.php +4 -5
- modules/site/google-ad-wrap.php +3 -4
- modules/site/google_webmaster.php +8 -8
- modules/site/hacks.php +0 -2
- modules/site/hittail.php +20 -21
- modules/site/microsoft-live.php +10 -13
- modules/site/mint.php +22 -25
- modules/site/page_counts.php +22 -24
- modules/site/piwik.php +32 -34
- modules/site/statcounter.php +32 -33
- modules/site/system-settings.php +15 -18
- modules/site/widgets.php +20 -23
- modules/site/wp_formatting.php +13 -14
- modules/site/yahoo-site-explorer.php +10 -12
- plugin.php +0 -252
- readme.txt +5 -5
- screenshot-4.png +0 -0
- view/admin/dashboard.php +3 -3
- view/admin/edit_page.php +3 -1
- view/admin/edit_post.php +2 -2
- view/admin/head_admin.php +0 -7
- view/admin/mass_edit.php +0 -77
- view/admin/options.php +5 -5
- view/admin/page-module-edit.php +1 -1
- view/admin/page-module-item.php +4 -4
- view/admin/page-settings-item.php +5 -5
- view/admin/site-module-edit.php +4 -4
- view/admin/site-module-item.php +8 -6
- view/admin/submenu.php +5 -5
- view/admin/version.php +2 -2
ajax.php
CHANGED
@@ -21,7 +21,6 @@ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
|
21 |
*
|
22 |
* @package HeadSpace
|
23 |
* @author John Godley
|
24 |
-
* @copyright Copyright (C) John Godley
|
25 |
**/
|
26 |
class HeadspaceAjax extends HeadSpace_Plugin {
|
27 |
function HeadspaceAjax() {
|
@@ -30,6 +29,10 @@ class HeadspaceAjax extends HeadSpace_Plugin {
|
|
30 |
add_action( 'init', array( &$this, 'init' ) );
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
33 |
function init() {
|
34 |
if ( current_user_can( 'manage_options' ) ) {
|
35 |
$this->register_ajax( 'hs_settings_edit' );
|
@@ -326,7 +329,7 @@ class HeadspaceAjax extends HeadSpace_Plugin {
|
|
326 |
$post = get_post( $id );
|
327 |
|
328 |
$suggestions = $tags->get_suggestions( $post->post_content.' '.$post->post_title );
|
329 |
-
echo
|
330 |
die();
|
331 |
}
|
332 |
}
|
21 |
*
|
22 |
* @package HeadSpace
|
23 |
* @author John Godley
|
|
|
24 |
**/
|
25 |
class HeadspaceAjax extends HeadSpace_Plugin {
|
26 |
function HeadspaceAjax() {
|
29 |
add_action( 'init', array( &$this, 'init' ) );
|
30 |
}
|
31 |
|
32 |
+
function base_url() {
|
33 |
+
return __FILE__;
|
34 |
+
}
|
35 |
+
|
36 |
function init() {
|
37 |
if ( current_user_can( 'manage_options' ) ) {
|
38 |
$this->register_ajax( 'hs_settings_edit' );
|
329 |
$post = get_post( $id );
|
330 |
|
331 |
$suggestions = $tags->get_suggestions( $post->post_content.' '.$post->post_title );
|
332 |
+
echo esc_html( implode( ', ', $suggestions ) );
|
333 |
die();
|
334 |
}
|
335 |
}
|
headspace.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: HeadSpace2
|
4 |
Plugin URI: http://urbangiraffe.com/plugins/headspace2/
|
5 |
Description: Meta-data manager on steroids, allowing complete control over all SEO needs such as keywords/tags, titles, description, stylesheets, and many many other goodies.
|
6 |
-
Version: 3.6.
|
7 |
Author: John Godley
|
8 |
Author URI: http://urbangiraffe.com/
|
9 |
============================================================================================================
|
@@ -43,7 +43,7 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
43 |
|
44 |
if (is_admin ()) {
|
45 |
$this->add_action( 'admin_menu' );
|
46 |
-
$this->
|
47 |
|
48 |
$this->add_action( 'save_post', 'save_tags' );
|
49 |
|
@@ -60,10 +60,6 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
60 |
$this->add_action( 'manage_posts_custom_column', 'manage_posts_custom_column', 10, 2);
|
61 |
$this->add_action( 'manage_pages_custom_column', 'manage_posts_custom_column', 10, 2);
|
62 |
|
63 |
-
$this->add_action( 'wp_print_scripts' );
|
64 |
-
$this->add_action( 'admin_head', 'wp_print_styles' );
|
65 |
-
$this->add_filter( 'print_scripts_array' );
|
66 |
-
$this->add_action( 'admin_print_styles', 'wp_print_styles' );
|
67 |
$this->register_plugin_settings( __FILE__ );
|
68 |
|
69 |
// Ajax functions
|
@@ -154,8 +150,6 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
154 |
add_management_page (HEADSPACE_MENU, HEADSPACE_MENU, HEADSPACE_ROLE, basename (__FILE__), array ($this, 'admin_screen'));
|
155 |
else
|
156 |
add_options_page (HEADSPACE_MENU, HEADSPACE_MENU, HEADSPACE_ROLE, basename (__FILE__), array ($this, 'admin_screen'));
|
157 |
-
|
158 |
-
add_management_page (HEADSPACE_META, HEADSPACE_META, HEADSPACE_ROLE, basename (__FILE__), array ($this, 'admin_mass'));
|
159 |
}
|
160 |
|
161 |
|
@@ -251,24 +245,14 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
251 |
function submenu($inwrap = false) {
|
252 |
// Decide what to do
|
253 |
$sub = isset ($_GET['sub']) ? $_GET['sub'] : '';
|
254 |
-
|
255 |
-
|
256 |
|
257 |
if ($inwrap == true)
|
258 |
-
$this->render_admin( 'submenu', array ('
|
259 |
return $sub;
|
260 |
}
|
261 |
|
262 |
-
function admin_mass() {
|
263 |
-
$sub = $this->submenu ();
|
264 |
-
|
265 |
-
// Display screen
|
266 |
-
if ($sub == '')
|
267 |
-
$this->admin_mass_edit ();
|
268 |
-
else if ($sub == 'tags')
|
269 |
-
$this->admin_tags ();
|
270 |
-
}
|
271 |
-
|
272 |
|
273 |
/**
|
274 |
* Checks the current theme footer.php and header.php to ensure it contains the appropriate function calls* to allow HS to work. Hopefully this will reduce support questions regarding this
|
@@ -331,8 +315,6 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
331 |
$this->admin_import ();
|
332 |
else if ($sub == 'site')
|
333 |
$this->admin_site ();
|
334 |
-
else if ($sub == 'mass')
|
335 |
-
$this->admin_mass_edit ();
|
336 |
else if ($sub == 'modules')
|
337 |
$this->admin_modules ();
|
338 |
}
|
@@ -357,31 +339,6 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
357 |
return $options;
|
358 |
}
|
359 |
|
360 |
-
function admin_mass_edit() {
|
361 |
-
include dirname (__FILE__).'/models/pager.php';
|
362 |
-
include dirname (__FILE__).'/models/mass_edit.php';
|
363 |
-
|
364 |
-
$headspace = HeadSpace2::get ();
|
365 |
-
$types = HSM_Mass_Editor::available ();
|
366 |
-
|
367 |
-
$current = 'hs_mass_pagetitle';
|
368 |
-
if (isset ($_GET['type']) && isset ($types[$_GET['type']]))
|
369 |
-
$current = $_GET['type'];
|
370 |
-
|
371 |
-
$current = $types[$current];
|
372 |
-
|
373 |
-
if (isset ($_POST['save']) && check_admin_referer ('headspace-mass_edit')) {
|
374 |
-
$current->update (stripslashes_deep ($_POST));
|
375 |
-
$this->render_message (__ ('Posts successfully updated', 'headspace'));
|
376 |
-
}
|
377 |
-
|
378 |
-
$pager = $current->get_pager ();
|
379 |
-
$posts = $current->get ($pager);
|
380 |
-
|
381 |
-
$this->render_admin( 'mass_edit', array ('types' => $types, 'posts' => $posts, 'pager' => $pager, 'current' => $current));
|
382 |
-
}
|
383 |
-
|
384 |
-
|
385 |
/**
|
386 |
* Display the settings screen
|
387 |
*
|
@@ -456,14 +413,12 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
456 |
$this->render_admin( 'import', array ('modules' => $importmanager->available ()));
|
457 |
}
|
458 |
|
459 |
-
function
|
460 |
global $wp_scripts;
|
461 |
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
add_meta_box ('tagsdiv', __ ('Tags', 'headspace'), array (&$this, 'metabox_tags'), 'page', 'side', 'high' );
|
466 |
-
}
|
467 |
|
468 |
// Rejig the localization
|
469 |
if ($this->is_page ())
|
@@ -473,16 +428,24 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
473 |
if (isset ($wp_scripts->registered['ui-tabs']) && strpos ($_SERVER['REQUEST_URI'], 'headspace.php') !== false)
|
474 |
unset ($wp_scripts->registered['ui-tabs']);
|
475 |
|
476 |
-
if (
|
477 |
-
wp_enqueue_script( 'headspace',
|
|
|
478 |
}
|
479 |
-
else
|
480 |
-
wp_enqueue_script( 'headspace',
|
481 |
-
|
|
|
|
|
482 |
}
|
483 |
|
484 |
-
|
485 |
-
|
|
|
|
|
|
|
|
|
|
|
486 |
}
|
487 |
|
488 |
function is_category_edit() {
|
@@ -497,41 +460,6 @@ class HeadSpace2_Admin extends HeadSpace_Plugin {
|
|
497 |
return false;
|
498 |
}
|
499 |
|
500 |
-
function wp_print_styles() {
|
501 |
-
if ( ( isset ($_GET['page']) && $_GET['page'] == 'headspace.php') || $this->is_page () || $this->is_category_edit () || $this->is_post_edit () ) {
|
502 |
-
echo '<link rel="stylesheet" href="'.$this->url ().'/admin.css" type="text/css" media="screen" title="no title" charset="utf-8"/>';
|
503 |
-
|
504 |
-
if (!function_exists ('wp_enqueue_style'))
|
505 |
-
echo '<style type="text/css" media="screen">
|
506 |
-
.subsubsub {
|
507 |
-
list-style: none;
|
508 |
-
margin: 8px 0 5px;
|
509 |
-
padding: 0;
|
510 |
-
white-space: nowrap;
|
511 |
-
font-size: 11px;
|
512 |
-
float: left;
|
513 |
-
}
|
514 |
-
.subsubsub li {
|
515 |
-
display: inline;
|
516 |
-
margin: 0;
|
517 |
-
padding: 0;
|
518 |
-
}
|
519 |
-
</style>';
|
520 |
-
}
|
521 |
-
}
|
522 |
-
|
523 |
-
|
524 |
-
/**
|
525 |
-
* Insert CSS and JS into administration page
|
526 |
-
*
|
527 |
-
* @return void
|
528 |
-
**/
|
529 |
-
|
530 |
-
function admin_head() {
|
531 |
-
if (strpos ($_SERVER['REQUEST_URI'], 'post.php') !== false || strpos ($_SERVER['REQUEST_URI'], 'post-new.php') !== false || $this->is_page () || strpos ($_SERVER['REQUEST_URI'], 'headspace') || strpos ($_SERVER['REQUEST_URI'], 'categories.php'))
|
532 |
-
$this->render_admin( 'head_admin' );
|
533 |
-
}
|
534 |
-
|
535 |
function version() {
|
536 |
$plugin_data = implode ('', file (__FILE__));
|
537 |
|
3 |
Plugin Name: HeadSpace2
|
4 |
Plugin URI: http://urbangiraffe.com/plugins/headspace2/
|
5 |
Description: Meta-data manager on steroids, allowing complete control over all SEO needs such as keywords/tags, titles, description, stylesheets, and many many other goodies.
|
6 |
+
Version: 3.6.39
|
7 |
Author: John Godley
|
8 |
Author URI: http://urbangiraffe.com/
|
9 |
============================================================================================================
|
43 |
|
44 |
if (is_admin ()) {
|
45 |
$this->add_action( 'admin_menu' );
|
46 |
+
$this->add_action( 'load-settings_page_headspace', 'admin_Head' );
|
47 |
|
48 |
$this->add_action( 'save_post', 'save_tags' );
|
49 |
|
60 |
$this->add_action( 'manage_posts_custom_column', 'manage_posts_custom_column', 10, 2);
|
61 |
$this->add_action( 'manage_pages_custom_column', 'manage_posts_custom_column', 10, 2);
|
62 |
|
|
|
|
|
|
|
|
|
63 |
$this->register_plugin_settings( __FILE__ );
|
64 |
|
65 |
// Ajax functions
|
150 |
add_management_page (HEADSPACE_MENU, HEADSPACE_MENU, HEADSPACE_ROLE, basename (__FILE__), array ($this, 'admin_screen'));
|
151 |
else
|
152 |
add_options_page (HEADSPACE_MENU, HEADSPACE_MENU, HEADSPACE_ROLE, basename (__FILE__), array ($this, 'admin_screen'));
|
|
|
|
|
153 |
}
|
154 |
|
155 |
|
245 |
function submenu($inwrap = false) {
|
246 |
// Decide what to do
|
247 |
$sub = isset ($_GET['sub']) ? $_GET['sub'] : '';
|
248 |
+
if ( !in_array( $sub, array( 'modules', 'site', 'options', 'import' ) ) )
|
249 |
+
$sub = '';
|
250 |
|
251 |
if ($inwrap == true)
|
252 |
+
$this->render_admin( 'submenu', array ('sub' => $sub));
|
253 |
return $sub;
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
|
257 |
/**
|
258 |
* Checks the current theme footer.php and header.php to ensure it contains the appropriate function calls* to allow HS to work. Hopefully this will reduce support questions regarding this
|
315 |
$this->admin_import ();
|
316 |
else if ($sub == 'site')
|
317 |
$this->admin_site ();
|
|
|
|
|
318 |
else if ($sub == 'modules')
|
319 |
$this->admin_modules ();
|
320 |
}
|
339 |
return $options;
|
340 |
}
|
341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
/**
|
343 |
* Display the settings screen
|
344 |
*
|
413 |
$this->render_admin( 'import', array ('modules' => $importmanager->available ()));
|
414 |
}
|
415 |
|
416 |
+
function admin_head() {
|
417 |
global $wp_scripts;
|
418 |
|
419 |
+
add_meta_box ('headspacestuff', __ ('HeadSpace', 'headspace'), array (&$this, 'metabox'), 'post', 'normal', 'high' );
|
420 |
+
add_meta_box ('headspacestuff', __ ('HeadSpace', 'headspace'), array (&$this, 'metabox'), 'page', 'normal', 'high' );
|
421 |
+
add_meta_box ('tagsdiv', __ ('Tags', 'headspace'), array (&$this, 'metabox_tags'), 'page', 'side', 'high' );
|
|
|
|
|
422 |
|
423 |
// Rejig the localization
|
424 |
if ($this->is_page ())
|
428 |
if (isset ($wp_scripts->registered['ui-tabs']) && strpos ($_SERVER['REQUEST_URI'], 'headspace.php') !== false)
|
429 |
unset ($wp_scripts->registered['ui-tabs']);
|
430 |
|
431 |
+
if ($this->is_page () || $this->is_post_edit ()) {
|
432 |
+
wp_enqueue_script( 'headspace', plugin_dir_url( __FILE__ ).'/js/headspace.js', array ('jquery-form'), $this->version ());
|
433 |
+
wp_enqueue_script( 'headspace-tags', plugin_dir_url( __FILE__ ).'/js/headspace-tags.js', array ('headspace'), $this->version ());
|
434 |
}
|
435 |
+
else
|
436 |
+
wp_enqueue_script( 'headspace', plugin_dir_url( __FILE__ ).'/js/headspace.js' , array ('jquery-form', 'jquery-ui-sortable'), $this->version ());
|
437 |
+
|
438 |
+
if ( ( isset ($_GET['page']) && $_GET['page'] == 'headspace.php') || $this->is_page () || $this->is_category_edit () || $this->is_post_edit () ) {
|
439 |
+
wp_enqueue_style( 'headspace', plugin_dir_url( __FILE__ ).'admin.css' );
|
440 |
}
|
441 |
|
442 |
+
wp_localize_script( 'headspace', 'hs2', array(
|
443 |
+
'headspace_delete' => plugins_url( '/images/delete.png', $this->base_url() ),
|
444 |
+
) );
|
445 |
+
}
|
446 |
+
|
447 |
+
function base_url() {
|
448 |
+
return __FILE__;
|
449 |
}
|
450 |
|
451 |
function is_category_edit() {
|
460 |
return false;
|
461 |
}
|
462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
function version() {
|
464 |
$plugin_data = implode ('', file (__FILE__));
|
465 |
|
headspace_library.php
CHANGED
@@ -4,7 +4,6 @@
|
|
4 |
*
|
5 |
* @package HeadSpace
|
6 |
* @author John Godley
|
7 |
-
* @copyright Copyright (C) John Godley
|
8 |
**/
|
9 |
|
10 |
/*
|
@@ -124,7 +123,7 @@ if (!class_exists ('MetaData')) {
|
|
124 |
$meta = get_post_meta ($postid, $field);
|
125 |
|
126 |
if ($insert == true || empty ($meta) || $meta === false)
|
127 |
-
$wpdb->
|
128 |
else
|
129 |
update_post_meta ($postid, $field, $data);
|
130 |
}
|
4 |
*
|
5 |
* @package HeadSpace
|
6 |
* @author John Godley
|
|
|
7 |
**/
|
8 |
|
9 |
/*
|
123 |
$meta = get_post_meta ($postid, $field);
|
124 |
|
125 |
if ($insert == true || empty ($meta) || $meta === false)
|
126 |
+
$wpdb->insert( $wpdb->postmeta, array( 'post_id' => $postid, 'meta_key' => $field, 'meta_value' => $data ) );
|
127 |
else
|
128 |
update_post_meta ($postid, $field, $data);
|
129 |
}
|
js/headspace.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
/**
|
2 |
* @package HeadSpace
|
3 |
* @author John Godley
|
4 |
-
* @copyright Copyright (C) John Godley
|
5 |
**/
|
6 |
|
7 |
/*
|
@@ -334,7 +333,7 @@ var HeadSpace;
|
|
334 |
function add_plugin ()
|
335 |
{
|
336 |
var text = '<li>';
|
337 |
-
text += '<div class="option"><a href="#" onclick="return delete_plugin(this);"><img src="' + headspace_delete + '" alt="delete" width="16" height="16"/></a></div>';
|
338 |
text += document.getElementById('headspace_plugin').options[document.getElementById('headspace_plugin').selectedIndex].innerHTML;
|
339 |
text += '<input type=\'hidden\' name=\'headspace_plugins[]\' value=\'' + jQuery('#headspace_plugin').val() + '\'/></li>';
|
340 |
|
1 |
/**
|
2 |
* @package HeadSpace
|
3 |
* @author John Godley
|
|
|
4 |
**/
|
5 |
|
6 |
/*
|
333 |
function add_plugin ()
|
334 |
{
|
335 |
var text = '<li>';
|
336 |
+
text += '<div class="option"><a href="#" onclick="return delete_plugin(this);"><img src="' + hs2.headspace_delete + '" alt="delete" width="16" height="16"/></a></div>';
|
337 |
text += document.getElementById('headspace_plugin').options[document.getElementById('headspace_plugin').selectedIndex].innerHTML;
|
338 |
text += '<input type=\'hidden\' name=\'headspace_plugins[]\' value=\'' + jQuery('#headspace_plugin').val() + '\'/></li>';
|
339 |
|
models/headspace.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*
|
6 |
* @package HeadSpace
|
7 |
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
**/
|
10 |
|
11 |
/*
|
5 |
*
|
6 |
* @package HeadSpace
|
7 |
* @author John Godley
|
|
|
8 |
**/
|
9 |
|
10 |
/*
|
models/importer.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*
|
6 |
* @package HeadSpace
|
7 |
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
**/
|
10 |
|
11 |
/*
|
5 |
*
|
6 |
* @package HeadSpace
|
7 |
* @author John Godley
|
|
|
8 |
**/
|
9 |
|
10 |
/*
|
models/inline_tags.php
CHANGED
@@ -5,7 +5,6 @@
|
|
5 |
*
|
6 |
* @package HeadSpace
|
7 |
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
**/
|
10 |
|
11 |
/*
|
5 |
*
|
6 |
* @package HeadSpace
|
7 |
* @author John Godley
|
|
|
8 |
**/
|
9 |
|
10 |
/*
|
models/mass_edit.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* HeadSpace
|
5 |
-
*
|
6 |
-
* @package HeadSpace
|
7 |
-
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
-
**/
|
10 |
-
|
11 |
-
/*
|
12 |
-
============================================================================================================
|
13 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
14 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
15 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
16 |
-
consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
|
17 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
18 |
-
contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
|
19 |
-
this software, even if advised of the possibility of such damage.
|
20 |
-
|
21 |
-
For full license details see license.txt
|
22 |
-
============================================================================================================ */
|
23 |
-
|
24 |
-
class HSM_Mass_Edit
|
25 |
-
{
|
26 |
-
function id() { return strtolower (get_class ($this)); }
|
27 |
-
function name() { return ''; }
|
28 |
-
function get(&$pager) { return array (); }
|
29 |
-
function get_pager() { }
|
30 |
-
}
|
31 |
-
|
32 |
-
class HSM_Mass_Editor
|
33 |
-
{
|
34 |
-
function available() {
|
35 |
-
// Load all available module files
|
36 |
-
$available = get_declared_classes ();
|
37 |
-
$files = glob (dirname (__FILE__).'/../modules/mass/*.php');
|
38 |
-
if (!empty ($files)) {
|
39 |
-
foreach ($files AS $file)
|
40 |
-
include_once ($file);
|
41 |
-
}
|
42 |
-
|
43 |
-
$types = array ();
|
44 |
-
$available = array_diff (get_declared_classes (), $available);
|
45 |
-
|
46 |
-
if (count ($available) > 0) {
|
47 |
-
$options = get_option ('headspace_options');
|
48 |
-
|
49 |
-
foreach ($available AS $name) {
|
50 |
-
$name = strtolower ($name);
|
51 |
-
$types[$name] = new $name;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
return $types;
|
56 |
-
}
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/pager.php
DELETED
@@ -1,439 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// ======================================================================================
|
4 |
-
// This library is free software; you can redistribute it and/or
|
5 |
-
// modify it under the terms of the GNU Lesser General Public
|
6 |
-
// License as published by the Free Software Foundation; either
|
7 |
-
// version 2.1 of the License, or (at your option) any later version.
|
8 |
-
//
|
9 |
-
// This library is distributed in the hope that it will be useful,
|
10 |
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12 |
-
// Lesser General Public License for more details.
|
13 |
-
// ======================================================================================
|
14 |
-
// @author John Godley (http://urbangiraffe.com)
|
15 |
-
// @version 0.2.8
|
16 |
-
// @copyright Copyright © 2007 John Godley, All Rights Reserved
|
17 |
-
// ======================================================================================
|
18 |
-
// 0.2.3 - Remember pager details in user data
|
19 |
-
// 0.2.4 - Add phpdoc comments
|
20 |
-
// 0.2.5 - Allow orderby to use tags to hide database columns
|
21 |
-
// 0.2.6 - Fix sortable columns with only 1 page
|
22 |
-
// 0.2.7 - Add a GROUP BY feature, make search work when position not 0
|
23 |
-
// 0.2.8 - WP 2.7 functions
|
24 |
-
// ======================================================================================
|
25 |
-
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Provides pagination, column-based ordering, searching, and filtering
|
29 |
-
*
|
30 |
-
* The class does no database queries itself but instead relies on the user modifying their queries with data
|
31 |
-
* from the pager. For correct pagination you must set the total number of results
|
32 |
-
*
|
33 |
-
* For example,
|
34 |
-
*
|
35 |
-
* $pager->set_total ($wpdb->get_var ("SELECT COUNT(*) FROM wp_posts").$pager->to_conditions ());
|
36 |
-
* $rows = $wpdb->get_results ("SELECT * FROM wp_posts".$pager->to_limits ("post_type=page"));
|
37 |
-
*
|
38 |
-
* Searching is achieved by specifying the columns that can be searched:
|
39 |
-
*
|
40 |
-
* $rows = $wpdb->get_results ("SELECT * FROM wp_posts".$pager->to_limits ("post_type=page", array ('post_content', 'post_excerpt')));
|
41 |
-
*
|
42 |
-
* Additionally you can output column headings with correct URLs:
|
43 |
-
* <th><?php echo $pager->sortable ('post_username', 'Username') ?></th>
|
44 |
-
*
|
45 |
-
* @package default
|
46 |
-
**/
|
47 |
-
|
48 |
-
class HS_Pager
|
49 |
-
{
|
50 |
-
var $url = null;
|
51 |
-
var $current_page = 1;
|
52 |
-
var $per_page = 25;
|
53 |
-
var $total = 0;
|
54 |
-
var $order_by = null;
|
55 |
-
var $order_original = null;
|
56 |
-
var $order_direction = null;
|
57 |
-
var $order_tags = array ();
|
58 |
-
var $steps = array ();
|
59 |
-
var $search = null;
|
60 |
-
var $filters = array ();
|
61 |
-
var $id;
|
62 |
-
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Construct a pager object using the $_GET data, the current URL, and default preferences
|
66 |
-
*
|
67 |
-
* @param array $data Array of values, typically from $_GET
|
68 |
-
* @param string $url The current URL
|
69 |
-
* @param string $orderby Default database column to order data by
|
70 |
-
* @param string $direction Default direction of ordering (DESC or ASC)
|
71 |
-
* @param string $id An ID for the pager to separate it from other pagers (typically the plugin name)
|
72 |
-
* @return void
|
73 |
-
**/
|
74 |
-
function HS_Pager($data, $url, $orderby = '', $direction = 'DESC', $id = 'default', $tags = '') {
|
75 |
-
// Remove all pager params from the url
|
76 |
-
$this->id = $id;
|
77 |
-
$this->url = $url;
|
78 |
-
|
79 |
-
if (isset ($data['curpage']))
|
80 |
-
$this->current_page = intval ($data['curpage']);
|
81 |
-
|
82 |
-
if ($orderby != '')
|
83 |
-
$this->order_by = $orderby;
|
84 |
-
|
85 |
-
if (isset ($data['orderby']))
|
86 |
-
$this->order_by = $data['orderby'];
|
87 |
-
|
88 |
-
if (!empty ($tags)) {
|
89 |
-
$this->order_tags = $tags;
|
90 |
-
if (isset ($this->order_tags[$this->order_by]))
|
91 |
-
$this->order_by = $this->order_tags[$this->order_by];
|
92 |
-
}
|
93 |
-
|
94 |
-
$this->order_direction = $direction;
|
95 |
-
$this->order_original = $orderby;
|
96 |
-
if (isset ($data['order']))
|
97 |
-
$this->order_direction = $data['order'];
|
98 |
-
|
99 |
-
$this->search = isset( $data['search'] ) ? $data['search'] : '';
|
100 |
-
$this->steps = array (10, 25, 50, 100, 250);
|
101 |
-
$this->url = str_replace ('&', '&', $this->url);
|
102 |
-
$this->url = str_replace ('&&', '&', $this->url);
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Set the total number of entries that match the conditions
|
109 |
-
*
|
110 |
-
* @param int $total Count
|
111 |
-
* @return void
|
112 |
-
**/
|
113 |
-
|
114 |
-
function set_total($total) {
|
115 |
-
$this->total = $total;
|
116 |
-
|
117 |
-
if ($this->current_page <= 0 || $this->current_page > $this->total_pages ())
|
118 |
-
$this->current_page = 1;
|
119 |
-
}
|
120 |
-
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Return the current page offset
|
124 |
-
*
|
125 |
-
* @return int Current page offset
|
126 |
-
**/
|
127 |
-
|
128 |
-
function offset() {
|
129 |
-
return ($this->current_page - 1) * $this->per_page;
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
/**
|
134 |
-
* @todo explain
|
135 |
-
* @return void
|
136 |
-
**/
|
137 |
-
// XXX
|
138 |
-
|
139 |
-
function is_secondary_sort() {
|
140 |
-
return substr ($this->order_by, 0, 1) == '_' ? true : false;
|
141 |
-
}
|
142 |
-
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Returns a set of conditions without any limits. This is suitable for a COUNT SQL
|
146 |
-
*
|
147 |
-
* @param string $conditions WHERE conditions
|
148 |
-
* @param array $searches Array of columns to search on
|
149 |
-
* @param array $filters Array of columns to filter on
|
150 |
-
* @return string SQL
|
151 |
-
**/
|
152 |
-
|
153 |
-
function to_conditions($conditions, $searches = '', $filters = '') {
|
154 |
-
$sql = '';
|
155 |
-
if ($conditions != '')
|
156 |
-
$sql .= ' WHERE '.$conditions;
|
157 |
-
|
158 |
-
// Add on search conditions
|
159 |
-
if (is_array ($searches) && $this->search != '') {
|
160 |
-
if ($sql == '')
|
161 |
-
$sql .= ' WHERE (';
|
162 |
-
else
|
163 |
-
$sql .= ' AND (';
|
164 |
-
|
165 |
-
$searchbits = array ();
|
166 |
-
foreach ($searches AS $search)
|
167 |
-
$searchbits[] = "$search LIKE \"%{$this->search}%\"";
|
168 |
-
|
169 |
-
$sql .= implode (' OR ', $searchbits);
|
170 |
-
$sql .= ')';
|
171 |
-
}
|
172 |
-
|
173 |
-
// Add filters
|
174 |
-
if (is_array ($filters) && !empty ($this->filters)) {
|
175 |
-
$searchbits = array ();
|
176 |
-
foreach ($filters AS $filter) {
|
177 |
-
if (isset ($this->filters[$filter])) {
|
178 |
-
if ($this->filters[$filter] != '')
|
179 |
-
$searchbits[] = sprintf ("%s = '%s'", $filter, $this->filters[$filter]);
|
180 |
-
}
|
181 |
-
}
|
182 |
-
|
183 |
-
if (count ($searchbits) > 0) {
|
184 |
-
if ($sql == '')
|
185 |
-
$sql .= ' WHERE (';
|
186 |
-
else
|
187 |
-
$sql .= ' AND (';
|
188 |
-
|
189 |
-
$sql .= implode (' AND ', $searchbits);
|
190 |
-
$sql .= ')';
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
return $sql;
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Returns a set of conditions with limits.
|
200 |
-
*
|
201 |
-
* @param string $conditions WHERE conditions
|
202 |
-
* @param array $searches Array of columns to search on
|
203 |
-
* @param array $filters Array of columns to filter on
|
204 |
-
* @return string SQL
|
205 |
-
**/
|
206 |
-
|
207 |
-
function to_limits($conditions = '', $searches = '', $filters = '', $group_by = '') {
|
208 |
-
$sql = $this->to_conditions ($conditions, $searches, $filters);
|
209 |
-
|
210 |
-
if ($group_by)
|
211 |
-
$sql .= ' '.$group_by.' ';
|
212 |
-
|
213 |
-
if (strlen ($this->order_by) > 0) {
|
214 |
-
if (!$this->is_secondary_sort ())
|
215 |
-
$sql .= " ORDER BY ".$this->order_by.' '.$this->order_direction;
|
216 |
-
else
|
217 |
-
$sql .= " ORDER BY ".$this->order_original.' '.$this->order_direction;
|
218 |
-
}
|
219 |
-
|
220 |
-
if ($this->per_page > 0)
|
221 |
-
$sql .= ' LIMIT '.$this->offset ().','.$this->per_page;
|
222 |
-
return $sql;
|
223 |
-
}
|
224 |
-
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Return the url with all the params added back
|
228 |
-
*
|
229 |
-
* @param int Page offset
|
230 |
-
* @param string $orderby Optional order
|
231 |
-
* @return string URL
|
232 |
-
**/
|
233 |
-
|
234 |
-
function url($offset, $orderby = '') {
|
235 |
-
// Position
|
236 |
-
if (strpos ($this->url, 'curpage=') !== false)
|
237 |
-
$url = preg_replace ('/curpage=\d*/', 'curpage='.$offset, $this->url);
|
238 |
-
else
|
239 |
-
$url = $this->url.'&curpage='.$offset;
|
240 |
-
|
241 |
-
// Order
|
242 |
-
if ($orderby != '') {
|
243 |
-
if (strpos ($url, 'orderby=') !== false)
|
244 |
-
$url = preg_replace ('/orderby=\w*/', 'orderby='.$orderby, $url);
|
245 |
-
else
|
246 |
-
$url = $url.'&orderby='.$orderby;
|
247 |
-
|
248 |
-
if (!empty ($this->order_tags) && isset ($this->order_tags[$orderby]))
|
249 |
-
$dir = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';
|
250 |
-
else if ($this->order_by == $orderby)
|
251 |
-
$dir = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';
|
252 |
-
else
|
253 |
-
$dir = $this->order_direction;
|
254 |
-
|
255 |
-
if (strpos ($url, 'order=') !== false)
|
256 |
-
$url = preg_replace ('/order=\w*/', 'order='.$dir, $url);
|
257 |
-
else
|
258 |
-
$url = $url.'&order='.$dir;
|
259 |
-
}
|
260 |
-
|
261 |
-
return str_replace ('&go=go', '', $url);
|
262 |
-
}
|
263 |
-
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Return current page
|
267 |
-
*
|
268 |
-
* @return int
|
269 |
-
**/
|
270 |
-
|
271 |
-
function current_page() { return $this->current_page; }
|
272 |
-
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Return total number of pages
|
276 |
-
*
|
277 |
-
* @return int
|
278 |
-
**/
|
279 |
-
|
280 |
-
function total_pages() {
|
281 |
-
if ($this->per_page == 0)
|
282 |
-
return 1;
|
283 |
-
return ceil ($this->total / $this->per_page);
|
284 |
-
}
|
285 |
-
|
286 |
-
|
287 |
-
/**
|
288 |
-
* Determine if we have a next page
|
289 |
-
*
|
290 |
-
* @return boolean
|
291 |
-
**/
|
292 |
-
|
293 |
-
function have_next_page() {
|
294 |
-
if ($this->current_page < $this->total_pages ())
|
295 |
-
return true;
|
296 |
-
return false;
|
297 |
-
}
|
298 |
-
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Determine if we have a previous page
|
302 |
-
*
|
303 |
-
* @return boolean
|
304 |
-
**/
|
305 |
-
|
306 |
-
function have_previous_page() {
|
307 |
-
if ($this->current_page > 1)
|
308 |
-
return true;
|
309 |
-
return false;
|
310 |
-
}
|
311 |
-
|
312 |
-
|
313 |
-
function sortable_class($column, $class = true) {
|
314 |
-
if ($column == $this->order_by) {
|
315 |
-
if ($class)
|
316 |
-
printf (' class="sorted"');
|
317 |
-
else
|
318 |
-
echo ' sorted';
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Return a string suitable for a sortable column heading
|
324 |
-
*
|
325 |
-
* @param string $column Column to search upon
|
326 |
-
* @param string $text Text to display for the column
|
327 |
-
* @param boolean $image Whether to show a direction image
|
328 |
-
* @return string URL
|
329 |
-
**/
|
330 |
-
|
331 |
-
function sortable($column, $text, $image = true) {
|
332 |
-
$img = '';
|
333 |
-
$url = $this->url ($this->current_page, $column);
|
334 |
-
|
335 |
-
if (isset ($this->order_tags[$column]))
|
336 |
-
$column = $this->order_tags[$column];
|
337 |
-
|
338 |
-
if ($column == $this->order_by) {
|
339 |
-
if (defined ('WP_PLUGIN_URL'))
|
340 |
-
$dir = WP_PLUGIN_URL.'/'.basename (dirname (dirname (__FILE__)));
|
341 |
-
else
|
342 |
-
$dir = get_bloginfo ('wpurl').'/wp-content/plugins/'.basename (dirname (dirname (__FILE__)));
|
343 |
-
|
344 |
-
if (strpos ($url, 'ASC') !== false)
|
345 |
-
$img = '<img align="bottom" src="'.$dir.'/images/up.gif" alt="dir" width="16" height="7"/>';
|
346 |
-
else
|
347 |
-
$img = '<img align="bottom" src="'.$dir.'/images/down.gif" alt="dir" width="16" height="7"/>';
|
348 |
-
|
349 |
-
if ($image == false)
|
350 |
-
$img = '';
|
351 |
-
}
|
352 |
-
|
353 |
-
return '<a href="'.$url.'">'.$text.'</a>'.$img;
|
354 |
-
}
|
355 |
-
|
356 |
-
|
357 |
-
/**
|
358 |
-
* Returns an array of page numbers => link, given the current page (next and previous etc)
|
359 |
-
*
|
360 |
-
* @return array Array of page links
|
361 |
-
**/
|
362 |
-
|
363 |
-
function area_pages() {
|
364 |
-
// First page
|
365 |
-
$allow_dot = true;
|
366 |
-
$pages = array ();
|
367 |
-
|
368 |
-
if ($this->total_pages () > 1) {
|
369 |
-
$previous = __ ('Previous', 'redirection');
|
370 |
-
$next = __ ('Next', 'redirection');
|
371 |
-
|
372 |
-
if ($this->have_previous_page ())
|
373 |
-
$pages[] = '<a href="'.$this->url ($this->current_page - 1).'">'.$previous.'</a> |';
|
374 |
-
else
|
375 |
-
$pages[] = $previous.' |';
|
376 |
-
|
377 |
-
for ($pos = 1; $pos <= $this->total_pages (); $pos++) {
|
378 |
-
if ($pos == $this->current_page) {
|
379 |
-
$pages[] = '<span class="active">'.$pos.'</span>';
|
380 |
-
$allow_dot = true;
|
381 |
-
}
|
382 |
-
else if ($pos == 1 || abs ($this->current_page - $pos) <= 2 || $pos == $this->total_pages ())
|
383 |
-
$pages[] = '<a href="'.$this->url ($pos).'">'.$pos."</a>";
|
384 |
-
else if ($allow_dot) {
|
385 |
-
$allow_dot = false;
|
386 |
-
$pages[] = '…';
|
387 |
-
}
|
388 |
-
}
|
389 |
-
|
390 |
-
if ($this->have_next_page ())
|
391 |
-
$pages[] = '| <a href="'.$this->url ($this->current_page + 1).'">'.$next.'</a>';
|
392 |
-
else
|
393 |
-
$pages[] = '| '.$next;
|
394 |
-
}
|
395 |
-
|
396 |
-
return $pages;
|
397 |
-
}
|
398 |
-
|
399 |
-
|
400 |
-
/**
|
401 |
-
* @todo
|
402 |
-
* @return boolean
|
403 |
-
**/
|
404 |
-
|
405 |
-
function filtered($field, $value) {
|
406 |
-
if (isset ($this->filters[$field]) && $this->filters[$field] == $value)
|
407 |
-
return true;
|
408 |
-
return false;
|
409 |
-
}
|
410 |
-
|
411 |
-
|
412 |
-
/**
|
413 |
-
* Display a SELECT box suitable for a per-page
|
414 |
-
*
|
415 |
-
* @return void
|
416 |
-
**/
|
417 |
-
|
418 |
-
function per_page($plugin = '') {
|
419 |
-
?>
|
420 |
-
<select name="perpage">
|
421 |
-
<?php foreach ($this->steps AS $step) : ?>
|
422 |
-
<option value="<?php echo $step ?>"<?php if ($this->per_page == $step) echo ' selected="selected"' ?>>
|
423 |
-
<?php printf (__ ('%d per-page', 'headspace'), $step) ?>
|
424 |
-
</option>
|
425 |
-
<?php endforeach; ?>
|
426 |
-
</select>
|
427 |
-
<?php
|
428 |
-
}
|
429 |
-
|
430 |
-
function page_links() {
|
431 |
-
$text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>',
|
432 |
-
number_format_i18n (($this->current_page () - 1) * $this->per_page + 1),
|
433 |
-
number_format_i18n ($this->current_page () * $this->per_page > $this->total ? $this->total : $this->current_page () * $this->per_page),
|
434 |
-
number_format_i18n ($this->total));
|
435 |
-
|
436 |
-
$links = paginate_links (array ('base' => str_replace ('99', '%#%', $this->url (99)), 'format' => '%#%', 'current' => $this->current_page (), 'total' => $this->total_pages (), 'end_size' => 3, 'mid_size' => 2, 'prev_next' => true));
|
437 |
-
return $text.$links;
|
438 |
-
}
|
439 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models/term_pager.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class TermPager
|
4 |
-
{
|
5 |
-
var $order_by = 'tag';
|
6 |
-
var $url;
|
7 |
-
var $current_page = 0;
|
8 |
-
var $order_direction = 'ASC';
|
9 |
-
|
10 |
-
function TermPager($get, $url, $default_order, $default_direction) {
|
11 |
-
$this->url = $url;
|
12 |
-
|
13 |
-
$this->order_by = $default_order;
|
14 |
-
$this->order_direction = $default_direction;
|
15 |
-
|
16 |
-
if (isset ($get['orderby']))
|
17 |
-
$this->order_by = $get['orderby'];
|
18 |
-
|
19 |
-
if (isset ($get['order']))
|
20 |
-
$this->order_direction = $get['order'];
|
21 |
-
}
|
22 |
-
|
23 |
-
function get($taxonomy) {
|
24 |
-
return get_terms ($taxonomy, array ('get' => 'all', 'hide_empty' => false, 'orderby' => $this->order_by, 'order' => $this->order_direction, 'number' => '2,2'));
|
25 |
-
}
|
26 |
-
|
27 |
-
function sortable($text, $column) {
|
28 |
-
$url = $this->url ($this->current_page, $column);
|
29 |
-
|
30 |
-
if (isset ($this->order_tags[$column]))
|
31 |
-
$column = $this->order_tags[$column];
|
32 |
-
|
33 |
-
if ($column == $this->order_by) {
|
34 |
-
if (defined ('WP_PLUGIN_URL'))
|
35 |
-
$dir = WP_PLUGIN_URL.'/'.basename (dirname (dirname (__FILE__)));
|
36 |
-
else
|
37 |
-
$dir = get_bloginfo ('wpurl').'/wp-content/plugins/'.basename (dirname (dirname (__FILE__)));
|
38 |
-
|
39 |
-
if (strpos ($url, 'ASC') !== false)
|
40 |
-
$img = '<img align="bottom" src="'.$dir.'/images/up.gif" alt="dir" width="16" height="7"/>';
|
41 |
-
else
|
42 |
-
$img = '<img align="bottom" src="'.$dir.'/images/down.gif" alt="dir" width="16" height="7"/>';
|
43 |
-
}
|
44 |
-
|
45 |
-
return '<a href="'.$url.'">'.$text.'</a>'.$img;
|
46 |
-
}
|
47 |
-
|
48 |
-
function url($offset, $orderby = '') {
|
49 |
-
// Position
|
50 |
-
if (strpos ($this->url, 'curpage=') !== false)
|
51 |
-
$url = preg_replace ('/curpage=\d*/', 'curpage='.$offset, $this->url);
|
52 |
-
else
|
53 |
-
$url = $this->url.'&curpage='.$offset;
|
54 |
-
|
55 |
-
// Order
|
56 |
-
if ($orderby != '') {
|
57 |
-
if (strpos ($url, 'orderby=') !== false)
|
58 |
-
$url = preg_replace ('/orderby=\w*/', 'orderby='.$orderby, $url);
|
59 |
-
else
|
60 |
-
$url = $url.'&orderby='.$orderby;
|
61 |
-
|
62 |
-
if (!empty ($this->order_tags) && isset ($this->order_tags[$orderby]))
|
63 |
-
$dir = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';
|
64 |
-
else if ($this->order_by == $orderby)
|
65 |
-
$dir = $this->order_direction == 'ASC' ? 'DESC' : 'ASC';
|
66 |
-
else
|
67 |
-
$dir = $this->order_direction;
|
68 |
-
|
69 |
-
if (strpos ($url, 'order=') !== false)
|
70 |
-
$url = preg_replace ('/order=\w*/', 'order='.$dir, $url);
|
71 |
-
else
|
72 |
-
$url = $url.'&order='.$dir;
|
73 |
-
}
|
74 |
-
|
75 |
-
return str_replace ('&go=go', '', $url);
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mass/description.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* HeadSpace
|
5 |
-
*
|
6 |
-
* @package HeadSpace
|
7 |
-
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
-
**/
|
10 |
-
|
11 |
-
/*
|
12 |
-
============================================================================================================
|
13 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
14 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
15 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
16 |
-
consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
|
17 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
18 |
-
contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
|
19 |
-
this software, even if advised of the possibility of such damage.
|
20 |
-
|
21 |
-
For full license details see license.txt
|
22 |
-
============================================================================================================ */
|
23 |
-
|
24 |
-
class HS_Mass_Description extends HSM_Mass_Edit
|
25 |
-
{
|
26 |
-
function name ()
|
27 |
-
{
|
28 |
-
return __ ('Page description', 'headspace');
|
29 |
-
}
|
30 |
-
|
31 |
-
function get_pager ()
|
32 |
-
{
|
33 |
-
global $wpdb;
|
34 |
-
|
35 |
-
$orderby = array
|
36 |
-
(
|
37 |
-
'id' => "{$wpdb->posts}.ID",
|
38 |
-
'title' => "{$wpdb->posts}.post_title",
|
39 |
-
'desc' => "{$wpdb->postmeta}.meta_value"
|
40 |
-
);
|
41 |
-
|
42 |
-
return new HS_Pager ($_GET, $_SERVER['REQUEST_URI'], "{$wpdb->posts}.ID", 'DESC', 'headspace', $orderby);
|
43 |
-
}
|
44 |
-
|
45 |
-
function show_header ($pager)
|
46 |
-
{
|
47 |
-
global $wpdb;
|
48 |
-
?>
|
49 |
-
<th><?php echo $pager->sortable ('title', __ ('Post title', 'headspace')) ?></th>
|
50 |
-
<th><?php echo $pager->sortable ('desc', __ ('Page description', 'headspace')) ?></th>
|
51 |
-
<th width="16"></th>
|
52 |
-
<?php
|
53 |
-
}
|
54 |
-
|
55 |
-
function show ($post)
|
56 |
-
{
|
57 |
-
?>
|
58 |
-
<td><?php echo htmlspecialchars ($post->post_title); ?></td>
|
59 |
-
<td width="60%" align="center" ><input style="width: 95%" type="text" name="edit[<?php echo $post->ID ?>][<?php echo $post->meta_id ?>]" value="<?php echo htmlspecialchars ($post->meta_value); ?>" id="edit_<?php echo $post->ID ?>"/></td>
|
60 |
-
<td width="16"><a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=hs_auto_description&post=<?php echo $post->ID ?>&_ajax_nonce=<?php echo wp_create_nonce( 'headspace-autodescription' ); ?>" class="auto-desc"><img src="../wp-content/plugins/headspace2/images/refresh.png" width="16" height="16" alt="View"/></a></td>
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
|
64 |
-
function get (&$pager)
|
65 |
-
{
|
66 |
-
global $wpdb;
|
67 |
-
|
68 |
-
$sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID,{$wpdb->posts}.post_title,{$wpdb->postmeta}.meta_value,{$wpdb->postmeta}.meta_id FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID={$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key='_headspace_description'";
|
69 |
-
$limits = $pager->to_limits ("({$wpdb->posts}.post_type='page' OR {$wpdb->posts}.post_type='post')", array ("{$wpdb->postmeta}.meta_value", "{$wpdb->posts}.post_title"));
|
70 |
-
|
71 |
-
$rows = $wpdb->get_results ($sql.$limits);
|
72 |
-
$pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
|
73 |
-
return $rows;
|
74 |
-
}
|
75 |
-
|
76 |
-
function update ($data)
|
77 |
-
{
|
78 |
-
if (count ($data['edit']) > 0)
|
79 |
-
{
|
80 |
-
global $wpdb;
|
81 |
-
foreach ($data['edit'] AS $postid => $values)
|
82 |
-
{
|
83 |
-
$postid = intval ($postid);
|
84 |
-
|
85 |
-
// Just check we can edit this
|
86 |
-
if (current_user_can ('edit_post', $postid))
|
87 |
-
{
|
88 |
-
foreach ($values AS $metaid => $value)
|
89 |
-
{
|
90 |
-
$savevalue = $wpdb->escape ($value);
|
91 |
-
$metaid = intval ($metaid);
|
92 |
-
|
93 |
-
if ($metaid == 0 && !empty ($value))
|
94 |
-
{
|
95 |
-
// This is a new value
|
96 |
-
$wpdb->query ("INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value) VALUES ($postid,'_headspace_description','$savevalue')");
|
97 |
-
}
|
98 |
-
else if ($metaid > 0 && empty ($value))
|
99 |
-
{
|
100 |
-
// Delete the value
|
101 |
-
$wpdb->query ("DELETE FROM {$wpdb->postmeta} WHERE meta_id='$metaid'");
|
102 |
-
}
|
103 |
-
else if ($metaid > 0 && !empty ($value))
|
104 |
-
{
|
105 |
-
// Update the value
|
106 |
-
$wpdb->query ("UPDATE {$wpdb->postmeta} SET meta_value='$savevalue' WHERE meta_id='$metaid'");
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mass/keywords.php
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* HeadSpace
|
5 |
-
*
|
6 |
-
* @package HeadSpace
|
7 |
-
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
-
**/
|
10 |
-
|
11 |
-
/*
|
12 |
-
============================================================================================================
|
13 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
14 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
15 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
16 |
-
consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
|
17 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
18 |
-
contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
|
19 |
-
this software, even if advised of the possibility of such damage.
|
20 |
-
|
21 |
-
For full license details see license.txt
|
22 |
-
============================================================================================================ */
|
23 |
-
/*
|
24 |
-
class HS_Mass_Keywords extends HSM_Mass_Edit
|
25 |
-
{
|
26 |
-
function name ()
|
27 |
-
{
|
28 |
-
return __ ('Keywords', 'headspace');
|
29 |
-
}
|
30 |
-
|
31 |
-
function get_pager ()
|
32 |
-
{
|
33 |
-
global $wpdb;
|
34 |
-
|
35 |
-
$orderby = array
|
36 |
-
(
|
37 |
-
'id' => "{$wpdb->posts}.ID",
|
38 |
-
'title' => "{$wpdb->posts}.post_title",
|
39 |
-
'desc' => "{$wpdb->postmeta}.meta_value"
|
40 |
-
);
|
41 |
-
|
42 |
-
return new HS_Pager ($_GET, $_SERVER['REQUEST_URI'], "{$wpdb->posts}.ID", 'DESC', 'headspace', $orderby);
|
43 |
-
}
|
44 |
-
|
45 |
-
function show_header ($pager)
|
46 |
-
{
|
47 |
-
global $wpdb;
|
48 |
-
?>
|
49 |
-
<th><?php echo $pager->sortable ('title', __ ('Post title', 'headspace')) ?></th>
|
50 |
-
<th><?php echo $pager->sortable ('keywords', __ ('Keywords', 'headspace')) ?></th>
|
51 |
-
<th width="16"></th>
|
52 |
-
<?php
|
53 |
-
}
|
54 |
-
|
55 |
-
function show ($post)
|
56 |
-
{
|
57 |
-
?>
|
58 |
-
<td><?php echo htmlspecialchars ($post->post_title); ?></td>
|
59 |
-
<td width="60%" align="center" ><input style="width: 95%" type="text" name="edit[<?php echo $post->ID ?>][<?php echo $post->meta_id ?>]" value="<?php echo htmlspecialchars ($post->meta_value); ?>" id="edit_<?php echo $post->ID ?>"/></td>
|
60 |
-
<td width="16"><a href="#auto" onclick="return auto_desc (<?php echo $post->ID ?>)"><img src="../wp-content/plugins/headspace2/images/refresh.png" width="16" height="16" alt="View"/></a></td>
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
|
64 |
-
function get (&$pager)
|
65 |
-
{
|
66 |
-
global $wpdb;
|
67 |
-
|
68 |
-
$sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID,{$wpdb->posts}.post_title,{$wpdb->postmeta}.meta_value,{$wpdb->postmeta}.meta_id FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID={$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key='_headspace_description' WHERE {$wpdb->posts}.post_type='page' OR {$wpdb->posts}.post_type='post'";
|
69 |
-
$limits = $pager->to_limits ("", array ("{$wpdb->postmeta}.meta_value", "{$wpdb->posts}.post_title"));
|
70 |
-
|
71 |
-
$rows = $wpdb->get_results ($sql.$limits);
|
72 |
-
$pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
|
73 |
-
return $rows;
|
74 |
-
}
|
75 |
-
|
76 |
-
function update ($data)
|
77 |
-
{
|
78 |
-
if (count ($data['edit']) > 0)
|
79 |
-
{
|
80 |
-
global $wpdb;
|
81 |
-
foreach ($data['edit'] AS $postid => $values)
|
82 |
-
{
|
83 |
-
$postid = intval ($postid);
|
84 |
-
|
85 |
-
// Just check we can edit this
|
86 |
-
if (current_user_can ('edit_post', $postid))
|
87 |
-
{
|
88 |
-
foreach ($values AS $metaid => $value)
|
89 |
-
{
|
90 |
-
$savevalue = $wpdb->escape ($value);
|
91 |
-
$metaid = intval ($metaid);
|
92 |
-
|
93 |
-
if ($metaid == 0 && !empty ($value))
|
94 |
-
{
|
95 |
-
// This is a new value
|
96 |
-
$wpdb->query ("INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value) VALUES ($postid,'_headspace_description','$savevalue')");
|
97 |
-
}
|
98 |
-
else if ($metaid > 0 && empty ($value))
|
99 |
-
{
|
100 |
-
// Delete the value
|
101 |
-
$wpdb->query ("DELETE FROM {$wpdb->postmeta} WHERE meta_id='$metaid'");
|
102 |
-
}
|
103 |
-
else if ($metaid > 0 && !empty ($value))
|
104 |
-
{
|
105 |
-
// Update the value
|
106 |
-
$wpdb->query ("UPDATE {$wpdb->postmeta} SET meta_value='$savevalue' WHERE meta_id='$metaid'");
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mass/more_text.php
DELETED
@@ -1,111 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* HeadSpace
|
5 |
-
*
|
6 |
-
* @package HeadSpace
|
7 |
-
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
-
**/
|
10 |
-
|
11 |
-
/*
|
12 |
-
============================================================================================================
|
13 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
14 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
15 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
16 |
-
consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
|
17 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
18 |
-
contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
|
19 |
-
this software, even if advised of the possibility of such damage.
|
20 |
-
|
21 |
-
For full license details see license.txt
|
22 |
-
============================================================================================================ */
|
23 |
-
|
24 |
-
class HS_Mass_MoreText extends HSM_Mass_Edit
|
25 |
-
{
|
26 |
-
function name ()
|
27 |
-
{
|
28 |
-
return __ ('More text', 'headspace');
|
29 |
-
}
|
30 |
-
|
31 |
-
function get_pager ()
|
32 |
-
{
|
33 |
-
global $wpdb;
|
34 |
-
|
35 |
-
$orderby = array
|
36 |
-
(
|
37 |
-
'id' => "{$wpdb->posts}.ID",
|
38 |
-
'title' => "{$wpdb->posts}.post_title",
|
39 |
-
'page' => "{$wpdb->postmeta}.meta_value"
|
40 |
-
);
|
41 |
-
|
42 |
-
return new HS_Pager ($_GET, $_SERVER['REQUEST_URI'], "{$wpdb->posts}.ID", 'DESC', 'headspace', $orderby);
|
43 |
-
}
|
44 |
-
|
45 |
-
function show_header ($pager)
|
46 |
-
{
|
47 |
-
global $wpdb;
|
48 |
-
?>
|
49 |
-
<th><?php echo $pager->sortable ('title', __ ('Post title', 'headspace')) ?></th>
|
50 |
-
<th><?php echo $pager->sortable ('page', __ ('More text', 'headspace')) ?></th>
|
51 |
-
<?php
|
52 |
-
}
|
53 |
-
|
54 |
-
function show ($post)
|
55 |
-
{
|
56 |
-
?>
|
57 |
-
<td><?php echo htmlspecialchars ($post->post_title); ?></td>
|
58 |
-
<td width="60%" align="center" ><input style="width: 95%" type="text" name="edit[<?php echo $post->ID ?>][<?php echo $post->meta_id ?>]" value="<?php echo htmlspecialchars ($post->meta_value); ?>" id="edit_<?php echo $post->ID ?>"/></td>
|
59 |
-
<?php
|
60 |
-
}
|
61 |
-
|
62 |
-
function get (&$pager)
|
63 |
-
{
|
64 |
-
global $wpdb;
|
65 |
-
|
66 |
-
$sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID,{$wpdb->posts}.post_title,{$wpdb->postmeta}.meta_value,{$wpdb->postmeta}.meta_id FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID={$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key='_headspace_more_text'";
|
67 |
-
$limits = $pager->to_limits ("({$wpdb->posts}.post_type='page' OR {$wpdb->posts}.post_type='post')", array ("{$wpdb->postmeta}.meta_value", "{$wpdb->posts}.post_title"));
|
68 |
-
|
69 |
-
$rows = $wpdb->get_results ($sql.$limits);
|
70 |
-
$pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
|
71 |
-
return $rows;
|
72 |
-
}
|
73 |
-
|
74 |
-
function update ($data)
|
75 |
-
{
|
76 |
-
if (count ($data['edit']) > 0)
|
77 |
-
{
|
78 |
-
global $wpdb;
|
79 |
-
foreach ($data['edit'] AS $postid => $values)
|
80 |
-
{
|
81 |
-
$postid = intval ($postid);
|
82 |
-
|
83 |
-
// Just check we can edit this
|
84 |
-
if (current_user_can ('edit_post', $postid))
|
85 |
-
{
|
86 |
-
foreach ($values AS $metaid => $value)
|
87 |
-
{
|
88 |
-
$savevalue = $wpdb->escape ($value);
|
89 |
-
$metaid = intval ($metaid);
|
90 |
-
|
91 |
-
if ($metaid == 0 && !empty ($value))
|
92 |
-
{
|
93 |
-
// This is a new value
|
94 |
-
$wpdb->query ("INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value) VALUES ($postid,'_headspace_more_text','$savevalue')");
|
95 |
-
}
|
96 |
-
else if ($metaid > 0 && empty ($value))
|
97 |
-
{
|
98 |
-
// Delete the value
|
99 |
-
$wpdb->query ("DELETE FROM {$wpdb->postmeta} WHERE meta_id='$metaid'");
|
100 |
-
}
|
101 |
-
else if ($metaid > 0 && !empty ($value))
|
102 |
-
{
|
103 |
-
// Update the value
|
104 |
-
$wpdb->query ("UPDATE {$wpdb->postmeta} SET meta_value='$savevalue' WHERE meta_id='$metaid'");
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mass/page_slug.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* HeadSpace
|
5 |
-
*
|
6 |
-
* @package HeadSpace
|
7 |
-
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
-
**/
|
10 |
-
|
11 |
-
/*
|
12 |
-
============================================================================================================
|
13 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
14 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
15 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
16 |
-
consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
|
17 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
18 |
-
contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
|
19 |
-
this software, even if advised of the possibility of such damage.
|
20 |
-
|
21 |
-
For full license details see license.txt
|
22 |
-
============================================================================================================ */
|
23 |
-
|
24 |
-
class HS_Mass_PageSlug extends HSM_Mass_Edit
|
25 |
-
{
|
26 |
-
function name ()
|
27 |
-
{
|
28 |
-
return __ ('Page slug', 'headspace');
|
29 |
-
}
|
30 |
-
|
31 |
-
function get_pager ()
|
32 |
-
{
|
33 |
-
global $wpdb;
|
34 |
-
|
35 |
-
$orderby = array
|
36 |
-
(
|
37 |
-
'id' => "{$wpdb->posts}.ID",
|
38 |
-
'title' => "{$wpdb->posts}.post_title",
|
39 |
-
'slug' => "{$wpdb->posts}.post_name"
|
40 |
-
);
|
41 |
-
|
42 |
-
return new HS_Pager ($_GET, $_SERVER['REQUEST_URI'], "{$wpdb->posts}.ID", 'DESC', 'headspace', $orderby);
|
43 |
-
}
|
44 |
-
|
45 |
-
function show_header ($pager)
|
46 |
-
{
|
47 |
-
global $wpdb;
|
48 |
-
?>
|
49 |
-
<th><?php echo $pager->sortable ('title', __ ('Post title', 'headspace')) ?></th>
|
50 |
-
<th><?php echo $pager->sortable ('slug', __ ('Post slug', 'headspace')) ?></th>
|
51 |
-
<?php
|
52 |
-
}
|
53 |
-
|
54 |
-
function show ($post)
|
55 |
-
{
|
56 |
-
?>
|
57 |
-
<td><?php echo htmlspecialchars ($post->post_title); ?></td>
|
58 |
-
<td width="60%" align="center" ><input style="width: 95%" type="text" name="edit[<?php echo $post->ID ?>]" value="<?php echo htmlspecialchars ($post->post_name); ?>" id="edit_<?php echo $post->ID ?>"/></td>
|
59 |
-
<?php
|
60 |
-
}
|
61 |
-
|
62 |
-
function get (&$pager)
|
63 |
-
{
|
64 |
-
global $wpdb;
|
65 |
-
|
66 |
-
$sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID,{$wpdb->posts}.post_title,{$wpdb->posts}.post_name FROM {$wpdb->posts}";
|
67 |
-
$limits = $pager->to_limits ("({$wpdb->posts}.post_type='page' OR {$wpdb->posts}.post_type='post')", array ("{$wpdb->posts}.post_name", "{$wpdb->posts}.post_title"));
|
68 |
-
|
69 |
-
$rows = $wpdb->get_results ($sql.$limits);
|
70 |
-
$pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
|
71 |
-
return $rows;
|
72 |
-
}
|
73 |
-
|
74 |
-
function update ($data)
|
75 |
-
{
|
76 |
-
if (count ($data['edit']) > 0)
|
77 |
-
{
|
78 |
-
global $wpdb;
|
79 |
-
foreach ($data['edit'] AS $postid => $slug)
|
80 |
-
{
|
81 |
-
$postid = intval ($postid);
|
82 |
-
|
83 |
-
// Just check we can edit this
|
84 |
-
if (current_user_can ('edit_post', $postid))
|
85 |
-
{
|
86 |
-
$_POST['redirection_slug'] = get_permalink ($postid);
|
87 |
-
wp_update_post (array ('ID' => $postid, 'post_name' => $slug));
|
88 |
-
}
|
89 |
-
}
|
90 |
-
}
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modules/mass/page_title.php
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* HeadSpace
|
5 |
-
*
|
6 |
-
* @package HeadSpace
|
7 |
-
* @author John Godley
|
8 |
-
* @copyright Copyright (C) John Godley
|
9 |
-
**/
|
10 |
-
|
11 |
-
/*
|
12 |
-
============================================================================================================
|
13 |
-
This software is provided "as is" and any express or implied warranties, including, but not limited to, the
|
14 |
-
implied warranties of merchantibility and fitness for a particular purpose are disclaimed. In no event shall
|
15 |
-
the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or
|
16 |
-
consequential damages (including, but not limited to, procurement of substitute goods or services; loss of
|
17 |
-
use, data, or profits; or business interruption) however caused and on any theory of liability, whether in
|
18 |
-
contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of
|
19 |
-
this software, even if advised of the possibility of such damage.
|
20 |
-
|
21 |
-
For full license details see license.txt
|
22 |
-
============================================================================================================ */
|
23 |
-
|
24 |
-
class HS_Mass_PageTitle extends HSM_Mass_Edit
|
25 |
-
{
|
26 |
-
function name ()
|
27 |
-
{
|
28 |
-
return __ ('Page title', 'headspace');
|
29 |
-
}
|
30 |
-
|
31 |
-
function get_pager ()
|
32 |
-
{
|
33 |
-
global $wpdb;
|
34 |
-
|
35 |
-
$orderby = array
|
36 |
-
(
|
37 |
-
'id' => "{$wpdb->posts}.ID",
|
38 |
-
'title' => "{$wpdb->posts}.post_title",
|
39 |
-
'page' => "{$wpdb->postmeta}.meta_value"
|
40 |
-
);
|
41 |
-
|
42 |
-
return new HS_Pager ($_GET, $_SERVER['REQUEST_URI'], "{$wpdb->posts}.ID", 'DESC', 'headspace', $orderby);
|
43 |
-
}
|
44 |
-
|
45 |
-
function show_header ($pager)
|
46 |
-
{
|
47 |
-
global $wpdb;
|
48 |
-
?>
|
49 |
-
<th><?php echo $pager->sortable ('title', __ ('Post title', 'headspace')) ?></th>
|
50 |
-
<th><?php echo $pager->sortable ('page', __ ('Page title', 'headspace')) ?></th>
|
51 |
-
<th width="16"></th>
|
52 |
-
<?php
|
53 |
-
}
|
54 |
-
|
55 |
-
function show ($post)
|
56 |
-
{
|
57 |
-
?>
|
58 |
-
<td id="title_<?php echo $post->ID ?>"><?php echo htmlspecialchars ($post->post_title); ?></td>
|
59 |
-
<td width="60%" align="center" ><input class="text" style="width: 95%" type="text" name="edit[<?php echo $post->ID ?>][<?php echo $post->meta_id ?>]" value="<?php echo htmlspecialchars ($post->meta_value); ?>" id="edit_<?php echo $post->ID ?>"/></td>
|
60 |
-
<td width="16"><a href="#title_<?php echo $post->ID ?>" class="title"><img src="../wp-content/plugins/headspace2/images/refresh.png" width="16" height="16" alt="View"/></a></td>
|
61 |
-
<?php
|
62 |
-
}
|
63 |
-
|
64 |
-
function get (&$pager)
|
65 |
-
{
|
66 |
-
global $wpdb;
|
67 |
-
|
68 |
-
$sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID,{$wpdb->posts}.post_title,{$wpdb->postmeta}.meta_value,{$wpdb->postmeta}.meta_id FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID={$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key='_headspace_page_title'";
|
69 |
-
$limits = $pager->to_limits ("({$wpdb->posts}.post_type='page' OR {$wpdb->posts}.post_type='post')", array ("{$wpdb->postmeta}.meta_value", "{$wpdb->posts}.post_title"));
|
70 |
-
|
71 |
-
$rows = $wpdb->get_results ($sql.$limits);
|
72 |
-
$pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
|
73 |
-
return $rows;
|
74 |
-
}
|
75 |
-
|
76 |
-
function update ($data)
|
77 |
-
{
|
78 |
-
if (count ($data['edit']) > 0)
|
79 |
-
{
|
80 |
-
global $wpdb;
|
81 |
-
foreach ($data['edit'] AS $postid => $values)
|
82 |
-
{
|
83 |
-
$postid = intval ($postid);
|
84 |
-
|
85 |
-
// Just check we can edit this
|
86 |
-
if (current_user_can ('edit_post', $postid))
|
87 |
-
{
|
88 |
-
foreach ($values AS $metaid => $value)
|
89 |
-
{
|
90 |
-
$savevalue = $wpdb->escape ($value);
|
91 |
-
$metaid = intval ($metaid);
|
92 |
-
|
93 |
-
if ($metaid == 0 && !empty ($value))
|
94 |
-
{
|
95 |
-
// This is a new value
|
96 |
-
$wpdb->query ("INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value) VALUES ($postid,'_headspace_page_title','$savevalue')");
|
97 |
-
}
|
98 |
-
else if ($metaid > 0 && empty ($value))
|
99 |
-
{
|
100 |
-
// Delete the value
|
101 |
-
$wpdb->query ("DELETE FROM {$wpdb->postmeta} WHERE meta_id='$metaid'");
|
102 |
-
}
|
103 |
-
else if ($metaid > 0 && !empty ($value))
|
104 |
-
{
|
105 |
-
// Update the value
|
106 |
-
$wpdb->query ("UPDATE {$wpdb->postmeta} SET meta_value='$savevalue' WHERE meta_id='$metaid'");
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|