From 754c4cd5cb6afa218a6c4ec2a9ad7ff11df0ff50 Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 09:04:28 +0100 Subject: [PATCH 01/11] Added a composer file --- composer.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..e7101d4 --- /dev/null +++ b/composer.json @@ -0,0 +1,19 @@ +{ + "name": "wp-plugin-owlcarousel", + "description": "A plugin to use Owl Carousel in Wordpress.", + "type": "wordpress-plugin", + "keywords": ["wordpress", "plugin"], + "homepage": "", + "authors": [ + { + "name": "Jehan Pierre", + "email": "pierre.jehan@gmail.com", + "homepage": "http://www.pierre-jehan.com" + }, + { + "name": "Rasmus Taarnby", + "email": "rt@peytz.dk", + "homepage": "http://peytz.dk/medarbejdere/rt" + } + ] +} From d390cabee3a56b78fd62266237cdf2c9638fc11d Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 09:07:31 +0100 Subject: [PATCH 02/11] Updated name --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e7101d4..50ed246 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "wp-plugin-owlcarousel", + "name": "rasmustaarnby/wp-plugin-owlcarousel", "description": "A plugin to use Owl Carousel in Wordpress.", "type": "wordpress-plugin", "keywords": ["wordpress", "plugin"], From b63db83fa03b2eb36fd8291770cc6cb283efe9d1 Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 09:28:15 +0100 Subject: [PATCH 03/11] Correct package name --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 50ed246..00b92ec 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "rasmustaarnby/wp-plugin-owlcarousel", + "name": "rasmustaarnby/owl-carousel", "description": "A plugin to use Owl Carousel in Wordpress.", "type": "wordpress-plugin", "keywords": ["wordpress", "plugin"], - "homepage": "", + "homepage": "https://github.com/rasmustaarnby/owl-carousel", "authors": [ { "name": "Jehan Pierre", From aec021b8a31eb95c2473c5d5c3bf458b6325855b Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 09:29:55 +0100 Subject: [PATCH 04/11] Added composer to ignore list --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b972665 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +composer.json \ No newline at end of file From da3fb938d39b18b254ce9e91e48678e9ac3f2531 Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 09:42:28 +0100 Subject: [PATCH 05/11] Updated readme with contibuters and updated plugin name --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1823e45..e65e15d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -wp-plugin-owlcarousel -===================== +# Owl Carousel + A plugin to use Owl Carousel in Wordpress + + +#### Contributers + +- [Jehan Pierre](https://github.com/pjehan) +- [Rasmus Taarnby](https://github.com/rasmustaarnby) From 535a581273bc9635302a1069b3dc3abcaf435b3e Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 09:44:01 +0100 Subject: [PATCH 06/11] Updated readme with original author --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e65e15d..0a438a8 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ A plugin to use Owl Carousel in Wordpress #### Contributers -- [Jehan Pierre](https://github.com/pjehan) +- [Jehan Pierre](https://github.com/pjehan) (Original author) - [Rasmus Taarnby](https://github.com/rasmustaarnby) From 391e1644778a6ad95c35525ea404b346d78a0ef8 Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 10:36:20 +0100 Subject: [PATCH 07/11] Formatting according to wp standards --- owlcarousel.php | 636 +++++++++++++++++++++++---------------------- save_parameter.php | 8 +- 2 files changed, 331 insertions(+), 313 deletions(-) diff --git a/owlcarousel.php b/owlcarousel.php index accbaca..aaa24b2 100644 --- a/owlcarousel.php +++ b/owlcarousel.php @@ -8,356 +8,372 @@ Licence: GPL2 */ -add_theme_support('post-thumbnails'); - -add_action('init', 'owlcarousel_init'); -add_action('wp_print_scripts', 'owl_register_scripts'); -add_action('wp_print_styles', 'owl_register_styles'); -add_action('widgets_init', 'owl_widgets_init'); -add_action('manage_edit-owl-carousel_columns', 'owl_columnfilter'); -add_action('manage_posts_custom_column', 'owl_column'); -add_action('admin_menu', 'owl_carousel_menu'); -add_action('admin_enqueue_scripts', 'owl_carousel_admin_register_scripts'); - -if(filter_var(get_option('owl_carousel_wordpress_gallery', false), FILTER_VALIDATE_BOOLEAN)) { - add_filter('post_gallery', 'owl_carousel_post_gallery', 10, 2); +add_theme_support( 'post-thumbnails' ); + +add_action( 'init', 'owlcarousel_init' ); +add_action( 'wp_print_scripts', 'owl_register_scripts' ); +add_action( 'wp_print_styles', 'owl_register_styles' ); +add_action( 'widgets_init', 'owl_widgets_init' ); +add_action( 'manage_edit-owl-carousel_columns', 'owl_columnfilter' ); +add_action( 'manage_posts_custom_column', 'owl_column' ); +add_action( 'admin_menu', 'owl_carousel_menu' ); +add_action( 'admin_enqueue_scripts', 'owl_carousel_admin_register_scripts' ); + +if ( filter_var( get_option( 'owl_carousel_wordpress_gallery', false ), FILTER_VALIDATE_BOOLEAN ) ) { + add_filter( 'post_gallery', 'owl_carousel_post_gallery', 10, 2 ); } // Add functions to create a new attachments fields -add_filter("attachment_fields_to_edit", "owl_carousel_attachment_fields_to_edit", null, 2); -add_filter("attachment_fields_to_save", "owl_carousel_attachment_fields_to_save", null, 2); +add_filter( "attachment_fields_to_edit", "owl_carousel_attachment_fields_to_edit", null, 2 ); +add_filter( "attachment_fields_to_save", "owl_carousel_attachment_fields_to_save", null, 2 ); /** * Initilize the plugin */ function owlcarousel_init() { - $labels = array( - 'name' => __('Owl Carousel', 'owl-carousel-domain'), - 'singular_name' => __('Carousel Item', 'owl-carousel-domain'), - 'add_new' => __('Add New Item', 'owl-carousel-domain'), - 'add_new_item' => __('Add New Carousel Item', 'owl-carousel-domain'), - 'edit_item' => __('Edit Carousel Item', 'owl-carousel-domain'), - 'new_item' => __('Add New Carousel Item', 'owl-carousel-domain'), - 'view_item' => __('View Item', 'owl-carousel-domain'), - 'search_items' => __('Search Carousel', 'owl-carousel-domain'), - 'not_found' => __('No carousel items found', 'owl-carousel-domain'), - 'not_found_in_trash' => __('No carousel items found in trash', 'owl-carousel-domain'), - ); - - register_post_type('owl-carousel', array( - 'public' => true, - 'publicly_queryable' => false, - 'exclude_from_search' => true, - 'label' => 'Owl Carousel', - 'menu_icon' => plugins_url('/owl-carousel/images/owl-logo-16.png'), - 'labels' => $labels, - 'capability_type' => 'post', - 'supports' => array( - 'title', - 'editor', - 'thumbnail' - ) - )); - - register_taxonomy( + $labels = array( + 'name' => __( 'Owl Carousel', 'owl-carousel-domain' ), + 'singular_name' => __( 'Carousel Item', 'owl-carousel-domain' ), + 'add_new' => __( 'Add New Item', 'owl-carousel-domain' ), + 'add_new_item' => __( 'Add New Carousel Item', 'owl-carousel-domain' ), + 'edit_item' => __( 'Edit Carousel Item', 'owl-carousel-domain' ), + 'new_item' => __( 'Add New Carousel Item', 'owl-carousel-domain' ), + 'view_item' => __( 'View Item', 'owl-carousel-domain' ), + 'search_items' => __( 'Search Carousel', 'owl-carousel-domain' ), + 'not_found' => __( 'No carousel items found', 'owl-carousel-domain' ), + 'not_found_in_trash' => __( 'No carousel items found in trash', 'owl-carousel-domain' ), + ); + + register_post_type( 'owl-carousel', array( + 'public' => true, + 'publicly_queryable' => false, + 'exclude_from_search' => true, + 'label' => 'Owl Carousel', + 'menu_icon' => plugins_url( '/owl-carousel/images/owl-logo-16.png' ), + 'labels' => $labels, + 'capability_type' => 'post', + 'supports' => array( + 'title', + 'editor', + 'thumbnail' + ) + ) ); + + register_taxonomy( 'Carousel', 'owl-carousel', array( 'label' => __( 'Carousel' ), 'rewrite' => array( 'slug' => 'carousel' ), 'hierarchical' => true, - 'show_admin_column' => true, + 'show_admin_column' => true, ) ); - add_image_size('owl_widget', 180, 100, true); - add_image_size('owl_function', 600, 280, true); + add_image_size( 'owl_widget', 180, 100, true ); + add_image_size( 'owl_function', 600, 280, true ); - add_shortcode('owl-carousel', 'owl_function'); - add_filter("mce_external_plugins", "owl_register_tinymce_plugin"); - add_filter('mce_buttons', 'owl_add_tinymce_button'); + add_shortcode( 'owl-carousel', 'owl_function' ); + add_filter( "mce_external_plugins", "owl_register_tinymce_plugin" ); + add_filter( 'mce_buttons', 'owl_add_tinymce_button' ); - // Add Wordpress Gallery option - add_option('owl_carousel_wordpress_gallery', 'off'); - add_option('owl_carousel_orderby', 'post_date'); + // Add Wordpress Gallery option + add_option( 'owl_carousel_wordpress_gallery', 'off' ); + add_option( 'owl_carousel_orderby', 'post_date' ); } + function owl_carousel_menu() { - add_submenu_page('edit.php?post_type=owl-carousel', __('Parameters', 'owl-carousel-domain'), __('Parameters', 'owl-carousel-domain'), 'manage_options', 'owl-carousel-parameters', 'submenu_parameters'); + add_submenu_page( 'edit.php?post_type=owl-carousel', __( 'Parameters', 'owl-carousel-domain' ), __( 'Parameters', 'owl-carousel-domain' ), 'manage_options', 'owl-carousel-parameters', 'submenu_parameters' ); } + function submenu_parameters() { - $isWordpressGallery = (filter_var(get_option('owl_carousel_wordpress_gallery', false), FILTER_VALIDATE_BOOLEAN)) ? 'checked' : ''; - $orderBy = get_option('owl_carousel_orderby', 'post_date'); - $orderByOptions = array('post_date', 'title'); + $isWordpressGallery = ( filter_var( get_option( 'owl_carousel_wordpress_gallery', false ), FILTER_VALIDATE_BOOLEAN ) ) ? 'checked' : ''; + $orderBy = get_option( 'owl_carousel_orderby', 'post_date' ); + $orderByOptions = array( 'post_date', 'title' ); - echo ''; From ce630451230475efa97a1774623e47c4740a23c5 Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 11:31:17 +0100 Subject: [PATCH 10/11] Added more filter to title and the second content check --- owlcarousel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owlcarousel.php b/owlcarousel.php index e326edd..2337fe8 100644 --- a/owlcarousel.php +++ b/owlcarousel.php @@ -360,7 +360,7 @@ function owl_function( $atts, $content = null ) { $slide_content = get_the_content(); $img_overlay = ''; @@ -369,7 +369,7 @@ function owl_function( $atts, $content = null ) { $result .= ''; } else { - $result .= ''; + $result .= ''; } $result .= ''; } From 09f41d3ff05fcfbb2eaafdf2920c548a943a0f1d Mon Sep 17 00:00:00 2001 From: Rasmus Taarnby Date: Thu, 12 Feb 2015 12:46:59 +0100 Subject: [PATCH 11/11] Update name and home page to reflect orginal repo --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 00b92ec..777b141 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "rasmustaarnby/owl-carousel", + "name": "pjehan/wp-plugin-owlcarousel", "description": "A plugin to use Owl Carousel in Wordpress.", "type": "wordpress-plugin", "keywords": ["wordpress", "plugin"], - "homepage": "https://github.com/rasmustaarnby/owl-carousel", + "homepage": "https://github.com/pjehan/wp-plugin-owlcarousel", "authors": [ { "name": "Jehan Pierre",