Plugin Directory

Changeset 1920945


Ignore:
Timestamp:
08/07/2018 10:36:04 AM (8 years ago)
Author:
magictheme
Message:

Version 1.1.1

Location:
onetone-companion
Files:
28 added
5 edited

Legend:

Unmodified
Added
Removed
  • onetone-companion/trunk/assets/css/admin.css

    r1911944 r1920945  
    4343    margin-bottom:10px;
    4444    }
     45#onetone_companion_page_meta_box .wp-picker-container{
     46    display:inline-block;
     47}
  • onetone-companion/trunk/assets/js/admin.js

    r1732703 r1920945  
    33    // Loads the color pickers
    44    $('.oc-color').wpColorPicker();
    5    
     5    $.ocMediaUploader();
    66});
     7
     8( function( $) {
     9    $.ocMediaUploader = function( options ) {
     10       
     11        var settings = $.extend({
     12           
     13            target : '.oc-uploader', // The class wrapping the textbox
     14            uploaderTitle : 'Select or upload image', // The title of the media upload popup
     15            uploaderButton : 'Set image', // the text of the button in the media upload popup
     16            multiple : false, // Allow the user to select multiple images
     17            buttonText : 'Upload image', // The text of the upload button
     18            buttonClass : '.oc-upload', // the class of the upload button
     19            previewSize : '150px', // The preview image size
     20            modal : false, // is the upload button within a bootstrap modal ?
     21            buttonStyle : { // style the button
     22                color : '#fff',
     23                background : '#3bafda',
     24                fontSize : '14px',               
     25                padding : '5px 15px',
     26                textDecoration : 'none',               
     27            },
     28           
     29        }, options );
     30       
     31       
     32        $( settings.target ).append( '<a href="#" class="' + settings.buttonClass.replace('.','') + '">' + settings.buttonText + '</a>' );
     33        $( settings.target ).append('<div><br><img src="#" style="display: none; width: ' + settings.previewSize + '"/></div>')
     34       
     35        $( settings.buttonClass ).css( settings.buttonStyle );
     36       
     37        $('body').on('click', settings.buttonClass, function(e) {
     38           
     39            e.preventDefault();
     40            var selector = $(this).parent( settings.target );
     41            var custom_uploader = wp.media({
     42                title: settings.uploaderTitle,
     43                button: {
     44                    text: settings.uploaderButton
     45                },
     46                multiple: settings.multiple
     47            })
     48            .on('select', function() {
     49                var attachment = custom_uploader.state().get('selection').first().toJSON();
     50                selector.find( 'img' ).attr( 'src', attachment.url).show();
     51                selector.find( 'input' ).val(attachment.url);
     52                if( settings.modal ) {
     53                    $('.modal').css( 'overflowY', 'auto');
     54                }
     55            })
     56            .open();
     57        });
     58       
     59       
     60    }
     61})(jQuery);
  • onetone-companion/trunk/includes/metabox-options.php

    r1916674 r1920945  
    127127        $post_metas['display_title']     =  isset($_POST['display_title'])?sanitize_text_field($_POST['display_title']):'yes';
    128128        $post_metas['display_title_bar'] =  isset($_POST['display_title_bar'])?sanitize_text_field($_POST['display_title_bar']):'0';
     129       
     130        $post_metas['titlebar_background_color'] =  isset($_POST['titlebar_background_color'])?sanitize_hex_color($_POST['titlebar_background_color']):'';
     131        $post_metas['titlebar_background_image'] =  isset($_POST['titlebar_background_image'])?sanitize_text_field($_POST['titlebar_background_image']):'0';
     132        $post_metas['titlebar_font_color'] =  isset($_POST['titlebar_font_color'])?sanitize_hex_color($_POST['titlebar_font_color']):'';
     133        $post_metas['titlebar_padding_top']       =  isset($_POST['titlebar_padding_top'])?sanitize_text_field($_POST['titlebar_padding_top']):'';
     134        $post_metas['titlebar_padding_bottom']    =  isset($_POST['titlebar_padding_bottom'])?sanitize_text_field($_POST['titlebar_padding_bottom']):'';
     135       
    129136        $onetone_post_meta = json_encode( $post_metas );
    130137        // Update the meta field.
     
    157164        /************ get nav menus*************/
    158165       
     166        $menus  = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
     167
    159168        $nav_menus[] = array(
    160169            'label'       => __( 'Default', 'onetone-companion' ),
    161170            'value'       => ''
    162171          );
    163         $menus = get_registered_nav_menus();
    164        
    165         foreach ( $menus as $location => $description ) {
     172         
     173        foreach ( $menus as $menu ) {
    166174        $nav_menus[] = array(
    167                     'label'       => $description,
    168                     'value'       => $location
     175                    'label'       => $menu->name,
     176                    'value'       => $menu->term_id
    169177                  );
    170178           
     
    199207        $padding_bottom      = isset( $padding_bottom )? $padding_bottom:'50px';
    200208       
     209        // page title bar
     210        $titlebar_padding_top         = isset( $titlebar_padding_top )? $titlebar_padding_top:'40px';
     211        $titlebar_padding_bottom      = isset( $titlebar_padding_bottom )? $titlebar_padding_bottom:'40px';
     212        $titlebar_font_color      = isset( $titlebar_font_color )? sanitize_hex_color($titlebar_font_color):'#555555';
     213        $titlebar_background_color      = isset( $titlebar_background_color )? sanitize_hex_color($titlebar_background_color):'#f5f5f5';
     214        $titlebar_background_image      = isset( $titlebar_background_image )? esc_url($titlebar_background_image):'';
     215       
    201216        $display_title_bar  = isset( $display_title_bar )? $display_title_bar:'';
    202217       
     
    219234       
    220235       
     236        echo '<p class="meta-options"><label for="titlebar_background_color"  style="display: inline-block;width: 150px;">';
     237        _e( 'Page Title Bar Background Color', 'onetone-companion' );
     238        echo '</label> ';
     239        echo '<input class="oc-color" type="text" name="titlebar_background_color" value="'.$titlebar_background_color.'"/>';
     240        echo '</p>';
     241
     242       
     243        echo '<p class="meta-options"><label for="titlebar_background_image"  style="display: inline-block;width: 150px;">';
     244        _e( 'Page Title Bar Background Image', 'onetone-companion' );
     245        echo '</label>';
     246        echo '<span class="form-group oc-uploader"><input type="text" name="titlebar_background_image" value="'.$titlebar_background_image.'"></span>';
     247        echo '</p>';
     248       
     249        echo '<p class="meta-options"><label for="titlebar_font_color"  style="display: inline-block;width: 150px;">';
     250        _e( 'Page Title Bar Font Color', 'onetone-companion' );
     251        echo '</label> ';
     252        echo '<input class="oc-color" type="text" name="titlebar_font_color" value="'.$titlebar_font_color.'"/>';
     253        echo '</p>';
     254       
     255        echo '<p class="meta-options"><label for="titlebar_padding_top"  style="display: inline-block;width: 150px;">';
     256        _e( 'Title Bar Padding Top', 'onetone-companion' );
     257        echo '</label> ';
     258        echo '<input name="titlebar_padding_top" type="text" value="'.esc_attr($titlebar_padding_top).'" />';
     259        echo '</p>';
     260       
     261        echo '<p class="meta-options"><label for="titlebar_padding_bottom"  style="display: inline-block;width: 150px;">';
     262        _e( 'Title Bar Padding Bottom', 'onetone-companion' );
     263        echo '</label> ';
     264        echo '<input name="titlebar_padding_bottom" type="text" value="'.esc_attr($titlebar_padding_bottom).'" />';
     265        echo '</p>';
     266       
     267       
     268       
    221269        echo '<p class="meta-options"><label for="full_width"  style="display: inline-block;width: 150px;">';
    222270        _e( 'Content Full Width', 'onetone-companion' );
     
    226274        <option '.selected($full_width,'yes',false).' value="yes">'.__("Yes","onetone-companion").'</option>
    227275        </select></p>';
    228        
    229         echo '<p class="meta-options"><label for="padding_top"  style="display: inline-block;width: 150px;">';
    230         _e( 'Padding Top', 'onetone-companion' );
    231         echo '</label> ';
    232         echo '<input name="padding_top" type="text" value="'.esc_attr($padding_top).'" />';
    233         echo '</p>';
    234        
    235         echo '<p class="meta-options"><label for="padding_bottom"  style="display: inline-block;width: 150px;">';
    236         _e( 'Padding Bottom', 'onetone-companion' );
    237         echo '</label> ';
    238         echo '<input name="padding_bottom" type="text" value="'.esc_attr($padding_bottom).'" />';
    239         echo '</p>';
    240        
    241276
    242277        echo '<p class="meta-options"><label for="display_title_bar"  style="display: inline-block;width: 150px;">';
     
    258293        </select></p>';
    259294       
    260                
    261295       
    262296        echo '<p class="meta-options"><label for="page_layout"  style="display: inline-block;width: 150px;">';
     
    270304        </select></p>';
    271305       
     306        echo '<p class="meta-options"><label for="padding_top"  style="display: inline-block;width: 150px;">';
     307        _e( 'Content Padding Top', 'onetone-companion' );
     308        echo '</label> ';
     309        echo '<input name="padding_top" type="text" value="'.esc_attr($padding_top).'" />';
     310        echo '</p>';
     311       
     312        echo '<p class="meta-options"><label for="padding_bottom"  style="display: inline-block;width: 150px;">';
     313        _e( 'Content Padding Bottom', 'onetone-companion' );
     314        echo '</label> ';
     315        echo '<input name="padding_bottom" type="text" value="'.esc_attr($padding_bottom).'" />';
     316        echo '</p>';
     317       
    272318        echo '<p class="meta-options"><label for="left_sidebar"  style="display: inline-block;width: 150px;">';
    273319        _e( 'Select Left Sidebar', 'onetone-companion' );
  • onetone-companion/trunk/onetone-companion.php

    r1916674 r1920945  
    22/*
    33    Plugin Name: OneTone Companion
    4     Description: OneTone theme options and templates importer.
     4    Description: Theme options and templates importer.
    55    Author: MageeWP
    66    Author URI: https://www.mageewp.com/
    7     Version: 1.1.0
     7    Version: 1.1.1
    88    Text Domain: onetone-companion
    99    Domain Path: /languages
     
    2121require_once 'includes/templates-importer/class-site-options-import.php';
    2222require_once 'includes/widget-recent-posts.php';
    23 define( 'ONETONE_COMPANION_VER', '1.1.0' );
     23define( 'ONETONE_COMPANION_VER', '1.1.1' );
    2424
    2525if(!class_exists('OnetoneCompanion')){
     
    5353       
    5454      function admin_scripts() {
    55 
     55         
     56          wp_enqueue_style( 'wp-color-picker' );
     57          wp_enqueue_style('thickbox');
     58          wp_enqueue_script('thickbox');
     59          wp_enqueue_script( 'media-upload');
     60
     61          wp_enqueue_script( 'onetone-companion-admin', plugins_url('assets/js/admin.js', __FILE__),array( 'jquery', 'wp-color-picker' ),ONETONE_COMPANION_VER,true);
     62          wp_enqueue_style( 'onetone-companion-admin-css',  plugins_url( 'assets/css/admin.css',__FILE__ ), '',ONETONE_COMPANION_VER, false );
     63         
    5664          if(isset($_GET['page']) && ( $_GET['page'] == 'onetone-companion' || $_GET['page'] == 'onetone-license' ) )
    57               wp_enqueue_style( 'onetone-companion-admin-css',  plugins_url( 'assets/css/admin.css',__FILE__ ), '',ONETONE_COMPANION_VER, false );
    58              
     65
    5966          if(isset($_GET['page']) && ( $_GET['page']== 'onetone-templates' || $_GET['page']== 'onetone-companion') ){
    6067              wp_enqueue_script( 'onetone-companion-templater', plugins_url('assets/js/templater.js', __FILE__),array( 'jquery', 'wp-util', 'updates' ),ONETONE_COMPANION_VER,true);
    6168              wp_enqueue_style( 'onetone-companion-templater',  plugins_url( 'assets/css/templater.css',__FILE__ ), '',ONETONE_COMPANION_VER, false );
    62              
     69 
    6370              wp_localize_script( 'onetone-companion-templater', 'onetone_companion_admin',
    6471              array(
     
    102109       
    103110    function front_scripts() {
     111       
     112            global $post;
     113           
    104114            wp_enqueue_script( 'onetone-companion-front', plugins_url('assets/js/main.js', __FILE__),array('jquery'),ONETONE_COMPANION_VER,true);
    105115            wp_enqueue_style( 'onetone-companion-front',  plugins_url( 'assets/css/front.css',__FILE__ ), '',ONETONE_COMPANION_VER, false );
     
    110120            'i4'=> __('Message is required.','onetone-companion' ),
    111121            );
     122           
     123            if(is_page()){
     124               
     125                if( isset($post->ID ) ){
     126                    $onetone_page_meta = get_post_meta( $post->ID ,'_onetone_post_meta');
     127                }               
     128                if( isset($onetone_page_meta[0]) && $onetone_page_meta[0]!='' )
     129                    $onetone_page_meta = json_decode( $onetone_page_meta[0],true );
     130                   
     131                    $padding_top     = isset($onetone_page_meta['padding_top'])?$onetone_page_meta['padding_top']:'';
     132                    $padding_bottom  = isset($onetone_page_meta['padding_bottom'])?$onetone_page_meta['padding_bottom']:'';
     133
     134                    $titlebar_background_color = isset($onetone_page_meta['titlebar_background_color'])?$onetone_page_meta['titlebar_background_color']:'';
     135                    $titlebar_background_image = isset($onetone_page_meta['titlebar_background_image'])?$onetone_page_meta['titlebar_background_image']:'';
     136                    $titlebar_font_color = isset($onetone_page_meta['titlebar_font_color'])?$onetone_page_meta['titlebar_font_color']:'';
     137                    $titlebar_padding_top     = isset($onetone_page_meta['titlebar_padding_top'])?$onetone_page_meta['titlebar_padding_top']:'';
     138                    $titlebar_padding_bottom  = isset($onetone_page_meta['titlebar_padding_bottom'])?$onetone_page_meta['titlebar_padding_bottom']:'';
     139                   
     140                    $css = '';
     141                    $container_css = '';
     142                    if( $padding_top )
     143                        $container_css .= 'padding-top:'.esc_attr($padding_top).';';
     144                    if( $padding_bottom )
     145                        $container_css .= 'padding-bottom:'.esc_attr($padding_bottom).';';
     146                   
     147                    $titlebar_css = '';
     148                    if( $titlebar_background_color )
     149                        $titlebar_css .= 'background-color:'.sanitize_hex_color($titlebar_background_color).';';
     150                    if( $titlebar_background_image )
     151                        $titlebar_css .= 'background-image: url('.esc_url($titlebar_background_image).');';
     152                    if( $titlebar_padding_top )
     153                        $titlebar_css .= 'padding-top:'.esc_attr($titlebar_padding_top).';';
     154                    if( $titlebar_padding_bottom )
     155                        $titlebar_css .= 'padding-bottom:'.esc_attr($titlebar_padding_bottom).';';
     156                       
     157                    $css .= '#post-'.$post->ID.' .post-inner{'.$container_css.'}';
     158                    $css .= '#post-'.$post->ID.' .page-title-bar{'.$titlebar_css.'}';
     159                   
     160                    if( $titlebar_font_color )
     161                        $css .= '#post-'.$post->ID.' .page-title-bar,#post-'.$post->ID.' .page-title-bar h1, #post-'.$post->ID.' .page-title-bar a, #post-'.$post->ID.' .page-title-bar span, #post-'.$post->ID.' .page-title-bar i{color:'.sanitize_hex_color($titlebar_font_color).';}';
     162                   
     163                    $css = wp_filter_nohtml_kses($css);
     164                   
     165                    wp_add_inline_style( 'onetone-companion-front', $css );
     166
     167               
     168                }
    112169           
    113170            wp_localize_script( 'onetone-companion-front', 'oc_params', array(
  • onetone-companion/trunk/readme.txt

    r1916674 r1920945  
    1111== Description ==
    1212
    13 Theme options and templates for OneTone theme.
     13Theme options and templates importer.
    1414
    1515== Installation ==
     
    3030
    3131== Changelog ==
     32
     33= 1.1.1 =
     34* Added page option - Page Title Bar Background Color
     35* Added page option - Page Title Bar Background Image
     36* Added page option - Page Title Bar Font Color
     37* Added page option - Title Bar Padding Top
     38* Added page option - Title Bar Padding Bottom
    3239
    3340= 1.1.0 =
Note: See TracChangeset for help on using the changeset viewer.