BBP_Converter::admin_head()
Admin scripts
Description
Source
File: bp-forums/admin/converter.php
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | public function admin_head() { ?> <style media= "screen" > /*<![CDATA[*/ div.bbp-converter-updated, div.bbp-converter-warning { border-radius: 3px 3px 3px 3px; border-style: solid; border-width: 1px; padding: 5px 5px 5px 5px; } div.bbp-converter-updated { height: 300px; overflow: auto; display: none; background-color: #FFFFE0; border-color: #E6DB55; font-family: monospace; font-weight: bold; } div.bbp-converter-updated p { margin: 0.5em 0; padding: 2px; float: left; clear: left; } div.bbp-converter-updated p.loading { padding: 2px 20px 2px 2px; background-image: url( '<?php echo admin_url(); ?>images/wpspin_light.gif' ); background-repeat: no-repeat; background-position: center right; } #bbp-converter-stop { display:none; } #bbp-converter-progress { display:none; } /*]]>*/ </style> <script language= "javascript" > var bbconverter_is_running = false; var bbconverter_run_timer; var bbconverter_delay_time = 0; function bbconverter_grab_data() { var values = {}; jQuery.each(jQuery( '#bbp-converter-settings' ).serializeArray(), function (i, field) { values[field.name] = field.value; }); if ( values[ '_bbp_converter_restart' ] ) { jQuery( '#_bbp_converter_restart' ).removeAttr( "checked" ); } if ( values[ '_bbp_converter_delay_time' ] ) { bbconverter_delay_time = values[ '_bbp_converter_delay_time' ] * 1000; } values[ 'action' ] = 'bbconverter_process' ; values[ '_ajax_nonce' ] = '<?php echo wp_create_nonce( ' bbp_converter_process ' ); ?>' ; return values; } function bbconverter_start() { if ( false == bbconverter_is_running ) { bbconverter_is_running = true; jQuery( '#bbp-converter-start' ).hide(); jQuery( '#bbp-converter-stop' ).show(); jQuery( '#bbp-converter-progress' ).show(); bbconverter_log( '<p class="loading"><?php esc_html_e( ' Starting Conversion ', ' buddyboss ' ); ?></p>' ); bbconverter_run(); } } function bbconverter_run() { jQuery.post(ajaxurl, bbconverter_grab_data(), function (response) { var response_length = response.length - 1; response = response.substring(0,response_length); bbconverter_success(response); }); } function bbconverter_stop() { jQuery( '#bbp-converter-start' ).show(); jQuery( '#bbp-converter-stop' ).hide(); jQuery( '#bbp-converter-progress' ).hide(); jQuery( '#bbp-converter-message p' ).removeClass( 'loading' ); bbconverter_is_running = false; clearTimeout( bbconverter_run_timer ); } function bbconverter_success(response) { bbconverter_log(response); if ( response == '<p class="loading"><?php esc_html_e( ' Conversion Complete ', ' buddyboss ' ); ?></p>' || response.indexOf( 'error' ) > -1 ) { bbconverter_log( '<p><?php esc_html_e(' Repair any missing information: ', ' buddyboss ' ); ?> <a href="<?php echo admin_url(); ?>admin.php?page=bbp-repair"><?php esc_html_e( ' Continue ', ' buddyboss '); ?></a></p>' ); bbconverter_stop(); } else if ( bbconverter_is_running ) { // keep going jQuery( '#bbp-converter-progress' ).show(); clearTimeout( bbconverter_run_timer ); bbconverter_run_timer = setTimeout( 'bbconverter_run()' , bbconverter_delay_time ); } else { bbconverter_stop(); } } function bbconverter_log(text) { if ( jQuery( '#bbp-converter-message' ).css( 'display' ) == 'none' ) { jQuery( '#bbp-converter-message' ).show(); } if ( text ) { jQuery( '#bbp-converter-message p' ).removeClass( 'loading' ); jQuery( '#bbp-converter-message' ).prepend( text ); } } </script> <?php } |
Changelog
Version | Description |
---|---|
bbPress (r3813) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.