|
@@ 1297-1335 (lines=39) @@
|
| 1294 |
|
$posts = $method( $args ); |
| 1295 |
|
} |
| 1296 |
|
|
| 1297 |
|
if ( isset( $posts ) && isset( $posts[0]->{$id_field} ) ) { |
| 1298 |
|
// Post does exist after checking the matching value. We want its id. |
| 1299 |
|
$post_id = $posts[0]->{$id_field}; |
| 1300 |
|
|
| 1301 |
|
if ( true === $check_only ) { |
| 1302 |
|
// We are just checking to see if there is a match. |
| 1303 |
|
return $post_id; |
| 1304 |
|
} |
| 1305 |
|
|
| 1306 |
|
// On the prematch fields, we specify the method_update param. |
| 1307 |
|
if ( isset( $methods['method_update'] ) ) { |
| 1308 |
|
$method = $methods['method_update']; |
| 1309 |
|
} else { |
| 1310 |
|
$method = $methods['method_modify']; |
| 1311 |
|
} |
| 1312 |
|
$params[ $key ] = array( |
| 1313 |
|
'value' => $value, |
| 1314 |
|
'method_modify' => $method, |
| 1315 |
|
'method_read' => $methods['method_read'], |
| 1316 |
|
); |
| 1317 |
|
} elseif ( false === $check_only ) { |
| 1318 |
|
// Post does not exist after checking the matching value. create it. |
| 1319 |
|
// On the prematch fields, we specify the method_create param. |
| 1320 |
|
if ( isset( $methods['method_create'] ) ) { |
| 1321 |
|
$method = $methods['method_create']; |
| 1322 |
|
} else { |
| 1323 |
|
$method = $methods['method_modify']; |
| 1324 |
|
} |
| 1325 |
|
$params[ $key ] = array( |
| 1326 |
|
'value' => $value, |
| 1327 |
|
'method_modify' => $method, |
| 1328 |
|
'method_read' => $methods['method_read'], |
| 1329 |
|
); |
| 1330 |
|
$result = $this->post_create( $params, $id_field, $post_type ); |
| 1331 |
|
return $result; |
| 1332 |
|
} else { |
| 1333 |
|
// Check only is true but there's not a post yet. |
| 1334 |
|
return null; |
| 1335 |
|
} // End if(). |
| 1336 |
|
} else { |
| 1337 |
|
// There is no method by which to check the post. we can check other ways here. |
| 1338 |
|
$params[ $key ] = array( |
|
@@ 1617-1655 (lines=39) @@
|
| 1614 |
|
$posts = $method( $args ); |
| 1615 |
|
} |
| 1616 |
|
|
| 1617 |
|
if ( isset( $posts ) && isset( $posts[0]->{$id_field} ) ) { |
| 1618 |
|
// Attachment does exist after checking the matching value. we want its id. |
| 1619 |
|
$attachment_id = $posts[0]->{$id_field}; |
| 1620 |
|
|
| 1621 |
|
if ( true === $check_only ) { |
| 1622 |
|
// We are just checking to see if there is a match. |
| 1623 |
|
return $attachment_id; |
| 1624 |
|
} |
| 1625 |
|
|
| 1626 |
|
// On the prematch fields, we specify the method_update param. |
| 1627 |
|
if ( isset( $methods['method_update'] ) ) { |
| 1628 |
|
$method = $methods['method_update']; |
| 1629 |
|
} else { |
| 1630 |
|
$method = $methods['method_modify']; |
| 1631 |
|
} |
| 1632 |
|
$params[ $key ] = array( |
| 1633 |
|
'value' => $value, |
| 1634 |
|
'method_modify' => $method, |
| 1635 |
|
'method_read' => $methods['method_read'], |
| 1636 |
|
); |
| 1637 |
|
} elseif ( false === $check_only ) { |
| 1638 |
|
// Attachment does not exist after checking the matching value. create it. |
| 1639 |
|
// On the prematch fields, we specify the method_create param. |
| 1640 |
|
if ( isset( $methods['method_create'] ) ) { |
| 1641 |
|
$method = $methods['method_create']; |
| 1642 |
|
} else { |
| 1643 |
|
$method = $methods['method_modify']; |
| 1644 |
|
} |
| 1645 |
|
$params[ $key ] = array( |
| 1646 |
|
'value' => $value, |
| 1647 |
|
'method_modify' => $method, |
| 1648 |
|
'method_read' => $methods['method_read'], |
| 1649 |
|
); |
| 1650 |
|
$result = $this->attachment_create( $params ); |
| 1651 |
|
return $result; |
| 1652 |
|
} else { |
| 1653 |
|
// Check only is true but there's not an attachment yet. |
| 1654 |
|
return null; |
| 1655 |
|
} // End if(). |
| 1656 |
|
} else { |
| 1657 |
|
// There is no method by which to check the post. we can check other ways here. |
| 1658 |
|
$params[ $key ] = array( |
|
@@ 1960-1998 (lines=39) @@
|
| 1957 |
|
$term = $method( $key, $value, $taxonomy ); // We need to put the taxonomy in there probably. |
| 1958 |
|
} |
| 1959 |
|
|
| 1960 |
|
if ( isset( $term ) && isset( $term->{$id_field} ) ) { |
| 1961 |
|
// Term does exist after checking the matching value. we want its id. |
| 1962 |
|
$term_id = $term->{$id_field}; |
| 1963 |
|
|
| 1964 |
|
if ( true === $check_only ) { |
| 1965 |
|
// We are just checking to see if there is a match. |
| 1966 |
|
return $term_id; |
| 1967 |
|
} |
| 1968 |
|
|
| 1969 |
|
// On the prematch fields, we specify the method_update param. |
| 1970 |
|
if ( isset( $methods['method_update'] ) ) { |
| 1971 |
|
$method = $methods['method_update']; |
| 1972 |
|
} else { |
| 1973 |
|
$method = $methods['method_modify']; |
| 1974 |
|
} |
| 1975 |
|
$params[ $key ] = array( |
| 1976 |
|
'value' => $value, |
| 1977 |
|
'method_modify' => $method, |
| 1978 |
|
'method_read' => $methods['method_read'], |
| 1979 |
|
); |
| 1980 |
|
} elseif ( false === $check_only ) { |
| 1981 |
|
// Term does not exist after checking the matching value. Create it. |
| 1982 |
|
// On the prematch fields, we specify the method_create param. |
| 1983 |
|
if ( isset( $methods['method_create'] ) ) { |
| 1984 |
|
$method = $methods['method_create']; |
| 1985 |
|
} else { |
| 1986 |
|
$method = $methods['method_modify']; |
| 1987 |
|
} |
| 1988 |
|
$params[ $key ] = array( |
| 1989 |
|
'value' => $value, |
| 1990 |
|
'method_modify' => $method, |
| 1991 |
|
'method_read' => $methods['method_read'], |
| 1992 |
|
); |
| 1993 |
|
$result = $this->term_create( $params, $taxonomy, $id_field ); |
| 1994 |
|
return $result; |
| 1995 |
|
} else { |
| 1996 |
|
// Check only is true but there's not a term yet. |
| 1997 |
|
return null; |
| 1998 |
|
} // End if(). |
| 1999 |
|
} else { |
| 2000 |
|
// There is no method by which to check the term. we can check other ways here. |
| 2001 |
|
$params[ $key ] = array( |