Example #1
0
function loading_page_get_screen($id)
{
    $screens = loading_page_get_screen_list();
    if (!empty($screens)) {
        foreach ($screens as $s) {
            if ($s['id'] == $id) {
                return $s;
            }
        }
        return $screens[0];
    }
    return false;
}
Example #2
0
    function loading_page_settings_page()
    {
        if (isset($_POST['loading_page_nonce']) && wp_verify_nonce($_POST['loading_page_nonce'], __FILE__)) {
            // Set the default options here
            $loading_page_options = array('foregroundColor' => !empty($_POST['lp_foregroundColor']) ? $_POST['lp_foregroundColor'] : '#FFFFFF', 'backgroundColor' => !empty($_POST['lp_backgroundColor']) ? $_POST['lp_backgroundColor'] : '#000000', 'backgroundImage' => $_POST['lp_backgroundImage'], 'backgroundImageRepeat' => $_POST['lp_backgroundRepeat'], 'fullscreen' => isset($_POST['lp_fullscreen']) ? 1 : 0, 'enabled_loading_screen' => isset($_POST['lp_enabled_loading_screen']) ? true : false, 'lp_loading_screen_display_in' => isset($_POST['lp_loading_screen_display_in']) ? $_POST['lp_loading_screen_display_in'] : 'all', 'once_per_session' => isset($_POST['once_per_session']) ? true : false, 'lp_loading_screen_display_in_pages' => $_POST['lp_loading_screen_display_in_pages'], 'lp_loading_screen_exclude_from_pages' => $_POST['lp_loading_screen_exclude_from_pages'], 'loading_screen' => $_POST['lp_loading_screen'], 'displayPercent' => isset($_POST['lp_displayPercent']) ? true : false, 'pageEffect' => $_POST['lp_pageEffect']);
            if (isset($_POST['lp_ls'])) {
                $loading_page_options['lp_ls'] = $_POST['lp_ls'];
            }
            if (update_option('loading_page_options', $loading_page_options)) {
                print '<div class="updated">' . __('The Loading Page has been stored successfully', LOADING_PAGE_TD) . '</div>';
            } else {
                print '<div class="error">' . __('The Loading Page settings could not be stored', LOADING_PAGE_TD) . '</div>';
            }
        }
        $loading_page_options = get_option('loading_page_options');
        ?>
        <div class="wrap">
            <h2><?php 
        _e('Loading Page Settings', LOADING_PAGE_TD);
        ?>
</h2>
            <form method="post">
                <input type="hidden" name="loading_page_nonce" value="<?php 
        print wp_create_nonce(__FILE__);
        ?>
" />    
                <div class="postbox" style="min-width:760px;">
                    <h3 class='hndle' style="padding:5px;"><span><?php 
        _e('Loading Screen', LOADING_PAGE_TD);
        ?>
</span></h3>
                    <div class="inside">
                        <p  style="border:1px solid #E6DB55;margin-bottom:10px;padding:5px;background-color: #FFFFE0;">If you want test the premium version of Loading Page go to the following links:<br/> <a href="http://demos.net-factor.com/loading-page/wp-login.php" target="_blank">Administration area: Click to access the administration area demo</a><br/> <a href="http://demos.net-factor.com/loading-page/" target="_blank">Public page: Click to access the Loading Page</a>
						</p>
                        <p><?php 
        print _e("Displays a loading screen until the webpage is ready, the screen shows the loading percent.", LOADING_PAGE_TD);
        ?>
</p>
                        <table class="form-table">
                            <tr>
                                <th><?php 
        _e('Enable loading screen', LOADING_PAGE_TD);
        ?>
</th>
                                <td><input type="checkbox" name="lp_enabled_loading_screen" <?php 
        echo $loading_page_options['enabled_loading_screen'] ? 'CHECKED' : '';
        ?>
 /></td>
                            </tr>
							<tr>
								<th><?php 
        _e('Display the loading screen once per session', LOADING_PAGE_TD);
        ?>
</th>
								<td><input type="checkbox" name="once_per_session" <?php 
        echo isset($loading_page_options['once_per_session']) && $loading_page_options['once_per_session'] ? 'CHECKED' : '';
        ?>
 /></td>
							</tr>
                            <tr>
                                <th><?php 
        _e('Display loading screen in', LOADING_PAGE_TD);
        ?>
</th>
                                <td>
									<div><input type="radio" name="lp_loading_screen_display_in" value="home" <?php 
        echo isset($loading_page_options['lp_loading_screen_display_in']) && $loading_page_options['lp_loading_screen_display_in'] == 'home' ? 'CHECKED' : '';
        ?>
 /> homepage only</div>
									<div><input type="radio" name="lp_loading_screen_display_in" value="all" <?php 
        echo isset($loading_page_options['lp_loading_screen_display_in']) && $loading_page_options['lp_loading_screen_display_in'] == 'all' ? 'CHECKED' : '';
        ?>
 /> all pages</div>
									<div><input type="radio" name="lp_loading_screen_display_in" value="pages" <?php 
        echo isset($loading_page_options['lp_loading_screen_display_in']) && $loading_page_options['lp_loading_screen_display_in'] == 'pages' ? 'CHECKED' : '';
        ?>
 /> the specific pages 
									<input type="text" name="lp_loading_screen_display_in_pages" value="<?php 
        if (!empty($loading_page_options['lp_loading_screen_display_in_pages'])) {
            print $loading_page_options['lp_loading_screen_display_in_pages'];
        }
        ?>
"> <span>In this case should be typed one, or more IDs for posts or pages, separated by the comma symbol ","</span></div>
									
								</td>
                            </tr>
							<tr>
								<th><?php 
        _e('Exclude loading screen from');
        ?>
</th>
								<td><input type="text" name="lp_loading_screen_exclude_from_pages" value="<?php 
        if (!empty($loading_page_options['lp_loading_screen_exclude_from_pages'])) {
            print $loading_page_options['lp_loading_screen_exclude_from_pages'];
        }
        ?>
"> <span>In this case should be typed one, or more IDs for posts or pages, separated by the comma symbol ","</span></td>
							</tr>
                            <tr>
                                <?php 
        $loading_screens = loading_page_get_screen_list();
        ?>
    
                                <th><?php 
        _e('Select the loading screen', LOADING_PAGE_TD);
        ?>
</th>
                                <td>
                                    <select name="lp_loading_screen">
                                        <?php 
        foreach ($loading_screens as $screen) {
            print '<option value="' . $screen['id'] . '" ' . ($loading_page_options['loading_screen'] == $screen['id'] ? 'SELECTED' : '') . ' title="' . (!empty($screen['tips']) ? esc_attr($screen['tips']) : '') . '" >' . $screen['name'] . '</option>';
        }
        ?>
                                    </select>
                                    <span style="color:#FF0000;">
                                        To display a different loading screen you require the commercial version of plugin <a href="http://wordpress.dwbooster.com/content-tools/loading-page" target="_blank">CLICK HERE</a>
                                    </span>
                                </td>
                            </tr>
							<?php 
        foreach ($loading_screens as $screen) {
            if (!empty($screen['adminsection'])) {
                include_once $screen['adminsection'];
            }
            if (!empty($screen['adminscript'])) {
                print '<script src="' . $screen['adminscript'] . '"></script>';
            }
        }
        ?>
                            <tr>
                                <th><?php 
        _e('Select background color', LOADING_PAGE_TD);
        ?>
</th>
                                <td><input type="text" name="lp_backgroundColor" id="lp_backgroundColor" value="<?php 
        print esc_attr($loading_page_options['backgroundColor']);
        ?>
" /><div id="lp_backgroundColor_picker"></div></td>
                            </tr>
                            <tr>
                                <th><?php 
        _e('Select image as background', LOADING_PAGE_TD);
        ?>
</th>
                                <td>
                                    <input type="text" name="lp_backgroundImage" id="lp_backgroundImage" value="<?php 
        print esc_attr($loading_page_options['backgroundImage']);
        ?>
" />
                                    <input type="button" value="Browse" onclick="loading_page_selected_image('lp_backgroundImage');" /> 
                                    <select id="lp_backgroundRepeat" name="lp_backgroundRepeat">
                                        <option value="repeat" <?php 
        if ($loading_page_options['backgroundImageRepeat'] == 'repeat') {
            echo "SELECTED";
        }
        ?>
 >Tile</option>
                                        <option value="no-repeat" <?php 
        if ($loading_page_options['backgroundImageRepeat'] == 'no-repeat') {
            echo "SELECTED";
        }
        ?>
 >Center</option>
                                    </select>
                                    
                                </td>
                            </tr>
                            <tr>
                                <th><?php 
        _e('Display image in fullscreen', LOADING_PAGE_TD);
        ?>
</th>
                                <td>
                                    <input type="checkbox" name="lp_fullscreen" id="lp_fullscreen" <?php 
        echo isset($loading_page_options['fullscreen']) && $loading_page_options['fullscreen'] ? 'CHECKED' : '';
        ?>
 />
                                    <?php 
        _e('(The fullscreen attribute can fail in some browsers)', LOADING_PAGE_TD);
        ?>
                                </td>
                            </tr>
                            <tr>
                                <th><?php 
        _e('Select foreground color', LOADING_PAGE_TD);
        ?>
</th>
                                <td><input type="text" name="lp_foregroundColor" id="lp_foregroundColor" value="<?php 
        print esc_attr($loading_page_options['foregroundColor']);
        ?>
" /><div id="lp_foregroundColor_picker"></div></td>
                            </tr>
                            <tr>
                                <th><?php 
        _e('Apply the effect on page', LOADING_PAGE_TD);
        ?>
</th>
                                <td>
                                <select name="lp_pageEffect">
                                <?php 
        $pageEffects = array('none', 'rotateInLeft');
        foreach ($pageEffects as $value) {
            print '<option value="' . $value . '" ' . ($loading_page_options['pageEffect'] == $value ? 'SELECTED' : '') . '>' . $value . '</option>';
        }
        ?>
                                    
                                </select>
                                <div>The premium version of plugin add the following effects: collapseIn, risingFromBottom, expandIn, fadeIn, fallFromTop, rotateInLeft, rotateInRight, rotateInRightWithoutToKeyframe, slideInSkew, tumbleIn, whirlIn</div>
                                </td>
                            </tr>
                            <tr>
                                <th><?php 
        _e('Display loading percent', LOADING_PAGE_TD);
        ?>
</th>
                                <td><input type="checkbox" name="lp_displayPercent" <?php 
        echo $loading_page_options['displayPercent'] ? 'CHECKED' : '';
        ?>
 /></td>
                            </tr>
                        </table>
                    </div>
                </div>    
                <div class="postbox" style="min-width:760px;">
                    <h3 class='hndle' style="padding:5px;"><span><?php 
        _e('Lazy Loading', LOADING_PAGE_TD);
        ?>
</span></h3>
                    <div class="inside">
                        <p><?php 
        print _e("To load only the images visible in the viewport to improve the loading rate of your website and reduce the bandwidth consumption.", LOADING_PAGE_TD);
        ?>
</p>
                        <p>
                            <span style="color:#FF0000;">
                                The lazy loading of images is available only in the commercial version of plugin <a href="http://wordpress.dwbooster.com/content-tools/loading-page" target="_blank">CLICK HERE</a>
                            </span>
                        </p>
                        <p><img src="<?php 
        print LOADING_PAGE_PLUGIN_URL . '/images/consumption_graph.png';
        ?>
" /></p>
                        <table class="form-table">
                            <tr>
                                <th><?php 
        _e('Enable lazy loading', LOADING_PAGE_TD);
        ?>
</th>
                                <td><input type="checkbox" DISABLED /></td>
                            </tr>
                            <tr>
                                <th><?php 
        _e('Select the image to load by default', LOADING_PAGE_TD);
        ?>
</th>
                                <td>
                                    <input type="text" DISABLED /><input type="button" value="Browse" DISABLED />
                                </td>
                            </tr>
							<tr>
								<th><?php 
        _e('Exclude lazy loading from');
        ?>
</th>
								<td><input type="text" DISABLED /> <span>In this case should be typed one, or more IDs for posts or pages, separated by the comma symbol ","</span></td>
							</tr>
                        </table>
                    </div>
                </div>
                <div><input type="submit" value="Update Settings" class="button-primary" /></div>
            </form>
        </div>    
<?php 
    }