Changeset 2676816
- Timestamp:
- 02/11/2022 02:55:23 AM (2 years ago)
- Location:
- wp-funnel-manager
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
wp-funnel-manager/tags/1.3.1/readme.txt
r2569689 r2676816 1 1 === WP Funnel Manager === 2 2 Contributors: manfcarlo 3 Tags: funnel, funnels, marketing, sales 4 Requires at least: 5.8 5 Tested up to: 5.8 6 Stable tag: 1.3.0 7 Requires PHP: 5.6 3 Tags: funnel builder, page builder, sales funnels, landing page, marketing, sales, block, blocks, block editor, gutenberg, template, templates 4 Tested up to: 5.9 5 Stable tag: 1.3.1 8 6 License: GPLv2 or later 9 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 49 47 Just go to the Funnels screen, find your funnel and click on Trash. This will delete the first step of the funnel only, and the second step of the funnel will take its place. 50 48 49 50 51 52 53 54 55 56 57 58 51 59 = How do I suggest a new feature or submit a bug report? = 52 60 … … 54 62 55 63 == Changelog == 64 65 66 67 68 56 69 57 70 = 1.3.0 = -
wp-funnel-manager/tags/1.3.1/src/plugin.php
r2569689 r2676816 22 22 * @var bool 23 23 */ 24 private $is_legacy = false; 24 private $is_legacy = true; 25 26 /** 27 * Whether this plugin manages the templated funnel types. 28 * 29 * @since 1.3.1 30 * @var bool 31 */ 32 private $is_templated = false; 25 33 26 34 /** … … 32 40 private $funnel_types = array(); 33 41 34 /**35 * Instantiate a WP_Funnel_Manager object.36 *37 * Don't call the constructor directly, use the `WP_Funnel_Manager::get_instance()`38 * static method instead.39 */40 public function __construct()41 {42 add_theme_support( 'block-templates' );43 }44 45 42 public function is_legacy() 46 43 { … … 50 47 public function register_funnel_types() 51 48 { 52 if ( !get_option( 'wpfunnel_ignore_legacy' ) ) 53 { 54 if ( empty( ( new \WP_Query( 'posts_per_page=-1&post_type=funnel&post_status=any,trash' ) )->posts ) ) 49 if ( get_option( 'wpfunnel_ignore_legacy' ) ) 50 { 51 $this->is_legacy = false; 52 } 53 54 $this->is_templated = current_theme_supports( 'block-templates' ); 55 56 if ( $this->is_templated ) 57 { 58 if ( $this->is_legacy && empty( ( 59 new \WP_Query( 60 array( 61 'post_type' => 'funnel', 62 'post_status' => array( 'any', 'trash' ), 63 'posts_per_page' => -1 64 ) 65 ) 66 )->posts ) ) 55 67 { 56 68 update_option( 'wpfunnel_ignore_legacy', '1' ); 69 57 70 } 58 else 71 72 foreach ( ( 73 new \WP_Query( 74 array( 75 'post_type' => 'wp_template', 76 'post_status' => 'publish', 77 'meta_key' => 'wpfunnel', 78 'meta_value' => '1', 79 'posts_per_page' => -1, 80 'orderby' => 'title', 81 'order' => 'ASC' 82 ) 83 ) 84 )->posts as $post ) 59 85 { 60 $this->is_legacy = true; 86 if ( strpos( $post->post_name, 'single-' ) === 0 ) 87 { 88 $slug = substr( $post->post_name, 7 ); 89 90 if ( ( !$this->is_legacy || $slug !== 'funnel' ) && substr( $slug, -4 ) !== '_int' ) 91 { 92 $this->funnel_types[] = new Funnel_Type( $slug, $post ); 93 } 94 } 61 95 } 62 96 } … … 67 101 } 68 102 69 foreach ( ( new \WP_Query( 'posts_per_page=-1&post_type=wp_template' ) )->posts as $post )70 {71 if ( empty( get_post_meta( $post->ID, 'wpfunnel' ) ) )72 continue;73 74 if ( $post->post_status !== 'publish' )75 continue;76 77 if ( strpos( $post->post_name, 'single-' ) !== 0 )78 continue;79 80 else81 $slug = substr( $post->post_name, 7 );82 83 if ( $this->is_legacy && $slug === 'funnel' )84 continue;85 86 if ( substr( $slug, -4 ) === '_int' )87 continue;88 89 $this->funnel_types[] = new Funnel_Type( $slug, $post );90 }91 92 103 foreach ( $this->funnel_types as $type ) 93 104 { … … 98 109 public function menu() 99 110 { 100 $new_type = 'wpfunnel'; 101 $parent = $this->is_legacy ? 'edit.php?post_type=funnel' : $new_type; 102 103 $wp_template = get_post_type_object( 'wp_template' ); 104 $new_type_capability = $wp_template === null ? 'do_not_allow' : $wp_template->cap->create_posts; 105 $parent_capability = $this->is_legacy ? 'edit_posts' : $new_type_capability; 106 107 add_menu_page( 'Funnels', 'Funnels', $parent_capability, $parent, '', 'dashicons-filter', 25 ); 108 $hook_suffix = add_submenu_page( $parent, 'New Funnel Type', 'New Funnel Type', $new_type_capability, $new_type, array( $this, 'new_funnel_type' ), 20 ); 109 110 add_action( 'load-' . $hook_suffix, array( $this, 'new_funnel_type' ) ); 111 if ( $this->is_templated || $this->is_legacy ) 112 { 113 $new_type = 'wpfunnel'; 114 $parent = $this->is_legacy ? 'edit.php?post_type=funnel' : $new_type; 115 116 $wp_template = get_post_type_object( 'wp_template' ); 117 $new_type_capability = $wp_template === null ? 'do_not_allow' : $wp_template->cap->create_posts; 118 $parent_capability = $this->is_legacy ? 'edit_posts' : $new_type_capability; 119 120 add_menu_page( 'Funnels', 'Funnels', $parent_capability, $parent, '', 'dashicons-filter', 25 ); 121 122 if ( $this->is_templated ) 123 { 124 $hook_suffix = add_submenu_page( $parent, 'New Funnel Type', 'New Funnel Type', $new_type_capability, $new_type, array( $this, 'new_funnel_type' ), 20 ); 125 add_action( 'load-' . $hook_suffix, array( $this, 'new_funnel_type' ) ); 126 } 127 } 111 128 } 112 129 … … 165 182 add_action( 'admin_menu', array( $this, 'menu' ), 9 ); 166 183 add_action( 'init', array( $this, 'database_upgrade_130' ), 20 ); 167 add_action( 'plugins_loaded', array( $this, 'register_funnel_types' ) ); 184 add_action( 'init', array( $this, 'database_upgrade_131' ), 20 ); 185 add_action( 'after_setup_theme', array( $this, 'register_funnel_types' ) ); 168 186 } 169 187 … … 182 200 'post_type' => 'wp_template', 183 201 'post_status' => array( 'any', 'trash', 'auto-draft' ), 184 'meta_input' => array( 185 'wpfunnel' => '1' 202 'meta_key' => 'wpfunnel', 203 'meta_value' => '1', 204 'posts_per_page' => -1 205 ) 206 ); 207 208 foreach ( $funnel_types->posts as $post ) 209 { 210 wp_set_post_terms( $post->ID, array(), 'wp_theme' ); 211 } 212 213 // If upgrading to 130 on version 1.3.1, skip the upgrade to 131 214 update_option( 'wpfunnel_db_version', '131' ); 215 } 216 217 /** 218 * Fixes a now-removed error with the 130 upgrade routine. 219 * 220 * @since 1.3.1 221 */ 222 public function database_upgrade_131() 223 { 224 if ( $this->get_db_version() >= 131 || !current_theme_supports( 'block-templates' ) ) 225 return; 226 227 $not_funnel_types = new \WP_Query( 228 array( 229 'post_type' => 'wp_template', 230 'post_status' => array( 'any', 'trash', 'auto-draft' ), 231 'meta_query' => array( 232 'relation' => 'OR', 233 array( 234 'key' => 'wpfunnel', 235 'compare' => 'NOT EXISTS' 236 ), 237 array( 238 'key' => 'wpfunnel', 239 'value' => '1', 240 'compare' => '!=' 241 ) 242 ), 243 'tax_query' => array( 244 array( 245 'taxonomy' => 'wp_theme', 246 'operator' => 'NOT EXISTS' 247 ) 186 248 ), 187 249 'posts_per_page' => -1 … … 189 251 ); 190 252 191 foreach ( $ funnel_types->posts as $post )192 { 193 wp_set_post_terms( $post->ID, array(), 'wp_theme');194 } 195 196 update_option( 'wpfunnel_db_version', '13 0' );253 foreach ( $funnel_types->posts as $post ) 254 { 255 wp_set_post_terms( $post->ID, ); 256 } 257 258 update_option( 'wpfunnel_db_version', '13' ); 197 259 } 198 260 199 261 public function no_funnels_notice() 200 262 { 201 if ( empty( $this->funnel_types ))202 { 203 echo '<div class="notice notice-warning"><p>Thank you for activating WP Funnel Manager! To start building funnels, just click on Funnels in the admin menu.</p></div>';263 if ( ) 264 { 265 echo '<div class="notice notice-warning"><p>Thank you for </p></div>'; 204 266 } 205 267 } -
wp-funnel-manager/tags/1.3.1/wp-funnel-manager.php
r2569689 r2676816 4 4 * Plugin URI: 5 5 * Description: Organises content into multi-step funnels. 6 * Version: 1.3. 06 * Version: 1.3. 7 7 * Requires at least: 5.8 8 8 9 * Author: Ask Carlo 9 10 * Author URI: https://askcarlo.com -
wp-funnel-manager/trunk/readme.txt
r2569689 r2676816 1 1 === WP Funnel Manager === 2 2 Contributors: manfcarlo 3 Tags: funnel, funnels, marketing, sales 4 Requires at least: 5.8 5 Tested up to: 5.8 6 Stable tag: 1.3.0 7 Requires PHP: 5.6 3 Tags: funnel builder, page builder, sales funnels, landing page, marketing, sales, block, blocks, block editor, gutenberg, template, templates 4 Tested up to: 5.9 5 Stable tag: 1.3.1 8 6 License: GPLv2 or later 9 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 49 47 Just go to the Funnels screen, find your funnel and click on Trash. This will delete the first step of the funnel only, and the second step of the funnel will take its place. 50 48 49 50 51 52 53 54 55 56 57 58 51 59 = How do I suggest a new feature or submit a bug report? = 52 60 … … 54 62 55 63 == Changelog == 64 65 66 67 68 56 69 57 70 = 1.3.0 = -
wp-funnel-manager/trunk/src/plugin.php
r2569689 r2676816 22 22 * @var bool 23 23 */ 24 private $is_legacy = false; 24 private $is_legacy = true; 25 26 /** 27 * Whether this plugin manages the templated funnel types. 28 * 29 * @since 1.3.1 30 * @var bool 31 */ 32 private $is_templated = false; 25 33 26 34 /** … … 32 40 private $funnel_types = array(); 33 41 34 /**35 * Instantiate a WP_Funnel_Manager object.36 *37 * Don't call the constructor directly, use the `WP_Funnel_Manager::get_instance()`38 * static method instead.39 */40 public function __construct()41 {42 add_theme_support( 'block-templates' );43 }44 45 42 public function is_legacy() 46 43 { … … 50 47 public function register_funnel_types() 51 48 { 52 if ( !get_option( 'wpfunnel_ignore_legacy' ) ) 53 { 54 if ( empty( ( new \WP_Query( 'posts_per_page=-1&post_type=funnel&post_status=any,trash' ) )->posts ) ) 49 if ( get_option( 'wpfunnel_ignore_legacy' ) ) 50 { 51 $this->is_legacy = false; 52 } 53 54 $this->is_templated = current_theme_supports( 'block-templates' ); 55 56 if ( $this->is_templated ) 57 { 58 if ( $this->is_legacy && empty( ( 59 new \WP_Query( 60 array( 61 'post_type' => 'funnel', 62 'post_status' => array( 'any', 'trash' ), 63 'posts_per_page' => -1 64 ) 65 ) 66 )->posts ) ) 55 67 { 56 68 update_option( 'wpfunnel_ignore_legacy', '1' ); 69 57 70 } 58 else 71 72 foreach ( ( 73 new \WP_Query( 74 array( 75 'post_type' => 'wp_template', 76 'post_status' => 'publish', 77 'meta_key' => 'wpfunnel', 78 'meta_value' => '1', 79 'posts_per_page' => -1, 80 'orderby' => 'title', 81 'order' => 'ASC' 82 ) 83 ) 84 )->posts as $post ) 59 85 { 60 $this->is_legacy = true; 86 if ( strpos( $post->post_name, 'single-' ) === 0 ) 87 { 88 $slug = substr( $post->post_name, 7 ); 89 90 if ( ( !$this->is_legacy || $slug !== 'funnel' ) && substr( $slug, -4 ) !== '_int' ) 91 { 92 $this->funnel_types[] = new Funnel_Type( $slug, $post ); 93 } 94 } 61 95 } 62 96 } … … 67 101 } 68 102 69 foreach ( ( new \WP_Query( 'posts_per_page=-1&post_type=wp_template' ) )->posts as $post )70 {71 if ( empty( get_post_meta( $post->ID, 'wpfunnel' ) ) )72 continue;73 74 if ( $post->post_status !== 'publish' )75 continue;76 77 if ( strpos( $post->post_name, 'single-' ) !== 0 )78 continue;79 80 else81 $slug = substr( $post->post_name, 7 );82 83 if ( $this->is_legacy && $slug === 'funnel' )84 continue;85 86 if ( substr( $slug, -4 ) === '_int' )87 continue;88 89 $this->funnel_types[] = new Funnel_Type( $slug, $post );90 }91 92 103 foreach ( $this->funnel_types as $type ) 93 104 { … … 98 109 public function menu() 99 110 { 100 $new_type = 'wpfunnel'; 101 $parent = $this->is_legacy ? 'edit.php?post_type=funnel' : $new_type; 102 103 $wp_template = get_post_type_object( 'wp_template' ); 104 $new_type_capability = $wp_template === null ? 'do_not_allow' : $wp_template->cap->create_posts; 105 $parent_capability = $this->is_legacy ? 'edit_posts' : $new_type_capability; 106 107 add_menu_page( 'Funnels', 'Funnels', $parent_capability, $parent, '', 'dashicons-filter', 25 ); 108 $hook_suffix = add_submenu_page( $parent, 'New Funnel Type', 'New Funnel Type', $new_type_capability, $new_type, array( $this, 'new_funnel_type' ), 20 ); 109 110 add_action( 'load-' . $hook_suffix, array( $this, 'new_funnel_type' ) ); 111 if ( $this->is_templated || $this->is_legacy ) 112 { 113 $new_type = 'wpfunnel'; 114 $parent = $this->is_legacy ? 'edit.php?post_type=funnel' : $new_type; 115 116 $wp_template = get_post_type_object( 'wp_template' ); 117 $new_type_capability = $wp_template === null ? 'do_not_allow' : $wp_template->cap->create_posts; 118 $parent_capability = $this->is_legacy ? 'edit_posts' : $new_type_capability; 119 120 add_menu_page( 'Funnels', 'Funnels', $parent_capability, $parent, '', 'dashicons-filter', 25 ); 121 122 if ( $this->is_templated ) 123 { 124 $hook_suffix = add_submenu_page( $parent, 'New Funnel Type', 'New Funnel Type', $new_type_capability, $new_type, array( $this, 'new_funnel_type' ), 20 ); 125 add_action( 'load-' . $hook_suffix, array( $this, 'new_funnel_type' ) ); 126 } 127 } 111 128 } 112 129 … … 165 182 add_action( 'admin_menu', array( $this, 'menu' ), 9 ); 166 183 add_action( 'init', array( $this, 'database_upgrade_130' ), 20 ); 167 add_action( 'plugins_loaded', array( $this, 'register_funnel_types' ) ); 184 add_action( 'init', array( $this, 'database_upgrade_131' ), 20 ); 185 add_action( 'after_setup_theme', array( $this, 'register_funnel_types' ) ); 168 186 } 169 187 … … 182 200 'post_type' => 'wp_template', 183 201 'post_status' => array( 'any', 'trash', 'auto-draft' ), 184 'meta_input' => array( 185 'wpfunnel' => '1' 202 'meta_key' => 'wpfunnel', 203 'meta_value' => '1', 204 'posts_per_page' => -1 205 ) 206 ); 207 208 foreach ( $funnel_types->posts as $post ) 209 { 210 wp_set_post_terms( $post->ID, array(), 'wp_theme' ); 211 } 212 213 // If upgrading to 130 on version 1.3.1, skip the upgrade to 131 214 update_option( 'wpfunnel_db_version', '131' ); 215 } 216 217 /** 218 * Fixes a now-removed error with the 130 upgrade routine. 219 * 220 * @since 1.3.1 221 */ 222 public function database_upgrade_131() 223 { 224 if ( $this->get_db_version() >= 131 || !current_theme_supports( 'block-templates' ) ) 225 return; 226 227 $not_funnel_types = new \WP_Query( 228 array( 229 'post_type' => 'wp_template', 230 'post_status' => array( 'any', 'trash', 'auto-draft' ), 231 'meta_query' => array( 232 'relation' => 'OR', 233 array( 234 'key' => 'wpfunnel', 235 'compare' => 'NOT EXISTS' 236 ), 237 array( 238 'key' => 'wpfunnel', 239 'value' => '1', 240 'compare' => '!=' 241 ) 242 ), 243 'tax_query' => array( 244 array( 245 'taxonomy' => 'wp_theme', 246 'operator' => 'NOT EXISTS' 247 ) 186 248 ), 187 249 'posts_per_page' => -1 … … 189 251 ); 190 252 191 foreach ( $ funnel_types->posts as $post )192 { 193 wp_set_post_terms( $post->ID, array(), 'wp_theme');194 } 195 196 update_option( 'wpfunnel_db_version', '13 0' );253 foreach ( $funnel_types->posts as $post ) 254 { 255 wp_set_post_terms( $post->ID, ); 256 } 257 258 update_option( 'wpfunnel_db_version', '13' ); 197 259 } 198 260 199 261 public function no_funnels_notice() 200 262 { 201 if ( empty( $this->funnel_types ))202 { 203 echo '<div class="notice notice-warning"><p>Thank you for activating WP Funnel Manager! To start building funnels, just click on Funnels in the admin menu.</p></div>';263 if ( ) 264 { 265 echo '<div class="notice notice-warning"><p>Thank you for </p></div>'; 204 266 } 205 267 } -
wp-funnel-manager/trunk/wp-funnel-manager.php
r2569689 r2676816 4 4 * Plugin URI: 5 5 * Description: Organises content into multi-step funnels. 6 * Version: 1.3. 06 * Version: 1.3. 7 7 * Requires at least: 5.8 8 8 9 * Author: Ask Carlo 9 10 * Author URI: https://askcarlo.com
Note: See TracChangeset
for help on using the changeset viewer.