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