Changeset 1744797
- Timestamp:
- 10/11/2017 02:10:48 PM (18 months ago)
- Location:
- pixtypes
- Files:
-
- 26 added
- 4 deleted
- 43 edited
- 7 copied
Legend:
- Unmodified
- Added
- Removed
-
pixtypes/tags/1.4.8/README.md
r1591155 r1744797 49 49 ), 50 50 'has_archive' => 'portfolio-archive', 51 'menu_icon' => ' report.png',51 'menu_icon' => 'dashicons-portfolio', 52 52 'menu_position' => null, 53 53 'hierarchical' => true, -
pixtypes/tags/1.4.8/class-pixtypes.php
r1728763 r1744797 25 25 * @const string 26 26 */ 27 protected $version = '1.4.7';27 protected $version; 28 28 /** 29 29 * Unique identifier for your plugin. … … 72 72 * 73 73 * @since 1.0.0 74 */ 75 protected function __construct() { 76 74 * 75 * @param string $version 76 */ 77 protected function __construct( $version = '1.0.0' ) { 78 $this->version = $version; 77 79 $this->plugin_basepath = plugin_dir_path( __FILE__ ); 78 80 $this->config = self::config(); … … 80 82 // Load plugin text domain 81 83 add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); 82 // add_action( 'admin_init', array( $this, 'wpgrade_init_plugin' ) );83 84 84 85 // Add the options page and menu item only when is needed. … … 92 93 } 93 94 94 // Load admin style sheet and JavaScript.95 // Load admin stylesheet and JavaScript files. 95 96 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); 96 97 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); 97 98 98 // Load public-facing style sheet and JavaScript.99 // add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );100 // add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );101 102 99 add_action( 'plugins_loaded', array( $this, 'register_metaboxes' ), 14 ); 103 100 add_action( 'init', array( $this, 'register_entities' ), 99999 ); 104 101 105 // We need this later th at the default 10so we can have things happening between the init-10 and the PixTypes config102 // We need this later then the default 10 priority so we can have things happening between the init-10 and the PixTypes config 106 103 add_action( 'init', array( $this, 'theme_version_check' ), 15 ); 107 104 108 105 /** 109 * Ajax Callbacks 106 * Ajax Callbacks - only for logged in users 110 107 */ 111 108 add_action( 'wp_ajax_unset_pixtypes', array( &$this, 'ajax_unset_pixtypes' ) ); 112 add_action( 'wp_ajax_nopriv_unset_pixtypes', array( &$this, 'ajax_unset_pixtypes' ) );113 109 } 114 110 … … 118 114 * @since 1.0.0 119 115 * 116 * @param string $version The current plugin version. 120 117 * @return object A single instance of this class. 121 118 */ 122 public static function get_instance( ) {119 public static function get_instance( $version = '1.0.0' ) { 123 120 124 121 // If the single instance hasn't been set, set it now. 125 122 if ( null == self::$instance ) { 126 self::$instance = new self ;123 self::$instance = new self( $version ); 127 124 } 128 125 … … 133 130 // @TODO maybe check this 134 131 return include 'plugin-config.php'; 135 }136 137 public function wpgrade_init_plugin() {138 // $this->plugin_textdomain();139 // $this->add_wpgrade_shortcodes_button();140 132 } 141 133 … … 184 176 if ( ! empty( $theme_types[ $current_theme ]['post_types'] ) ) { 185 177 foreach ( $theme_types[ $current_theme ]['post_types'] as $key => $post_type ) { 186 $testable_slug = $is_slug_unique = ''; 187 $testable_slug = str_replace( $theme_name . '-', '', $post_type["rewrite"]["slug"] ); 178 $testable_slug = str_replace( $theme_name . '-', '', $post_type['rewrite']['slug'] ); 188 179 189 180 /** for our current theme we try to prioritize slugs */ 190 if ( isset( $post_type[ "rewrite"] ) && self::is_custom_post_type_slug_unique( $testable_slug ) ) {181 if ( isset( $post_type['rewrite'] ) && self::is_custom_post_type_slug_unique( $testable_slug ) ) { 191 182 /** this slug is unique we can quit the theme suffix */ 192 $theme_types[ $current_theme ]['post_types'][ $key ][ "rewrite"]["slug"] = $testable_slug;183 $theme_types[ $current_theme ]['post_types'][ $key ]['rewrite']['slug'] = $testable_slug; 193 184 } 194 185 195 186 // process menu icon if it exists 196 187 if ( isset( $post_type['menu_icon'] ) ) { 197 $theme_types[ $current_theme ]['post_types'][ $key ]['menu_icon'] = plugins_url( 'assets/' . $post_type['menu_icon'], __FILE__ ); 188 // If we have been given a dashicon, use it without processing 189 if ( false !== strpos( $post_type['menu_icon'], 'dashicon' ) ) { 190 $theme_types[ $current_theme ]['post_types'][ $key ]['menu_icon'] = $post_type['menu_icon']; 191 } else { 192 $theme_types[ $current_theme ]['post_types'][ $key ]['menu_icon'] = plugins_url( 'assets/' . $post_type['menu_icon'], __FILE__ ); 193 } 198 194 } 199 195 } … … 203 199 if ( ! empty( $theme_types[ $current_theme ]['taxonomies'] ) ) { 204 200 foreach ( $theme_types[ $current_theme ]['taxonomies'] as $key => $tax ) { 205 $testable_slug = $is_slug_unique = ''; 206 $testable_slug = str_replace( $theme_name . '-', '', $tax["rewrite"]["slug"] ); 207 if ( isset( $tax["rewrite"] ) && self::is_tax_slug_unique( $testable_slug ) ) { 201 $testable_slug = str_replace( $theme_name . '-', '', $tax['rewrite']['slug'] ); 202 if ( isset( $tax['rewrite'] ) && self::is_tax_slug_unique( $testable_slug ) ) { 208 203 /** this slug is unique we can quit the theme suffix */ 209 $theme_types[ $current_theme ]['taxonomies'][ $key ][ "rewrite"]["slug"] = $testable_slug;204 $theme_types[ $current_theme ]['taxonomies'][ $key ]['rewrite']['slug'] = $testable_slug; 210 205 } 211 206 } … … 218 213 update_option( $config['settings-key'], $types_settings ); 219 214 220 // flush_rewrite_rules();221 // global $wp_rewrite;222 // $wp_rewrite->generate_rewrite_rules();223 // flush_rewrite_rules();224 225 215 /** 226 216 * http://wordpress.stackexchange.com/questions/36152/flush-rewrite-rules-not-working-on-plugin-deactivation-invalid-urls-not-showing 227 * nothing from above works in plugin so ...217 * nothing from above works in plugins so ... 228 218 */ 229 219 delete_option( 'rewrite_rules' ); … … 299 289 300 290 /** 301 * Register and enqueue public-facing style sheet.302 *303 * @since 1.0.0304 */305 function enqueue_styles() {306 wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'css/public.css', __FILE__ ), array(), $this->version );307 }308 309 /**310 * Register and enqueues public-facing JavaScript files.311 *312 * @since 1.0.0313 */314 public function enqueue_scripts() {315 wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), $this->version );316 }317 318 /**319 291 * Register the administration menu for this plugin into the WordPress Dashboard menu. 320 292 */ … … 322 294 323 295 $this->plugin_screen_hook_suffix = add_options_page( 324 esc_html__( 'PixTypes', $this->plugin_slug),325 esc_html__( 'PixTypes', $this->plugin_slug),296 esc_html__( 'PixTypes', 'pixtypes' ), 297 esc_html__( 'PixTypes', 'pixtypes' ), 326 298 'manage_options', 327 299 $this->plugin_slug, … … 342 314 */ 343 315 function add_action_links( $links ) { 344 return array_merge( array( 'settings' => '<a href="' . admin_url( 'options-general.php?page=pixtypes' ) . '">' . esc_html__( 'Settings', $this->plugin_slug) . '</a>' ), $links );316 return array_merge( array( 'settings' => '<a href="' . admin_url( 'options-general.php?page=pixtypes' ) . '">' . esc_html__( 'Settings', 'pixtypes' ) . '</a>' ), $links ); 345 317 } 346 318 347 319 function register_entities() { 348 require_once( $this->plugin_basepath . 'features/custom-entities.php' ); 320 // register post types 321 $options = $updated_options = apply_filters( 'pixtypes_settings_pre_register_entitites', get_option( 'pixtypes_settings' ) ); 322 $updated_options['display_settings'] = false; 323 324 // go through each theme and activate portfolio post types 325 if ( empty( $options['themes'] ) || ! array( $options['themes'] ) ) { 326 return; 327 } 328 329 /** A pixelgrade theme will always have this class so we know we can import new settings **/ 330 $current_theme = false; 331 if ( class_exists( 'wpgrade' ) ) { 332 $current_theme = wpgrade::shortname(); 333 } 334 335 $theme_types = $options['themes']; 336 foreach ( $theme_types as $key => $theme ) { 337 // post types 338 if ( isset( $theme['post_types'] ) && is_array( $theme['post_types'] ) ) { 339 // Remember what post types we have removed from settings so we can skip registering their taxonomies 340 $deleted_post_types = array(); 341 foreach ( $theme['post_types'] as $post_type => $post_type_args ) { 342 // First check if the post type is already registered - we bail if that is the case 343 if ( post_type_exists( $post_type ) ) { 344 continue; 345 } 346 347 // Second, for post types not belonging to the current theme, we only register them if there are posts 348 if ( false !== $current_theme && $key != $current_theme ) { 349 // We get the posts to see if there are any - we include all post statuses (trash and auto-draft need to be specified directly) 350 $posts = get_posts( array( 'post_type' => $post_type, 'post_status' => array( 'any', 'trash', 'auto-draft' ), 'posts_per_page' => '1' ) ); 351 if ( empty( $posts ) ) { 352 // We should also delete the post type from the settings - no worries; if the theme gets activated again, all this will come back 353 // This is just for auto-cleanup 354 unset( $updated_options['themes'][ $key ]['post_types'][ $post_type ] ); 355 $deleted_post_types[] = $post_type; 356 continue; 357 } 358 } 359 360 $is_jetpack_compatible = false; 361 if ( strpos( $post_type, 'jetpack' ) !== false ) { 362 ///$xxxx = str_replace( 'jetpack-', '', $post_type); 363 $is_jetpack_compatible = true; 364 } 365 366 if ( $is_jetpack_compatible ) { 367 $post_type_key = strstr( $post_type, '-' ); 368 $post_type_key = substr( $post_type_key, 1 ); 369 } else { 370 // eliminate the theme prefix 371 $post_type_key = strstr( $post_type, '_' ); 372 $post_type_key = substr( $post_type_key, 1 ); 373 } 374 375 // process menu icon if it exists 376 if ( isset( $post_type_args['menu_icon'] ) ) { 377 // If we have been given a dashicon or full URL, use it without processing 378 if ( false === strpos( $post_type_args['menu_icon'], 'dashicon' ) && false === filter_var( $post_type_args['menu_icon'], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED ) ) { 379 $post_type_args['menu_icon'] = plugins_url( 'assets/' . $post_type_args['menu_icon'], __FILE__ ); 380 } 381 } 382 383 if ( isset( $options[ 'enable_' . $post_type_key ] ) ) { 384 $updated_options['display_settings'] = true; 385 if ( $options[ 'enable_' . $post_type_key ] ) { 386 register_post_type( $post_type, $post_type_args ); 387 } 388 } 389 } 390 } 391 392 // taxonomies 393 if ( isset( $theme['taxonomies'] ) && is_array( $theme['taxonomies'] ) ) { 394 foreach ( $theme['taxonomies'] as $tax => $tax_args ) { 395 // First check if the taxonomy is already registered - we bail if that is the case 396 if ( taxonomy_exists( $tax ) ) { 397 continue; 398 } 399 400 // If we have deleted post types settings we need to skip registering their taxonomies 401 if ( ! empty( $tax_args['post_types'] ) && ! empty( $deleted_post_types ) ) { 402 if ( ! is_array( $tax_args['post_types'] ) ) { 403 if ( in_array( $tax_args['post_types'], $deleted_post_types ) ) { 404 continue; 405 } 406 } else { 407 $temp = array_diff( $tax_args['post_types'], $deleted_post_types ); 408 if ( empty( $temp ) ) { 409 continue; 410 } 411 } 412 } 413 414 $tax_post_types = $tax_args['post_types']; 415 // remove "post_types", isn't a register_taxonomy argument we are just using it for post type linking 416 unset( $tax_args['post_types'] ); 417 418 $is_jetpack_compatible = false; 419 if ( strpos( $tax, 'jetpack' ) !== false ) { 420 ///$xxxx = str_replace( 'jetpack-', '', $tax); 421 $is_jetpack_compatible = true; 422 } 423 424 if ( $is_jetpack_compatible ) { 425 $tax_key = strstr( $tax, '-' ); 426 $tax_key = substr( $tax_key, 1 ); 427 } else { 428 // eliminate the theme prefix 429 $tax_key = strstr( $tax, '_' ); 430 $tax_key = substr( $tax_key, 1 ); 431 } 432 433 if ( isset( $options[ 'enable_' . $tax_key ] ) ) { 434 $updated_options['display_settings'] = true; 435 if ( $options[ 'enable_' . $tax_key ] ) { 436 register_taxonomy( $tax, $tax_post_types, $tax_args ); 437 } 438 } 439 } 440 } 441 } 442 443 // Only update if we have actually changed something 444 if ( $options != $updated_options ) { 445 update_option( 'pixtypes_settings', $updated_options ); 446 } 349 447 } 350 448 … … 369 467 $rewrite = $post_type->rewrite; 370 468 /** if this post_type has a rewrite rule check for it */ 371 if ( ! empty( $rewrite ) && isset( $rewrite[ "slug"] ) && $slug == $rewrite["slug"] ) {469 if ( ! empty( $rewrite ) && isset( $rewrite['slug'] ) && $slug == $rewrite['slug'] ) { 372 470 $is_unique = false; 373 471 } elseif ( $slug == $key ) { … … 388 486 */ 389 487 static function is_tax_slug_unique( $slug ) { 390 391 488 global $wp_taxonomies; 489 490 /** Suppose it's true */ 392 491 $is_unique = true; 393 /** Suppose it's true */394 492 395 493 foreach ( $wp_taxonomies as $key => $tax ) { 396 494 $rewrite = $tax->rewrite; 397 495 /** if this post_type has a rewrite rule check for it */ 398 if ( ! empty( $rewrite ) && isset( $rewrite[ "slug"] ) && $slug == $rewrite["slug"] ) {496 if ( ! empty( $rewrite ) && isset( $rewrite['slug'] ) && $slug == $rewrite['slug'] ) { 399 497 $is_unique = false; 400 498 } elseif ( $slug == $key ) { … … 433 531 ), 434 532 'has_archive' => 'portfolio-archive', 435 'menu_icon' => plugins_url( 'assets/report.png', __FILE__ ),533 'menu_icon' => 'dashicons-portfolio', 436 534 'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'excerpt' ), 437 535 'yarpp_support' => true, … … 459 557 'has_archive' => 'galleries-archive', 460 558 'menu_position' => null, 559 'menu_icon' => 'dashicons-format-gallery', 461 560 'supports' => array( 'title', 'thumbnail', 'page-attributes', 'excerpt' ), 462 561 'yarpp_support' => true, … … 546 645 547 646 /** 548 * Ajax callback for unseting unneeded post types647 * Ajax callback for cleaning up the settings for a theme 549 648 */ 550 649 function ajax_unset_pixtypes() { … … 555 654 } 556 655 557 if ( isset( $_POST[' post_type'] ) ) {558 $key = $_POST[' post_type'];656 if ( isset( $_POST['theme_slug'] ) ) { 657 $key = $_POST['theme_slug']; 559 658 $options = get_option( 'pixtypes_settings' ); 560 659 if ( isset( $options['themes'][ $key ] ) ) { 561 660 unset( $options['themes'][ $key ] ); 562 661 update_option( 'pixtypes_settings', $options ); 563 $result['msg'] = ' Post type ' . $key . ' is gone.';662 $result['msg'] = 'Settings for ' . ucfirst( $key ) . ' have been cleaned up!'; 564 663 $result['success'] = true; 565 664 } … … 574 673 */ 575 674 function theme_version_check() { 576 577 $options = get_option( 'pixtypes_settings' ); 578 579 if ( class_exists( 'wpgrade' ) && isset( $options['wpgrade_theme_version'] ) ) { 580 581 if ( wpgrade::themeversion() != $options['wpgrade_theme_version'] ) { 675 if ( class_exists( 'wpgrade' ) ) { 676 // Each theme should have it's pixtypes config theme version saved 677 $options = get_option( 'pixtypes_settings' ); 678 679 // Make sure that we fix things just in case 680 if ( ! isset( $options['wpgrade_theme_version'] ) ) { 681 $options['wpgrade_theme_version'] = '0.0.1'; 682 } 683 684 if ( version_compare( wpgrade::themeversion(), $options['wpgrade_theme_version'], '!=' ) ) { 582 685 // here the theme is updating it's options 583 $test = function_exists( 'wpgrade_callback_geting_active' ); 584 585 wpgrade_callback_geting_active(); 586 // the plugin will copy these options into it's own field 587 self::activate( false ); 588 // end finally merge user's settings with the theme ones 589 save_pixtypes_settings( $options ); 590 686 if ( function_exists( 'wpgrade_callback_geting_active' ) ) { 687 wpgrade_callback_geting_active(); 688 // the plugin will copy these options into it's own field 689 self::activate( false ); 690 // end finally merge user's settings with the theme ones 691 save_pixtypes_settings( $options ); 692 } 591 693 } 592 694 } -
pixtypes/tags/1.4.8/core/classes/HTMLElement.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/classes/HTMLTag.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/classes/Meta.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/classes/Processor.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/classes/Validator.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/classes/forms/Form.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/classes/forms/FormField.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/defaults.php
r1591155 r1744797 28 28 'errors' => array 29 29 ( 30 'is_numeric' => esc_html__('Numberic value required.', pixtypes::textdomain()),31 'not_empty' => esc_html__('Field is required.', pixtypes::textdomain()),30 'is_numeric' => esc_html__('Numberic value required.', 'pixtypes' ), 31 'not_empty' => esc_html__('Field is required.', 'pixtypes' ), 32 32 ), 33 33 -
pixtypes/tags/1.4.8/core/interfaces/HTMLElement.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/interfaces/HTMLTag.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/interfaces/Meta.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/interfaces/Processor.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/interfaces/Validator.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/interfaces/extended/Form.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/core/interfaces/extended/FormField.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/tags/1.4.8/features/metaboxes/init.php
r1591646 r1744797 1012 1012 // validate meta value 1013 1013 if ( isset( $field['validate_func'] ) ) { 1014 $ok = call_user_func( array( 'cmb_Meta_Box_Validate', $field['validate_func'] ), $new);1014 $ok = call_user_func( $field['validate_func'], $new, $field, $post_id ); 1015 1015 if ( $ok === false ) { // pass away when meta value is invalid 1016 1016 continue; -
pixtypes/tags/1.4.8/features/metaboxes/metaboxes.php
r1728763 r1744797 53 53 54 54 require_once 'cmb-field-select2/cmb-field-select2.php'; 55 require_once 'cmb-field-select2-v2/cmb-field-select2.php'; 55 56 } 56 57 -
pixtypes/tags/1.4.8/js/admin.js
r1115891 r1744797 61 61 /** ajax callbacks */ 62 62 $('#unset_pixypes').on('click', 'button', function(e){ 63 var response = confirm(' Be sure that you don\'t need this post type anymore');63 var response = confirm('Make sure that you have moved the theme specific content you were interested in. If at any time you wish to access it again, reactivate that previous theme.'); 64 64 65 65 if ( response == false ) { … … 69 69 70 70 var ajax_nounce = $(this).parents('ul').siblings('.unset_nonce').val(); 71 // reload likes number71 // Cleanup pixtypes settings 72 72 jQuery.ajax({ 73 type: "post",url: locals.ajax_url,data: { action: 'unset_pixtypes', _ajax_nonce: ajax_nounce, post_type: $(this).val() },73 type: "post",url: locals.ajax_url,data: { action: 'unset_pixtypes', _ajax_nonce: ajax_nounce, theme_slug: $(this).val() }, 74 74 //beforeSend: function() {jQuery("#loading").show("slow");}, //show loading just when link is clicked 75 75 //complete: function() { jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete -
pixtypes/tags/1.4.8/pixtypes.php
r1728763 r1744797 1 1 <?php 2 2 /* 3 * @package PixTypes 4 * @author Pixelgrade <[email protected]> 5 * @license GPL-2.0+ 6 * @link https://pixelgrade.com 7 * @copyright 2013-2017 Pixelgrade 8 * 9 * @wordpress-plugin 10 Plugin Name: PixTypes 11 Plugin URI: https://pixelgrade.com 12 Description: Custom post types and meta-boxes needed by your theme 13 Version: 1.4.7 14 Author: Pixelgrade 15 Author URI: https://pixelgrade.com 16 Author Email: [email protected] 17 Text Domain: pixtypes 18 License: GPL-2.0+ 19 License URI: http://www.gnu.org/licenses/gpl-2.0.txt 20 Domain Path: /lang 21 */ 3 * Plugin Name: PixTypes 4 * Plugin URI: https://wordpress.org/plugins/pixtypes/ 5 * Description: Custom post types and meta-boxes needed by your themes. 6 * Version: 1.4.8 7 * Author URI: https://pixelgrade.com 8 * Author Email: [email protected] 9 * License: GPL2+ 10 * Text Domain: pixtypes 11 * Domain Path: /lang/ 12 */ 22 13 23 14 // If this file is called directly, abort. … … 34 25 35 26 $config = include 'plugin-config' . EXT; 36 include 'features/class-pix-query' . EXT;37 27 // set textdomain 38 28 pixtypes::settextdomain( $config['textdomain'] ); … … 56 46 // -------------- 57 47 58 $basepath = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;59 $callbackpath = $basepath . 'callbacks' . DIRECTORY_SEPARATOR;48 $basepath = trailingslashit( dirname( __FILE__ ) ); 49 $callbackpath = trailingslashit( $basepath . 'callbacks' ); 60 50 pixtypes::require_all( $callbackpath ); 61 51 … … 67 57 68 58 global $pixtypes_plugin; 69 $pixtypes_plugin = PixTypesPlugin::get_instance( );59 $pixtypes_plugin = PixTypesPlugin::get_instance( '1.4.8' ); -
pixtypes/tags/1.4.8/settings/post_types.php
r1591155 r1744797 7 7 8 8 $options = get_option( 'pixtypes_settings' ); 9 // go through each theme and activate portfolio post types10 if ( isset( $options[ "themes"] ) ) {11 $theme_types = $options[ "themes"];9 // go through each theme and activate the post types settings 10 if ( isset( $options['themes'] ) ) { 11 $theme_types = $options['themes']; 12 12 foreach ( $theme_types as $key => $theme ) { 13 13 … … 23 23 } 24 24 $display_settings = true; 25 } else {26 return array( 'type' => 'hidden' );27 25 } 28 26 } 27 } 28 29 // Check if we have any post type that should be shown settings 30 $hide = true; 31 foreach ( $display_option as $post_type => $display ) { 32 if ( $display ) { 33 $hide = false; 34 break; 35 } 36 } 37 38 if ( $hide ) { 39 return array( 'type' => 'hidden' ); 29 40 } 30 41 -
pixtypes/tags/1.4.8/views/admin.php
r1591155 r1744797 43 43 <?php endif; ?> 44 44 45 <?php echo $f = pixtypes::form( $config, $processor ); 46 echo $f->field( 'hiddens' )->render(); ?> 45 <?php 46 $f = pixtypes::form( $config, $processor ); ?> 47 48 <?php echo $f->startform() ?> 49 50 <?php echo $f->field( 'hiddens' )->render(); ?> 47 51 48 52 <?php echo $f->field( 'post_types' )->render(); ?> … … 70 74 71 75 <div class="handlediv" title="Click to toggle"><br></div> 72 <h3 class="hndle"><span><?php esc_html_e( ' DangerZone', 'pixtypes' ); ?></span></h3>76 <h3 class="hndle"><span><?php esc_html_e( 'Extra Careful Zone', 'pixtypes' ); ?></span></h3> 73 77 74 78 <div class="inside"> 75 79 76 <p><?php esc_html_e( 'If you are done with copying your content from old post types to new ones, you can also get rid of the old post types.', 'pixtypes' ); ?></p>80 <p><?php esc_html_e( 'If you are done with copying your content from old themes to new ones, you can also get rid of the old themes settings and post types.', 'pixtypes' ); ?></p> 77 81 <form method="post" id="unset_pixypes" 78 82 action="<?php echo admin_url( 'options-general.php?page=pixtypes' ) ?>"> … … 83 87 if ( isset( $options['themes'] ) && count( $options['themes'] ) > 1 ) { 84 88 foreach ( $options['themes'] as $key => $theme ) { 85 echo '<li><button class="button delete-action" type="submit" name="unset_pixtype" value="' . $key . '">' . esc_html__( ' Unset', 'pixtypes' ) . ' ' . $key. '</button></li>';89 echo '<li><button class="button delete-action" type="submit" name="unset_pixtype" value="' . $key . '">' . esc_html__( 'Clean-up after', 'pixtypes' ) . ' ' . ucfirst( $key ) . '</button></li>'; 86 90 } 87 91 } ?> -
pixtypes/trunk/README.md
r1591155 r1744797 49 49 ), 50 50 'has_archive' => 'portfolio-archive', 51 'menu_icon' => ' report.png',51 'menu_icon' => 'dashicons-portfolio', 52 52 'menu_position' => null, 53 53 'hierarchical' => true, -
pixtypes/trunk/class-pixtypes.php
r1728763 r1744797 25 25 * @const string 26 26 */ 27 protected $version = '1.4.7';27 protected $version; 28 28 /** 29 29 * Unique identifier for your plugin. … … 72 72 * 73 73 * @since 1.0.0 74 */ 75 protected function __construct() { 76 74 * 75 * @param string $version 76 */ 77 protected function __construct( $version = '1.0.0' ) { 78 $this->version = $version; 77 79 $this->plugin_basepath = plugin_dir_path( __FILE__ ); 78 80 $this->config = self::config(); … … 80 82 // Load plugin text domain 81 83 add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); 82 // add_action( 'admin_init', array( $this, 'wpgrade_init_plugin' ) );83 84 84 85 // Add the options page and menu item only when is needed. … … 92 93 } 93 94 94 // Load admin style sheet and JavaScript.95 // Load admin stylesheet and JavaScript files. 95 96 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) ); 96 97 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); 97 98 98 // Load public-facing style sheet and JavaScript.99 // add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );100 // add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );101 102 99 add_action( 'plugins_loaded', array( $this, 'register_metaboxes' ), 14 ); 103 100 add_action( 'init', array( $this, 'register_entities' ), 99999 ); 104 101 105 // We need this later th at the default 10so we can have things happening between the init-10 and the PixTypes config102 // We need this later then the default 10 priority so we can have things happening between the init-10 and the PixTypes config 106 103 add_action( 'init', array( $this, 'theme_version_check' ), 15 ); 107 104 108 105 /** 109 * Ajax Callbacks 106 * Ajax Callbacks - only for logged in users 110 107 */ 111 108 add_action( 'wp_ajax_unset_pixtypes', array( &$this, 'ajax_unset_pixtypes' ) ); 112 add_action( 'wp_ajax_nopriv_unset_pixtypes', array( &$this, 'ajax_unset_pixtypes' ) );113 109 } 114 110 … … 118 114 * @since 1.0.0 119 115 * 116 * @param string $version The current plugin version. 120 117 * @return object A single instance of this class. 121 118 */ 122 public static function get_instance( ) {119 public static function get_instance( $version = '1.0.0' ) { 123 120 124 121 // If the single instance hasn't been set, set it now. 125 122 if ( null == self::$instance ) { 126 self::$instance = new self ;123 self::$instance = new self( $version ); 127 124 } 128 125 … … 133 130 // @TODO maybe check this 134 131 return include 'plugin-config.php'; 135 }136 137 public function wpgrade_init_plugin() {138 // $this->plugin_textdomain();139 // $this->add_wpgrade_shortcodes_button();140 132 } 141 133 … … 184 176 if ( ! empty( $theme_types[ $current_theme ]['post_types'] ) ) { 185 177 foreach ( $theme_types[ $current_theme ]['post_types'] as $key => $post_type ) { 186 $testable_slug = $is_slug_unique = ''; 187 $testable_slug = str_replace( $theme_name . '-', '', $post_type["rewrite"]["slug"] ); 178 $testable_slug = str_replace( $theme_name . '-', '', $post_type['rewrite']['slug'] ); 188 179 189 180 /** for our current theme we try to prioritize slugs */ 190 if ( isset( $post_type[ "rewrite"] ) && self::is_custom_post_type_slug_unique( $testable_slug ) ) {181 if ( isset( $post_type['rewrite'] ) && self::is_custom_post_type_slug_unique( $testable_slug ) ) { 191 182 /** this slug is unique we can quit the theme suffix */ 192 $theme_types[ $current_theme ]['post_types'][ $key ][ "rewrite"]["slug"] = $testable_slug;183 $theme_types[ $current_theme ]['post_types'][ $key ]['rewrite']['slug'] = $testable_slug; 193 184 } 194 185 195 186 // process menu icon if it exists 196 187 if ( isset( $post_type['menu_icon'] ) ) { 197 $theme_types[ $current_theme ]['post_types'][ $key ]['menu_icon'] = plugins_url( 'assets/' . $post_type['menu_icon'], __FILE__ ); 188 // If we have been given a dashicon, use it without processing 189 if ( false !== strpos( $post_type['menu_icon'], 'dashicon' ) ) { 190 $theme_types[ $current_theme ]['post_types'][ $key ]['menu_icon'] = $post_type['menu_icon']; 191 } else { 192 $theme_types[ $current_theme ]['post_types'][ $key ]['menu_icon'] = plugins_url( 'assets/' . $post_type['menu_icon'], __FILE__ ); 193 } 198 194 } 199 195 } … … 203 199 if ( ! empty( $theme_types[ $current_theme ]['taxonomies'] ) ) { 204 200 foreach ( $theme_types[ $current_theme ]['taxonomies'] as $key => $tax ) { 205 $testable_slug = $is_slug_unique = ''; 206 $testable_slug = str_replace( $theme_name . '-', '', $tax["rewrite"]["slug"] ); 207 if ( isset( $tax["rewrite"] ) && self::is_tax_slug_unique( $testable_slug ) ) { 201 $testable_slug = str_replace( $theme_name . '-', '', $tax['rewrite']['slug'] ); 202 if ( isset( $tax['rewrite'] ) && self::is_tax_slug_unique( $testable_slug ) ) { 208 203 /** this slug is unique we can quit the theme suffix */ 209 $theme_types[ $current_theme ]['taxonomies'][ $key ][ "rewrite"]["slug"] = $testable_slug;204 $theme_types[ $current_theme ]['taxonomies'][ $key ]['rewrite']['slug'] = $testable_slug; 210 205 } 211 206 } … … 218 213 update_option( $config['settings-key'], $types_settings ); 219 214 220 // flush_rewrite_rules();221 // global $wp_rewrite;222 // $wp_rewrite->generate_rewrite_rules();223 // flush_rewrite_rules();224 225 215 /** 226 216 * http://wordpress.stackexchange.com/questions/36152/flush-rewrite-rules-not-working-on-plugin-deactivation-invalid-urls-not-showing 227 * nothing from above works in plugin so ...217 * nothing from above works in plugins so ... 228 218 */ 229 219 delete_option( 'rewrite_rules' ); … … 299 289 300 290 /** 301 * Register and enqueue public-facing style sheet.302 *303 * @since 1.0.0304 */305 function enqueue_styles() {306 wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'css/public.css', __FILE__ ), array(), $this->version );307 }308 309 /**310 * Register and enqueues public-facing JavaScript files.311 *312 * @since 1.0.0313 */314 public function enqueue_scripts() {315 wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'js/public.js', __FILE__ ), array( 'jquery' ), $this->version );316 }317 318 /**319 291 * Register the administration menu for this plugin into the WordPress Dashboard menu. 320 292 */ … … 322 294 323 295 $this->plugin_screen_hook_suffix = add_options_page( 324 esc_html__( 'PixTypes', $this->plugin_slug),325 esc_html__( 'PixTypes', $this->plugin_slug),296 esc_html__( 'PixTypes', 'pixtypes' ), 297 esc_html__( 'PixTypes', 'pixtypes' ), 326 298 'manage_options', 327 299 $this->plugin_slug, … … 342 314 */ 343 315 function add_action_links( $links ) { 344 return array_merge( array( 'settings' => '<a href="' . admin_url( 'options-general.php?page=pixtypes' ) . '">' . esc_html__( 'Settings', $this->plugin_slug) . '</a>' ), $links );316 return array_merge( array( 'settings' => '<a href="' . admin_url( 'options-general.php?page=pixtypes' ) . '">' . esc_html__( 'Settings', 'pixtypes' ) . '</a>' ), $links ); 345 317 } 346 318 347 319 function register_entities() { 348 require_once( $this->plugin_basepath . 'features/custom-entities.php' ); 320 // register post types 321 $options = $updated_options = apply_filters( 'pixtypes_settings_pre_register_entitites', get_option( 'pixtypes_settings' ) ); 322 $updated_options['display_settings'] = false; 323 324 // go through each theme and activate portfolio post types 325 if ( empty( $options['themes'] ) || ! array( $options['themes'] ) ) { 326 return; 327 } 328 329 /** A pixelgrade theme will always have this class so we know we can import new settings **/ 330 $current_theme = false; 331 if ( class_exists( 'wpgrade' ) ) { 332 $current_theme = wpgrade::shortname(); 333 } 334 335 $theme_types = $options['themes']; 336 foreach ( $theme_types as $key => $theme ) { 337 // post types 338 if ( isset( $theme['post_types'] ) && is_array( $theme['post_types'] ) ) { 339 // Remember what post types we have removed from settings so we can skip registering their taxonomies 340 $deleted_post_types = array(); 341 foreach ( $theme['post_types'] as $post_type => $post_type_args ) { 342 // First check if the post type is already registered - we bail if that is the case 343 if ( post_type_exists( $post_type ) ) { 344 continue; 345 } 346 347 // Second, for post types not belonging to the current theme, we only register them if there are posts 348 if ( false !== $current_theme && $key != $current_theme ) { 349 // We get the posts to see if there are any - we include all post statuses (trash and auto-draft need to be specified directly) 350 $posts = get_posts( array( 'post_type' => $post_type, 'post_status' => array( 'any', 'trash', 'auto-draft' ), 'posts_per_page' => '1' ) ); 351 if ( empty( $posts ) ) { 352 // We should also delete the post type from the settings - no worries; if the theme gets activated again, all this will come back 353 // This is just for auto-cleanup 354 unset( $updated_options['themes'][ $key ]['post_types'][ $post_type ] ); 355 $deleted_post_types[] = $post_type; 356 continue; 357 } 358 } 359 360 $is_jetpack_compatible = false; 361 if ( strpos( $post_type, 'jetpack' ) !== false ) { 362 ///$xxxx = str_replace( 'jetpack-', '', $post_type); 363 $is_jetpack_compatible = true; 364 } 365 366 if ( $is_jetpack_compatible ) { 367 $post_type_key = strstr( $post_type, '-' ); 368 $post_type_key = substr( $post_type_key, 1 ); 369 } else { 370 // eliminate the theme prefix 371 $post_type_key = strstr( $post_type, '_' ); 372 $post_type_key = substr( $post_type_key, 1 ); 373 } 374 375 // process menu icon if it exists 376 if ( isset( $post_type_args['menu_icon'] ) ) { 377 // If we have been given a dashicon or full URL, use it without processing 378 if ( false === strpos( $post_type_args['menu_icon'], 'dashicon' ) && false === filter_var( $post_type_args['menu_icon'], FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED ) ) { 379 $post_type_args['menu_icon'] = plugins_url( 'assets/' . $post_type_args['menu_icon'], __FILE__ ); 380 } 381 } 382 383 if ( isset( $options[ 'enable_' . $post_type_key ] ) ) { 384 $updated_options['display_settings'] = true; 385 if ( $options[ 'enable_' . $post_type_key ] ) { 386 register_post_type( $post_type, $post_type_args ); 387 } 388 } 389 } 390 } 391 392 // taxonomies 393 if ( isset( $theme['taxonomies'] ) && is_array( $theme['taxonomies'] ) ) { 394 foreach ( $theme['taxonomies'] as $tax => $tax_args ) { 395 // First check if the taxonomy is already registered - we bail if that is the case 396 if ( taxonomy_exists( $tax ) ) { 397 continue; 398 } 399 400 // If we have deleted post types settings we need to skip registering their taxonomies 401 if ( ! empty( $tax_args['post_types'] ) && ! empty( $deleted_post_types ) ) { 402 if ( ! is_array( $tax_args['post_types'] ) ) { 403 if ( in_array( $tax_args['post_types'], $deleted_post_types ) ) { 404 continue; 405 } 406 } else { 407 $temp = array_diff( $tax_args['post_types'], $deleted_post_types ); 408 if ( empty( $temp ) ) { 409 continue; 410 } 411 } 412 } 413 414 $tax_post_types = $tax_args['post_types']; 415 // remove "post_types", isn't a register_taxonomy argument we are just using it for post type linking 416 unset( $tax_args['post_types'] ); 417 418 $is_jetpack_compatible = false; 419 if ( strpos( $tax, 'jetpack' ) !== false ) { 420 ///$xxxx = str_replace( 'jetpack-', '', $tax); 421 $is_jetpack_compatible = true; 422 } 423 424 if ( $is_jetpack_compatible ) { 425 $tax_key = strstr( $tax, '-' ); 426 $tax_key = substr( $tax_key, 1 ); 427 } else { 428 // eliminate the theme prefix 429 $tax_key = strstr( $tax, '_' ); 430 $tax_key = substr( $tax_key, 1 ); 431 } 432 433 if ( isset( $options[ 'enable_' . $tax_key ] ) ) { 434 $updated_options['display_settings'] = true; 435 if ( $options[ 'enable_' . $tax_key ] ) { 436 register_taxonomy( $tax, $tax_post_types, $tax_args ); 437 } 438 } 439 } 440 } 441 } 442 443 // Only update if we have actually changed something 444 if ( $options != $updated_options ) { 445 update_option( 'pixtypes_settings', $updated_options ); 446 } 349 447 } 350 448 … … 369 467 $rewrite = $post_type->rewrite; 370 468 /** if this post_type has a rewrite rule check for it */ 371 if ( ! empty( $rewrite ) && isset( $rewrite[ "slug"] ) && $slug == $rewrite["slug"] ) {469 if ( ! empty( $rewrite ) && isset( $rewrite['slug'] ) && $slug == $rewrite['slug'] ) { 372 470 $is_unique = false; 373 471 } elseif ( $slug == $key ) { … … 388 486 */ 389 487 static function is_tax_slug_unique( $slug ) { 390 391 488 global $wp_taxonomies; 489 490 /** Suppose it's true */ 392 491 $is_unique = true; 393 /** Suppose it's true */394 492 395 493 foreach ( $wp_taxonomies as $key => $tax ) { 396 494 $rewrite = $tax->rewrite; 397 495 /** if this post_type has a rewrite rule check for it */ 398 if ( ! empty( $rewrite ) && isset( $rewrite[ "slug"] ) && $slug == $rewrite["slug"] ) {496 if ( ! empty( $rewrite ) && isset( $rewrite['slug'] ) && $slug == $rewrite['slug'] ) { 399 497 $is_unique = false; 400 498 } elseif ( $slug == $key ) { … … 433 531 ), 434 532 'has_archive' => 'portfolio-archive', 435 'menu_icon' => plugins_url( 'assets/report.png', __FILE__ ),533 'menu_icon' => 'dashicons-portfolio', 436 534 'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'excerpt' ), 437 535 'yarpp_support' => true, … … 459 557 'has_archive' => 'galleries-archive', 460 558 'menu_position' => null, 559 'menu_icon' => 'dashicons-format-gallery', 461 560 'supports' => array( 'title', 'thumbnail', 'page-attributes', 'excerpt' ), 462 561 'yarpp_support' => true, … … 546 645 547 646 /** 548 * Ajax callback for unseting unneeded post types647 * Ajax callback for cleaning up the settings for a theme 549 648 */ 550 649 function ajax_unset_pixtypes() { … … 555 654 } 556 655 557 if ( isset( $_POST[' post_type'] ) ) {558 $key = $_POST[' post_type'];656 if ( isset( $_POST['theme_slug'] ) ) { 657 $key = $_POST['theme_slug']; 559 658 $options = get_option( 'pixtypes_settings' ); 560 659 if ( isset( $options['themes'][ $key ] ) ) { 561 660 unset( $options['themes'][ $key ] ); 562 661 update_option( 'pixtypes_settings', $options ); 563 $result['msg'] = ' Post type ' . $key . ' is gone.';662 $result['msg'] = 'Settings for ' . ucfirst( $key ) . ' have been cleaned up!'; 564 663 $result['success'] = true; 565 664 } … … 574 673 */ 575 674 function theme_version_check() { 576 577 $options = get_option( 'pixtypes_settings' ); 578 579 if ( class_exists( 'wpgrade' ) && isset( $options['wpgrade_theme_version'] ) ) { 580 581 if ( wpgrade::themeversion() != $options['wpgrade_theme_version'] ) { 675 if ( class_exists( 'wpgrade' ) ) { 676 // Each theme should have it's pixtypes config theme version saved 677 $options = get_option( 'pixtypes_settings' ); 678 679 // Make sure that we fix things just in case 680 if ( ! isset( $options['wpgrade_theme_version'] ) ) { 681 $options['wpgrade_theme_version'] = '0.0.1'; 682 } 683 684 if ( version_compare( wpgrade::themeversion(), $options['wpgrade_theme_version'], '!=' ) ) { 582 685 // here the theme is updating it's options 583 $test = function_exists( 'wpgrade_callback_geting_active' ); 584 585 wpgrade_callback_geting_active(); 586 // the plugin will copy these options into it's own field 587 self::activate( false ); 588 // end finally merge user's settings with the theme ones 589 save_pixtypes_settings( $options ); 590 686 if ( function_exists( 'wpgrade_callback_geting_active' ) ) { 687 wpgrade_callback_geting_active(); 688 // the plugin will copy these options into it's own field 689 self::activate( false ); 690 // end finally merge user's settings with the theme ones 691 save_pixtypes_settings( $options ); 692 } 591 693 } 592 694 } -
pixtypes/trunk/core/classes/HTMLElement.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/classes/HTMLTag.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/classes/Meta.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/classes/Processor.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/classes/Validator.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/classes/forms/Form.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/classes/forms/FormField.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/defaults.php
r1591155 r1744797 28 28 'errors' => array 29 29 ( 30 'is_numeric' => esc_html__('Numberic value required.', pixtypes::textdomain()),31 'not_empty' => esc_html__('Field is required.', pixtypes::textdomain()),30 'is_numeric' => esc_html__('Numberic value required.', 'pixtypes' ), 31 'not_empty' => esc_html__('Field is required.', 'pixtypes' ), 32 32 ), 33 33 -
pixtypes/trunk/core/interfaces/HTMLElement.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/interfaces/HTMLTag.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/interfaces/Meta.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/interfaces/Processor.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/interfaces/Validator.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/interfaces/extended/Form.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/core/interfaces/extended/FormField.php
r1115891 r1744797 1 1 <?php defined('ABSPATH') or die; 2 3 /* This file is property of Pixel Grade Media. You may NOT copy, or redistribute4 * it. Please see the license that came with your copy for more information.5 */6 2 7 3 /** -
pixtypes/trunk/features/metaboxes/init.php
r1591646 r1744797 1012 1012 // validate meta value 1013 1013 if ( isset( $field['validate_func'] ) ) { 1014 $ok = call_user_func( array( 'cmb_Meta_Box_Validate', $field['validate_func'] ), $new);1014 $ok = call_user_func( $field['validate_func'], $new, $field, $post_id ); 1015 1015 if ( $ok === false ) { // pass away when meta value is invalid 1016 1016 continue; -
pixtypes/trunk/features/metaboxes/metaboxes.php
r1728763 r1744797 53 53 54 54 require_once 'cmb-field-select2/cmb-field-select2.php'; 55 require_once 'cmb-field-select2-v2/cmb-field-select2.php'; 55 56 } 56 57 -
pixtypes/trunk/js/admin.js
r1115891 r1744797 61 61 /** ajax callbacks */ 62 62 $('#unset_pixypes').on('click', 'button', function(e){ 63 var response = confirm(' Be sure that you don\'t need this post type anymore');63 var response = confirm('Make sure that you have moved the theme specific content you were interested in. If at any time you wish to access it again, reactivate that previous theme.'); 64 64 65 65 if ( response == false ) { … … 69 69 70 70 var ajax_nounce = $(this).parents('ul').siblings('.unset_nonce').val(); 71 // reload likes number71 // Cleanup pixtypes settings 72 72 jQuery.ajax({ 73 type: "post",url: locals.ajax_url,data: { action: 'unset_pixtypes', _ajax_nonce: ajax_nounce, post_type: $(this).val() },73 type: "post",url: locals.ajax_url,data: { action: 'unset_pixtypes', _ajax_nonce: ajax_nounce, theme_slug: $(this).val() }, 74 74 //beforeSend: function() {jQuery("#loading").show("slow");}, //show loading just when link is clicked 75 75 //complete: function() { jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete -
pixtypes/trunk/pixtypes.php
r1728763 r1744797 1 1 <?php 2 2 /* 3 * @package PixTypes 4 * @author Pixelgrade <[email protected]> 5 * @license GPL-2.0+ 6 * @link https://pixelgrade.com 7 * @copyright 2013-2017 Pixelgrade 8 * 9 * @wordpress-plugin 10 Plugin Name: PixTypes 11 Plugin URI: https://pixelgrade.com 12 Description: Custom post types and meta-boxes needed by your theme 13 Version: 1.4.7 14 Author: Pixelgrade 15 Author URI: https://pixelgrade.com 16 Author Email: [email protected] 17 Text Domain: pixtypes 18 License: GPL-2.0+ 19 License URI: http://www.gnu.org/licenses/gpl-2.0.txt 20 Domain Path: /lang 21 */ 3 * Plugin Name: PixTypes 4 * Plugin URI: https://wordpress.org/plugins/pixtypes/ 5 * Description: Custom post types and meta-boxes needed by your themes. 6 * Version: 1.4.8 7 * Author URI: https://pixelgrade.com 8 * Author Email: [email protected] 9 * License: GPL2+ 10 * Text Domain: pixtypes 11 * Domain Path: /lang/ 12 */ 22 13 23 14 // If this file is called directly, abort. … … 34 25 35 26 $config = include 'plugin-config' . EXT; 36 include 'features/class-pix-query' . EXT;37 27 // set textdomain 38 28 pixtypes::settextdomain( $config['textdomain'] ); … … 56 46 // -------------- 57 47 58 $basepath = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;59 $callbackpath = $basepath . 'callbacks' . DIRECTORY_SEPARATOR;48 $basepath = trailingslashit( dirname( __FILE__ ) ); 49 $callbackpath = trailingslashit( $basepath . 'callbacks' ); 60 50 pixtypes::require_all( $callbackpath ); 61 51 … … 67 57 68 58 global $pixtypes_plugin; 69 $pixtypes_plugin = PixTypesPlugin::get_instance( );59 $pixtypes_plugin = PixTypesPlugin::get_instance( '1.4.8' ); -
pixtypes/trunk/settings/post_types.php
r1591155 r1744797 7 7 8 8 $options = get_option( 'pixtypes_settings' ); 9 // go through each theme and activate portfolio post types10 if ( isset( $options[ "themes"] ) ) {11 $theme_types = $options[ "themes"];9 // go through each theme and activate the post types settings 10 if ( isset( $options['themes'] ) ) { 11 $theme_types = $options['themes']; 12 12 foreach ( $theme_types as $key => $theme ) { 13 13 … … 23 23 } 24 24 $display_settings = true; 25 } else {26 return array( 'type' => 'hidden' );27 25 } 28 26 } 27 } 28 29 // Check if we have any post type that should be shown settings 30 $hide = true; 31 foreach ( $display_option as $post_type => $display ) { 32 if ( $display ) { 33 $hide = false; 34 break; 35 } 36 } 37 38 if ( $hide ) { 39 return array( 'type' => 'hidden' ); 29 40 } 30 41 -
pixtypes/trunk/views/admin.php
r1591155 r1744797 43 43 <?php endif; ?> 44 44 45 <?php echo $f = pixtypes::form( $config, $processor ); 46 echo $f->field( 'hiddens' )->render(); ?> 45 <?php 46 $f = pixtypes::form( $config, $processor ); ?> 47 48 <?php echo $f->startform() ?> 49 50 <?php echo $f->field( 'hiddens' )->render(); ?> 47 51 48 52 <?php echo $f->field( 'post_types' )->render(); ?> … … 70 74 71 75 <div class="handlediv" title="Click to toggle"><br></div> 72 <h3 class="hndle"><span><?php esc_html_e( ' DangerZone', 'pixtypes' ); ?></span></h3>76 <h3 class="hndle"><span><?php esc_html_e( 'Extra Careful Zone', 'pixtypes' ); ?></span></h3> 73 77 74 78 <div class="inside"> 75 79 76 <p><?php esc_html_e( 'If you are done with copying your content from old post types to new ones, you can also get rid of the old post types.', 'pixtypes' ); ?></p>80 <p><?php esc_html_e( 'If you are done with copying your content from old themes to new ones, you can also get rid of the old themes settings and post types.', 'pixtypes' ); ?></p> 77 81 <form method="post" id="unset_pixypes" 78 82 action="<?php echo admin_url( 'options-general.php?page=pixtypes' ) ?>"> … … 83 87 if ( isset( $options['themes'] ) && count( $options['themes'] ) > 1 ) { 84 88 foreach ( $options['themes'] as $key => $theme ) { 85 echo '<li><button class="button delete-action" type="submit" name="unset_pixtype" value="' . $key . '">' . esc_html__( ' Unset', 'pixtypes' ) . ' ' . $key. '</button></li>';89 echo '<li><button class="button delete-action" type="submit" name="unset_pixtype" value="' . $key . '">' . esc_html__( 'Clean-up after', 'pixtypes' ) . ' ' . ucfirst( $key ) . '</button></li>'; 86 90 } 87 91 } ?>
Note: See TracChangeset
for help on using the changeset viewer.