get_values( $fields );
$data = '';
foreach($fields as $key =>$item) {
if(in_array($key, $this->get_excluded_fields()) ){
continue;
} else {
switch(gettype($item)) {
case 'string':
if (preg_match('/(\.jpg|\.png|\.bmp)$/', $item)) {
$data = $data.'
';
} else {
$data = $data.' '.$item;
}
break;
case 'array':
if($key == 'sizes') {
// put all images in img tags for scoring.
$data = $data.' ;
}
break;
}
}
}
return $data;
}
function get_values($array) {
$value_array = array_values($array);
return $value_array;
}
function ajax_get_fields() {
$pid = $_POST['postId'];
$fields = get_fields( $pid );
wp_send_json( $this->get_field_data( $fields ) );
}
/**
* Register and enqueue admin-specific JavaScript.
*
* @since 0.1.0
*/
public function enqueue_admin_scripts() {
$pid = isset($_GET['post']) ? $_GET['post'] : $post->ID;
wp_enqueue_script($this->plugin_slug, AC_SEO_ACF_ANALYSIS_PLUGIN_URL . 'yoast-seo-plugin.js', array('jquery', 'yoast-seo', 'wp-seo-post-scraper'), self::VERSION);
wp_localize_script($this->plugin_slug, 'yoast_acf_settings', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'id' => $pid,
'ajax_action' => $plugin_slug . '_get_fields'
));
}
}
new AC_Yoast_SEO_ACF_Content_Analysis();
)