Ejemplo n.º 1
0
 /**
  * Enqueue the front-end styles.
  *
  * @since 1.2.0
  */
 public function enqueue_styles()
 {
     // The icon font.
     wp_register_style('simmer-icons', dirname(plugin_dir_url(__FILE__)) . '/assets/icons/css/simmer-icons.css', array(), Simmer()->version);
     // The main front-end stylsheet.
     wp_enqueue_style('simmer-plugin-styles', plugin_dir_url(__FILE__) . 'assets/styles.css', array('simmer-icons'), Simmer()->version);
 }
 /**
  * Enqueue the front-end scripts.
  *
  * @since 1.2.1
  */
 public function enqueue_scripts()
 {
     // Register the PrintThis script.
     wp_register_script('simmer-print-this', plugin_dir_url(__FILE__) . 'assets/print-this.js', array('jquery'), '1.5.0', true);
     // The main front-end scripts.
     wp_enqueue_script('simmer-plugin-scripts', plugin_dir_url(__FILE__) . 'assets/simmer-scripts.js', array('jquery', 'simmer-print-this'), Simmer()->version, true);
     wp_localize_script('simmer-plugin-scripts', 'simmerStrings', array('printStylesURL' => plugin_dir_url(__FILE__) . 'assets/simmer-print.css'));
 }
 /**
  * Enqueue the modal script.
  *
  * @since 1.2.0
  *
  * @param string $hook The current admin screen.
  */
 public function enqueue_script($hook)
 {
     if (('post.php' == $hook || 'post-new.php' == $hook) && !in_array(get_post_type(), $this->get_supported_post_types())) {
         return;
     }
     wp_register_script('select2-script', plugin_dir_url(__FILE__) . 'assets/plugins/select2.min.js', array('jquery'), '4.0.0', true);
     wp_enqueue_script('simmer-admin-shortcode-script', plugin_dir_url(__FILE__) . 'assets/shortcode.js', array('jquery', 'select2-script'), Simmer()->version, true);
     wp_enqueue_style('select2-style', plugin_dir_url(__FILE__) . 'assets/plugins/select2.min.css', array(), '4.0.0');
 }
Ejemplo n.º 4
0
 /**
  * Enqueue the custom scripts & styles.
  *
  * @since 1.3.3
  */
 public function enqueue_scripts($hook)
 {
     wp_enqueue_style('simmer-admin-styles', plugin_dir_url(__FILE__) . 'assets/admin.css', array('dashicons'), Simmer()->version);
     // Only enqueue the script when dealing with our main object type (recipe).
     if (('post.php' == $hook || 'post-new.php' == $hook) && get_post_type() == simmer_get_object_type()) {
         wp_enqueue_script('simmer-admin-scripts', plugin_dir_url(__FILE__) . 'assets/admin.js', array('jquery'), Simmer()->version, true);
         wp_localize_script('simmer-admin-scripts', 'simmer_vars', array('remove_ingredient_min' => __('You must have at least one ingredient!', 'simmer'), 'remove_instruction_min' => __('You must have at least one instruction!', 'simmer'), 'remove_ays' => __('Are you sure you want to remove this item?', 'simmer')));
         wp_enqueue_script('simmer-admin-bulk-script', plugin_dir_url(__FILE__) . 'assets/bulk-add.js', array('jquery'), Simmer()->version, true);
         wp_localize_script('simmer-admin-bulk-script', 'simmer_bulk_add_vars', array('ingredients_title' => __('Add Bulk Ingredients', 'simmer'), 'ingredients_help' => __('Type or paste the list of ingredients below, one ingredient per line.', 'simmer'), 'ingredients_placeholder' => __('e.g. 1 cup flour, sifted', 'simmer'), 'ingredients_button' => __('Add Ingredients', 'simmer'), 'instructions_title' => __('Add Bulk Instructions', 'simmer'), 'instructions_help' => __('Type or paste the list of instructions below, one instruction per line.', 'simmer'), 'instructions_placeholder' => __('e.g. Preheat your oven to 450 degrees.', 'simmer'), 'instructions_button' => __('Add Instructions', 'simmer'), 'error_message' => __('Something went wrong. Please try again.', 'simmer'), 'ajax_url' => admin_url('admin-ajax.php')));
     }
 }
Ejemplo n.º 5
0
 /**
  * Install Simmer in all its glory.
  *
  * @since 1.3.0
  */
 public static function install()
 {
     // Shout it from the rooftops: "Simmer is installing!"
     if (!defined('SIMMER_INSTALLING')) {
         define('SIMMER_INSTALLING', true);
     }
     // Create the custom database tables.
     self::create_db_tables();
     $current_version = get_option('simmer_version', '1.0.0');
     // Upgrade older versions of Simmer.
     if (version_compare($current_version, Simmer()->version, '<')) {
         self::upgrade($current_version);
     }
     // Reset the version number.
     delete_option('simmer_version');
     add_option('simmer_version', Simmer()->version, '', 'no');
     /**
      * Fires after Simmer has been installed.
      *
      * @since 0.1.0
      */
     do_action('simmer_installed');
 }
Ejemplo n.º 6
0
 /**
  * Prevent the class from being unserialized.
  *
  * @since 1.3.3
  */
 public function __wakeup()
 {
     _doing_it_wrong(__FUNCTION__, __('The Simmer_Admin_Bulk_Add class can not be unserialized', 'simmer'), Simmer()->version);
 }
Ejemplo n.º 7
0
 /**
  * Register the recipe CPT and category taxonomy.
  *
  * @since  1.3.9
  * @access protected
  * @return void
  */
 protected static function register_types()
 {
     Simmer()->register_object_type();
     Simmer()->register_category_taxonomy();
 }