Beispiel #1
0
 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')));
 }
Beispiel #2
0
 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 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');
 }
Beispiel #4
0
 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));
     }
 }
Beispiel #5
0
 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'];
 }
Beispiel #6
0
 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');
 }
Beispiel #7
0
 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));
 }
Beispiel #8
0
 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);
 }
Beispiel #10
0
 public function __construct($class)
 {
     $this->plugin_name = FBSS_Registry::get('plugin_name');
     $this->class = $class;
 }