-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor code to use namespace and improve security.
* Add custom avatar upload to settings page. * Update language file. * Update readme txt and md files.
- Loading branch information
1 parent
bae6b98
commit 19873c5
Showing
17 changed files
with
983 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
plugin setting styles | ||
*/ | ||
.azrcrv-ui-tabs { | ||
display: block; | ||
position: relative; | ||
margin-bottom: 6px; | ||
overflow: auto; | ||
} | ||
.azrcrv-ui-tabs .azrcrv-ui-tabs-nav { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: left; | ||
background: transparent; | ||
border: none; | ||
font-size: 1.3em; | ||
} | ||
.azrcrv-ui-tabs-nav .azrcrv-ui-state-default a{ | ||
border: 1px solid grey; | ||
border-bottom: 4px solid grey; | ||
color: grey; | ||
background: transparent; | ||
font-weight: 700; | ||
padding: 6px; | ||
} | ||
.azrcrv-ui-tabs-nav .azrcrv-ui-state-active a{ | ||
border: 1px solid #007FFF; | ||
border-bottom: 4px solid #007FFF; | ||
color: #007FFF; | ||
background: transparent; | ||
font-weight: 700; | ||
padding: 6px; | ||
} | ||
.azrcrv-ui-tabs-nav .azrcrv-ui-state-default a:hover{ | ||
border: 1px solid #0000ff; | ||
border-bottom: 4px solid #0000ff; | ||
color: #0000ff; | ||
background: transparent; | ||
font-weight: 700; | ||
padding: 6px; | ||
} | ||
.azrcrv-ui-tabs-scroll { | ||
margin-top: -12px; | ||
border: 1px solid grey; | ||
padding: 12px; | ||
} | ||
.azrcrv-ui-tabs-hidden{ | ||
display: none; | ||
} | ||
table.azrcrv-settings{ | ||
} | ||
th.azrcrv-settings-section-heading { | ||
margin: 0; | ||
padding: 0; | ||
padding-left: 6px; | ||
line-height: 1em; | ||
border-bottom: 5px solid #007fff; | ||
} | ||
h2.azrcrv-settings-section-heading { | ||
line-height: 1em; | ||
} | ||
table.azrcrv.settings th { | ||
padding-left: 12px; | ||
} | ||
div.azrcrv-donate { | ||
color: #007fff; | ||
font-size: 1.25em; | ||
font-weight: 700; | ||
text-align: center; | ||
float:right; | ||
width: 300px; | ||
} | ||
div.azrcrv-donate span { | ||
font-size: 1em; | ||
color: #000; | ||
font-weight: 400; | ||
} | ||
/* | ||
other styles | ||
*/ | ||
tr.user-profile-picture{ | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
// Whereof one cannot speak, thereof one must be silent. | ||
// Whereof one cannot speak, thereof one must be silent. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
// Whereof one cannot speak, thereof one must be silent. | ||
// Whereof one cannot speak, thereof one must be silent. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Tabs | ||
*/ | ||
jQuery( | ||
function($) { | ||
'use strict'; | ||
|
||
$( '#tabs ul li a' ).on( | ||
'keyup click', | ||
function(e) { | ||
if (e.key === 'Enter' || e.type === 'click') { | ||
var id = $( this ).attr( 'href' ); | ||
$( '.azrcrv-ui-state-active' ).removeClass( 'azrcrv-ui-state-active' ).attr( 'aria-selected', 'false' ).attr( 'aria-expanded', 'false' ); | ||
$( this ).parent( 'li' ).addClass( 'azrcrv-ui-state-active' ).attr( 'aria-selected', 'true' ).attr( 'aria-expanded', 'true' ); | ||
$( this ).closest( 'ul' ).siblings().addClass( 'azrcrv-ui-tabs-hidden' ).attr( 'aria-hidden', 'true' ); | ||
$( id ).removeClass( 'azrcrv-ui-tabs-hidden' ).attr( 'aria-hidden', 'false' ); | ||
e.preventDefault(); | ||
} | ||
} | ||
); | ||
|
||
$( '#tabs ul li a' ).hover( | ||
function() { $( this ).addClass( 'azrcrv-ui-state-hover' ); }, | ||
function() { $( this ).removeClass( 'azrcrv-ui-state-hover' ); } | ||
); | ||
} | ||
); | ||
|
||
/* | ||
* Adapted from: http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in-plugins/ | ||
*/ | ||
jQuery( document ).ready( | ||
function($){ | ||
// remove standard avatar display | ||
// jQuery('table.form-table tr.user-profile-picture').remove(); | ||
|
||
// Uploading files | ||
var file_frame; | ||
|
||
$( '#azrcrv-a-upload-avatar' ).on( | ||
'click', | ||
function( event ){ | ||
|
||
event.preventDefault(); | ||
|
||
// If the media frame already exists, reopen it. | ||
if ( file_frame ) { | ||
file_frame.open(); | ||
return; | ||
} | ||
|
||
// Create the media frame. | ||
file_frame = wp.media.frames.file_frame = wp.media( | ||
{ | ||
title: $( this ).data( 'uploader_title' ), | ||
button: { | ||
text: $( this ).data( 'uploader_button_text' ), | ||
}, | ||
multiple: false // Set to true to allow multiple files to be selected | ||
} | ||
); | ||
|
||
// When an image is selected, run a callback. | ||
file_frame.on( | ||
'select', | ||
function() { | ||
// We set multiple to false so only get one image from the uploader | ||
attachment = file_frame.state().get( 'selection' ).first().toJSON(); | ||
|
||
// Do something with attachment.id and/or attachment.url here | ||
jQuery( '#custom-default-avatar' ).attr( 'value',attachment.url ); | ||
jQuery( '#custom-default-avatar-src' ).attr( 'src',attachment.url ); | ||
} | ||
); | ||
|
||
// Finally, open the modal | ||
file_frame.open(); | ||
} | ||
); | ||
$( '#azrcrv-a-remove-avatar' ).on( | ||
'click', | ||
function( event ){ | ||
|
||
// remove image and url | ||
jQuery( '#custom-default-avatar' ).attr( 'value','' ); | ||
jQuery( '#custom-default-avatar-src' ).attr( 'src','' ); | ||
|
||
} | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
// Whereof one cannot speak, thereof one must be silent. | ||
// Whereof one cannot speak, thereof one must be silent. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<?php | ||
// Whereof one cannot speak, thereof one must be silent. | ||
// Whereof one cannot speak, thereof one must be silent. |
Oops, something went wrong.