Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Updating to version 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bamadesigner committed Jan 13, 2015
1 parent d326c94 commit 52fcd5e
Show file tree
Hide file tree
Showing 22 changed files with 1,557 additions and 1,280 deletions.
1,473 changes: 769 additions & 704 deletions admin-settings.php

Large diffs are not rendered by default.

106 changes: 57 additions & 49 deletions admin.php
100755 → 100644

Large diffs are not rendered by default.

71 changes: 41 additions & 30 deletions cpt-onomies.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
<?php

/*
Plugin Name: CPT-onomies: Using Custom Post Types as Taxonomies
Plugin URI: http://wordpress.org/plugins/cpt-onomies/
Description: A CPT-onomy is a taxonomy built from a custom post type, using the post titles as the taxonomy terms. Create custom post types using the CPT-onomies custom post type manager or use post types created by themes or other plugins.
Version: 1.3.1
Author: Rachel Carden
Author URI: http://wpdreamer.com
Text Domain: cpt-onomies
*/

/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

/**
* Plugin Name: CPT-onomies: Using Custom Post Types as Taxonomies
* Plugin URI: http://wordpress.org/plugins/cpt-onomies/
* Description: A CPT-onomy is a taxonomy built from a custom post type, using the post titles as the taxonomy terms. Create custom post types using the CPT-onomies custom post type manager or use post types created by themes or other plugins.
* Version: 1.3.2
* Author: Rachel Carden
* Author URI: http://wpdreamer.com
* Text Domain: cpt-onomies
*/

/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License or later.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Visit http://www.fsf.org to read the GNU General Public License or
* to learn more about the Free Software Foundation.
*/

// let's define some stuff. maybe we'll use it later
define( 'CPT_ONOMIES_VERSION', '1.3.1' );
define( 'CPT_ONOMIES_VERSION', '1.3.2' );
define( 'CPT_ONOMIES_WORDPRESS_MIN', '3.1' );
define( 'CPT_ONOMIES_DIR', dirname( __FILE__ ) );
define( 'CPT_ONOMIES_URL', plugin_dir_url( __FILE__ ) );
define( 'CPT_ONOMIES_PLUGIN_NAME', 'CPT-onomies: Using Custom Post Types as Taxonomies' );
define( 'CPT_ONOMIES_PLUGIN_SHORT_NAME', 'CPT-onomies' );
define( 'CPT_ONOMIES_PLUGIN_DIRECTORY_URL', 'http://wordpress.org/extend/plugins/cpt-onomies/' );
Expand All @@ -55,13 +53,26 @@
// for translations
add_action( 'plugins_loaded', 'custom_post_type_onomies_load_textdomain' );
function custom_post_type_onomies_load_textdomain() {
load_plugin_textdomain( CPT_ONOMIES_TEXTDOMAIN, false, trailingslashit( CPT_ONOMIES_URL . 'languages' ) );
load_plugin_textdomain( CPT_ONOMIES_TEXTDOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}

// for the newbies
// runs when you activate the plugin
register_activation_hook( __FILE__, 'custom_post_type_onomies_activation_hook' );
function custom_post_type_onomies_activation_hook( $network_wide ) {

// rewrite rules can be a pain in the ass
// so let's flush them out and start fresh
flush_rewrite_rules( false );

}

?>
// runs when you upgrade anything
add_action( 'upgrader_process_complete', 'custom_post_type_onomies_upgrader_process_complete', 1, 2 );
function custom_post_type_onomies_upgrader_process_complete( $upgrader, $upgrade_info ) {

// for some reason I find myself having to flush my
// rewrite rules whenever I upgrade WordPress so just
// helping everyone out by taking care of this automatically
flush_rewrite_rules( false );

}
10 changes: 4 additions & 6 deletions cpt-onomy.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,14 @@ public function get_term_link( $term, $taxonomy ) {
if ( ! $cpt_onomies_manager->is_registered_cpt_onomy( $taxonomy ) )
return get_term_link( $term, $taxonomy );

if ( !is_object( $term ) ) {
if ( ! is_object( $term ) ) {
if ( is_int( $term ) )
$term = $this->get_term( $term, $taxonomy );
else
$term = $this->get_term_by( 'slug', $term, $taxonomy );
}

if ( !is_object( $term ) )
if ( ! is_object( $term ) )
$term = new WP_Error( 'invalid_term', __( 'Empty Term', CPT_ONOMIES_TEXTDOMAIN ) );

if ( is_wp_error( $term ) )
Expand Down Expand Up @@ -1806,7 +1806,7 @@ public function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = fa

foreach ( (array) $terms as $term ) {

if ( !strlen( trim( $term ) ) )
if ( ! strlen( trim( $term ) ) )
continue;

if ( is_numeric( $term ) ) $term = (int) $term;
Expand Down Expand Up @@ -2052,6 +2052,4 @@ function cpt_onomies_sort_cpt_onomy_term_by_slug( $a, $b ) {
if ( strtolower( $a->slug ) == strtolower( $b->slug ) )
return 0;
return ( strtolower( $a->slug ) < strtolower( $b->slug ) ) ? -1 : 1;
}

?>
}
Loading

0 comments on commit 52fcd5e

Please sign in to comment.