register(); } public function register() { add_action( 'plugins_loaded', array( $this, 'register_text_domain' ) ); add_action( 'admin_notices', array($this,'check_activation_seopress') ); add_filter( 'seopress_content_analysis_content', array( $this, 'add_content_acf_to_seopress' ), 10, 2 ); } public function check_activation_seopress() { if ( !is_plugin_active( 'wp-seopress/seopress.php' ) && current_user_can( 'manage_options' ) ): ?>

SEOPress in order to use the plugin ACF Content Analysis For Seopress.', 'acf-content-analysis-for-seopress' ); ?>

Advanced Custom Fields in order to use the plugin ACF Content Analysis For Seopress.', 'acf-content-analysis-for-seopress' ); ?>

collect_acf_content( $id ); $content = strip_tags($content); return $content; } public function collect_acf_content($id) { $all_fields = get_field_objects( $id ); $content = ''; if ($all_fields): foreach ($all_fields as $field): $content .= $this->acf_individual_field_content($field, $id); endforeach; endif; return $content; } public function acf_individual_field_content( $field, $id ) { if (in_array($field['type'], $this->interested_single_field_types)): $content = $field['value'].' '; return $content; else: if (in_array( $field['type'], $this->interested_complex_field_types)): if (have_rows( $field['name'], $id)): $content = ''; while(have_rows($field['name'], $id)): $row = the_row(); foreach ($row as $row_field_key => $row_field): $subfield_object_array = get_sub_field_object($row_field_key); if ($subfield_object_array) $content .= $this->acf_individual_field_content($subfield_object_array, $id); endforeach; endwhile; return $content; endif; endif; endif; return ''; } } $contentACFSeopress = new ACFSeopress(); }