Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed collision function by adding acf_ prefix to get_field to avoid the conflict with other plugins' function #6

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.editorconfig
**/.DS_STORE
.remote-sync.json
26 changes: 18 additions & 8 deletions css/feature-box.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
color: #f0f0f0;
position: relative;
padding: 0;
min-height: 350px;
min-height: 150px;
margin-bottom: 15px;
}
blockquote .wp-feature-box {
margin-bottom: 15px
}

.wp-feature-box .wp-feature-box-container {
padding: 5%;
padding: 2%;
display: inline-block;
width: 100%;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
-khtml-box-sizing: border-box;
-moz-box-sizing: border-box;
margin-top: 20px;
}

.wp-feature-box-slider-content {
Expand Down Expand Up @@ -66,7 +70,11 @@

.wp-feature-box .wp-feature-box-header {
text-align: center;
margin: 0 auto 40px;
margin: 0 auto 10px;
}

.wp-feature-box-header blockquote {
padding: 15px 15px;
}

.wp-feature-box .wp-feature-box-header h2 {
Expand All @@ -82,9 +90,11 @@
.wp-feature-box .wp-feature-box-header p {
text-shadow: 1px 0 0 rgba(0,0,0,0.6);
max-width: 600px;
margin: 0 auto 20px;
margin: 0 auto 0;
}
.wp-feature-box .wp-feature-box-header strong {
color: #f0f0f0;
}

.wp-feature-box .wp-feature-box-main-link {
position: absolute;
top: 0;
Expand Down Expand Up @@ -222,7 +232,7 @@
font-size: 90%;
}

/*
/*
* Embed tool
*/

Expand Down Expand Up @@ -274,4 +284,4 @@
color: #fff;
font-weight: 600;
text-decoration: none;
}
}
4 changes: 2 additions & 2 deletions embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public function get_embed_settings($settings) {
}

public function print_embed_script() {

header('Content-type: application/javascript');
// header was hidden because it conflicts with magic field: file can't upload
//header('Content-type: application/javascript');

if(isset($_REQUEST['wp_feature_embed'])) {

Expand Down
2 changes: 1 addition & 1 deletion includes/acf/acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function get_post_id( $post_id )
* Override for preview
*
* If the $_GET['preview_id'] is set, then the user wants to see the preview data.
* There is also the case of previewing a page with post_id = 1, but using get_field
* There is also the case of previewing a page with post_id = 1, but using acf_get_field
* to load data from another post_id.
* In this case, we need to make sure that the autosave revision is actually related
* to the $post_id variable. If they match, then the autosave data will be used, otherwise,
Expand Down
2 changes: 1 addition & 1 deletion includes/acf/add-ons/acf-website-field/website_url.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function create_options($field)
<tr class="field_option field_option_<?php echo $this->name; ?>">
<td class="label">
<label><?php _e("Return array instead of Link",'acf'); ?></label>
<p class="description">If "Yes" than the get_field will return an array</p>
<p class="description">If "Yes" than the acf_get_field will return an array</p>
</td>
<td>
<?php
Expand Down
54 changes: 27 additions & 27 deletions includes/acf/core/api.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* get_field_reference()
* acf_get_field_reference()
*
* This function will find the $field_key that is related to the $field_name.
* This is know as the field value reference
Expand All @@ -16,7 +16,7 @@
* @return string $return: a string containing the field_key
*/

function get_field_reference( $field_name, $post_id ) {
function acf_get_field_reference( $field_name, $post_id ) {

// cache
$found = false;
Expand Down Expand Up @@ -58,7 +58,7 @@ function get_field_reference( $field_name, $post_id ) {


/*
* get_field_objects()
* acf_get_field_objects()
*
* This function will return an array containing all the custom field objects for a specific post_id.
* The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the fields / values.
Expand All @@ -72,7 +72,7 @@ function get_field_reference( $field_name, $post_id ) {
* @return array $return: an array containin the field groups
*/

function get_field_objects( $post_id = false, $options = array() ) {
function acf_get_field_objects( $post_id = false, $options = array() ) {

// global
global $wpdb;
Expand Down Expand Up @@ -121,7 +121,7 @@ function get_field_objects( $post_id = false, $options = array() ) {
{
foreach( $keys as $key )
{
$field = get_field_object( $key, $post_id, $options );
$field = acf_get_field_object( $key, $post_id, $options );

if( !is_array($field) )
{
Expand All @@ -146,7 +146,7 @@ function get_field_objects( $post_id = false, $options = array() ) {


/*
* get_fields()
* acf_get_fields()
*
* This function will return an array containing all the custom field values for a specific post_id.
* The function is not very elegant and wastes a lot of PHP memory / SQL queries if you are not using all the values.
Expand All @@ -160,7 +160,7 @@ function get_field_objects( $post_id = false, $options = array() ) {
* @return array $return: an array containin the field values
*/

function get_fields( $post_id = false, $format_value = true ) {
function acf_get_fields( $post_id = false, $format_value = true ) {

// vars
$options = array(
Expand All @@ -169,7 +169,7 @@ function get_fields( $post_id = false, $format_value = true ) {
);


$fields = get_field_objects( $post_id, $options );
$fields = acf_get_field_objects( $post_id, $options );

if( is_array($fields) )
{
Expand All @@ -184,7 +184,7 @@ function get_fields( $post_id = false, $format_value = true ) {


/*
* get_field()
* acf_get_field()
*
* This function will return a custom field value for a specific field name/key + post_id.
* There is a 3rd parameter to turn on/off formating. This means that an Image field will not use
Expand All @@ -201,7 +201,7 @@ function get_fields( $post_id = false, $format_value = true ) {
* @return mixed $value: the value found
*/

function get_field( $field_key, $post_id = false, $format_value = true ) {
function acf_get_field( $field_key, $post_id = false, $format_value = true ) {

// vars
$return = false;
Expand All @@ -211,7 +211,7 @@ function get_field( $field_key, $post_id = false, $format_value = true ) {
);


$field = get_field_object( $field_key, $post_id, $options);
$field = acf_get_field_object( $field_key, $post_id, $options);


if( is_array($field) )
Expand All @@ -226,7 +226,7 @@ function get_field( $field_key, $post_id = false, $format_value = true ) {


/*
* get_field_object()
* acf_get_field_object()
*
* This function will return an array containing all the field data for a given field_name
*
Expand All @@ -243,7 +243,7 @@ function get_field( $field_key, $post_id = false, $format_value = true ) {
* @return array $return: an array containin the field groups
*/

function get_field_object( $field_key, $post_id = false, $options = array() ) {
function acf_get_field_object( $field_key, $post_id = false, $options = array() ) {

// make sure add-ons are included
acf()->include_3rd_party();
Expand All @@ -268,7 +268,7 @@ function get_field_object( $field_key, $post_id = false, $options = array() ) {
if( substr($field_key, 0, 6) !== 'field_' )
{
// get field key
$field_key = get_field_reference( $field_key, $post_id );
$field_key = acf_get_field_reference( $field_key, $post_id );
}


Expand Down Expand Up @@ -314,7 +314,7 @@ function get_field_object( $field_key, $post_id = false, $options = array() ) {
/*
* the_field()
*
* This function is the same as echo get_field().
* This function is the same as echo acf_get_field().
*
* @type function
* @since 1.0.3
Expand All @@ -328,7 +328,7 @@ function get_field_object( $field_key, $post_id = false, $options = array() ) {

function the_field( $field_name, $post_id = false ) {

$value = get_field($field_name, $post_id);
$value = acf_get_field($field_name, $post_id);

if( is_array($value) )
{
Expand Down Expand Up @@ -439,7 +439,7 @@ function have_rows( $field_name, $post_id = false ) {
if( $new_parent_loop )
{
// vars
$f = get_field_object( $field_name, $post_id );
$f = acf_get_field_object( $field_name, $post_id );
$v = $f['value'];
unset( $f['value'] );

Expand Down Expand Up @@ -863,8 +863,8 @@ function register_field_group( $array )
}


add_filter('acf/get_field_groups', 'api_acf_get_field_groups', 2, 1);
function api_acf_get_field_groups( $return )
add_filter('acf/acf_get_field_groups', 'api_acf_acf_get_field_groups', 2, 1);
function api_acf_acf_get_field_groups( $return )
{
// validate
if( empty($GLOBALS['acf_register_field_group']) )
Expand Down Expand Up @@ -902,8 +902,8 @@ function api_acf_get_field_groups( $return )
}


add_filter('acf/field_group/get_fields', 'api_acf_field_group_get_fields', 1, 2);
function api_acf_field_group_get_fields( $fields, $post_id )
add_filter('acf/field_group/acf_get_fields', 'api_acf_field_group_acf_get_fields', 1, 2);
function api_acf_field_group_acf_get_fields( $fields, $post_id )
{
// validate
if( !empty($GLOBALS['acf_register_field_group']) )
Expand Down Expand Up @@ -1029,7 +1029,7 @@ function get_row_layout()
* string + field: the field name
* mixed + post_id: the post_id to load from
*
* @return string $value: the value found by get_field
* @return string $value: the value found by acf_get_field
*/

function acf_shortcode( $atts )
Expand All @@ -1049,7 +1049,7 @@ function acf_shortcode( $atts )


// get value and return it
$value = get_field( $field, $post_id );
$value = acf_get_field( $field, $post_id );


if( is_array($value) )
Expand Down Expand Up @@ -1255,7 +1255,7 @@ function acf_form( $options = array() )
echo $options['html_before_fields'];


$acfs = apply_filters('acf/get_field_groups', array());
$acfs = apply_filters('acf/acf_get_field_groups', array());

if( is_array($acfs) ){ foreach( $acfs as $acf ){

Expand All @@ -1271,7 +1271,7 @@ function acf_form( $options = array() )


// load fields
$fields = apply_filters('acf/field_group/get_fields', array(), $acf['id']);
$fields = apply_filters('acf/field_group/acf_get_fields', array(), $acf['id']);


echo '<div id="acf_' . $acf['id'] . '" class="postbox acf_postbox ' . $acf['options']['layout'] . '">';
Expand Down Expand Up @@ -1334,7 +1334,7 @@ function update_field( $field_key, $value, $post_id = false )
'format_value' => false
);

$field = get_field_object( $field_key, $post_id, $options);
$field = acf_get_field_object( $field_key, $post_id, $options);


// sub fields? They need formatted data
Expand Down Expand Up @@ -1413,7 +1413,7 @@ function create_field( $field )
* @since 4.0.0
* @date 17/03/13
*
* @param array $value: the value returned via get_field
* @param array $value: the value returned via acf_get_field
* @param array $field: the field or layout to find sub fields from
*
* @return N/A
Expand Down
8 changes: 4 additions & 4 deletions includes/acf/core/controllers/everything_fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function attachment_fields_to_edit( $form_fields, $post )
}


$acfs = apply_filters('acf/get_field_groups', array());
$acfs = apply_filters('acf/acf_get_field_groups', array());


if( is_array($acfs) ){ foreach( $acfs as $acf ){
Expand All @@ -105,7 +105,7 @@ function attachment_fields_to_edit( $form_fields, $post )


// load fields
$fields = apply_filters('acf/field_group/get_fields', array(), $acf['id']);
$fields = apply_filters('acf/field_group/acf_get_fields', array(), $acf['id']);


if( is_array($fields) ){ foreach( $fields as $i => $field ){
Expand Down Expand Up @@ -654,7 +654,7 @@ function acf_everything_fields()


// get acfs
$acfs = apply_filters('acf/get_field_groups', false);
$acfs = apply_filters('acf/acf_get_field_groups', false);


// layout
Expand Down Expand Up @@ -726,7 +726,7 @@ function acf_everything_fields()


// load fields
$fields = apply_filters('acf/field_group/get_fields', array(), $acf['id']);
$fields = apply_filters('acf/field_group/acf_get_fields', array(), $acf['id']);


if( is_array($fields) ){ foreach( $fields as $field ){
Expand Down
2 changes: 1 addition & 1 deletion includes/acf/core/controllers/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ function html_php()
$var = array(
'id' => $acf->post_name,
'title' => $acf->post_title,
'fields' => apply_filters('acf/field_group/get_fields', array(), $acf->ID),
'fields' => apply_filters('acf/field_group/acf_get_fields', array(), $acf->ID),
'location' => apply_filters('acf/field_group/get_location', array(), $acf->ID),
'options' => apply_filters('acf/field_group/get_options', array(), $acf->ID),
'menu_order' => $acf->menu_order,
Expand Down
Loading