page.php
135 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @var $custom_css string The custom CSS string to be edited. |
| 4 | * @var $current_revision int If the CSS to be edited is a revision, this will contain the timestamp of the revision. |
| 5 | * @var $custom_css_revisions array Saved revisions for the current theme. |
| 6 | */ |
| 7 | |
| 8 | $snippets = SiteOrigin_CSS::single()->get_snippets(); |
| 9 | $user = wp_get_current_user(); |
| 10 | if ( ! empty( $current_revision ) ) { |
| 11 | $revision_date = date( 'j F Y @ H:i:s', $current_revision + get_option( 'gmt_offset' ) * 60 * 60 ); |
| 12 | } |
| 13 | ?> |
| 14 | |
| 15 | <div class="wrap" id="siteorigin-custom-css"> |
| 16 | <h2> |
| 17 | <img src="<?php echo plugin_dir_url(__FILE__) . '../css/images/icon.png' ?>" class="icon" /> |
| 18 | <?php _e( 'SiteOrigin CSS', 'so-css' ) ?> |
| 19 | </h2> |
| 20 | |
| 21 | |
| 22 | <?php if( isset($_POST['siteorigin_custom_css_save']) ) : ?> |
| 23 | <div class="notice notice-success"><p><?php _e('Site design updated.', 'so-css') ?></p></div> |
| 24 | <?php endif; ?> |
| 25 | |
| 26 | <?php if ( ! empty( $current_revision ) ) : ?> |
| 27 | <div class="notice notice-warning"> |
| 28 | <p><?php printf( __( 'Editing revision dated %s. Click %sRevert to this revision%s to keep using it.', 'so-css'), $revision_date, '<em>', '</em>' ) ?></p> |
| 29 | </div> |
| 30 | <?php endif; ?> |
| 31 | |
| 32 | <div id="poststuff"> |
| 33 | <div id="so-custom-css-info"> |
| 34 | |
| 35 | <?php if( $this->display_teaser() ) : ?> |
| 36 | <div class="postbox"> |
| 37 | <h3 class="hndle"><span><?php _e('Get The Full Experience', 'so-css') ?></span></h3> |
| 38 | <div class="inside"> |
| 39 | <?php printf( __( '%sSiteOrigin Premium%s adds a <strong>Google Web Font</strong> selector to SiteOrigin CSS so you can easily change any font.', 'so-css' ) , '<a href="https://siteorigin.com/downloads/premium/?featured_addon=plugins/web-font-selector" target="_blank">', '</a>' ); ?> |
| 40 | </div> |
| 41 | </div> |
| 42 | <?php endif; ?> |
| 43 | |
| 44 | <?php if( !get_user_meta( $user->ID, 'socss_hide_gs' ) ) : ?> |
| 45 | <div class="postbox" id="so-custom-css-getting-started"> |
| 46 | <h3 class="hndle"> |
| 47 | <span><?php _e('Getting Started Video', 'so-css') ?></span> |
| 48 | <a href="<?php echo wp_nonce_url( admin_url('admin-ajax.php?action=socss_hide_getting_started'), 'hide' ) ?>" class="hide"><?php _e('Dismiss', 'so-css') ?></a> |
| 49 | </h3> |
| 50 | <div class="inside"> |
| 51 | <a href="https://siteorigin.com/css/getting-started/" target="_blank"><img src="<?php echo plugin_dir_url(__FILE__).'../css/images/video.jpg' ?>" /></a> |
| 52 | </div> |
| 53 | </div> |
| 54 | <?php endif; ?> |
| 55 | |
| 56 | <div class="postbox" id="so-custom-css-revisions"> |
| 57 | <h3 class="hndle"><span><?php _e('CSS Revisions', 'so-css') ?></span></h3> |
| 58 | <div class="inside"> |
| 59 | <ol class="custom-revisions-list" data-confirm="<?php esc_attr_e('Are you sure you want to load this revision?', 'so-css') ?>"> |
| 60 | <?php |
| 61 | $this->custom_css_revisions_list( $theme, $socss_post_id, $current_revision ); |
| 62 | ?> |
| 63 | </ol> |
| 64 | </div> |
| 65 | </div> |
| 66 | |
| 67 | </div> |
| 68 | |
| 69 | <form action="<?php echo esc_url( admin_url('themes.php?page=so_custom_css') ) ?>" method="POST" id="so-custom-css-form"> |
| 70 | |
| 71 | <div class="custom-css-toolbar"> |
| 72 | <div class="toolbar-function-buttons"> |
| 73 | <div class="toolbar-functions-dropdown"> |
| 74 | <span class="dashicons dashicons-menu"></span> |
| 75 | </div> |
| 76 | |
| 77 | <ul class="toolbar-buttons"> |
| 78 | </ul> |
| 79 | </div> |
| 80 | |
| 81 | <div class="toolbar-action-buttons"> |
| 82 | |
| 83 | <a href="#visual" class="editor-visual socss-button"> |
| 84 | <span class="fa fa-eye"></span> |
| 85 | </a> |
| 86 | |
| 87 | <a href="#expand" class="editor-expand socss-button"> |
| 88 | <span class="fa fa-expand"></span> |
| 89 | <span class="fa fa-compress"></span> |
| 90 | </a> |
| 91 | </div> |
| 92 | </div> |
| 93 | |
| 94 | <div class="custom-css-container"> |
| 95 | <textarea name="custom_css" id="custom-css-textarea" class="css-editor" rows="<?php echo max( 10, substr_count( $custom_css, "\n" ) + 1 ) ?>"><?php echo esc_textarea( $custom_css ) ?></textarea> |
| 96 | <?php wp_nonce_field( 'custom_css', '_sononce' ) ?> |
| 97 | </div> |
| 98 | <p class="description"><?php echo SiteOrigin_CSS::editor_description(); ?></p> |
| 99 | |
| 100 | <p class="submit"> |
| 101 | <input type="submit" name="siteorigin_custom_css_save" class="button-primary" value="<?php esc_attr_e( ( ! empty ( $current_revision ) ? __( 'Revert to this revision', 'so-css' ) : __( 'Save CSS', 'so-css' ) ) ); ?>" /> |
| 102 | </p> |
| 103 | |
| 104 | <div class="custom-css-preview"> |
| 105 | |
| 106 | </div> |
| 107 | |
| 108 | <div class="decoration"></div> |
| 109 | |
| 110 | </form> |
| 111 | |
| 112 | <div id="so-custom-css-properties"> |
| 113 | |
| 114 | <div class="toolbar"> |
| 115 | <select> |
| 116 | </select> |
| 117 | <div class="close socss-button"> |
| 118 | <span class="fa fa-check"></span> |
| 119 | </div> |
| 120 | </div> |
| 121 | |
| 122 | <ul class="section-tabs"> |
| 123 | </ul> |
| 124 | |
| 125 | <div class="sections"> |
| 126 | </div> |
| 127 | |
| 128 | </div> |
| 129 | |
| 130 | </div> |
| 131 | |
| 132 | <div class="clear"></div> |
| 133 | |
| 134 | </div> |
| 135 |