Changeset 2210250
- Timestamp:
- 12/11/2019 05:02:13 PM (6 years ago)
- File:
-
- 1 edited
-
book-now/trunk/book-now.php (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
book-now/trunk/book-now.php
r1867949 r2210250 2 2 /** 3 3 * @package Book_Now 4 * @version 1. 4.54 * @version 1.5 5 5 */ 6 6 /* … … 9 9 Description: This plugin adds a fixed call to action button to your site, with text and link to anywhere you want. 10 10 Author: RianGraphics 11 Version: 1. 4.511 Version: 1.5 12 12 Author URI: https://www.riangraphics.com/book-now/ 13 13 */ … … 37 37 register_setting( 'book-now-settings-group', 'rg_btn_pad' ); 38 38 register_setting( 'book-now-settings-group', 'rg_btn_pad_m' ); 39 register_setting( 'book-now-settings-group', 'rg_font_family' ); 39 40 } 40 41 … … 65 66 <p> 66 67 <label for="my_meta_box_enable">Enable/Disable for this page/post</label> 67 <input name="my_meta_box_enable" id="my_meta_box_enable" type="checkbox" value="1" <?php checked( '1', $ text); ?> />68 <input name="my_meta_box_enable" id="my_meta_box_enable" type="checkbox" value="1" <?php checked( '1', $enable ); ?> /> 68 69 </p> 69 70 <p> … … 77 78 <p> 78 79 <label for="my_meta_box_target">Target</label> 79 <select name="my_meta_box_target" id="my_meta_box_target"> 80 <select name="my_meta_box_target" id="my_meta_box_target"> 80 81 <option disabled selected value> -- select an option -- </option> 81 82 <option <?php if($target == '_blank') { echo 'selected';} ?> value="_blank">New window (_blank)</option> 82 <option <?php if($target == '_self') { echo 'selected';} ?> value="_self">Same window (_self)</option> 83 <option <?php if($target == '_self') { echo 'selected';} ?> value="_self">Same window (_self)</option> 83 84 <option <?php if($target == '_parent') { echo 'selected';} ?> value="_parent">Parent frame (_parent)</option> 84 85 <option <?php if($target == '_top') { echo 'selected';} ?> value="_top">Opens the linked document in the full body of the window … … 113 114 <label for="my_meta_box_width">Custom button width ex(200px)</label> 114 115 <input type="text" name="my_meta_box_width" id="my_meta_box_width" value="<?php echo $width; ?>" /> 115 </p> 116 <?php 116 </p> 117 <?php 117 118 } 118 119 add_action( 'save_post', 'rg_meta_box_save' ); … … 125 126 if( !current_user_can( 'edit_post', $post_id ) ) return; 126 127 // now we can actually save the data 127 $allowed = array( 128 $allowed = array( 128 129 'a' => array( // on allow a tags 129 130 'href' => array() // and those anchords can only have href attribute … … 165 166 <?php settings_fields( 'book-now-settings-group' ); ?> 166 167 <?php do_settings_sections( 'book-now-settings-group' ); ?> 168 <?php //echo get_option( 'rg_book_enable' ); ?> 167 169 <table class="form-table"> 168 170 <tr valign="top"> … … 175 177 <td><input type="text" name="rg_book_text" value="<?php echo esc_attr( get_option('rg_book_text', 'Book Now') ); ?>" /></td> 176 178 </tr> 177 179 178 180 <tr valign="top"> 179 181 <th scope="row">Full url</th> 180 182 <td><input type="text" name="rg_book_url" value="<?php echo esc_attr( get_option('rg_book_url', 'http://example.com') ); ?>" /></td> 181 183 </tr> 182 184 183 185 <tr valign="top"> 184 186 <th scope="row">Link Target</th> 185 187 <td> 186 <select name="rg_target"> 188 <select name="rg_target"> 187 189 <option <?php if(get_option('rg_target') == '_blank') { echo 'selected';} ?> value="_blank">New window (_blank)</option> 188 <option <?php if(get_option('rg_target') == '_self') { echo 'selected';} ?> value="_self">Same window (_self)</option> 190 <option <?php if(get_option('rg_target') == '_self') { echo 'selected';} ?> value="_self">Same window (_self)</option> 189 191 <option <?php if(get_option('rg_target') == '_parent') { echo 'selected';} ?> value="_parent">Parent frame (_parent)</option> 190 192 <option <?php if(get_option('rg_target') == '_top') { echo 'selected';} ?> value="_top">Opens the linked document in the full body of the window … … 193 195 </td> 194 196 </tr> 195 197 196 198 <tr valign="top"> 197 199 <th scope="row">Left or Right</th> 198 200 <td> 199 <select name="rg_left_right"> 201 <select name="rg_left_right"> 200 202 <option <?php if(get_option('rg_left_right') == 'left') { echo 'selected';} ?> value="left">Left</option> 201 <option <?php if(get_option('rg_left_right') == 'right') { echo 'selected';} ?> value="right">Right</option> 203 <option <?php if(get_option('rg_left_right') == 'right') { echo 'selected';} ?> value="right">Right</option> 202 204 </select> 203 205 </td> … … 214 216 <th scope="row">Text Color ex(#FFFFFF)</th> 215 217 <td><input type="text" name="rg_text_color" value="<?php echo esc_attr( get_option('rg_text_color', '#FFFFFF') ); ?>" /></td> 218 </tr> 219 <tr valign="top"> 220 <th scope="row">Font Family</th> 221 <td><input type="text" name="rg_font_family" value="<?php echo esc_attr( get_option('rg_font_family', 'Arial') ); ?>" /></td> 216 222 </tr> 217 223 <tr valign="top"> … … 240 246 </tr> 241 247 </table> 242 248 243 249 <?php submit_button(); ?> 244 250 245 251 </form> 246 252 </div> 247 <?php } 253 <?php } 248 254 249 255 250 256 function book_now() { 251 257 252 258 if (get_post_meta(get_the_ID(), 'my_meta_box_text', true)) { 253 259 $mytext = __(get_post_meta(get_the_ID(), 'my_meta_box_text', true)); … … 255 261 $mytext = __(get_option('rg_book_text')); 256 262 } 257 263 258 264 if (get_post_meta(get_the_ID(), 'my_meta_box_url', true)) { 259 265 $myurl = __(get_post_meta(get_the_ID(), 'my_meta_box_url', true)); … … 261 267 $myurl = __(get_option('rg_book_url')); 262 268 } 263 269 264 270 if (get_post_meta(get_the_ID(), 'my_meta_box_enable', true)) { 265 271 $mytrue = __(get_post_meta(get_the_ID(), 'my_meta_box_enable', true)); … … 267 273 $mytrue = get_option( 'rg_book_enable' ); 268 274 } 269 275 270 276 if (get_post_meta(get_the_ID(), 'my_meta_box_target', true)) { 271 277 $target = __(get_post_meta(get_the_ID(), 'my_meta_box_target', true)); … … 273 279 $target = get_option( 'rg_target' ); 274 280 } 275 281 276 282 $pageid = get_option( 'rg_page_id' ); 277 283 if(!empty($pageid)) { 278 284 $truepgid = explode(',',$pageid); 279 280 281 282 if(!is_admin() && $mytrue == 1 && !is_page($truepgid) && !is_single($truepgid)) { 283 285 } else { 286 $truepgid = ""; 287 } 288 289 if(!is_admin() && $mytrue === '1') { 290 if(!empty($truepgid)) { 291 if(!is_page($truepgid) && !is_single($truepgid)) { 284 292 echo " 285 293 <div id='rg-book'> … … 287 295 </div> 288 296 "; 289 } 297 } 298 } else { 299 echo " 300 <div id='rg-book'> 301 <a href='$myurl' target='$target'>$mytext</a> 302 </div> 303 "; 304 } 305 } 290 306 } 291 307 … … 295 311 // We need some CSS to position the paragraph 296 312 function book_css() { 297 313 298 314 if (get_post_meta(get_the_ID(), 'my_meta_box_enable', true)) { 299 315 $mytrue = __(get_post_meta(get_the_ID(), 'my_meta_box_enable', true)); … … 301 317 $mytrue = get_option( 'rg_book_enable' ); 302 318 } 303 319 304 320 if (get_post_meta(get_the_ID(), 'my_meta_box_bg', true)) { 305 321 $bgcolor = __(get_post_meta(get_the_ID(), 'my_meta_box_bg', true)); … … 307 323 $bgcolor = get_option('rg_book_color'); 308 324 } 309 325 310 326 if (get_post_meta(get_the_ID(), 'my_meta_box_txtcolor', true)) { 311 327 $txtcolor = __(get_post_meta(get_the_ID(), 'my_meta_box_txtcolor', true)); … … 313 329 $txtcolor = get_option('rg_text_color'); 314 330 } 315 331 316 332 if (get_post_meta(get_the_ID(), 'my_meta_box_font_size', true)) { 317 333 $fontsize = __(get_post_meta(get_the_ID(), 'my_meta_box_font_size', true)); … … 319 335 $fontsize = get_option('rg_font_size'); 320 336 } 321 337 322 338 if (get_post_meta(get_the_ID(), 'my_meta_box_font_size_m', true)) { 323 339 $fontsizem = __(get_post_meta(get_the_ID(), 'my_meta_box_font_size_m', true)); … … 325 341 $fontsizem = get_option('rg_font_size_m'); 326 342 } 327 343 328 344 if (get_post_meta(get_the_ID(), 'my_meta_box_btn_pad', true)) { 329 345 $btnpad = __(get_post_meta(get_the_ID(), 'my_meta_box_btn_pad', true)); … … 331 347 $btnpad = get_option('rg_btn_pad'); 332 348 } 333 349 334 350 if (get_post_meta(get_the_ID(), 'my_meta_box_btn_pad_m', true)) { 335 351 $btnpadm = __(get_post_meta(get_the_ID(), 'my_meta_box_btn_pad_m', true)); … … 337 353 $btnpadm = get_option('rg_btn_pad_m'); 338 354 } 339 355 340 356 if (get_post_meta(get_the_ID(), 'my_meta_box_width', true)) { 341 357 $customwidth = __(get_post_meta(get_the_ID(), 'my_meta_box_width', true)); … … 343 359 $customwidth = get_option('rg_width'); 344 360 } 345 361 346 362 $mymobile = get_option( 'rg_book_bottom' ); 347 363 $fontfamily = get_option( 'rg_font_family' ); 364 348 365 $lor = get_option('rg_left_right'); 349 366 350 367 $numberofchars = strlen(get_option('rg_book_text')); 351 368 352 369 $totalW = 25 * $numberofchars; 353 370 354 371 $distance = 10 * $numberofchars; 355 372 356 373 $deg = ''; 357 374 358 375 if($lor == 'right') { 359 376 $deg = '-90deg'; … … 386 403 text-transform:uppercase; 387 404 font-size:'.$fontsize.'; 388 font-weight:700; 405 font-weight:700; 406 font-family:'.$fontfamily.'; 389 407 } 390 408 @media screen and (max-width:767px) { … … 410 428 font-size:'.$fontsizem.'; 411 429 font-weight:700; 412 430 413 431 } 414 432 }
Note: See TracChangeset
for help on using the changeset viewer.