function sp_admin_bar_do_load_js($footer) { # always load the auto update scripts sp_plugin_enqueue_script('spabupdate', SPABSCRIPT . 'sp-admin-bar-update.js', array('jquery'), false, $footer); $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SPABSCRIPT . 'sp-admin-bar-dev.js' : SPABSCRIPT . 'sp-admin-bar.js'; sp_plugin_enqueue_script('spabjs', $script, array('jquery'), false, $footer); $strings = array('loading' => __('Loading topic', 'spab'), 'saving' => __('Saving post', 'spab')); sp_plugin_localize_script('spabjs', 'sp_adminbar_vars', $strings); }
function sp_load_forum_scripts() { global $spVars, $spThisUser, $spMobile, $spDevice; $footer = sp_get_option('sfscriptfoot') ? true : false; do_action('sph_scripts_start', $footer); $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SFJSCRIPT . 'sp-forum-dev.js' : SFJSCRIPT . 'sp-forum.js'; sp_plugin_enqueue_script('spforum', $script, array('jquery', 'jquery-form'), false, $footer); $target = isset($spVars['forumid']) ? $spVars['forumid'] : 'global'; $strings = array('problem' => sp_text('Unable to save'), 'noguestname' => sp_text('No guest username entered'), 'noguestemail' => sp_text('No guest email Entered'), 'notopictitle' => sp_text('No topic title entered'), 'nomath' => sp_text('Spam math unanswered'), 'nocontent' => sp_text('No post content entered'), 'rejected' => sp_text('This post is rejected because it contains embedded formatting, probably pasted in form MS Word or other WYSIWYG editor'), 'iframe' => sp_text('This post contains an iframe which are disallowed'), 'savingpost' => sp_text('Saving post'), 'nosearch' => sp_text('No search text entered'), 'allwordmin' => sp_text('Minimum number of characters that can be used for a search word is'), 'somewordmin' => sp_text('Not all words can be used for the search as minimum word length is'), 'wait' => sp_text('Please wait'), 'deletepost' => sp_text('Are you sure you want to delete this post?'), 'deletetopic' => sp_text('Are you sure you want to delete this topic?'), 'topicdeleted' => sp_text('Topic deleted'), 'postdeleted' => sp_text('Post deleted'), 'markread' => sp_text('All posts marked as read'), 'pinpost' => sp_text('Post pin status toggled'), 'pintopic' => sp_text('Topic pin status toggled'), 'locktopic' => sp_text('Topic lock status toggled')); $strings = apply_filters('sph_forum_vars', $strings); sp_plugin_localize_script('spforum', 'sp_forum_vars', $strings); # Older themes (Unified) define a constant SP_MOBILE_THEME now being deprecated. # if this constant exists (custom Unfied theme) swap for theme cap registration if (defined('SP_MOBILE_THEME') && SP_MOBILE_THEME) { add_theme_support('sp-theme-responsive'); } # sp_platform_vars is not static so cannot be in combined js cache and cannote use localize script $tooltips = defined('SP_TOOLTIPS') ? SP_TOOLTIPS : true; $mobtheme = current_theme_supports('sp-theme-responsive') ? 1 : 0; $checkboxes = defined('SP_USE_PRETTY_CBOX') ? SP_USE_PRETTY_CBOX : false; $iframe = sp_get_auth('can_use_iframes', $target, $spThisUser->ID) ? 'no' : 'yes'; ?> <script type='text/javascript'> /* <![CDATA[ */ var sp_platform_vars = { "focus":"forum", "mobile":"<?php echo $spMobile; ?> ", "device":"<?php echo $spDevice; ?> ", "tooltips":"<?php echo $tooltips; ?> ", "mobiletheme":"<?php echo $mobtheme; ?> ", "checkboxes":"<?php echo $checkboxes; ?> ", "headpadding":"<?php echo sp_get_option('spheaderspace'); ?> ", "saveprocess": 0, "checkiframe":"<?php echo $iframe; ?> ", <?php do_action('sph_platform_vars'); ?> }; /* ]]> */ </script> <?php $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SFCJSCRIPT . 'sp-common-dev.js' : SFCJSCRIPT . 'sp-common.js'; sp_plugin_enqueue_script('spcommon', $script, array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-dialog', 'jquery-ui-autocomplete', 'jquery-effects-slide'), false, $footer); if ($checkboxes) { $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SFCJSCRIPT . 'checkboxes/prettyCheckboxes-dev.js' : SFCJSCRIPT . 'checkboxes/prettyCheckboxes.js'; sp_plugin_enqueue_script('jquery.checkboxes', $script, array('jquery'), false, $footer); } $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SFJSCRIPT . 'print-this/printThis-dev.js' : SFJSCRIPT . 'print-this/printThis.js'; sp_plugin_enqueue_script('sfprintthis', $script, array('jquery'), false, $footer); # Dialog boxes and other jQuery UI components $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SFJSCRIPT . 'msdropdown/msdropdown-dev.js' : SFJSCRIPT . 'msdropdown/msdropdown.js'; sp_plugin_enqueue_script('jquery.ui.msdropdown', $script, array('jquery', 'jquery-ui-core', 'jquery-ui-widget'), false, $footer); if ($spDevice != 'desktop') { sp_plugin_enqueue_script('jquery-touch-punch', false, array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'), false, $footer); $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SFJSCRIPT . 'mobile/sp-mobilemenu-dev.js' : SFJSCRIPT . 'mobile/sp-mobilemenu.js'; sp_plugin_enqueue_script('jquery.spmobilemenu', $script, array('jquery'), false, $footer); } else { sp_plugin_enqueue_script('jquery-ui-tooltip', false, array('jquery', 'jquery-ui-core', 'jquery-ui-widget'), false, $footer); } sp_plugin_enqueue_script('jquery.tools', SFJSCRIPT . 'jquery-tools/jquery.tools.min.js', array('jquery', 'jquery-ui-core', 'jquery-ui-widget'), false, $footer); # password strength meter on profile if ($spVars['pageview'] == 'profileedit') { wp_enqueue_script('user-profile'); } # tell plugins to enqueue their scripts do_action('sph_print_plugin_scripts', $footer); $combine_js = sp_get_option('combinejs'); if ($combine_js) { # use compressed scripts sp_combine_plugin_script_files(); } else { # use individual scripts global $sp_plugin_scripts, $wp_scripts; if (!empty($sp_plugin_scripts)) { foreach ($sp_plugin_scripts->queue as $handle) { # enqueue with wp $f = empty($sp_plugin_scripts->registered[$handle]->extra['group']) || $sp_plugin_scripts->registered[$handle]->extra['group'] == 0 ? false : true; $plugin_footer = is_array($sp_plugin_scripts->registered[$handle]->extra) && $f == 1 ? true : false; wp_enqueue_script($handle, $sp_plugin_scripts->registered[$handle]->src, $sp_plugin_scripts->registered[$handle]->deps, false, $plugin_footer); # too late to register script since already formatted - so just set the wp script data equal it our localized data $data = $sp_plugin_scripts->get_data($handle, 'data'); $wp_scripts->registered[$handle]->extra['data'] = $data; } } } do_action('sph_scripts_end', $footer); }
function sp_captcha_do_load_js($footer) { $script = defined('SP_SCRIPTS_DEBUG') && SP_SCRIPTS_DEBUG ? SPCAPSCRIPT . 'jquery.captcha-dev.js' : SPCAPSCRIPT . 'jquery.captcha.js'; sp_plugin_enqueue_script('captcha', $script, array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-touch-punch'), false, $footer); }