Issues (35)

admin/partials/myslideshow-admin-display.php (6 issues)

Labels
Severity
1
<?php
2
3
/**
4
 * Provide a admin area view for the plugin.
5
 *
6
 * This file is used to markup the admin-facing aspects of the plugin
7
 *
8
 * @link       rahicodes.wordpress.com
9
 * @since      1.0.0
10
 *
11
 * @package    Myslideshow
12
 * @subpackage Myslideshow/admin/partials
13
 */
14
15
/**
16
 * This function renders the custom settings page for 'slideshow settings'
17
 * 
18
 * @since      1.0.1
19
 */
20
function mss_render_settings_page() {
21
22
    global $slides_options;
23
    $number_of_images = $slides_options['images_number'];
24
    $urls = explode(";", $slides_options['image_urls']);
25
    
26
    if (function_exists('wp_enqueue_media')) {
27
        wp_enqueue_media();
28
    } else {
29
        wp_enqueue_style('thickbox');
0 ignored issues
show
The function wp_enqueue_style was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        /** @scrutinizer ignore-call */ 
30
        wp_enqueue_style('thickbox');
Loading history...
30
        wp_enqueue_script('media-upload');
0 ignored issues
show
The function wp_enqueue_script was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        /** @scrutinizer ignore-call */ 
31
        wp_enqueue_script('media-upload');
Loading history...
31
        wp_enqueue_script('thickbox');
32
    }
33
    
34
    ?>
35
        <form id="settings_form" method="post" action="options.php">
36
            <?php
37
        settings_fields('mss-settings-group');
0 ignored issues
show
The function settings_fields was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        /** @scrutinizer ignore-call */ 
38
        settings_fields('mss-settings-group');
Loading history...
38
        ?>
39
            <div class="settings-wrapper">
40
                
41
                <div class="header">
42
                    <h2>My Slide Show Control Panel</h2>
43
                    <span>v1.0.3</span>
44
                </div>
45
46
                <span><i><?php esc_html_e('Recommended image dimensions', 'myslideshow'); ?>: 1000 X 560</i></span>
0 ignored issues
show
The function esc_html_e was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

46
                <span><i><?php /** @scrutinizer ignore-call */ esc_html_e('Recommended image dimensions', 'myslideshow'); ?>: 1000 X 560</i></span>
Loading history...
47
                
48
                <div id="images-container">
49
                    <div id="add-image" class="image disable-sort-item">
50
                        <span class="dashicons dashicons-plus"></span>
51
                    </div>
52
53
                    <?php 
54
                    // render images from the db
55
                    for ($i = 0; $i < $number_of_images; $i++) {
56
                        echo '<div class="image sortable" style="background-image: url(' . $urls[$i] . ');">
57
                            <div class="delete-image">
58
                                <span class="dashicons dashicons-trash"></span>
59
                            </div>
60
                        </div>';
61
                    }
62
                    
63
                    ?>
64
                </div>
65
66
                <div class="footer">
67
                    <span><i><b><?php esc_html_e('Tip', 'myslideshow'); ?>: </b>
68
                        <?php esc_html_e('You can drag images to change their order in the slide show!', 'myslideshow'); ?></i></span>
69
                    <button id="btn-save" class="button-primary"> <?php _e('Save Changes'); ?></button>
0 ignored issues
show
The function _e was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

69
                    <button id="btn-save" class="button-primary"> <?php /** @scrutinizer ignore-call */ _e('Save Changes'); ?></button>
Loading history...
70
                </div>
71
72
            </div>  
73
        </form>
74
    <?php
75
}
76
77
/**
78
 * Helper function for rendering image slides
79
 * 
80
 * @since      1.0.2
81
 */
82
function render_mss_shortcode() {
83
84
    // get slide show options
85
    global $slides_options;
86
    $html = '';
87
    
88
    $number_of_images = $slides_options['images_number'];
89
90
    // check if there are any images added in the slideshow or not
91
    if ($number_of_images == 0) {
92
        $html .= '<h5> No images found. You can add images in \'Slideshow Settings\' menu in the admin panel. </h5>';
93
        return $html;
94
    }
95
96
    $image_urls = explode(";", $slides_options['image_urls']);
97
    $html .= '<div class="mss-slides-container">';
98
    $html .= '<img class="static-bg" src="' . plugins_url('assets/images/default-bg.png', dirname(__FILE__)) . '"/>';
0 ignored issues
show
The function plugins_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

98
    $html .= '<img class="static-bg" src="' . /** @scrutinizer ignore-call */ plugins_url('assets/images/default-bg.png', dirname(__FILE__)) . '"/>';
Loading history...
99
100
    for ($i = 0; $i < $number_of_images; $i++) {
101
        $html .= '<img class="slide" src="' . $image_urls[$i] . '"/>';
102
    }
103
104
    // arrows
105
    $html .= '<div class="arrow left"><img src="' . plugins_url('assets/images/arrow-left.png', dirname(__FILE__)) . '"/></div>';
106
    $html .= '<div class="arrow right"><img src="' . plugins_url('assets/images/arrow-right.png', dirname(__FILE__)) . '"/></div>';
107
    
108
    // indicators
109
    $html .= '<ul class="indicators">';
110
    
111
    for ($i = 0; $i < $number_of_images; $i++) {
112
        $html .= '<li></li>';
113
    }
114
    $html .= '</ul>';
115
116
    $html .= '</div>';
117
118
    return $html;
119
}
120
?>
121