HeadSpace2 SEO - Version 3.6.39

Version Description

  • Update some old crufty code
  • Remove mass editor
Download this release

Release Info

Developer johnny5
Plugin Icon wp plugin HeadSpace2 SEO
Version 3.6.39
Comparing to
See all releases

Code changes from version 3.6.38 to 3.6.39

Files changed (74) hide show
  1. ajax.php +5 -2
  2. headspace.php +24 -96
  3. headspace_library.php +1 -2
  4. js/headspace.js +1 -2
  5. models/headspace.php +0 -1
  6. models/importer.php +0 -1
  7. models/inline_tags.php +0 -1
  8. models/mass_edit.php +0 -57
  9. models/pager.php +0 -439
  10. models/term_pager.php +0 -77
  11. modules/mass/description.php +0 -114
  12. modules/mass/keywords.php +0 -114
  13. modules/mass/more_text.php +0 -111
  14. modules/mass/page_slug.php +0 -93
  15. modules/mass/page_title.php +0 -113
  16. modules/mass/site_description.php +0 -111
  17. modules/mass/site_name.php +0 -111
  18. modules/mass/tags.php +0 -120
  19. modules/page/custom.php +3 -3
  20. modules/page/description.php +2 -2
  21. modules/page/javascript.php +3 -3
  22. modules/page/keywords.php +1 -1
  23. modules/page/more_text.php +3 -3
  24. modules/page/page-links.php +5 -5
  25. modules/page/page_title.php +2 -2
  26. modules/page/plugin.php +3 -3
  27. modules/page/raw-footer.php +1 -1
  28. modules/page/raw.php +1 -1
  29. modules/page/relative-links.php +5 -5
  30. modules/page/rss_name.php +1 -1
  31. modules/page/rss_tagline.php +1 -1
  32. modules/page/site_name.php +2 -2
  33. modules/page/site_tagline.php +1 -1
  34. modules/page/stylesheet.php +3 -3
  35. modules/page/tags.php +5 -6
  36. modules/page/theme.php +1 -1
  37. modules/site/103bees.php +21 -21
  38. modules/site/analytics.php +38 -38
  39. modules/site/apture.php +21 -21
  40. modules/site/awstats.php +22 -23
  41. modules/site/crazyegg.php +23 -23
  42. modules/site/disable_visual_editing.php +4 -5
  43. modules/site/feedburner-stats.php +10 -10
  44. modules/site/first-time-visitor.php +18 -18
  45. modules/site/frame-breaker.php +4 -5
  46. modules/site/google-ad-wrap.php +3 -4
  47. modules/site/google_webmaster.php +8 -8
  48. modules/site/hacks.php +0 -2
  49. modules/site/hittail.php +20 -21
  50. modules/site/microsoft-live.php +10 -13
  51. modules/site/mint.php +22 -25
  52. modules/site/page_counts.php +22 -24
  53. modules/site/piwik.php +32 -34
  54. modules/site/statcounter.php +32 -33
  55. modules/site/system-settings.php +15 -18
  56. modules/site/widgets.php +20 -23
  57. modules/site/wp_formatting.php +13 -14
  58. modules/site/yahoo-site-explorer.php +10 -12
  59. plugin.php +0 -252
  60. readme.txt +5 -5
  61. screenshot-4.png +0 -0
  62. view/admin/dashboard.php +3 -3
  63. view/admin/edit_page.php +3 -1
  64. view/admin/edit_post.php +2 -2
  65. view/admin/head_admin.php +0 -7
  66. view/admin/mass_edit.php +0 -77
  67. view/admin/options.php +5 -5
  68. view/admin/page-module-edit.php +1 -1
  69. view/admin/page-module-item.php +4 -4
  70. view/admin/page-settings-item.php +5 -5
  71. view/admin/site-module-edit.php +4 -4
  72. view/admin/site-module-item.php +8 -6
  73. view/admin/submenu.php +5 -5
  74. 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 HeadSpace_Plugin::specialchars( implode( ', ', $suggestions ) );
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.38
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->add_filter ('admin_head' );
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
- $url = explode ('&', $_SERVER['REQUEST_URI']);
255
- $url = $url[0];
256
 
257
  if ($inwrap == true)
258
- $this->render_admin( 'submenu', array ('url' => $url, 'sub' => $sub));
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 wp_print_scripts() {
460
  global $wp_scripts;
461
 
462
- if ( function_exists( 'add_meta_box' ) ) {
463
- add_meta_box ('headspacestuff', __ ('HeadSpace', 'headspace'), array (&$this, 'metabox'), 'post', 'normal', 'high' );
464
- add_meta_box ('headspacestuff', __ ('HeadSpace', 'headspace'), array (&$this, 'metabox'), 'page', 'normal', 'high' );
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 (strpos ($_SERVER['REQUEST_URI'], 'headspace') || $this->is_category_edit ()) {
477
- wp_enqueue_script( 'headspace', $this->url ().'/js/headspace.js', array ('jquery-form', 'jquery-ui-sortable'), $this->version ());
 
478
  }
479
- else if ($this->is_page () || $this->is_post_edit ()) {
480
- wp_enqueue_script( 'headspace', $this->url ().'/js/headspace.js', array ('jquery-form'), $this->version ());
481
- wp_enqueue_script( 'headspace-tags', $this->url ().'/js/headspace-tags.js', array ('headspace'), $this->version ());
 
 
482
  }
483
 
484
- // Stop this being called again
485
- remove_action( 'wp_print_scripts', array(&$this, 'wp_print_scripts'));
 
 
 
 
 
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->query ("INSERT INTO {$wpdb->postmeta} (post_id,meta_key,meta_value) VALUES ('$postid','$field','".$wpdb->escape ($data)."')");
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 &copy; 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 ('&', '&amp;', $this->url);
102
- $this->url = str_replace ('&&amp;', '&amp;', $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.'&amp;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.'&amp;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.'&amp;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[] = '&hellip;';
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&#8211;%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.'&amp;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.'&amp;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.'&amp;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&amp;post=<?php echo $post->ID ?>&amp;_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
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/mass/site_description.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_SiteDescription extends HSM_Mass_Edit
25
- {
26
- function name ()
27
- {
28
- return __ ('Site 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
- 'name' => "{$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', __ ('Site description', '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_blog_tagline'";
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_blog_tagline','$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/site_name.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_SiteName extends HSM_Mass_Edit
25
- {
26
- function name ()
27
- {
28
- return __ ('Site name', '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
- 'name' => "{$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', __ ('Site name', '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_blog_name'";
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_blog_name','$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/tags.php DELETED
@@ -1,120 +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_Tags extends HSM_Mass_Edit
25
- {
26
- function name ()
27
- {
28
- return __ ('Tags', '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 width="60%"><?php echo $pager->sortable ('desc', __ ('Tags/keywords', 'headspace')) ?></th>
51
- <th width="16"></th>
52
- <?php
53
- }
54
-
55
- function show ($post)
56
- {
57
- $tags = str_replace (',', ', ', MetaData::get_tags ($post->ID));
58
- ?>
59
- <td><?php echo htmlspecialchars ($post->post_title); ?></td>
60
- <td width="60%" id="tags_<?php echo $post->ID ?>">
61
- <input style="width: 95%" type="text" name="edit[<?php echo $post->ID ?>]" value="<?php echo htmlspecialchars ($tags); ?>" id="edit_<?php echo $post->ID ?>"/>
62
- </td>
63
- <td width="16"><a class="tag" href="<?php echo admin_url( 'admin-ajax.php' ) ?>?id=<?php echo $post->ID ?>&amp;action=hs_auto_tag&amp;_ajax_nonce=<?php echo wp_create_nonce ('headspace-auto_tag_'.$post->ID) ?>"><img src="../wp-content/plugins/headspace2/images/refresh.png" width="16" height="16" alt="View"/></a></td>
64
- <?php
65
- }
66
-
67
- function get (&$pager)
68
- {
69
- global $wpdb;
70
-
71
- $sql = "SELECT SQL_CALC_FOUND_ROWS {$wpdb->posts}.ID,{$wpdb->posts}.post_title FROM {$wpdb->posts}";
72
-
73
- $limits = $pager->to_limits ("(post_type='page' OR post_type='post')", array ("{$wpdb->postmeta}.meta_value", "{$wpdb->posts}.post_title"));
74
-
75
- $rows = $wpdb->get_results ($sql.$limits);
76
- $pager->set_total ($wpdb->get_var ("SELECT FOUND_ROWS()"));
77
- return $rows;
78
- }
79
-
80
- function update ($data)
81
- {
82
- if (count ($data['edit']) > 0)
83
- {
84
- global $wpdb;
85
- foreach ($data['edit'] AS $postid => $values)
86
- {
87
- $postid = intval ($postid);
88
-
89
- // Just check we can edit this
90
- if (current_user_can ('edit_post', $postid))
91
- MetaData::add_tags ($postid, $values);
92
- }
93
- }
94
- }
95
-
96
- function normalize_tags ($words, $order = true)
97
- {
98
- $list = explode (',', trim (str_replace (',,', '', $words), ','));
99
- if (count ($list) > 0)
100
- {
101
- foreach ($list AS $pos => $item)
102
- {
103
- $list[$pos] = trim ($item);
104
-
105
- if (function_exists ('mb_strtolower'))
106
- $list[$pos] = mb_strtolower ($list[$pos], get_option ('blog_charset'));
107
- else
108
- $list[$pos] = strtolower ($list[$pos]);
109
- }
110
-
111
- $list = array_unique ($list);
112
- if ($this->order)
113
- sort ($list);
114
-
115
- return implode (',', $list);
116
- }
117
-
118
- return $words;
119
- }
120
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/page/custom.php CHANGED
@@ -54,7 +54,7 @@ class HSM_Custom extends HSM_Module
54
  <tr>
55
  <th width="<?php echo $width ?>" align="right"><?php echo $field ?>:</th>
56
  <td>
57
- <input type="text" name="headspace_custom_field[<?php echo $field ?>]" value="<?php if (isset ($this->values[$field])) echo htmlspecialchars ($this->values[$field])?>" style="width: 95%"/>
58
  </td>
59
  </tr>
60
  <?php
@@ -86,10 +86,10 @@ class HSM_Custom extends HSM_Module
86
  <td id="headspace_custom_fields<?php echo $id ?>">
87
  <?php if (count ($this->fields) > 0) : ?>
88
  <?php foreach ($this->fields AS $pos => $sheet) : ?>
89
- <input type="text" name="headspace_custom_field[]" value="<?php echo htmlspecialchars ($sheet) ?>" style="width: 90%"/>
90
  <?php if ($pos == 0) : ?>
91
  <a href="#" onclick="jQuery('#headspace_custom_fields<?php echo $id ?>').append ('<input type=&quot;text&quot; name=&quot;headspace_custom_field[]&quot; style=&quot;width: 90%&quot;/>'); return false">
92
- <img src="<?php echo $headspace2->url (); ?>/images/add.png" alt="add"/>
93
  </a>
94
  <?php endif; ?>
95
  <?php endforeach; ?>
54
  <tr>
55
  <th width="<?php echo $width ?>" align="right"><?php echo $field ?>:</th>
56
  <td>
57
+ <input type="text" name="headspace_custom_field[<?php echo $field ?>]" value="<?php if (isset ($this->values[$field])) echo esc_attr ($this->values[$field])?>" style="width: 95%"/>
58
  </td>
59
  </tr>
60
  <?php
86
  <td id="headspace_custom_fields<?php echo $id ?>">
87
  <?php if (count ($this->fields) > 0) : ?>
88
  <?php foreach ($this->fields AS $pos => $sheet) : ?>
89
+ <input type="text" name="headspace_custom_field[]" value="<?php echo esc_attr ($sheet) ?>" style="width: 90%"/>
90
  <?php if ($pos == 0) : ?>
91
  <a href="#" onclick="jQuery('#headspace_custom_fields<?php echo $id ?>').append ('<input type=&quot;text&quot; name=&quot;headspace_custom_field[]&quot; style=&quot;width: 90%&quot;/>'); return false">
92
+ <img src="<?php echo plugins_url( '/images/add.png', $headspace2->base_url() ); ?>" alt="add"/>
93
  </a>
94
  <?php endif; ?>
95
  <?php endforeach; ?>
modules/page/description.php CHANGED
@@ -45,7 +45,7 @@ class HSM_Description extends HSM_Module
45
  $description = substr (strip_tags ($this->description), 0, $this->max_length);
46
 
47
  $description = trim (preg_replace ("/[\r\n ]+/", ' ', $description));
48
- $description = HeadSpace_Plugin::specialchars ($description);
49
 
50
  echo '<meta name="description" content="'.$description.'" />'."\r\n";
51
  }
@@ -91,7 +91,7 @@ class HSM_Description extends HSM_Module
91
  <?php endif; ?>
92
  </th>
93
  <td>
94
- <textarea rows="2" name="headspace_description" style="width: 95%" id="desc_<?php echo $id; ?>"><?php echo HeadSpace_Plugin::specialchars ($this->description) ?></textarea><br/>
95
 
96
  <script type="text/javascript" charset="utf-8">
97
  jQuery('#desc_<?php echo $id ?>').Counter( { limit: <?php echo $this->max_length; ?>, remaining: '<?php echo esc_js( __( 'remaining', 'headspace' ) )?>' } );
45
  $description = substr (strip_tags ($this->description), 0, $this->max_length);
46
 
47
  $description = trim (preg_replace ("/[\r\n ]+/", ' ', $description));
48
+ $description = esc_attr($description);
49
 
50
  echo '<meta name="description" content="'.$description.'" />'."\r\n";
51
  }
91
  <?php endif; ?>
92
  </th>
93
  <td>
94
+ <textarea rows="2" name="headspace_description" style="width: 95%" id="desc_<?php echo $id; ?>"><?php echo esc_html($this->description) ?></textarea><br/>
95
 
96
  <script type="text/javascript" charset="utf-8">
97
  jQuery('#desc_<?php echo $id ?>').Counter( { limit: <?php echo $this->max_length; ?>, remaining: '<?php echo esc_js( __( 'remaining', 'headspace' ) )?>' } );
modules/page/javascript.php CHANGED
@@ -37,7 +37,7 @@ class HSM_JavaScript extends HSM_Module
37
  function head () {
38
  if (!empty ($this->scripts)) {
39
  foreach ($this->scripts AS $script)
40
- echo '<script type="text/javascript" src="'.$script.'"></script>'."\r\n";
41
  }
42
  }
43
 
@@ -61,10 +61,10 @@ class HSM_JavaScript extends HSM_Module
61
  <td id="headspace_scripts_<?php echo $id ?>">
62
  <?php if (count ($this->scripts) > 0) : ?>
63
  <?php foreach ($this->scripts AS $pos => $sheet) : ?>
64
- <input type="text" name="headspace_js[]" value="<?php echo htmlspecialchars ($sheet) ?>" style="width: 90%"/>
65
  <?php if ($pos == 0) : ?>
66
  <a href="#" onclick="jQuery('#headspace_scripts_<?php echo $id ?>').append ('<input type=&quot;text&quot; name=&quot;headspace_js[]&quot; style=&quot;width: 90%&quot;/>'); return false">
67
- <img src="<?php echo $headspace2->url (); ?>/images/add.png" alt="add"/>
68
  </a>
69
  <?php endif; ?>
70
  <?php endforeach; ?>
37
  function head () {
38
  if (!empty ($this->scripts)) {
39
  foreach ($this->scripts AS $script)
40
+ echo '<script type="text/javascript" src="'.esc_attr( $script ).'"></script>'."\r\n";
41
  }
42
  }
43
 
61
  <td id="headspace_scripts_<?php echo $id ?>">
62
  <?php if (count ($this->scripts) > 0) : ?>
63
  <?php foreach ($this->scripts AS $pos => $sheet) : ?>
64
+ <input type="text" name="headspace_js[]" value="<?php echo esc_attr ($sheet) ?>" style="width: 90%"/>
65
  <?php if ($pos == 0) : ?>
66
  <a href="#" onclick="jQuery('#headspace_scripts_<?php echo $id ?>').append ('<input type=&quot;text&quot; name=&quot;headspace_js[]&quot; style=&quot;width: 90%&quot;/>'); return false">
67
+ <img src="<?php echo plugins_url( '/images/add.png', $headspace2->base_url() ); ?>" alt="add"/>
68
  </a>
69
  <?php endif; ?>
70
  <?php endforeach; ?>
modules/page/keywords.php CHANGED
@@ -110,7 +110,7 @@ class HSM_Keywords extends HSM_Module
110
  <?php endif; ?>
111
  </th>
112
  <td>
113
- <input type="text" name="headspace_metakey" style="width: 95%" value="<?php echo htmlspecialchars ($this->metakey) ?>" id="keywords_<?php echo $id; ?>"/>
114
 
115
  <script type="text/javascript" charset="utf-8">
116
  jQuery('#keywords_<?php echo $id ?>').Counter( { limit: <?php echo $this->max_length; ?>, remaining: '<?php echo esc_js( __( 'remaining', 'headspace' ) )?>' } );
110
  <?php endif; ?>
111
  </th>
112
  <td>
113
+ <input type="text" name="headspace_metakey" style="width: 95%" value="<?php echo esc_attr ($this->metakey) ?>" id="keywords_<?php echo $id; ?>"/>
114
 
115
  <script type="text/javascript" charset="utf-8">
116
  jQuery('#keywords_<?php echo $id ?>').Counter( { limit: <?php echo $this->max_length; ?>, remaining: '<?php echo esc_js( __( 'remaining', 'headspace' ) )?>' } );
modules/page/more_text.php CHANGED
@@ -96,7 +96,7 @@ class HSM_MoreText extends HSM_Module
96
  <tr>
97
  <th width="<?php echo $width ?>" align="right"><?php _e ('More text', 'headspace') ?>:</th>
98
  <td>
99
- <input type="text" name="headspace_more_text" value="<?php echo htmlspecialchars ($this->more_text) ?>" style="width: 95%"/>
100
  </td>
101
  </tr>
102
  <?php
@@ -123,13 +123,13 @@ class HSM_MoreText extends HSM_Module
123
  <tr>
124
  <th width="120"><?php _e ('Pattern', 'headspace'); ?>:</th>
125
  <td>
126
- <input type="text" name="pattern" value="<?php echo htmlspecialchars ($this->pattern) ?>"/><br/>
127
  <span class="sub"><?php _e ('Advanced - the regular expression pattern to select the more link from your posts', 'headspace'); ?></span>
128
  </td>
129
  </tr>
130
  <tr>
131
  <th width="120"><?php _e ('Replace', 'headspace'); ?>:</th>
132
- <input type="text" name="replace" value="<?php echo htmlspecialchars ($this->replace) ?>"/><br/>
133
  <span class="sub"><?php _e ('Advanced - the regular expression replacement text', 'headspace'); ?></span>
134
  </td>
135
  </tr>
96
  <tr>
97
  <th width="<?php echo $width ?>" align="right"><?php _e ('More text', 'headspace') ?>:</th>
98
  <td>
99
+ <input type="text" name="headspace_more_text" value="<?php echo esc_attr ($this->more_text) ?>" style="width: 95%"/>
100
  </td>
101
  </tr>
102
  <?php
123
  <tr>
124
  <th width="120"><?php _e ('Pattern', 'headspace'); ?>:</th>
125
  <td>
126
+ <input type="text" name="pattern" value="<?php echo esc_attr ($this->pattern) ?>"/><br/>
127
  <span class="sub"><?php _e ('Advanced - the regular expression pattern to select the more link from your posts', 'headspace'); ?></span>
128
  </td>
129
  </tr>
130
  <tr>
131
  <th width="120"><?php _e ('Replace', 'headspace'); ?>:</th>
132
+ <input type="text" name="replace" value="<?php echo esc_attr ($this->replace) ?>"/><br/>
133
  <span class="sub"><?php _e ('Advanced - the regular expression replacement text', 'headspace'); ?></span>
134
  </td>
135
  </tr>
modules/page/page-links.php CHANGED
@@ -157,12 +157,12 @@ class HSM_PageLinks extends HSM_Module {
157
  ?>
158
  <tr>
159
  <th width="<?php echo $width ?>" align="right"><?php _e( 'Page Link Text', 'headspace' )?>:</th>
160
- <td><input style="width: 95%" type="text" name="headspace_pagelink_text" value="<?php echo htmlspecialchars( $this->pagelink_text ); ?>"/>
161
  </td>
162
  </tr>
163
  <tr>
164
  <th width="<?php echo $width ?>" align="right"><?php _e( 'Page Link Title', 'headspace' )?>:</th>
165
- <td><input style="width: 95%" type="text" name="headspace_pagelink_title" value="<?php echo htmlspecialchars( $this->pagelink_title ); ?>"/>
166
  </td>
167
  </tr>
168
  <tr>
@@ -203,21 +203,21 @@ class HSM_PageLinks extends HSM_Module {
203
  <tr>
204
  <th width="120"><?php _e ('Display', 'headspace'); ?>:</th>
205
  <td>
206
- <input type="text" name="link_display" value="<?php echo htmlspecialchars ($this->link_display) ?>"/><br/>
207
  <span class="sub"><?php _e ('How a link is displayed. Use %link% for the link itself', 'headspace'); ?></span>
208
  </td>
209
  </tr>
210
  <tr>
211
  <th width="120"><?php _e ('Before HTML', 'headspace'); ?>:</th>
212
  <td>
213
- <input type="text" name="before_text" value="<?php echo htmlspecialchars ($this->before_text) ?>"/><br/>
214
  <span class="sub"><?php _e ('HTML added to start of list', 'headspace'); ?></span>
215
  </td>
216
  </tr>
217
  <tr>
218
  <th width="120"><?php _e ('After HTML', 'headspace'); ?>:</th>
219
  <td>
220
- <input type="text" name="after_text" value="<?php echo htmlspecialchars ($this->after_text) ?>"/><br/>
221
  <span class="sub"><?php _e ('HTML added to end of list', 'headspace'); ?></span>
222
  </td>
223
  </tr>
157
  ?>
158
  <tr>
159
  <th width="<?php echo $width ?>" align="right"><?php _e( 'Page Link Text', 'headspace' )?>:</th>
160
+ <td><input style="width: 95%" type="text" name="headspace_pagelink_text" value="<?php echo esc_attr( $this->pagelink_text ); ?>"/>
161
  </td>
162
  </tr>
163
  <tr>
164
  <th width="<?php echo $width ?>" align="right"><?php _e( 'Page Link Title', 'headspace' )?>:</th>
165
+ <td><input style="width: 95%" type="text" name="headspace_pagelink_title" value="<?php echo esc_attr( $this->pagelink_title ); ?>"/>
166
  </td>
167
  </tr>
168
  <tr>
203
  <tr>
204
  <th width="120"><?php _e ('Display', 'headspace'); ?>:</th>
205
  <td>
206
+ <input type="text" name="link_display" value="<?php echo esc_attr ($this->link_display) ?>"/><br/>
207
  <span class="sub"><?php _e ('How a link is displayed. Use %link% for the link itself', 'headspace'); ?></span>
208
  </td>
209
  </tr>
210
  <tr>
211
  <th width="120"><?php _e ('Before HTML', 'headspace'); ?>:</th>
212
  <td>
213
+ <input type="text" name="before_text" value="<?php echo esc_attr ($this->before_text) ?>"/><br/>
214
  <span class="sub"><?php _e ('HTML added to start of list', 'headspace'); ?></span>
215
  </td>
216
  </tr>
217
  <tr>
218
  <th width="120"><?php _e ('After HTML', 'headspace'); ?>:</th>
219
  <td>
220
+ <input type="text" name="after_text" value="<?php echo esc_attr ($this->after_text) ?>"/><br/>
221
  <span class="sub"><?php _e ('HTML added to end of list', 'headspace'); ?></span>
222
  </td>
223
  </tr>
modules/page/page_title.php CHANGED
@@ -122,7 +122,7 @@ class HSM_PageTitle extends HSM_Module
122
  <tr>
123
  <th width="120"><?php _e ('Title separator', 'headspace'); ?>:</th>
124
  <td>
125
- <input class="text" type="text" name="separator" size="5" value="<?php esc_attr_e( $this->separator ) ?>"/>
126
  <span class="sub"><?php _e ('Leave blank to use theme default', 'headspace'); ?></span>
127
  </td>
128
  </tr>
@@ -150,7 +150,7 @@ class HSM_PageTitle extends HSM_Module
150
  <tr>
151
  <th><?php _e ('Max length', 'headspace'); ?>:</th>
152
  <td>
153
- <input type="text" name="max_length" size="5" value="<?php echo $this->max_length ?>"/>
154
  </td>
155
  </tr>
156
  <?php
122
  <tr>
123
  <th width="120"><?php _e ('Title separator', 'headspace'); ?>:</th>
124
  <td>
125
+ <input class="text" type="text" name="separator" size="5" value="<?php echo esc_attr( $this->separator ) ?>"/>
126
  <span class="sub"><?php _e ('Leave blank to use theme default', 'headspace'); ?></span>
127
  </td>
128
  </tr>
150
  <tr>
151
  <th><?php _e ('Max length', 'headspace'); ?>:</th>
152
  <td>
153
+ <input type="text" name="max_length" size="5" value="<?php echo esc_attr( $this->max_length ) ?>"/>
154
  </td>
155
  </tr>
156
  <?php
modules/page/plugin.php CHANGED
@@ -137,13 +137,13 @@ class HSM_Plugin extends HSM_Module
137
  <option value="<?php echo $name ?>"><?php echo $details['Name']; ?></option>
138
  <?php endforeach; ?>
139
  </select>
140
- <a href="#" onclick="return add_plugin ()"><img valign="bottom" src="<?php echo $headspace2->url (); ?>/images/add.png" alt="add"/></a>
141
 
142
  <ul id="headspace_plugins">
143
  <?php if (!empty ($this->plugins)) : ?>
144
  <?php foreach ($this->plugins AS $name) : ?>
145
  <li>
146
- <div class="delete"><a href="#" onclick="return delete_plugin(this);"><img src="<?php echo $headspace->url () ?>/images/delete.png" alt="delete" width="16" height="16"/></a></div>
147
  <?php echo $plugins[$name]['Name'] ?>
148
  <input type='hidden' name='headspace_plugins[]' value='<?php echo $name ?>'/>
149
  </li>
@@ -186,7 +186,7 @@ class HSM_Plugin extends HSM_Module
186
 
187
  function link ($id) {
188
  $url = get_permalink ($id);
189
- $url = str_replace (get_bloginfo ('home'), '', $url);
190
  return $url;
191
  }
192
 
137
  <option value="<?php echo $name ?>"><?php echo $details['Name']; ?></option>
138
  <?php endforeach; ?>
139
  </select>
140
+ <a href="#" onclick="return add_plugin ()"><img valign="bottom" src="<?php echo plugins_url( '/images/add.png', $headspace->base_url() ); ?>" alt="add"/></a>
141
 
142
  <ul id="headspace_plugins">
143
  <?php if (!empty ($this->plugins)) : ?>
144
  <?php foreach ($this->plugins AS $name) : ?>
145
  <li>
146
+ <div class="delete"><a href="#" onclick="return delete_plugin(this);"><img src="<?php echo plugins_url( '/images/delete.png', $headspace->base_url() ); ?>" alt="delete" width="16" height="16"/></a></div>
147
  <?php echo $plugins[$name]['Name'] ?>
148
  <input type='hidden' name='headspace_plugins[]' value='<?php echo $name ?>'/>
149
  </li>
186
 
187
  function link ($id) {
188
  $url = get_permalink ($id);
189
+ $url = str_replace (get_bloginfo ('url'), '', $url);
190
  return $url;
191
  }
192
 
modules/page/raw-footer.php CHANGED
@@ -53,7 +53,7 @@ class HSM_RawFooter extends HSM_Module
53
  <tr>
54
  <th width="<?php echo $width ?>" align="right" valign="top"><?php _e ('Raw footer data', 'headspace') ?>:</th>
55
  <td>
56
- <textarea name="headspace_raw_footer" style="width: 95%" rows="3"><?php echo htmlspecialchars ($this->raw_footer) ?></textarea>
57
  </td>
58
  </tr>
59
  <?php
53
  <tr>
54
  <th width="<?php echo $width ?>" align="right" valign="top"><?php _e ('Raw footer data', 'headspace') ?>:</th>
55
  <td>
56
+ <textarea name="headspace_raw_footer" style="width: 95%" rows="3"><?php echo esc_html ($this->raw_footer) ?></textarea>
57
  </td>
58
  </tr>
59
  <?php
modules/page/raw.php CHANGED
@@ -49,7 +49,7 @@ class HSM_Raw extends HSM_Module
49
  <tr>
50
  <th width="<?php echo $width ?>" align="right" valign="top"><?php _e ('Raw data', 'headspace') ?>:</th>
51
  <td>
52
- <textarea name="headspace_raw" style="width: 95%" rows="3"><?php echo htmlspecialchars ($this->raw) ?></textarea>
53
  </td>
54
  </tr>
55
  <?php
49
  <tr>
50
  <th width="<?php echo $width ?>" align="right" valign="top"><?php _e ('Raw data', 'headspace') ?>:</th>
51
  <td>
52
+ <textarea name="headspace_raw" style="width: 95%" rows="3"><?php echo esc_html($this->raw) ?></textarea>
53
  </td>
54
  </tr>
55
  <?php
modules/page/relative-links.php CHANGED
@@ -107,27 +107,27 @@ class HSM_RelativeLinks extends HSM_Module {
107
  <td>
108
  <label>
109
  <small><?php _e( 'Previous', 'headspace' )?>:</small>
110
- <input size="5" type="text" name="headspace_rellink_prev" value="<?php echo htmlspecialchars( $this->rellink_prev ); ?>"/>
111
  </label>
112
 
113
  <label>
114
  <small><?php _e( 'Next', 'headspace' )?>:</small>
115
- <input size="5" type="text" name="headspace_rellink_next" value="<?php echo htmlspecialchars( $this->rellink_next ); ?>"/>
116
  </label>
117
 
118
  <label>
119
  <small><?php _e( 'Start', 'headspace' )?>:</small>
120
- <input size="5" type="text" name="headspace_rellink_start" value="<?php echo htmlspecialchars( $this->rellink_start ); ?>"/>
121
  </label>
122
 
123
  <label>
124
  <small><?php _e( 'End', 'headspace' )?>:</small>
125
- <input size="5" type="text" name="headspace_rellink_end" value="<?php echo htmlspecialchars( $this->rellink_end ); ?>"/>
126
  </label>
127
 
128
  <label>
129
  <small><?php _e( 'Parent', 'headspace' )?>:</small>
130
- <input size="5" type="text" name="headspace_rellink_parent" value="<?php echo htmlspecialchars( $this->rellink_parent ); ?>"/>
131
  </label>
132
  </td>
133
  </tr>
107
  <td>
108
  <label>
109
  <small><?php _e( 'Previous', 'headspace' )?>:</small>
110
+ <input size="5" type="text" name="headspace_rellink_prev" value="<?php echo esc_attr( $this->rellink_prev ); ?>"/>
111
  </label>
112
 
113
  <label>
114
  <small><?php _e( 'Next', 'headspace' )?>:</small>
115
+ <input size="5" type="text" name="headspace_rellink_next" value="<?php echo esc_attr( $this->rellink_next ); ?>"/>
116
  </label>
117
 
118
  <label>
119
  <small><?php _e( 'Start', 'headspace' )?>:</small>
120
+ <input size="5" type="text" name="headspace_rellink_start" value="<?php echo esc_attr( $this->rellink_start ); ?>"/>
121
  </label>
122
 
123
  <label>
124
  <small><?php _e( 'End', 'headspace' )?>:</small>
125
+ <input size="5" type="text" name="headspace_rellink_end" value="<?php echo esc_attr( $this->rellink_end ); ?>"/>
126
  </label>
127
 
128
  <label>
129
  <small><?php _e( 'Parent', 'headspace' )?>:</small>
130
+ <input size="5" type="text" name="headspace_rellink_parent" value="<?php echo esc_attr( $this->rellink_parent ); ?>"/>
131
  </label>
132
  </td>
133
  </tr>
modules/page/rss_name.php CHANGED
@@ -68,7 +68,7 @@ class HSM_RssName extends HSM_Module
68
  <tr>
69
  <th width="<?php echo $width ?>" align="right"><?php _e ('RSS Name', 'headspace') ?>:</th>
70
  <td>
71
- <input type="text" name="headspace_rss_title" value="<?php echo htmlspecialchars ($this->rss_title) ?>" style="width: 95%"/>
72
  </td>
73
  </tr>
74
  <?php
68
  <tr>
69
  <th width="<?php echo $width ?>" align="right"><?php _e ('RSS Name', 'headspace') ?>:</th>
70
  <td>
71
+ <input type="text" name="headspace_rss_title" value="<?php echo esc_attr ($this->rss_title) ?>" style="width: 95%"/>
72
  </td>
73
  </tr>
74
  <?php
modules/page/rss_tagline.php CHANGED
@@ -68,7 +68,7 @@ class HSM_RssTagline extends HSM_Module
68
  <tr>
69
  <th width="<?php echo $width ?>" align="right"><?php _e ('RSS Desc.', 'headspace') ?>:</th>
70
  <td>
71
- <input type="text" name="headspace_rss_description" value="<?php echo htmlspecialchars ($this->rss_desc); ?>" style="width: 95%"/>
72
  </td>
73
  </tr>
74
  <?php
68
  <tr>
69
  <th width="<?php echo $width ?>" align="right"><?php _e ('RSS Desc.', 'headspace') ?>:</th>
70
  <td>
71
+ <input type="text" name="headspace_rss_description" value="<?php echo esc_attr($this->rss_desc); ?>" style="width: 95%"/>
72
  </td>
73
  </tr>
74
  <?php
modules/page/site_name.php CHANGED
@@ -46,7 +46,7 @@ class HSM_SiteName extends HSM_Module
46
  HeadSpace2::reload ($this);
47
 
48
  if (strlen ($this->blog_name) > 0)
49
- return trim (HeadSpace_Plugin::specialchars ($this->blog_name));
50
  return trim ($tagline);
51
  }
52
 
@@ -69,7 +69,7 @@ class HSM_SiteName extends HSM_Module
69
  <tr>
70
  <th width="<?php echo $width ?>" align="right"><?php _e ('Site name', 'headspace') ?>:</th>
71
  <td>
72
- <input type="text" name="headspace_blog_name" value="<?php echo HeadSpace_Plugin::specialchars ($this->blog_name) ?>" style="width: 95%"/>
73
  </td>
74
  </tr>
75
  <?php
46
  HeadSpace2::reload ($this);
47
 
48
  if (strlen ($this->blog_name) > 0)
49
+ return trim (esc_html ($this->blog_name));
50
  return trim ($tagline);
51
  }
52
 
69
  <tr>
70
  <th width="<?php echo $width ?>" align="right"><?php _e ('Site name', 'headspace') ?>:</th>
71
  <td>
72
+ <input type="text" name="headspace_blog_name" value="<?php echo esc_attr ($this->blog_name) ?>" style="width: 95%"/>
73
  </td>
74
  </tr>
75
  <?php
modules/page/site_tagline.php CHANGED
@@ -67,7 +67,7 @@ class HSM_SiteTagline extends HSM_Module
67
  <tr>
68
  <th width="<?php echo $width ?>" align="right"><?php _e ('Site Tagline', 'headspace') ?>:</th>
69
  <td>
70
- <input type="text" name="headspace_blog_tagline" value="<?php echo htmlspecialchars ($this->blog_tagline) ?>" style="width: 95%"/>
71
  </td>
72
  </tr>
73
  <?php
67
  <tr>
68
  <th width="<?php echo $width ?>" align="right"><?php _e ('Site Tagline', 'headspace') ?>:</th>
69
  <td>
70
+ <input type="text" name="headspace_blog_tagline" value="<?php echo esc_attr ($this->blog_tagline) ?>" style="width: 95%"/>
71
  </td>
72
  </tr>
73
  <?php
modules/page/stylesheet.php CHANGED
@@ -46,7 +46,7 @@ class HSM_Stylesheet extends HSM_Module
46
  function head () {
47
  if (!empty ($this->stylesheets) && $this->disable == false) {
48
  foreach ($this->stylesheets AS $style)
49
- echo '<link rel="stylesheet" href="'.$style.'" type="text/css" />'."\r\n";
50
  }
51
  }
52
 
@@ -70,10 +70,10 @@ class HSM_Stylesheet extends HSM_Module
70
  <td id="headspace_styles_<?php echo $id ?>">
71
  <?php if (count ($this->stylesheets) > 0) : ?>
72
  <?php foreach ($this->stylesheets AS $pos => $sheet) : ?>
73
- <input type="text" name="headspace_style[]" value="<?php echo htmlspecialchars ($sheet) ?>" style="width: 90%"/>
74
  <?php if ($pos == 0) : ?>
75
  <a href="#" onclick="jQuery('#headspace_styles_<?php echo $id ?>').append ('<input type=&quot;text&quot; name=&quot;headspace_style[]&quot; style=&quot;width: 90%&quot;/>'); return false">
76
- <img src="<?php echo $headspace2->url (); ?>/images/add.png" alt="add"/>
77
  </a>
78
  <?php endif; ?>
79
  <?php endforeach; ?>
46
  function head () {
47
  if (!empty ($this->stylesheets) && $this->disable == false) {
48
  foreach ($this->stylesheets AS $style)
49
+ echo '<link rel="stylesheet" href="'.esc_attr( $style ).'" type="text/css" />'."\r\n";
50
  }
51
  }
52
 
70
  <td id="headspace_styles_<?php echo $id ?>">
71
  <?php if (count ($this->stylesheets) > 0) : ?>
72
  <?php foreach ($this->stylesheets AS $pos => $sheet) : ?>
73
+ <input type="text" name="headspace_style[]" value="<?php echo esc_attr ($sheet) ?>" style="width: 90%"/>
74
  <?php if ($pos == 0) : ?>
75
  <a href="#" onclick="jQuery('#headspace_styles_<?php echo $id ?>').append ('<input type=&quot;text&quot; name=&quot;headspace_style[]&quot; style=&quot;width: 90%&quot;/>'); return false">
76
+ <img src="<?php echo plugins_url( '/images/add.png', $headspace2->base_url() ); ?>" alt="add"/>
77
  </a>
78
  <?php endif; ?>
79
  <?php endforeach; ?>
modules/page/tags.php CHANGED
@@ -34,7 +34,6 @@ class HSM_Tags extends HSM_Module
34
  var $zone_tag_key = 'QeXfUYfV34GcpUS9TaSfy8kEtcMb8GVMq7Z0hPi1s4rBUQVTU8NSoHApm_m80DJQkkNj29p2Dfc-';
35
 
36
  function HSM_Tags ($options = array ()) {
37
- // XXXX
38
  if (isset ($options['show_post']))
39
  $this->show_post = $options['show_post'];
40
 
@@ -61,7 +60,7 @@ class HSM_Tags extends HSM_Module
61
  $this->tags = $this->get_the_tags ();
62
 
63
  if (isset ($meta['keywords']) && !is_array ($meta['keywords'])) {
64
- $this->tags .= ','.HeadSpace_Plugin::specialchars ($meta['keywords']);
65
  $this->tags = $this->normalize_tags ($this->tags);
66
  }
67
 
@@ -197,7 +196,7 @@ class HSM_Tags extends HSM_Module
197
  <tr>
198
  <th width="130"><?php _e ('Yahoo ZoneTag', 'headspace'); ?>:</th>
199
  <td>
200
- <input class="regular-text" type="text" name="zone_tag_key" value="<?php echo HeadSpace_Plugin::specialchars ($this->zone_tag_key) ?>"/>
201
  <label><span class="sub"><?php _e ('enable', 'headspace'); ?> <input type="checkbox" name="zone_tag"<?php if ($this->zone_tag) echo ' checked="checked"' ?>/></span></label>
202
  </td>
203
  </tr>
@@ -234,7 +233,7 @@ class HSM_Tags extends HSM_Module
234
  <tr>
235
  <th width="<?php echo $width ?>" align="right"><?php _e ('Tags', 'headspace') ?>:</th>
236
  <td>
237
- <input id="tags-input_<?php echo $area ?>" type="text" name="tags_input" value="<?php echo HeadSpace_Plugin::specialchars ($this->tags) ?>" style="width: 95%"/>
238
  </td>
239
  </tr>
240
  <?php
@@ -301,7 +300,7 @@ class HSM_Tags extends HSM_Module
301
  <?php endforeach; ?>
302
  </div>
303
 
304
- <img style="display: none" id="tag_loading" align="middle" src="<?php echo $headspace2->url (); ?>/images/small.gif" width="16" height="16" alt="Small"/>
305
  <?php
306
  }
307
  else
@@ -319,7 +318,7 @@ class HSM_Tags extends HSM_Module
319
  </small>
320
  </h4>
321
 
322
- <img style="display: none" id="tag_loading" align="middle" src="<?php echo $headspace2->url (); ?>/images/small.gif" width="16" height="16" alt="Small"/>
323
  <?php
324
  }
325
  }
34
  var $zone_tag_key = 'QeXfUYfV34GcpUS9TaSfy8kEtcMb8GVMq7Z0hPi1s4rBUQVTU8NSoHApm_m80DJQkkNj29p2Dfc-';
35
 
36
  function HSM_Tags ($options = array ()) {
 
37
  if (isset ($options['show_post']))
38
  $this->show_post = $options['show_post'];
39
 
60
  $this->tags = $this->get_the_tags ();
61
 
62
  if (isset ($meta['keywords']) && !is_array ($meta['keywords'])) {
63
+ $this->tags .= ','.esc_attr($meta['keywords']);
64
  $this->tags = $this->normalize_tags ($this->tags);
65
  }
66
 
196
  <tr>
197
  <th width="130"><?php _e ('Yahoo ZoneTag', 'headspace'); ?>:</th>
198
  <td>
199
+ <input class="regular-text" type="text" name="zone_tag_key" value="<?php echo esc_attr($this->zone_tag_key) ?>"/>
200
  <label><span class="sub"><?php _e ('enable', 'headspace'); ?> <input type="checkbox" name="zone_tag"<?php if ($this->zone_tag) echo ' checked="checked"' ?>/></span></label>
201
  </td>
202
  </tr>
233
  <tr>
234
  <th width="<?php echo $width ?>" align="right"><?php _e ('Tags', 'headspace') ?>:</th>
235
  <td>
236
+ <input id="tags-input_<?php echo $area ?>" type="text" name="tags_input" value="<?php echo esc_attr($this->tags) ?>" style="width: 95%"/>
237
  </td>
238
  </tr>
239
  <?php
300
  <?php endforeach; ?>
301
  </div>
302
 
303
+ <img style="display: none" id="tag_loading" align="middle" src="<?php echo plugins_url( '/images/small.gif', $headspace2->base_url() ); ?>" width="16" height="16" alt="Small"/>
304
  <?php
305
  }
306
  else
318
  </small>
319
  </h4>
320
 
321
+ <img style="display: none" id="tag_loading" align="middle" src="<?php echo plugins_url( '/images/small.gif', $headspace2->base_url() ); ?>" width="16" height="16" alt="Small"/>
322
  <?php
323
  }
324
  }
modules/page/theme.php CHANGED
@@ -91,7 +91,7 @@ class HSM_Theme extends HSM_Module
91
  <option value="0"><?php _e ('Current theme', 'headspace'); ?></option>
92
 
93
  <?php foreach ($themes AS $name => $values) : ?>
94
- <option value="<?php echo $values['Template'] ?>"<?php if ($values['Template'] == $this->theme) echo ' selected="selected"' ?>><?php echo $name ?></option>
95
  <?php endforeach; ?>
96
  </select>
97
  </td>
91
  <option value="0"><?php _e ('Current theme', 'headspace'); ?></option>
92
 
93
  <?php foreach ($themes AS $name => $values) : ?>
94
+ <option value="<?php echo $values['Template'] ?>"<?php if ($values['Template'] == $this->theme) echo ' selected="selected"' ?>><?php echo esc_html( $name ) ?></option>
95
  <?php endforeach; ?>
96
  </select>
97
  </td>
modules/site/103bees.php CHANGED
@@ -25,31 +25,31 @@ class HSS_Bees extends HS_SiteModule
25
  {
26
  var $role = 'everyone';
27
  var $code = '';
28
-
29
  function name ()
30
  {
31
  return __ ('103bees', 'headspace');
32
  }
33
-
34
  function description ()
35
  {
36
  return __ ('Adds 103bees tracking code to all pages', 'headspace');
37
  }
38
-
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
-
44
  function is_trackable ()
45
  {
46
  if (is_user_logged_in () && $this->role != 'everyone')
47
  {
48
  $user = wp_get_current_user ();
49
-
50
  global $wp_roles;
51
  $caps = $wp_roles->get_role ($this->role);
52
-
53
  if ($caps)
54
  {
55
  // Calculate the highest level of the user and the role
@@ -59,7 +59,7 @@ class HSS_Bees extends HS_SiteModule
59
  if (isset ($caps->capabilities['level_'.$x]))
60
  break;
61
  }
62
-
63
  $role_level = $x;
64
 
65
  for ($x = 10; $x >= 0; $x--)
@@ -67,9 +67,9 @@ class HSS_Bees extends HS_SiteModule
67
  if (isset ($user->allcaps['level_'.$x]))
68
  break;
69
  }
70
-
71
  $user_level = $x;
72
-
73
  // Quit if the user is greater level than the role
74
  if ($user_level > $role_level)
75
  {
@@ -78,39 +78,39 @@ class HSS_Bees extends HS_SiteModule
78
  }
79
  }
80
  }
81
-
82
  return true;
83
  }
84
-
85
  function wp_footer ()
86
  {
87
  if ($this->is_trackable ())
88
  echo $this->code;
89
  }
90
-
91
  function load ($data)
92
  {
93
  if (isset ($data['role']))
94
  $this->role = $data['role'];
95
-
96
  if (isset ($data['code']))
97
  $this->code = $data['code'];
98
  }
99
-
100
  function has_config () { return true; }
101
-
102
  function save_options ($data)
103
  {
104
  return array ('code' => $data['code'], 'role' => $data['role']);
105
  }
106
-
107
  function edit ()
108
  {
109
  ?>
110
  <tr>
111
  <th width="150"><?php _e ('Tracking code', 'headspace'); ?>:</th>
112
  <td>
113
- <textarea rows="3" cols="40" name="code"><?php echo htmlspecialchars ($this->code); ?></textarea><br/>
114
  <span class="sub"><?php _e ('Enter the full JavaScript tracking code as shown on your 103bees account page.', 'headspace'); ?></span>
115
  </td>
116
  </tr>
@@ -120,20 +120,20 @@ class HSS_Bees extends HS_SiteModule
120
  <select name="role">
121
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
122
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
123
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
124
  <?php endforeach; ?>
125
  </select>
126
-
127
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
128
  </td>
129
  </tr>
130
  <?php
131
  }
132
-
133
  function file ()
134
  {
135
  return basename (__FILE__);
136
  }
137
  }
138
 
139
- ?>
25
  {
26
  var $role = 'everyone';
27
  var $code = '';
28
+
29
  function name ()
30
  {
31
  return __ ('103bees', 'headspace');
32
  }
33
+
34
  function description ()
35
  {
36
  return __ ('Adds 103bees tracking code to all pages', 'headspace');
37
  }
38
+
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
+
44
  function is_trackable ()
45
  {
46
  if (is_user_logged_in () && $this->role != 'everyone')
47
  {
48
  $user = wp_get_current_user ();
49
+
50
  global $wp_roles;
51
  $caps = $wp_roles->get_role ($this->role);
52
+
53
  if ($caps)
54
  {
55
  // Calculate the highest level of the user and the role
59
  if (isset ($caps->capabilities['level_'.$x]))
60
  break;
61
  }
62
+
63
  $role_level = $x;
64
 
65
  for ($x = 10; $x >= 0; $x--)
67
  if (isset ($user->allcaps['level_'.$x]))
68
  break;
69
  }
70
+
71
  $user_level = $x;
72
+
73
  // Quit if the user is greater level than the role
74
  if ($user_level > $role_level)
75
  {
78
  }
79
  }
80
  }
81
+
82
  return true;
83
  }
84
+
85
  function wp_footer ()
86
  {
87
  if ($this->is_trackable ())
88
  echo $this->code;
89
  }
90
+
91
  function load ($data)
92
  {
93
  if (isset ($data['role']))
94
  $this->role = $data['role'];
95
+
96
  if (isset ($data['code']))
97
  $this->code = $data['code'];
98
  }
99
+
100
  function has_config () { return true; }
101
+
102
  function save_options ($data)
103
  {
104
  return array ('code' => $data['code'], 'role' => $data['role']);
105
  }
106
+
107
  function edit ()
108
  {
109
  ?>
110
  <tr>
111
  <th width="150"><?php _e ('Tracking code', 'headspace'); ?>:</th>
112
  <td>
113
+ <textarea rows="3" cols="40" name="code"><?php echo esc_html ($this->code); ?></textarea><br/>
114
  <span class="sub"><?php _e ('Enter the full JavaScript tracking code as shown on your 103bees account page.', 'headspace'); ?></span>
115
  </td>
116
  </tr>
120
  <select name="role">
121
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
122
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
123
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
124
  <?php endforeach; ?>
125
  </select>
126
+
127
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
128
  </td>
129
  </tr>
130
  <?php
131
  }
132
+
133
  function file ()
134
  {
135
  return basename (__FILE__);
136
  }
137
  }
138
 
139
+ ?>
modules/site/analytics.php CHANGED
@@ -30,34 +30,34 @@ class HSS_Analytics extends HS_SiteModule {
30
  var $domain = '';
31
  var $raw = '';
32
  var $login = false;
33
-
34
  var $trackable = null;
35
-
36
  function name() {
37
  return __( 'Google Analytics', 'headspace' );
38
  }
39
-
40
  function description() {
41
  return __( 'Adds Google Analytic tracking code to all pages (through <code>wp_footer</code>)', 'headspace' );
42
  }
43
-
44
  function run() {
45
  add_action( 'wp_footer', array( &$this, 'wp_footer' ) );
46
-
47
  if ( $this->login )
48
  add_action( 'login_head', array( &$this, 'wp_footer' ) );
49
  }
50
-
51
  function is_trackable() {
52
  if ( $this->trackable !== null )
53
  return $this->trackable;
54
-
55
  if ( is_user_logged_in () && $this->role != 'everyone' ) {
56
  $user = wp_get_current_user ();
57
-
58
  global $wp_roles;
59
  $caps = $wp_roles->get_role( $this->role );
60
-
61
  if ( $caps ) {
62
  // Calculate the highest level of the user and the role
63
  $role_level = $user_level = 0;
@@ -65,16 +65,16 @@ class HSS_Analytics extends HS_SiteModule {
65
  if ( isset( $caps->capabilities['level_'.$x] ) )
66
  break;
67
  }
68
-
69
  $role_level = $x;
70
 
71
  for ( $x = 10; $x >= 0; $x-- ) {
72
  if ( isset( $user->allcaps['level_'.$x] ) )
73
  break;
74
  }
75
-
76
  $user_level = $x;
77
-
78
  // Quit if the user is greater level than the role
79
  if ( $user_level > $role_level ) {
80
  $this->is_trackable = false;
@@ -82,21 +82,21 @@ class HSS_Analytics extends HS_SiteModule {
82
  }
83
  }
84
  }
85
-
86
  $this->is_trackable = true;
87
  return $this->is_trackable;
88
  }
89
-
90
  function wp_footer() {
91
  if ( $this->tracking && $this->is_trackable() && $this->version == 'urchin' )
92
  $this->track_urchin();
93
  }
94
-
95
  function head() {
96
  if ( $this->tracking && $this->is_trackable() && $this->version == 'ga' )
97
  $this->track_ga();
98
  }
99
-
100
  function track_urchin() {
101
  $virtual = '';
102
  if ( $this->virtual )
@@ -105,13 +105,13 @@ class HSS_Analytics extends HS_SiteModule {
105
  <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
106
  </script>
107
  <script type="text/javascript">
108
- _uacct = "<?php echo $this->tracking ?>";
109
  <?php if ($this->domain) echo '_udn = "'.$this->domain.'";'."\r\n"; ?>
110
  <?php if ($this->raw) echo $this->raw."\r\n"; ?>
111
  urchinTracker(<?php echo $virtual ?>);
112
  </script>
113
  <?php
114
-
115
  // Output code for outbound tracking
116
  if ( $this->outbound ) {
117
  ?>
@@ -133,13 +133,13 @@ urchinTracker(<?php echo $virtual ?>);
133
  <?php
134
  }
135
  }
136
-
137
  function track_ga() {
138
  ?>
139
-
140
  <script type="text/javascript">
141
  var _gaq = _gaq || [];
142
- _gaq.push(['_setAccount', '<?php echo $this->tracking ?>']);
143
  _gaq.push(['_trackPageview']);
144
 
145
  <?php if ( $this->domain ) : ?>
@@ -147,7 +147,7 @@ urchinTracker(<?php echo $virtual ?>);
147
  <?php endif; ?>
148
 
149
  <?php if ( $this->virtual ) : ?>
150
- _gaq.push(['_trackPageview'], '<?php echo esc_js( $virtual ); ?>' );
151
  <?php endif; ?>
152
 
153
  <?php if ( $this->outbound ) : ?>
@@ -167,32 +167,32 @@ urchinTracker(<?php echo $virtual ?>);
167
  var s = document.getElementsByTagName('script' )[0]; s.parentNode.insertBefore(ga, s);
168
  })();
169
 
170
- </script>
171
  <?php
172
  }
173
-
174
  function load( $data ) {
175
  $load = array( 'tracking', 'role', 'outbound', 'raw', 'virtual', 'domain', 'version', 'login' );
176
-
177
  foreach ( $load AS $key ) {
178
  if ( isset( $data[$key] ) )
179
  $this->$key = $data[$key];
180
  }
181
  }
182
-
183
  function has_config() {
184
  return true;
185
  }
186
-
187
  function save_options( $data ) {
188
  $code = trim( $data['tracking'] );
189
-
190
  if ( strpos( $code, 'text/javascript' ) !== false ) {
191
  if ( strpos( $code, '_uacct' ) !== false )
192
  preg_match( '@_uacct = "(.*?)";@', $code, $matches );
193
  else
194
  preg_match( '@_getTracker\("(.*?)"\);@', $code, $matches );
195
-
196
  if ( count( $matches ) > 0 )
197
  $code = $matches[1];
198
  }
@@ -208,13 +208,13 @@ urchinTracker(<?php echo $virtual ?>);
208
  'login' => isset( $data['login'] ) ? true : false
209
  );
210
  }
211
-
212
  function edit() {
213
  ?>
214
  <tr>
215
  <th width="150"><?php _e( 'Account ID', 'headspace' ); ?>:</th>
216
  <td>
217
- <textarea rows="5" cols="40" name="tracking"><?php esc_attr_e( $this->tracking); ?></textarea><br/>
218
  <span class="sub"><?php _e( 'Enter the full Google JavaScript tracking code, or just the <code>_uacct</code> number.', 'headspace' ); ?></span>
219
  </td>
220
  </tr>
@@ -237,35 +237,35 @@ urchinTracker(<?php echo $virtual ?>);
237
  <?php endforeach; ?>
238
  </select>
239
  </select>
240
-
241
  <span class="sub"><?php _e( 'Users of the specified role or less will be tracked', 'headspace' ); ?></span>
242
  </td>
243
  </tr>
244
  <tr>
245
  <th><?php _e( 'Track outbound links', 'headspace' ); ?>:</th>
246
  <td>
247
- <input size="30" type="text" name="outbound" value="<?php esc_attr_e( $this->outbound) ?>"/>
248
  <span class="sub"><?php _e( 'Enter the URL you want outbound links tracked to', 'headspace' ); ?></span>
249
  </td>
250
  </tr>
251
  <tr>
252
  <th><?php _e( 'Virtual Pages', 'headspace' ); ?>:</th>
253
  <td>
254
- <input size="30" type="text" name="virtual" value="<?php esc_attr_e( $this->virtual) ?>"/>
255
  <span class="sub"><?php _e( 'Change what appears in reports', 'headspace' ); ?></span>
256
  </td>
257
  </tr>
258
  <tr>
259
  <th><?php _e( 'Domain Name', 'headspace' ); ?>:</th>
260
  <td>
261
- <input size="30" type="text" name="domain" value="<?php esc_attr_e( $this->domain) ?>"/>
262
  <span class="sub"><?php _e( 'Set to a root domain when tracking across sub-domains', 'headspace' ); ?></span>
263
  </td>
264
  </tr>
265
  <tr>
266
  <th><?php _e( 'Raw Code', 'headspace' ); ?>:</th>
267
  <td>
268
- <textarea rows="5" cols="40" name="raw"><?php esc_attr_e( $this->raw); ?></textarea><br/>
269
  <span class="sub"><?php _e( 'Enter any additional Google Analytics code', 'headspace' ); ?></span>
270
  </td>
271
  </tr>
@@ -276,10 +276,10 @@ urchinTracker(<?php echo $virtual ?>);
276
  <span class="sub"><?php _e( 'Include Google Analytics on the WordPress login page', 'headspace' )?></span>
277
  </td>
278
  </tr>
279
-
280
  <?php
281
  }
282
-
283
  function file() {
284
  return basename( __FILE__ );
285
  }
30
  var $domain = '';
31
  var $raw = '';
32
  var $login = false;
33
+
34
  var $trackable = null;
35
+
36
  function name() {
37
  return __( 'Google Analytics', 'headspace' );
38
  }
39
+
40
  function description() {
41
  return __( 'Adds Google Analytic tracking code to all pages (through <code>wp_footer</code>)', 'headspace' );
42
  }
43
+
44
  function run() {
45
  add_action( 'wp_footer', array( &$this, 'wp_footer' ) );
46
+
47
  if ( $this->login )
48
  add_action( 'login_head', array( &$this, 'wp_footer' ) );
49
  }
50
+
51
  function is_trackable() {
52
  if ( $this->trackable !== null )
53
  return $this->trackable;
54
+
55
  if ( is_user_logged_in () && $this->role != 'everyone' ) {
56
  $user = wp_get_current_user ();
57
+
58
  global $wp_roles;
59
  $caps = $wp_roles->get_role( $this->role );
60
+
61
  if ( $caps ) {
62
  // Calculate the highest level of the user and the role
63
  $role_level = $user_level = 0;
65
  if ( isset( $caps->capabilities['level_'.$x] ) )
66
  break;
67
  }
68
+
69
  $role_level = $x;
70
 
71
  for ( $x = 10; $x >= 0; $x-- ) {
72
  if ( isset( $user->allcaps['level_'.$x] ) )
73
  break;
74
  }
75
+
76
  $user_level = $x;
77
+
78
  // Quit if the user is greater level than the role
79
  if ( $user_level > $role_level ) {
80
  $this->is_trackable = false;
82
  }
83
  }
84
  }
85
+
86
  $this->is_trackable = true;
87
  return $this->is_trackable;
88
  }
89
+
90
  function wp_footer() {
91
  if ( $this->tracking && $this->is_trackable() && $this->version == 'urchin' )
92
  $this->track_urchin();
93
  }
94
+
95
  function head() {
96
  if ( $this->tracking && $this->is_trackable() && $this->version == 'ga' )
97
  $this->track_ga();
98
  }
99
+
100
  function track_urchin() {
101
  $virtual = '';
102
  if ( $this->virtual )
105
  <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
106
  </script>
107
  <script type="text/javascript">
108
+ _uacct = "<?php echo esc_js( $this->tracking ) ?>";
109
  <?php if ($this->domain) echo '_udn = "'.$this->domain.'";'."\r\n"; ?>
110
  <?php if ($this->raw) echo $this->raw."\r\n"; ?>
111
  urchinTracker(<?php echo $virtual ?>);
112
  </script>
113
  <?php
114
+
115
  // Output code for outbound tracking
116
  if ( $this->outbound ) {
117
  ?>
133
  <?php
134
  }
135
  }
136
+
137
  function track_ga() {
138
  ?>
139
+
140
  <script type="text/javascript">
141
  var _gaq = _gaq || [];
142
+ _gaq.push(['_setAccount', '<?php echo esc_js( $this->tracking ) ?>']);
143
  _gaq.push(['_trackPageview']);
144
 
145
  <?php if ( $this->domain ) : ?>
147
  <?php endif; ?>
148
 
149
  <?php if ( $this->virtual ) : ?>
150
+ _gaq.push(['_trackPageview'], '<?php echo esc_js( $this->virtual ); ?>' );
151
  <?php endif; ?>
152
 
153
  <?php if ( $this->outbound ) : ?>
167
  var s = document.getElementsByTagName('script' )[0]; s.parentNode.insertBefore(ga, s);
168
  })();
169
 
170
+ </script>
171
  <?php
172
  }
173
+
174
  function load( $data ) {
175
  $load = array( 'tracking', 'role', 'outbound', 'raw', 'virtual', 'domain', 'version', 'login' );
176
+
177
  foreach ( $load AS $key ) {
178
  if ( isset( $data[$key] ) )
179
  $this->$key = $data[$key];
180
  }
181
  }
182
+
183
  function has_config() {
184
  return true;
185
  }
186
+
187
  function save_options( $data ) {
188
  $code = trim( $data['tracking'] );
189
+
190
  if ( strpos( $code, 'text/javascript' ) !== false ) {
191
  if ( strpos( $code, '_uacct' ) !== false )
192
  preg_match( '@_uacct = "(.*?)";@', $code, $matches );
193
  else
194
  preg_match( '@_getTracker\("(.*?)"\);@', $code, $matches );
195
+
196
  if ( count( $matches ) > 0 )
197
  $code = $matches[1];
198
  }
208
  'login' => isset( $data['login'] ) ? true : false
209
  );
210
  }
211
+
212
  function edit() {
213
  ?>
214
  <tr>
215
  <th width="150"><?php _e( 'Account ID', 'headspace' ); ?>:</th>
216
  <td>
217
+ <textarea rows="5" cols="40" name="tracking"><?php echo esc_attr( $this->tracking); ?></textarea><br/>
218
  <span class="sub"><?php _e( 'Enter the full Google JavaScript tracking code, or just the <code>_uacct</code> number.', 'headspace' ); ?></span>
219
  </td>
220
  </tr>
237
  <?php endforeach; ?>
238
  </select>
239
  </select>
240
+
241
  <span class="sub"><?php _e( 'Users of the specified role or less will be tracked', 'headspace' ); ?></span>
242
  </td>
243
  </tr>
244
  <tr>
245
  <th><?php _e( 'Track outbound links', 'headspace' ); ?>:</th>
246
  <td>
247
+ <input size="30" type="text" name="outbound" value="<?php echo esc_attr( $this->outbound) ?>"/>
248
  <span class="sub"><?php _e( 'Enter the URL you want outbound links tracked to', 'headspace' ); ?></span>
249
  </td>
250
  </tr>
251
  <tr>
252
  <th><?php _e( 'Virtual Pages', 'headspace' ); ?>:</th>
253
  <td>
254
+ <input size="30" type="text" name="virtual" value="<?php echo esc_attr( $this->virtual) ?>"/>
255
  <span class="sub"><?php _e( 'Change what appears in reports', 'headspace' ); ?></span>
256
  </td>
257
  </tr>
258
  <tr>
259
  <th><?php _e( 'Domain Name', 'headspace' ); ?>:</th>
260
  <td>
261
+ <input size="30" type="text" name="domain" value="<?php echo esc_attr( $this->domain) ?>"/>
262
  <span class="sub"><?php _e( 'Set to a root domain when tracking across sub-domains', 'headspace' ); ?></span>
263
  </td>
264
  </tr>
265
  <tr>
266
  <th><?php _e( 'Raw Code', 'headspace' ); ?>:</th>
267
  <td>
268
+ <textarea rows="5" cols="40" name="raw"><?php echo esc_attr( $this->raw); ?></textarea><br/>
269
  <span class="sub"><?php _e( 'Enter any additional Google Analytics code', 'headspace' ); ?></span>
270
  </td>
271
  </tr>
276
  <span class="sub"><?php _e( 'Include Google Analytics on the WordPress login page', 'headspace' )?></span>
277
  </td>
278
  </tr>
279
+
280
  <?php
281
  }
282
+
283
  function file() {
284
  return basename( __FILE__ );
285
  }
modules/site/apture.php CHANGED
@@ -25,31 +25,31 @@ class HSS_Apture extends HS_SiteModule
25
  {
26
  var $role = 'everyone';
27
  var $token = '';
28
-
29
  function name ()
30
  {
31
  return __ ('Apture', 'headspace');
32
  }
33
-
34
  function description ()
35
  {
36
  return __ ('Add Apture to all pages', 'headspace');
37
  }
38
-
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
-
44
  function is_trackable ()
45
  {
46
  if (is_user_logged_in () && $this->role != 'everyone')
47
  {
48
  $user = wp_get_current_user ();
49
-
50
  global $wp_roles;
51
  $caps = $wp_roles->get_role ($this->role);
52
-
53
  if ($caps)
54
  {
55
  // Calculate the highest level of the user and the role
@@ -59,7 +59,7 @@ class HSS_Apture extends HS_SiteModule
59
  if (isset ($caps->capabilities['level_'.$x]))
60
  break;
61
  }
62
-
63
  $role_level = $x;
64
 
65
  for ($x = 10; $x >= 0; $x--)
@@ -67,9 +67,9 @@ class HSS_Apture extends HS_SiteModule
67
  if (isset ($user->allcaps['level_'.$x]))
68
  break;
69
  }
70
-
71
  $user_level = $x;
72
-
73
  // Quit if the user is greater level than the role
74
  if ($user_level > $role_level)
75
  {
@@ -78,39 +78,39 @@ class HSS_Apture extends HS_SiteModule
78
  }
79
  }
80
  }
81
-
82
  return true;
83
  }
84
-
85
  function wp_footer ()
86
  {
87
  if ($this->is_trackable ())
88
  echo '<script type="text/javascript" id="aptureScript" src="http://www.apture.com/js/apture.js?siteToken='.$this->token.'" charset="utf-8"></script>';
89
  }
90
-
91
  function load ($data)
92
  {
93
  if (isset ($data['role']))
94
  $this->role = $data['role'];
95
-
96
  if (isset ($data['token']))
97
  $this->token = $data['token'];
98
  }
99
-
100
  function has_config () { return true; }
101
-
102
  function save_options ($data)
103
  {
104
  return array ('token' => $data['token'], 'role' => $data['role']);
105
  }
106
-
107
  function edit ()
108
  {
109
  ?>
110
  <tr>
111
  <th width="150"><?php _e ('Site token', 'headspace'); ?>:</th>
112
  <td>
113
- <input type="text" name="token" value="<?php echo htmlspecialchars ($this->token); ?>"/><br/>
114
  <span class="sub"><?php _e ('Enter your site token.', 'headspace'); ?></span>
115
  </td>
116
  </tr>
@@ -120,21 +120,21 @@ class HSS_Apture extends HS_SiteModule
120
  <select name="role">
121
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
122
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
123
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
124
  <?php endforeach; ?>
125
  </select>
126
  </select>
127
-
128
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
129
  </td>
130
  </tr>
131
  <?php
132
  }
133
-
134
  function file ()
135
  {
136
  return basename (__FILE__);
137
  }
138
  }
139
 
140
- ?>
25
  {
26
  var $role = 'everyone';
27
  var $token = '';
28
+
29
  function name ()
30
  {
31
  return __ ('Apture', 'headspace');
32
  }
33
+
34
  function description ()
35
  {
36
  return __ ('Add Apture to all pages', 'headspace');
37
  }
38
+
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
+
44
  function is_trackable ()
45
  {
46
  if (is_user_logged_in () && $this->role != 'everyone')
47
  {
48
  $user = wp_get_current_user ();
49
+
50
  global $wp_roles;
51
  $caps = $wp_roles->get_role ($this->role);
52
+
53
  if ($caps)
54
  {
55
  // Calculate the highest level of the user and the role
59
  if (isset ($caps->capabilities['level_'.$x]))
60
  break;
61
  }
62
+
63
  $role_level = $x;
64
 
65
  for ($x = 10; $x >= 0; $x--)
67
  if (isset ($user->allcaps['level_'.$x]))
68
  break;
69
  }
70
+
71
  $user_level = $x;
72
+
73
  // Quit if the user is greater level than the role
74
  if ($user_level > $role_level)
75
  {
78
  }
79
  }
80
  }
81
+
82
  return true;
83
  }
84
+
85
  function wp_footer ()
86
  {
87
  if ($this->is_trackable ())
88
  echo '<script type="text/javascript" id="aptureScript" src="http://www.apture.com/js/apture.js?siteToken='.$this->token.'" charset="utf-8"></script>';
89
  }
90
+
91
  function load ($data)
92
  {
93
  if (isset ($data['role']))
94
  $this->role = $data['role'];
95
+
96
  if (isset ($data['token']))
97
  $this->token = $data['token'];
98
  }
99
+
100
  function has_config () { return true; }
101
+
102
  function save_options ($data)
103
  {
104
  return array ('token' => $data['token'], 'role' => $data['role']);
105
  }
106
+
107
  function edit ()
108
  {
109
  ?>
110
  <tr>
111
  <th width="150"><?php _e ('Site token', 'headspace'); ?>:</th>
112
  <td>
113
+ <input type="text" name="token" value="<?php echo esc_attr ($this->token); ?>"/><br/>
114
  <span class="sub"><?php _e ('Enter your site token.', 'headspace'); ?></span>
115
  </td>
116
  </tr>
120
  <select name="role">
121
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
122
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
123
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
124
  <?php endforeach; ?>
125
  </select>
126
  </select>
127
+
128
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
129
  </td>
130
  </tr>
131
  <?php
132
  }
133
+
134
  function file ()
135
  {
136
  return basename (__FILE__);
137
  }
138
  }
139
 
140
+ ?>
modules/site/awstats.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -23,36 +22,36 @@ For full license details see license.txt
23
 
24
  class HSS_AwStats extends HS_SiteModule
25
  {
26
- var $role = 'everyone';
27
  var $is_trackable = null;
28
-
29
  function name ()
30
  {
31
  return __ ('AWStats JavaScript Tracking', 'headspace');
32
  }
33
-
34
  function description ()
35
  {
36
  return __ ('Adds AWStats JavaScript tracking to all pages (through <code>wp_footer</code>)', 'headspace');
37
  }
38
-
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
-
44
  function is_trackable ()
45
  {
46
  if ($this->is_trackable !== null)
47
  return $this->is_trackable;
48
-
49
  if (is_user_logged_in () && $this->role != 'everyone')
50
  {
51
  $user = wp_get_current_user ();
52
-
53
  global $wp_roles;
54
  $caps = $wp_roles->get_role ($this->role);
55
-
56
  if ($caps)
57
  {
58
  // Calculate the highest level of the user and the role
@@ -62,7 +61,7 @@ class HSS_AwStats extends HS_SiteModule
62
  if (isset ($caps->capabilities['level_'.$x]))
63
  break;
64
  }
65
-
66
  $role_level = $x;
67
 
68
  for ($x = 10; $x >= 0; $x--)
@@ -70,9 +69,9 @@ class HSS_AwStats extends HS_SiteModule
70
  if (isset ($user->allcaps['level_'.$x]))
71
  break;
72
  }
73
-
74
  $user_level = $x;
75
-
76
  // Quit if the user is greater level than the role
77
  if ($user_level > $role_level)
78
  {
@@ -81,31 +80,31 @@ class HSS_AwStats extends HS_SiteModule
81
  }
82
  }
83
  }
84
-
85
  $this->is_trackable = true;
86
  return $this->is_trackable;
87
  }
88
-
89
  function wp_footer ()
90
  {
91
  global $headspace2;
92
  if ($this->is_trackable ())
93
- echo '<script src="'.$headspace2->url ().'/js/awstats.js" type="text/javascript" charset="utf-8"></script>';
94
  }
95
 
96
  function load ($data)
97
  {
98
  $load = array ('role');
99
-
100
  foreach ($load AS $key)
101
  {
102
  if (isset ($data[$key]))
103
  $this->$key = $data[$key];
104
  }
105
  }
106
-
107
  function has_config () { return true; }
108
-
109
  function save_options ($data)
110
  {
111
  return array
@@ -113,7 +112,7 @@ class HSS_AwStats extends HS_SiteModule
113
  'role' => $data['role'],
114
  );
115
  }
116
-
117
  function edit ()
118
  {
119
  ?>
@@ -123,21 +122,21 @@ class HSS_AwStats extends HS_SiteModule
123
  <select name="role">
124
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
125
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
126
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
127
  <?php endforeach; ?>
128
  </select>
129
  </select>
130
-
131
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
132
  </td>
133
  </tr>
134
  <?php
135
  }
136
-
137
  function file ()
138
  {
139
  return basename (__FILE__);
140
  }
141
  }
142
 
143
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
22
 
23
  class HSS_AwStats extends HS_SiteModule
24
  {
25
+ var $role = 'everyone';
26
  var $is_trackable = null;
27
+
28
  function name ()
29
  {
30
  return __ ('AWStats JavaScript Tracking', 'headspace');
31
  }
32
+
33
  function description ()
34
  {
35
  return __ ('Adds AWStats JavaScript tracking to all pages (through <code>wp_footer</code>)', 'headspace');
36
  }
37
+
38
  function run ()
39
  {
40
  add_action ('wp_footer', array (&$this, 'wp_footer'));
41
  }
42
+
43
  function is_trackable ()
44
  {
45
  if ($this->is_trackable !== null)
46
  return $this->is_trackable;
47
+
48
  if (is_user_logged_in () && $this->role != 'everyone')
49
  {
50
  $user = wp_get_current_user ();
51
+
52
  global $wp_roles;
53
  $caps = $wp_roles->get_role ($this->role);
54
+
55
  if ($caps)
56
  {
57
  // Calculate the highest level of the user and the role
61
  if (isset ($caps->capabilities['level_'.$x]))
62
  break;
63
  }
64
+
65
  $role_level = $x;
66
 
67
  for ($x = 10; $x >= 0; $x--)
69
  if (isset ($user->allcaps['level_'.$x]))
70
  break;
71
  }
72
+
73
  $user_level = $x;
74
+
75
  // Quit if the user is greater level than the role
76
  if ($user_level > $role_level)
77
  {
80
  }
81
  }
82
  }
83
+
84
  $this->is_trackable = true;
85
  return $this->is_trackable;
86
  }
87
+
88
  function wp_footer ()
89
  {
90
  global $headspace2;
91
  if ($this->is_trackable ())
92
+ echo '<script src="'.plugins_url( '/js/awstats.js', $headspace2->base_url() ).'" type="text/javascript" charset="utf-8"></script>';
93
  }
94
 
95
  function load ($data)
96
  {
97
  $load = array ('role');
98
+
99
  foreach ($load AS $key)
100
  {
101
  if (isset ($data[$key]))
102
  $this->$key = $data[$key];
103
  }
104
  }
105
+
106
  function has_config () { return true; }
107
+
108
  function save_options ($data)
109
  {
110
  return array
112
  'role' => $data['role'],
113
  );
114
  }
115
+
116
  function edit ()
117
  {
118
  ?>
122
  <select name="role">
123
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
124
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
125
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
126
  <?php endforeach; ?>
127
  </select>
128
  </select>
129
+
130
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
131
  </td>
132
  </tr>
133
  <?php
134
  }
135
+
136
  function file ()
137
  {
138
  return basename (__FILE__);
139
  }
140
  }
141
 
142
+ ?>
modules/site/crazyegg.php CHANGED
@@ -25,36 +25,36 @@ class HSS_CrazyEgg extends HS_SiteModule
25
  {
26
  var $tracking = '';
27
  var $role = 'everyone';
28
-
29
  var $trackable = null;
30
-
31
  function name ()
32
  {
33
  return __ ('CrazyEgg', 'headspace');
34
  }
35
-
36
  function description ()
37
  {
38
  return __ ('Adds CrazyEgg tracking code to all pages', 'headspace');
39
  }
40
-
41
  function run ()
42
  {
43
  add_action ('wp_footer', array (&$this, 'wp_footer'));
44
  }
45
-
46
  function is_trackable ()
47
  {
48
  if ($this->is_trackable !== null)
49
  return $this->is_trackable;
50
-
51
  if (is_user_logged_in () && $this->role != 'everyone')
52
  {
53
  $user = wp_get_current_user ();
54
-
55
  global $wp_roles;
56
  $caps = $wp_roles->get_role ($this->role);
57
-
58
  if ($caps)
59
  {
60
  // Calculate the highest level of the user and the role
@@ -64,7 +64,7 @@ class HSS_CrazyEgg extends HS_SiteModule
64
  if (isset ($caps->capabilities['level_'.$x]))
65
  break;
66
  }
67
-
68
  $role_level = $x;
69
 
70
  for ($x = 10; $x >= 0; $x--)
@@ -72,9 +72,9 @@ class HSS_CrazyEgg extends HS_SiteModule
72
  if (isset ($user->allcaps['level_'.$x]))
73
  break;
74
  }
75
-
76
  $user_level = $x;
77
-
78
  // Quit if the user is greater level than the role
79
  if ($user_level > $role_level)
80
  {
@@ -83,40 +83,40 @@ class HSS_CrazyEgg extends HS_SiteModule
83
  }
84
  }
85
  }
86
-
87
  $this->is_trackable = true;
88
  return $this->is_trackable;
89
  }
90
-
91
  function wp_footer ()
92
  {
93
  if ($this->tracking && $this->is_trackable ())
94
  echo $this->tracking;
95
  }
96
-
97
  function load ($data)
98
  {
99
  if (isset ($data['tracking']))
100
  $this->tracking = $data['tracking'];
101
-
102
  if (isset ($data['role']))
103
  $this->role = $data['role'];
104
  }
105
-
106
  function has_config () { return true; }
107
-
108
  function save_options ($data)
109
  {
110
  return array ('tracking' => $data['tracking'], 'role' => $data['role']);
111
  }
112
-
113
  function edit ()
114
  {
115
  ?>
116
  <tr>
117
  <th width="150"><?php _e ('CrazyEgg ID', 'headspace'); ?>:</th>
118
  <td>
119
- <input type="text" name="tracking" value="<?php echo htmlspecialchars ($this->tracking); ?>"/>
120
  <span class="sub"><?php _e ('Enter your full <a href="http://crazyegg.com/pages/instructions">CrazyEgg code</a>', 'headspace'); ?>.</span>
121
  </td>
122
  </tr>
@@ -126,21 +126,21 @@ class HSS_CrazyEgg extends HS_SiteModule
126
  <select name="role">
127
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
128
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
129
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
130
  <?php endforeach; ?>
131
  </select>
132
  </select>
133
-
134
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
135
  </td>
136
  </tr>
137
  <?php
138
  }
139
-
140
  function file ()
141
  {
142
  return basename (__FILE__);
143
  }
144
  }
145
 
146
- ?>
25
  {
26
  var $tracking = '';
27
  var $role = 'everyone';
28
+
29
  var $trackable = null;
30
+
31
  function name ()
32
  {
33
  return __ ('CrazyEgg', 'headspace');
34
  }
35
+
36
  function description ()
37
  {
38
  return __ ('Adds CrazyEgg tracking code to all pages', 'headspace');
39
  }
40
+
41
  function run ()
42
  {
43
  add_action ('wp_footer', array (&$this, 'wp_footer'));
44
  }
45
+
46
  function is_trackable ()
47
  {
48
  if ($this->is_trackable !== null)
49
  return $this->is_trackable;
50
+
51
  if (is_user_logged_in () && $this->role != 'everyone')
52
  {
53
  $user = wp_get_current_user ();
54
+
55
  global $wp_roles;
56
  $caps = $wp_roles->get_role ($this->role);
57
+
58
  if ($caps)
59
  {
60
  // Calculate the highest level of the user and the role
64
  if (isset ($caps->capabilities['level_'.$x]))
65
  break;
66
  }
67
+
68
  $role_level = $x;
69
 
70
  for ($x = 10; $x >= 0; $x--)
72
  if (isset ($user->allcaps['level_'.$x]))
73
  break;
74
  }
75
+
76
  $user_level = $x;
77
+
78
  // Quit if the user is greater level than the role
79
  if ($user_level > $role_level)
80
  {
83
  }
84
  }
85
  }
86
+
87
  $this->is_trackable = true;
88
  return $this->is_trackable;
89
  }
90
+
91
  function wp_footer ()
92
  {
93
  if ($this->tracking && $this->is_trackable ())
94
  echo $this->tracking;
95
  }
96
+
97
  function load ($data)
98
  {
99
  if (isset ($data['tracking']))
100
  $this->tracking = $data['tracking'];
101
+
102
  if (isset ($data['role']))
103
  $this->role = $data['role'];
104
  }
105
+
106
  function has_config () { return true; }
107
+
108
  function save_options ($data)
109
  {
110
  return array ('tracking' => $data['tracking'], 'role' => $data['role']);
111
  }
112
+
113
  function edit ()
114
  {
115
  ?>
116
  <tr>
117
  <th width="150"><?php _e ('CrazyEgg ID', 'headspace'); ?>:</th>
118
  <td>
119
+ <input type="text" name="tracking" value="<?php echo esc_attr ($this->tracking); ?>"/>
120
  <span class="sub"><?php _e ('Enter your full <a href="http://crazyegg.com/pages/instructions">CrazyEgg code</a>', 'headspace'); ?>.</span>
121
  </td>
122
  </tr>
126
  <select name="role">
127
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
128
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
129
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
130
  <?php endforeach; ?>
131
  </select>
132
  </select>
133
+
134
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
135
  </td>
136
  </tr>
137
  <?php
138
  }
139
+
140
  function file ()
141
  {
142
  return basename (__FILE__);
143
  }
144
  }
145
 
146
+ ?>
modules/site/disable_visual_editing.php CHANGED
@@ -27,26 +27,25 @@ class HSS_DisableVisual extends HS_SiteModule
27
  {
28
  return __ ('Disable Visual Editing', 'headspace');
29
  }
30
-
31
  function description ()
32
  {
33
  return __ ('Disable visual editing', 'headspace');
34
  }
35
-
36
  function can_edit ()
37
  {
38
  return false;
39
  }
40
-
41
  function run ()
42
  {
43
  add_filter ('user_can_richedit', array (&$this, 'can_edit'));
44
  }
45
-
46
  function file ()
47
  {
48
  return basename (__FILE__);
49
  }
50
  }
51
 
52
- ?>
27
  {
28
  return __ ('Disable Visual Editing', 'headspace');
29
  }
30
+
31
  function description ()
32
  {
33
  return __ ('Disable visual editing', 'headspace');
34
  }
35
+
36
  function can_edit ()
37
  {
38
  return false;
39
  }
40
+
41
  function run ()
42
  {
43
  add_filter ('user_can_richedit', array (&$this, 'can_edit'));
44
  }
45
+
46
  function file ()
47
  {
48
  return basename (__FILE__);
49
  }
50
  }
51
 
 
modules/site/feedburner-stats.php CHANGED
@@ -24,17 +24,17 @@ For full license details see license.txt
24
  class HSS_FeedburnerStats extends HS_SiteModule
25
  {
26
  var $account = '';
27
-
28
  function name ()
29
  {
30
  return __ ('Feedburner Stats Pro', 'headspace');
31
  }
32
-
33
  function description ()
34
  {
35
  return __ ('Adds appropriate code to your posts to enable FeedBurner Stats Pro', 'headspace');
36
  }
37
-
38
  function burn ($text)
39
  {
40
  return $text.'<script src="http://feeds.feedburner.com/~s/'.$this->account.'?i='.get_permalink ().'" type="text/javascript" charset="utf-8"></script>';
@@ -46,37 +46,37 @@ class HSS_FeedburnerStats extends HS_SiteModule
46
  add_filter ('the_excerpt', array (&$this, 'burn'));
47
  add_filter ('the_excerpt_reloaded', array (&$this, 'burn'));
48
  }
49
-
50
  function load ($data)
51
  {
52
  if (isset ($data['account']))
53
  $this->account = $data['account'];
54
  }
55
-
56
  function has_config () { return true; }
57
-
58
  function save_options ($data)
59
  {
60
  return array ('account' => $data['account']);
61
  }
62
-
63
  function edit ()
64
  {
65
  ?>
66
  <tr>
67
  <th width="150"><?php _e ('Account ID', 'headspace'); ?>:</th>
68
  <td>
69
- <input type="text" name="account" value="<?php echo htmlspecialchars ($this->account); ?>"/><br/>
70
  <span class="sub"><?php _e ('This is your FeedBurner username', 'headspace'); ?></span>
71
  </td>
72
  </tr>
73
  <?php
74
  }
75
-
76
  function file ()
77
  {
78
  return basename (__FILE__);
79
  }
80
  }
81
 
82
- ?>
24
  class HSS_FeedburnerStats extends HS_SiteModule
25
  {
26
  var $account = '';
27
+
28
  function name ()
29
  {
30
  return __ ('Feedburner Stats Pro', 'headspace');
31
  }
32
+
33
  function description ()
34
  {
35
  return __ ('Adds appropriate code to your posts to enable FeedBurner Stats Pro', 'headspace');
36
  }
37
+
38
  function burn ($text)
39
  {
40
  return $text.'<script src="http://feeds.feedburner.com/~s/'.$this->account.'?i='.get_permalink ().'" type="text/javascript" charset="utf-8"></script>';
46
  add_filter ('the_excerpt', array (&$this, 'burn'));
47
  add_filter ('the_excerpt_reloaded', array (&$this, 'burn'));
48
  }
49
+
50
  function load ($data)
51
  {
52
  if (isset ($data['account']))
53
  $this->account = $data['account'];
54
  }
55
+
56
  function has_config () { return true; }
57
+
58
  function save_options ($data)
59
  {
60
  return array ('account' => $data['account']);
61
  }
62
+
63
  function edit ()
64
  {
65
  ?>
66
  <tr>
67
  <th width="150"><?php _e ('Account ID', 'headspace'); ?>:</th>
68
  <td>
69
+ <input type="text" name="account" value="<?php echo esc_attr ($this->account); ?>"/><br/>
70
  <span class="sub"><?php _e ('This is your FeedBurner username', 'headspace'); ?></span>
71
  </td>
72
  </tr>
73
  <?php
74
  }
75
+
76
  function file ()
77
  {
78
  return basename (__FILE__);
79
  }
80
  }
81
 
82
+ ?>
modules/site/first-time-visitor.php CHANGED
@@ -28,17 +28,17 @@ class HSS_FirstTimeVisitor extends HS_SiteModule
28
  var $bots = true;
29
  var $position = 'content_before';
30
  var $visited = false;
31
-
32
  function name ()
33
  {
34
  return __ ('First Time Visitor', 'headspace');
35
  }
36
-
37
  function description ()
38
  {
39
  return __ ('Display a message for first time visitors (based upon idea from Seth Godin)', 'headspace');
40
  }
41
-
42
  function run ()
43
  {
44
  if (!is_admin () && !is_404 () && !is_search () && $this->is_robot () == false)
@@ -56,7 +56,7 @@ class HSS_FirstTimeVisitor extends HS_SiteModule
56
  }
57
  }
58
  }
59
-
60
  function is_robot ()
61
  {
62
  if ($this->bots)
@@ -70,7 +70,7 @@ class HSS_FirstTimeVisitor extends HS_SiteModule
70
 
71
  return false;
72
  }
73
-
74
  function content ($text)
75
  {
76
  $hs = HeadSpace2::get ();
@@ -87,26 +87,26 @@ class HSS_FirstTimeVisitor extends HS_SiteModule
87
 
88
  return $text;
89
  }
90
-
91
  function load ($data)
92
  {
93
- $this->message = sprintf (__ ('<p>As a new visitor you may want to subscribe to my <a href="%s/feed/">RSS</a> feed.</p>', 'headspace'), get_bloginfo ('home'));
94
-
95
  if (isset ($data['message']))
96
  $this->message = $data['message'];
97
-
98
  if (isset ($data['repeat']))
99
  $this->repeat = $data['repeat'];
100
-
101
  if (isset ($data['position']))
102
  $this->position = $data['position'];
103
-
104
  if (isset ($data['bots']))
105
  $this->bots = $data['bots'];
106
  }
107
-
108
  function has_config () { return true; }
109
-
110
  function save_options ($data)
111
  {
112
  return array(
@@ -116,19 +116,19 @@ class HSS_FirstTimeVisitor extends HS_SiteModule
116
  'bots' => isset ($data['bots']) ? true : false
117
  );
118
  }
119
-
120
  function edit ()
121
  {
122
  ?>
123
  <tr>
124
  <th width="150"><?php _e ('Message to display', 'headspace'); ?>:</th>
125
  <td>
126
- <textarea rows="3" cols="40" name="message"><?php echo htmlspecialchars ($this->message); ?></textarea><br/>
127
  </td>
128
  </tr>
129
  <tr>
130
  <th><?php _e ('Repeat', 'headspace'); ?>:</th>
131
- <td><input type="text" name="repeat" value="<?php echo $this->repeat ?>"/> <span class="sub"><?php _e ('Enter 0 for always', 'headspace'); ?></span></td>
132
  </tr>
133
  <tr>
134
  <th><?php _e ('Display position', 'headspace'); ?>:</th>
@@ -145,11 +145,11 @@ class HSS_FirstTimeVisitor extends HS_SiteModule
145
  </tr>
146
  <?php
147
  }
148
-
149
  function file ()
150
  {
151
  return basename (__FILE__);
152
  }
153
  }
154
 
155
- ?>
28
  var $bots = true;
29
  var $position = 'content_before';
30
  var $visited = false;
31
+
32
  function name ()
33
  {
34
  return __ ('First Time Visitor', 'headspace');
35
  }
36
+
37
  function description ()
38
  {
39
  return __ ('Display a message for first time visitors (based upon idea from Seth Godin)', 'headspace');
40
  }
41
+
42
  function run ()
43
  {
44
  if (!is_admin () && !is_404 () && !is_search () && $this->is_robot () == false)
56
  }
57
  }
58
  }
59
+
60
  function is_robot ()
61
  {
62
  if ($this->bots)
70
 
71
  return false;
72
  }
73
+
74
  function content ($text)
75
  {
76
  $hs = HeadSpace2::get ();
87
 
88
  return $text;
89
  }
90
+
91
  function load ($data)
92
  {
93
+ $this->message = sprintf (__ ('<p>As a new visitor you may want to subscribe to my <a href="%s/feed/">RSS</a> feed.</p>', 'headspace'), get_bloginfo ('url'));
94
+
95
  if (isset ($data['message']))
96
  $this->message = $data['message'];
97
+
98
  if (isset ($data['repeat']))
99
  $this->repeat = $data['repeat'];
100
+
101
  if (isset ($data['position']))
102
  $this->position = $data['position'];
103
+
104
  if (isset ($data['bots']))
105
  $this->bots = $data['bots'];
106
  }
107
+
108
  function has_config () { return true; }
109
+
110
  function save_options ($data)
111
  {
112
  return array(
116
  'bots' => isset ($data['bots']) ? true : false
117
  );
118
  }
119
+
120
  function edit ()
121
  {
122
  ?>
123
  <tr>
124
  <th width="150"><?php _e ('Message to display', 'headspace'); ?>:</th>
125
  <td>
126
+ <textarea rows="3" cols="40" name="message"><?php echo esc_html ($this->message); ?></textarea><br/>
127
  </td>
128
  </tr>
129
  <tr>
130
  <th><?php _e ('Repeat', 'headspace'); ?>:</th>
131
+ <td><input type="text" name="repeat" value="<?php echo esc_attr( $this->repeat ) ?>"/> <span class="sub"><?php _e ('Enter 0 for always', 'headspace'); ?></span></td>
132
  </tr>
133
  <tr>
134
  <th><?php _e ('Display position', 'headspace'); ?>:</th>
145
  </tr>
146
  <?php
147
  }
148
+
149
  function file ()
150
  {
151
  return basename (__FILE__);
152
  }
153
  }
154
 
155
+ ?>
modules/site/frame-breaker.php CHANGED
@@ -26,17 +26,17 @@ class HSS_FrameBreaker extends HS_SiteModule
26
  var $wpautop = false;
27
  var $clickable = true;
28
  var $wptexturize = false;
29
-
30
  function name ()
31
  {
32
  return __ ('Frame Breaker', 'headspace');
33
  }
34
-
35
  function description ()
36
  {
37
  return __ ('Stops your site being loaded in a frame.', 'headspace');
38
  }
39
-
40
  function head ()
41
  {
42
  if ($_SERVER['HTTP_REFERER'] != get_bloginfo ('wpurl').'/wp-admin/themes.php')
@@ -51,11 +51,10 @@ class HSS_FrameBreaker extends HS_SiteModule
51
  <?php
52
  }
53
  }
54
-
55
  function file ()
56
  {
57
  return basename (__FILE__);
58
  }
59
  }
60
 
61
- ?>
26
  var $wpautop = false;
27
  var $clickable = true;
28
  var $wptexturize = false;
29
+
30
  function name ()
31
  {
32
  return __ ('Frame Breaker', 'headspace');
33
  }
34
+
35
  function description ()
36
  {
37
  return __ ('Stops your site being loaded in a frame.', 'headspace');
38
  }
39
+
40
  function head ()
41
  {
42
  if ($_SERVER['HTTP_REFERER'] != get_bloginfo ('wpurl').'/wp-admin/themes.php')
51
  <?php
52
  }
53
  }
54
+
55
  function file ()
56
  {
57
  return basename (__FILE__);
58
  }
59
  }
60
 
 
modules/site/google-ad-wrap.php CHANGED
@@ -27,12 +27,12 @@ class HSS_GoogleAdWrap extends HS_SiteModule
27
  {
28
  return __ ('Google Section Targeting', 'headspace');
29
  }
30
-
31
  function description ()
32
  {
33
  return __ ('Wraps all post and page content inside a Google targeted section', 'headspace');
34
  }
35
-
36
  function google_ad_wrap ($text)
37
  {
38
  if ( !is_feed() )
@@ -47,11 +47,10 @@ class HSS_GoogleAdWrap extends HS_SiteModule
47
  add_filter ('the_excerpt_reloaded', array (&$this, 'google_ad_wrap'));
48
  add_filter ('comment_text', array (&$this, 'google_ad_wrap'));
49
  }
50
-
51
  function file ()
52
  {
53
  return basename (__FILE__);
54
  }
55
  }
56
 
57
- ?>
27
  {
28
  return __ ('Google Section Targeting', 'headspace');
29
  }
30
+
31
  function description ()
32
  {
33
  return __ ('Wraps all post and page content inside a Google targeted section', 'headspace');
34
  }
35
+
36
  function google_ad_wrap ($text)
37
  {
38
  if ( !is_feed() )
47
  add_filter ('the_excerpt_reloaded', array (&$this, 'google_ad_wrap'));
48
  add_filter ('comment_text', array (&$this, 'google_ad_wrap'));
49
  }
50
+
51
  function file ()
52
  {
53
  return basename (__FILE__);
54
  }
55
  }
56
 
 
modules/site/google_webmaster.php CHANGED
@@ -23,15 +23,15 @@ For full license details see license.txt
23
 
24
  class HSS_GoogleWebmaster extends HS_SiteModule {
25
  var $code = '';
26
-
27
  function name() {
28
  return __( 'Google Webmaster', 'headspace' );
29
  }
30
-
31
  function description() {
32
  return __( 'Adds Google Webmaster verification tag to your home page', 'headspace' );
33
  }
34
-
35
  function run() {
36
  add_filter( 'wp_head', array( &$this, 'wp_head' ) );
37
  }
@@ -46,27 +46,27 @@ class HSS_GoogleWebmaster extends HS_SiteModule {
46
  if ( isset( $data['code'] ) )
47
  $this->code = $data['code'];
48
  }
49
-
50
  function has_config() {
51
  return true;
52
  }
53
-
54
  function save_options( $data ) {
55
  return array( 'code' => $data['code'] );
56
  }
57
-
58
  function edit() {
59
  ?>
60
  <tr>
61
  <th width="150"><?php _e( 'Verification Tag', 'headspace'); ?>:</th>
62
  <td>
63
- <input size="40" name="code" type="text" value="<?php esc_attr_e( $this->code ); ?>"/><br/>
64
  <span class="sub"><?php _e( 'Enter Google Webmaster verification tag.', 'headspace' ); ?></span>
65
  </td>
66
  </tr>
67
  <?php
68
  }
69
-
70
  function file() {
71
  return basename( __FILE__ );
72
  }
23
 
24
  class HSS_GoogleWebmaster extends HS_SiteModule {
25
  var $code = '';
26
+
27
  function name() {
28
  return __( 'Google Webmaster', 'headspace' );
29
  }
30
+
31
  function description() {
32
  return __( 'Adds Google Webmaster verification tag to your home page', 'headspace' );
33
  }
34
+
35
  function run() {
36
  add_filter( 'wp_head', array( &$this, 'wp_head' ) );
37
  }
46
  if ( isset( $data['code'] ) )
47
  $this->code = $data['code'];
48
  }
49
+
50
  function has_config() {
51
  return true;
52
  }
53
+
54
  function save_options( $data ) {
55
  return array( 'code' => $data['code'] );
56
  }
57
+
58
  function edit() {
59
  ?>
60
  <tr>
61
  <th width="150"><?php _e( 'Verification Tag', 'headspace'); ?>:</th>
62
  <td>
63
+ <input size="40" name="code" type="text" value="<?php echo esc_attr( $this->code ); ?>"/><br/>
64
  <span class="sub"><?php _e( 'Enter Google Webmaster verification tag.', 'headspace' ); ?></span>
65
  </td>
66
  </tr>
67
  <?php
68
  }
69
+
70
  function file() {
71
  return basename( __FILE__ );
72
  }
modules/site/hacks.php CHANGED
@@ -24,5 +24,3 @@ For full license details see license.txt
24
  // Various hacks around bugs in other plugins
25
  if (strpos ($_SERVER['REQUEST_URI'], 'headspace.php') !== false)
26
  remove_filter ('admin_head', 'ps_imagemanager_admin_head'); // Hack so still works with ImageManager
27
-
28
- ?>
24
  // Various hacks around bugs in other plugins
25
  if (strpos ($_SERVER['REQUEST_URI'], 'headspace.php') !== false)
26
  remove_filter ('admin_head', 'ps_imagemanager_admin_head'); // Hack so still works with ImageManager
 
 
modules/site/hittail.php CHANGED
@@ -25,31 +25,31 @@ class HSS_HitTail extends HS_SiteModule
25
  {
26
  var $role = 'everyone';
27
  var $code = '';
28
-
29
  function name ()
30
  {
31
  return __ ('HitTail', 'headspace');
32
  }
33
-
34
  function description ()
35
  {
36
  return __ ('Adds HitTail tracking code to all pages', 'headspace');
37
  }
38
-
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
-
44
  function is_trackable ()
45
  {
46
  if (is_user_logged_in () && $this->role != 'everyone')
47
  {
48
  $user = wp_get_current_user ();
49
-
50
  global $wp_roles;
51
  $caps = $wp_roles->get_role ($this->role);
52
-
53
  if ($caps)
54
  {
55
  // Calculate the highest level of the user and the role
@@ -59,7 +59,7 @@ class HSS_HitTail extends HS_SiteModule
59
  if (isset ($caps->capabilities['level_'.$x]))
60
  break;
61
  }
62
-
63
  $role_level = $x;
64
 
65
  for ($x = 10; $x >= 0; $x--)
@@ -67,9 +67,9 @@ class HSS_HitTail extends HS_SiteModule
67
  if (isset ($user->allcaps['level_'.$x]))
68
  break;
69
  }
70
-
71
  $user_level = $x;
72
-
73
  // Quit if the user is greater level than the role
74
  if ($user_level > $role_level)
75
  {
@@ -78,39 +78,39 @@ class HSS_HitTail extends HS_SiteModule
78
  }
79
  }
80
  }
81
-
82
  return true;
83
  }
84
-
85
  function wp_footer ()
86
  {
87
  if ($this->is_trackable ())
88
  echo $this->code;
89
  }
90
-
91
  function load ($data)
92
  {
93
  if (isset ($data['role']))
94
  $this->role = $data['role'];
95
-
96
  if (isset ($data['code']))
97
  $this->code = $data['code'];
98
  }
99
-
100
  function has_config () { return true; }
101
-
102
  function save_options ($data)
103
  {
104
  return array ('code' => $data['code'], 'role' => $data['role']);
105
  }
106
-
107
  function edit ()
108
  {
109
  ?>
110
  <tr>
111
  <th width="150"><?php _e ('Tracking code', 'headspace'); ?>:</th>
112
  <td>
113
- <textarea rows="3" cols="40" name="code"><?php echo htmlspecialchars ($this->code); ?></textarea><br/>
114
  <span class="sub"><?php _e ('Enter the full JavaScript tracking code as provided by HitTail.', 'headspace'); ?></span>
115
  </td>
116
  </tr>
@@ -120,21 +120,20 @@ class HSS_HitTail extends HS_SiteModule
120
  <select name="role">
121
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
122
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
123
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
124
  <?php endforeach; ?>
125
  </select>
126
  </select>
127
-
128
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
129
  </td>
130
  </tr>
131
  <?php
132
  }
133
-
134
  function file ()
135
  {
136
  return basename (__FILE__);
137
  }
138
  }
139
 
140
- ?>
25
  {
26
  var $role = 'everyone';
27
  var $code = '';
28
+
29
  function name ()
30
  {
31
  return __ ('HitTail', 'headspace');
32
  }
33
+
34
  function description ()
35
  {
36
  return __ ('Adds HitTail tracking code to all pages', 'headspace');
37
  }
38
+
39
  function run ()
40
  {
41
  add_action ('wp_footer', array (&$this, 'wp_footer'));
42
  }
43
+
44
  function is_trackable ()
45
  {
46
  if (is_user_logged_in () && $this->role != 'everyone')
47
  {
48
  $user = wp_get_current_user ();
49
+
50
  global $wp_roles;
51
  $caps = $wp_roles->get_role ($this->role);
52
+
53
  if ($caps)
54
  {
55
  // Calculate the highest level of the user and the role
59
  if (isset ($caps->capabilities['level_'.$x]))
60
  break;
61
  }
62
+
63
  $role_level = $x;
64
 
65
  for ($x = 10; $x >= 0; $x--)
67
  if (isset ($user->allcaps['level_'.$x]))
68
  break;
69
  }
70
+
71
  $user_level = $x;
72
+
73
  // Quit if the user is greater level than the role
74
  if ($user_level > $role_level)
75
  {
78
  }
79
  }
80
  }
81
+
82
  return true;
83
  }
84
+
85
  function wp_footer ()
86
  {
87
  if ($this->is_trackable ())
88
  echo $this->code;
89
  }
90
+
91
  function load ($data)
92
  {
93
  if (isset ($data['role']))
94
  $this->role = $data['role'];
95
+
96
  if (isset ($data['code']))
97
  $this->code = $data['code'];
98
  }
99
+
100
  function has_config () { return true; }
101
+
102
  function save_options ($data)
103
  {
104
  return array ('code' => $data['code'], 'role' => $data['role']);
105
  }
106
+
107
  function edit ()
108
  {
109
  ?>
110
  <tr>
111
  <th width="150"><?php _e ('Tracking code', 'headspace'); ?>:</th>
112
  <td>
113
+ <textarea rows="3" cols="40" name="code"><?php echo esc_html ($this->code); ?></textarea><br/>
114
  <span class="sub"><?php _e ('Enter the full JavaScript tracking code as provided by HitTail.', 'headspace'); ?></span>
115
  </td>
116
  </tr>
120
  <select name="role">
121
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
122
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
123
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
124
  <?php endforeach; ?>
125
  </select>
126
  </select>
127
+
128
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
129
  </td>
130
  </tr>
131
  <?php
132
  }
133
+
134
  function file ()
135
  {
136
  return basename (__FILE__);
137
  }
138
  }
139
 
 
modules/site/microsoft-live.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -24,17 +23,17 @@ For full license details see license.txt
24
  class HSS_MicrosoftLive extends HS_SiteModule
25
  {
26
  var $code = '';
27
-
28
  function name ()
29
  {
30
  return __ ('Microsoft Live Verification / Bing Webmaster', 'headspace');
31
  }
32
-
33
  function description ()
34
  {
35
  return __ ('Adds Microsoft Live verification / Bing Webmaster code to your home page', 'headspace');
36
  }
37
-
38
  function run ()
39
  {
40
  add_filter ('wp_head', array (&$this, 'wp_head'));
@@ -44,39 +43,37 @@ class HSS_MicrosoftLive extends HS_SiteModule
44
  {
45
  // Only need to put this on the home page
46
  if ($this->code && is_front_page ())
47
- echo '<meta name="msvalidate.01" content="'.htmlspecialchars ($this->code).'"/>'."\r\n";
48
  }
49
-
50
  function load ($data)
51
  {
52
  if (isset ($data['code']))
53
  $this->code = $data['code'];
54
  }
55
-
56
  function has_config () { return true; }
57
-
58
  function save_options ($data)
59
  {
60
  return array ('code' => $data['code']);
61
  }
62
-
63
  function edit ()
64
  {
65
  ?>
66
  <tr>
67
  <th width="150"><?php _e ('Verification code', 'headspace'); ?>:</th>
68
  <td>
69
- <input size="40" name="code" type="text" value="<?php echo htmlspecialchars ($this->code); ?>"/><br/>
70
  <span class="sub"><?php _e ('Enter Microsoft Live verification code.', 'headspace'); ?></span>
71
  </td>
72
  </tr>
73
  <?php
74
  }
75
-
76
  function file ()
77
  {
78
  return basename (__FILE__);
79
  }
80
  }
81
-
82
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
23
  class HSS_MicrosoftLive extends HS_SiteModule
24
  {
25
  var $code = '';
26
+
27
  function name ()
28
  {
29
  return __ ('Microsoft Live Verification / Bing Webmaster', 'headspace');
30
  }
31
+
32
  function description ()
33
  {
34
  return __ ('Adds Microsoft Live verification / Bing Webmaster code to your home page', 'headspace');
35
  }
36
+
37
  function run ()
38
  {
39
  add_filter ('wp_head', array (&$this, 'wp_head'));
43
  {
44
  // Only need to put this on the home page
45
  if ($this->code && is_front_page ())
46
+ echo '<meta name="msvalidate.01" content="'.esc_attr ($this->code).'"/>'."\r\n";
47
  }
48
+
49
  function load ($data)
50
  {
51
  if (isset ($data['code']))
52
  $this->code = $data['code'];
53
  }
54
+
55
  function has_config () { return true; }
56
+
57
  function save_options ($data)
58
  {
59
  return array ('code' => $data['code']);
60
  }
61
+
62
  function edit ()
63
  {
64
  ?>
65
  <tr>
66
  <th width="150"><?php _e ('Verification code', 'headspace'); ?>:</th>
67
  <td>
68
+ <input size="40" name="code" type="text" value="<?php echo esc_attr ($this->code); ?>"/><br/>
69
  <span class="sub"><?php _e ('Enter Microsoft Live verification code.', 'headspace'); ?></span>
70
  </td>
71
  </tr>
72
  <?php
73
  }
74
+
75
  function file ()
76
  {
77
  return basename (__FILE__);
78
  }
79
  }
 
 
modules/site/mint.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -25,36 +24,36 @@ class HSS_Mint extends HS_SiteModule
25
  {
26
  var $path = '';
27
  var $role = 'everyone';
28
-
29
  var $trackable = null;
30
-
31
  function name ()
32
  {
33
  return __ ('Mint', 'headspace');
34
  }
35
-
36
  function description ()
37
  {
38
  return __ ('Adds Mint tracking code to all pages', 'headspace');
39
  }
40
-
41
  function run ()
42
  {
43
  add_action ('wp_footer', array (&$this, 'wp_footer'));
44
  }
45
-
46
  function is_trackable ()
47
  {
48
  if ($this->is_trackable !== null)
49
  return $this->is_trackable;
50
-
51
  if (is_user_logged_in () && $this->role != 'everyone')
52
  {
53
  $user = wp_get_current_user ();
54
-
55
  global $wp_roles;
56
  $caps = $wp_roles->get_role ($this->role);
57
-
58
  if ($caps)
59
  {
60
  // Calculate the highest level of the user and the role
@@ -64,7 +63,7 @@ class HSS_Mint extends HS_SiteModule
64
  if (isset ($caps->capabilities['level_'.$x]))
65
  break;
66
  }
67
-
68
  $role_level = $x;
69
 
70
  for ($x = 10; $x >= 0; $x--)
@@ -72,9 +71,9 @@ class HSS_Mint extends HS_SiteModule
72
  if (isset ($user->allcaps['level_'.$x]))
73
  break;
74
  }
75
-
76
  $user_level = $x;
77
-
78
  // Quit if the user is greater level than the role
79
  if ($user_level > $role_level)
80
  {
@@ -83,11 +82,11 @@ class HSS_Mint extends HS_SiteModule
83
  }
84
  }
85
  }
86
-
87
  $this->is_trackable = true;
88
  return $this->is_trackable;
89
  }
90
-
91
  function wp_footer ()
92
  {
93
  if ($this->path && $this->is_trackable ())
@@ -97,30 +96,30 @@ class HSS_Mint extends HS_SiteModule
97
  <?php
98
  }
99
  }
100
-
101
  function load ($data)
102
  {
103
  if (isset ($data['path']))
104
  $this->path = $data['path'];
105
-
106
  if (isset ($data['role']))
107
  $this->role = $data['role'];
108
  }
109
-
110
  function has_config () { return true; }
111
-
112
  function save_options ($data)
113
  {
114
  return array ('path' => $data['path'], 'role' => $data['role']);
115
  }
116
-
117
  function edit ()
118
  {
119
  ?>
120
  <tr>
121
  <th width="150"><?php _e ('Mint path', 'headspace'); ?>:</th>
122
  <td>
123
- <input type="text" name="path" value="<?php echo htmlspecialchars ($this->path); ?>"/>
124
  <span class="sub"><?php _e ('Enter the URL of your Mint installation (i.e. <code>/mint/</code>).', 'headspace'); ?></span>
125
  </td>
126
  </tr>
@@ -130,21 +129,19 @@ class HSS_Mint extends HS_SiteModule
130
  <select name="role">
131
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
132
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
133
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
134
  <?php endforeach; ?>
135
  </select>
136
  </select>
137
-
138
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
139
  </td>
140
  </tr>
141
  <?php
142
  }
143
-
144
  function file ()
145
  {
146
  return basename (__FILE__);
147
  }
148
  }
149
-
150
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
24
  {
25
  var $path = '';
26
  var $role = 'everyone';
27
+
28
  var $trackable = null;
29
+
30
  function name ()
31
  {
32
  return __ ('Mint', 'headspace');
33
  }
34
+
35
  function description ()
36
  {
37
  return __ ('Adds Mint tracking code to all pages', 'headspace');
38
  }
39
+
40
  function run ()
41
  {
42
  add_action ('wp_footer', array (&$this, 'wp_footer'));
43
  }
44
+
45
  function is_trackable ()
46
  {
47
  if ($this->is_trackable !== null)
48
  return $this->is_trackable;
49
+
50
  if (is_user_logged_in () && $this->role != 'everyone')
51
  {
52
  $user = wp_get_current_user ();
53
+
54
  global $wp_roles;
55
  $caps = $wp_roles->get_role ($this->role);
56
+
57
  if ($caps)
58
  {
59
  // Calculate the highest level of the user and the role
63
  if (isset ($caps->capabilities['level_'.$x]))
64
  break;
65
  }
66
+
67
  $role_level = $x;
68
 
69
  for ($x = 10; $x >= 0; $x--)
71
  if (isset ($user->allcaps['level_'.$x]))
72
  break;
73
  }
74
+
75
  $user_level = $x;
76
+
77
  // Quit if the user is greater level than the role
78
  if ($user_level > $role_level)
79
  {
82
  }
83
  }
84
  }
85
+
86
  $this->is_trackable = true;
87
  return $this->is_trackable;
88
  }
89
+
90
  function wp_footer ()
91
  {
92
  if ($this->path && $this->is_trackable ())
96
  <?php
97
  }
98
  }
99
+
100
  function load ($data)
101
  {
102
  if (isset ($data['path']))
103
  $this->path = $data['path'];
104
+
105
  if (isset ($data['role']))
106
  $this->role = $data['role'];
107
  }
108
+
109
  function has_config () { return true; }
110
+
111
  function save_options ($data)
112
  {
113
  return array ('path' => $data['path'], 'role' => $data['role']);
114
  }
115
+
116
  function edit ()
117
  {
118
  ?>
119
  <tr>
120
  <th width="150"><?php _e ('Mint path', 'headspace'); ?>:</th>
121
  <td>
122
+ <input type="text" name="path" value="<?php echo esc_attr ($this->path); ?>"/>
123
  <span class="sub"><?php _e ('Enter the URL of your Mint installation (i.e. <code>/mint/</code>).', 'headspace'); ?></span>
124
  </td>
125
  </tr>
129
  <select name="role">
130
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
131
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
132
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
133
  <?php endforeach; ?>
134
  </select>
135
  </select>
136
+
137
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
138
  </td>
139
  </tr>
140
  <?php
141
  }
142
+
143
  function file ()
144
  {
145
  return basename (__FILE__);
146
  }
147
  }
 
 
modules/site/page_counts.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -27,37 +26,37 @@ class HSS_PageCounts extends HS_SiteModule
27
  var $archive_display = 'default';
28
  var $search_count = 0;
29
  var $search_display = 'default';
30
-
31
  function name ()
32
  {
33
  return __ ('Page Counts', 'headspace');
34
  }
35
-
36
  function description ()
37
  {
38
  return __ ('Customise the number of posts shown on the archive and search pages, and decide whether to show full content or the excerpt', 'headspace');
39
  }
40
-
41
  function run ()
42
  {
43
  if ($this->archive_count > 0 || $this->search_count > 0)
44
  add_filter ('pre_option_posts_per_page', array (&$this, 'posts_per_page'));
45
-
46
  if ($this->archive_display != 'default' || $this->search_display != 'default')
47
  add_action ('the_posts', array (&$this, 'content'));
48
  }
49
-
50
  function content ($posts)
51
  {
52
  if (is_search () && $this->search_display != 'default')
53
  return $this->modify ($posts, $this->search_display);
54
-
55
  if (is_archive () && $this->archive_display != 'default')
56
  return $this->modify ($posts, $this->archive_display);
57
-
58
  return $posts;
59
  }
60
-
61
  function modify ($posts, $type)
62
  {
63
  if (count ($posts) > 0)
@@ -70,50 +69,50 @@ class HSS_PageCounts extends HS_SiteModule
70
  $posts[$pos]->post_excerpt = $post->post_content;
71
  }
72
  }
73
-
74
  return $posts;
75
  }
76
-
77
  function posts_per_page ($thing)
78
  {
79
  if (is_archive ())
80
  return $this->archive_count;
81
-
82
  else if (is_search ())
83
  return $this->search_count;
84
-
85
  return false;
86
  }
87
-
88
  function load ($data)
89
  {
90
  if (isset ($data['archive_count']))
91
  $this->archive_count = $data['archive_count'];
92
-
93
  if (isset ($data['search_count']))
94
  $this->search_count = $data['search_count'];
95
-
96
  if (isset ($data['archive_display']))
97
  $this->archive_display = $data['archive_display'];
98
-
99
  if (isset ($data['search_display']))
100
  $this->search_display = $data['search_display'];
101
  }
102
-
103
  function has_config () { return true; }
104
-
105
  function save_options ($data)
106
  {
107
  return array ('archive_count' => intval ($data['archive_count']), 'archive_display' => $data['archive_display'], 'search_count' => intval ($data['search_count']), 'search_display' => $data['search_display']);
108
  }
109
-
110
  function edit ()
111
  {
112
  ?>
113
  <tr>
114
  <th width="50"><?php _e ('Archives', 'headspace'); ?>:</th>
115
  <td>
116
- <input type="text" size="5" name="archive_count" value="<?php echo $this->archive_count; ?>"/> <?php _e ('posts, showing the', 'headspace'); ?>
117
  <select name="archive_display">
118
  <option value="default"<?php if ($this->archive_display == 'default') echo ' selected="selected"' ?>><?php _e ('default', 'headspace'); ?></option>
119
  <option value="content"<?php if ($this->archive_display == 'content') echo ' selected="selected"' ?>><?php _e ('content', 'headspace'); ?></option>
@@ -125,7 +124,7 @@ class HSS_PageCounts extends HS_SiteModule
125
  <tr>
126
  <th width="50"><?php _e ('Searches', 'headspace'); ?>:</th>
127
  <td>
128
- <input type="text" size="5" name="search_count" value="<?php echo $this->search_count; ?>"/> <?php _e ('posts, showing the', 'headspace'); ?>
129
  <select name="search_display">
130
  <option value="default"<?php if ($this->search_display == 'default') echo ' selected="selected"' ?>><?php _e ('default', 'headspace'); ?></option>
131
  <option value="content"<?php if ($this->search_display == 'content') echo ' selected="selected"' ?>><?php _e ('content', 'headspace'); ?></option>
@@ -136,11 +135,10 @@ class HSS_PageCounts extends HS_SiteModule
136
  </tr>
137
  <?php
138
  }
139
-
140
  function file ()
141
  {
142
  return basename (__FILE__);
143
  }
144
  }
145
 
146
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
26
  var $archive_display = 'default';
27
  var $search_count = 0;
28
  var $search_display = 'default';
29
+
30
  function name ()
31
  {
32
  return __ ('Page Counts', 'headspace');
33
  }
34
+
35
  function description ()
36
  {
37
  return __ ('Customise the number of posts shown on the archive and search pages, and decide whether to show full content or the excerpt', 'headspace');
38
  }
39
+
40
  function run ()
41
  {
42
  if ($this->archive_count > 0 || $this->search_count > 0)
43
  add_filter ('pre_option_posts_per_page', array (&$this, 'posts_per_page'));
44
+
45
  if ($this->archive_display != 'default' || $this->search_display != 'default')
46
  add_action ('the_posts', array (&$this, 'content'));
47
  }
48
+
49
  function content ($posts)
50
  {
51
  if (is_search () && $this->search_display != 'default')
52
  return $this->modify ($posts, $this->search_display);
53
+
54
  if (is_archive () && $this->archive_display != 'default')
55
  return $this->modify ($posts, $this->archive_display);
56
+
57
  return $posts;
58
  }
59
+
60
  function modify ($posts, $type)
61
  {
62
  if (count ($posts) > 0)
69
  $posts[$pos]->post_excerpt = $post->post_content;
70
  }
71
  }
72
+
73
  return $posts;
74
  }
75
+
76
  function posts_per_page ($thing)
77
  {
78
  if (is_archive ())
79
  return $this->archive_count;
80
+
81
  else if (is_search ())
82
  return $this->search_count;
83
+
84
  return false;
85
  }
86
+
87
  function load ($data)
88
  {
89
  if (isset ($data['archive_count']))
90
  $this->archive_count = $data['archive_count'];
91
+
92
  if (isset ($data['search_count']))
93
  $this->search_count = $data['search_count'];
94
+
95
  if (isset ($data['archive_display']))
96
  $this->archive_display = $data['archive_display'];
97
+
98
  if (isset ($data['search_display']))
99
  $this->search_display = $data['search_display'];
100
  }
101
+
102
  function has_config () { return true; }
103
+
104
  function save_options ($data)
105
  {
106
  return array ('archive_count' => intval ($data['archive_count']), 'archive_display' => $data['archive_display'], 'search_count' => intval ($data['search_count']), 'search_display' => $data['search_display']);
107
  }
108
+
109
  function edit ()
110
  {
111
  ?>
112
  <tr>
113
  <th width="50"><?php _e ('Archives', 'headspace'); ?>:</th>
114
  <td>
115
+ <input type="text" size="5" name="archive_count" value="<?php echo esc_attr($this->archive_count ); ?>"/> <?php _e ('posts, showing the', 'headspace'); ?>
116
  <select name="archive_display">
117
  <option value="default"<?php if ($this->archive_display == 'default') echo ' selected="selected"' ?>><?php _e ('default', 'headspace'); ?></option>
118
  <option value="content"<?php if ($this->archive_display == 'content') echo ' selected="selected"' ?>><?php _e ('content', 'headspace'); ?></option>
124
  <tr>
125
  <th width="50"><?php _e ('Searches', 'headspace'); ?>:</th>
126
  <td>
127
+ <input type="text" size="5" name="search_count" value="<?php echo esc_attr( $this->search_count ); ?>"/> <?php _e ('posts, showing the', 'headspace'); ?>
128
  <select name="search_display">
129
  <option value="default"<?php if ($this->search_display == 'default') echo ' selected="selected"' ?>><?php _e ('default', 'headspace'); ?></option>
130
  <option value="content"<?php if ($this->search_display == 'content') echo ' selected="selected"' ?>><?php _e ('content', 'headspace'); ?></option>
135
  </tr>
136
  <?php
137
  }
138
+
139
  function file ()
140
  {
141
  return basename (__FILE__);
142
  }
143
  }
144
 
 
modules/site/piwik.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -32,34 +31,34 @@ class HSS_Piwik extends HS_SiteModule
32
  var $pause = 250;
33
  var $role = 'everyone';
34
  var $is_trackable = null;
35
-
36
  function name ()
37
  {
38
  return __ ('Piwik', 'headspace');
39
  }
40
-
41
  function description ()
42
  {
43
  return __ ('Adds Piwik tracking code to all pages', 'headspace');
44
  }
45
-
46
  function run ()
47
  {
48
  add_action ('wp_footer', array (&$this, 'wp_footer'));
49
  }
50
-
51
  function is_trackable ()
52
  {
53
  if ($this->is_trackable !== null)
54
  return $this->is_trackable;
55
-
56
  if (is_user_logged_in () && $this->role != 'everyone')
57
  {
58
  $user = wp_get_current_user ();
59
-
60
  global $wp_roles;
61
  $caps = $wp_roles->get_role ($this->role);
62
-
63
  if ($caps)
64
  {
65
  // Calculate the highest level of the user and the role
@@ -69,7 +68,7 @@ class HSS_Piwik extends HS_SiteModule
69
  if (isset ($caps->capabilities['level_'.$x]))
70
  break;
71
  }
72
-
73
  $role_level = $x;
74
 
75
  for ($x = 10; $x >= 0; $x--)
@@ -77,9 +76,9 @@ class HSS_Piwik extends HS_SiteModule
77
  if (isset ($user->allcaps['level_'.$x]))
78
  break;
79
  }
80
-
81
  $user_level = $x;
82
-
83
  // Quit if the user is greater level than the role
84
  if ($user_level > $role_level)
85
  {
@@ -88,11 +87,11 @@ class HSS_Piwik extends HS_SiteModule
88
  }
89
  }
90
  }
91
-
92
  $this->is_trackable = true;
93
  return $this->is_trackable;
94
  }
95
-
96
  function wp_footer ()
97
  {
98
  if ($this->piwik_id && $this->is_trackable ())
@@ -103,12 +102,12 @@ class HSS_Piwik extends HS_SiteModule
103
  $full = array ();
104
  foreach ($aliases AS $alias)
105
  $full[] = '"'.$alias.'"';
106
-
107
  $aliases = implode (', ', $full);
108
  }
109
  else
110
  $aliases = '';
111
-
112
  ?>
113
  <script type="text/javascript" src="<?php echo $this->piwik_js ?>"></script>
114
  <script type="text/javascript">
@@ -119,7 +118,7 @@ class HSS_Piwik extends HS_SiteModule
119
  <?php if ($this->downloads == '') : ?>
120
  piwik_install_tracker = 0;
121
  <?php elseif ($this->downloads != $this->default) : ?>
122
- piwik_download_extensions = "<?php echo htmlspecialchars ($this->downloads) ?>";
123
  <?php endif; ?>
124
  <?php if ($this->pause != 250) : ?>
125
  piwik_tracker_pause = <?php echo $this->pause; ?>;
@@ -133,33 +132,33 @@ class HSS_Piwik extends HS_SiteModule
133
  <?php
134
  }
135
  }
136
-
137
  function load ($data)
138
  {
139
  if (isset ($data['piwik_js']))
140
  $this->piwik_js = $data['piwik_js'];
141
-
142
  if (isset ($data['piwik_id']))
143
  $this->piwik_id = $data['piwik_id'];
144
-
145
  if (isset ($data['piwik_php']))
146
  $this->piwik_php = $data['piwik_php'];
147
 
148
  if (isset ($data['downloads']))
149
  $this->downloads = $data['downloads'];
150
-
151
  if (isset ($data['aliases']))
152
  $this->aliases = $data['aliases'];
153
-
154
  if (isset ($data['pause']))
155
  $this->pause = $data['pause'];
156
-
157
  if (isset ($data['role']))
158
  $this->role = $data['role'];
159
  }
160
-
161
  function has_config () { return true; }
162
-
163
  function save_options ($data)
164
  {
165
  return array
@@ -173,7 +172,7 @@ class HSS_Piwik extends HS_SiteModule
173
  'pause' => intval ($data['pause'])
174
  );
175
  }
176
-
177
  function edit ()
178
  {
179
  ?>
@@ -187,35 +186,35 @@ class HSS_Piwik extends HS_SiteModule
187
  <tr>
188
  <th width="150"><?php _e ('Piwik PHP', 'headspace'); ?>:</th>
189
  <td>
190
- <input type="text" name="piwik_php" value="<?php echo htmlspecialchars ($this->piwik_php); ?>"/>
191
  <span class="sub"><?php _e ('The location of the Piwik PHP file (i.e. <code>/piwik/piwik.php</code>)', 'headspace'); ?></span>
192
  </td>
193
  </tr>
194
  <tr>
195
  <th width="150"><?php _e ('Piwik JavaScript', 'headspace'); ?>:</th>
196
  <td>
197
- <input type="text" name="piwik_js" value="<?php echo htmlspecialchars ($this->piwik_js); ?>"/>
198
  <span class="sub"><?php _e ('The location of the Piwik JavaScript file (i.e. <code>/piwik/piwik.js</code>)', 'headspace') ?></span>
199
  </td>
200
  </tr>
201
  <tr>
202
  <th width="150"><?php _e ('Track downloads', 'headspace'); ?>:</th>
203
  <td>
204
- <input id="piwik_downloads" type="text" name="downloads" style="width: 95%" value="<?php echo htmlspecialchars ($this->downloads); ?>"/><br/>
205
  <span class="sub"><?php _e ('Clear to disable download tracking', 'headspace') ?> - <a href="#" onclick="jQuery('#piwik_downloads').val ('<?php echo $this->default ?>'); return false"><?php _e ('reset to default', 'headspace') ?></a></span>
206
  </td>
207
  </tr>
208
  <tr>
209
  <th width="150"><?php _e ('Tracker pause', 'headspace'); ?>:</th>
210
  <td>
211
- <input type="text" name="pause" style="width: 95%" value="<?php echo $this->pause; ?>"/><br/>
212
  <span class="sub"><?php _e ('A pause (milliseconds) added when a file is downloaded. Small values may not be tracked', 'headspace') ?></span>
213
  </td>
214
  </tr>
215
  <tr>
216
  <th width="150"><?php _e ('Host aliases', 'headspace'); ?>:</th>
217
  <td>
218
- <textarea name="aliases" style="width: 95%" rows="4"><?php echo htmlspecialchars ($this->aliases); ?></textarea><br/>
219
  <span class="sub"><?php _e ('Enter each host on a separate line', 'headspace') ?></span>
220
  </td>
221
  </tr>
@@ -225,21 +224,20 @@ class HSS_Piwik extends HS_SiteModule
225
  <select name="role">
226
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
227
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
228
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
229
  <?php endforeach; ?>
230
  </select>
231
  </select>
232
-
233
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
234
  </td>
235
  </tr>
236
  <?php
237
  }
238
-
239
  function file ()
240
  {
241
  return basename (__FILE__);
242
  }
243
  }
244
 
245
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
31
  var $pause = 250;
32
  var $role = 'everyone';
33
  var $is_trackable = null;
34
+
35
  function name ()
36
  {
37
  return __ ('Piwik', 'headspace');
38
  }
39
+
40
  function description ()
41
  {
42
  return __ ('Adds Piwik tracking code to all pages', 'headspace');
43
  }
44
+
45
  function run ()
46
  {
47
  add_action ('wp_footer', array (&$this, 'wp_footer'));
48
  }
49
+
50
  function is_trackable ()
51
  {
52
  if ($this->is_trackable !== null)
53
  return $this->is_trackable;
54
+
55
  if (is_user_logged_in () && $this->role != 'everyone')
56
  {
57
  $user = wp_get_current_user ();
58
+
59
  global $wp_roles;
60
  $caps = $wp_roles->get_role ($this->role);
61
+
62
  if ($caps)
63
  {
64
  // Calculate the highest level of the user and the role
68
  if (isset ($caps->capabilities['level_'.$x]))
69
  break;
70
  }
71
+
72
  $role_level = $x;
73
 
74
  for ($x = 10; $x >= 0; $x--)
76
  if (isset ($user->allcaps['level_'.$x]))
77
  break;
78
  }
79
+
80
  $user_level = $x;
81
+
82
  // Quit if the user is greater level than the role
83
  if ($user_level > $role_level)
84
  {
87
  }
88
  }
89
  }
90
+
91
  $this->is_trackable = true;
92
  return $this->is_trackable;
93
  }
94
+
95
  function wp_footer ()
96
  {
97
  if ($this->piwik_id && $this->is_trackable ())
102
  $full = array ();
103
  foreach ($aliases AS $alias)
104
  $full[] = '"'.$alias.'"';
105
+
106
  $aliases = implode (', ', $full);
107
  }
108
  else
109
  $aliases = '';
110
+
111
  ?>
112
  <script type="text/javascript" src="<?php echo $this->piwik_js ?>"></script>
113
  <script type="text/javascript">
118
  <?php if ($this->downloads == '') : ?>
119
  piwik_install_tracker = 0;
120
  <?php elseif ($this->downloads != $this->default) : ?>
121
+ piwik_download_extensions = "<?php echo esc_js($this->downloads) ?>";
122
  <?php endif; ?>
123
  <?php if ($this->pause != 250) : ?>
124
  piwik_tracker_pause = <?php echo $this->pause; ?>;
132
  <?php
133
  }
134
  }
135
+
136
  function load ($data)
137
  {
138
  if (isset ($data['piwik_js']))
139
  $this->piwik_js = $data['piwik_js'];
140
+
141
  if (isset ($data['piwik_id']))
142
  $this->piwik_id = $data['piwik_id'];
143
+
144
  if (isset ($data['piwik_php']))
145
  $this->piwik_php = $data['piwik_php'];
146
 
147
  if (isset ($data['downloads']))
148
  $this->downloads = $data['downloads'];
149
+
150
  if (isset ($data['aliases']))
151
  $this->aliases = $data['aliases'];
152
+
153
  if (isset ($data['pause']))
154
  $this->pause = $data['pause'];
155
+
156
  if (isset ($data['role']))
157
  $this->role = $data['role'];
158
  }
159
+
160
  function has_config () { return true; }
161
+
162
  function save_options ($data)
163
  {
164
  return array
172
  'pause' => intval ($data['pause'])
173
  );
174
  }
175
+
176
  function edit ()
177
  {
178
  ?>
186
  <tr>
187
  <th width="150"><?php _e ('Piwik PHP', 'headspace'); ?>:</th>
188
  <td>
189
+ <input type="text" name="piwik_php" value="<?php echo esc_attr ($this->piwik_php); ?>"/>
190
  <span class="sub"><?php _e ('The location of the Piwik PHP file (i.e. <code>/piwik/piwik.php</code>)', 'headspace'); ?></span>
191
  </td>
192
  </tr>
193
  <tr>
194
  <th width="150"><?php _e ('Piwik JavaScript', 'headspace'); ?>:</th>
195
  <td>
196
+ <input type="text" name="piwik_js" value="<?php echo esc_attr ($this->piwik_js); ?>"/>
197
  <span class="sub"><?php _e ('The location of the Piwik JavaScript file (i.e. <code>/piwik/piwik.js</code>)', 'headspace') ?></span>
198
  </td>
199
  </tr>
200
  <tr>
201
  <th width="150"><?php _e ('Track downloads', 'headspace'); ?>:</th>
202
  <td>
203
+ <input id="piwik_downloads" type="text" name="downloads" style="width: 95%" value="<?php echo esc_attr ($this->downloads); ?>"/><br/>
204
  <span class="sub"><?php _e ('Clear to disable download tracking', 'headspace') ?> - <a href="#" onclick="jQuery('#piwik_downloads').val ('<?php echo $this->default ?>'); return false"><?php _e ('reset to default', 'headspace') ?></a></span>
205
  </td>
206
  </tr>
207
  <tr>
208
  <th width="150"><?php _e ('Tracker pause', 'headspace'); ?>:</th>
209
  <td>
210
+ <input type="text" name="pause" style="width: 95%" value="<?php echo esc_attr( $this->pause ); ?>"/><br/>
211
  <span class="sub"><?php _e ('A pause (milliseconds) added when a file is downloaded. Small values may not be tracked', 'headspace') ?></span>
212
  </td>
213
  </tr>
214
  <tr>
215
  <th width="150"><?php _e ('Host aliases', 'headspace'); ?>:</th>
216
  <td>
217
+ <textarea name="aliases" style="width: 95%" rows="4"><?php echo esc_html ($this->aliases); ?></textarea><br/>
218
  <span class="sub"><?php _e ('Enter each host on a separate line', 'headspace') ?></span>
219
  </td>
220
  </tr>
224
  <select name="role">
225
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
226
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
227
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
228
  <?php endforeach; ?>
229
  </select>
230
  </select>
231
+
232
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
233
  </td>
234
  </tr>
235
  <?php
236
  }
237
+
238
  function file ()
239
  {
240
  return basename (__FILE__);
241
  }
242
  }
243
 
 
modules/site/statcounter.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -27,36 +26,36 @@ class HSS_StatCounter extends HS_SiteModule
27
  var $partition = 0;
28
  var $security = '';
29
  var $role = 'everyone';
30
-
31
  var $trackable = null;
32
-
33
  function name ()
34
  {
35
  return __ ('StatCounter', 'headspace');
36
  }
37
-
38
  function description ()
39
  {
40
  return __ ('Adds StatCounter tracking code to all pages', 'headspace');
41
  }
42
-
43
  function run ()
44
  {
45
  add_action ('wp_footer', array (&$this, 'wp_footer'));
46
  }
47
-
48
  function is_trackable ()
49
  {
50
  if ($this->is_trackable !== null)
51
  return $this->is_trackable;
52
-
53
  if (is_user_logged_in () && $this->role != 'everyone')
54
  {
55
  $user = wp_get_current_user ();
56
-
57
  global $wp_roles;
58
  $caps = $wp_roles->get_role ($this->role);
59
-
60
  if ($caps)
61
  {
62
  // Calculate the highest level of the user and the role
@@ -66,7 +65,7 @@ class HSS_StatCounter extends HS_SiteModule
66
  if (isset ($caps->capabilities['level_'.$x]))
67
  break;
68
  }
69
-
70
  $role_level = $x;
71
 
72
  for ($x = 10; $x >= 0; $x--)
@@ -74,9 +73,9 @@ class HSS_StatCounter extends HS_SiteModule
74
  if (isset ($user->allcaps['level_'.$x]))
75
  break;
76
  }
77
-
78
  $user_level = $x;
79
-
80
  // Quit if the user is greater level than the role
81
  if ($user_level > $role_level)
82
  {
@@ -85,28 +84,28 @@ class HSS_StatCounter extends HS_SiteModule
85
  }
86
  }
87
  }
88
-
89
  $this->is_trackable = true;
90
  return $this->is_trackable;
91
  }
92
-
93
  function wp_footer ()
94
  {
95
  if ($this->project > 0 && $this->partition > 0 && $this->security && $this->is_trackable ())
96
  {
97
  ?>
98
  <script type="text/javascript">
99
- var sc_project = <?php echo $this->project ?>;
100
- var sc_invisible = 1;
101
- var sc_partition = <?php echo $this->partition ?>;
102
- var sc_security = "<?php echo $this->security; ?>";
103
- var sc_remove_link = 1;
104
  </script>
105
  <script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
106
  <?php
107
  }
108
  }
109
-
110
  function load ($data)
111
  {
112
  if (isset ($data['project']))
@@ -114,64 +113,64 @@ class HSS_StatCounter extends HS_SiteModule
114
 
115
  if (isset ($data['partition']))
116
  $this->partition = $data['partition'];
117
-
118
  if (isset ($data['security']))
119
  $this->security = $data['security'];
120
-
121
  if (isset ($data['role']))
122
  $this->role = $data['role'];
123
  }
124
-
125
  function has_config () { return true; }
126
-
127
  function save_options ($data)
128
  {
129
  return array ('project' => intval ($data['project']), 'partition' => intval ($data['partition']), 'security' => $data['security'], 'role' => $data['role']);
130
  }
131
-
132
  function edit ()
133
  {
134
  ?>
135
  <tr>
136
  <th width="150"><?php _e ('Project ID', 'headspace'); ?>:</th>
137
  <td>
138
- <input type="text" name="project" value="<?php echo $this->project; ?>"/>
139
  </td>
140
  </tr>
141
  <tr>
142
  <th width="150"><?php _e ('Partition ID', 'headspace'); ?>:</th>
143
  <td>
144
- <input type="text" name="partition" value="<?php echo $this->partition; ?>"/>
145
  </td>
146
  </tr>
147
  <tr>
148
  <th width="150"><?php _e ('Security ID', 'headspace'); ?>:</th>
149
  <td>
150
- <input type="text" name="security" value="<?php echo htmlspecialchars ($this->security); ?>"/>
151
  </td>
152
  </tr>
153
-
154
  <tr>
155
  <th><?php _e ('Who to track', 'headspace'); ?>:</th>
156
  <td>
157
  <select name="role">
158
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
159
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
160
- <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo $rolename ?></option>
161
  <?php endforeach; ?>
162
  </select>
163
  </select>
164
-
165
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
166
  </td>
167
  </tr>
168
  <?php
169
  }
170
-
171
  function file ()
172
  {
173
  return basename (__FILE__);
174
  }
175
  }
176
 
177
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
26
  var $partition = 0;
27
  var $security = '';
28
  var $role = 'everyone';
29
+
30
  var $trackable = null;
31
+
32
  function name ()
33
  {
34
  return __ ('StatCounter', 'headspace');
35
  }
36
+
37
  function description ()
38
  {
39
  return __ ('Adds StatCounter tracking code to all pages', 'headspace');
40
  }
41
+
42
  function run ()
43
  {
44
  add_action ('wp_footer', array (&$this, 'wp_footer'));
45
  }
46
+
47
  function is_trackable ()
48
  {
49
  if ($this->is_trackable !== null)
50
  return $this->is_trackable;
51
+
52
  if (is_user_logged_in () && $this->role != 'everyone')
53
  {
54
  $user = wp_get_current_user ();
55
+
56
  global $wp_roles;
57
  $caps = $wp_roles->get_role ($this->role);
58
+
59
  if ($caps)
60
  {
61
  // Calculate the highest level of the user and the role
65
  if (isset ($caps->capabilities['level_'.$x]))
66
  break;
67
  }
68
+
69
  $role_level = $x;
70
 
71
  for ($x = 10; $x >= 0; $x--)
73
  if (isset ($user->allcaps['level_'.$x]))
74
  break;
75
  }
76
+
77
  $user_level = $x;
78
+
79
  // Quit if the user is greater level than the role
80
  if ($user_level > $role_level)
81
  {
84
  }
85
  }
86
  }
87
+
88
  $this->is_trackable = true;
89
  return $this->is_trackable;
90
  }
91
+
92
  function wp_footer ()
93
  {
94
  if ($this->project > 0 && $this->partition > 0 && $this->security && $this->is_trackable ())
95
  {
96
  ?>
97
  <script type="text/javascript">
98
+ var sc_project = <?php echo esc_js( $this->project ) ?>;
99
+ var sc_invisible = 1;
100
+ var sc_partition = <?php echo esc_js( $this->partition ) ?>;
101
+ var sc_security = "<?php echo esc_js( $this->security ); ?>";
102
+ var sc_remove_link = 1;
103
  </script>
104
  <script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
105
  <?php
106
  }
107
  }
108
+
109
  function load ($data)
110
  {
111
  if (isset ($data['project']))
113
 
114
  if (isset ($data['partition']))
115
  $this->partition = $data['partition'];
116
+
117
  if (isset ($data['security']))
118
  $this->security = $data['security'];
119
+
120
  if (isset ($data['role']))
121
  $this->role = $data['role'];
122
  }
123
+
124
  function has_config () { return true; }
125
+
126
  function save_options ($data)
127
  {
128
  return array ('project' => intval ($data['project']), 'partition' => intval ($data['partition']), 'security' => $data['security'], 'role' => $data['role']);
129
  }
130
+
131
  function edit ()
132
  {
133
  ?>
134
  <tr>
135
  <th width="150"><?php _e ('Project ID', 'headspace'); ?>:</th>
136
  <td>
137
+ <input type="text" name="project" value="<?php echo esc_attr( $this->project ); ?>"/>
138
  </td>
139
  </tr>
140
  <tr>
141
  <th width="150"><?php _e ('Partition ID', 'headspace'); ?>:</th>
142
  <td>
143
+ <input type="text" name="partition" value="<?php echo esc_attr( $this->partition ); ?>"/>
144
  </td>
145
  </tr>
146
  <tr>
147
  <th width="150"><?php _e ('Security ID', 'headspace'); ?>:</th>
148
  <td>
149
+ <input type="text" name="security" value="<?php echo esc_attr ($this->security); ?>"/>
150
  </td>
151
  </tr>
152
+
153
  <tr>
154
  <th><?php _e ('Who to track', 'headspace'); ?>:</th>
155
  <td>
156
  <select name="role">
157
  <option value="everyone"><?php _e ('Everyone', 'headspace'); ?></option>
158
  <?php global $wp_roles; foreach ($wp_roles->role_names as $key => $rolename) : ?>
159
+ <option value="<?php echo $key ?>"<?php if ($this->role == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $rolename ) ?></option>
160
  <?php endforeach; ?>
161
  </select>
162
  </select>
163
+
164
  <span class="sub"><?php _e ('Users of the specified role or less will be tracked', 'headspace'); ?></span>
165
  </td>
166
  </tr>
167
  <?php
168
  }
169
+
170
  function file ()
171
  {
172
  return basename (__FILE__);
173
  }
174
  }
175
 
176
+ ?>
modules/site/system-settings.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -26,17 +25,17 @@ class HSS_SystemSettings extends HS_SiteModule
26
  var $memory_limit = 0;
27
  var $timeout = -1;
28
  var $errors = 'default';
29
-
30
  function name ()
31
  {
32
  return __ ('System Settings', 'headspace');
33
  }
34
-
35
  function description ()
36
  {
37
  return __ ('Configure PHP memory limits, time-outs, and error reporting', 'headspace');
38
  }
39
-
40
  function run ()
41
  {
42
  if ($this->errors == 'error')
@@ -45,10 +44,10 @@ class HSS_SystemSettings extends HS_SiteModule
45
  error_reporting (E_ALL);
46
  else if ($this->errors == 'none')
47
  error_reporting (0);
48
-
49
  if ($this->memory_limit > 0)
50
  ini_set ('memory_limit', $this->memory_limit.'M');
51
-
52
  if ($this->timeout != -1)
53
  set_time_limit ($this->timeout);
54
  }
@@ -57,16 +56,16 @@ class HSS_SystemSettings extends HS_SiteModule
57
  {
58
  if (isset ($data['memory_limit']))
59
  $this->memory_limit = $data['memory_limit'];
60
-
61
  if (isset ($data['timeout']))
62
  $this->timeout = $data['timeout'];
63
 
64
  if (isset ($data['errors']))
65
  $this->errors = $data['errors'];
66
  }
67
-
68
  function has_config () { return true; }
69
-
70
  function save_options ($data)
71
  {
72
  return array
@@ -76,7 +75,7 @@ class HSS_SystemSettings extends HS_SiteModule
76
  'errors' => $data['errors']
77
  );
78
  }
79
-
80
  function edit ()
81
  {
82
  $timeouts = array
@@ -88,12 +87,12 @@ class HSS_SystemSettings extends HS_SiteModule
88
  '3600' => __ ('1 hour', 'headspace'),
89
  '0' => __ ('No timeout limit', 'headspace')
90
  );
91
-
92
  $limits = array
93
  (
94
  '0' => __ ('System default', 'headspace'), '16' => '16M', '32' => '32M', '64' => '64M', '128' => '128M'
95
  );
96
-
97
  $reports = array
98
  (
99
  'default' => __ ('System default', 'headspace'),
@@ -107,7 +106,7 @@ class HSS_SystemSettings extends HS_SiteModule
107
  <td>
108
  <select name="memory_limit">
109
  <?php foreach ($limits as $key => $text) : ?>
110
- <option value="<?php echo $key ?>"<?php if ($this->memory_limit == $key) echo ' selected="selected"'; ?>><?php echo $text ?></option>
111
  <?php endforeach; ?>
112
  </select>
113
  </td>
@@ -117,7 +116,7 @@ class HSS_SystemSettings extends HS_SiteModule
117
  <td>
118
  <select name="timeout">
119
  <?php foreach ($timeouts as $key => $text) : ?>
120
- <option value="<?php echo $key ?>"<?php if ($this->timeout == $key) echo ' selected="selected"'; ?>><?php echo $text ?></option>
121
  <?php endforeach; ?>
122
  </select>
123
  </td>
@@ -127,18 +126,16 @@ class HSS_SystemSettings extends HS_SiteModule
127
  <td>
128
  <select name="errors">
129
  <?php foreach ($reports as $key => $text) : ?>
130
- <option value="<?php echo $key ?>"<?php if ($this->errors == $key) echo ' selected="selected"'; ?>><?php echo $text ?></option>
131
  <?php endforeach; ?>
132
  </select>
133
  </td>
134
  </tr>
135
  <?php
136
  }
137
-
138
  function file ()
139
  {
140
  return basename (__FILE__);
141
  }
142
  }
143
-
144
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
25
  var $memory_limit = 0;
26
  var $timeout = -1;
27
  var $errors = 'default';
28
+
29
  function name ()
30
  {
31
  return __ ('System Settings', 'headspace');
32
  }
33
+
34
  function description ()
35
  {
36
  return __ ('Configure PHP memory limits, time-outs, and error reporting', 'headspace');
37
  }
38
+
39
  function run ()
40
  {
41
  if ($this->errors == 'error')
44
  error_reporting (E_ALL);
45
  else if ($this->errors == 'none')
46
  error_reporting (0);
47
+
48
  if ($this->memory_limit > 0)
49
  ini_set ('memory_limit', $this->memory_limit.'M');
50
+
51
  if ($this->timeout != -1)
52
  set_time_limit ($this->timeout);
53
  }
56
  {
57
  if (isset ($data['memory_limit']))
58
  $this->memory_limit = $data['memory_limit'];
59
+
60
  if (isset ($data['timeout']))
61
  $this->timeout = $data['timeout'];
62
 
63
  if (isset ($data['errors']))
64
  $this->errors = $data['errors'];
65
  }
66
+
67
  function has_config () { return true; }
68
+
69
  function save_options ($data)
70
  {
71
  return array
75
  'errors' => $data['errors']
76
  );
77
  }
78
+
79
  function edit ()
80
  {
81
  $timeouts = array
87
  '3600' => __ ('1 hour', 'headspace'),
88
  '0' => __ ('No timeout limit', 'headspace')
89
  );
90
+
91
  $limits = array
92
  (
93
  '0' => __ ('System default', 'headspace'), '16' => '16M', '32' => '32M', '64' => '64M', '128' => '128M'
94
  );
95
+
96
  $reports = array
97
  (
98
  'default' => __ ('System default', 'headspace'),
106
  <td>
107
  <select name="memory_limit">
108
  <?php foreach ($limits as $key => $text) : ?>
109
+ <option value="<?php echo $key ?>"<?php if ($this->memory_limit == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $text ); ?></option>
110
  <?php endforeach; ?>
111
  </select>
112
  </td>
116
  <td>
117
  <select name="timeout">
118
  <?php foreach ($timeouts as $key => $text) : ?>
119
+ <option value="<?php echo $key ?>"<?php if ($this->timeout == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $text ); ?></option>
120
  <?php endforeach; ?>
121
  </select>
122
  </td>
126
  <td>
127
  <select name="errors">
128
  <?php foreach ($reports as $key => $text) : ?>
129
+ <option value="<?php echo $key ?>"<?php if ($this->errors == $key) echo ' selected="selected"'; ?>><?php echo esc_html( $text ); ?></option>
130
  <?php endforeach; ?>
131
  </select>
132
  </td>
133
  </tr>
134
  <?php
135
  }
136
+
137
  function file ()
138
  {
139
  return basename (__FILE__);
140
  }
141
  }
 
 
modules/site/widgets.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -24,25 +23,25 @@ For full license details see license.txt
24
  class HSS_WpWidgets extends HS_SiteModule
25
  {
26
  var $widgets = array ();
27
-
28
  function name ()
29
  {
30
  return __ ('Disable WordPress Widgets', 'headspace');
31
  }
32
-
33
  function description ()
34
  {
35
  return __ ('Allows you to enable or disable various WordPress Widgets', 'headspace');
36
  }
37
-
38
  function plugins_loaded ()
39
  {
40
  remove_filter ('init', 'wp_widgets_init', 1);
41
-
42
  if (count ($this->widgets) > 0)
43
  add_action ('init', array (&$this, 'init'));
44
  }
45
-
46
  function init ()
47
  {
48
  $dims90 = array( 'height' => 90, 'width' => 300 );
@@ -51,18 +50,18 @@ class HSS_WpWidgets extends HS_SiteModule
51
 
52
  if (!function_exists ('wp_widget_text_register'))
53
  return;
54
-
55
  foreach ($this->widgets AS $widget)
56
  {
57
  switch ($widget)
58
  {
59
- case 'pages' :
60
  $class = array('classname' => 'widget_pages');
61
  wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $class);
62
  wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims150);
63
  break;
64
 
65
- case 'calendar' :
66
  $class['classname'] = 'widget_calendar';
67
  wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $class);
68
  wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control', $dims90);
@@ -74,18 +73,18 @@ class HSS_WpWidgets extends HS_SiteModule
74
  wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control', $dims100);
75
  break;
76
 
77
- case 'links' :
78
  $class['classname'] = 'widget_links';
79
  wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $class);
80
  break;
81
 
82
- case 'meta' :
83
  $class['classname'] = 'widget_meta';
84
  wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $class);
85
  wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control', $dims90);
86
  break;
87
 
88
- case 'search' :
89
  $class['classname'] = 'widget_search';
90
  wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $class);
91
  break;
@@ -104,28 +103,28 @@ class HSS_WpWidgets extends HS_SiteModule
104
 
105
  case 'categories' : wp_widget_categories_register();
106
  break;
107
-
108
  case 'text' : wp_widget_text_register();
109
  break;
110
-
111
  case 'rss' : wp_widget_rss_register();
112
  break;
113
-
114
  case 'recent_comments' :
115
  wp_widget_recent_comments_register();
116
  break;
117
  }
118
  }
119
  }
120
-
121
  function load ($data)
122
  {
123
  if (isset ($data['widgets']))
124
  $this->widgets = $data['widgets'];
125
  }
126
-
127
  function has_config () { return true; }
128
-
129
  function save_options ($data)
130
  {
131
  $widgets = array ();
@@ -133,7 +132,7 @@ class HSS_WpWidgets extends HS_SiteModule
133
  $widgets = $_POST['widgets'];
134
  return array ('widgets' => $widgets);
135
  }
136
-
137
  function edit ()
138
  {
139
  $widgets = array
@@ -156,17 +155,15 @@ class HSS_WpWidgets extends HS_SiteModule
156
  <th width="150"><?php _e ('Enabled Widgets', 'headspace'); ?>:</th>
157
  <td>
158
  <?php foreach ($widgets AS $widg => $name) : ?>
159
- <label><input type="checkbox" name="widgets[]" value="<?php echo $widg; ?>" <?php if (in_array ($widg, $this->widgets)) echo ' checked="checked"' ?>/> <?php echo $name; ?></label><br/>
160
  <?php endforeach; ?>
161
  </td>
162
  </tr>
163
  <?php
164
  }
165
-
166
  function file ()
167
  {
168
  return basename (__FILE__);
169
  }
170
  }
171
-
172
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
23
  class HSS_WpWidgets extends HS_SiteModule
24
  {
25
  var $widgets = array ();
26
+
27
  function name ()
28
  {
29
  return __ ('Disable WordPress Widgets', 'headspace');
30
  }
31
+
32
  function description ()
33
  {
34
  return __ ('Allows you to enable or disable various WordPress Widgets', 'headspace');
35
  }
36
+
37
  function plugins_loaded ()
38
  {
39
  remove_filter ('init', 'wp_widgets_init', 1);
40
+
41
  if (count ($this->widgets) > 0)
42
  add_action ('init', array (&$this, 'init'));
43
  }
44
+
45
  function init ()
46
  {
47
  $dims90 = array( 'height' => 90, 'width' => 300 );
50
 
51
  if (!function_exists ('wp_widget_text_register'))
52
  return;
53
+
54
  foreach ($this->widgets AS $widget)
55
  {
56
  switch ($widget)
57
  {
58
+ case 'pages' :
59
  $class = array('classname' => 'widget_pages');
60
  wp_register_sidebar_widget('pages', __('Pages'), 'wp_widget_pages', $class);
61
  wp_register_widget_control('pages', __('Pages'), 'wp_widget_pages_control', $dims150);
62
  break;
63
 
64
+ case 'calendar' :
65
  $class['classname'] = 'widget_calendar';
66
  wp_register_sidebar_widget('calendar', __('Calendar'), 'wp_widget_calendar', $class);
67
  wp_register_widget_control('calendar', __('Calendar'), 'wp_widget_calendar_control', $dims90);
73
  wp_register_widget_control('archives', __('Archives'), 'wp_widget_archives_control', $dims100);
74
  break;
75
 
76
+ case 'links' :
77
  $class['classname'] = 'widget_links';
78
  wp_register_sidebar_widget('links', __('Links'), 'wp_widget_links', $class);
79
  break;
80
 
81
+ case 'meta' :
82
  $class['classname'] = 'widget_meta';
83
  wp_register_sidebar_widget('meta', __('Meta'), 'wp_widget_meta', $class);
84
  wp_register_widget_control('meta', __('Meta'), 'wp_widget_meta_control', $dims90);
85
  break;
86
 
87
+ case 'search' :
88
  $class['classname'] = 'widget_search';
89
  wp_register_sidebar_widget('search', __('Search'), 'wp_widget_search', $class);
90
  break;
103
 
104
  case 'categories' : wp_widget_categories_register();
105
  break;
106
+
107
  case 'text' : wp_widget_text_register();
108
  break;
109
+
110
  case 'rss' : wp_widget_rss_register();
111
  break;
112
+
113
  case 'recent_comments' :
114
  wp_widget_recent_comments_register();
115
  break;
116
  }
117
  }
118
  }
119
+
120
  function load ($data)
121
  {
122
  if (isset ($data['widgets']))
123
  $this->widgets = $data['widgets'];
124
  }
125
+
126
  function has_config () { return true; }
127
+
128
  function save_options ($data)
129
  {
130
  $widgets = array ();
132
  $widgets = $_POST['widgets'];
133
  return array ('widgets' => $widgets);
134
  }
135
+
136
  function edit ()
137
  {
138
  $widgets = array
155
  <th width="150"><?php _e ('Enabled Widgets', 'headspace'); ?>:</th>
156
  <td>
157
  <?php foreach ($widgets AS $widg => $name) : ?>
158
+ <label><input type="checkbox" name="widgets[]" value="<?php echo esc_attr( $widg ); ?>" <?php if (in_array ($widg, $this->widgets)) echo ' checked="checked"' ?>/> <?php echo esc_html( $name ); ?></label><br/>
159
  <?php endforeach; ?>
160
  </td>
161
  </tr>
162
  <?php
163
  }
164
+
165
  function file ()
166
  {
167
  return basename (__FILE__);
168
  }
169
  }
 
 
modules/site/wp_formatting.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -26,17 +25,17 @@ class HSS_WpFormatting extends HS_SiteModule
26
  var $wpautop = false;
27
  var $clickable = true;
28
  var $wptexturize = false;
29
-
30
  function name ()
31
  {
32
  return __ ('WordPress content formatting', 'headspace');
33
  }
34
-
35
  function description ()
36
  {
37
  return __ ('Allows you to enable or disable various WordPress auto-formatting (including wpautop)', 'headspace');
38
  }
39
-
40
  function run ()
41
  {
42
  if ($this->wpautop === false)
@@ -45,7 +44,7 @@ class HSS_WpFormatting extends HS_SiteModule
45
  remove_filter ('the_excerpt', 'wpautop');
46
  remove_filter ('comment_text', 'wpautop');
47
  }
48
-
49
  if ($this->wptexturize === false)
50
  {
51
  remove_filter ('the_content', 'wptexturize');
@@ -60,30 +59,30 @@ class HSS_WpFormatting extends HS_SiteModule
60
  remove_filter ('bloginfo', 'wptexturize');
61
  remove_filter ('wp_title', 'wptexturize');
62
  }
63
-
64
  if ($this->clickable === false)
65
  remove_filter ('comment_text', 'make_clickable');
66
  }
67
-
68
  function load ($data)
69
  {
70
  if (isset ($data['wpautop']))
71
  $this->wpautop = $data['wpautop'];
72
-
73
  if (isset ($data['wptexturize']))
74
  $this->wptexturize = $data['wptexturize'];
75
-
76
  if (isset ($data['clickable']))
77
  $this->clickable = $data['clickable'];
78
  }
79
-
80
  function has_config () { return true; }
81
-
82
  function save_options ($data)
83
  {
84
  return array ('wpautop' => isset ($data['wpautop']) ? true : false, 'wptexturize' => isset ($data['wptexturize']) ? true : false, 'clickable' => isset ($data['clickable']) ? true : false);
85
  }
86
-
87
  function edit ()
88
  {
89
  ?>
@@ -110,11 +109,11 @@ class HSS_WpFormatting extends HS_SiteModule
110
  </tr>
111
  <?php
112
  }
113
-
114
  function file ()
115
  {
116
  return basename (__FILE__);
117
  }
118
  }
119
 
120
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
25
  var $wpautop = false;
26
  var $clickable = true;
27
  var $wptexturize = false;
28
+
29
  function name ()
30
  {
31
  return __ ('WordPress content formatting', 'headspace');
32
  }
33
+
34
  function description ()
35
  {
36
  return __ ('Allows you to enable or disable various WordPress auto-formatting (including wpautop)', 'headspace');
37
  }
38
+
39
  function run ()
40
  {
41
  if ($this->wpautop === false)
44
  remove_filter ('the_excerpt', 'wpautop');
45
  remove_filter ('comment_text', 'wpautop');
46
  }
47
+
48
  if ($this->wptexturize === false)
49
  {
50
  remove_filter ('the_content', 'wptexturize');
59
  remove_filter ('bloginfo', 'wptexturize');
60
  remove_filter ('wp_title', 'wptexturize');
61
  }
62
+
63
  if ($this->clickable === false)
64
  remove_filter ('comment_text', 'make_clickable');
65
  }
66
+
67
  function load ($data)
68
  {
69
  if (isset ($data['wpautop']))
70
  $this->wpautop = $data['wpautop'];
71
+
72
  if (isset ($data['wptexturize']))
73
  $this->wptexturize = $data['wptexturize'];
74
+
75
  if (isset ($data['clickable']))
76
  $this->clickable = $data['clickable'];
77
  }
78
+
79
  function has_config () { return true; }
80
+
81
  function save_options ($data)
82
  {
83
  return array ('wpautop' => isset ($data['wpautop']) ? true : false, 'wptexturize' => isset ($data['wptexturize']) ? true : false, 'clickable' => isset ($data['clickable']) ? true : false);
84
  }
85
+
86
  function edit ()
87
  {
88
  ?>
109
  </tr>
110
  <?php
111
  }
112
+
113
  function file ()
114
  {
115
  return basename (__FILE__);
116
  }
117
  }
118
 
119
+ ?>
modules/site/yahoo-site-explorer.php CHANGED
@@ -5,7 +5,6 @@
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
8
- * @copyright Copyright (C) John Godley
9
  **/
10
 
11
  /*
@@ -24,17 +23,17 @@ For full license details see license.txt
24
  class HSS_YahooSiteExplorer extends HS_SiteModule
25
  {
26
  var $code = '';
27
-
28
  function name ()
29
  {
30
  return __ ('Yahoo! Site Explorer', 'headspace');
31
  }
32
-
33
  function description ()
34
  {
35
  return __ ('Adds Yahoo! Site Explorer tracking code to your home page', 'headspace');
36
  }
37
-
38
  function run ()
39
  {
40
  add_filter ('wp_head', array (&$this, 'wp_head'));
@@ -44,39 +43,38 @@ class HSS_YahooSiteExplorer extends HS_SiteModule
44
  {
45
  // Only need to put this on the home page
46
  if ($this->code && is_front_page ())
47
- echo '<meta name="y_key" content="'.htmlspecialchars ($this->code).'"/>'."\r\n";
48
  }
49
-
50
  function load ($data)
51
  {
52
  if (isset ($data['code']))
53
  $this->code = $data['code'];
54
  }
55
-
56
  function has_config () { return true; }
57
-
58
  function save_options ($data)
59
  {
60
  return array ('code' => $data['code']);
61
  }
62
-
63
  function edit ()
64
  {
65
  ?>
66
  <tr>
67
  <th width="150"><?php _e ('Tracking code', 'headspace'); ?>:</th>
68
  <td>
69
- <input size="40" name="code" type="text" value="<?php echo htmlspecialchars ($this->code); ?>"/><br/>
70
  <span class="sub"><?php _e ('Enter Yahoo! Site Explorer tracking code.', 'headspace'); ?></span>
71
  </td>
72
  </tr>
73
  <?php
74
  }
75
-
76
  function file ()
77
  {
78
  return basename (__FILE__);
79
  }
80
  }
81
 
82
- ?>
5
  *
6
  * @package HeadSpace
7
  * @author John Godley
 
8
  **/
9
 
10
  /*
23
  class HSS_YahooSiteExplorer extends HS_SiteModule
24
  {
25
  var $code = '';
26
+
27
  function name ()
28
  {
29
  return __ ('Yahoo! Site Explorer', 'headspace');
30
  }
31
+
32
  function description ()
33
  {
34
  return __ ('Adds Yahoo! Site Explorer tracking code to your home page', 'headspace');
35
  }
36
+
37
  function run ()
38
  {
39
  add_filter ('wp_head', array (&$this, 'wp_head'));
43
  {
44
  // Only need to put this on the home page
45
  if ($this->code && is_front_page ())
46
+ echo '<meta name="y_key" content="'.esc_attr ($this->code).'"/>'."\r\n";
47
  }
48
+
49
  function load ($data)
50
  {
51
  if (isset ($data['code']))
52
  $this->code = $data['code'];
53
  }
54
+
55
  function has_config () { return true; }
56
+
57
  function save_options ($data)
58
  {
59
  return array ('code' => $data['code']);
60
  }
61
+
62
  function edit ()
63
  {
64
  ?>
65
  <tr>
66
  <th width="150"><?php _e ('Tracking code', 'headspace'); ?>:</th>
67
  <td>
68
+ <input size="40" name="code" type="text" value="<?php echo esc_attr ($this->code); ?>"/><br/>
69
  <span class="sub"><?php _e ('Enter Yahoo! Site Explorer tracking code.', 'headspace'); ?></span>
70
  </td>
71
  </tr>
72
  <?php
73
  }
74
+
75
  function file ()
76
  {
77
  return basename (__FILE__);
78
  }
79
  }
80
 
 
plugin.php CHANGED
@@ -13,7 +13,6 @@
13
  // ======================================================================================
14
  // @author John Godley(http://urbangiraffe.com)
15
  // @version 0.2.4
16
- // @copyright Copyright &copy; 2009 John Godley, All Rights Reserved
17
  // ======================================================================================
18
  // 0.1.6 - Corrected WP locale functions
19
  // 0.1.7 - Add phpdoc comments
@@ -101,7 +100,6 @@
101
  *
102
  * @package WordPress base library
103
  * @author John Godley
104
- * @copyright Copyright(C) John Godley
105
  **/
106
 
107
  class Headspace_Plugin {
@@ -135,100 +133,6 @@ class Headspace_Plugin {
135
  $this->plugin_name = $name;
136
 
137
  $this->add_action( 'init', 'load_locale' );
138
-
139
- global $wp_version;
140
- if ( version_compare( $wp_version, '2.7', '<' ) )
141
- $this->add_action( 'admin_menu', 'compatibility_27' );
142
-
143
- if ( version_compare( $wp_version, '2.6', '<' ) )
144
- $this->add_action( 'admin_menu', 'compatibility_26' );
145
-
146
- if ( version_compare( $wp_version, '2.5', '<' ) ) {
147
- $this->add_action( 'admin_menu', 'compatibility_25' );
148
-
149
- if ( !function_exists( 'is_front_page' ) ) {
150
- function is_front_page ( ) {
151
- return is_home ();
152
- }
153
- }
154
- }
155
- }
156
-
157
- function compatibility_25() {
158
- if ( !function_exists( 'check_ajax_referer' ) ) {
159
- function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
160
- if ( $query_arg )
161
- $nonce = $_REQUEST[$query_arg];
162
- else
163
- $nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce'];
164
-
165
- $result = wp_verify_nonce( $nonce, $action );
166
-
167
- if ( $die && false == $result )
168
- die('-1');
169
-
170
- do_action('check_ajax_referer', $action, $result);
171
-
172
- return $result;
173
- }
174
- }
175
- }
176
-
177
- function compatibility_26() {
178
- if ( !function_exists( 'admin_url' ) ) {
179
- function admin_url() {
180
- $url = site_url('wp-admin/', 'admin');
181
-
182
- if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
183
- $url .= ltrim($path, '/');
184
-
185
- return $url;
186
- }
187
- }
188
-
189
- if ( !function_exists( 'is_ssl' ) ) {
190
- function is_ssl() {
191
- if ( isset($_SERVER['HTTPS']) ) {
192
- if ( 'on' == strtolower($_SERVER['HTTPS']) )
193
- return true;
194
- if ( '1' == $_SERVER['HTTPS'] )
195
- return true;
196
- } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
197
- return true;
198
- }
199
- return false;
200
- }
201
- }
202
-
203
- if ( !function_exists( 'site_url' ) ) {
204
- function site_url($path = '', $scheme = null) {
205
- $scheme = ( is_ssl() ? 'https' : 'http' );
206
-
207
- $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
208
-
209
- if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
210
- $url .= '/' . ltrim($path, '/');
211
-
212
- return apply_filters('site_url', $url, $path, $orig_scheme);
213
- }
214
- }
215
- }
216
-
217
- /**
218
- * Backwards compatible admin functions
219
- * @return void
220
- **/
221
- function compatibility_27() {
222
- if ( !function_exists( 'screen_icon' ) ) {
223
- function screen_icon() {
224
- }
225
- }
226
-
227
- if ( !function_exists( 'add_meta_box' ) ) {
228
- function add_meta_box ( $id, $title, $callback, $page, $context = 'advanced', $priority = 'default', $callback_args=null ) {
229
- add_action( 'dbx_post_advanced', $callback );
230
- }
231
- }
232
  }
233
 
234
  /**
@@ -410,157 +314,6 @@ class Headspace_Plugin {
410
  </div>
411
  <?php
412
  }
413
-
414
- /**
415
- * Get the plugin's base directory
416
- *
417
- * @return string Base directory
418
- **/
419
- function dir() {
420
- return $this->plugin_base;
421
- }
422
-
423
- function base () {
424
- $parts = explode( '?', basename( $_SERVER['REQUEST_URI'] ) );
425
- return $parts[0];
426
- }
427
-
428
- /**
429
- * Get a URL to the plugin. Useful for specifying JS and CSS files
430
- *
431
- * For example, <img src="<?php echo $this->url() ?>/myimage.png"/>
432
- *
433
- * @return string URL
434
- **/
435
- function url( $url = '' ) {
436
- if ( $url )
437
- return str_replace( '\\', urlencode( '\\' ), str_replace( '&amp;amp', '&amp;', str_replace( '&', '&amp;', $url ) ) );
438
-
439
- $root = ABSPATH;
440
- if ( defined( 'WP_PLUGIN_DIR' ) )
441
- $root = WP_PLUGIN_DIR;
442
-
443
- $url = substr( $this->plugin_base, strlen( $this->realpath( $root ) ) );
444
- if ( DIRECTORY_SEPARATOR != '/' )
445
- $url = str_replace( DIRECTORY_SEPARATOR, '/', $url );
446
-
447
- if ( defined( 'WP_PLUGIN_URL' ) )
448
- $url = WP_PLUGIN_URL.'/'.ltrim( $url, '/' );
449
- else
450
- $url = get_bloginfo( 'wpurl' ).'/'.ltrim( $url, '/' );
451
-
452
- // Do an SSL check - only works on Apache
453
- global $is_IIS;
454
- if ( isset( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) == 'on' && $is_IIS === false )
455
- $url = str_replace( 'http://', 'https://', $url );
456
-
457
- return $url;
458
- }
459
-
460
- /**
461
- * Version of realpath that will work on systems without realpath
462
- *
463
- * @param string $path The path to canonicalize
464
- * @return string Canonicalized path
465
- **/
466
- function realpath( $path ) {
467
- if ( function_exists( 'realpath' ) && DIRECTORY_SEPARATOR == '/' )
468
- return realpath( $path );
469
- elseif ( DIRECTORY_SEPARATOR == '/' )
470
- {
471
- $path = preg_replace( '/^~/', $_SERVER['DOCUMENT_ROOT'], $path );
472
-
473
- // canonicalize
474
- $path = explode( DIRECTORY_SEPARATOR, $path );
475
- $newpath = array();
476
-
477
- for ( $i = 0; $i < count( $path ); $i++ ) {
478
- if ( $path[$i] === '' || $path[$i] === '.' )
479
- continue;
480
-
481
- if ( $path[$i] === '..' ) {
482
- array_pop( $newpath );
483
- continue;
484
- }
485
-
486
- array_push( $newpath, $path[$i] );
487
- }
488
-
489
- return DIRECTORY_SEPARATOR.implode( DIRECTORY_SEPARATOR, $newpath );
490
- }
491
-
492
- return $path;
493
- }
494
-
495
- /**
496
- * Helper function to check a checkbox if the item has been checked
497
- *
498
- * @param mixed $item Checkbox value, or array of checkbox values: field => value
499
- * @param string $field Fieldname, if array is given for $item
500
- * @return void
501
- **/
502
- function checked( $item, $field = '' ) {
503
- if ( $field && is_array( $item ) ) {
504
- if ( isset( $item[$field] ) && $item[$field] )
505
- echo ' checked="checked"';
506
- }
507
- elseif ( !empty( $item ) )
508
- echo ' checked="checked"';
509
- }
510
-
511
- /**
512
- * Helper function to display a dropdown select box
513
- *
514
- * @param array $items Associative array of: fieldname => label
515
- * @param string $default Default fieldname to select
516
- * @return void
517
- **/
518
- function select( $items, $default = '' ) {
519
- if ( count( $items ) > 0 ) {
520
- foreach ( $items AS $key => $value ) {
521
- if ( is_array( $value ) ) {
522
- echo '<optgroup label="'.$key.'">';
523
-
524
- foreach ( $value AS $sub => $subvalue ) {
525
- echo '<option value="'.$sub.'"'.( $sub == $default ? ' selected="selected"' : '' ).'>'.$subvalue.'</option>';
526
- }
527
-
528
- echo '</optgroup>';
529
- }
530
- else
531
- echo '<option value="'.$key.'"'.( $key == $default ? ' selected="selected"' : '' ).'>'.$value.'</option>';
532
- }
533
- }
534
- }
535
-
536
- /**
537
- * Expanded version of htmlspecialchars which detects the blog encoding and runs iconv on any encoding that is not supported by htmlspecialchars
538
- *
539
- * @param string $text Text to run htmlspecialchars on
540
- * @return void
541
- **/
542
- function specialchars( $text ) {
543
- $charset = get_option( 'blog_charset' );
544
-
545
- if ( $charset != 'UTF-8' && function_exists( 'iconv' ) && !in_array( $charset, array( 'ISO-8859-1', 'ISO-8859-15', 'cp1251', 'cp1252', 'KOI8-R', 'BIG5', 'GB2312', 'Shift_JIS', 'EUC-JP' ) ) )
546
- return iconv( 'UTF-8//IGNORE', $charset, htmlspecialchars( iconv( $charset, 'UTF-8//IGNORE', $text ) ) );
547
- return htmlspecialchars( $text, ENT_COMPAT, $charset );
548
- }
549
-
550
- /**
551
- * Special version of strlen that runs mb_strlen if blog encoding is not UTF-8
552
- *
553
- * @param string $name Name of your plugin. Is used to determine the plugin locale domain
554
- * @param string $base Directory containing the plugin's 'view' files.
555
- * @return void
556
- **/
557
- function strlen( $text ) {
558
- $charset = get_option( 'blog_charset' );
559
-
560
- if ( $charset != 'UTF-8' && function_exists( 'mb_strlen' ) )
561
- return mb_strlen( $text );
562
- return strlen( $text );
563
- }
564
  }
565
 
566
  /**
@@ -578,8 +331,3 @@ if ( !function_exists( 'pr' ) ) {
578
  }
579
  }
580
 
581
- if ( !function_exists( '_n' ) ) {
582
- function _n($single, $plural, $number, $domain = 'default') {
583
- return __ngettext($single, $plural, $number, $domain = 'default');
584
- }
585
- }
13
  // ======================================================================================
14
  // @author John Godley(http://urbangiraffe.com)
15
  // @version 0.2.4
 
16
  // ======================================================================================
17
  // 0.1.6 - Corrected WP locale functions
18
  // 0.1.7 - Add phpdoc comments
100
  *
101
  * @package WordPress base library
102
  * @author John Godley
 
103
  **/
104
 
105
  class Headspace_Plugin {
133
  $this->plugin_name = $name;
134
 
135
  $this->add_action( 'init', 'load_locale' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
 
138
  /**
314
  </div>
315
  <?php
316
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  }
318
 
319
  /**
331
  }
332
  }
333
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: johnny5
3
  Tags: seo, post, page, meta-data, title, keywords, tags, tagging, google, head, meta, crazyegg, piwik, awstats, analytics, webmaster, feedburner
4
  Requires at least: 3.0
5
  Tested up to: 3.4
6
- Stable tag: 3.6.38
7
 
8
  Controls almost every aspect of your site's meta-data, including advanced tagging, Analytics, and dozens of plugins. The best WordPress SEO solution!
9
 
@@ -114,7 +114,6 @@ You can find full details of installing a plugin on the [plugin installation pag
114
  1. Drag-and-drop module configuration
115
  2. Configure every aspect of your site's meta-data
116
  3. Configure meta data for posts and pages, including custom plugins and themes that only load on that post
117
- 4. Mass-edit meta-data
118
 
119
  == Documentation ==
120
 
@@ -122,6 +121,10 @@ Full documentation can be found on the [HeadSpace2](http://urbangiraffe.com/plug
122
 
123
  == Changelog ==
124
 
 
 
 
 
125
  = 3.6.38 =
126
  * Updated to AIOSEO importer, thanks to Joan
127
 
@@ -284,6 +287,3 @@ Full documentation can be found on the [HeadSpace2](http://urbangiraffe.com/plug
284
  * Piwik bug (#306).
285
  * Check theme files.
286
  * Fix auto description
287
-
288
-
289
-
3
  Tags: seo, post, page, meta-data, title, keywords, tags, tagging, google, head, meta, crazyegg, piwik, awstats, analytics, webmaster, feedburner
4
  Requires at least: 3.0
5
  Tested up to: 3.4
6
+ Stable tag: 3.6.39
7
 
8
  Controls almost every aspect of your site's meta-data, including advanced tagging, Analytics, and dozens of plugins. The best WordPress SEO solution!
9
 
114
  1. Drag-and-drop module configuration
115
  2. Configure every aspect of your site's meta-data
116
  3. Configure meta data for posts and pages, including custom plugins and themes that only load on that post
 
117
 
118
  == Documentation ==
119
 
121
 
122
  == Changelog ==
123
 
124
+ = 3.6.39 =
125
+ * Update some old crufty code
126
+ * Remove mass editor
127
+
128
  = 3.6.38 =
129
  * Updated to AIOSEO importer, thanks to Joan
130
 
287
  * Piwik bug (#306).
288
  * Check theme files.
289
  * Fix auto description
 
 
 
screenshot-4.png DELETED
Binary file
view/admin/dashboard.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <script type="text/javascript" charset="utf-8">
3
- var wp_hs_base = '<?php echo $this->url (); ?>/ajax.php';
4
 
5
  jQuery(document).ready(function()
6
  {
7
  var clone = jQuery('#headspace_dash').clone ();
8
  jQuery(clone).attr ('id', 'dashboard_headspace');
9
-
10
  // Copy internals of HeadSpace box into QuickPress
11
  jQuery('#quick-press .submit').before ('<p class="submit" id="head_break"></p>');
12
  jQuery('#dashboard_headspace').remove ();
@@ -17,4 +17,4 @@
17
  <div id="headspace_dash">
18
  <?php $this->render_admin ('page-settings-edit', array ('simple' => $simple, 'advanced' => $advanced, 'width' => 140, 'area' => 'page')); ?>
19
  <br/>
20
- </div>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <script type="text/javascript" charset="utf-8">
3
+ var wp_hs_base = '<?php echo plugins_url( 'ajax.php', $this->base_url() ); ?>';
4
 
5
  jQuery(document).ready(function()
6
  {
7
  var clone = jQuery('#headspace_dash').clone ();
8
  jQuery(clone).attr ('id', 'dashboard_headspace');
9
+
10
  // Copy internals of HeadSpace box into QuickPress
11
  jQuery('#quick-press .submit').before ('<p class="submit" id="head_break"></p>');
12
  jQuery('#dashboard_headspace').remove ();
17
  <div id="headspace_dash">
18
  <?php $this->render_admin ('page-settings-edit', array ('simple' => $simple, 'advanced' => $advanced, 'width' => 140, 'area' => 'page')); ?>
19
  <br/>
20
+ </div>
view/admin/edit_page.php CHANGED
@@ -1,2 +1,4 @@
1
- <p id="jaxtag"><input type="text" name="tags_input" class="tags-input headspace-tags" id="tags-input" size="25" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p>
 
 
2
  <div id="tagchecklist"></div>
1
+ <p id="jaxtag">
2
+ <input type="text" name="tags_input" class="tags-input headspace-tags" id="tags-input" size="25" tabindex="3" value="<?php echo esc_attr( get_tags_to_edit( $post_ID ) ); ?>" />
3
+ </p>
4
  <div id="tagchecklist"></div>
view/admin/edit_post.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
 
3
  <?php if (count ($simple) > 0 || count ($advanced) > 0) : ?>
4
-
5
  <div class="meta-box-sortables ui-sortable" style="position: relative;">
6
  <div class="postbox">
7
  <h3 class="hndle"><?php _e ('HeadSpace Meta data', 'headspace') ?></h3>
8
-
9
  <div class="inside" id="headspacestuff">
10
  <?php $this->render_admin ('page-settings-edit', array ('simple' => $simple, 'advanced' => $advanced, 'width' => 140, 'area' => 'page')); ?>
11
  </div>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
 
3
  <?php if (count ($simple) > 0 || count ($advanced) > 0) : ?>
4
+
5
  <div class="meta-box-sortables ui-sortable" style="position: relative;">
6
  <div class="postbox">
7
  <h3 class="hndle"><?php _e ('HeadSpace Meta data', 'headspace') ?></h3>
8
+
9
  <div class="inside" id="headspacestuff">
10
  <?php $this->render_admin ('page-settings-edit', array ('simple' => $simple, 'advanced' => $advanced, 'width' => 140, 'area' => 'page')); ?>
11
  </div>
view/admin/head_admin.php DELETED
@@ -1,7 +0,0 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
- <script type="text/javascript" charset="utf-8">
3
- var wp_hs_base = '<?php echo $this->url (); ?>/ajax.php';
4
- var headspace_delete = '<?php echo $this->url () ?>/images/delete.png';
5
- var wp_hs_mergetag = '<?php _e( 'Are you sure you want to merge that tag?', 'headspace' ); ?>';
6
- var headspace_error = '<?php _e('A problem occured retrieving data from the server. If this persists please check that you have installed the plugin correctly.'); ?>';
7
- </script>
 
 
 
 
 
 
 
view/admin/mass_edit.php DELETED
@@ -1,77 +0,0 @@
1
- <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
- <div class="wrap">
3
- <?php screen_icon(); ?>
4
-
5
- <h2><?php echo HEADSPACE_META; ?></h2>
6
-
7
- <form method="get" action="<?php echo $this->url ($pager->url) ?>">
8
- <p class="search-box">
9
- <label for="post-search-input" class="hidden"><?php _e ('Search') ?>:</label>
10
- <input class="search-input" type="text" name="search" value="<?php echo isset($_GET['search']) ? htmlspecialchars ($_GET['search']) : ''?>"/>
11
- <input class="button-secondary" type="submit" name="go" value="<?php _e ('Search', 'drain-hole') ?>"/>
12
-
13
- <input type="hidden" name="page" value="headspace.php"/>
14
- <input type="hidden" name="curpage" value="<?php echo $pager->current_page () ?>"/>
15
- </p>
16
-
17
- <div id="pager" class="tablenav">
18
- <div class="alignleft actions">
19
- <?php _e ('Meta-data', 'headspace'); ?>: <select name="type">
20
- <?php foreach ($types AS $name => $type) : ?>
21
- <option value="<?php echo $type->id () ?>"<?php if ($name == $current->id ()) echo ' selected="selected"' ?>><?php echo $type->name () ?></option>
22
- <?php endforeach; ?>
23
- </select>
24
-
25
- <?php $pager->per_page ('drain-hole'); ?>
26
-
27
- <input type="submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
28
-
29
- <br class="clear" />
30
- </div>
31
-
32
- <div class="tablenav-pages">
33
- <?php echo $pager->page_links (); ?>
34
- </div>
35
- </div>
36
- </form>
37
-
38
- <form action="" method="post" accept-charset="utf-8">
39
- <table class="widefat post fixed">
40
- <thead>
41
- <tr>
42
- <th style="width: 40px; text-align: center"><?php echo $pager->sortable ('id', 'ID') ?></th>
43
- <?php $current->show_header ($pager); ?>
44
- </tr>
45
- </thead>
46
-
47
-
48
- <tbody>
49
- <?php if (count ($posts) > 0) : ?>
50
- <?php foreach ($posts AS $pos => $post) : ?>
51
- <tr<?php if ($pos % 2 == 1) echo ' class="alt"' ?>>
52
- <td align="center"><a href="post.php?action=edit&amp;post=<?php echo $post->ID ?>"><?php echo $post->ID ?></a></td>
53
- <?php $current->show ($post, $pager); ?>
54
- </tr>
55
- <?php endforeach; ?>
56
- <?php endif; ?>
57
- </tbody>
58
- </table>
59
-
60
- <?php wp_nonce_field ('headspace-mass_edit'); ?>
61
-
62
- <div style="clear: both"></div>
63
- <br/>
64
- <input class="button-primary" type="submit" name="save" value="<?php _e ('Save all data', 'headspace'); ?>" id="save"/>
65
- <br/><br/>
66
-
67
- </form>
68
-
69
-
70
- <script type="text/javascript">
71
- jQuery(document).ready( function() {
72
- jQuery( 'a.auto-desc' ).AutoDescription( { target: '#edit_' } );
73
- jQuery( 'a.tag' ).AutoTag();
74
- jQuery( 'a.title' ).AutoTitle();
75
- });
76
- </script>
77
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
view/admin/options.php CHANGED
@@ -2,11 +2,11 @@
2
 
3
  <div class="wrap">
4
  <?php screen_icon(); ?>
5
-
6
  <h2><?php printf (__ ('%s | General Options', 'headspace'), HEADSPACE_MENU); ?></h2>
7
 
8
  <?php $this->submenu (true); ?>
9
-
10
  <form method="post" action="">
11
  <?php wp_nonce_field ('headspace-update_options'); ?>
12
 
@@ -47,12 +47,12 @@
47
 
48
  <div class="wrap">
49
  <h2><?php _e ('Remove HeadSpace', 'headspace'); ?></h2>
50
-
51
  <p><?php _e ('This option will remove HeadSpace and delete all settings, tags, and meta-data - be sure this is what you want!', 'headspace'); ?></p>
52
-
53
  <form action="" method="post" accept-charset="utf-8">
54
  <?php wp_nonce_field ('headspace-delete_plugin'); ?>
55
-
56
  <input class="button-secondary" type="submit" name="delete" value="<?php _e ('Delete HeadSpace', 'headspace'); ?>" onclick="return confirm ('Are you sure you want to remove HeadSpace and all settings?')"/>
57
  </form>
58
  </div>
2
 
3
  <div class="wrap">
4
  <?php screen_icon(); ?>
5
+
6
  <h2><?php printf (__ ('%s | General Options', 'headspace'), HEADSPACE_MENU); ?></h2>
7
 
8
  <?php $this->submenu (true); ?>
9
+
10
  <form method="post" action="">
11
  <?php wp_nonce_field ('headspace-update_options'); ?>
12
 
47
 
48
  <div class="wrap">
49
  <h2><?php _e ('Remove HeadSpace', 'headspace'); ?></h2>
50
+
51
  <p><?php _e ('This option will remove HeadSpace and delete all settings, tags, and meta-data - be sure this is what you want!', 'headspace'); ?></p>
52
+
53
  <form action="" method="post" accept-charset="utf-8">
54
  <?php wp_nonce_field ('headspace-delete_plugin'); ?>
55
+
56
  <input class="button-secondary" type="submit" name="delete" value="<?php _e ('Delete HeadSpace', 'headspace'); ?>" onclick="return confirm ('Are you sure you want to remove HeadSpace and all settings?')"/>
57
  </form>
58
  </div>
view/admin/page-module-edit.php CHANGED
@@ -12,7 +12,7 @@
12
  <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'headspace'); ?>"/>
13
 
14
  <input type="hidden" name="action" value="hs_module_save"/>
15
- <input type="hidden" name="module" value="<?php echo htmlspecialchars( $id ); ?>"/>
16
  <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce ('headspace-module_save_'.$id ) ?>"/>
17
  </td>
18
  </tr>
12
  <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'headspace'); ?>"/>
13
 
14
  <input type="hidden" name="action" value="hs_module_save"/>
15
+ <input type="hidden" name="module" value="<?php echo esc_attr( $id ); ?>"/>
16
  <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce ('headspace-module_save_'.$id ) ?>"/>
17
  </td>
18
  </tr>
view/admin/page-module-item.php CHANGED
@@ -1,15 +1,15 @@
1
  <div class="option">
2
  <?php if ($module->has_config ()) : ?>
3
  <a class="edit" href="admin-ajax.php?action=hs_module_edit&amp;_ajax_nonce=<?php echo wp_create_nonce ('headspace-module_'.$module->id() )?>&amp;module=<?php echo $module->id(); ?>">
4
- <img src="<?php echo $this->url () ?>/images/edit.png" width="16" height="16" alt="Edit"/>
5
  </a>
6
  <?php endif; ?>
7
 
8
- <a class="help" href="#help"><img src="<?php echo $this->url () ?>/images/help.png" width="16" height="16" alt="Help"/></a>
9
  </div>
10
 
11
  <?php echo $module->name (); ?>
12
 
13
  <div class="help" style="display: none">
14
- <?php echo htmlspecialchars ($module->description ()); ?>
15
- </div>
1
  <div class="option">
2
  <?php if ($module->has_config ()) : ?>
3
  <a class="edit" href="admin-ajax.php?action=hs_module_edit&amp;_ajax_nonce=<?php echo wp_create_nonce ('headspace-module_'.$module->id() )?>&amp;module=<?php echo $module->id(); ?>">
4
+ <img src="<?php echo plugins_url( '/images/edit.png', $this->base_url() ); ?>" width="16" height="16" alt="Edit"/>
5
  </a>
6
  <?php endif; ?>
7
 
8
+ <a class="help" href="#help"><img src="<?php echo plugins_url( '/images/help.png', $this->base_url() ); ?>" width="16" height="16" alt="Help"/></a>
9
  </div>
10
 
11
  <?php echo $module->name (); ?>
12
 
13
  <div class="help" style="display: none">
14
+ <?php echo esc_html ($module->description ()); ?>
15
+ </div>
view/admin/page-settings-item.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
 
3
  <div style="display: none" class="option">
4
- <img src="<?php echo $this->url (); ?>/images/progress.gif" alt="progress"/>
5
  </div>
6
 
7
- <img src="<?php echo $this->url (); ?>/images/page.png" alt="page" width="16" height="16" />
8
 
9
  <?php if ($nolink !== true) : ?>
10
- <a href="<?php echo admin_url('admin-ajax.php'); ?>?action=hs_settings_edit&amp;page=<?php echo $type ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'headspace-edit_setting_'.$type )?>"><strong><?php echo $name ?></strong></a>
11
  <?php else : ?>
12
- <strong><?php echo $name ?></strong>
13
  <?php endif; ?>
14
 
15
- - <?php echo $desc ?>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
 
3
  <div style="display: none" class="option">
4
+ <img src="<?php echo plugins_url( '/images/progress.gif', $this->base_url() ); ?>" alt="progress"/>
5
  </div>
6
 
7
+ <img src="<?php echo plugins_url( '/images/page.png', $this->base_url() ); ?>" alt="page" width="16" height="16" />
8
 
9
  <?php if ($nolink !== true) : ?>
10
+ <a href="<?php echo admin_url('admin-ajax.php'); ?>?action=hs_settings_edit&amp;page=<?php echo $type ?>&amp;_ajax_nonce=<?php echo wp_create_nonce( 'headspace-edit_setting_'.$type )?>"><strong><?php echo esc_html( $name ) ?></strong></a>
11
  <?php else : ?>
12
+ <strong><?php echo esc_html( $name ) ?></strong>
13
  <?php endif; ?>
14
 
15
+ - <?php echo esc_html( $desc ) ?>
view/admin/site-module-edit.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="option">
3
- <img style="display: none" src="<?php echo $this->url () ?>/images/progress.gif" width="50" height="16" alt="Progress" id="load_<?php echo $module->id () ?>"/>
4
  </div>
5
 
6
  <input type="checkbox" <?php if ($module->is_active ()) echo ' checked="checked"' ?> name="site_modules[<?php echo $module->id() ?>]" value="<?php echo $module->file(); ?>" />
@@ -10,15 +10,15 @@
10
  <form action="<?php echo admin_url( 'admin-ajax.php' ); ?>" method="post">
11
  <table class="headspace">
12
  <?php $module->edit (); ?>
13
-
14
  <tr>
15
  <th></th>
16
  <td>
17
  <input class="button-primary" type="submit" name="save" value="<?php _e ('Save', 'headspace'); ?>"/>
18
  <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'headspace'); ?>"/>
19
-
20
  <input type="hidden" name="action" value="hs_site_save"/>
21
- <input type="hidden" name="module" value="<?php echo htmlspecialchars( $module->id() ); ?>"/>
22
  <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce ('headspace-site_save_'.$module->id() ) ?>"/>
23
  </td>
24
  </tr>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <div class="option">
3
+ <img style="display: none" src="<?php echo plugins_url( '/images/progress.gif', $this->base_url() ); ?>" width="50" height="16" alt="Progress" id="load_<?php echo $module->id () ?>"/>
4
  </div>
5
 
6
  <input type="checkbox" <?php if ($module->is_active ()) echo ' checked="checked"' ?> name="site_modules[<?php echo $module->id() ?>]" value="<?php echo $module->file(); ?>" />
10
  <form action="<?php echo admin_url( 'admin-ajax.php' ); ?>" method="post">
11
  <table class="headspace">
12
  <?php $module->edit (); ?>
13
+
14
  <tr>
15
  <th></th>
16
  <td>
17
  <input class="button-primary" type="submit" name="save" value="<?php _e ('Save', 'headspace'); ?>"/>
18
  <input class="button-secondary" type="submit" name="cancel" value="<?php _e ('Cancel', 'headspace'); ?>"/>
19
+
20
  <input type="hidden" name="action" value="hs_site_save"/>
21
+ <input type="hidden" name="module" value="<?php echo esc_attr( $module->id() ); ?>"/>
22
  <input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce ('headspace-site_save_'.$module->id() ) ?>"/>
23
  </td>
24
  </tr>
view/admin/site-module-item.php CHANGED
@@ -1,12 +1,14 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><div class="option">
2
- <img style="display: none" src="<?php echo $this->url () ?>/images/progress.gif" width="50" height="16" alt="Progress" class="load" />
3
-
4
  <?php if ($module->has_config ()) : ?>
5
- <a href="<?php echo admin_url( 'admin-ajax.php' ) ?>?action=hs_site_edit&amp;module=<?php echo $module->id(); ?>" class="edit"><img src="<?php echo $this->url () ?>/images/edit.png" width="16" height="16" alt="Edit"/></a>
 
 
6
  <?php endif; ?>
7
-
8
  <a href="#help" class="help">
9
- <img src="<?php echo $this->url () ?>/images/help.png" width="16" height="16" alt="Help"/>
10
  </a>
11
  </div>
12
 
@@ -16,4 +18,4 @@
16
 
17
  <div class="help" style="display: none">
18
  <?php echo $module->description (); ?>
19
- </div>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><div class="option">
2
+ <img style="display: none" src="<?php echo plugins_url( '/images/progress.gif', $this->base_url() ); ?>" width="50" height="16" alt="Progress" class="load" />
3
+
4
  <?php if ($module->has_config ()) : ?>
5
+ <a href="<?php echo admin_url( 'admin-ajax.php' ) ?>?action=hs_site_edit&amp;module=<?php echo $module->id(); ?>" class="edit">
6
+ <img src="<?php echo plugins_url( '/images/edit.png', $this->base_url() ); ?>" width="16" height="16" alt="Edit"/>
7
+ </a>
8
  <?php endif; ?>
9
+
10
  <a href="#help" class="help">
11
+ <img src="<?php echo plugins_url( '/images/help.png', $this->base_url() ); ?>" width="16" height="16" alt="Help"/>
12
  </a>
13
  </div>
14
 
18
 
19
  <div class="help" style="display: none">
20
  <?php echo $module->description (); ?>
21
+ </div>
view/admin/submenu.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <ul class="subsubsub">
3
- <li><a <?php if ($sub == '') echo 'class="current"'; ?>href="<?php echo $url ?>"><?php _e ('Page Settings', 'headspace') ?></a> |</li>
4
- <li><a <?php if ($sub == 'modules') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=modules"><?php _e ('Page Modules', 'headspace') ?></a> |</li>
5
- <li><a <?php if ($sub == 'site') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=site"><?php _e ('Site Modules', 'headspace') ?></a> |</li>
6
- <li><a <?php if ($sub == 'options') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=options"><?php _e ('Options', 'headspace') ?></a> |</li>
7
- <li><a <?php if ($sub == 'import') echo 'class="current"'; ?>href="<?php echo $url ?>&amp;sub=import"><?php _e ('Import', 'headspace') ?></a></li>
8
  </ul>
1
  <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
2
  <ul class="subsubsub">
3
+ <li><a <?php if ($sub == '') echo 'class="current"'; ?> href="<?php echo admin_url( 'options-general.php?page=headspace.php' ); ?>"><?php _e ('Page Settings', 'headspace') ?></a> |</li>
4
+ <li><a <?php if ($sub == 'modules') echo 'class="current"'; ?> href="<?php echo admin_url( 'options-general.php?page=headspace.php' ); ?>&amp;sub=modules"><?php _e ('Page Modules', 'headspace') ?></a> |</li>
5
+ <li><a <?php if ($sub == 'site') echo 'class="current"'; ?> href="<?php echo admin_url( 'options-general.php?page=headspace.php' ); ?>&amp;sub=site"><?php _e ('Site Modules', 'headspace') ?></a> |</li>
6
+ <li><a <?php if ($sub == 'options') echo 'class="current"'; ?> href="<?php echo admin_url( 'options-general.php?page=headspace.php' ); ?>&amp;sub=options"><?php _e ('Options', 'headspace') ?></a> |</li>
7
+ <li><a <?php if ($sub == 'import') echo 'class="current"'; ?> href="<?php echo admin_url( 'options-general.php?page=headspace.php' ); ?>&amp;sub=import"><?php _e ('Import', 'headspace') ?></a></li>
8
  </ul>
view/admin/version.php CHANGED
@@ -2,7 +2,7 @@
2
  <h3><?php _e ('HeadSpace2 News', 'headspace'); ?></h3>
3
 
4
  <?php foreach ($rss->items AS $item) : ?>
5
- <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
6
- <p><?php echo $item['description']; ?></p>
7
  <?php endforeach; ?>
8
  </div>
2
  <h3><?php _e ('HeadSpace2 News', 'headspace'); ?></h3>
3
 
4
  <?php foreach ($rss->items AS $item) : ?>
5
+ <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo esc_html($item['title']); ?></a> &#8212; <?php printf(__('%s ago'), human_time_diff(strtotime($item['pubdate'], time() ) ) ); ?></h4>
6
+ <p><?php echo esc_html( $item['description'] ); ?></p>
7
  <?php endforeach; ?>
8
  </div>