PluginProbe
FeedWordPress / 2022.0203
FeedWordPress v2022.0203
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
← All changes | feedwordpresssettingsui.class.php +49 -86 trunk2022.0203 View file →
@@ -3,90 +3,63 @@
3 3 * class FeedWordPressSettingsUI: Module to package several functions related to the
4 4 * WordPress administrative / settings interface.
5 5 */
6 6 class FeedWordPressSettingsUI {
7 - /**
8 - * Checks if current user is an administrator with permissions to
9 - * see the FWP dashboard.
10 - *
11 - * @return bool True if current user is an administrator.
12 - *
13 - * @uses is_admin()
14 - * @uses FeedWordPress::path()
15 - * @uses MyPHP::request()
16 - */
17 - static function is_admin() {
7 + static function is_admin () {
8 +
18 9 $admin_page = false; // Innocent until proven guilty
19 - if ( ! is_null( MyPHP::request( 'page' ) ) ) :
20 - $fwp = preg_quote( FeedWordPress::path() );
10 + if (!is_null(MyPHP::request('page'))) :
11 + $fwp = preg_quote(FeedWordPress::path());
21 12 $admin_page = (
22 13 is_admin()
23 - and preg_match( "|^{$fwp}/|", MyPHP::request( 'page' ) )
14 + and preg_match("|^${fwp}/|", MyPHP::request('page'))
24 15 );
25 16 endif;
26 17 return $admin_page;
27 18 }
28 19
29 - /**
30 - * Enqueues JavaScript for the administration dashboard.
31 - */
32 - static function admin_scripts() {
33 - wp_enqueue_script( 'post' ); // for magic tag and category boxes
34 - wp_enqueue_script( 'admin-forms' ); // for checkbox selection
20 + static function admin_scripts () {
21 + wp_enqueue_script('post'); // for magic tag and category boxes
22 + wp_enqueue_script('admin-forms'); // for checkbox selection
35 23
36 - wp_register_script( 'feedwordpress-elements', plugins_url( 'assets/js/feedwordpress-elements.js', __FILE__ ) );
37 - wp_enqueue_script( 'feedwordpress-elements' );
24 + wp_register_script('feedwordpress-elements', plugins_url( 'assets/js/feedwordpress-elements.js', __FILE__ ) );
25 + wp_enqueue_script('feedwordpress-elements');
38 26 }
39 27
40 - /**
41 - * Sets the CSS for the administration dashboard.
42 - *
43 - * @todo At some point in the future, these ought to be changed to modern designs,
44 - * i.e. either Dashicons or the upcoming SVG icon fonts. (gwyneth 20210717)
45 - */
46 - static function admin_styles() {
28 + static function admin_styles () {
47 29 ?>
48 30 <style type="text/css">
49 31 #feedwordpress-admin-feeds .link-rss-params-remove .x, .feedwordpress-admin .remove-it .x {
50 - content: "\f153"; /* dashicons-dismiss */
51 - color: var(--wp-components-color-foreground,#1e1e1e);
52 - background-color: var(--wp-components-color-background);
32 + background: url(<?php print admin_url('images/xit.gif') ?>) no-repeat scroll 0 0 transparent;
53 33 }
34 +
54 35 #feedwordpress-admin-feeds .link-rss-params-remove:hover .x, .feedwordpress-admin .remove-it:hover .x {
55 - content: "\f153"; /* dashicons-dismiss */
56 - color: var(--wp-components-color-accent);
57 - background-color: var(--wp-components-color-background);
36 + background: url(<?php print admin_url('images/xit.gif') ?>) no-repeat scroll -10px 0 transparent;
58 37 }
59 38
60 - /* Note: the old images referred here were deprecated around 2009 or so and are *not*
61 - part of the WordPress core any more; see https://core.trac.wordpress.org/ticket/20980
62 - I have placed these missing images on the images folder instead (gwyneth 20210717) */
63 39 .fwpfs {
64 - background-image: url(<?php echo esc_url( plugins_url( 'assets/images/fav.png', __FILE__ ) ); ?>);
40 + background-image: url(<?php print admin_url('images/fav.png'); ?>);
65 41 background-repeat: repeat-x;
66 42 background-position: left center;
67 43 background-attachment: scroll;
68 44 }
69 45 .fwpfs.slide-down {
70 - background-image: url(<?php echo esc_url( plugins_url( 'assets/images/fav-top.png', __FILE__ ) ); ?>);
71 - background-position: 0 top;
72 - background-repeat: repeat-x;
46 + background-image:url(<?php print admin_url('images/fav-top.png'); ?>);
47 + background-position:0 top;
48 + background-repeat:repeat-x;
73 49 }
50 +
74 51 .update-results {
75 52 max-width: 100%;
76 53 overflow: auto;
77 54 }
55 +
78 56 </style>
79 57 <?php
80 58 } /* FeedWordPressSettingsUI::admin_styles () */
81 59
82 - /**
83 - * Makes sure we have nonce active.
84 - *
85 - * @uses wp_nonce_field()
86 - */
87 - static function ajax_nonce_fields() {
88 - if ( function_exists( 'wp_nonce_field' ) ) :
60 + static function ajax_nonce_fields () {
61 + if (function_exists('wp_nonce_field')) :
89 62 echo "<form style='display: none' method='get' action=''>\n<p>\n";
90 63 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
91 64 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
92 65 echo "</p>\n</form>\n";
@@ -103,9 +76,9 @@
103 76 $('.hide-postbox-tog').unbind('click');
104 77 $('.columns-prefs input[type="radio"]').unbind('click');
105 78 $('.meta-box-sortables').sortable('destroy');
106 79
107 - postboxes.add_postbox_toggles('<?php print esc_attr( $context ); ?>');
80 + postboxes.add_postbox_toggles('<?php print $context; ?>');
108 81 } );
109 82 </script>
110 83 <?php
111 84 } /* FeedWordPressSettingsUI::fix_toggles_js () */
@@ -118,34 +91,34 @@
118 91 * @param string $slug The slug name for the generic template
119 92 * @param string $name The name of the specialized template
120 93 * @param array $args Additional arguments passed to the template.
121 94 */
122 - static public function get_template_part( $slug, $name = null, $type = null, $args = array() ) {
95 + static public function get_template_part ( $slug, $name = null, $type = null, $args = array() ) {
123 96 global $feedwordpress;
97 +
98 + do_action( "feedwordpress_get_template_part_${slug}", $slug, $name, $type, $args );
124 99
125 - do_action( "feedwordpress_get_template_part_{$slug}", $slug, $name, $type, $args );
126 -
127 100 $templates = array();
128 101 $name = (string) $name;
129 102 $type = (string) $type;
130 -
103 +
131 104 $ext = ".php";
132 - if ( strlen( $type ) > 0 ):
133 - $ext = ".{$type}{$ext}";
105 + if ( strlen($type) > 0 ):
106 + $ext = ".${type}${ext}";
134 107 endif;
135 -
136 - if ( strlen( $name ) > 0 ) :
137 - $templates[] = "{$slug}-{$name}{$ext}";
108 +
109 + if ( strlen($name) > 0 ) :
110 + $templates[] = "${slug}-${name}${ext}";
138 111 endif;
139 - $templates[] = "{$slug}{$ext}";
140 -
112 + $templates[] = "${slug}${ext}";
113 +
141 114 do_action( "feedwordpress_get_template_part", $slug, $name, $type, $args );
142 -
115 +
143 116 // locate_template
144 117 $located = '';
145 118 foreach ( $templates as $template_name ) :
146 119 if ( !! $template_name ) :
147 - $templatePath = $feedwordpress->plugin_dir_path( 'templates/' . $template_name );
120 + $templatePath = $feedwordpress->plugin_dir_path('templates/' . $template_name);
148 121 if ( is_readable( $templatePath ) ) :
149 122 $located = $templatePath;
150 123 break;
151 124 endif;
@@ -150,41 +123,31 @@
150 123 break;
151 124 endif;
152 125 endif;
153 126 endforeach;
154 -
155 - if ( strlen( $located ) > 0 ) :
127 +
128 + if ( strlen($located) > 0 ) :
156 129 load_template( $located, /*require_once=*/ false, /*args=*/ $args );
157 130 endif;
158 131 } /* FeedWordPressSettingsUI::get_template_part () */
159 -
160 - /**
161 - * Generates contextual hovering text with tips for the form fields.
162 - *
163 - * How exactly this works is beyond myself. (gwyneth 20230916)
164 - *
165 - * @param string $id Apparently it's the field's id attribute.
166 - *
167 - */
168 - static function magic_input_tip_js( $id ) {
169 - if ( ! preg_match( '/^[.#]/', $id ) ) :
170 - $id = '#' . $id;
132 +
133 + static function magic_input_tip_js ($id) {
134 + if (!preg_match('/^[.#]/', $id)) :
135 + $id = '#'.$id;
171 136 endif;
172 137 ?>
173 138 <script type="text/javascript">
174 - jQuery( document ).ready( function () {
175 - var inputBox = jQuery( "<?php print esc_attr( $id ); ?>" );
176 - var boxEl = inputBox.get( 0 );
177 - if ( boxEl.value == boxEl.defaultValue ) {
178 - inputBox.addClass( 'form-input-tip' );
179 - }
139 + jQuery(document).ready( function () {
140 + var inputBox = jQuery("<?php print $id; ?>");
141 + var boxEl = inputBox.get(0);
142 + if (boxEl.value==boxEl.defaultValue) { inputBox.addClass('form-input-tip'); }
180 143 inputBox.focus(function() {
181 144 if ( this.value == this.defaultValue )
182 - jQuery( this ).val( '' ).removeClass( 'form-input-tip' );
145 + jQuery(this).val( '' ).removeClass( 'form-input-tip' );
183 146 });
184 - inputBox.blur( function() {
147 + inputBox.blur(function() {
185 148 if ( this.value == '' )
186 - jQuery( this ).val( this.defaultValue ).addClass( 'form-input-tip' );
149 + jQuery(this).val( this.defaultValue ).addClass( 'form-input-tip' );
187 150 });
188 151 } );
189 152 </script>
190 153 <?php