PluginProbe
FeedWordPress / 2020.0818
FeedWordPress v2020.0818
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
feedwordpress / feedwordpresssettingsui.class.php

feedwordpresssettingsui.class.php in FeedWordPress 2020.0818, at feedwordpresssettingsui.class.php

112 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * class FeedWordPressSettingsUI: Module to package several functions related to the
4 * WordPress administrative / settings interface.
5 */
6 class FeedWordPressSettingsUI {
7 static function is_admin () {
8 global $fwp_path;
9
10 $admin_page = false; // Innocent until proven guilty
11 if (isset($_REQUEST['page'])) :
12 $admin_page = (
13 is_admin()
14 and preg_match("|^{$fwp_path}/|", $_REQUEST['page'])
15 );
16 endif;
17 return $admin_page;
18 }
19
20 static function admin_scripts () {
21 global $fwp_path;
22
23 wp_enqueue_script('post'); // for magic tag and category boxes
24 wp_enqueue_script('admin-forms'); // for checkbox selection
25
26 wp_register_script('feedwordpress-elements', plugins_url('/' . $fwp_path . '/feedwordpress-elements.js') );
27 wp_enqueue_script('feedwordpress-elements');
28 }
29
30 static function admin_styles () {
31 ?>
32 <style type="text/css">
33 #feedwordpress-admin-feeds .link-rss-params-remove .x, .feedwordpress-admin .remove-it .x {
34 background: url(<?php print admin_url('images/xit.gif') ?>) no-repeat scroll 0 0 transparent;
35 }
36
37 #feedwordpress-admin-feeds .link-rss-params-remove:hover .x, .feedwordpress-admin .remove-it:hover .x {
38 background: url(<?php print admin_url('images/xit.gif') ?>) no-repeat scroll -10px 0 transparent;
39 }
40
41 .fwpfs {
42 background-image: url(<?php print admin_url('images/fav.png'); ?>);
43 background-repeat: repeat-x;
44 background-position: left center;
45 background-attachment: scroll;
46 }
47 .fwpfs.slide-down {
48 background-image:url(<?php print admin_url('images/fav-top.png'); ?>);
49 background-position:0 top;
50 background-repeat:repeat-x;
51 }
52
53 .update-results {
54 max-width: 100%;
55 overflow: auto;
56 }
57
58 </style>
59 <?php
60 } /* FeedWordPressSettingsUI::admin_styles () */
61
62 static function ajax_nonce_fields () {
63 if (function_exists('wp_nonce_field')) :
64 echo "<form style='display: none' method='get' action=''>\n<p>\n";
65 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
66 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
67 echo "</p>\n</form>\n";
68 endif;
69 } /* FeedWordPressSettingsUI::ajax_nonce_fields () */
70
71 static function fix_toggles_js ($context) {
72 ?>
73 <script type="text/javascript">
74 jQuery(document).ready( function($) {
75 // In case someone got here first...
76 $('.postbox h3, .postbox .handlediv').unbind('click');
77 $('.postbox h3 a').unbind('click');
78 $('.hide-postbox-tog').unbind('click');
79 $('.columns-prefs input[type="radio"]').unbind('click');
80 $('.meta-box-sortables').sortable('destroy');
81
82 postboxes.add_postbox_toggles('<?php print $context; ?>');
83 } );
84 </script>
85 <?php
86 } /* FeedWordPressSettingsUI::fix_toggles_js () */
87
88 static function magic_input_tip_js ($id) {
89 if (!preg_match('/^[.#]/', $id)) :
90 $id = '#'.$id;
91 endif;
92 ?>
93 <script type="text/javascript">
94 jQuery(document).ready( function () {
95 var inputBox = jQuery("<?php print $id; ?>");
96 var boxEl = inputBox.get(0);
97 if (boxEl.value==boxEl.defaultValue) { inputBox.addClass('form-input-tip'); }
98 inputBox.focus(function() {
99 if ( this.value == this.defaultValue )
100 jQuery(this).val( '' ).removeClass( 'form-input-tip' );
101 });
102 inputBox.blur(function() {
103 if ( this.value == '' )
104 jQuery(this).val( this.defaultValue ).addClass( 'form-input-tip' );
105 });
106 } );
107 </script>
108 <?php
109 } /* FeedWordPressSettingsUI::magic_input_tip_js () */
110 } /* class FeedWordPressSettingsUI */
111
112