Ejemplo n.º 1
0
 /**
  *
  * add custom css classes to body tag
  *
  * @param array $classes
  * @return array
  * @static
  * @link https://codex.wordpress.org/Function_Reference/body_class#Add_Classes_By_Filters example
  */
 public static function body_class($classes)
 {
     if (is_page_template('contact-page.php') && \SilverWp\Helper\Option::get_theme_option('use_google_maps') === '1') {
         $classes[] = 'google-map';
     }
     return $classes;
 }
Ejemplo n.º 2
0
 /**
  *
  * Connect with Tweeter API
  *
  * @return \SilverWp\Ajax\TwitterOAuth
  */
 private function connect()
 {
     $cons_key = Option::get_theme_option('twitter_oauth_key');
     $cons_secret = Option::get_theme_option('twitter_oauth_secret');
     $token = Option::get_theme_option('twitter_oauth_access_token');
     $secret = Option::get_theme_option('twitter_oauth_access_secret');
     $connection = new TwitterOAuth($cons_key, $cons_secret, $token, $secret);
     return $connection;
 }
Ejemplo n.º 3
0
 /**
  * Class constructor initialize class
  *
  * @access protected
  * @todo implements re_insert_custom_css
  */
 protected function __construct()
 {
     $this->user_name = Option::get_theme_option('tf_user_name');
     $this->api_key = Option::get_theme_option('tf_api_key');
     $this->author = Theme::getThemeInfo('Author');
     $this->theme_name = Theme::getThemeInfo('Name');
     $this->version = Theme::getThemeInfo('Version');
     add_action('admin_notices', array($this, 'backendHtml'));
     add_action('update_bulk_theme_complete_actions', array($this, 'updateComplete'), 10, 2);
     //add_action( 'upgrader_process_complete', array( $this, 're_insert_custom_css' ) );
     //add_action( 'load-update.php', array( $this, 'temp_save_custom_css' ), 20 );
     $this->includes();
 }
Ejemplo n.º 4
0
 /**
  *
  * Check the current post or page have a sidebar
  *
  * @static
  * @access public
  * @return boolean
  */
 public static function isDisplayed()
 {
     //fix Ticket #220
     if (is_search() && is_home() || is_tag() || is_date() || is_archive()) {
         $post_id = Option::get_option('page_for_posts');
         $post_type = 'page';
     } else {
         $page_object = get_queried_object();
         $post_id = get_queried_object_id();
         $post_type = isset($page_object->post_type) ? $page_object->post_type : 'posts';
     }
     $sidebar = MetaBox::isSidebar($post_type, $post_id);
     if ((is_search() || is_author() || is_tag() || is_date() || is_archive()) && Option::get_theme_option('blogposts_sidebar') != '0') {
         $sidebar = true;
     }
     $display = apply_filters('sage/display_sidebar', $sidebar);
     return $display;
 }
Ejemplo n.º 5
0
 /**
  *
  * Replace default image size based in settings->media
  *
  * @param array $image_sizes array with all image size
  *
  * @access private
  * @return void
  */
 private function defaultImageSize(array $image_sizes)
 {
     foreach ($image_sizes as $name => $defualt) {
         Option::update_option($name . '_size_w', $defualt['width']);
         Option::update_option($name . '_size_h', $defualt['height']);
         $crop = $defualt['crop'] ? 1 : 0;
         if ('post-thumbnail' == $name) {
             //add icon image
             \set_post_thumbnail_size($defualt['width'], $defualt['height'], $crop);
         }
         if (false === Option::get_option($name . '_crop')) {
             Option::add_option($name . '_crop', $crop);
         } else {
             Option::update_option($name . '_crop', $crop);
         }
     }
 }
Ejemplo n.º 6
0
function avia_get_option($name)
{
    return \SilverWp\Helper\Option::get_theme_option($name);
}
Ejemplo n.º 7
0
 /**
  * Get sidebar position
  *
  * @param integer $post_id
  *
  * @return string
  * @access public
  */
 public function getSidebarPosition($post_id)
 {
     //Fix for tag page and all post type where don't have config from meta box
     if (is_home() || is_tag() || is_date() || is_archive()) {
         $post_id = Option::get_option('page_for_posts');
     }
     $sidebar_code = $this->get($post_id, 'sidebar');
     switch ($sidebar_code) {
         case '1':
             $sidebar_position = 'left';
             break;
         case '2':
             $sidebar_position = 'right';
             break;
         default:
             $sidebar_position = 'right';
             // default position
     }
     return $sidebar_position;
 }
Ejemplo n.º 8
0
 /**
  * get fonts settings
  *
  * @return array
  */
 public function set_font()
 {
     $fonts_body = Option::get_theme_option('style_fonts_body', true);
     unset($fonts_body['preview']);
     $fonts_heading = Option::get_theme_option('style_fonts_heading', true);
     unset($fonts_heading['preview']);
     $fonts_main_menu = Option::get_theme_option('style_fonts_main_menu', true);
     unset($fonts_main_menu['preview']);
     self::$_fonts = array_merge($fonts_body, $fonts_heading, $fonts_main_menu);
     foreach (self::$_fonts as $key => $value) {
         if (strpos($key, 'family')) {
             $font = explode(',', trim($value, ','));
             $font[0] = strpos($font[0], ' ') ? '\'' . $font[0] . '\'' : $font[0];
             self::$_fonts[$key] = implode(',', $font);
         }
     }
     $this->_set_value(self::$_fonts);
     return self::$_css_variable;
 }
Ejemplo n.º 9
0
 /**
  * Short cut to SilverWp\Helper\Option::get_theme_option()
  *
  * @param string $option_name
  *
  * @return string
  * @access public
  * @author Marcin Dobroszek <marcin at silversite.pl>
  * @since 0.2
  */
 function get_theme_option($option_name)
 {
     return Option::get_theme_option($option_name);
 }