Skip to content

Commit

Permalink
Fixed internal PodsUI callback issues in custom actions used by Pods
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Oct 1, 2013
1 parent 0175694 commit b5bd769
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions classes/Pods.php
Expand Up @@ -599,8 +599,8 @@ public function raw ( $name, $single = null ) {
* This function will return arrays for relationship and file fields. * This function will return arrays for relationship and file fields.
* *
* @param string|array $name The field name, or an associative array of parameters * @param string|array $name The field name, or an associative array of parameters
* @param boolean $single (optional) For tableless fields, to return the whole array or the just the first item * @param boolean $single (optional) For tableless fields, to return the whole array or the just the first item, or an associative array of parameters
* @param boolean $raw (optional) Whether to return the raw value, or to run through the field type's display method * @param boolean $raw (optional) Whether to return the raw value, or to run through the field type's display method, or an associative array of parameters
* *
* @return mixed|null Value returned depends on the field type, null if the field doesn't exist, false if no value returned for tableless fields * @return mixed|null Value returned depends on the field type, null if the field doesn't exist, false if no value returned for tableless fields
* @since 2.0 * @since 2.0
Expand Down Expand Up @@ -632,6 +632,10 @@ public function field ( $name, $single = null, $raw = false ) {
$defaults[ 'single' ] = null; $defaults[ 'single' ] = null;
$params = (object) array_merge( $defaults, (array) $single ); $params = (object) array_merge( $defaults, (array) $single );
} }
elseif ( is_array( $raw ) || is_object( $raw ) ) {
$defaults[ 'raw' ] = false;
$params = (object) array_merge( $defaults, (array) $raw );
}
else else
$params = (object) $defaults; $params = (object) $defaults;


Expand Down
6 changes: 3 additions & 3 deletions classes/PodsAdmin.php
Expand Up @@ -1588,7 +1588,7 @@ public function admin_setup_edit_field_options ( $pod ) {
* *
* @return mixed * @return mixed
*/ */
public function admin_setup_duplicate ( &$obj ) { public function admin_setup_duplicate ( $obj ) {
$new_id = pods_api()->duplicate_pod( array( 'id' => $obj->id ) ); $new_id = pods_api()->duplicate_pod( array( 'id' => $obj->id ) );


if ( 0 < $new_id ) if ( 0 < $new_id )
Expand All @@ -1603,7 +1603,7 @@ public function admin_setup_duplicate ( &$obj ) {
* *
* @return mixed * @return mixed
*/ */
public function admin_setup_reset ( &$obj, $id ) { public function admin_setup_reset ( $id, $obj ) {
$pod = pods_api()->load_pod( array( 'id' => $id ), false ); $pod = pods_api()->load_pod( array( 'id' => $id ), false );


if ( empty( $pod ) ) if ( empty( $pod ) )
Expand All @@ -1624,7 +1624,7 @@ public function admin_setup_reset ( &$obj, $id ) {
* *
* @return mixed * @return mixed
*/ */
public function admin_setup_delete ( $id, &$obj ) { public function admin_setup_delete ( $id, $obj ) {
$pod = pods_api()->load_pod( array( 'id' => $id ), false ); $pod = pods_api()->load_pod( array( 'id' => $id ), false );


if ( empty( $pod ) ) if ( empty( $pod ) )
Expand Down
2 changes: 1 addition & 1 deletion classes/PodsUI.php
Expand Up @@ -438,7 +438,7 @@ public function __construct ( $options, $deprecated = false ) {
} }


if ( is_object( $object ) && ( 'Pods' == get_class( $object ) || 'Pod' == get_class( $object ) ) ) if ( is_object( $object ) && ( 'Pods' == get_class( $object ) || 'Pod' == get_class( $object ) ) )
$this->pod = &$object; $this->pod =& $object;
} }


if ( !is_array( $options ) ) { if ( !is_array( $options ) ) {
Expand Down
2 changes: 1 addition & 1 deletion components/Roles/Roles.php
Expand Up @@ -170,7 +170,7 @@ function admin_edit ( $duplicate, $obj ) {
pods_view( PODS_DIR . 'components/Roles/ui/edit.php', compact( array_keys( get_defined_vars() ) ) ); pods_view( PODS_DIR . 'components/Roles/ui/edit.php', compact( array_keys( get_defined_vars() ) ) );
} }


function admin_delete ( $id, &$obj ) { function admin_delete ( $id, $obj ) {
global $wp_roles; global $wp_roles;


$id = $obj->id; $id = $obj->id;
Expand Down
2 changes: 1 addition & 1 deletion deprecated/classes/Pods.php
Expand Up @@ -21,7 +21,7 @@ class Pods_Deprecated
* @license http://www.gnu.org/licenses/gpl-2.0.html * @license http://www.gnu.org/licenses/gpl-2.0.html
* @since 2.0 * @since 2.0
*/ */
public function __construct ( &$obj ) { public function __construct ( $obj ) {
// backwards-compatibility with references to $this->var_name // backwards-compatibility with references to $this->var_name
$vars = get_object_vars( $obj ); $vars = get_object_vars( $obj );


Expand Down
2 changes: 1 addition & 1 deletion deprecated/classes/PodsAPI.php
Expand Up @@ -24,7 +24,7 @@ class PodsAPI_Deprecated {
* @license http://www.gnu.org/licenses/gpl-2.0.html * @license http://www.gnu.org/licenses/gpl-2.0.html
* @since 2.0 * @since 2.0
*/ */
public function __construct ( &$obj ) { public function __construct ( $obj ) {
// backwards-compatibility with references to $this->var_name // backwards-compatibility with references to $this->var_name
$vars = get_object_vars( $obj ); $vars = get_object_vars( $obj );


Expand Down
2 changes: 1 addition & 1 deletion includes/general.php
Expand Up @@ -57,7 +57,7 @@ function pods_query ( $sql, $error = 'Database Error', $results_error = null, $n
* @since 2.0 * @since 2.0
* @todo Need to figure out how to handle $scope = 'pods' for the Pods class * @todo Need to figure out how to handle $scope = 'pods' for the Pods class
*/ */
function pods_do_hook ( $scope, $name, $args = null, &$obj = null ) { function pods_do_hook ( $scope, $name, $args = null, $obj = null ) {
// Add filter name // Add filter name
array_unshift( $args, "pods_{$scope}_{$name}" ); array_unshift( $args, "pods_{$scope}_{$name}" );


Expand Down

0 comments on commit b5bd769

Please sign in to comment.