page.php
209 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 | $snippets = SiteOrigin_CSS::single()->get_snippets(); |
| 13 | $user = wp_get_current_user(); |
| 14 | |
| 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'] ) ) { ?> |
| 28 | <div class="notice notice-success"><p><?php esc_html_e( 'Site design updated.', 'so-css' ); ?></p></div> |
| 29 | <?php } ?> |
| 30 | |
| 31 | <?php if ( ! empty( $current_revision ) ) { ?> |
| 32 | <div class="notice notice-warning"> |
| 33 | <p><?php printf( esc_html__( '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 } ?> |
| 36 | |
| 37 | <div id="poststuff"> |
| 38 | <form action="<?php echo esc_url( $form_save_url ); ?>" method="POST"> |
| 39 | |
| 40 | <div id="so-custom-css-info"> |
| 41 | <p class="so-custom-css-submit"> |
| 42 | <input type="submit" name="siteorigin_custom_css_save" class="button-primary" value="<?php esc_attr_e( $save_button_label ); ?>" /> |
| 43 | </p> |
| 44 | |
| 45 | <?php if ( $this->display_teaser() ) { ?> |
| 46 | <div class="postbox"> |
| 47 | <h3 class="hndle"><span><?php esc_html_e( 'Get The Full Experience', 'so-css' ); ?></span></h3> |
| 48 | <div class="inside"> |
| 49 | <?php printf( wp_kses_post( __( '%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>' ); ?> |
| 50 | </div> |
| 51 | </div> |
| 52 | <?php } ?> |
| 53 | |
| 54 | <?php if ( ! get_user_meta( $user->ID, 'socss_hide_gs' ) ) { ?> |
| 55 | <div class="postbox" id="so-custom-css-getting-started"> |
| 56 | <h3 class="hndle"> |
| 57 | <span><?php esc_html_e( 'Getting Started Video', 'so-css' ); ?></span> |
| 58 | <a href="<?php echo wp_nonce_url( admin_url( 'admin-ajax.php?action=socss_hide_getting_started' ), 'hide' ); ?>" class="hide"><?php esc_html_e( 'Dismiss', 'so-css' ); ?></a> |
| 59 | </h3> |
| 60 | <div class="inside"> |
| 61 | <a href="https://siteorigin.com/css/getting-started/" target="_blank"><img src="<?php echo plugin_dir_url( __FILE__ ) . '../css/images/video.jpg'; ?>" /></a> |
| 62 | </div> |
| 63 | </div> |
| 64 | <?php } ?> |
| 65 | |
| 66 | <div class="postbox" id="so-custom-css-revisions"> |
| 67 | <h3 class="hndle"><span><?php esc_html_e( 'CSS Revisions', 'so-css' ); ?></span></h3> |
| 68 | <div class="inside"> |
| 69 | <ol class="custom-revisions-list" data-confirm="<?php esc_attr_e( 'Are you sure you want to load this revision?', 'so-css' ); ?>"> |
| 70 | <?php $this->custom_css_revisions_list( $theme, $socss_post_id, $current_revision ); ?> |
| 71 | </ol> |
| 72 | </div> |
| 73 | </div> |
| 74 | |
| 75 | <div class="postbox" id="so-custom-css-editor-theme"> |
| 76 | <h3 class="hndle"><span><?php esc_html_e( 'Editor Theme', 'so-css' ); ?></span></h3> |
| 77 | <div class="inside"> |
| 78 | <select name="so_css_editor_theme" id="so_css_editor_theme"> |
| 79 | <option value="neat" <?php selected( 'neat', $editor_theme ); ?>><?php esc_attr_e( 'Light', 'so-css' ); ?></option> |
| 80 | <option value="ambiance" <?php selected( 'ambiance', $editor_theme ); ?>><?php esc_attr_e( 'Dark', 'so-css' ); ?></option> |
| 81 | </select> |
| 82 | </div> |
| 83 | </div> |
| 84 | |
| 85 | |
| 86 | <div class="postbox" id="so-custom-css-editor-theme"> |
| 87 | <h3 class="hndle" id="so_css_output_location_label"> |
| 88 | <span> |
| 89 | <?php esc_html_e( 'CSS Output Location', 'so-css' ); ?> |
| 90 | </span> |
| 91 | </h3> |
| 92 | <div class="inside"> |
| 93 | <select |
| 94 | name="so_css_output_location" |
| 95 | id="so_css_output_location" |
| 96 | aria-labelledby="so_css_output_location_label" |
| 97 | aria-described_by="so_css_output_location_description" |
| 98 | > |
| 99 | <option value="file" <?php selected( 'file', $output_location ); ?>><?php esc_attr_e( 'Dedicated File', 'so-css' ); ?></option> |
| 100 | <option value="inline" <?php selected( 'inline', $output_location ); ?>><?php esc_attr_e( 'Inline', 'so-css' ); ?></option> |
| 101 | </select> |
| 102 | |
| 103 | <p id="so_css_output_location_description" class="description"> |
| 104 | <?php |
| 105 | esc_html_e( 'Dedicated CSS File offers best performance, Internal CSS embeds styles in page HTML.', 'so-css' ); |
| 106 | ?> |
| 107 | </p> |
| 108 | </div> |
| 109 | </div> |
| 110 | |
| 111 | </div> |
| 112 | |
| 113 | <div id="so-custom-css-form"> |
| 114 | |
| 115 | <div class="custom-css-toolbar"> |
| 116 | <div class="toolbar-function-buttons"> |
| 117 | <div class="toolbar-functions-dropdown"> |
| 118 | <span class="dashicons dashicons-menu"></span> |
| 119 | </div> |
| 120 | |
| 121 | <ul class="toolbar-buttons"> |
| 122 | </ul> |
| 123 | </div> |
| 124 | |
| 125 | <div class="toolbar-action-buttons"> |
| 126 | <a href="#expand" class="editor-expand socss-button" title="<?php esc_attr_e( 'Open Expanded Mode', 'so-css' ); ?>"> |
| 127 | <span class="so-css-icon so-css-icon-expand" title="<?php esc_attr_e( 'Open Expanded Mode', 'so-css' ); ?>"></span> |
| 128 | <span class="so-css-icon so-css-icon-compress" title="<?php esc_attr_e( 'Close Expanded Mode', 'so-css' ); ?>"></span> |
| 129 | </a> |
| 130 | |
| 131 | <a href="#visual" class="editor-visual socss-button" title="<?php esc_attr_e( 'Open Visual Mode', 'so-css' ); ?>"> |
| 132 | <span class="so-css-icon so-css-icon-eye"></span> |
| 133 | </a> |
| 134 | |
| 135 | <span class="save socss-button button-primary" title="<?php esc_attr_e( 'Save CSS', 'so-css' ); ?>"> |
| 136 | <span class="so-css-icon so-css-icon-save"></span> |
| 137 | </span> |
| 138 | </div> |
| 139 | </div> |
| 140 | |
| 141 | <div class="custom-css-container"> |
| 142 | <textarea |
| 143 | name="siteorigin_custom_css" id="custom-css-textarea" data-theme="<?php echo esc_attr( $editor_theme ); ?>" class="css-editor" rows="<?php echo max( 10, substr_count( $custom_css, "\n" ) + 1 ); ?>"><?php echo esc_textarea( $custom_css ); ?></textarea> |
| 144 | <?php wp_nonce_field( 'custom_css', '_sononce' ); ?> |
| 145 | </div> |
| 146 | <div class="so-css-footer"> |
| 147 | <p class="description"> |
| 148 | <?php esc_html_e( $editor_description ); ?> |
| 149 | </p> |
| 150 | </div> |
| 151 | <?php |
| 152 | if ( |
| 153 | ! class_exists( 'SiteOrigin_Panels' ) && |
| 154 | ! class_exists( 'SiteOrigin_Widgets_Bundle' ) && |
| 155 | ! class_exists( 'SiteOrigin_Premium' ) |
| 156 | ) { |
| 157 | ?> |
| 158 | <div class="installer"> |
| 159 | <a href="#" class="installer-link"> |
| 160 | <?php _e( 'Other Settings', 'so-css' ); ?> |
| 161 | </a> |
| 162 | |
| 163 | <div class="installer-container" style="display: none;"> |
| 164 | <label> |
| 165 | <?php echo __( 'Enable SiteOrigin Installer: ', 'so-css' ); ?> |
| 166 | <input |
| 167 | type="checkbox" |
| 168 | name="installer_status" |
| 169 | class="installer_status" |
| 170 | <?php checked( get_option( 'siteorigin_installer', false ), 1 ); ?> |
| 171 | data-nonce="<?php echo wp_create_nonce( 'siteorigin_installer_status' ); ?>" |
| 172 | > |
| 173 | </label> |
| 174 | </div> |
| 175 | </div> |
| 176 | <?php } ?> |
| 177 | |
| 178 | <div class="custom-css-preview"></div> |
| 179 | |
| 180 | <div class="decoration"></div> |
| 181 | |
| 182 | </div> |
| 183 | |
| 184 | <div id="so-custom-css-properties"> |
| 185 | |
| 186 | <div class="toolbar"> |
| 187 | <select></select> |
| 188 | <div class="close socss-button" title="<?php esc_attr_e( 'Close', 'so-css' ); ?>"> |
| 189 | <span class="so-css-icon so-css-icon-check"></span> |
| 190 | </div> |
| 191 | <div class="save socss-button button-primary" title="<?php esc_attr_e( 'Save CSS', 'so-css' ); ?>"> |
| 192 | <span class="so-css-icon so-css-icon-save"></span> |
| 193 | </div> |
| 194 | </div> |
| 195 | |
| 196 | <ul class="section-tabs"></ul> |
| 197 | |
| 198 | <div class="sections"></div> |
| 199 | |
| 200 | </div> |
| 201 | |
| 202 | </form> |
| 203 | |
| 204 | </div> |
| 205 | |
| 206 | <div class="clear"></div> |
| 207 | |
| 208 | </div> |
| 209 |