@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @since 1.0.0 |
| 68 | 68 | */ |
| 69 | 69 | public function __construct() { |
| 70 | - if ( defined( 'MYSLIDESHOW_VERSION' ) ) { |
|
| 70 | + if (defined('MYSLIDESHOW_VERSION')) { |
|
| 71 | 71 | $this->version = MYSLIDESHOW_VERSION; |
| 72 | 72 | } else { |
| 73 | 73 | $this->version = '1.0.0'; |
@@ -103,29 +103,29 @@ discard block |
||
| 103 | 103 | * The class responsible for orchestrating the actions and filters of the |
| 104 | 104 | * core plugin. |
| 105 | 105 | */ |
| 106 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-myslideshow-loader.php'; |
|
| 106 | + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-myslideshow-loader.php'; |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * The class responsible for defining internationalization functionality |
| 110 | 110 | * of the plugin. |
| 111 | 111 | */ |
| 112 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-myslideshow-i18n.php'; |
|
| 112 | + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-myslideshow-i18n.php'; |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * The class responsible for defining all actions that occur in the admin area. |
| 116 | 116 | */ |
| 117 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-myslideshow-admin.php'; |
|
| 117 | + require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-myslideshow-admin.php'; |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * The class responsible for defining all actions that occur in the public-facing |
| 121 | 121 | * side of the site. |
| 122 | 122 | */ |
| 123 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-myslideshow-public.php'; |
|
| 123 | + require_once plugin_dir_path(dirname(__FILE__)) . 'public/class-myslideshow-public.php'; |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * this file contains all admin-side rendering |
| 127 | 127 | */ |
| 128 | - require_once( plugin_dir_path( dirname( __FILE__ ) ) . 'admin/partials/myslideshow-admin-display.php' ); |
|
| 128 | + require_once(plugin_dir_path(dirname(__FILE__)) . 'admin/partials/myslideshow-admin-display.php'); |
|
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | $this->loader = new Myslideshow_Loader(); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $plugin_i18n = new Myslideshow_i18n(); |
| 147 | 147 | |
| 148 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 148 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,19 +158,19 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | private function define_admin_hooks() { |
| 160 | 160 | |
| 161 | - $plugin_admin = new Myslideshow_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 161 | + $plugin_admin = new Myslideshow_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 162 | 162 | |
| 163 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 164 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 163 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 164 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 165 | 165 | |
| 166 | 166 | // Hook for slideshow settings page |
| 167 | - $this->loader->add_action( 'admin_menu', $plugin_admin, 'mss_settings_page' ); |
|
| 167 | + $this->loader->add_action('admin_menu', $plugin_admin, 'mss_settings_page'); |
|
| 168 | 168 | |
| 169 | 169 | // Hook for registering settings |
| 170 | - $this->loader->add_action( 'admin_init', $plugin_admin, 'mss_register_settings' ); |
|
| 170 | + $this->loader->add_action('admin_init', $plugin_admin, 'mss_register_settings'); |
|
| 171 | 171 | |
| 172 | 172 | // Hook for registering shortcode |
| 173 | - $this->loader->add_action( 'init', $plugin_admin, 'mss_register_shortcodes' ); |
|
| 173 | + $this->loader->add_action('init', $plugin_admin, 'mss_register_shortcodes'); |
|
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | private function define_public_hooks() { |
| 185 | 185 | |
| 186 | - $plugin_public = new Myslideshow_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 186 | + $plugin_public = new Myslideshow_Public($this->get_plugin_name(), $this->get_version()); |
|
| 187 | 187 | |
| 188 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 189 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 188 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 189 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 190 | 190 | |
| 191 | 191 | } |
| 192 | 192 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | load_plugin_textdomain( |
| 38 | 38 | 'myslideshow', |
| 39 | 39 | false, |
| 40 | - dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' |
|
| 40 | + dirname(dirname(plugin_basename(__FILE__))) . '/languages/' |
|
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | } |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
| 64 | 64 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
| 65 | 65 | */ |
| 66 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 67 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 66 | + public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 67 | + $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
| 78 | 78 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 |
| 79 | 79 | */ |
| 80 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
| 81 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
| 80 | + public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
| 81 | + $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param int $accepted_args The number of arguments that should be passed to the $callback. |
| 96 | 96 | * @return array The collection of actions and filters registered with WordPress. |
| 97 | 97 | */ |
| 98 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
| 98 | + private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { |
|
| 99 | 99 | |
| 100 | 100 | $hooks[] = array( |
| 101 | 101 | 'hook' => $hook, |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function run() { |
| 118 | 118 | |
| 119 | - foreach ( $this->filters as $hook ) { |
|
| 120 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 119 | + foreach ($this->filters as $hook) { |
|
| 120 | + add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - foreach ( $this->actions as $hook ) { |
|
| 124 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 123 | + foreach ($this->actions as $hook) { |
|
| 124 | + add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | } |
@@ -41,13 +41,13 @@ |
||
| 41 | 41 | * Global options |
| 42 | 42 | */ |
| 43 | 43 | $defaults = array( |
| 44 | - 'image_urls' => '', |
|
| 45 | - 'images_number' => '0', |
|
| 44 | + 'image_urls' => '', |
|
| 45 | + 'images_number' => '0', |
|
| 46 | 46 | ); |
| 47 | 47 | $slides_options = get_option( 'mss_settings', $defaults ); |
| 48 | 48 | |
| 49 | 49 | if ( $slides_options == '' ) { |
| 50 | - update_option( 'mss_settings', $defaults ); |
|
| 50 | + update_option( 'mss_settings', $defaults ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | // If this file is called directly, abort. |
| 29 | -if ( ! defined( 'WPINC' ) ) { |
|
| 29 | +if ( ! defined('WPINC')) { |
|
| 30 | 30 | die; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * Start at version 1.0.0 and use SemVer - https://semver.org |
| 36 | 36 | * Rename this for your plugin and update it as you release new versions. |
| 37 | 37 | */ |
| 38 | -define( 'MYSLIDESHOW_VERSION', '1.0.1' ); |
|
| 38 | +define('MYSLIDESHOW_VERSION', '1.0.1'); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Global options |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | 'image_urls' => '', |
| 45 | 45 | 'images_number' => '0', |
| 46 | 46 | ); |
| 47 | -$slides_options = get_option( 'mss_settings', $defaults ); |
|
| 47 | +$slides_options = get_option('mss_settings', $defaults); |
|
| 48 | 48 | |
| 49 | -if ( $slides_options == '' ) { |
|
| 50 | - update_option( 'mss_settings', $defaults ); |
|
| 49 | +if ($slides_options == '') { |
|
| 50 | + update_option('mss_settings', $defaults); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * This action is documented in includes/class-myslideshow-activator.php |
| 56 | 56 | */ |
| 57 | 57 | function activate_myslideshow() { |
| 58 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-myslideshow-activator.php'; |
|
| 58 | + require_once plugin_dir_path(__FILE__) . 'includes/class-myslideshow-activator.php'; |
|
| 59 | 59 | Myslideshow_Activator::activate(); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,18 +64,18 @@ discard block |
||
| 64 | 64 | * This action is documented in includes/class-myslideshow-deactivator.php |
| 65 | 65 | */ |
| 66 | 66 | function deactivate_myslideshow() { |
| 67 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-myslideshow-deactivator.php'; |
|
| 67 | + require_once plugin_dir_path(__FILE__) . 'includes/class-myslideshow-deactivator.php'; |
|
| 68 | 68 | Myslideshow_Deactivator::deactivate(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -register_activation_hook( __FILE__, 'activate_myslideshow' ); |
|
| 72 | -register_deactivation_hook( __FILE__, 'deactivate_myslideshow' ); |
|
| 71 | +register_activation_hook(__FILE__, 'activate_myslideshow'); |
|
| 72 | +register_deactivation_hook(__FILE__, 'deactivate_myslideshow'); |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * The core plugin class that is used to define internationalization, |
| 76 | 76 | * admin-specific hooks, and public-facing site hooks. |
| 77 | 77 | */ |
| 78 | -require plugin_dir_path( __FILE__ ) . 'includes/class-myslideshow.php'; |
|
| 78 | +require plugin_dir_path(__FILE__) . 'includes/class-myslideshow.php'; |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Begins execution of the plugin. |
@@ -26,6 +26,6 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | // If uninstall not called from WordPress, then exit. |
| 29 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 29 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 30 | 30 | exit; |
| 31 | 31 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param string $plugin_name The name of the 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 | $this->plugin_name = $plugin_name; |
| 53 | 53 | $this->version = $version; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * class. |
| 74 | 74 | */ |
| 75 | 75 | |
| 76 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/myslideshow-public.css', array(), $this->version, 'all' ); |
|
| 76 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/myslideshow-public.css', array(), $this->version, 'all'); |
|
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * class. |
| 97 | 97 | */ |
| 98 | 98 | |
| 99 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/myslideshow-public.js', array( 'jquery' ), $this->version, false ); |
|
| 99 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/myslideshow-public.js', array('jquery'), $this->version, false); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -102,94 +102,94 @@ |
||
| 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', 'Slideshow Settings', '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', 'Slideshow Settings', '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( ) { |
|
| 143 | - |
|
| 144 | - // $atts = shortcode_atts( |
|
| 145 | - // array( |
|
| 146 | - // 'id' => '', |
|
| 147 | - // 'author_name' => '', |
|
| 148 | - // 'year' => '', |
|
| 149 | - // 'category' => '', |
|
| 150 | - // 'tag' => '', |
|
| 151 | - // 'publisher' => '', |
|
| 152 | - // ), $atts |
|
| 153 | - // ); |
|
| 154 | - |
|
| 155 | - // I messed it up here |
|
| 156 | - // $args = array( |
|
| 157 | - // 'post_type' => 'book', |
|
| 158 | - // 'post_status' => 'publish', |
|
| 159 | - // 'posts_per_page' => 999999, |
|
| 160 | - // 'order' => 'ASC', |
|
| 161 | - // 'author' => $atts[ 'author_name' ], |
|
| 162 | - // ); |
|
| 163 | - |
|
| 164 | - // if ( $atts[ 'category' ] != '' ) { |
|
| 165 | - // $args['tax_query'] = array( |
|
| 166 | - // array( |
|
| 167 | - // 'taxonomy' => 'book_category', |
|
| 168 | - // 'terms' => array( $atts[ 'category' ] ), |
|
| 169 | - // 'field' => 'slug', |
|
| 170 | - // 'operator' => 'IN', |
|
| 171 | - // ), |
|
| 172 | - // ); |
|
| 173 | - // } |
|
| 174 | - |
|
| 175 | - // if ( $atts[ 'tag' ] != '' ) { |
|
| 176 | - // $args[ 'tax_query' ] = array( |
|
| 177 | - // array( |
|
| 178 | - // 'taxonomy' => 'book_tag', |
|
| 179 | - // 'terms' => array( $atts[ 'tag' ] ), |
|
| 180 | - // 'field' => 'slug', |
|
| 181 | - // 'operator' => 'AND', |
|
| 182 | - // ), |
|
| 183 | - // ); |
|
| 184 | - // } |
|
| 185 | - |
|
| 186 | - // function in : .../admin/partials/myslideshow-admin-display.php |
|
| 187 | - return render_mss_shortcode( ); |
|
| 188 | - |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - function mss_register_shortcodes() { |
|
| 192 | - add_shortcode( 'slideshow', array( $this, 'mss_add_shortcode' ) ); |
|
| 193 | - } |
|
| 138 | + * Function for adding short code |
|
| 139 | + * |
|
| 140 | + * @since 1.0.2 |
|
| 141 | + */ |
|
| 142 | + public function mss_add_shortcode( ) { |
|
| 143 | + |
|
| 144 | + // $atts = shortcode_atts( |
|
| 145 | + // array( |
|
| 146 | + // 'id' => '', |
|
| 147 | + // 'author_name' => '', |
|
| 148 | + // 'year' => '', |
|
| 149 | + // 'category' => '', |
|
| 150 | + // 'tag' => '', |
|
| 151 | + // 'publisher' => '', |
|
| 152 | + // ), $atts |
|
| 153 | + // ); |
|
| 154 | + |
|
| 155 | + // I messed it up here |
|
| 156 | + // $args = array( |
|
| 157 | + // 'post_type' => 'book', |
|
| 158 | + // 'post_status' => 'publish', |
|
| 159 | + // 'posts_per_page' => 999999, |
|
| 160 | + // 'order' => 'ASC', |
|
| 161 | + // 'author' => $atts[ 'author_name' ], |
|
| 162 | + // ); |
|
| 163 | + |
|
| 164 | + // if ( $atts[ 'category' ] != '' ) { |
|
| 165 | + // $args['tax_query'] = array( |
|
| 166 | + // array( |
|
| 167 | + // 'taxonomy' => 'book_category', |
|
| 168 | + // 'terms' => array( $atts[ 'category' ] ), |
|
| 169 | + // 'field' => 'slug', |
|
| 170 | + // 'operator' => 'IN', |
|
| 171 | + // ), |
|
| 172 | + // ); |
|
| 173 | + // } |
|
| 174 | + |
|
| 175 | + // if ( $atts[ 'tag' ] != '' ) { |
|
| 176 | + // $args[ 'tax_query' ] = array( |
|
| 177 | + // array( |
|
| 178 | + // 'taxonomy' => 'book_tag', |
|
| 179 | + // 'terms' => array( $atts[ 'tag' ] ), |
|
| 180 | + // 'field' => 'slug', |
|
| 181 | + // 'operator' => 'AND', |
|
| 182 | + // ), |
|
| 183 | + // ); |
|
| 184 | + // } |
|
| 185 | + |
|
| 186 | + // function in : .../admin/partials/myslideshow-admin-display.php |
|
| 187 | + return render_mss_shortcode( ); |
|
| 188 | + |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + function mss_register_shortcodes() { |
|
| 192 | + add_shortcode( 'slideshow', array( $this, 'mss_add_shortcode' ) ); |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | } |
@@ -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', 'Slideshow Settings', 'manage_options', 'slideshow-settings', 'mss_render_settings_page', |
|
| 125 | - 'dashicons-chart-pie', '59' ); |
|
| 124 | + add_menu_page('My Slide Show Settings', 'Slideshow Settings', '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 | /** |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | function mss_register_shortcodes() { |
| 192 | - add_shortcode( 'slideshow', array( $this, 'mss_add_shortcode' ) ); |
|
| 192 | + add_shortcode('slideshow', array($this, 'mss_add_shortcode')); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | } |
@@ -19,23 +19,23 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function mss_render_settings_page() { |
| 21 | 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'); |
|
| 30 | - wp_enqueue_script('media-upload'); |
|
| 31 | - wp_enqueue_script('thickbox'); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - ?> |
|
| 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'); |
|
| 30 | + wp_enqueue_script('media-upload'); |
|
| 31 | + wp_enqueue_script('thickbox'); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + ?> |
|
| 35 | 35 | <form id="settings_form" method="post" action="options.php"> |
| 36 | 36 | <?php |
| 37 | - settings_fields( 'mss-settings-group' ); |
|
| 38 | - ?> |
|
| 37 | + settings_fields( 'mss-settings-group' ); |
|
| 38 | + ?> |
|
| 39 | 39 | <div class="settings-wrapper"> |
| 40 | 40 | |
| 41 | 41 | <div class="header"> |
@@ -49,18 +49,18 @@ discard block |
||
| 49 | 49 | </div> |
| 50 | 50 | |
| 51 | 51 | <?php |
| 52 | - // render images from the db |
|
| 53 | - for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 52 | + // render images from the db |
|
| 53 | + for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 54 | 54 | |
| 55 | - echo '<div class="image sortable" style="background-image: url(' . $urls[ $i ] . ');"> |
|
| 55 | + echo '<div class="image sortable" style="background-image: url(' . $urls[ $i ] . ');"> |
|
| 56 | 56 | <div class="delete-image"> |
| 57 | 57 | <span class="dashicons dashicons-trash"></span> |
| 58 | 58 | </div> |
| 59 | 59 | </div>'; |
| 60 | 60 | |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - ?> |
|
| 63 | + ?> |
|
| 64 | 64 | </div> |
| 65 | 65 | |
| 66 | 66 | <div class="footer"> |
@@ -80,27 +80,27 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | function render_mss_shortcode() { |
| 82 | 82 | |
| 83 | - // get slide show options |
|
| 84 | - global $slides_options; |
|
| 85 | - $html = ''; |
|
| 83 | + // get slide show options |
|
| 84 | + global $slides_options; |
|
| 85 | + $html = ''; |
|
| 86 | 86 | |
| 87 | - $number_of_images = $slides_options[ 'images_number' ]; |
|
| 87 | + $number_of_images = $slides_options[ 'images_number' ]; |
|
| 88 | 88 | |
| 89 | - // check if there are any images added in the slideshow or not |
|
| 90 | - if ( $number_of_images == 0 ) { |
|
| 91 | - $html .= '<h5> No images found. You can add images from \'Slideshow Settings\' menu in the admin panel. </h5>'; |
|
| 92 | - return $html; |
|
| 93 | - } |
|
| 89 | + // check if there are any images added in the slideshow or not |
|
| 90 | + if ( $number_of_images == 0 ) { |
|
| 91 | + $html .= '<h5> No images found. You can add images from \'Slideshow Settings\' menu in the admin panel. </h5>'; |
|
| 92 | + return $html; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - $image_urls = explode( ";", $slides_options[ 'image_urls' ] ); |
|
| 96 | - $html .= '<div id="slides-container">'; |
|
| 95 | + $image_urls = explode( ";", $slides_options[ 'image_urls' ] ); |
|
| 96 | + $html .= '<div id="slides-container">'; |
|
| 97 | 97 | |
| 98 | - for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 99 | - $html .= '<img class="slide" src="'. $image_urls[ $i ] . '"/>'; |
|
| 100 | - } |
|
| 98 | + for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 99 | + $html .= '<img class="slide" src="'. $image_urls[ $i ] . '"/>'; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - $html .= '</div>'; |
|
| 102 | + $html .= '</div>'; |
|
| 103 | 103 | |
| 104 | - return $html; |
|
| 104 | + return $html; |
|
| 105 | 105 | } |
| 106 | 106 | ?> |
@@ -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 | |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | <?php |
| 52 | 52 | // render images from the db |
| 53 | - for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 53 | + for ($i = 0; $i < $number_of_images; $i++) { |
|
| 54 | 54 | |
| 55 | - echo '<div class="image sortable" style="background-image: url(' . $urls[ $i ] . ');"> |
|
| 55 | + echo '<div class="image sortable" style="background-image: url(' . $urls[$i] . ');"> |
|
| 56 | 56 | <div class="delete-image"> |
| 57 | 57 | <span class="dashicons dashicons-trash"></span> |
| 58 | 58 | </div> |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | global $slides_options; |
| 85 | 85 | $html = ''; |
| 86 | 86 | |
| 87 | - $number_of_images = $slides_options[ 'images_number' ]; |
|
| 87 | + $number_of_images = $slides_options['images_number']; |
|
| 88 | 88 | |
| 89 | 89 | // check if there are any images added in the slideshow or not |
| 90 | - if ( $number_of_images == 0 ) { |
|
| 90 | + if ($number_of_images == 0) { |
|
| 91 | 91 | $html .= '<h5> No images found. You can add images from \'Slideshow Settings\' menu in the admin panel. </h5>'; |
| 92 | 92 | return $html; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $image_urls = explode( ";", $slides_options[ 'image_urls' ] ); |
|
| 95 | + $image_urls = explode(";", $slides_options['image_urls']); |
|
| 96 | 96 | $html .= '<div id="slides-container">'; |
| 97 | 97 | |
| 98 | - for ( $i = 0; $i < $number_of_images; $i++ ) { |
|
| 99 | - $html .= '<img class="slide" src="'. $image_urls[ $i ] . '"/>'; |
|
| 98 | + for ($i = 0; $i < $number_of_images; $i++) { |
|
| 99 | + $html .= '<img class="slide" src="' . $image_urls[$i] . '"/>'; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $html .= '</div>'; |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 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'); |