} $out = array(); if (!is_array($choices)) { $out[] = array('id' => $name . '_' . self::clean_str_for_field($choices), 'label' => $choices, 'value' => self::clean_str_for_field($choices)); } else { foreach ($choices as $choice) { if (!is_array($choice)) { $out[] = array('label' => $choice, 'id' => $name . '_' . self::clean_str_for_field($choice), 'value' => self::clean_str_for_field($choice)); } else { # if choice is already an array, we need to check for missing data if (!array_key_exists('id', $choice)) { $choice['id'] = $name . '_' . self::clean_str_for_field($choice['label']); } if (!array_key_exists('value', $choice)) { $choice['value'] = $name . '_' . self::clean_str_for_field($choice['label']); } $out[] = $choice; } } } return $out; } } # end class RO3 # require files for plugin foreach (RO3::$classes as $class) { RO3::req_file(ro3_dir("lib/class-{$class}.php")); } # load static variables for RO3 class RO3::$style = RO3_Options::$options['style']; RO3::$color = RO3_Options::$options['main_color'];
<?php /** * Plugin Name: Big Boom Rule Of Three * Description: Uses shortcode to insert a responsive, custom-defined rule of 3 (or 4) into a page or post * Version: 1.2.1 * Author: Big Boom Design * Author URI: https://bigboomdesign.com */ /** * Load main class */ require_once ro3_dir("lib/class-ro3.php"); /** * Admin routine */ if (is_admin() && !(defined('DOING_AJAX') && DOING_AJAX)) { # Scripts and styles add_action("admin_enqueue_scripts", array('RO3', 'admin_enqueue')); # define sections and fields for options page add_action('admin_init', array('RO3_Options', 'register_settings')); # add main plugin options page to the WP Admin menu add_action('admin_menu', 'ro3_settings_page'); function ro3_settings_page() { add_menu_page('Rule of Three Settings', 'Rule of Three', 'manage_options', 'ro3_settings', 'ro3_do_settings_page'); } function ro3_do_settings_page() { RO3_Options::settings_page(); }