public function activation_hook() { // create default settings add_option($this->settings_key_general, array('name' => 'Bacon', 'start-with' => 'Bacon ipsum dolor amet', 'querystring-all-custom' => 'all-custom', 'querystring-custom-and-filler' => 'custom-and-filler', 'button-text' => 'Give Me Bacon', 'all-custom-text' => 'All Meat', 'custom-and-filler-text' => 'Meat and Filler'), '', $autoload = 'no'); add_option($this->settings_key_api, array('api-enabled' => '0', 'api-endpoint' => 'ipsum-api'), '', $autoload = 'no'); add_option($this->settings_key_oembed, array('oembed-enabled' => '0', 'oembed-endpoint' => 'ipsum-oembed'), '', $autoload = 'no'); $custom = ''; $filler = ''; if (class_exists('WPAnyIpsumGenerator')) { $WPAnyIpsumGenerator = new WPAnyIpsumGenerator(); $custom = implode("\n", $WPAnyIpsumGenerator->default_custom()); $filler = implode("\n", $WPAnyIpsumGenerator->default_filler()); } add_option($this->settings_key_filler, array('custom-words' => $custom, 'filler-words' => $filler), '', $autoload = 'no'); // add an option so we can show the activated admin notice add_option('anyipsum-plugin-activated', '1'); }
public function generate_filler($args) { $args = wp_parse_args($args, $this->default_generator_args()); if (class_exists('WPAnyIpsumGenerator')) { $generator = new WPAnyIpsumGenerator(); $generator->custom_words = $this->get_words('custom-words'); $generator->filler = $this->get_words('filler-words'); $generator->start_with = apply_filters('anyipsum-setting-get', '', 'anyipsum-settings-general', 'start-with'); $generator->custom_and_filler = apply_filters('anyipsum-setting-get', '', 'anyipsum-settings-general', 'querystring-custom-and-filler'); $generator->sentence_mode = apply_filters('anyipsum-setting-get', false, 'anyipsum-settings-custom-filler', 'sentence-mode'); return $generator->Make_Some_Custom_Filler($args['type'], $args['number-of-paragraphs'], $args['start-with-lorem'], $args['number-of-sentences'], $args['max-number-of-paragraphs']); } else { return array(); } }