/** * Initialize the class and set its properties. * * @since 1.0.0 * @var string $plugin_slug The name of this plugin. * @var string $version The version of this plugin. */ public function __construct($plugin_slug, $version) { $this->plugin_slug = $plugin_slug; $this->version = $version; $arve_shared = new Advanced_Responsive_Video_Embedder_Shared(); $this->regex_list = $arve_shared->get_regex_list(); $this->options = $arve_shared->get_options(); $this->options_defaults = $arve_shared->get_options_defaults(); }
public function validate_options_shortcodes($input) { $output = array(); //* Storing the Options Section as a empty array will cause the plugin to use defaults if (isset($input['reset'])) { return array(); } foreach ($input as $key => $var) { $var = preg_replace('/[_]+/', '_', $var); // remove multiple underscores $var = preg_replace('/[^A-Za-z0-9_]/', '', $var); // strip away everything except a-z,0-9 and underscores if (strlen($var) < 3) { continue; } $output[$key] = $var; } $options_defaults = Advanced_Responsive_Video_Embedder_Shared::get_options_defaults('shortcodes'); //* Store only the options in the database that are different from the defaults. return array_diff_assoc($output, $options_defaults); }