public static function fb_social_stream_sc($atts, $content, $name) { $limit = FBSS_Registry::get('stream_msg_limit'); $social = new FBSS_SocialStream(); $stream_data = $social->get($limit); return $stream_data['html']; }
public static function getInstance() { if (self::$instance === null) { self::$instance = new FBSS_Registry(); } return self::$instance; }
public static function add_js_library() { self::$logger->log("Add JS library.", __LINE__); $plugin_version = FBSS_Registry::get('plugin_version'); wp_enqueue_script('wp-fb-social-stream-js', self::$plugin_dir_url . 'js/wp-fb-social-stream.min.js', array('jquery'), $plugin_version, true); wp_localize_script('wp-fb-social-stream-js', 'wp_fb_social_stream_js_vars', array('ajaxurl' => admin_url('admin-ajax.php'))); }
public function __construct() { $this->logger = new FBSS_Logger(__CLASS__); $this->plugin_base_dir = FBSS_Registry::get('plugin_base_dir'); $this->extensions_base_dir = $this->plugin_base_dir . '/extensions'; $this->wpurl = get_bloginfo('wpurl'); $this->wpversion = get_bloginfo('version'); }
public static function add_css_library() { $template = new FBSS_Template(); $template_id = $template->getId(); $plugin_version = FBSS_Registry::get('plugin_version'); $style_dir = self::$plugin_dir_url . 'templates/' . $template_id . '/css'; $style_uri = $style_dir . '/style.min.css'; wp_enqueue_style('wp-fb-social-stream', $style_uri, array(), $plugin_version, 'all'); // enqueue customized style $css_configs = $template->getConfigurationCSS(); $custom_css = array(); foreach ($css_configs as $config) { $config_index = $config['config']['index']; foreach ($config['config']['configs'] as $sub_config) { if (isset($sub_config['actions'])) { if (isset($sub_config['actions']['copy_value_from'])) { // copy value and create css $copy_from_key = $template->getDBOptionsKey($sub_config['actions']['copy_value_from']['index'], $sub_config['actions']['copy_value_from']['config_id']); $copy_from_val = $template->getDBOptionsValue($copy_from_key); if ($copy_from_val) { $prefix = $sub_config['actions']['copy_value_from']['value_prefix']; $suffix = $sub_config['actions']['copy_value_from']['value_suffix']; if ($sub_config['type'] == 'hexcode') { $css_string = sprintf('%s {%s: %s#%s%s;}', $sub_config['selector'], $sub_config['property'], $prefix, $copy_from_val, $suffix); } elseif ($sub_config['type'] == 'size') { $unit = $template->getDBOptionsValue($copy_from_key . '_u'); $css_string = sprintf('%s {%s: %s%s%s;}', $sub_config['selector'], $sub_config['property'], $prefix, $copy_from_val . $unit, $suffix); } else { $css_string = sprintf('%s {%s: %s%s%s;}', $sub_config['selector'], $sub_config['property'], $prefix, $copy_from_val, $suffix); } array_push($custom_css, $css_string); continue; } } } $db_options_key = $template->getDBOptionsKey($config_index, $sub_config['config_id']); $css_val = $template->getDBOptionsValue($db_options_key); if ($css_val) { if ($sub_config['type'] == 'hexcode') { $css_string = sprintf('%s {%s: #%s;}', $sub_config['selector'], $sub_config['property'], $css_val); } elseif ($sub_config['type'] == 'size') { $unit = $template->getDBOptionsValue($db_options_key . '_u'); $css_string = sprintf('%s {%s: %s;}', $sub_config['selector'], $sub_config['property'], $css_val . $unit); } else { $css_string = sprintf('%s {%s: %s;}', $sub_config['selector'], $sub_config['property'], $css_val); } array_push($custom_css, $css_string); } } } if (count($custom_css)) { wp_add_inline_style('wp-fb-social-stream', implode(' ', $custom_css)); } }
public function __construct() { $this->logger = new FBSS_Logger(__CLASS__); $template_id = get_option('fbss_setting_output_template', 'default'); $this->template_id = $template_id; $this->logger->log("Init configuration for template '{$template_id}'.", __LINE__); // register configuration in registry by use of include_once $template_config_path = plugin_dir_path(__FILE__) . '../templates/' . $template_id . '/config.php'; if (!@(include_once $template_config_path)) { $this->logger->log("Template with id '{$template_id}' does not exist!" . " Switching back to default template.", __LINE__); $this->template_id = 'default'; include_once plugin_dir_path(__FILE__) . '../templates/default' . '/config.php'; } $this->template_config = FBSS_Registry::get('template_config'); $this->template_name = $this->template_config['template_name']; }
public static function register() { $fb_page_name = get_option('fbss_setting_fb_page_name'); $fb_access_token = get_option('fbss_setting_fb_access_token'); self::$stream_msg_limit = get_option('fbss_setting_msg_limit', 20); // init registry with plugin data first FBSS_Registry::set('plugin_name', self::$plugin_name); FBSS_Registry::set('plugin_version', self::$plugin_version); FBSS_Registry::set('plugin_base_dir_url', plugin_dir_url(__FILE__)); FBSS_Registry::set('plugin_base_dir', plugin_dir_path(__FILE__)); FBSS_Registry::set('fb_page_name', $fb_page_name); FBSS_Registry::set('fb_access_token', $fb_access_token); FBSS_Registry::set('stream_msg_limit', self::$stream_msg_limit); self::$logger = new FBSS_Logger(__CLASS__); self::$db = new FBSS_DB(); self::$logger->log("Register plugin.", __LINE__); /* hooks */ register_activation_hook(__FILE__, array(__CLASS__, 'onActivation')); register_deactivation_hook(__FILE__, array(__CLASS__, 'onDeactivation')); register_uninstall_hook(__FILE__, array(__CLASS__, 'onUninstall')); /* translations */ add_action('plugins_loaded', array(__CLASS__, 'initTextDomain')); /* init plugin template */ self::initTemplate(); if (is_admin()) { /* administration submenu */ $admin = new FBSS_Admin(); /* settings link */ add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(__CLASS__, 'setPluginSettingsLink')); } /* check plugin version */ self::checkPluginVersion(); /* register shortcodes */ FBSS_Shortcodes::register(); /* register ajax handler to update social stream */ add_action('wp_ajax_wp_fb_social_stream_update', array(__CLASS__, 'ajaxUpdateSocialStream')); add_action('wp_ajax_nopriv_wp_fb_social_stream_update', array(__CLASS__, 'ajaxUpdateSocialStream')); add_action('wp_ajax_wp_fb_social_stream_force_update', array(__CLASS__, 'ajaxForceUpdateSocialStream')); /* register javascript libraries */ FBSS_JS::register(); /* register stylesheets */ FBSS_CSS::register(); }
public function __construct() { $this->logger = new FBSS_Logger(__CLASS__); $this->access_token = FBSS_Registry::get('fb_access_token'); $this->plugin_version = FBSS_Registry::get('plugin_version'); }
<?php /** * Do not change this default template-configuration! * * You can create your own template in * templates/{your-template-name}/config.php */ require_once plugin_dir_path(__FILE__) . '../../lib/FBSS_Registry.php'; $template_config = array('api_version' => '1.0.0', 'template_id' => 'default', 'template_name' => 'FBSS Default', 'css' => array(array('name' => __('Message-box', 'wp-fb-social-stream'), 'desc' => __('The main message box', 'wp-fb-social-stream'), 'config' => array('index' => 'message_box', 'configs' => array(array('config_id' => 7, 'desc' => __('Maximum width', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-wrap', 'property' => 'max-width', 'type' => 'size'), array('config_id' => 8, 'desc' => __('Width', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-wrap', 'property' => 'width', 'type' => 'size'), array('config_id' => 1, 'desc' => __('Background color', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-wrap', 'property' => 'background-color', 'type' => 'hexcode'), array('config_id' => 2, 'desc' => __('Border color', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-wrap', 'property' => 'border-color', 'type' => 'hexcode'), array('config_id' => 3, 'desc' => '', 'selector' => '.wp-fb-social-stream .fb-message-wrap:after', 'property' => 'border-color', 'type' => 'hexcode', 'actions' => array('hide' => true, 'copy_value_from' => array('index' => 'message_box', 'config_id' => 2, 'value_prefix' => 'transparent ', 'value_suffix' => ''))), array('config_id' => 5, 'desc' => __('Text color message date', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-wrap .fb-message-date', 'property' => 'color', 'type' => 'hexcode'), array('config_id' => 6, 'desc' => __('Text color message text', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-wrap .fb-message-text', 'property' => 'color', 'type' => 'hexcode')))), array('name' => __('Meta-box', 'wp-fb-social-stream'), 'desc' => __('The meta-box contains the like and comment count', 'wp-fb-social-stream'), 'config' => array('index' => 'meta_box', 'configs' => array(array('config_id' => 2, 'desc' => __('Maximum width', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-info', 'property' => 'max-width', 'type' => 'size'), array('config_id' => 1, 'desc' => __('Background color', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-metadata', 'property' => 'background-color', 'type' => 'hexcode')))), array('name' => __('Link-box', 'wp-fb-social-stream'), 'desc' => __('Links inside the message-box are wrapped by the link-box', 'wp-fb-social-stream'), 'config' => array('index' => 'link_box', 'configs' => array(array('config_id' => 1, 'desc' => __('Background color', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-linkbox', 'property' => 'background-color', 'type' => 'hexcode'), array('config_id' => 2, 'desc' => __('Text color link name', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-linkbox .fb-message-linkbox-name', 'property' => 'color', 'type' => 'hexcode'), array('config_id' => 3, 'desc' => __('Text color link description', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-linkbox .fb-message-linkbox-desc', 'property' => 'color', 'type' => 'hexcode'), array('config_id' => 4, 'desc' => __('Text color link caption', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-linkbox .fb-message-linkbox-caption', 'property' => 'color', 'type' => 'hexcode')))), array('name' => __('Video-box', 'wp-fb-social-stream'), 'desc' => __('The video-box contains the video itself and optional name and description', 'wp-fb-social-stream'), 'config' => array('index' => 'video_box', 'configs' => array(array('config_id' => 3, 'desc' => __('Background color', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-video-linkbox', 'property' => 'background-color', 'type' => 'hexcode'), array('config_id' => 1, 'desc' => __('Text color name', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-video-name', 'property' => 'color', 'type' => 'hexcode'), array('config_id' => 2, 'desc' => __('Text color description', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-video-desc', 'property' => 'color', 'type' => 'hexcode')))), array('name' => __('Event-box', 'wp-fb-social-stream'), 'desc' => __('Events are wrapped by the event-box', 'wp-fb-social-stream'), 'config' => array('index' => 'event_box', 'configs' => array(array('config_id' => 1, 'desc' => __('Background color', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-eventbox', 'property' => 'background-color', 'type' => 'hexcode'), array('config_id' => 2, 'desc' => __('Text color event name', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-eventbox .fb-message-eventbox-name', 'property' => 'color', 'type' => 'hexcode'), array('config_id' => 3, 'desc' => __('Text color event description', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-eventbox .fb-message-eventbox-desc', 'property' => 'color', 'type' => 'hexcode'), array('config_id' => 4, 'desc' => __('Text color event date', 'wp-fb-social-stream'), 'selector' => '.wp-fb-social-stream .fb-message-eventbox .fb-message-eventbox-date', 'property' => 'color', 'type' => 'hexcode')))))); // register configuration FBSS_Registry::set('template_config', $template_config);
private function getStreamOptionsHTML() { $this->logger->log("getStreamOptionsHTML.", __LINE__); // get output template options $tpl_base_dir = FBSS_Registry::get('plugin_base_dir') . '/templates'; $templates_avail = array(); $files = scandir($tpl_base_dir); foreach ($files as $file) { if ($file != '.' && $file != '..' && is_dir($tpl_base_dir . '/' . $file)) { array_push($templates_avail, $file); } } # TODO identify template name return $this->view->render('admin/settings-stream-options', array('output_templates' => $templates_avail)); }
public function __construct() { $this->logger = new FBSS_Logger(__CLASS__); $this->view_dir = FBSS_Registry::get('plugin_base_dir') . '/view'; }
private function setTemplateViewDir() { $tpl_base_dir = FBSS_Registry::get('plugin_base_dir') . '/templates'; $template_dir = $this->template_id; $this->view->setViewDir($tpl_base_dir . '/' . $template_dir); }
public function __construct($class) { $this->plugin_name = FBSS_Registry::get('plugin_name'); $this->class = $class; }