/** * Sets up our actions/filters. * * @since 1.0.0 */ public function __construct() { $this->plugin = Cherry_Social::get_instance(); $this->prefix = $this->get_prefix(); add_action('init', array($this, 'register_shortcodes')); add_filter('cherry_shortcodes/data/shortcodes', array($this, 'shortcodes')); }
/** * Callbck method for register static. * * @since 1.0.0 */ public function callback() { $plugin = Cherry_Social::get_instance(); $title = $plugin->get_option('follow-title'); if (!empty($title)) { $title_wrap = sprintf('<h3 class="%1$s">%2$s</h3>', 'cherry-follow_title', $title); $title_wrap = apply_filters('cherry_social_follow_static_title', $title_wrap); echo $title_wrap; } $plugin->get_follows(-1); }
/** * Initialize the plugin by loading admin scripts & styles and adding a * settings page and menu. * * @since 1.0.0 */ private function __construct() { $plugin = Cherry_Social::get_instance(); $this->plugin_slug = $plugin->get_plugin_slug(); // Load admin stylesheet and JavaScript. add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); // Add the options page and menu item. add_action('admin_menu', array($this, 'add_plugin_admin_menu')); // Add an action link pointing to the options page. $plugin_basename = plugin_basename(plugin_dir_path(realpath(dirname(__FILE__))) . $this->plugin_slug . '.php'); add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links')); }
/** * Specifies the classname and description. * * @since 1.0.0 */ public function __construct() { parent::__construct($this->get_widget_slug(), __('Cherry Follow Us', 'cherry-social'), array('classname' => $this->get_widget_slug() . '-class', 'description' => __('A social follow widget.', 'cherry-social'))); $this->plugin = Cherry_Social::get_instance(); $this->follow_items = $this->plugin->get_option('follow-items', array()); if (!empty($this->follow_items)) { $values = wp_list_pluck($this->follow_items, 'link-label'); $keys = array_map('sanitize_key', $values); $this->follow_items = array_combine($keys, $values); } // Refreshing the widget's cached output with each new post. add_action('save_post', array($this, 'flush_widget_cache')); add_action('deleted_post', array($this, 'flush_widget_cache')); add_action('switch_theme', array($this, 'flush_widget_cache')); }
// 'type' => 'select', // 'title' => __( 'Position', 'cherry-social' ), // 'decsription' => __( 'Choose where you would like the share buttons to appear, before or after the main content.', 'cherry-social' ), // 'value' => 'bottom', // 'options' => array( // 'top' => __( 'Top', 'cherry-social' ), // 'bottom' => __( 'Bottom', 'cherry-social' ), // 'both' => __( 'Top and Bottom', 'cherry-social' ), // ) // ); // Follow Us. $social_options['follow-title'] = array('type' => 'text', 'title' => __('Follow Us title', 'cherry-social'), 'decsription' => __('This title is used in `Follow Us` static.', 'cherry-social'), 'value' => __('Follow Us', 'cherry-social')); $social_options['follow-items'] = array('type' => 'repeater', 'title' => __('Follow Us networks', 'cherry-social'), 'decsription' => __('Set the social networks to display for following', 'cherry-social'), 'value' => array(array('external-link' => 'https://www.facebook.com/cherry.framework', 'font-class' => 'flaticon-facebook', 'link-label' => __('Facebook', 'cherry-social')), array('external-link' => 'https://twitter.com/CherryFramework', 'font-class' => 'flaticon-twitter', 'link-label' => __('Twitter', 'cherry-social')), array('external-link' => 'https://plus.google.com/u/0/110473764189007055556/posts', 'font-class' => 'flaticon-googleplus', 'link-label' => __('Google+', 'cherry-social')))); $sections['social-section'] = array('name' => __('Social', 'cherry-social'), 'icon' => 'dashicons dashicons-share', 'priority' => 120, 'options-list' => $social_options); // $sections['social-share-subsection'] = array( // 'name' => __( 'Sharing', 'cherry-social' ), // 'icon' => 'dashicons dashicons-arrow-right', // 'parent' => 'social-section', // 'options-list' => $share_options, // ); // $sections['social-follow-subsection'] = array( // 'name' => __( 'Follow', 'cherry-social' ), // 'icon' => 'dashicons dashicons-arrow-right', // 'parent' => 'social-section', // 'options-list' => $follow_options, // ); return $sections; } } Cherry_Social::get_instance(); }