vaas_js_hash . '" crossorigin="anonymous"';
return str_replace(' src', $attributes . ' src', $tag);
}
return $tag;
}
public function settings_page()
{
$page_title = 'Acapela VaaS Settings';
$menu_title = 'Acapela VaaS';
$capability = 'manage_options';
$slug = $this->plugin_slug;
$callback = array($this, 'settings_page_content');
add_submenu_page('options-general.php', $page_title, $menu_title, $capability, $slug, $callback);
}
public function settings_page_content()
{
?>
Acapela VaaS
options_section_slug, 'Settings', false, $this->plugin_slug);
}
public function setup_fields()
{
$fields = array(
array(
'uid' => 'key_field',
'label' => 'Key',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false
),
array(
'uid' => 'login_field',
'label' => 'Login',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false
),
array(
'uid' => 'app_field',
'label' => 'App',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false
),
array(
'uid' => 'password_field',
'label' => 'Password',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false
),
array(
'uid' => 'default_voice_field',
'label' => 'Default voice',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false,
'helper' => 'Select the voice which will be used for text to speech.'
),
array(
'uid' => 'selector_field',
'label' => 'Selector',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false,
'helper' => 'Select all css selectors which identify sections where you want to active text to speech functionality.'
),
array(
'uid' => 'exclude_selector_field',
'label' => 'Exclude selector',
'section' => $this->options_section_slug,
'type' => 'text',
'options' => false
)
);
foreach ($fields as $field)
{
add_settings_field($field['uid'], $field['label'], array($this, 'field_callback'), $this->plugin_slug, $field['section'], $field);
register_setting($this->plugin_slug, $field['uid']);
}
}
public function field_callback($arguments)
{
echo '';
if ($helper = $arguments['helper'])
{
echo '' . $helper . '
';
}
}
}
$acapela = new Acapela();
}