');
if ( ! empty( $_GET['settings-updated'] ) ) {
add_settings_error(
'wpc_seo_settings',
'wpc_seo_settings_updated',
__( 'SEO settings saved successfully' ),
'updated'
);
}
settings_errors();
echo '';
wp_nonce_field( 'wpc_seo_settings' );
$this->doSettingsSections($this->page);
if( apply_filters('wpc_settings_submit_button', true ) ){
submit_button();
}
print('');
}
public function doSettingsSections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
if ( ! isset( $wp_settings_sections[ $page ] ) ) {
return;
}
echo '
';
do_action('wpc_before_seo_setting_section_title_' . $section['id'], $page);
do_action('wpc_before_sections_settings_fields', $this->page );
}
if ( !empty($section['title']) ) {
echo "
". wp_kses( $section['title'], array( 'span' => array( 'class' => true ) )) ."
\n";
}
if(!empty($section['before_section'])){
do_action('wpc_after_seo_setting_section_title_' . $section['id'], $page);
}
if ( $section['callback'] ) {
call_user_func( $section['callback'], $section );
}
$sortable = ( $section['id'] === 'wpc_slugs' ) ? ' wpc-sortable-table' : '';
echo '
';
if(!empty($section['after_section'])){
do_action('wpc_after_sections_settings_fields_' . $section['id'], $this->page );
echo '
';
}
}
do_action('wpc_after_settings_fields', $page );
}
public function start_section_html($is_open = false) {
return $this->sectionName();
}
public function end_section_html() {
return 'true';
}
protected function addSectionSettingsWrapper($settings, $is_open = false)
{
$first_key = array_key_first($settings);
$last_key = array_key_last($settings);
if ($first_key !== $last_key) {
$settings[$first_key]['args'] = ['before_section' => $this->start_section_html($is_open)];
$settings[$last_key]['args'] = ['after_section' => $this->end_section_html()];
}
if ($first_key === $last_key) {
$settings[$first_key]['args'] = ['before_section' => $this->start_section_html($is_open), 'after_section' => $this->end_section_html()];
}
return $settings;
}
}