@@ -102,52 +102,52 @@ |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /********* CUSTOM FUNCTIONS START HERE ***********/ |
| 105 | - /** |
|
| 106 | - * Function for our settings page |
|
| 107 | - * |
|
| 108 | - * @since 1.0.1 |
|
| 109 | - */ |
|
| 110 | - public function mss_settings_page() { |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * for adding the settings page under "Settings" menu |
|
| 114 | - * add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function ); |
|
| 115 | - */ |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * for adding the page under root menu |
|
| 119 | - * add_menu_page( string $page_title, string $menu_title, string $capability, |
|
| 120 | - * string $menu_slug, callable $function = '', string $icon_url = '', int $position = null ) |
|
| 121 | - */ |
|
| 122 | - |
|
| 123 | - //'book_render_settings_page' function in : .../admin/partials/rahi_wpbook-admin-display.php |
|
| 124 | - add_menu_page( __( 'My Slide Show Settings', 'myslideshow' ), __( 'Slideshow Settings', 'myslideshow' ), 'manage_options', 'slideshow-settings', 'mss_render_settings_page', |
|
| 125 | - 'dashicons-chart-pie', '59' ); |
|
| 105 | + /** |
|
| 106 | + * Function for our settings page |
|
| 107 | + * |
|
| 108 | + * @since 1.0.1 |
|
| 109 | + */ |
|
| 110 | + public function mss_settings_page() { |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * for adding the settings page under "Settings" menu |
|
| 114 | + * add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function ); |
|
| 115 | + */ |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * for adding the page under root menu |
|
| 119 | + * add_menu_page( string $page_title, string $menu_title, string $capability, |
|
| 120 | + * string $menu_slug, callable $function = '', string $icon_url = '', int $position = null ) |
|
| 121 | + */ |
|
| 122 | + |
|
| 123 | + //'book_render_settings_page' function in : .../admin/partials/rahi_wpbook-admin-display.php |
|
| 124 | + add_menu_page( __( 'My Slide Show Settings', 'myslideshow' ), __( 'Slideshow Settings', 'myslideshow' ), 'manage_options', 'slideshow-settings', 'mss_render_settings_page', |
|
| 125 | + 'dashicons-chart-pie', '59' ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | - * Function for registering settings |
|
| 130 | - * |
|
| 131 | - * @since 1.0.1 |
|
| 132 | - */ |
|
| 133 | - function mss_register_settings() { |
|
| 134 | - register_setting( 'mss-settings-group', 'mss_settings' ); |
|
| 135 | - } |
|
| 129 | + * Function for registering settings |
|
| 130 | + * |
|
| 131 | + * @since 1.0.1 |
|
| 132 | + */ |
|
| 133 | + function mss_register_settings() { |
|
| 134 | + register_setting( 'mss-settings-group', 'mss_settings' ); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * Function for adding short code |
|
| 139 | - * |
|
| 140 | - * @since 1.0.2 |
|
| 141 | - */ |
|
| 142 | - public function mss_add_shortcode( ) { |
|
| 138 | + * Function for adding short code |
|
| 139 | + * |
|
| 140 | + * @since 1.0.2 |
|
| 141 | + */ |
|
| 142 | + public function mss_add_shortcode( ) { |
|
| 143 | 143 | |
| 144 | - // function in : .../admin/partials/myslideshow-admin-display.php |
|
| 145 | - return render_mss_shortcode( ); |
|
| 144 | + // function in : .../admin/partials/myslideshow-admin-display.php |
|
| 145 | + return render_mss_shortcode( ); |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - function mss_register_shortcodes() { |
|
| 150 | - add_shortcode( 'slideshow', array( $this, 'mss_add_shortcode' ) ); |
|
| 151 | - } |
|
| 149 | + function mss_register_shortcodes() { |
|
| 150 | + add_shortcode( 'slideshow', array( $this, 'mss_add_shortcode' ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param string $plugin_name The name of this plugin. |
| 48 | 48 | * @param string $version The version of this plugin. |
| 49 | 49 | */ |
| 50 | - public function __construct( $plugin_name, $version ) { |
|
| 50 | + public function __construct($plugin_name, $version) { |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | $this->plugin_name = $plugin_name; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * class. |
| 75 | 75 | */ |
| 76 | 76 | |
| 77 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/myslideshow-admin.css', array(), $this->version, 'all' ); |
|
| 77 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/myslideshow-admin.css', array(), $this->version, 'all'); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * class. |
| 98 | 98 | */ |
| 99 | 99 | |
| 100 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/myslideshow-admin.js', array( 'jquery' ), $this->version, false ); |
|
| 100 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/myslideshow-admin.js', array('jquery'), $this->version, false); |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | |
| 123 | 123 | //'book_render_settings_page' function in : .../admin/partials/rahi_wpbook-admin-display.php |
| 124 | - add_menu_page( __( 'My Slide Show Settings', 'myslideshow' ), __( 'Slideshow Settings', 'myslideshow' ), 'manage_options', 'slideshow-settings', 'mss_render_settings_page', |
|
| 125 | - 'dashicons-chart-pie', '59' ); |
|
| 124 | + add_menu_page(__('My Slide Show Settings', 'myslideshow'), __('Slideshow Settings', 'myslideshow'), 'manage_options', 'slideshow-settings', 'mss_render_settings_page', |
|
| 125 | + 'dashicons-chart-pie', '59'); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * @since 1.0.1 |
| 132 | 132 | */ |
| 133 | 133 | function mss_register_settings() { |
| 134 | - register_setting( 'mss-settings-group', 'mss_settings' ); |
|
| 134 | + register_setting('mss-settings-group', 'mss_settings'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function mss_register_shortcodes() { |
| 150 | - add_shortcode( 'slideshow', array( $this, 'mss_add_shortcode' ) ); |
|
| 150 | + add_shortcode('slideshow', array($this, 'mss_add_shortcode')); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | function mss_render_settings_page() { |
| 21 | 21 | |
| 22 | 22 | global $slides_options; |
| 23 | - $number_of_images = $slides_options[ 'images_number' ]; |
|
| 24 | - $urls = explode( ";", $slides_options[ 'image_urls' ] ); |
|
| 23 | + $number_of_images = $slides_options['images_number']; |
|
| 24 | + $urls = explode(";", $slides_options['image_urls']); |
|
| 25 | 25 | |
| 26 | - if(function_exists( 'wp_enqueue_media' )){ |
|
| 26 | + if (function_exists('wp_enqueue_media')) { |
|
| 27 | 27 | wp_enqueue_media(); |
| 28 | - }else{ |
|
| 28 | + } else { |
|
| 29 | 29 | wp_enqueue_style('thickbox'); |
| 30 | 30 | wp_enqueue_script('media-upload'); |
| 31 | 31 | wp_enqueue_script('thickbox'); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ?> |
| 35 | 35 | <form id="settings_form" method="post" action="options.php"> |
| 36 | 36 | <?php |
| 37 | - settings_fields( 'mss-settings-group' ); |
|
| 37 | + settings_fields('mss-settings-group'); |
|
| 38 | 38 | ?> |
| 39 | 39 | <div class="settings-wrapper"> |
| 40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | <span>v1.0.3</span> |
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | - <span><i><?php esc_html_e( 'Recommended image dimensions', 'myslideshow' ); ?>: 1000 X 560</i></span> |
|
| 46 | + <span><i><?php esc_html_e('Recommended image dimensions', 'myslideshow'); ?>: 1000 X 560</i></span> |
|
| 47 | 47 | |
| 48 | 48 | <div id="images-container"> |
| 49 | 49 | <div id="add-image" class="image disable-sort-item"> |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | 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 ] . ');"> |
|
| 55 | + for ($i = 0; $i < $number_of_images; $i++) { |
|
| 56 | + echo '<div class="image sortable" style="background-image: url(' . $urls[$i] . ');"> |
|
| 57 | 57 | <div class="delete-image"> |
| 58 | 58 | <span class="dashicons dashicons-trash"></span> |
| 59 | 59 | </div> |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | </div> |
| 65 | 65 | |
| 66 | 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> |
|
| 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> |
|
| 70 | 70 | </div> |
| 71 | 71 | |
| 72 | 72 | </div> |
@@ -85,30 +85,30 @@ discard block |
||
| 85 | 85 | global $slides_options; |
| 86 | 86 | $html = ''; |
| 87 | 87 | |
| 88 | - $number_of_images = $slides_options[ 'images_number' ]; |
|
| 88 | + $number_of_images = $slides_options['images_number']; |
|
| 89 | 89 | |
| 90 | 90 | // check if there are any images added in the slideshow or not |
| 91 | - if ( $number_of_images == 0 ) { |
|
| 91 | + if ($number_of_images == 0) { |
|
| 92 | 92 | $html .= '<h5> No images found. You can add images in \'Slideshow Settings\' menu in the admin panel. </h5>'; |
| 93 | 93 | return $html; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $image_urls = explode( ";", $slides_options[ 'image_urls' ] ); |
|
| 96 | + $image_urls = explode(";", $slides_options['image_urls']); |
|
| 97 | 97 | $html .= '<div class="mss-slides-container">'; |
| 98 | - $html .= '<img class="static-bg" src="'. plugins_url( 'assets/images/default-bg.png' , dirname( __FILE__ ) ) . '"/>'; |
|
| 98 | + $html .= '<img class="static-bg" src="' . plugins_url('assets/images/default-bg.png', dirname(__FILE__)) . '"/>'; |
|
| 99 | 99 | |
| 100 | - for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 101 | - $html .= '<img class="slide" src="'. $image_urls[ $i ] . '"/>'; |
|
| 100 | + for ($i = 0; $i < $number_of_images; $i++) { |
|
| 101 | + $html .= '<img class="slide" src="' . $image_urls[$i] . '"/>'; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 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>'; |
|
| 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 | 107 | |
| 108 | 108 | // indicators |
| 109 | 109 | $html .= '<ul class="indicators">'; |
| 110 | 110 | |
| 111 | - for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 111 | + for ($i = 0; $i < $number_of_images; $i++) { |
|
| 112 | 112 | $html .= '<li></li>'; |
| 113 | 113 | } |
| 114 | 114 | $html .= '</ul>'; |