diff --git a/css/jquery.qtip.min.css b/css/jquery.qtip.min.css deleted file mode 100644 index 947c8f9..0000000 --- a/css/jquery.qtip.min.css +++ /dev/null @@ -1 +0,0 @@ -.ui-tooltip,.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;}.ui-tooltip-fluid{display:block;visibility:hidden;position:static!important;float:left!important;}.ui-tooltip-content{position:relative;padding:5px 9px;overflow:hidden;border:1px solid #000001;text-align:left;word-wrap:break-word;overflow:hidden;}.ui-tooltip-titlebar{position:relative;min-height:14px;padding:5px 35px 5px 10px;overflow:hidden;border:1px solid #000001;border-width:1px 1px 0;font-weight:bold;}.ui-tooltip-titlebar+.ui-tooltip-content{border-top-width:0!important;}/*!Default close button class */ .ui-tooltip-titlebar .ui-state-default{position:absolute;right:4px;top:50%;margin-top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;}* html .ui-tooltip-titlebar .ui-state-default{top:16px;}.ui-tooltip-titlebar .ui-icon,.ui-tooltip-icon .ui-icon{display:block;text-indent:-1000em;}.ui-tooltip-icon,.ui-tooltip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}.ui-tooltip-icon .ui-icon{width:18px;height:14px;text-align:center;text-indent:0;font:normal bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em;}/*!Default tooltip style */ .ui-tooltip-default .ui-tooltip-titlebar,.ui-tooltip-default .ui-tooltip-content{border-color:#F1D031;background-color:#FFFFA3;color:#555;}.ui-tooltip-default .ui-tooltip-titlebar{background-color:#FFEF93;}.ui-tooltip-default .ui-tooltip-icon{border-color:#CCC;background:#F1F1F1;color:#777;}.ui-tooltip-default .ui-tooltip-titlebar .ui-state-hover{border-color:#AAA;color:#111;}.ui-tooltip .ui-tooltip-tip{margin:0 auto;overflow:hidden;z-index:10;}.ui-tooltip .ui-tooltip-tip,.ui-tooltip .ui-tooltip-tip *{position:absolute;line-height:.1px!important;font-size:.1px!important;color:#123456;background:transparent;border:0 dashed transparent;}.ui-tooltip .ui-tooltip-tip canvas{top:0;left:0;}#qtip-overlay{position:fixed;left:-10000em;top:-10000em;}#qtip-overlay.blurs{cursor:pointer;}#qtip-overlay div{position:absolute;left:0;top:0;width:100%;height:100%;background-color:black;opacity:.7;filter:alpha(opacity=70);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";}/*!Light tooltip style */ .ui-tooltip-light .ui-tooltip-titlebar,.ui-tooltip-light .ui-tooltip-content{border-color:#E2E2E2;color:#454545;}.ui-tooltip-light .ui-tooltip-content{background-color:white;}.ui-tooltip-light .ui-tooltip-titlebar{background-color:#f1f1f1;}/*!Dark tooltip style */ .ui-tooltip-dark .ui-tooltip-titlebar,.ui-tooltip-dark .ui-tooltip-content{border-color:#303030;color:#f3f3f3;}.ui-tooltip-dark .ui-tooltip-content{background-color:#505050;}.ui-tooltip-dark .ui-tooltip-titlebar{background-color:#404040;}.ui-tooltip-dark .ui-tooltip-icon{border-color:#444;}.ui-tooltip-dark .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}/*!Cream tooltip style */ .ui-tooltip-cream .ui-tooltip-titlebar,.ui-tooltip-cream .ui-tooltip-content{border-color:#F9E98E;color:#A27D35;}.ui-tooltip-cream .ui-tooltip-content{background-color:#FBF7AA;}.ui-tooltip-cream .ui-tooltip-titlebar{background-color:#F0DE7D;}.ui-tooltip-cream .ui-state-default .ui-tooltip-icon{background-position:-82px 0;}/*!Red tooltip style */ .ui-tooltip-red .ui-tooltip-titlebar,.ui-tooltip-red .ui-tooltip-content{border-color:#D95252;color:#912323;}.ui-tooltip-red .ui-tooltip-content{background-color:#F78B83;}.ui-tooltip-red .ui-tooltip-titlebar{background-color:#F06D65;}.ui-tooltip-red .ui-state-default .ui-tooltip-icon{background-position:-102px 0;}.ui-tooltip-red .ui-tooltip-icon{border-color:#D95252;}.ui-tooltip-red .ui-tooltip-titlebar .ui-state-hover{border-color:#D95252;}/*!Green tooltip style */ .ui-tooltip-green .ui-tooltip-titlebar,.ui-tooltip-green .ui-tooltip-content{border-color:#90D93F;color:#3F6219;}.ui-tooltip-green .ui-tooltip-content{background-color:#CAED9E;}.ui-tooltip-green .ui-tooltip-titlebar{background-color:#B0DE78;}.ui-tooltip-green .ui-state-default .ui-tooltip-icon{background-position:-42px 0;}/*!Blue tooltip style */ .ui-tooltip-blue .ui-tooltip-titlebar,.ui-tooltip-blue .ui-tooltip-content{border-color:#ADD9ED;color:#5E99BD;}.ui-tooltip-blue .ui-tooltip-content{background-color:#E5F6FE;}.ui-tooltip-blue .ui-tooltip-titlebar{background-color:#D0E9F5;}.ui-tooltip-blue .ui-state-default .ui-tooltip-icon{background-position:-2px 0;}/*!Add shadows to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE6+,Safari 2+*/ .ui-tooltip-shadow{-webkit-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);-moz-box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);box-shadow:1px 1px 3px 1px rgba(0,0,0,0.15);}.ui-tooltip-shadow .ui-tooltip-titlebar,.ui-tooltip-shadow .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3);-ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Color='gray',Direction=135,Strength=3)";_margin-bottom:-3px;.margin-bottom:-3px;}/*!Add rounded corners to your tooltips in:FF3+,Chrome 2+,Opera 10.6+,IE9+,Safari 2+*/ .ui-tooltip-rounded,.ui-tooltip-rounded .ui-tooltip-content,.ui-tooltip-tipsy,.ui-tooltip-tipsy .ui-tooltip-content,.ui-tooltip-youtube,.ui-tooltip-youtube .ui-tooltip-content{-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px;}.ui-tooltip-rounded .ui-tooltip-titlebar,.ui-tooltip-tipsy .ui-tooltip-titlebar,.ui-tooltip-youtube .ui-tooltip-titlebar{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;}.ui-tooltip-rounded .ui-tooltip-titlebar+.ui-tooltip-content,.ui-tooltip-tipsy .ui-tooltip-titlebar+.ui-tooltip-content,.ui-tooltip-youtube .ui-tooltip-titlebar+.ui-tooltip-content{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px;}/*!Youtube tooltip style */ .ui-tooltip-youtube{-webkit-box-shadow:0 0 3px #333;-moz-box-shadow:0 0 3px #333;box-shadow:0 0 3px #333;}.ui-tooltip-youtube .ui-tooltip-titlebar,.ui-tooltip-youtube .ui-tooltip-content{_margin-bottom:0;.margin-bottom:0;background:transparent;background:rgba(0,0,0,0.85);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";color:white;border-color:#CCC;}.ui-tooltip-youtube .ui-tooltip-icon{border-color:#222;}.ui-tooltip-youtube .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-jtools{background:#232323;background:rgba(0,0,0,0.7);background-image:-moz-linear-gradient(top,#717171,#232323);background-image:-webkit-gradient(linear,left top,left bottom,from(#717171),to(#232323));border:2px solid #ddd;border:2px solid rgba(241,241,241,1);-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 12px #333;-moz-box-shadow:0 0 12px #333;box-shadow:0 0 12px #333;}.ui-tooltip-jtools .ui-tooltip-titlebar{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)";}.ui-tooltip-jtools .ui-tooltip-content{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)";}.ui-tooltip-jtools .ui-tooltip-titlebar,.ui-tooltip-jtools .ui-tooltip-content{background:transparent;color:white;border:0 dashed transparent;}.ui-tooltip-jtools .ui-tooltip-icon{border-color:#555;}.ui-tooltip-jtools .ui-tooltip-titlebar .ui-state-hover{border-color:#333;}.ui-tooltip-cluetip{-webkit-box-shadow:4px 4px 5px rgba(0,0,0,0.4);-moz-box-shadow:4px 4px 5px rgba(0,0,0,0.4);box-shadow:4px 4px 5px rgba(0,0,0,0.4);}.ui-tooltip-cluetip .ui-tooltip-titlebar{background-color:#87876A;color:white;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-content{background-color:#D9D9C2;color:#111;border:0 dashed transparent;}.ui-tooltip-cluetip .ui-tooltip-icon{border-color:#808064;}.ui-tooltip-cluetip .ui-tooltip-titlebar .ui-state-hover{border-color:#696952;color:#696952;}.ui-tooltip-tipsy{border:0;}.ui-tooltip-tipsy .ui-tooltip-titlebar,.ui-tooltip-tipsy .ui-tooltip-content{_margin-bottom:0;.margin-bottom:0;background:transparent;background:rgba(0,0,0,.87);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#D9000000,endColorstr=#D9000000)";color:white;border:0 transparent;font-size:11px;font-family:'Lucida Grande',sans-serif;font-weight:bold;line-height:16px;text-shadow:0 1px black;}.ui-tooltip-tipsy .ui-tooltip-titlebar{padding:6px 35px 0 10;}.ui-tooltip-tipsy .ui-tooltip-content{padding:6px 10;}.ui-tooltip-tipsy .ui-tooltip-icon{border-color:#222;text-shadow:none;}.ui-tooltip-tipsy .ui-tooltip-titlebar .ui-state-hover{border-color:#303030;}.ui-tooltip-tipped .ui-tooltip-titlebar,.ui-tooltip-tipped .ui-tooltip-content{border:3px solid #959FA9;filter:none;-ms-filter:none;}.ui-tooltip-tipped .ui-tooltip-titlebar{background:#3A79B8;background-image:-moz-linear-gradient(top,#3A79B8,#2E629D);background-image:-webkit-gradient(linear,left top,left bottom,from(#3A79B8),to(#2E629D));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)";color:white;font-weight:normal;font-family:serif;border-bottom-width:0;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;}.ui-tooltip-tipped .ui-tooltip-content{background-color:#F9F9F9;color:#454545;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}.ui-tooltip-tipped .ui-tooltip-icon{border:2px solid #285589;background:#285589;}.ui-tooltip-tipped .ui-tooltip-icon .ui-icon{background-color:#FBFBFB;color:#555;}.ui-tooltip:not(.ie9haxors) div.ui-tooltip-content,.ui-tooltip:not(.ie9haxors) div.ui-tooltip-titlebar{filter:none;-ms-filter:none;} \ No newline at end of file diff --git a/css/smoothness/jquery-ui-1.8.11.custom.css b/css/smoothness/jquery-ui-1.8.11.custom.css index 4c57c5b..69b0a33 100644 --- a/css/smoothness/jquery-ui-1.8.11.custom.css +++ b/css/smoothness/jquery-ui-1.8.11.custom.css @@ -59,20 +59,25 @@ #ZotpressMetaBox .ui-widget { } #ZotpressMetaBox .ui-widget .ui-widget { font-size: 1em; } /*#ZotpressMetaBox .ui-widget input, #ZotpressMetaBox .ui-widget select, #ZotpressMetaBox .ui-widget textarea, #ZotpressMetaBox .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }*/ -#ZotpressMetaBox .ui-widget-content { border: none; background: transparent; color: #222222; } +#ZotpressMetaBox .ui-widget-content { border: none; background: transparent; color: #555d66; } #ZotpressMetaBox .ui-widget-content a { color: #222222; } -#ZotpressMetaBox .ui-widget-header { border: 0; background: #F5F5F5; color: #222222; font-weight: normal; font-size: 0.85em !important; text-transform: uppercase; } +#ZotpressMetaBox .ui-widget-header { + /* border: 0; background: #fff; color: #222222; font-weight: normal; */ + font-size: 0.85em !important; text-transform: uppercase; +} #ZotpressMetaBox .ui-widget-header a { color: #222222; } /* Interaction states ----------------------------------*/ -#ZotpressMetaBox .ui-state-default, #ZotpressMetaBox .ui-widget-content .ui-state-default, #ZotpressMetaBox .ui-widget-header .ui-state-default { border: none; background: #e6e6e6; color: #666; float: left; margin: 0.35em 0 0 0.35em; } +/* #ZotpressMetaBox .ui-state-default, #ZotpressMetaBox .ui-widget-content .ui-state-default, #ZotpressMetaBox .ui-widget-header .ui-state-default { border: none; background: #fff; color: #222; float: left; margin: 0; padding: 8px 4px; } */ +/* #ZotpressMetaBox .ui-state-default:before, #ZotpressMetaBox .ui-widget-content .ui-state-default:before, #ZotpressMetaBox .ui-widget-header .ui-state-default:before { content: " "; display: block; background: url('images/ui-icons_222222_256x240.png') -111px 335px; width: 20px; height: 14px; float: left; } */ #ZotpressMetaBox .ui-state-default a, #ZotpressMetaBox .ui-state-default a:link, #ZotpressMetaBox .ui-state-default a:visited { color: #555555; text-decoration: none; } -#ZotpressMetaBox .ui-state-hover, #ZotpressMetaBox .ui-widget-content .ui-state-hover, #ZotpressMetaBox .ui-widget-header .ui-state-hover, #ZotpressMetaBox .ui-state-focus, #ZotpressMetaBox .ui-widget-content .ui-state-focus, #ZotpressMetaBox .ui-widget-header .ui-state-focus { background: #ccc; color: #000; } +#ZotpressMetaBox .ui-state-hover, #ZotpressMetaBox .ui-widget-content .ui-state-hover, #ZotpressMetaBox .ui-widget-header .ui-state-hover, #ZotpressMetaBox .ui-state-focus, #ZotpressMetaBox .ui-widget-content .ui-state-focus, #ZotpressMetaBox .ui-widget-header .ui-state-focus { } #ZotpressMetaBox .ui-state-hover a, #ZotpressMetaBox .ui-state-hover a:hover { color: #212121; text-decoration: none; } -#ZotpressMetaBox .ui-state-active, #ZotpressMetaBox .ui-widget-content .ui-state-active, #ZotpressMetaBox .ui-widget-header .ui-state-active { border: none; background: #ffffff; color: #222; } -#ZotpressMetaBox .ui-state-active a, #ZotpressMetaBox .ui-state-active a:link, #ZotpressMetaBox .ui-state-active a:visited { color: #212121; text-decoration: none; } -#ZotpressMetaBox .ui-widget :active { outline: none; } +/* #ZotpressMetaBox .ui-state-active, #ZotpressMetaBox .ui-widget-content .ui-state-active, #ZotpressMetaBox .ui-widget-header .ui-state-active { border: none; background: #ffffff; color: #222; } */ +/* #ZotpressMetaBox .ui-state-active:before, #ZotpressMetaBox .ui-widget-content .ui-state-active:before, #ZotpressMetaBox .ui-widget-header .ui-state-active:before { content: " "; display: block; background: url('images/ui-icons_222222_256x240.png') -206px 287px; width: 20px; height: 14px; float: left; } */ +#ZotpressMetaBox .ui-state-active a, #ZotpressMetaBox .ui-state-active a:link, #ZotpressMetaBox .ui-state-active a:visited, #ZotpressMetaBox .ui-state-active a:focus { color: #212121; text-decoration: none; } +#ZotpressMetaBox .ui-widget :active, #ZotpressMetaBox .ui-widget :focus { outline: none; box-shadow: none; } /* Interaction Cues ----------------------------------*/ @@ -304,7 +309,7 @@ #ZotpressMetaBox .ui-tabs { position: relative; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ #ZotpressMetaBox .ui-tabs #ZotpressMetaBox .ui-tabs-nav { margin: 0; padding: 0 0 0 1px; } #ZotpressMetaBox .ui-tabs #ZotpressMetaBox .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 1px 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -#ZotpressMetaBox .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +/* #ZotpressMetaBox .ui-tabs .ui-tabs-nav li a { float: left; padding: 0; text-decoration: none; } */ #ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } #ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, #ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-state-disabled a, #ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } #ZotpressMetaBox .ui-tabs .ui-tabs-nav li a, #ZotpressMetaBox .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ @@ -331,7 +336,7 @@ #ZotpressMetaBox .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } #ZotpressMetaBox .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } #ZotpressMetaBox .ui-datepicker select.ui-datepicker-month-year {width: 100%;} -#ZotpressMetaBox .ui-datepicker select.ui-datepicker-month, +#ZotpressMetaBox .ui-datepicker select.ui-datepicker-month, #ZotpressMetaBox .ui-datepicker select.ui-datepicker-year { width: 49%;} #ZotpressMetaBox .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } #ZotpressMetaBox .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } @@ -377,4 +382,4 @@ left: -4px; /*must have*/ width: 200px; /*must have*/ height: 200px; /*must have*/ -} \ No newline at end of file +} diff --git a/css/smoothness/jquery-ui-1.8.11.custom.min.css b/css/smoothness/jquery-ui-1.8.11.custom.min.css new file mode 100644 index 0000000..9e2c25f --- /dev/null +++ b/css/smoothness/jquery-ui-1.8.11.custom.min.css @@ -0,0 +1 @@ +#ZotpressMetaBox .ui-helper-hidden{display:none}#ZotpressMetaBox .ui-helper-hidden-accessible{position:absolute!important;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}#ZotpressMetaBox .ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}#ZotpressMetaBox .ui-helper-clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}#ZotpressMetaBox .ui-helper-clearfix{display:inline-block}* html #ZotpressMetaBox .ui-helper-clearfix{height:1%}#ZotpressMetaBox .ui-helper-clearfix{display:block}#ZotpressMetaBox .ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}#ZotpressMetaBox .ui-state-disabled{cursor:default!important}#ZotpressMetaBox .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}#ZotpressMetaBox .ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}#ZotpressMetaBox .ui-widget .ui-widget{font-size:1em}#ZotpressMetaBox .ui-widget-content{border:none;background:0 0;color:#555d66}#ZotpressMetaBox .ui-widget-content a{color:#222}#ZotpressMetaBox .ui-widget-header{font-size:.85em!important;text-transform:uppercase}#ZotpressMetaBox .ui-widget-header a{color:#222}#ZotpressMetaBox .ui-state-default a,#ZotpressMetaBox .ui-state-default a:link,#ZotpressMetaBox .ui-state-default a:visited{color:#555;text-decoration:none}#ZotpressMetaBox .ui-state-hover a,#ZotpressMetaBox .ui-state-hover a:hover{color:#212121;text-decoration:none}#ZotpressMetaBox .ui-state-active a,#ZotpressMetaBox .ui-state-active a:focus,#ZotpressMetaBox .ui-state-active a:link,#ZotpressMetaBox .ui-state-active a:visited{color:#212121;text-decoration:none}#ZotpressMetaBox .ui-widget :active,#ZotpressMetaBox .ui-widget :focus{outline:0;box-shadow:none}#ZotpressMetaBox .ui-state-highlight,#ZotpressMetaBox .ui-widget-content .ui-state-highlight,#ZotpressMetaBox .ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color:#363636}#ZotpressMetaBox .ui-state-highlight a,#ZotpressMetaBox .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}#ZotpressMetaBox .ui-state-error,#ZotpressMetaBox .ui-widget-content .ui-state-error,#ZotpressMetaBox .ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;color:#cd0a0a}#ZotpressMetaBox .ui-state-error a,#ZotpressMetaBox .ui-widget-content .ui-state-error a,#ZotpressMetaBox .ui-widget-header .ui-state-error a{color:#cd0a0a}#ZotpressMetaBox .ui-state-error-text,#ZotpressMetaBox .ui-widget-content .ui-state-error-text,#ZotpressMetaBox .ui-widget-header .ui-state-error-text{color:#cd0a0a}#ZotpressMetaBox .ui-priority-primary,#ZotpressMetaBox .ui-widget-content .ui-priority-primary,#ZotpressMetaBox .ui-widget-header .ui-priority-primary{font-weight:700}#ZotpressMetaBox .ui-priority-secondary,#ZotpressMetaBox .ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}#ZotpressMetaBox .ui-state-disabled,#ZotpressMetaBox .ui-widget-content .ui-state-disabled,#ZotpressMetaBox .ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}#ZotpressMetaBox .ui-icon{width:16px;height:16px;background-image:url(images/ui-icons_222222_256x240.png)}#ZotpressMetaBox .ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}#ZotpressMetaBox .ui-widget-header .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}#ZotpressMetaBox .ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png)}#ZotpressMetaBox .ui-state-focus .ui-icon,#ZotpressMetaBox .ui-state-hover .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}#ZotpressMetaBox .ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}#ZotpressMetaBox .ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png)}#ZotpressMetaBox .ui-state-error .ui-icon,#ZotpressMetaBox .ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png)}#ZotpressMetaBox .ui-icon-carat-1-n{background-position:0 0}#ZotpressMetaBox .ui-icon-carat-1-ne{background-position:-16px 0}#ZotpressMetaBox .ui-icon-carat-1-e{background-position:-32px 0}#ZotpressMetaBox .ui-icon-carat-1-se{background-position:-48px 0}#ZotpressMetaBox .ui-icon-carat-1-s{background-position:-64px 0}#ZotpressMetaBox .ui-icon-carat-1-sw{background-position:-80px 0}#ZotpressMetaBox .ui-icon-carat-1-w{background-position:-96px 0}#ZotpressMetaBox .ui-icon-carat-1-nw{background-position:-112px 0}#ZotpressMetaBox .ui-icon-carat-2-n-s{background-position:-128px 0}#ZotpressMetaBox .ui-icon-carat-2-e-w{background-position:-144px 0}#ZotpressMetaBox .ui-icon-triangle-1-n{background-position:0 -16px}#ZotpressMetaBox .ui-icon-triangle-1-ne{background-position:-16px -16px}#ZotpressMetaBox .ui-icon-triangle-1-e{background-position:-32px -16px}#ZotpressMetaBox .ui-icon-triangle-1-se{background-position:-48px -16px}#ZotpressMetaBox .ui-icon-triangle-1-s{background-position:-64px -16px}#ZotpressMetaBox .ui-icon-triangle-1-sw{background-position:-80px -16px}#ZotpressMetaBox .ui-icon-triangle-1-w{background-position:-96px -16px}#ZotpressMetaBox .ui-icon-triangle-1-nw{background-position:-112px -16px}#ZotpressMetaBox .ui-icon-triangle-2-n-s{background-position:-128px -16px}#ZotpressMetaBox .ui-icon-triangle-2-e-w{background-position:-144px -16px}#ZotpressMetaBox .ui-icon-arrow-1-n{background-position:0 -32px}#ZotpressMetaBox .ui-icon-arrow-1-ne{background-position:-16px -32px}#ZotpressMetaBox .ui-icon-arrow-1-e{background-position:-32px -32px}#ZotpressMetaBox .ui-icon-arrow-1-se{background-position:-48px -32px}#ZotpressMetaBox .ui-icon-arrow-1-s{background-position:-64px -32px}#ZotpressMetaBox .ui-icon-arrow-1-sw{background-position:-80px -32px}#ZotpressMetaBox .ui-icon-arrow-1-w{background-position:-96px -32px}#ZotpressMetaBox .ui-icon-arrow-1-nw{background-position:-112px -32px}#ZotpressMetaBox .ui-icon-arrow-2-n-s{background-position:-128px -32px}#ZotpressMetaBox .ui-icon-arrow-2-ne-sw{background-position:-144px -32px}#ZotpressMetaBox .ui-icon-arrow-2-e-w{background-position:-160px -32px}#ZotpressMetaBox .ui-icon-arrow-2-se-nw{background-position:-176px -32px}#ZotpressMetaBox .ui-icon-arrowstop-1-n{background-position:-192px -32px}#ZotpressMetaBox .ui-icon-arrowstop-1-e{background-position:-208px -32px}#ZotpressMetaBox .ui-icon-arrowstop-1-s{background-position:-224px -32px}#ZotpressMetaBox .ui-icon-arrowstop-1-w{background-position:-240px -32px}#ZotpressMetaBox .ui-icon-arrowthick-1-n{background-position:0 -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-ne{background-position:-16px -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-e{background-position:-32px -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-se{background-position:-48px -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-s{background-position:-64px -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-sw{background-position:-80px -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-w{background-position:-96px -48px}#ZotpressMetaBox .ui-icon-arrowthick-1-nw{background-position:-112px -48px}#ZotpressMetaBox .ui-icon-arrowthick-2-n-s{background-position:-128px -48px}#ZotpressMetaBox .ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}#ZotpressMetaBox .ui-icon-arrowthick-2-e-w{background-position:-160px -48px}#ZotpressMetaBox .ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}#ZotpressMetaBox .ui-icon-arrowthickstop-1-n{background-position:-192px -48px}#ZotpressMetaBox .ui-icon-arrowthickstop-1-e{background-position:-208px -48px}#ZotpressMetaBox .ui-icon-arrowthickstop-1-s{background-position:-224px -48px}#ZotpressMetaBox .ui-icon-arrowthickstop-1-w{background-position:-240px -48px}#ZotpressMetaBox .ui-icon-arrowreturnthick-1-w{background-position:0 -64px}#ZotpressMetaBox .ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}#ZotpressMetaBox .ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}#ZotpressMetaBox .ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}#ZotpressMetaBox .ui-icon-arrowreturn-1-w{background-position:-64px -64px}#ZotpressMetaBox .ui-icon-arrowreturn-1-n{background-position:-80px -64px}#ZotpressMetaBox .ui-icon-arrowreturn-1-e{background-position:-96px -64px}#ZotpressMetaBox .ui-icon-arrowreturn-1-s{background-position:-112px -64px}#ZotpressMetaBox .ui-icon-arrowrefresh-1-w{background-position:-128px -64px}#ZotpressMetaBox .ui-icon-arrowrefresh-1-n{background-position:-144px -64px}#ZotpressMetaBox .ui-icon-arrowrefresh-1-e{background-position:-160px -64px}#ZotpressMetaBox .ui-icon-arrowrefresh-1-s{background-position:-176px -64px}#ZotpressMetaBox .ui-icon-arrow-4{background-position:0 -80px}#ZotpressMetaBox .ui-icon-arrow-4-diag{background-position:-16px -80px}#ZotpressMetaBox .ui-icon-extlink{background-position:-32px -80px}#ZotpressMetaBox .ui-icon-newwin{background-position:-48px -80px}#ZotpressMetaBox .ui-icon-refresh{background-position:-64px -80px}#ZotpressMetaBox .ui-icon-shuffle{background-position:-80px -80px}#ZotpressMetaBox .ui-icon-transfer-e-w{background-position:-96px -80px}#ZotpressMetaBox .ui-icon-transferthick-e-w{background-position:-112px -80px}#ZotpressMetaBox .ui-icon-folder-collapsed{background-position:0 -96px}#ZotpressMetaBox .ui-icon-folder-open{background-position:-16px -96px}#ZotpressMetaBox .ui-icon-document{background-position:-32px -96px}#ZotpressMetaBox .ui-icon-document-b{background-position:-48px -96px}#ZotpressMetaBox .ui-icon-note{background-position:-64px -96px}#ZotpressMetaBox .ui-icon-mail-closed{background-position:-80px -96px}#ZotpressMetaBox .ui-icon-mail-open{background-position:-96px -96px}#ZotpressMetaBox .ui-icon-suitcase{background-position:-112px -96px}#ZotpressMetaBox .ui-icon-comment{background-position:-128px -96px}#ZotpressMetaBox .ui-icon-person{background-position:-144px -96px}#ZotpressMetaBox .ui-icon-print{background-position:-160px -96px}#ZotpressMetaBox .ui-icon-trash{background-position:-176px -96px}#ZotpressMetaBox .ui-icon-locked{background-position:-192px -96px}#ZotpressMetaBox .ui-icon-unlocked{background-position:-208px -96px}#ZotpressMetaBox .ui-icon-bookmark{background-position:-224px -96px}#ZotpressMetaBox .ui-icon-tag{background-position:-240px -96px}#ZotpressMetaBox .ui-icon-home{background-position:0 -112px}#ZotpressMetaBox .ui-icon-flag{background-position:-16px -112px}#ZotpressMetaBox .ui-icon-calendar{background-position:-32px -112px}#ZotpressMetaBox .ui-icon-cart{background-position:-48px -112px}#ZotpressMetaBox .ui-icon-pencil{background-position:-64px -112px}#ZotpressMetaBox .ui-icon-clock{background-position:-80px -112px}#ZotpressMetaBox .ui-icon-disk{background-position:-96px -112px}#ZotpressMetaBox .ui-icon-calculator{background-position:-112px -112px}#ZotpressMetaBox .ui-icon-zoomin{background-position:-128px -112px}#ZotpressMetaBox .ui-icon-zoomout{background-position:-144px -112px}#ZotpressMetaBox .ui-icon-search{background-position:-160px -112px}#ZotpressMetaBox .ui-icon-wrench{background-position:-176px -112px}#ZotpressMetaBox .ui-icon-gear{background-position:-192px -112px}#ZotpressMetaBox .ui-icon-heart{background-position:-208px -112px}#ZotpressMetaBox .ui-icon-star{background-position:-224px -112px}#ZotpressMetaBox .ui-icon-link{background-position:-240px -112px}#ZotpressMetaBox .ui-icon-cancel{background-position:0 -128px}#ZotpressMetaBox .ui-icon-plus{background-position:-16px -128px}#ZotpressMetaBox .ui-icon-plusthick{background-position:-32px -128px}#ZotpressMetaBox .ui-icon-minus{background-position:-48px -128px}#ZotpressMetaBox .ui-icon-minusthick{background-position:-64px -128px}#ZotpressMetaBox .ui-icon-close{background-position:-80px -128px}#ZotpressMetaBox .ui-icon-closethick{background-position:-96px -128px}#ZotpressMetaBox .ui-icon-key{background-position:-112px -128px}#ZotpressMetaBox .ui-icon-lightbulb{background-position:-128px -128px}#ZotpressMetaBox .ui-icon-scissors{background-position:-144px -128px}#ZotpressMetaBox .ui-icon-clipboard{background-position:-160px -128px}#ZotpressMetaBox .ui-icon-copy{background-position:-176px -128px}#ZotpressMetaBox .ui-icon-contact{background-position:-192px -128px}#ZotpressMetaBox .ui-icon-image{background-position:-208px -128px}#ZotpressMetaBox .ui-icon-video{background-position:-224px -128px}#ZotpressMetaBox .ui-icon-script{background-position:-240px -128px}#ZotpressMetaBox .ui-icon-alert{background-position:0 -144px}#ZotpressMetaBox .ui-icon-info{background-position:-16px -144px}#ZotpressMetaBox .ui-icon-notice{background-position:-32px -144px}#ZotpressMetaBox .ui-icon-help{background-position:-48px -144px}#ZotpressMetaBox .ui-icon-check{background-position:-64px -144px}#ZotpressMetaBox .ui-icon-bullet{background-position:-80px -144px}#ZotpressMetaBox .ui-icon-radio-off{background-position:-96px -144px}#ZotpressMetaBox .ui-icon-radio-on{background-position:-112px -144px}#ZotpressMetaBox .ui-icon-pin-w{background-position:-128px -144px}#ZotpressMetaBox .ui-icon-pin-s{background-position:-144px -144px}#ZotpressMetaBox .ui-icon-play{background-position:0 -160px}#ZotpressMetaBox .ui-icon-pause{background-position:-16px -160px}#ZotpressMetaBox .ui-icon-seek-next{background-position:-32px -160px}#ZotpressMetaBox .ui-icon-seek-prev{background-position:-48px -160px}#ZotpressMetaBox .ui-icon-seek-end{background-position:-64px -160px}#ZotpressMetaBox .ui-icon-seek-start{background-position:-80px -160px}#ZotpressMetaBox .ui-icon-seek-first{background-position:-80px -160px}#ZotpressMetaBox .ui-icon-stop{background-position:-96px -160px}#ZotpressMetaBox .ui-icon-eject{background-position:-112px -160px}#ZotpressMetaBox .ui-icon-volume-off{background-position:-128px -160px}#ZotpressMetaBox .ui-icon-volume-on{background-position:-144px -160px}#ZotpressMetaBox .ui-icon-power{background-position:0 -176px}#ZotpressMetaBox .ui-icon-signal-diag{background-position:-16px -176px}#ZotpressMetaBox .ui-icon-signal{background-position:-32px -176px}#ZotpressMetaBox .ui-icon-battery-0{background-position:-48px -176px}#ZotpressMetaBox .ui-icon-battery-1{background-position:-64px -176px}#ZotpressMetaBox .ui-icon-battery-2{background-position:-80px -176px}#ZotpressMetaBox .ui-icon-battery-3{background-position:-96px -176px}#ZotpressMetaBox .ui-icon-circle-plus{background-position:0 -192px}#ZotpressMetaBox .ui-icon-circle-minus{background-position:-16px -192px}#ZotpressMetaBox .ui-icon-circle-close{background-position:-32px -192px}#ZotpressMetaBox .ui-icon-circle-triangle-e{background-position:-48px -192px}#ZotpressMetaBox .ui-icon-circle-triangle-s{background-position:-64px -192px}#ZotpressMetaBox .ui-icon-circle-triangle-w{background-position:-80px -192px}#ZotpressMetaBox .ui-icon-circle-triangle-n{background-position:-96px -192px}#ZotpressMetaBox .ui-icon-circle-arrow-e{background-position:-112px -192px}#ZotpressMetaBox .ui-icon-circle-arrow-s{background-position:-128px -192px}#ZotpressMetaBox .ui-icon-circle-arrow-w{background-position:-144px -192px}#ZotpressMetaBox .ui-icon-circle-arrow-n{background-position:-160px -192px}#ZotpressMetaBox .ui-icon-circle-zoomin{background-position:-176px -192px}#ZotpressMetaBox .ui-icon-circle-zoomout{background-position:-192px -192px}#ZotpressMetaBox .ui-icon-circle-check{background-position:-208px -192px}#ZotpressMetaBox .ui-icon-circlesmall-plus{background-position:0 -208px}#ZotpressMetaBox .ui-icon-circlesmall-minus{background-position:-16px -208px}#ZotpressMetaBox .ui-icon-circlesmall-close{background-position:-32px -208px}#ZotpressMetaBox .ui-icon-squaresmall-plus{background-position:-48px -208px}#ZotpressMetaBox .ui-icon-squaresmall-minus{background-position:-64px -208px}#ZotpressMetaBox .ui-icon-squaresmall-close{background-position:-80px -208px}#ZotpressMetaBox .ui-icon-grip-dotted-vertical{background-position:0 -224px}#ZotpressMetaBox .ui-icon-grip-dotted-horizontal{background-position:-16px -224px}#ZotpressMetaBox .ui-icon-grip-solid-vertical{background-position:-32px -224px}#ZotpressMetaBox .ui-icon-grip-solid-horizontal{background-position:-48px -224px}#ZotpressMetaBox .ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}#ZotpressMetaBox .ui-icon-grip-diagonal-se{background-position:-80px -224px}#ZotpressMetaBox .ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px}#ZotpressMetaBox .ui-corner-tr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px}#ZotpressMetaBox .ui-corner-bl{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}#ZotpressMetaBox .ui-corner-br{-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}#ZotpressMetaBox .ui-corner-bottom{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}#ZotpressMetaBox .ui-corner-right{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}#ZotpressMetaBox .ui-corner-left{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}#ZotpressMetaBox .ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}#ZotpressMetaBox .ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);-moz-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}#ZotpressMetaBox .ui-tabs{position:relative;zoom:1}#ZotpressMetaBox .ui-tabs #ZotpressMetaBox .ui-tabs-nav{margin:0;padding:0 0 0 1px}#ZotpressMetaBox .ui-tabs #ZotpressMetaBox .ui-tabs-nav li{list-style:none;float:left;position:relative;top:1px;margin:0 1px 1px 0;border-bottom:0!important;padding:0;white-space:nowrap}#ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-tabs-selected{margin-bottom:0;padding-bottom:1px}#ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-state-disabled a,#ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-state-processing a,#ZotpressMetaBox .ui-tabs .ui-tabs-nav li.ui-tabs-selected a{cursor:text}#ZotpressMetaBox .ui-tabs .ui-tabs-nav li a,#ZotpressMetaBox .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{cursor:pointer}#ZotpressMetaBox .ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:0;background:0 0}#ZotpressMetaBox .ui-tabs .ui-tabs-hide{display:none!important}#ZotpressMetaBox .ui-datepicker{width:17em;padding:.2em .2em 0;display:none}#ZotpressMetaBox .ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}#ZotpressMetaBox .ui-datepicker .ui-datepicker-next,#ZotpressMetaBox .ui-datepicker .ui-datepicker-prev{position:absolute;top:2px;width:1.8em;height:1.8em}#ZotpressMetaBox .ui-datepicker .ui-datepicker-next-hover,#ZotpressMetaBox .ui-datepicker .ui-datepicker-prev-hover{top:1px}#ZotpressMetaBox .ui-datepicker .ui-datepicker-prev{left:2px}#ZotpressMetaBox .ui-datepicker .ui-datepicker-next{right:2px}#ZotpressMetaBox .ui-datepicker .ui-datepicker-prev-hover{left:1px}#ZotpressMetaBox .ui-datepicker .ui-datepicker-next-hover{right:1px}#ZotpressMetaBox .ui-datepicker .ui-datepicker-next span,#ZotpressMetaBox .ui-datepicker .ui-datepicker-prev span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}#ZotpressMetaBox .ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}#ZotpressMetaBox .ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}#ZotpressMetaBox .ui-datepicker select.ui-datepicker-month-year{width:100%}#ZotpressMetaBox .ui-datepicker select.ui-datepicker-month,#ZotpressMetaBox .ui-datepicker select.ui-datepicker-year{width:49%}#ZotpressMetaBox .ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}#ZotpressMetaBox .ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}#ZotpressMetaBox .ui-datepicker td{border:0;padding:1px}#ZotpressMetaBox .ui-datepicker td a,#ZotpressMetaBox .ui-datepicker td span{display:block;padding:.2em;text-align:right;text-decoration:none}#ZotpressMetaBox .ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}#ZotpressMetaBox .ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}#ZotpressMetaBox .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}#ZotpressMetaBox .ui-datepicker.ui-datepicker-multi{width:auto}#ZotpressMetaBox .ui-datepicker-multi .ui-datepicker-group{float:left}#ZotpressMetaBox .ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}#ZotpressMetaBox .ui-datepicker-multi-2 .ui-datepicker-group{width:50%}#ZotpressMetaBox .ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}#ZotpressMetaBox .ui-datepicker-multi-4 .ui-datepicker-group{width:25%}#ZotpressMetaBox .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}#ZotpressMetaBox .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}#ZotpressMetaBox .ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}#ZotpressMetaBox .ui-datepicker-row-break{clear:both;width:100%}#ZotpressMetaBox .ui-datepicker-rtl{direction:rtl}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-group{float:right}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}#ZotpressMetaBox .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}#ZotpressMetaBox .ui-datepicker-cover{display:none;display:block;position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px} diff --git a/css/zotpress.admin.css b/css/zotpress.admin.css new file mode 100644 index 0000000..21a9c64 --- /dev/null +++ b/css/zotpress.admin.css @@ -0,0 +1,1392 @@ + + +/* START OF BASIC ZOTPRESS CSS */ + +div#zp-Zotpress select { + cursor: pointer; +} + +div#zp-Zotpress div.zp-Col-1 { + float: left; + width: 350px; +} +div#zp-Zotpress div.zp-Col-2 { + float: left; +} + +#adminmenu .current .wp-menu-image img { + opacity: 1.0; + /* filter: alpha(opacity = 100); */ +} + +div#zp-Zotpress del { + color: #aaa; + text-decoration: none; +} + +div#zp-Setup h3, +div#zp-Zotpress h3 { + clear: both; + font: 400 27px/32px "Helvetica", "Helvetica Neue", "Arial", sans-serif; + margin: 0; + font-weight: bold; + padding: 9px 15px 4px 0; + text-transform: none; +} +div#zp-Setup h3.pair { + border-bottom: 0; + padding: 15px 30px 0; +} + +div.zp-Collection-Title, +div#zp-Setup h4, +div#zp-Zotpress h4 { + font: italic 400 17px/21px "Georgia", serif; + margin: 1.5em 0 1em; +} +div#zp-Setup h4 { + font: italic 400 16px/21px "Georgia", serif; +} +div#zp-Setup h4.pair { + border-bottom: 1px solid #eee; + margin: 0; + padding: 10px 30px 25px; +} + +div#zp-Zotpress h5 { + font: 300 11px/30px "Georgia", serif; + margin-bottom: -15px; + text-transform: uppercase; +} + +div#zp-Zotpress hr { + border: none; + border-top: 1px solid #ddd; + clear: both; + margin: 3.3em 0 0.7em; + height: 1px; +} +div#zp-Setup hr.clear, +div#zp-Zotpress hr.clear { + border: none; + margin-bottom: 0; +} + +div#zp-Setup ul, +div#zp-Zotpress ul { + list-style: none; + margin: 20px 0 25px; + padding: 0; +} +div#zp-Setup ul li, +div#zp-Zotpress ul li { + background: url('../images/sprite.png') no-repeat -40px -60px; + padding-left: 15px; + margin-left: 5px; + margin-bottom: 10px; + list-style: none; +} + +div#zp-Zotpress form hr.clear { + margin: 0; + padding: 0; + height: 1px; +} + +div#zp-Zotpress p.example { + font-family: monospace; + font-size: 1.1em; +} + +/* END OF BASIC ZOTPRESS CSS */ + + + +/* START OF SETUP CSS */ + +div#zp-Setup { + border-bottom: 1px solid #ccc; + margin-right: 1.5em; + width: auto; + min-width: 549px; +} +div#zp-Setup div#zp-Zotpress-Navigation { + z-index: 1; + position: relative; + margin-bottom: 0; +} +div.zp-Setup-Step, +div#zp-Setup-Step { + z-index: 0; + position: relative; + background-color: #fff; + padding: 1em 0 0.65em; +} +div.zp-Setup-Step.second { + border-top: 1px solid #eee; +} +div.zp-Setup-Step.second:before, +div.zp-Setup-Step.second:after { + display: table; + content: ""; +} +div.zp-Setup-Step.second:after { + clear: both; +} + +div#zp-Setup h3 { + padding: 15px 30px 25px; + border-bottom: 1px solid #eee; +} +div#zp-Setup-Step hr { + clear: both; + border: none; + padding: 0; + margin: 1em 0; + height: 1px; + background: none; + border-top: 1px solid #eee; +} +div#zp-Setup-Step hr.clear { + margin: 0; +} + +div#zp-Setup div.zp-Column-1, +div#zp-Setup div.zp-Column-2 { + float: left; + margin-left: 30px; + width: 400px; +} + +div#zp-Setup p.note { + color: #666; + font-size: 0.9em; + font-style: italic; + margin: -10px 0 10px 0; +} + +div#zp-Setup div.zp-Zotpress-Options { + margin-bottom: 2em; +} + +div#zp-Zotpress-Setup-Buttons { + clear: both; + border-top: 1px solid #eee; +} +a#zp-Setup-Cancel, +div#zp-Zotpress-Setup-Buttons a, +div#zp-Zotpress-Setup-Buttons input { + margin: 1em 30px 0.5em; + float: right; +} +a#zp-Setup-Cancel { + float: none; +} +div#zp-Zotpress-Setup-Buttons a#zp-Import-Accounts-Button { + margin-right: 0; +} +div#zp-Zotpress-Setup-Buttons a#zp-Import-Browse-Button { + margin-left: 10px; +} + +div#zp-Setup div.zp-Zotpress-Options div.zp-Success, +div#zp-Setup div.zp-Zotpress-Options div.zp-Loading, +div#zp-Setup div.zp-Zotpress-Options div.zp-Errors { + float: left; + height: 32px; +} +div#zp-Setup div.zp-Zotpress-Options div.zp-Success, +div#zp-Setup div.zp-Zotpress-Options div.zp-Errors { + margin-top: 14px; + margin-bottom: 0; + padding-left: 35px; + height: 24px; +} +div#zp-Setup div.zp-Zotpress-Options div.zp-Success { + background-position: 0 -82px; +} +div#zp-Setup div.zp-Zotpress-Options div.zp-Errors { + background-position: 0 -146px; +} +div#zp-Setup div.zp-Zotpress-Options div.zp-Loading { + margin-top: 6px; +} + + +div#zp-Setup div.zp-Column, +div#zp-Zotpress div.zp-Column { + border-bottom: 1px solid #eee; +} +div#zp-Setup div.zp-Column div.zp-Column-Inner { + padding: 0 25px; +} + + +div.zp-Step-Import, +div#zp-Step-Import { + padding: 10px 30px; +} +.second div.zp-Step-Import { + padding-top: 0; +} +div#zp-Zotpress-Setup-Import-Buttons { + margin-top: 2em; +} +input#zp-Zotpress-Setup-Import, +.wp-core-ui input.zp-Import-Button.button-secondary { + margin: 0 0.5em 1em 0; + float: left; +} +div#zp-Step-Import-Collection { + background-color: #f9f9f9; + clear: both; + margin-top: 1em; + width: 36.75em; + height: 13.5em; +} +div#zp-Step-Import-Collection.loading { + background: #f9f9f9 url('../images/loading_default.gif') no-repeat center; +} +div#zp-Step-Import-Collection iframe { + width: 100%; +} +#zp-Zotpress-Setup-Import-Selective { + float: left; + margin: 1em 0; +} + + +iframe#zp-Setup-Import { + position: absolute; + top: 0; + right: 0; + margin: 0; + padding: 0; + + /* LIVE */ + visibility: hidden; + width: 50px; + height: 35px; + + /* DEBUGGING */ + /*border: 3px solid #eee;*/ + /*width: 350px;*/ + /*height: 200px;*/ +} + +div.zp-Loading-Container { + clear: both; + padding-top: 0.75em; +} +div.zp-Loading-Container:before, +div.zp-Loading-Container:after { + content: ""; + display: table; +} +div.zp-Loading-Container:after { + clear: both; +} +div.zp-Loading-Container.selective { + clear: none; + padding-top: 0; +} +div.zp-Loading-Initial.zp-Loading-Import { + background: transparent url('../images/loading_import.gif') no-repeat 0 6px; + display: none; + float: left; + margin: 0; + width: 70px; + height: 20px; +} +div.zp-Loading-Initial.zp-Loading-Import.selective { + margin-top: 1.35em; + margin-left: 1em; +} +div.zp-Import-Messages { + color: #999; + font: italic 9px/20px Georgia,"Times New Roman","Bitstream Charter",Times,serif; + display: none; + float: left; + margin: 0 0 0 1em; +} +div.zp-Import-Messages.selective { + margin-top: 1.95em; +} + +div.Zotpress_update_notice .notice-dismiss.text { + position: static; + color: inherit; + text-decoration: underline; + padding: 0; +} +div.Zotpress_update_notice .notice-dismiss.text::before { + display: none; +} + + + +/* START OF SETUP CHECK */ + +#zp-Setup-Check { + padding: 1.5em 30px; +} +#zp-Setup-Check-Message.error { + background: #fceae9; +} +#zp-Setup-Check-Message.updated { + background: #eef9e6; +} +div#zp-Setup-Check-Message.error strong em { + color: #E14D43; + font-style: normal; +} +div#zp-Setup-Check-Message.updated strong em { + color: #7AD03A; + font-style: normal; +} + + + +/* START OF ADD FORM CSS */ + +form#zp-Add { + padding: 0; + margin: 0; +} +*:first-child+html form#zp-Add { /* IE7 hack */ + /*width: 850px;*/ +} +form#zp-Add fieldset { + background: transparent; + border: none; + margin: 0; + padding: 0; +} +form#zp-Add div.field { + clear: both; + padding: 2.2em 2.4em; +} + +form#zp-Add label, +form#zp-Add select, +form#zp-Add textarea, +form#zp-Add input, +form#zp-Add aside { + display: block; + float: left; +} +form#zp-Add select, +form#zp-Add textarea, +form#zp-Add input { + margin: -4px 0 0; +} +form#zp-Add input#private_key { + min-width: 18em; +} +form#zp-Add label { + font: italic 400 1.1em/1.25em "Georgia", serif; + width: 20%; +} +form#zp-Add label.required { + background: url('../images/sprite.png') no-repeat 0 -36px; + padding-left: 15px; + margin-left: -15px; +} +form#zp-Add aside { + float: right; + margin-top: -8px; + width: 40%; +} +form#zp-Add aside p { + font-size: 0.85em; + margin: 0 0 0 1em; +} +form#zp-Add .last aside p { + padding-bottom: 2em; +} + +form#zp-Add input#upload_image, +form#zp-Add input#upload_image_button { + display: inline; +}/* Remove once converted to WP types w/ post image? */ + +#zp-Setup div.proceed { + border-top: 1px solid #eee; + clear: both; + width: 100%; +} +#zp-Setup div.proceed input#zp-Connect, +#zp-Setup div.proceed input#zp-Connect-Next { + margin: 1em 30px 0.5em; + float: right; +} +/* Thanks to http://nicolasgallagher.com/micro-clearfix-hack/ */ +#zp-Setup div.proceed:before, +#zp-Setup div.proceed:after { + content: ""; + display: table; +} +#zp-Setup div.proceed:after { + clear: both; +} + +form#zp-Add div.message { + position: absolute; + bottom: 1.1em; + right: 8.5em; + width: 100%; +} +div.zp-Loading { + background: transparent url('../images/loading_default.gif') no-repeat center; + display: none; + float: right; + letter-spacing: -1000px; + overflow: hidden; + text-indent: -5000px; + margin: 0 0 0; + width: 30px; + height: 30px; +} +div.zp-Errors, +div.zp-Success { + display: none; + float: right; + font-weight: bold; + margin: 0 0 0; + padding-left: 35px; +} +div.zp-Errors { + background: url('../images/sprite.png') no-repeat 0 -139px; + color: #990033; +} +div.zp-Success { + background: url('../images/sprite.png') no-repeat 0 -76px; + color: #009966; +} +div.zp-Errors p, +div.zp-Success p { + margin: 5px 0; +} + +/* END OF SETUP CSS */ + + + +/* START OF LOADING CSS */ + +div.zp-Loading-Initial { + background: transparent url('../images/loading_initial.gif') no-repeat -3px 10px; + margin: 0; + padding: 0; + width: 220px; + height: 18px; +} +div.zp-Loading-Initial h2 { + margin-bottom: -12px; +} +iframe#zp-Loading-Initial { + visibility: hidden; +} + +/* END OF LOADING CSS */ + + + +/* START TABS */ + +div#zp-Zotpress-Navigation { + border-bottom: 1px solid #ccc; + margin: 10px 0 20px; + overflow: visible; + /*height: 47px;*/ + height: 49px; +} + +div#zp-Zotpress-Navigation h1 { + font: 600 18px/24px "Helvetica", Arial, sans-serif; + float: left; + margin: 0; + padding: 0.45em 5em 1em 0; + text-transform: uppercase; +} +div#zp-Zotpress-Navigation h1 em { + color: #c23d35; + font-style: normal; +} + +/* Nav Items */ + +div#zp-Zotpress-Navigation .nav-item, +div#zp-Zotpress-Navigation :visited.nav-item { + color: #000; + display: block; + float: left; + /*font: normal 15px/24px "Helvetica", "Helvetica Neue", "Arial", sans-serif;*/ + font: normal 1em/2.15em "Helvetica", "Helvetica Neue", "Arial", sans-serif; + padding: 0.75em 1.5em; + outline: none; + text-transform: uppercase; + text-decoration: none; +} +div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation .nav-item, +div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation :visited.nav-item { + color: #bbb; +} + +div#zp-Zotpress-Navigation :hover.nav-item { + border-bottom: 0.25em solid #000; +} +div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation :hover.nav-item { + border-bottom: none; +} + +div#zp-Zotpress-Navigation :focus.nav-item, +div#zp-Zotpress-Navigation :active.nav-item, +div#zp-Zotpress-Navigation .active.nav-item { + background-color: #eaeaea; + border-bottom: 0.25em solid #000; + box-shadow: none; +} + +div#zp-Zotpress-Navigation .nav-item.nav-tab-active, +div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active, +div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active:hover, +div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active:active { + border-bottom: 0.25em solid #E14D43; + background-color: transparent; + color: #000; +} + +div#zp-Zotpress-Navigation .nav-item.nav-tab-active strong { + font-weight: bold; + margin-right: 0.25em; +} + +div#zp-Icon { + float: left; + margin-right: 8px; + text-align: center; + width: 48px; + height: 48px; +} +div#zp-Icon img { + display: inline; + padding-top: 6px; + width: 32px; +} + +/* END TABS */ + + + +/* START BROWSE */ + +/* from ID to class: + +zp-Options-Wrapper +zp-Browse-Wrapper +zp-Browse-Bar +.zp-Browse-Collections, +.zp-Browse-Tags + +*/ + +div#zp-Zotpress div#zp-Options-Wrapper, +div#zp-Zotpress div.zp-Browse-Wrapper { + position: relative; + background-color: #fff; + border-bottom: 1px solid #ccc; + margin-top: -20px; + padding: 1em 0 0; +} +div#zp-Zotpress div#zp-Options-Wrapper:before, +div#zp-Zotpress div#zp-Options-Wrapper:after { + content: ""; + display: table; +} +div#zp-Zotpress div#zp-Options-Wrapper:after { + clear: both; +} +div#zp-Zotpress div#zp-Options-Wrapper h3, +div#zp-Zotpress div.zp-Browse-Wrapper h3 { + padding: 15px 30px 25px; +} +div#zp-Zotpress div#zp-Options-Wrapper h3 { + border-bottom: 1px solid #eee; +} + +div#zp-Zotpress div#zp-Options-Wrapper hr { + border-color: #eee; + margin-bottom: 0; +} +div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-1, +div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-2 { + border-color: #eee; + margin-right: 0; + width: 49.5%; +} +div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-Inner { + padding: 0 25px; +} + + +/* Browse Dropdowns */ + +.zp-Browse-Bar { + border: none; + padding: 0 30px; +} +.zp-Browse-Bar:after { + clear: both; + content: ""; + display: table; +} + +.zp-Browse-Collections, +.zp-Browse-Tags { + float: left; + width: 50%; +} +.zp-Browse-Select { + /* padding: 0 30px; */ + margin-right: 15px; + width: auto; +} +.zp-Browse-Tags .zp-Browse-Select { + margin-right: 0; + margin-left: 15px; +} + +.zp-Browse-Select select { + border: 1px solid #ccc; + width: 100%; +} + +.zp-Browse-Select .zp-List-Tags { + float: right; +} + + + +/* Accounts */ + +div.zp-Browse-Accounts { + display: inline; +} +div.zp-Browse-Accounts label { + color: #ccc; + display: none; + font: normal 400 1em/1.75em "Georgia", serif; + margin-right: 5px; + padding: 0; +} +div#zp-Zotpress select.zp-FilterByAccount { + font-size: inherit; + line-height: inherit; + border: none; + box-shadow: none; + margin: 0; + padding: 0; + display: inline; + height: auto; + vertical-align: baseline; +} +div#zp-Zotpress select.zp-FilterByAccount.loading { + color: #ddd; +} + +div.zp-Browse-Account-Options { + position: absolute; + top: 27px; + right: 30px; +} +.zp-Browse-Account-Default { + font: 400 27px/32px "Helvetica", "Helvetica Neue", "Arial", sans-serif; + padding-left: 3px !important; + transition: none !important; + width: auto; +} +.zp-Browse-Account-Default:before { + font-family: dashicons; + content: "\f154"; + line-height: 1.1; + font-size: 1.1em; + margin: 0 0.4em; + padding: 0 0.1em; + vertical-align: text-bottom; +} +.zp-Browse-Account-Default.dashicons-star-empty:before { + content: "\f154"; +} +.zp-Browse-Account-Default.dashicons-star-filled:before { + content: "\f155"; +} +.zp-Browse-Account-Default.loading:before { + background-image: url("../images/loading_default.gif") !important; + background-repeat: no-repeat; + background-position: center !important; + height: 1.5rem; +} +.zp-Browse-Account-Default.loading.dashicons-star-empty:before { + content: " "; + display: inline-block; + white-space: pre; + vertical-align: 0.1em; + min-height: 18px; + min-width: 18px; +} + + +/* Collection Folders */ + +div.zp-Collection-Title { + letter-spacing: normal; + margin-left: 30px; + padding: 0; + text-transform: none; +} +div.zp-Collection-Title label { + color: #ccc; + display: inline-block; + font-family: "Georgia", serif; + font-size: 0.65em; + font-style: normal; + padding-left: 2em; + text-transform: uppercase; +} +div.zp-Collection-Title .item_key { + border: none; + box-shadow: none; + color: #ccc; + display: inline-block; + font-size: 0.8em; + font-style: italic; +} + +/* END BROWSE */ + + + +/* START OF BROWSE CITATION LISTS */ + +.zpSearchResultsContainer { + border-top: 1px solid #eee; +} +.wp-admin .zpSearchResultsContainer { + padding-bottom: 0; +} +.wp-admin div#zp-Zotpress div.zp-List .zp_display_progress { + position: absolute; + top: 0; + right: 0; + + background: transparent url('../images/loading_default.gif') no-repeat right top; + font-size: 0.8em; + text-transform: uppercase; + margin-right: 30px; + padding-right: 30px; +} +.wp-admin div#zp-Zotpress div.zp-List.loading .zpSearchResultsContainer { + background: none; +} + +div#zp-Zotpress div.zp-List { + position: relative; +} + +div#zp-Zotpress div.zp-List h3 { + display: block; + color: #bbb; + background: #333; + font: 400 19px/24px "Helvetica", "Helvetica Neue", "Arial", sans-serif; + margin: -3px 0 0; + padding: 10px 15px; +} +div#zp-Zotpress div.zp-List h3 em { + color: #fff; + font-style: normal; +} + +div#zp-Zotpress div.zp-List p { + margin: 1em; +} + +div#zp-Zotpress div.zp-List a, +div#zp-Zotpress div.zp-List a:visited +{ + color: #E14D43; /* bae1fe */ + text-decoration: none; +} +div#zp-Zotpress div.zp-List h3 a { + float: right; +} +div#zp-Zotpress div.zp-List a:hover { + color: #ddd; +} +div#zp-Zotpress div.zp-List a:active { + color: #666; +} + + + +div#zp-Zotpress div.zp-List div.zp-Entry { + padding: 0 30px; +} +div#zp-Zotpress div.zp-List div.zp-Entry:before, +div#zp-Zotpress div.zp-List div.zp-Entry:after { + content: ""; + display: table; +} +div#zp-Zotpress div.zp-List div.zp-Entry:after { + clear: both; +} +.wp-admin div#zp-Zotpress div.zp-List div.zp-Entry { + border-bottom: 1px solid #eee; + padding-top: 20px; +} + +div#zp-Zotpress div.zp-List div.zp-Entry label { + color: #ccc; + display: inline; + font-family: "Georgia", serif; + font-size: 0.85em; + text-transform: uppercase; +} +div#zp-Zotpress div.zp-List div.zp-Entry input.item_key { + border: none; + box-shadow: none; + color: #ccc; + display: inline-block; + font-family: "Georgia", serif; + font-style: italic; + font-weight: normal; + margin-bottom: 2em; +} + +div#zp-Zotpress div.zp-List div.zp-Entry-Image { + position: relative; + float: right; + margin: 0 0 5px 15px; + overflow: hidden; + text-align: center; + width: 150px; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image.hasImage { + line-height: 0; + width: 150px; + height: auto; +} + +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload, +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:link, +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:visited { + transition: .25s ease-in-out; + + background-color: #F6F6F6; + border: 2px solid #F6F6F6; + border-bottom: 2px solid #eee; + color: #ccc; + display: block; + font-size: 0.9em; + font-weight: bold; + line-height: 2em; + text-decoration: none; + width: 150px; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:hover { + background-color: #E14D43; + border: 2px solid #E14D43; + border-bottom: 2px solid #C24138; + color: #fff; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:active { + background-color: #aaa; + border: 2px solid #aaa; + color: #666; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete, +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:link, +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:visited { + transition: .25s ease-in-out; + + position: absolute; + z-index: 3; + top: 0; + right: 0; + left: auto; + background-color: #F6F6F6; + border: 2px solid #F6F6F6; + border-bottom: 2px solid #eee; + box-shadow: none; + display: none; + font-size: 14pt; + font-weight: bold; + line-height: 20px; + outline: none; + text-align: center; + width: 25px; + height: 25px; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:hover { + background-color: #E14D43; + border: 2px solid #E14D43; + border-bottom: 2px solid #C24138; + color: #fff; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:active { + background-color: #aaa; + border: 2px solid #aaa; + color: #666; +} +div#zp-Zotpress div.zp-List div.zp-Entry-Image.hover.hasImage a.delete { + display: block; +} + +div#zp-Zotpress div.zp-List div.zp-Entry-Image img { + width: 150px; + height: auto; +} + +div#zp-Zotpress div.zp-Entry div.zp-Entry-ID { + color: #999; + font-size: 10px; + display: block; + margin: 0; +} +div#zp-Zotpress div.zp-Entry div.zp-Entry-ID span.title { + text-transform: uppercase; +} +div#zp-Zotpress div.zp-Entry div.zp-Entry-ID div { + display: inline-block; +} +div#zp-Zotpress div.zp-Entry div.zp-Entry-ID-Text span { + cursor: pointer; +} +div#zp-Zotpress div.zp-Entry div.zp-Entry-ID input { + border: 0; + background: transparent; + color: #999; + display: none; + font-size: 10px; + padding: 0; + margin: 0; +} + + +/* Pagination */ + +.zpSearchResultsPaging:after { + clear: both; + content: ""; + display: table; +} + +.zpSearchResultsPagingContainer { + margin: 0; + margin-left: 30px; +} + +.zpSearchResultsPagingContainer span.title { + font: italic 400 1rem/2.6 "Georgia", serif; + /* float: left; */ + /* padding: 7px 15px 0 0; */ + text-transform: none; +} + +.zpSearchResultsPaging a { + /* float: left; */ + display: block; + text-align: center; + /* width: 40px; */ + /* height: 3.5rem; */ +} +.zpSearchResultsPaging a.selected { + color: #000 !important; +} +.zpSearchResultsPaging a span { + margin: 0.5rem; + /* padding: calc(1.5rem - 4px) calc(1.2rem - 4px); */ +} + +.zpSearchResultsPagingScroller { + /* width: 5em; */ +} +.zpSearchResultsPagingScroller span { + font-size: 2.5rem; + margin-top: -0.5rem; +} + +/* END OF BROWSE CITATIONS */ + + + +/* START IMAGE FORM */ + +div#zp-Zotpress form#zp-Image { + /* -moz-border-radius: 10px; */ + border-radius: 10px; + background-color: #fafafa; + margin: 0.75em 0 30px 0; + width: 780px; +} + +div#zp-Zotpress form#zp-Image fieldset { + padding: 10px 20px; +} + +div#zp-Zotpress form#zp-Image div.section { + margin: 10px 0; +} + +div#zp-Zotpress form#zp-Image div.zp-Image-Current { + float: right; + overflow: hidden; + margin: 20px; + max-width: 310px; + max-height: 310px; +} + +div#zp-Zotpress div.zp-Citation { + width: 780px; +} +div#zp-Zotpress div.zp-Citation div.csl-bib-body { + margin: 0; +} +div#zp-Zotpress div.zp-Citation div.zp-Entry { + min-height: 0; +} + +div#zp-Zotpress form#zp-Image span.help { + color: #999; + font: italic 11px/14px 'Georgia', serif; +} + +div#zp-Zotpress form#zp-Image #zp-Submit, +div#zp-Zotpress form#zp-Image #zp-Cancel { + float: left; +} +div#zp-Zotpress form#zp-Image #zp-Submit { + margin-right: 4px; +} + +div#zp-Zotpress form#zp-Image div.zp-Loading { + display: none; + float: left; + margin: 0 0 0 4px; +} + +div#zp-Zotpress form#zp-Image div.zp-Errors, +div#zp-Zotpress form#zp-Image div.zp-Success { + margin-left: 140px; + padding-left: 35px; +} +div#zp-Zotpress form#zp-Image div.zp-Errors p, +div#zp-Zotpress form#zp-Image div.zp-Success p { + padding: 6px 0 1px; +} + +/* END IMAGE FORM */ + + + +/* START OF HIDDEN URL CSS */ + +span#ZOTPRESS_PLUGIN_URL { + display: none; +} + +/* END OF HIDDEN URL CSS */ + + + +/* START ACCOUNTS */ + +div#zp-ManageAccounts { + clear: both; +} +div#zp-ManageAccounts h3 { + width: 50%; +} + +a.zp-Account-Default.inactive { + cursor: default; +} + +a.zp-AddAccountButton, +a.zp-AddAccountButton:link, +a.zp-AddAccountButton:visited, +a.zp-AddAccountButton:active, +a.zp-AddAccountButton:hover { + float: right; + margin-top: -2.55em; + text-shadow: none; +} +a.zp-AddAccountButton span.dashicons { + color: #000; + margin-right: 0.3em; + padding-bottom: 3px; + vertical-align: middle; + /* background: transparent url('../images/sprite.png') no-repeat 0 -351px; */ + /* padding: 0 2px 0 16px; */ +} +a.zp-AddAccountButton:hover { + background: #ceec8a; +} +a.zp-AddAccountButton:hover span.dashicons { + color: #E14D43; + /* background-position: -161px -351px; */ +} +a.zp-AddAccountButton:active { + background: #777; + color: #000; +} +a.zp-AddAccountButton:active span.dashicons { + color: #666; + /* background-position: -161px -350px; */ +} + +#zp-Accounts { + margin: 1.55em 0; +} + +#zp-Accounts th { + font: 300 1.1em/1.1em "Georgia", sans-serif; +} + +#zp-Accounts .default { + text-align: center; + width: 10%; +} +#zp-Accounts .account_type { + width: 8%; +} +#zp-Accounts .api_user_id { + width: 12%; +} +#zp-Accounts .private_key { + width: 34%; +} +#zp-Accounts .nickname { + width: 20%; +} +#zp-Accounts .cache { + text-align: center; + width: 8%; +} +#zp-Accounts .remove { + text-align: center; + width: 8%; +} + +#zp-AccountsList td.cache, +#zp-AccountsList td.remove { + text-align: center; + /* display: flex; + align-items: center; + justify-content: center; + width: inherit; */ +} + +#zp-AccountsList .default a, +#zp-AccountsList .cache a, +#zp-AccountsList .remove a { +/* #zp-AccountsList .actions a { */ + /* display: block; */ + font-size: 1.7em; + line-height: 25px; + outline: none; + overflow: hidden; + margin: 0 1.25em 0 0; + width: 25px; + height: 25px; +} +#zp-AccountsList .default a span, +#zp-AccountsList .cache a span, +#zp-AccountsList .remove a span { + display: none; +} +#zp-AccountsList .default a.dashicons-star-filled { + color: #000; + content: "\f154"; +} +#zp-AccountsList .default a.dashicons-star-empty { + color: #ccc; + content: "\f155"; +} +#zp-AccountsList .default a:focus, +#zp-AccountsList .cache a:focus, +#zp-AccountsList .remove a:focus { +/* #zp-AccountsList .actions a:focus { */ + box-shadow: none; +} +#zp-AccountsList .cache a.cache { + color: #000; + /* color: #2ecc71; */ + margin-right: 0; + + /* -webkit-transform: scaleX(-1) rotate(25deg); + -moz-transform: scaleX(-1) rotate(25deg); + -o-transform: scaleX(-1) rotate(25deg); */ + transform: scaleX(-1) rotate(25deg); +} +#zp-AccountsList .cache a.cache.loading:before { + content: " "; + white-space: pre; + background-position: 0 center !important; + background-image: url('../images/loading_default.gif'); + background-repeat: no-repeat; + width: 18px; + display: inline-block; +} +#zp-AccountsList .remove a.delete { + color: #E14D43; + margin-right: 0; +} + +#zp-AccountsList .default a.default { + float: none; + margin: 0 auto; +} +#zp-AccountsList .default a.default.loading { + background-position: 4px center !important; + background-image: url('../images/loading_default.gif'); + background-repeat: no-repeat; +} +#zp-AccountsList .default a.default.loading:before { + content: " "; + white-space: pre; +} + +/* END ACCOUNTS */ + + + + + + +/* START OF MODAL CSS */ + +.zp-Modal #adminmenu, +.zp-Modal #footer, +.zp-Modal #wphead +{ + display: none; +} +.zp-Modal #wpbody { + margin-left: 25px; +} +body.wp-admin.zp-Modal { + min-width: 400px; +} + +/* END OF MODAL CSS */ + + + + +/* START OF OPTIONS PAGE CSS */ + +div.zp-Zotpress-Options { + border-left: 0.35em solid #000; + margin: 20px 0 30px; + padding: 0.6em 1em; +} +div.zp-Zotpress-Options:before, +div.zp-Zotpress-Options:after { + content: ""; + display: table; +} +div.zp-Zotpress-Options:after { + clear: both; +} + +div#zp-Zotpress div.zp-Column-1 { + border-right: 1px solid #ddd; + float: left; + margin-right: 4%; + width: 47.5% +} +div#zp-Zotpress div.zp-Column-2 { + float: left; + width: 47.5% +} + +div.zp-Zotpress-Options label { + font: normal 0.9em/1em "Georgia", sans-serif; + margin: 0 0 0.5em 0; + text-transform: uppercase; + letter-spacing: 0.075rem; +} + +div.zp-Zotpress-Options label, +div.zp-Zotpress-Options select { + display: block; +} +div.zp-Zotpress-Options select { + margin-bottom: 0.5em; +} + +div.zp-Zotpress-Options input.button-secondary { + float: left; + margin-top: 10px; +} + +div#zp-Zotpress div.zp-Zotpress-Options div.zp-Loading { + display: none; + float: left; + margin: 0.6em 0 0 0.25em; +} +div#zp-Zotpress div.zp-Zotpress-Options div.zp-Success, +div#zp-Zotpress div.zp-Zotpress-Options div.zp-Errors { + margin: 0.6em 0 0; + padding: 6px 0 4px 32px; + float: left; +} + +div#zp-Zotpress-Options-Style-New-Container { + display: none; + margin: 1.5em 0 0.5em; +} +select#zp-Zotpress-Options-Style option#new { + border-top: 1px dotted #CCCCCC; + font-weight: bold; + font-style: italic; +} + +div#zp-Zotpress .zp-Column-1 p.note { + /*margin-right: 1em;*/ +} + +div#zp-Zotpress-Options-Reset { + border-left: 0; + padding: 0; +} + +div.zp-CPT-Checkbox { + float: left; + width: 50%; +} +div.zp-Zotpress-Options div.zp-CPT-Checkbox label { + display: inline; + line-height: 2em; + vertical-align: 0.05em; +} +div.zp-Zotpress-Options div.zp-CPT-Checkbox label.dis { + color: #ccc; +} +div.zp-CPT-Checkbox-Container:before, +div.zp-CPT-Checkbox-Container:after { + content: " "; /* 1 */ + display: table; /* 2 */ +} +div.zp-CPT-Checkbox-Container:after { + clear: both; +} + +/* END OF OPTIONS PAGE CSS */ + + +.ui-tooltip-tipsy .ui-tooltip-titlebar, .ui-tooltip-tipsy .ui-tooltip-content { + font-weight: normal !important; + width: 300px !important; +} diff --git a/css/zotpress.admin.min.css b/css/zotpress.admin.min.css new file mode 100644 index 0000000..9fbc9ad --- /dev/null +++ b/css/zotpress.admin.min.css @@ -0,0 +1 @@ +div#zp-Zotpress select{cursor:pointer}div#zp-Zotpress div.zp-Col-1{float:left;width:350px}div#zp-Zotpress div.zp-Col-2{float:left}#adminmenu .current .wp-menu-image img{opacity:1}div#zp-Zotpress del{color:#aaa;text-decoration:none}div#zp-Setup h3,div#zp-Zotpress h3{clear:both;font:400 27px/32px Helvetica,"Helvetica Neue",Arial,sans-serif;margin:0;font-weight:700;padding:9px 15px 4px 0;text-transform:none}div#zp-Setup h3.pair{border-bottom:0;padding:15px 30px 0}div#zp-Setup h4,div#zp-Zotpress h4,div.zp-Collection-Title{font:italic 400 17px/21px Georgia,serif;margin:1.5em 0 1em}div#zp-Setup h4{font:italic 400 16px/21px Georgia,serif}div#zp-Setup h4.pair{border-bottom:1px solid #eee;margin:0;padding:10px 30px 25px}div#zp-Zotpress h5{font:300 11px/30px Georgia,serif;margin-bottom:-15px;text-transform:uppercase}div#zp-Zotpress hr{border:none;border-top:1px solid #ddd;clear:both;margin:3.3em 0 .7em;height:1px}div#zp-Setup hr.clear,div#zp-Zotpress hr.clear{border:none;margin-bottom:0}div#zp-Setup ul,div#zp-Zotpress ul{list-style:none;margin:20px 0 25px;padding:0}div#zp-Setup ul li,div#zp-Zotpress ul li{background:url('../images/sprite.png') no-repeat -40px -60px;padding-left:15px;margin-left:5px;margin-bottom:10px;list-style:none}div#zp-Zotpress form hr.clear{margin:0;padding:0;height:1px}div#zp-Zotpress p.example{font-family:monospace;font-size:1.1em}div#zp-Setup{border-bottom:1px solid #ccc;margin-right:1.5em;width:auto;min-width:549px}div#zp-Setup div#zp-Zotpress-Navigation{z-index:1;position:relative;margin-bottom:0}div#zp-Setup-Step,div.zp-Setup-Step{z-index:0;position:relative;background-color:#fff;padding:1em 0 .65em}div.zp-Setup-Step.second{border-top:1px solid #eee}div.zp-Setup-Step.second:after,div.zp-Setup-Step.second:before{display:table;content:""}div.zp-Setup-Step.second:after{clear:both}div#zp-Setup h3{padding:15px 30px 25px;border-bottom:1px solid #eee}div#zp-Setup-Step hr{clear:both;border:none;padding:0;margin:1em 0;height:1px;background:0 0;border-top:1px solid #eee}div#zp-Setup-Step hr.clear{margin:0}div#zp-Setup div.zp-Column-1,div#zp-Setup div.zp-Column-2{float:left;margin-left:30px;width:400px}div#zp-Setup p.note{color:#666;font-size:.9em;font-style:italic;margin:-10px 0 10px 0}div#zp-Setup div.zp-Zotpress-Options{margin-bottom:2em}div#zp-Zotpress-Setup-Buttons{clear:both;border-top:1px solid #eee}a#zp-Setup-Cancel,div#zp-Zotpress-Setup-Buttons a,div#zp-Zotpress-Setup-Buttons input{margin:1em 30px .5em;float:right}a#zp-Setup-Cancel{float:none}div#zp-Zotpress-Setup-Buttons a#zp-Import-Accounts-Button{margin-right:0}div#zp-Zotpress-Setup-Buttons a#zp-Import-Browse-Button{margin-left:10px}div#zp-Setup div.zp-Zotpress-Options div.zp-Errors,div#zp-Setup div.zp-Zotpress-Options div.zp-Loading,div#zp-Setup div.zp-Zotpress-Options div.zp-Success{float:left;height:32px}div#zp-Setup div.zp-Zotpress-Options div.zp-Errors,div#zp-Setup div.zp-Zotpress-Options div.zp-Success{margin-top:14px;margin-bottom:0;padding-left:35px;height:24px}div#zp-Setup div.zp-Zotpress-Options div.zp-Success{background-position:0 -82px}div#zp-Setup div.zp-Zotpress-Options div.zp-Errors{background-position:0 -146px}div#zp-Setup div.zp-Zotpress-Options div.zp-Loading{margin-top:6px}div#zp-Setup div.zp-Column,div#zp-Zotpress div.zp-Column{border-bottom:1px solid #eee}div#zp-Setup div.zp-Column div.zp-Column-Inner{padding:0 25px}div#zp-Step-Import,div.zp-Step-Import{padding:10px 30px}.second div.zp-Step-Import{padding-top:0}div#zp-Zotpress-Setup-Import-Buttons{margin-top:2em}.wp-core-ui input.zp-Import-Button.button-secondary,input#zp-Zotpress-Setup-Import{margin:0 .5em 1em 0;float:left}div#zp-Step-Import-Collection{background-color:#f9f9f9;clear:both;margin-top:1em;width:36.75em;height:13.5em}div#zp-Step-Import-Collection.loading{background:#f9f9f9 url('../images/loading_default.gif') no-repeat center}div#zp-Step-Import-Collection iframe{width:100%}#zp-Zotpress-Setup-Import-Selective{float:left;margin:1em 0}iframe#zp-Setup-Import{position:absolute;top:0;right:0;margin:0;padding:0;visibility:hidden;width:50px;height:35px}div.zp-Loading-Container{clear:both;padding-top:.75em}div.zp-Loading-Container:after,div.zp-Loading-Container:before{content:"";display:table}div.zp-Loading-Container:after{clear:both}div.zp-Loading-Container.selective{clear:none;padding-top:0}div.zp-Loading-Initial.zp-Loading-Import{background:transparent url('../images/loading_import.gif') no-repeat 0 6px;display:none;float:left;margin:0;width:70px;height:20px}div.zp-Loading-Initial.zp-Loading-Import.selective{margin-top:1.35em;margin-left:1em}div.zp-Import-Messages{color:#999;font:italic 9px/20px Georgia,"Times New Roman","Bitstream Charter",Times,serif;display:none;float:left;margin:0 0 0 1em}div.zp-Import-Messages.selective{margin-top:1.95em}div.Zotpress_update_notice .notice-dismiss.text{position:static;color:inherit;text-decoration:underline;padding:0}div.Zotpress_update_notice .notice-dismiss.text::before{display:none}#zp-Setup-Check{padding:1.5em 30px}#zp-Setup-Check-Message.error{background:#fceae9}#zp-Setup-Check-Message.updated{background:#eef9e6}div#zp-Setup-Check-Message.error strong em{color:#e14d43;font-style:normal}div#zp-Setup-Check-Message.updated strong em{color:#7ad03a;font-style:normal}form#zp-Add{padding:0;margin:0}form#zp-Add fieldset{background:0 0;border:none;margin:0;padding:0}form#zp-Add div.field{clear:both;padding:2.2em 2.4em}form#zp-Add aside,form#zp-Add input,form#zp-Add label,form#zp-Add select,form#zp-Add textarea{display:block;float:left}form#zp-Add input,form#zp-Add select,form#zp-Add textarea{margin:-4px 0 0}form#zp-Add input#private_key{min-width:18em}form#zp-Add label{font:italic 400 1.1em/1.25em Georgia,serif;width:20%}form#zp-Add label.required{background:url('../images/sprite.png') no-repeat 0 -36px;padding-left:15px;margin-left:-15px}form#zp-Add aside{float:right;margin-top:-8px;width:40%}form#zp-Add aside p{font-size:.85em;margin:0 0 0 1em}form#zp-Add .last aside p{padding-bottom:2em}form#zp-Add input#upload_image,form#zp-Add input#upload_image_button{display:inline}#zp-Setup div.proceed{border-top:1px solid #eee;clear:both;width:100%}#zp-Setup div.proceed input#zp-Connect,#zp-Setup div.proceed input#zp-Connect-Next{margin:1em 30px .5em;float:right}#zp-Setup div.proceed:after,#zp-Setup div.proceed:before{content:"";display:table}#zp-Setup div.proceed:after{clear:both}form#zp-Add div.message{position:absolute;bottom:1.1em;right:8.5em;width:100%}div.zp-Loading{background:transparent url('../images/loading_default.gif') no-repeat center;display:none;float:right;letter-spacing:-1000px;overflow:hidden;text-indent:-5000px;margin:0 0 0;width:30px;height:30px}div.zp-Errors,div.zp-Success{display:none;float:right;font-weight:700;margin:0 0 0;padding-left:35px}div.zp-Errors{background:url('../images/sprite.png') no-repeat 0 -139px;color:#903}div.zp-Success{background:url('../images/sprite.png') no-repeat 0 -76px;color:#096}div.zp-Errors p,div.zp-Success p{margin:5px 0}div.zp-Loading-Initial{background:transparent url('../images/loading_initial.gif') no-repeat -3px 10px;margin:0;padding:0;width:220px;height:18px}div.zp-Loading-Initial h2{margin-bottom:-12px}iframe#zp-Loading-Initial{visibility:hidden}div#zp-Zotpress-Navigation{border-bottom:1px solid #ccc;margin:10px 0 20px;overflow:visible;height:49px}div#zp-Zotpress-Navigation h1{font:600 18px/24px Helvetica,Arial,sans-serif;float:left;margin:0;padding:.45em 5em 1em 0;text-transform:uppercase}div#zp-Zotpress-Navigation h1 em{color:#c23d35;font-style:normal}div#zp-Zotpress-Navigation .nav-item,div#zp-Zotpress-Navigation :visited.nav-item{color:#000;display:block;float:left;font:normal 1em/2.15em Helvetica,"Helvetica Neue",Arial,sans-serif;padding:.75em 1.5em;outline:0;text-transform:uppercase;text-decoration:none}div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation .nav-item,div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation :visited.nav-item{color:#bbb}div#zp-Zotpress-Navigation :hover.nav-item{border-bottom:.25em solid #000}div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation :hover.nav-item{border-bottom:none}div#zp-Zotpress-Navigation .active.nav-item,div#zp-Zotpress-Navigation :active.nav-item,div#zp-Zotpress-Navigation :focus.nav-item{background-color:#eaeaea;border-bottom:.25em solid #000;box-shadow:none}div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active,div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active:active,div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active:hover,div#zp-Zotpress-Navigation .nav-item.nav-tab-active{border-bottom:.25em solid #e14d43;background-color:transparent;color:#000}div#zp-Zotpress-Navigation .nav-item.nav-tab-active strong{font-weight:700;margin-right:.25em}div#zp-Icon{float:left;margin-right:8px;text-align:center;width:48px;height:48px}div#zp-Icon img{display:inline;padding-top:6px;width:32px}div#zp-Zotpress div#zp-Options-Wrapper,div#zp-Zotpress div.zp-Browse-Wrapper{position:relative;background-color:#fff;border-bottom:1px solid #ccc;margin-top:-20px;padding:1em 0 0}div#zp-Zotpress div#zp-Options-Wrapper:after,div#zp-Zotpress div#zp-Options-Wrapper:before{content:"";display:table}div#zp-Zotpress div#zp-Options-Wrapper:after{clear:both}div#zp-Zotpress div#zp-Options-Wrapper h3,div#zp-Zotpress div.zp-Browse-Wrapper h3{padding:15px 30px 25px}div#zp-Zotpress div#zp-Options-Wrapper h3{border-bottom:1px solid #eee}div#zp-Zotpress div#zp-Options-Wrapper hr{border-color:#eee;margin-bottom:0}div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-1,div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-2{border-color:#eee;margin-right:0;width:49.5%}div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-Inner{padding:0 25px}.zp-Browse-Bar{border:none;padding:0 30px}.zp-Browse-Bar:after{clear:both;content:"";display:table}.zp-Browse-Collections,.zp-Browse-Tags{float:left;width:50%}.zp-Browse-Select{margin-right:15px;width:auto}.zp-Browse-Tags .zp-Browse-Select{margin-right:0;margin-left:15px}.zp-Browse-Select select{border:1px solid #ccc;width:100%}.zp-Browse-Select .zp-List-Tags{float:right}div.zp-Browse-Accounts{display:inline}div.zp-Browse-Accounts label{color:#ccc;display:none;font:normal 400 1em/1.75em Georgia,serif;margin-right:5px;padding:0}div#zp-Zotpress select.zp-FilterByAccount{font-size:inherit;line-height:inherit;border:none;box-shadow:none;margin:0;padding:0;display:inline;height:auto;vertical-align:baseline}div#zp-Zotpress select.zp-FilterByAccount.loading{color:#ddd}div.zp-Browse-Account-Options{position:absolute;top:27px;right:30px}.zp-Browse-Account-Default{font:400 27px/32px Helvetica,"Helvetica Neue",Arial,sans-serif;padding-left:3px!important;transition:none!important;width:auto}.zp-Browse-Account-Default:before{font-family:dashicons;content:"\f154";line-height:1.1;font-size:1.1em;margin:0 .4em;padding:0 .1em;vertical-align:text-bottom}.zp-Browse-Account-Default.dashicons-star-empty:before{content:"\f154"}.zp-Browse-Account-Default.dashicons-star-filled:before{content:"\f155"}.zp-Browse-Account-Default.loading:before{background-image:url("../images/loading_default.gif")!important;background-repeat:no-repeat;background-position:center!important;height:1.5rem}.zp-Browse-Account-Default.loading.dashicons-star-empty:before{content:" ";display:inline-block;white-space:pre;vertical-align:.1em;min-height:18px;min-width:18px}div.zp-Collection-Title{letter-spacing:normal;margin-left:30px;padding:0;text-transform:none}div.zp-Collection-Title label{color:#ccc;display:inline-block;font-family:Georgia,serif;font-size:.65em;font-style:normal;padding-left:2em;text-transform:uppercase}div.zp-Collection-Title .item_key{border:none;box-shadow:none;color:#ccc;display:inline-block;font-size:.8em;font-style:italic}.zpSearchResultsContainer{border-top:1px solid #eee}.wp-admin .zpSearchResultsContainer{padding-bottom:0}.wp-admin div#zp-Zotpress div.zp-List .zp_display_progress{position:absolute;top:0;right:0;background:transparent url('../images/loading_default.gif') no-repeat right top;font-size:.8em;text-transform:uppercase;margin-right:30px;padding-right:30px}.wp-admin div#zp-Zotpress div.zp-List.loading .zpSearchResultsContainer{background:0 0}div#zp-Zotpress div.zp-List{position:relative}div#zp-Zotpress div.zp-List h3{display:block;color:#bbb;background:#333;font:400 19px/24px Helvetica,"Helvetica Neue",Arial,sans-serif;margin:-3px 0 0;padding:10px 15px}div#zp-Zotpress div.zp-List h3 em{color:#fff;font-style:normal}div#zp-Zotpress div.zp-List p{margin:1em}div#zp-Zotpress div.zp-List a,div#zp-Zotpress div.zp-List a:visited{color:#e14d43;text-decoration:none}div#zp-Zotpress div.zp-List h3 a{float:right}div#zp-Zotpress div.zp-List a:hover{color:#ddd}div#zp-Zotpress div.zp-List a:active{color:#666}div#zp-Zotpress div.zp-List div.zp-Entry{padding:0 30px}div#zp-Zotpress div.zp-List div.zp-Entry:after,div#zp-Zotpress div.zp-List div.zp-Entry:before{content:"";display:table}div#zp-Zotpress div.zp-List div.zp-Entry:after{clear:both}.wp-admin div#zp-Zotpress div.zp-List div.zp-Entry{border-bottom:1px solid #eee;padding-top:20px}div#zp-Zotpress div.zp-List div.zp-Entry label{color:#ccc;display:inline;font-family:Georgia,serif;font-size:.85em;text-transform:uppercase}div#zp-Zotpress div.zp-List div.zp-Entry input.item_key{border:none;box-shadow:none;color:#ccc;display:inline-block;font-family:Georgia,serif;font-style:italic;font-weight:400;margin-bottom:2em}div#zp-Zotpress div.zp-List div.zp-Entry-Image{position:relative;float:right;margin:0 0 5px 15px;overflow:hidden;text-align:center;width:150px}div#zp-Zotpress div.zp-List div.zp-Entry-Image.hasImage{line-height:0;width:150px;height:auto}div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload,div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:link,div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:visited{transition:.25s ease-in-out;background-color:#f6f6f6;border:2px solid #f6f6f6;border-bottom:2px solid #eee;color:#ccc;display:block;font-size:.9em;font-weight:700;line-height:2em;text-decoration:none;width:150px}div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:hover{background-color:#e14d43;border:2px solid #e14d43;border-bottom:2px solid #c24138;color:#fff}div#zp-Zotpress div.zp-List div.zp-Entry-Image a.upload:active{background-color:#aaa;border:2px solid #aaa;color:#666}div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete,div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:link,div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:visited{transition:.25s ease-in-out;position:absolute;z-index:3;top:0;right:0;left:auto;background-color:#f6f6f6;border:2px solid #f6f6f6;border-bottom:2px solid #eee;box-shadow:none;display:none;font-size:14pt;font-weight:700;line-height:20px;outline:0;text-align:center;width:25px;height:25px}div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:hover{background-color:#e14d43;border:2px solid #e14d43;border-bottom:2px solid #c24138;color:#fff}div#zp-Zotpress div.zp-List div.zp-Entry-Image a.delete:active{background-color:#aaa;border:2px solid #aaa;color:#666}div#zp-Zotpress div.zp-List div.zp-Entry-Image.hover.hasImage a.delete{display:block}div#zp-Zotpress div.zp-List div.zp-Entry-Image img{width:150px;height:auto}div#zp-Zotpress div.zp-Entry div.zp-Entry-ID{color:#999;font-size:10px;display:block;margin:0}div#zp-Zotpress div.zp-Entry div.zp-Entry-ID span.title{text-transform:uppercase}div#zp-Zotpress div.zp-Entry div.zp-Entry-ID div{display:inline-block}div#zp-Zotpress div.zp-Entry div.zp-Entry-ID-Text span{cursor:pointer}div#zp-Zotpress div.zp-Entry div.zp-Entry-ID input{border:0;background:0 0;color:#999;display:none;font-size:10px;padding:0;margin:0}.zpSearchResultsPaging:after{clear:both;content:"";display:table}.zpSearchResultsPagingContainer{margin:0;margin-left:30px}.zpSearchResultsPagingContainer span.title{font:italic 400 1rem/2.6 Georgia,serif;text-transform:none}.zpSearchResultsPaging a{display:block;text-align:center}.zpSearchResultsPaging a.selected{color:#000!important}.zpSearchResultsPaging a span{margin:.5rem}.zpSearchResultsPagingScroller span{font-size:2.5rem;margin-top:-.5rem}div#zp-Zotpress form#zp-Image{border-radius:10px;background-color:#fafafa;margin:.75em 0 30px 0;width:780px}div#zp-Zotpress form#zp-Image fieldset{padding:10px 20px}div#zp-Zotpress form#zp-Image div.section{margin:10px 0}div#zp-Zotpress form#zp-Image div.zp-Image-Current{float:right;overflow:hidden;margin:20px;max-width:310px;max-height:310px}div#zp-Zotpress div.zp-Citation{width:780px}div#zp-Zotpress div.zp-Citation div.csl-bib-body{margin:0}div#zp-Zotpress div.zp-Citation div.zp-Entry{min-height:0}div#zp-Zotpress form#zp-Image span.help{color:#999;font:italic 11px/14px Georgia,serif}div#zp-Zotpress form#zp-Image #zp-Cancel,div#zp-Zotpress form#zp-Image #zp-Submit{float:left}div#zp-Zotpress form#zp-Image #zp-Submit{margin-right:4px}div#zp-Zotpress form#zp-Image div.zp-Loading{display:none;float:left;margin:0 0 0 4px}div#zp-Zotpress form#zp-Image div.zp-Errors,div#zp-Zotpress form#zp-Image div.zp-Success{margin-left:140px;padding-left:35px}div#zp-Zotpress form#zp-Image div.zp-Errors p,div#zp-Zotpress form#zp-Image div.zp-Success p{padding:6px 0 1px}span#ZOTPRESS_PLUGIN_URL{display:none}div#zp-ManageAccounts{clear:both}div#zp-ManageAccounts h3{width:50%}a.zp-Account-Default.inactive{cursor:default}a.zp-AddAccountButton,a.zp-AddAccountButton:active,a.zp-AddAccountButton:hover,a.zp-AddAccountButton:link,a.zp-AddAccountButton:visited{float:right;margin-top:-2.55em;text-shadow:none}a.zp-AddAccountButton span.dashicons{color:#000;margin-right:.3em;padding-bottom:3px;vertical-align:middle}a.zp-AddAccountButton:hover{background:#ceec8a}a.zp-AddAccountButton:hover span.dashicons{color:#e14d43}a.zp-AddAccountButton:active{background:#777;color:#000}a.zp-AddAccountButton:active span.dashicons{color:#666}#zp-Accounts{margin:1.55em 0}#zp-Accounts th{font:300 1.1em/1.1em Georgia,sans-serif}#zp-Accounts .default{text-align:center;width:10%}#zp-Accounts .account_type{width:8%}#zp-Accounts .api_user_id{width:12%}#zp-Accounts .private_key{width:34%}#zp-Accounts .nickname{width:20%}#zp-Accounts .cache{text-align:center;width:8%}#zp-Accounts .remove{text-align:center;width:8%}#zp-AccountsList td.cache,#zp-AccountsList td.remove{text-align:center}#zp-AccountsList .cache a,#zp-AccountsList .default a,#zp-AccountsList .remove a{font-size:1.7em;line-height:25px;outline:0;overflow:hidden;margin:0 1.25em 0 0;width:25px;height:25px}#zp-AccountsList .cache a span,#zp-AccountsList .default a span,#zp-AccountsList .remove a span{display:none}#zp-AccountsList .default a.dashicons-star-filled{color:#000;content:"\f154"}#zp-AccountsList .default a.dashicons-star-empty{color:#ccc;content:"\f155"}#zp-AccountsList .cache a:focus,#zp-AccountsList .default a:focus,#zp-AccountsList .remove a:focus{box-shadow:none}#zp-AccountsList .cache a.cache{color:#000;margin-right:0;transform:scaleX(-1) rotate(25deg)}#zp-AccountsList .cache a.cache.loading:before{content:" ";white-space:pre;background-position:0 center!important;background-image:url('../images/loading_default.gif');background-repeat:no-repeat;width:18px;display:inline-block}#zp-AccountsList .remove a.delete{color:#e14d43;margin-right:0}#zp-AccountsList .default a.default{float:none;margin:0 auto}#zp-AccountsList .default a.default.loading{background-position:4px center!important;background-image:url('../images/loading_default.gif');background-repeat:no-repeat}#zp-AccountsList .default a.default.loading:before{content:" ";white-space:pre}.zp-Modal #adminmenu,.zp-Modal #footer,.zp-Modal #wphead{display:none}.zp-Modal #wpbody{margin-left:25px}body.wp-admin.zp-Modal{min-width:400px}div.zp-Zotpress-Options{border-left:.35em solid #000;margin:20px 0 30px;padding:.6em 1em}div.zp-Zotpress-Options:after,div.zp-Zotpress-Options:before{content:"";display:table}div.zp-Zotpress-Options:after{clear:both}div#zp-Zotpress div.zp-Column-1{border-right:1px solid #ddd;float:left;margin-right:4%;width:47.5%}div#zp-Zotpress div.zp-Column-2{float:left;width:47.5%}div.zp-Zotpress-Options label{font:normal 0.9em/1em Georgia,sans-serif;margin:0 0 .5em 0;text-transform:uppercase;letter-spacing:.075rem}div.zp-Zotpress-Options label,div.zp-Zotpress-Options select{display:block}div.zp-Zotpress-Options select{margin-bottom:.5em}div.zp-Zotpress-Options input.button-secondary{float:left;margin-top:10px}div#zp-Zotpress div.zp-Zotpress-Options div.zp-Loading{display:none;float:left;margin:.6em 0 0 .25em}div#zp-Zotpress div.zp-Zotpress-Options div.zp-Errors,div#zp-Zotpress div.zp-Zotpress-Options div.zp-Success{margin:.6em 0 0;padding:6px 0 4px 32px;float:left}div#zp-Zotpress-Options-Style-New-Container{display:none;margin:1.5em 0 .5em}select#zp-Zotpress-Options-Style option#new{border-top:1px dotted #ccc;font-weight:700;font-style:italic}div#zp-Zotpress-Options-Reset{border-left:0;padding:0}div.zp-CPT-Checkbox{float:left;width:50%}div.zp-Zotpress-Options div.zp-CPT-Checkbox label{display:inline;line-height:2em;vertical-align:.05em}div.zp-Zotpress-Options div.zp-CPT-Checkbox label.dis{color:#ccc}div.zp-CPT-Checkbox-Container:after,div.zp-CPT-Checkbox-Container:before{content:" ";display:table}div.zp-CPT-Checkbox-Container:after{clear:both}.ui-tooltip-tipsy .ui-tooltip-content,.ui-tooltip-tipsy .ui-tooltip-titlebar{font-weight:400!important;width:300px!important} diff --git a/css/zotpress.ckeditor.css b/css/zotpress.ckeditor.css deleted file mode 100644 index 6f63990..0000000 --- a/css/zotpress.ckeditor.css +++ /dev/null @@ -1,170 +0,0 @@ -.zp-ZotpressShortcode { - background-color: #eee; -} - - - - - .zotpress-widget-ckeditor-php #adminmenuback, - .zotpress-widget-ckeditor-php #adminmenuwrap, - .zotpress-widget-ckeditor-php #footer, - .zotpress-widget-ckeditor-php #wpadminbar - { - display: none !important; - } - - /* Body */ - - body.zotpress-widget-ckeditor-php { - background-color: #EBEBEB; - } - - body.zotpress-widget-ckeditor-php.admin-bar #wpcontent, - body.zotpress-widget-ckeditor-php.admin-bar #adminmenu { - margin: 0; - padding: 0; - } - - #wpbody-content { - padding-bottom: 0; - } - - div#zp-Zotpress-CkEditor.citation { - background-color: #fafafa; - border-radius: 7px; - -moz-border-radius: 7px; - } - - - /* Tabs */ - - div#zp-Zotpress-CkEditor-0 { - padding: 6px !important; - width: 584px; - } - .citation div#zp-Zotpress-CkEditor-0 { - padding: 0 !important; - width: 592px; - } - - div#zp-Zotpress-CkEditor ul.ui-widget-header { - border: 1px solid #aaa; - border-bottom: none; - } - - div#zp-Zotpress-CkEditor div#zp-ZotpressMetaBox-Tabs ul.ui-widget-header { - border: 1px solid #efefef; - border-bottom: none; - background: #f0f0f0; - } - - div#zp-ZotpressMetaBox-Tabs { - overflow: hidden; - margin-bottom: 0; - width: 580px; - } - .citation div#zp-ZotpressMetaBox-Tabs { - width: 588px; - } - - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li { - margin-right: 2px; - } - - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li a { - color: #888; - letter-spacing: 0; - - } - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active a { - color: #bbb; - } - - div#zp-Zotpress-CkEditor div#zp-ZotpressMetaBox-Tabs .zp-Tab { - width: 560px; - height: 250px; - } - - /* Frames */ - - div#zp-Zotpress-Frame-Left { - border-right: 1px solid #eee; - float: left; - padding-right: 10px; - width: 200px; - } - - div#zp-Zotpress-Frame-Right { - float: left; - padding-left: 10px; - width: 338px; - } - - /* Form */ - - div#zp-ZotpressMetaBox-Tabs div.zp-Loading { - position: absolute; - top: 50px; - } - - .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { - font-size: 11px; - } - - div#zp-Zotpress-Collection-Account-Select { - float: right; - margin-top: -32px; - margin-right: -17px; - } - div#zp-ZotpressMetaBox-Tabs div.zp-Tab select#zp-ZotpressMetaBox-Collection-Accounts { - margin-bottom: 0; - width: 215px; - height: 22px; - } - - div#zp-Zotpress-CkEditor label { - font: 10px/10px "Arial", sans-serif; - color: #666; - text-transform: uppercase; - } - - div#zp-ZotpressMetaBox-Tabs .wp-admin select[multiple], - div#zp-ZotpressMetaBox-Tabs div.zp-Tab select { - width: 200px; - height: 228px; - } - div#zp-ZotpressMetaBox-Tabs div.zp-Tab select#zp-ZotpressMetaBox-Collection-Items { - width: 344px; - } - - #zp-ZotpressMetaBox-Pages-Button { - display: none !important; - } - - /* Pages */ - - div#zp-ZotpressMetaBox-Pages { - margin-left: 317px; - padding: 6px; - } - div#zp-ZotpressMetaBox-Pages p.zp-Note { - margin-bottom: 0 !important; - } - - /* Zotpress Shortcode output */ - - div#zp-Zotpress-CKEditor-Output { - display: block; - padding: 7px; - padding-bottom: 0; - } - div#zp-Zotpress-CKEditor-Output label { - font-size: 10px; - text-transform: uppercase; - } - input#zp-Zotpress-Output-Citation { - width: 230px; - } - input#zp-Zotpress-Output-Shortcode { - display: none; - } \ No newline at end of file diff --git a/css/zotpress.css b/css/zotpress.css deleted file mode 100644 index 6552343..0000000 --- a/css/zotpress.css +++ /dev/null @@ -1,1667 +0,0 @@ - - - /* START OF BASIC ZOTPRESS CSS */ - - div#zp-Zotpress select { - cursor: pointer; - } - - div#zp-Zotpress div.zp-Col-1 { - float: left; - width: 350px; - } - div#zp-Zotpress div.zp-Col-2 { - float: left; - } - - #adminmenu .current .wp-menu-image img { - opacity: 1.0; - filter: alpha(opacity = 100); - } - - div#zp-Zotpress del { - color: #aaa; - text-decoration: none; - } - - div#zp-Setup h3, - div#zp-Zotpress h3 { - clear: both; - font: 400 27px/32px "Oswald", "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif; - margin: 0; - padding: 9px 15px 4px 0; - text-transform: uppercase; - } - div#zp-Zotpress h3.zp-HeaderGroup { - /*margin-bottom: -0.5em;*/ - } - div#zp-Setup h3.pair { - border-bottom: 0; - padding: 15px 30px 0; - } - - div#zp-Setup h4, - div#zp-Zotpress h4 { - font: italic 400 17px/21px "Droid Serif", "Georgia", serif; - margin: 1.5em 0 1em; - } - div#zp-Setup h4 { - font: italic 400 16px/21px "Droid Serif", "Georgia", serif; - } - div#zp-Setup h4.pair { - border-bottom: 1px solid #eee; - margin: 0; - padding: 10px 30px 25px; - } - - div#zp-Zotpress h5 { - font: 300 11px/30px "Droid Serif", serif; - margin-bottom: -15px; - text-transform: uppercase; - } - - div#zp-Zotpress hr { - border: none; - border-top: 1px solid #ddd; - clear: both; - margin: 3.3em 0 0.7em; - height: 1px; - } - div#zp-Setup hr.clear, - div#zp-Zotpress hr.clear { - border: none; - margin-bottom: 0; - } - - div#zp-Zotpress ul { - list-style: none; - margin: 20px 0 25px; - padding: 0; - } - div#zp-Zotpress ul li { - background: url('../images/sprite.png') no-repeat -40px -60px; - padding-left: 15px; - margin-left: 5px; - margin-bottom: 10px; - list-style: none; - } - - div#zp-Zotpress form hr.clear { - margin: 0; - padding: 0; - height: 1px; - } - - div#zp-Zotpress p.example { - font-family: monospace; - font-size: 1.1em; - } - - /* END OF BASIC ZOTPRESS CSS */ - - - - /* START OF SETUP CSS */ - - div#zp-Setup { - border-bottom: 1px solid #ccc; - margin-right: 1.5em; - width: auto; - min-width: 549px; - } - div#zp-Setup div#zp-Zotpress-Navigation { - z-index: 1; - position: relative; - margin-bottom: 0; - } - div.zp-Setup-Step, - div#zp-Setup-Step { - z-index: 0; - position: relative; - background-color: #fff; - padding: 1em 0 0.65em; - } - div.zp-Setup-Step.second { - border-top: 1px solid #eee; - } - div.zp-Setup-Step.second:before, - div.zp-Setup-Step.second:after { - display: table; - content: ""; - } - div.zp-Setup-Step.second:after { - clear: both; - } - - div#zp-Setup h3 { - padding: 15px 30px 25px; - border-bottom: 1px solid #eee; - } - div#zp-Setup-Step hr { - clear: both; - border: none; - padding: 0; - margin: 1em 0; - height: 1px; - background: none; - border-top: 1px solid #eee; - } - div#zp-Setup-Step hr.clear { - margin: 0; - } - - div#zp-Setup div.zp-Column-1, - div#zp-Setup div.zp-Column-2 { - float: left; - margin-left: 30px; - width: 400px; - } - - div#zp-Setup p.note { - color: #666; - font-size: 0.9em; - font-style: italic; - margin: -10px 0 10px 0; - } - - div#zp-Setup div.zp-Zotpress-Options { - margin-bottom: 2em; - } - - div#zp-Zotpress-Setup-Buttons { - clear: both; - border-top: 1px solid #eee; - } - a#zp-Setup-Cancel, - div#zp-Zotpress-Setup-Buttons a, - div#zp-Zotpress-Setup-Buttons input { - margin: 20px 30px 12px; - float: right; - } - a#zp-Setup-Cancel { - float: none; - } - div#zp-Zotpress-Setup-Buttons a#zp-Import-Accounts-Button { - margin-right: 0; - } - div#zp-Zotpress-Setup-Buttons a#zp-Import-Browse-Button { - margin-left: 10px; - } - - div#zp-Setup div.zp-Zotpress-Options div.zp-Success, - div#zp-Setup div.zp-Zotpress-Options div.zp-Loading, - div#zp-Setup div.zp-Zotpress-Options div.zp-Errors { - float: left; - height: 32px; - } - div#zp-Setup div.zp-Zotpress-Options div.zp-Success, - div#zp-Setup div.zp-Zotpress-Options div.zp-Errors { - margin-top: 14px; - margin-bottom: 0; - padding-left: 35px; - height: 24px; - } - div#zp-Setup div.zp-Zotpress-Options div.zp-Success { - background-position: 0 -82px; - } - div#zp-Setup div.zp-Zotpress-Options div.zp-Errors { - background-position: 0 -146px; - } - div#zp-Setup div.zp-Zotpress-Options div.zp-Loading { - margin-top: 6px; - } - - - div.zp-Step-Import, - div#zp-Step-Import { - padding: 10px 30px; - } - .second div.zp-Step-Import { - padding-top: 0; - } - div#zp-Zotpress-Setup-Import-Buttons { - margin-top: 2em; - } - input#zp-Zotpress-Setup-Import, - .wp-core-ui input.zp-Import-Button.button-secondary { - margin: 0 0.5em 1em 0; - float: left; - } - div#zp-Step-Import-Collection { - background-color: #f9f9f9; - clear: both; - margin-top: 1em; - width: 36.75em; - height: 13.5em; - } - div#zp-Step-Import-Collection.loading { - background: #f9f9f9 url('../images/loading_default.gif') no-repeat center; - } - div#zp-Step-Import-Collection iframe { - width: 100%; - } - #zp-Zotpress-Setup-Import-Selective { - float: left; - margin: 1em 0; - } - - - iframe.zp-Setup-Sync, - iframe#zp-Setup-Import { - position: absolute; - top: 0; - right: 0; - margin: 0; - padding: 0; - - /* LIVE */ - visibility: hidden; - width: 50px; - height: 35px; - - /* DEBUGGING */ - /*border: 3px solid #eee;*/ - /*width: 350px;*/ - /*height: 200px;*/ - } - - div.zp-Loading-Container { - clear: both; - padding-top: 0.75em; - } - div.zp-Loading-Container:before, - div.zp-Loading-Container:after { - content: ""; - display: table; - } - div.zp-Loading-Container:after { - clear: both; - } - div.zp-Loading-Container.selective { - clear: none; - padding-top: 0; - } - div.zp-Loading-Initial.zp-Loading-Import { - background: transparent url('../images/loading_import.gif') no-repeat 0 6px; - display: none; - float: left; - margin: 0; - width: 70px; - height: 20px; - } - div.zp-Loading-Initial.zp-Loading-Import.selective { - margin-top: 1.35em; - margin-left: 1em; - } - div.zp-Import-Messages { - color: #999; - font: italic 9px/20px Georgia,"Times New Roman","Bitstream Charter",Times,serif; - display: none; - float: left; - margin: 0 0 0 1em; - } - div.zp-Import-Messages.selective { - margin-top: 1.95em; - } - - - - /* START OF SETUP CHECK */ - - #zp-Setup-Check { - padding: 1.5em 30px; - } - #zp-Setup-Check-Message.error { - background: #fceae9; - } - #zp-Setup-Check-Message.updated { - background: #eef9e6; - } - div#zp-Setup-Check-Message.error strong em { - color: #E14D43; - font-style: normal; - } - div#zp-Setup-Check-Message.updated strong em { - color: #7AD03A; - font-style: normal; - } - - - - /* START OF ADD FORM CSS */ - - form#zp-Add { - padding: 0; - margin: 0; - } - *:first-child+html form#zp-Add { /* IE7 hack */ - /*width: 850px;*/ - } - form#zp-Add fieldset { - background: transparent; - border: none; - margin: 0; - padding: 0; - } - form#zp-Add div.field { - clear: both; - padding: 2.2em 2.4em; - } - - form#zp-Add label, - form#zp-Add select, - form#zp-Add textarea, - form#zp-Add input, - form#zp-Add aside { - display: block; - float: left; - } - form#zp-Add select, - form#zp-Add textarea, - form#zp-Add input { - margin: -4px 0 0; - } - form#zp-Add input#public_key { - min-width: 18em; - } - form#zp-Add label { - font: italic 400 1.1em/1.25em "Droid Serif", serif; - width: 20%; - } - form#zp-Add label.required { - background: url('../images/sprite.png') no-repeat 0 -36px; - padding-left: 15px; - margin-left: -15px; - } - form#zp-Add aside { - float: right; - margin-top: -8px; - width: 40%; - } - form#zp-Add aside p { - font-size: 0.85em; - margin: 0 0 0 1em; - } - form#zp-Add .last aside p { - padding-bottom: 2em; - } - - form#zp-Add input#upload_image, - form#zp-Add input#upload_image_button { - display: inline; - }/* Remove once converted to WP types w/ post image? */ - - #zp-Setup div.proceed { - border-top: 1px solid #eee; - clear: both; - width: 100%; - } - #zp-Setup div.proceed input#zp-Connect { - margin: 1em 2em 0.5em; - float: right; - } - /* Thanks to http://nicolasgallagher.com/micro-clearfix-hack/ */ - #zp-Setup div.proceed:before, - #zp-Setup div.proceed:after { - content: ""; - display: table; - } - #zp-Setup div.proceed:after { - clear: both; - } - - form#zp-Add div.message { - position: absolute; - bottom: 1.1em; - right: 8.5em; - width: 100%; - } - div.zp-Loading { - background: transparent url('../images/loading_default.gif') no-repeat center; - display: none; - float: right; - letter-spacing: -1000px; - overflow: hidden; - text-indent: -5000px; - margin: 0 0 0; - width: 30px; - height: 30px; - } - div.zp-Errors, - div.zp-Success { - display: none; - float: right; - font-weight: bold; - margin: 0 0 0; - padding-left: 35px; - } - div.zp-Errors { - background: url('../images/sprite.png') no-repeat 0 -139px; - color: #990033; - } - div.zp-Success { - background: url('../images/sprite.png') no-repeat 0 -76px; - color: #009966; - } - div.zp-Errors p, - div.zp-Success p { - margin: 5px 0; - } - - /* END OF SETUP CSS */ - - - - /* START OF LOADING CSS */ - - div.zp-Loading-Initial { - background: transparent url('../images/loading_initial.gif') no-repeat -3px 10px; - margin: 0; - padding: 0; - width: 220px; - height: 18px; - } - div.zp-Loading-Initial h2 { - margin-bottom: -12px; - } - iframe#zp-Loading-Initial { - visibility: hidden; - } - - /* END OF LOADING CSS */ - - - - /* START TABS */ - - div#zp-Zotpress-Navigation { - border-bottom: 1px solid #ccc; - margin: 10px 0 20px; - overflow: visible; - /*height: 47px;*/ - height: 49px; - } - - div#zp-Zotpress-Navigation h1 { - font: 600 18px/24px "Source Sans Pro", sans-serif; - float: left; - margin: 0; - padding: 0.45em 5em 1em 0; - text-transform: uppercase; - } - div#zp-Zotpress-Navigation h1 em { - color: #c23d35; - font-style: normal; - } - - /* Nav Items */ - - div#zp-Zotpress-Navigation .nav-item, - div#zp-Zotpress-Navigation :visited.nav-item { - color: #000; - display: block; - float: left; - font: 300 15px/24px "Source Sans Pro", sans-serif; - padding: 0.75em 1.5em; - outline: none; - text-transform: uppercase; - text-decoration: none; - } - div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation .nav-item, - div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation :visited.nav-item { - color: #bbb; - } - - div#zp-Zotpress-Navigation :hover.nav-item { - border-bottom: 0.25em solid #000; - } - div#zp-Setup:not(.zp-Step-Selective) div#zp-Zotpress-Navigation :hover.nav-item { - border-bottom: none; - } - - div#zp-Zotpress-Navigation :focus.nav-item, - div#zp-Zotpress-Navigation :active.nav-item, - div#zp-Zotpress-Navigation .active.nav-item { - background-color: #eaeaea; - border-bottom: 0.25em solid #000; - box-shadow: none; - } - - div#zp-Zotpress-Navigation .nav-item.nav-tab-active, - div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active, - div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active:hover, - div#zp-Setup div#zp-Zotpress-Navigation .nav-item.nav-tab-active:active { - border-bottom: 0.25em solid #E14D43; - background-color: transparent; - color: #000; - } - - div#zp-Zotpress-Navigation .nav-item.nav-tab-active strong { - font-weight: bold; - margin-right: 0.25em; - } - - div#zp-Icon { - background: transparent url('../images/sprite.png') no-repeat -4px -310px; - float: left; - margin-right: 1em; - width: 33px; - height: 44px; - } - - /* END TABS */ - - - - /* START BROWSE */ - - div#zp-Options-Wrapper, - div#zp-Browse-Wrapper { - position: relative; - background-color: #fff; - border-bottom: 1px solid #ccc; - margin-top: -20px; - padding: 1em 0 0; - } - div#zp-Options-Wrapper:before, - div#zp-Options-Wrapper:after { - content: ""; - display: table; - } - div#zp-Options-Wrapper:after { - clear: both; - } - div#zp-Options-Wrapper h3, - div#zp-Browse-Wrapper h3 { - padding: 15px 30px 25px; - } - div#zp-Options-Wrapper h3 { - border-bottom: 1px solid #eee; - } - - div#zp-Zotpress div#zp-Options-Wrapper hr { - border-color: #eee; - margin-bottom: 0; - } - div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-1, - div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-2 { - border-color: #eee; - margin-right: 0; - width: 49.5%; - } - div#zp-Zotpress div#zp-Options-Wrapper div.zp-Column-Inner { - padding: 0 25px; - } - - div#zp-Browse { - background-color: #F9F9F9; - margin: 0; - padding: 0; - overflow: hidden; - width: 100%; - } - div#zp-Browse-Bar { - background-color: #ACBAD5; - float: left; - padding-bottom: 5000px; - margin-bottom: -5000px; - width: 25%; - } - div#zp-Browse label, - div#zp-Browse-Accounts label { - /*font: normal 600 1em/1.5em "Open Sans", Helvetica, Arial, sans-serif;*/ - font: normal 600 1em/1.75em "Droid Serif", serif; - color: #fff; - display: block; - padding: 4% 0 0 6%; - text-transform: uppercase; - } - - - /* Accounts */ - - div#zp-Browse-Accounts { - display: inline; - } - div#zp-Browse-Accounts label { - color: #ccc; - display: none; - font: normal 400 1em/1.75em "Droid Serif", serif; - margin-right: 5px; - padding: 0; - } - div#zp-Zotpress select#zp-FilterByAccount { - font-size: inherit; - line-height: inherit; - border: none; - box-shadow: none; - margin: 0; - padding: 0; - display: inline; - height: auto; - vertical-align: baseline; - } - div#zp-Zotpress select#zp-FilterByAccount.loading { - color: #ddd; - } - - div#zp-Browse-Account-Options { - position: absolute; - top: 35px; - right: 30px; - } - .zp-Browse-Account-Import { - padding-left: 3px !important; - margin-right: 5px !important; - transition: none !important; - } - .zp-Browse-Account-Import:before { - background-image: url("../images/sprite.png") !important; - background-repeat: no-repeat !important; - background-position: -252px -420px !important; - content: ""; - display: block; - float: left; - width: 25px; - height: 25px; - } - .zp-Browse-Account-Import.loading:before { - background-image: url("../images/loading_default.gif") !important; - background-position: 2px center !important; - } - .zp-Browse-Account-Default { - padding-left: 3px !important; - transition: none !important; - } - .zp-Browse-Account-Default:before { - background-image: url("../images/sprite.png") !important; - background-repeat: no-repeat !important; - background-position: -312px -420px !important; - content: ""; - display: block; - float: left; - width: 25px; - height: 25px; - } - .zp-Browse-Account-Default.selected:before { - background-position: -282px -420px !important; - } - .zp-Browse-Account-Default.loading:before { - background-image: url("../images/loading_default.gif") !important; - background-position: 2px center !important; - } - .zp-Browse-Account-Default.success:before { - background-image: url("../images/checkmark-green.png") !important; - background-position: 3px center !important; - } - - - /* Collection Folders */ - - div#zp-Browse-Collections { - background-color: #ACBAD5; - width: 100%; - } - - div#zp-Browse-Collections a.zp-List-Subcollection, - div#zp-Browse-Collections a.zp-List-Subcollection:visited - { - background-color: #7c8798; - border-bottom: 1px solid #687384; - color: #fff; - display: block; - font-size: 9pt; - line-height: 1.1; - padding: 4% 6% 4.5%; - outline: none; - text-decoration: none; - } - div#zp-Browse-Collections a.zp-List-Subcollection:hover - { - background-color: #9aa3af; - } - div#zp-Browse-Collections a.zp-List-Subcollection.selected, - div#zp-Browse-Collections a.zp-List-Subcollection.down, - div#zp-Browse-Collections a.zp-List-Subcollection:active, - div#zp-Browse-Collections a.zp-List-Subcollection:focus - { - background-color: #6d798b; - box-shadow: none; - color: #9aa3af; - } - div#zp-Browse-Collections a.zp-List-Subcollection span.name { - display: block; - font-weight: 600; - padding-bottom: 4%; - } - - - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel, - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel.selected { - background-color: #ACBAD5; - color: #fff; - font: normal 600 1em/1.75em "Droid Serif", serif; - padding: 3% 6%; - text-transform: uppercase; - } - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel span, - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel.down span, - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel.down:hover span, - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel:active span, - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel.selected span, - div#zp-Browse-Collections a.zp-List-Subcollection.toplevel.selected:hover span { - background: transparent url('../images/sprite.png') no-repeat -250px -558px; - padding-left: 24px; - } - - div#zp-Browse-Collections a.zp-List-Subcollection.child span.name, - div#zp-Browse-Collections a.zp-List-Subcollection.child:active span.name, - div#zp-Browse-Collections a.zp-List-Subcollection.child:hover span.name { - background: transparent url('../images/sprite.png') no-repeat 0 -730px; - padding-left: 10px; - } - div#zp-Browse-Collections a.zp-List-Subcollection.child.down span.name, - div#zp-Browse-Collections a.zp-List-Subcollection.child.down:hover span.name { - background: transparent url('../images/sprite.png') no-repeat -490px -730px; - padding-left: 10px; - } - div#zp-Browse-Collections a.zp-List-Subcollection.child span.item_key, - div#zp-Browse-Collections a.zp-List-Subcollection.child span.meta { - padding-left: 10px; - } - - div#zp-Browse-Collections a.zp-List-Subcollection span.item_key, - div#zp-Browse-Collections a.zp-List-Subcollection span.meta { - display: block; - font-size: 0.75em; - text-transform: uppercase; - } - div#zp-Browse-Collections a.zp-List-Subcollection span.item_key { - padding-bottom: 3px; - } - - div#zp-Browse-Collections a.zp-List-Subcollection.back span, - div#zp-Browse-Collections a.zp-List-Subcollection.back:hover span { - background: transparent url('../images/sprite.png') no-repeat 0 -812px; - padding-left: 15px; - } - div#zp-Browse-Collections a.zp-List-Subcollection.back:active span, - div#zp-Browse-Collections a.zp-List-Subcollection.back.down span, - div#zp-Browse-Collections a.zp-List-Subcollection.back.down:hover span { - background: transparent url('../images/sprite.png') no-repeat -490px -812px; - padding-left: 15px; - } - - div#zp-Browse-Collections a.zp-List-Subcollection.last { - border-bottom: none; - } - - div.zp-Collection-Title { - background-color: #fff; - border-bottom: 1px solid #eee; - color: #444; - font: normal 400 1em/1.75em "Droid Serif", serif; - padding: 0.9% 2%; - padding-right: 15px; - text-transform: uppercase; - } - div.zp-Collection-Title .item_key { - float: right; - color: #ccc; - } - div.zp-Collection-Title .item_key_inner { - float: right; - } - div.zp-Collection-Title .item_key_inner input, - div.zp-Collection-Title .item_key_inner span { - color: #444; - cursor: pointer; - display: block; - float: right; - text-align: right; - width: 6em; - } - div.zp-Collection-Title .item_key_inner input { - background: none; - border: none; - display: none; - font: normal 400 1em/1em "Droid Serif", serif; - margin: 0; - padding: 0; - } - div.zp-Collection-Title .item_key_inner input:focus { - border: none; - box-shadow: none; - margin-top: 0.3em; - } - - /* Browse Tags */ - - div#zp-Browse-Tags { - background-color: #ACBAD5; - border-top: 1px solid #687384; - padding: 0.05em 0 5%; - width: 100%; - } - div#zp-Browse-Tags:before, - div#zp-Browse-Tags:after { - content: ""; - display: table; - } - div#zp-Browse-Tags:after { - clear: both; - } - div#zp-Browse-Tags label span { - background: transparent url('../images/sprite.png') no-repeat -483px -556px; - padding-left: 22px; - } - select#zp-List-Tags { - background: #99abcc; - border: none; - border: 1px solid #8798b4; - box-shadow: 0 1px 2px #8798b4 inset; - color: #fff; - font-size: 0.9em; - margin: 4% 6%; - width: 88%; - } - select#zp-List-Tags.active { - background-color: #fff; - color: #7988a2; - } - select#zp-List-Tags:focus { - border: 1px solid #8798b4; - box-shadow: none; - } - select#zp-List-Tags:focus { - background: #8397b8; - border-color: #7185a6; - color: #fff; - } - select#zp-List-Tags option { - background: #fff; - border-bottom: 1px solid #eee; - color: #666; - padding: 0.5em 1em; - } - - - /* Pagination */ - - div#zp-Zotpress div#zp-Pagination { - position: relative; - background-color: #fff; - /*border-top: 1px solid #eee;*/ - clear: both; - min-height: 3em; - } - div#zp-Pagination span { - display: block; - font-size: 12px; - font-family: "Droid Serif", serif; - padding: 1em; - text-align: right; - text-shadow: 0 1px 0 #FAFAFA; - } - - /* END BROWSE */ - - - - /* START CITATION LISTS */ - - div#zp-Zotpress div#zp-List { - float: right; - border-top: 1px solid #E5E5E5; - border-bottom: 1px solid #eee; - width: 75%; - } - - div#zp-Zotpress div#zp-List h3 { - display: block; - color: #bbb; - background: #333; - font: 400 19px/24px "Oswald","Times New Roman","Bitstream Charter",Times,serif; - margin: -3px 0 0; - padding: 10px 15px; - } - div#zp-Zotpress div#zp-List h3 em { - color: #fff; - font-style: normal; - } - - div#zp-Zotpress div#zp-List p { - margin: 1em; - } - - div#zp-Zotpress div#zp-List a, - div#zp-Zotpress div#zp-List a:visited - { - color: #E14D43; /* bae1fe */ - text-decoration: none; - } - div#zp-Zotpress div#zp-List h3 a { - float: right; - } - div#zp-Zotpress div#zp-List a:hover { - color: #fff; - } - div#zp-Zotpress div#zp-List a:active { - color: #999; - } - - /* END CITATION LISTS */ - - - - /* START CITATIONS */ - - div#zp-Zotpress div#zp-List div.zp-Entry { - background-color: #fff; - padding: 15px; - } - div#zp-Zotpress div#zp-List div.zp-Entry:before, - div#zp-Zotpress div#zp-List div.zp-Entry:after { - content: ""; - display: table; - } - div#zp-Zotpress div#zp-List div.zp-Entry:after { - clear: both; - } - div#zp-Zotpress div#zp-List div.zp-Entry.odd { - background-color: transparent; - } - - div#zp-Zotpress div#zp-List div.zp-Entry-Image { - position: relative; - float: right; - margin-left: 15px; - overflow: hidden; - text-align: center; - width: 100px; - height: 100px; - } - - div#zp-Zotpress div#zp-List div.zp-Entry-Image a.upload, - div#zp-Zotpress div#zp-List div.zp-Entry-Image a.upload:link, - div#zp-Zotpress div#zp-List div.zp-Entry-Image a.upload:visited, - div#zp-Zotpress div#zp-List div.zp-Entry-Image a.upload:active - { - z-index: 2; - top: 0; - left: 0; - position: absolute; - background-color: #F6F6F6; - border: 2px dashed #eee; - color: #ccc; - display: block; - font-size: 0.9em; - font-weight: bold; - line-height: 96px; - text-decoration: none; - width: 96px; - height: 96px; - } - div#zp-Zotpress div#zp-List div.zp-Entry-Image.hasimage a.upload { - background: transparent; - border: none; - color: #fff; - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter: alpha(opacity=0); - -moz-opacity: 0; - -khtml-opacity: 0; - text-shadow: 0px 0px 3px rgba(0, 0, 0, 1.0); - width: 100px; - height: 100px; - } - div#zp-Zotpress div#zp-List div.zp-Entry-Image a.upload:hover { - background-color: #a8cf30; - border: 2px solid #a8cf30; - color: #fff; - } - div#zp-Zotpress div#zp-List div.zp-Entry-Image.hasimage a.upload:hover { - background: transparent; - border: none; - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - filter: alpha(opacity=100); - -moz-opacity: 1; - -khtml-opacity: 1; - width: 100px; - height: 100px; - } - div#zp-Zotpress div#zp-List div.zp-Entry-Image a.delete { - position: absolute; - z-index: 3; - top: 0; - right: 0; - left: auto; - border: none; - background-color: #E14D43; - color: #fff; - display: none; - font-size: 14pt; - font-weight: bold; - line-height: 25px; - text-align: center; - width: 25px; - height: 25px; - } - div#zp-Zotpress div#zp-List div.zp-Entry-Image.hover.hasimage a.delete { - display: block; - } - - div#zp-Zotpress div#zp-List div.zp-Entry-Image img { - z-index: 1; - position: absolute; - top: 0; - left: 0; - width: 100px; - height: 100px; - } - - div#zp-Zotpress div.zp-Entry div.csl-bib-body { - font-size: 0.9em; - margin: 0 0 15px; - } - - div#zp-Zotpress div.zp-Entry div.zp-Entry-ID { - /*border-top: 1px dashed #EEEEEE;*/ - color: #999; - font-size: 10px; - display: block; - margin: 0; - } - div#zp-Zotpress div.zp-Entry div.zp-Entry-ID span.title { - /*color: #ccc;*/ - text-transform: uppercase; - } - div#zp-Zotpress div.zp-Entry div.zp-Entry-ID div { - display: inline-block; - } - div#zp-Zotpress div.zp-Entry div.zp-Entry-ID-Text span { - cursor: pointer; - } - div#zp-Zotpress div.zp-Entry div.zp-Entry-ID input { - border: 0; - background: transparent; - color: #999; - display: none; - font-size: 10px; - padding: 0; - margin: 0; - } - - /* END CITATIONS */ - - - - /* START IMAGE FORM */ - - div#zp-Zotpress form#zp-Image { - -moz-border-radius: 10px; - background-color: #fafafa; - margin: 0.75em 0 30px 0; - width: 780px; - } - - div#zp-Zotpress form#zp-Image fieldset { - padding: 10px 20px; - } - - div#zp-Zotpress form#zp-Image div.section { - margin: 10px 0; - } - - div#zp-Zotpress form#zp-Image div.zp-Image-Current { - float: right; - overflow: hidden; - margin: 20px; - max-width: 310px; - max-height: 310px; - } - - div#zp-Zotpress div.zp-Citation { - width: 780px; - } - div#zp-Zotpress div.zp-Citation div.csl-bib-body { - margin: 0; - } - div#zp-Zotpress div.zp-Citation div.zp-Entry { - min-height: 0; - } - - div#zp-Zotpress form#zp-Image span.help { - color: #999; - font: italic 11px/14px 'Georgia', serif; - } - - div#zp-Zotpress form#zp-Image #zp-Submit, - div#zp-Zotpress form#zp-Image #zp-Cancel { - float: left; - } - div#zp-Zotpress form#zp-Image #zp-Submit { - margin-right: 4px; - } - - div#zp-Zotpress form#zp-Image div.zp-Loading { - display: none; - float: left; - margin: 0 0 0 4px; - } - - div#zp-Zotpress form#zp-Image div.zp-Errors, - div#zp-Zotpress form#zp-Image div.zp-Success { - margin-left: 140px; - padding-left: 35px; - } - div#zp-Zotpress form#zp-Image div.zp-Errors p, - div#zp-Zotpress form#zp-Image div.zp-Success p { - padding: 6px 0 1px; - } - - /* END IMAGE FORM */ - - - - /* START OF HIDDEN URL CSS */ - - span#ZOTPRESS_PLUGIN_URL { - display: none; - } - - /* END OF HIDDEN URL CSS */ - - - - /* START ACCOUNTS */ - - div#zp-ManageAccounts { - clear: both; - } - div#zp-ManageAccounts h3 { - width: 50%; - } - - a.zp-AddAccountButton, - a.zp-AddAccountButton:link, - a.zp-AddAccountButton:visited, - a.zp-AddAccountButton:active, - a.zp-AddAccountButton:hover { - float: right; - margin-top: -2.55em; - text-shadow: none; - } - a.zp-AddAccountButton span { - background: transparent url('../images/sprite.png') no-repeat 0 -351px; - padding: 0 2px 0 16px; - } - a.zp-AddAccountButton:hover { - background: #ceec8a; - } - a.zp-AddAccountButton:hover span { - background-position: -161px -351px; - } - a.zp-AddAccountButton:active { - background: #777; - color: #000; - } - a.zp-AddAccountButton:active span { - background-position: -161px -350px; - } - - #zp-Accounts { - margin: 1.55em 0; - } - - #zp-Accounts th { - font: 300 1.1em/1.1em "Droid Serif", sans-serif; - } - - #zp-Accounts .account_type { - width: 3em; - } - #zp-Accounts .api_user_id { - width: 4em; - } - #zp-Accounts .public_key { - width: 13.5em; - } - #zp-Accounts .status { - text-align: center; - width: 5em; - } - #zp-Accounts .status .status_good { - color: #008000; - font-weight: bold; - } - #zp-Accounts .status .status_bad { - color: #DD3D36; - font-weight: bold; - } - #zp-Accounts .actions { - width: 22.5em; - } - - #zp-AccountsList .default a, - #zp-AccountsList .actions a { - display: block; - float: left; - outline: none; - margin: 0 1.25em 0 0; - height: 25px; - } - #zp-AccountsList .default a:focus, - #zp-AccountsList .actions a:focus { - box-shadow: none; - } - @media only screen and (max-width: 1200px) - { - #zp-AccountsList .default a, - #zp-AccountsList .actions a { - margin-right: 0.25em; - width: 25px; - height: 25px; - overflow: hidden; - } - #zp-Accounts th.default { - width: 50px; - } - #zp-Accounts .actions { - width: 94px; - } - } - #zp-AccountsList .default a:before, - #zp-AccountsList .actions a:before { - background-image: url('../images/sprite.png'); - background-repeat: no-repeat; - padding: 0.15em 0 0.15em 2em; - vertical-align: middle; - - content: ""; - width: 25px; - height: 25px; - } - #zp-AccountsList .default a:hover:before, - #zp-AccountsList .actions a:hover:before { - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; - filter: alpha(opacity=50); - -moz-opacity: 0.5; - -khtml-opacity: 0.5; - opacity: 0.5; - } - #zp-AccountsList .actions a.sync span.icon { - background-position: -31px -422px; - } - #zp-AccountsList .actions a.sync.syncing span.icon { - background: transparent url('../images/syncing.gif') no-repeat 0 0; - } - #zp-AccountsList .actions a.sync.error span.icon { - background-position: -51px -422px; - } - #zp-AccountsList .actions a.sync.success span.icon { - background-position: -61px -422px; - } - #zp-AccountsList .actions a.selective:before { - background-position: -252px -423px; - } - #zp-AccountsList .actions a.import:before { - background-position: 0 -423px; - } - #zp-AccountsList .actions a.delete:before { - background-position: -105px 0; - } - #zp-AccountsList .actions a.delete { - margin-right: 0; - } - - #zp-AccountsList .default a.default { - float: none; - margin: 0 auto; - } - #zp-AccountsList .default.selected a.default:before { - background-position: -282px -423px !important; - } - #zp-AccountsList .default a.default:before { - background-position: -312px -423px !important; - } - #zp-AccountsList .default a.default.loading:before { - background-position: 2px center !important; - background-image: url('../images/loading_default.gif'); - background-repeat: no-repeat; - } - #zp-AccountsList .default a.default.success:before { - background-position: 2px center !important; - background-image: url('../images/checkmark-green.png'); - background-repeat: no-repeat; - } - - /* END ACCOUNTS */ - - - - - - - /* START OF MODAL CSS */ - - .zp-Modal #adminmenu, - .zp-Modal #footer, - .zp-Modal #wphead - { - display: none; - } - .zp-Modal #wpbody { - margin-left: 25px; - } - body.wp-admin.zp-Modal { - min-width: 400px; - } - - /* END OF MODAL CSS */ - - - - /* START OF DOCUMENTATION CSS */ - - div#zp-Intext-Example { - background-color: #fff; - -moz-box-shadow: 0 0 1px #aaa; - -webkit-box-shadow: 0 0 1px#aaa; - box-shadow: 0 0 1px #aaa; - float: right; - font: normal 400 12px/18px "Droid Serif","Georgia",serif; - margin: 1em 0 0 2em; - padding: 2em; - width: 24%; - } - div#zp-Intext-Example .title { - font-weight: 600; - font-style: italic; - } - - div#zp-Zotpress code { - background: #ddd; - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - font-family: "Monaco", monospace; - padding: 2px 3px; - } - - .zp-Documentation { - border: none; - background-color: #fff; - margin: 2em 0; - padding: 0; - } - - .zp-Documentation strong { - font-weight: bold; - } - div#zp-Zotpress .zp-Documentation code { - background: #eaeaea; - } - - .zp-Documentation tr, - .zp-Documentation th, - .zp-Documentation td { - border: none; - font-weight: 300; - margin: 0; - padding: 8px 16px; - text-align: left; - vertical-align: top; - } - .zp-Documentation td { - border-bottom: 1px solid #f1f1f1; - padding: 12px 16px; - } - .zp-Documentation .zebra td { - background-color: #f9f9f9; - border-bottom: 1px solid #eee; - } - .zp-Documentation p { - margin: 0; - } - - .zp-Documentation .main { - background-color: #333; - border-bottom: none; - color: #fff; - font: 400 1.5em/1.5em "Oswald", sans-serif; - text-transform: uppercase; - } - - .zp-Documentation .category, - .zp-Documentation .type { - /*font: 400 1.25em/1.25em "Source Sans Pro", sans-serif;*/ - font: 600 1em/1.25em "Source Sans Pro", sans-serif; - text-transform: uppercase; - } - - .zp-Documentation .category, - .zp-Documentation .zebra .category { - background-color: #666; - border-bottom: 1px solid #999; - color: #fff; - } - - .zp-Documentation .type { - background-color: #ACBAD5; - border-bottom: 1px solid #859ac2; - } - .zp-Documentation .zebra .type { - background-color: #99abcc; - border-bottom: 1px solid #859ac2; - } - - .zp-Documentation .code { - background-color: #ffcb15; - border-bottom: 1px solid #f9a93e; - } - .zp-Documentation .zebra .code { - background-color: #ffb915; - border-bottom: 1px solid #f2aa00; - } - .zp-Documentation .example { - min-width: 20em; - padding-right: 0; - } - .zp-Documentation .example p { - margin-bottom: 0.25em; - } - - .zp-Documentation p.break { - margin-top: 1em; - } - - /*.zp-Documentation tr.last td,*/ - .zp-Documentation td.last { - border-bottom: none; - } - - /* END OF DOCUMENTATION CSS */ - - - - /* START OF MESSAGE CSS */ - - div.zp-Message { - background-color: #ffcb15; - display: block; - float: right; - margin-left: 20px; - margin-top: -30px; - overflow: hidden; - width: 275px; - } - div#zp-Zotpress div.zp-Message h3 { - font-size: 21px; - line-height: 1.4em; - padding: 1.2em; - padding-bottom: 0; - } - div.zp-Message p { - font: italic 400 14px/21px "Droid Serif", "Georgia", serif; - margin: 0; - padding: 2em; - } - div.zp-Message p.rate { - background-color: #333; - color: #fff; - text-shadow: 0 1px 0 #000; - } - div.zp-Message p.version { - color: #333; - font-size: 0.9em; - padding-top: 1em; - } - div.zp-Message p.version a, - div.zp-Message p.version a:visited, - div.zp-Message p.version a:active { - color: #666; - } - div.zp-Message p.version a:hover { - color: #999; - } - div.zp-Message p.version strong { - font: 600 11px/1em "Source Sans Pro","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif; - text-transform: uppercase; - } - a.zp-FiveStar { - background: transparent url('../images/sprite.png') no-repeat -160px -1px; - color: #ffd900; - padding-left: 95px; - } - - ol.zp-WaysToUseZotpress { - list-style: none; - margin: 2em; - } - ol.zp-WaysToUseZotpress li { - background: transparent url('../images/sprite.png') no-repeat -300px 2px; - list-style-position: inside; - padding-left: 5px; - margin-bottom: 12px; - } - ol.zp-WaysToUseZotpress li span.number { - float: left; - font-size: 10px; - margin-left: 1px; - margin-top: 3px; - margin-right: 14px; - } - ol.zp-WaysToUseZotpress li strong { - font: 600 1em/1em "Source Sans Pro","HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif; - text-transform: uppercase; - } - ol.zp-WaysToUseZotpress li p.indent { - margin-top: -12px; - margin-bottom: 14px; - text-indent: 21px; - } - - /* END OF MESSAGE CSS */ - - - - /* START OF OPTIONS PAGE CSS */ - - div.zp-Zotpress-Options { - border-left: 0.35em solid #000; - margin: 20px 0 30px; - padding: 0.6em 1em; - } - div.zp-Zotpress-Options:before, - div.zp-Zotpress-Options:after { - content: ""; - display: table; - } - div.zp-Zotpress-Options:after { - clear: both; - } - - div#zp-Zotpress div.zp-Column-1 { - border-right: 1px solid #ddd; - float: left; - margin-right: 4%; - width: 47.5% - } - div#zp-Zotpress div.zp-Column-2 { - float: left; - width: 47.5% - } - - div.zp-Zotpress-Options label { - font: 300 0.9em/1em "Droid Serif", sans-serif; - margin: 0 0 0.5em 0; - text-transform: uppercase; - } - - div.zp-Zotpress-Options label, - div.zp-Zotpress-Options select { - display: block; - } - div.zp-Zotpress-Options select { - margin-bottom: 0.5em; - } - - div.zp-Zotpress-Options input.button-secondary { - float: left; - margin-top: 10px; - } - - div#zp-Zotpress div.zp-Zotpress-Options div.zp-Loading { - display: none; - float: left; - margin: 0.6em 0 0 0.25em; - } - div#zp-Zotpress div.zp-Zotpress-Options div.zp-Success, - div#zp-Zotpress div.zp-Zotpress-Options div.zp-Errors { - margin: 0.6em 0 0; - padding: 6px 0 4px 32px; - float: left; - } - - div#zp-Zotpress-Options-Style-New-Container { - display: none; - margin: 1.5em 0 0.5em; - } - select#zp-Zotpress-Options-Style option#new { - border-top: 1px dotted #CCCCCC; - font-weight: bold; - font-style: italic; - } - - div#zp-Zotpress .zp-Column-1 p.note { - /*margin-right: 1em;*/ - } - - div#zp-Zotpress-Options-Reset { - border-left: 0; - padding: 0; - } - - div.zp-CPT-Checkbox { - float: left; - width: 50%; - } - div.zp-Zotpress-Options div.zp-CPT-Checkbox label { - display: inline; - line-height: 2em; - vertical-align: 0.05em; - } - div.zp-Zotpress-Options div.zp-CPT-Checkbox label.dis { - color: #ccc; - } - - /* END OF OPTIONS PAGE CSS */ - - - .ui-tooltip-tipsy .ui-tooltip-titlebar, .ui-tooltip-tipsy .ui-tooltip-content { - font-weight: normal !important; - width: 300px !important; - } - \ No newline at end of file diff --git a/css/zotpress.help.css b/css/zotpress.help.css new file mode 100644 index 0000000..fd2048a --- /dev/null +++ b/css/zotpress.help.css @@ -0,0 +1,325 @@ + +/* START OF HELP CSS */ + +div#zp-Zotero-API { + background-color: #fff; +} + +div#zp-Zotpress ul#zp-Zotero-API-Menu { + background-color: #26292c; + display: block; + margin: 3em 0 0; +} +div#zp-Zotpress ul#zp-Zotero-API-Menu:before, +div#zp-Zotpress ul#zp-Zotero-API-Menu:after { + content: ""; + display: table; +} +div#zp-Zotpress ul#zp-Zotero-API-Menu:after { + clear: both; +} + +div#zp-Zotpress ul#zp-Zotero-API-Menu li { + background: none; + display: block; + float: left; + margin: 0; + padding: 0; +} +div#zp-Zotpress ul#zp-Zotero-API-Menu li a { + color: #fff; + display: block; + font: normal 1em/2.15em "Helvetica", "Arial", sans-serif; + padding: 1em 2em; + text-transform: uppercase; + text-decoration: none; +} + +div#zp-Zotpress ul#zp-Zotero-API-Menu li.ui-tabs-active { + background-color: #e14d43; +} +div#zp-Zotpress ul#zp-Zotero-API-Menu li a:focus { + box-shadow: none; +} + + +div.zp-Zotero-API-Explanation { + background: #fff; + padding: 1em 2em 1em; +} +div.zp-Zotero-API-Explanation:after { + clear: both; + content: ""; + display: table; +} + + +div.zp-Zotero-API-Attributes { + background-color: #e3e3e3; + padding: 1px 5px; +} +div.zp-Zotero-API-Attributes-Search { + background-color: transparent; + margin: 5px 0; +} +div.zp-Zotero-API-Attributes-Search:after { + content: ""; + display: table; + clear: both; +} +input[type="text"].zp-Zotero-API-Attributes-Search-Input { + background-color: #fff; + border: 0; + border-radius: 0; + box-shadow: none; + color: #e14d43; + float: left; + font-size: 26px; /* 2em 14px */ + font-weight: bold; + margin: 0; + padding: 14px 1em; + width: 92.5%; +} +input[type="text"].zp-Zotero-API-Attributes-Search-Input::placeholder { + color: #aaa; + font-weight: normal; + font-style: italic; +} +div.zp-Zotero-API-Attributes-Search-Status { + background: #fff; + float: left; + padding: 10px 0 11px; + width: 7.5%; +} +div.zp-Zotero-API-Attributes-Search-Status .zp-Loading, +div.zp-Zotero-API-Attributes-Search-Status .dashicons { + font-size: 30px; + float: right; + line-height: 2.1; + width: 2.1em; + height: 1.96em; +} +div.zp-Zotero-API-Attribute { + border-bottom: 1px solid #eee; + background-color: #fff; + margin: 5px 0; + padding: 2em; +} +div#zp-Zotpress div.zp-Zotero-API-Attribute h4 { + font: 600 1em/1em "Helvetica", Arial, sans-serif; + margin-top: 0.5em; + text-transform: uppercase; +} +div#zp-Zotpress div.zp-Zotero-API-Attribute h4 strong { + text-transform: lowercase; + font-size: 2em; +} + +/* END OF HELP CSS */ + + + + +/* START OF MESSAGE CSS */ + +div.zp-Message { + /*background-color: #ffcb15;*/ + background-color: #e14d43; + display: block; + float: right; + margin-left: 20px; + margin-top: -30px; + overflow: hidden; + width: 278px; +} +div#zp-Zotpress div.zp-Message h3 { + color: #fff; + font-size: 21px; + line-height: 1.4em; + padding: 1.2em; + padding-bottom: 0; +} +div.zp-Message p { + color: #fff; + font: italic 400 14px/21px "Georgia", serif; + margin: 0; + padding: 2em; +} +div.zp-Message p.rate { + background-color: #26292c; + text-shadow: 0 1px 0 #000; +} +div.zp-Message p.version { + font-size: 1em; + padding-top: 1em; +} +div.zp-Message p.version a, +div.zp-Message p.version a:visited, +div.zp-Message p.version a:active { + color: #fff; +} +div.zp-Message p.version a:hover { + color: #fff; +} +div.zp-Message p.version a#zp-Donate { + background: transparent url('../images/pp.png') no-repeat right center; + padding-right: 16px; +} +div.zp-Message p.version strong { + color: #fff; + font: 600 10px/1em "Helvetica", Arial, sans-serif; + text-transform: uppercase; +} +a.zp-FiveStar { + background: transparent url('../images/sprite.png') no-repeat -160px -1px; + color: #ffd900; + padding-left: 95px; +} + +/* END OF MESSAGE CSS */ + + + +/* START OF DOCUMENTATION CSS */ + +div#zp-InText-Example { + background-color: #fff; + -moz-box-shadow: 0 0 1px #aaa; + -webkit-box-shadow: 0 0 1px#aaa; + box-shadow: 0 0 1px #aaa; + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + align-items: stretch; + float: right; + font: normal 400 12px/18px "Georgia", serif; + margin: 0.5em; + padding: 0.5em; + width: 50%; +} +div#zp-InText-Example:after { + clear: both; + content: ""; + display: table; +} +div.zp-InText-Example-Col { + padding: 0 2%; + width: calc(45.5% - 4px); +} +div.zp-InText-Example-Col:nth-child(1) { + margin-right: 1.5%; +} +div.zp-InText-Example-Col.alt { + background-color: #f3f3f3; +} +div#zp-Zotpress div.zp-InText-Example-Col h4 { + font-size: 1.25em; + margin: 0; + padding: 1em 0 0; +} +div#zp-InText-Example .title { + font-weight: 600; + font-style: italic; +} + +div#zp-Zotpress code { + background: #ddd; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + font-family: "Monaco", monospace; + padding: 2px 3px; +} + +.zp-Documentation { + border: none; + background-color: #fff; + margin: 2em 0; + padding: 0; +} + +.zp-Documentation strong { + font-weight: bold; +} +div#zp-Zotpress .zp-Documentation code { + background: #eaeaea; +} + +.zp-Documentation tr, +.zp-Documentation th, +.zp-Documentation td { + border: none; + font-weight: 300; + margin: 0; + padding: 8px 16px; + text-align: left; + vertical-align: top; +} +.zp-Documentation td { + border-bottom: 1px solid #f1f1f1; + padding: 12px 16px; +} +.zp-Documentation .zebra td { + background-color: #f9f9f9; + border-bottom: 1px solid #eee; +} +.zp-Documentation p { + margin: 0; +} + +.zp-Documentation .main { + background-color: #333; + border-bottom: none; + color: #fff; + font: 400 1.5em/1.5em "Helvetica", "Helvetica Neue", "Arial", sans-serif; + text-transform: uppercase; +} + +.zp-Documentation .category, +.zp-Documentation .type { + font: 600 1em/1.25em "Helvetica", Arial, sans-serif; + text-transform: uppercase; +} + +.zp-Documentation .category, +.zp-Documentation .zebra .category { + background-color: #666; + border-bottom: 1px solid #999; + color: #fff; +} + +.zp-Documentation .type { + background-color: #ACBAD5; + border-bottom: 1px solid #859ac2; +} +.zp-Documentation .zebra .type { + background-color: #99abcc; + border-bottom: 1px solid #859ac2; +} + +.zp-Documentation .code { + background-color: #ffcb15; + border-bottom: 1px solid #f9a93e; +} +.zp-Documentation .zebra .code { + background-color: #ffb915; + border-bottom: 1px solid #f2aa00; +} +.zp-Documentation .example { + min-width: 20em; + padding-right: 0; +} +.zp-Documentation .example p { + margin-bottom: 0.25em; +} + +.zp-Documentation p.break { + margin-top: 1em; +} + +/*.zp-Documentation tr.last td,*/ +.zp-Documentation td.last { + border-bottom: none; +} + +/* END OF DOCUMENTATION CSS */ diff --git a/css/zotpress.help.min.css b/css/zotpress.help.min.css new file mode 100644 index 0000000..699dec5 --- /dev/null +++ b/css/zotpress.help.min.css @@ -0,0 +1 @@ +div#zp-Zotero-API{background-color:#fff}div#zp-Zotpress ul#zp-Zotero-API-Menu{background-color:#26292c;display:block;margin:3em 0 0}div#zp-Zotpress ul#zp-Zotero-API-Menu:after,div#zp-Zotpress ul#zp-Zotero-API-Menu:before{content:"";display:table}div#zp-Zotpress ul#zp-Zotero-API-Menu:after{clear:both}div#zp-Zotpress ul#zp-Zotero-API-Menu li{background:0 0;display:block;float:left;margin:0;padding:0}div#zp-Zotpress ul#zp-Zotero-API-Menu li a{color:#fff;display:block;font:normal 1em/2.15em Helvetica,Arial,sans-serif;padding:1em 2em;text-transform:uppercase;text-decoration:none}div#zp-Zotpress ul#zp-Zotero-API-Menu li.ui-tabs-active{background-color:#e14d43}div#zp-Zotpress ul#zp-Zotero-API-Menu li a:focus{box-shadow:none}div.zp-Zotero-API-Explanation{background:#fff;padding:1em 2em 1em}div.zp-Zotero-API-Explanation:after{clear:both;content:"";display:table}div.zp-Zotero-API-Attributes{background-color:#e3e3e3;padding:1px 5px}div.zp-Zotero-API-Attributes-Search{background-color:transparent;margin:5px 0}div.zp-Zotero-API-Attributes-Search:after{content:"";display:table;clear:both}input[type=text].zp-Zotero-API-Attributes-Search-Input{background-color:#fff;border:0;border-radius:0;box-shadow:none;color:#e14d43;float:left;font-size:26px;font-weight:700;margin:0;padding:14px 1em;width:92.5%}input[type=text].zp-Zotero-API-Attributes-Search-Input::placeholder{color:#aaa;font-weight:400;font-style:italic}div.zp-Zotero-API-Attributes-Search-Status{background:#fff;float:left;padding:10px 0 11px;width:7.5%}div.zp-Zotero-API-Attributes-Search-Status .dashicons,div.zp-Zotero-API-Attributes-Search-Status .zp-Loading{font-size:30px;float:right;line-height:2.1;width:2.1em;height:1.96em}div.zp-Zotero-API-Attribute{border-bottom:1px solid #eee;background-color:#fff;margin:5px 0;padding:2em}div#zp-Zotpress div.zp-Zotero-API-Attribute h4{font:600 1em/1em Helvetica,Arial,sans-serif;margin-top:.5em;text-transform:uppercase}div#zp-Zotpress div.zp-Zotero-API-Attribute h4 strong{text-transform:lowercase;font-size:2em}div.zp-Message{background-color:#e14d43;display:block;float:right;margin-left:20px;margin-top:-30px;overflow:hidden;width:278px}div#zp-Zotpress div.zp-Message h3{color:#fff;font-size:21px;line-height:1.4em;padding:1.2em;padding-bottom:0}div.zp-Message p{color:#fff;font:italic 400 14px/21px Georgia,serif;margin:0;padding:2em}div.zp-Message p.rate{background-color:#26292c;text-shadow:0 1px 0 #000}div.zp-Message p.version{font-size:1em;padding-top:1em}div.zp-Message p.version a,div.zp-Message p.version a:active,div.zp-Message p.version a:visited{color:#fff}div.zp-Message p.version a:hover{color:#fff}div.zp-Message p.version a#zp-Donate{background:transparent url(../images/pp.png) no-repeat right center;padding-right:16px}div.zp-Message p.version strong{color:#fff;font:600 10px/1em Helvetica,Arial,sans-serif;text-transform:uppercase}a.zp-FiveStar{background:transparent url(../images/sprite.png) no-repeat -160px -1px;color:#ffd900;padding-left:95px}div#zp-InText-Example{background-color:#fff;-moz-box-shadow:0 0 1px #aaa;-webkit-box-shadow:0 0 1px#aaa;box-shadow:0 0 1px #aaa;display:flex;flex-wrap:wrap;justify-content:space-evenly;align-items:stretch;float:right;font:normal 400 12px/18px Georgia,serif;margin:.5em;padding:.5em;width:50%}div#zp-InText-Example:after{clear:both;content:"";display:table}div.zp-InText-Example-Col{padding:0 2%;width:calc(45.5% - 4px)}div.zp-InText-Example-Col:nth-child(1){margin-right:1.5%}div.zp-InText-Example-Col.alt{background-color:#f3f3f3}div#zp-Zotpress div.zp-InText-Example-Col h4{font-size:1.25em;margin:0;padding:1em 0 0}div#zp-InText-Example .title{font-weight:600;font-style:italic}div#zp-Zotpress code{background:#ddd;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;font-family:Monaco,monospace;padding:2px 3px}.zp-Documentation{border:none;background-color:#fff;margin:2em 0;padding:0}.zp-Documentation strong{font-weight:700}div#zp-Zotpress .zp-Documentation code{background:#eaeaea}.zp-Documentation td,.zp-Documentation th,.zp-Documentation tr{border:none;font-weight:300;margin:0;padding:8px 16px;text-align:left;vertical-align:top}.zp-Documentation td{border-bottom:1px solid #f1f1f1;padding:12px 16px}.zp-Documentation .zebra td{background-color:#f9f9f9;border-bottom:1px solid #eee}.zp-Documentation p{margin:0}.zp-Documentation .main{background-color:#333;border-bottom:none;color:#fff;font:400 1.5em/1.5em Helvetica,"Helvetica Neue",Arial,sans-serif;text-transform:uppercase}.zp-Documentation .category,.zp-Documentation .type{font:600 1em/1.25em Helvetica,Arial,sans-serif;text-transform:uppercase}.zp-Documentation .category,.zp-Documentation .zebra .category{background-color:#666;border-bottom:1px solid #999;color:#fff}.zp-Documentation .type{background-color:#acbad5;border-bottom:1px solid #859ac2}.zp-Documentation .zebra .type{background-color:#99abcc;border-bottom:1px solid #859ac2}.zp-Documentation .code{background-color:#ffcb15;border-bottom:1px solid #f9a93e}.zp-Documentation .zebra .code{background-color:#ffb915;border-bottom:1px solid #f2aa00}.zp-Documentation .example{min-width:20em;padding-right:0}.zp-Documentation .example p{margin-bottom:.25em}.zp-Documentation p.break{margin-top:1em}.zp-Documentation td.last{border-bottom:none} diff --git a/css/zotpress.metabox.css b/css/zotpress.metabox.css index 8526db2..1c891d8 100644 --- a/css/zotpress.metabox.css +++ b/css/zotpress.metabox.css @@ -1,534 +1,667 @@ - - - /* START OF AUTOCOMPLETE CSS */ - - .ui-autocomplete.zp-autocomplete { - background: none; - background-color: #fff; - border: 1px solid #ddd; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); - -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); - margin: 0; - padding: 0; - max-height: 200px; - width: 253px !important; - overflow-y: auto; - overflow-x: hidden; /* prevent horizontal scrollbar */ - } - .ui-autocomplete.zp-autocomplete-wide { - width: 775px !important; - } - - .ui-autocomplete.zp-autocomplete li { - background: none; - border: none; - font-weight: 400; - font-size: 0.75rem; - line-height: 1.2; - margin: 0; - padding: 0; - white-space: normal; - /*width: 253px;*/ - } - .ui-autocomplete.zp-autocomplete-wide li { - /*width: 775px;*/ - } - - .ui-autocomplete.zp-autocomplete-wide li strong { - font-weight: 600; - } - - .ui-autocomplete.zp-autocomplete li a { - background: none; - border: none; - border-bottom: 1px solid #ddd; - color: #666; - margin: 0; - padding: 6px 10px 6px 10px; - } - .ui-autocomplete.zp-autocomplete li a.ui-state-focus, - .ui-autocomplete.zp-autocomplete li a.ui-state-hover { - background: none; - background-color: #eee; /* 8ec5fb */ - margin: 0; - - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - } - - .ui-tabs .ui-tabs-nav li a, - .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { - outline: none; - } - - /* END OF AUTOCOMPLETE CSS */ - - - - /* START OF IN-TEXT CSS */ - - div#zp-ZotpressMetaBox-Biblio-Citations, - div#zp-ZotpressMetaBox-Citations { - border: 5px solid #E14D43; - margin: 0.5em; - - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - } - div#zp-ZotpressMetaBox-Citations { - border: 5px solid #0080c0; - } - - input#zp-ZotpressMetaBox-Biblio-Citations-Search, - input#zp-ZotpressMetaBox-Citations-Search { - border: none; - background: #fff; - font-size: 1em; - margin: 0; - width: 100%; - } - input#zp-ZotpressMetaBox-Biblio-Citations-Search.ui-autocomplete-loading, - input#zp-ZotpressMetaBox-Citations-Search.ui-autocomplete-loading { - background: #fff url("../images/loading_default.gif") no-repeat 225px center; - } - input#zp-ZotpressMetaBox-Biblio-Citations-Search.help, - input#zp-ZotpressMetaBox-Citations-Search.help { - color: #aaa; - } - - div#zp-ZotpressMetaBox-Biblio-Shortcode, - div#zp-ZotpressMetaBox-InTextCreator-Shortcode { - padding: 0.75em; - } - div#zp-ZotpressMetaBox-Biblio-Shortcode-Inner, - div#zp-ZotpressMetaBox-InTextCreator-Shortcode-Inner { - background-color: #f6f6f6; - display: none; - margin: 0.75em 0 0 0; - padding: 0.75em; - } - - #ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-Biblio-Generate-Button, - #ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InTextCreator-Generate-Button { - color: #fff; - float: right; - line-height: 1.75em; - height: auto; - } - #ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-Biblio-Clear-Button, - #ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InTextCreator-Clear-Button { - float: left; - line-height: 1.75em; - height: auto; - } - - div#zp-ZotpressMetaBox-Biblio-Shortcode hr.clear, - div#zp-ZotpressMetaBox-InTextCreator-Shortcode hr.clear { - border: none; - clear: both; - margin: 0; - padding: 0; - visibility: hidden; - height: 1px; - } - - div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Shortcode label, - div#ZotpressMetaBox div#zp-ZotpressMetaBox-InTextCreator-Shortcode label - { - font-size: 0.85em; - display: block; - line-height: 1em; - margin-bottom: 0.5em; - padding: 0; - } - - #zp-ZotpressMetaBox-Biblio-Shortcode-Text, - #zp-ZotpressMetaBox-InTextCreator-Text-Bib, - #zp-ZotpressMetaBox-InTextCreator-InText { - font-size: 0.85em; - width: 100%; - } - - div#zp-ZotpressMetaBox-InTextCreator-Text-Bib-Container { - margin-top: 0.75em; - } - div#zp-ZotpressMetaBox-Biblio-Text-Bib-Container label span, - div#zp-ZotpressMetaBox-InTextCreator-Text-Bib-Container label span { - color: #999; - font-weight: normal; - } - - /* Start of Visual Indicator Item CSS */ - - div#zp-ZotpressMetaBox-Biblio-Citations-List, - div#zp-ZotpressMetaBox-Citations-List { - padding: 0 1rem; - } - - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item, - div#zp-ZotpressMetaBox-Citations-List div.item { - position: relative; - border-top: 1px solid #eee; - font-weight: 400; - font-size: 0.7rem; - line-height: 1.2; - padding: 0.5rem 0; - width: 100%; - } - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item:first-child, - div#zp-ZotpressMetaBox-Citations-List div.item:first-child { - border-top: none; - } - - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .label, - div#zp-ZotpressMetaBox-Citations-List div.item .label { - display: block; - width: 90%; - } - - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .options, - div#zp-ZotpressMetaBox-Citations-List div.item .options { - margin: 0.5rem 0; - display: block; - width: 90%; - } - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .options:before, - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .options:after, - div#zp-ZotpressMetaBox-Citations-List div.item .options:before, - div#zp-ZotpressMetaBox-Citations-List div.item .options:after { - content: ""; - display: table; - } - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .options:after, - div#zp-ZotpressMetaBox-Citations-List div.item .options:after { - clear: both; - } - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .options label, - div#zp-ZotpressMetaBox-Citations-List div.item .options label { - float: left; - line-height: 1.5; - margin-right: 0.2rem; - } - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .options input, - div#zp-ZotpressMetaBox-Citations-List div.item .options input { - text-transform: uppercase; - font-weight: 600; - float: left; - font-size: 0.7rem; - padding: 0 0.2rem; - width: 40%; - } - - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .item_key, - div#zp-ZotpressMetaBox-Citations-List div.item .item_key { - display: block; - font-weight: 600; - margin-top: 0.25rem; - } - - div#zp-ZotpressMetaBox-Biblio-Citations-List div.item .delete, - div#zp-ZotpressMetaBox-Citations-List div.item .delete { - position: absolute; - top: 0.5rem; - right: 0; - background-color: #e14d43; - color: #fff; - cursor: pointer; - font-size: 0.8rem; - line-height: 1; - padding: 0.05rem 0.25rem; - - border-radius: 10px; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - } - - div#zp-ZotpressMetaBox-Biblio-Citations-List hr.clear, - div#zp-ZotpressMetaBox-Citations-List hr.clear { - background: none; - border: none; - height: 1px; - margin: 0; - padding: 0; - visibility: hidden; - } - - - /* Start of Account CSS */ - - div#zp-ZotpressMetaBox-Biblio-Account, - div#zp-ZotpressMetaBox-Account { - color: #999; - font-size: 0.85em; - margin: 0.5em 1em; - } - - - /* Start of Options CSS */ - - div#zp-ZotpressMetaBox-Biblio-Options, - div#zp-ZotpressMetaBox-InTextCreator-Options { - border-top: 1px solid #EEEEEE; - border-bottom: 1px solid #EEEEEE; - margin: 0; - } - - div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Options h4, - div#ZotpressMetaBox div#zp-ZotpressMetaBox-InTextCreator-Options h4 { - margin: 0.75em; - } - - div#zp-ZotpressMetaBox-Biblio-Options-Inner, - div#zp-ZotpressMetaBox-InTextCreator-Options-Inner { - border-top: 1px solid #EEEEEE; - display: none; - padding: 0.25em 0; - } - div.zp-ZotpressMetaBox-Field { - font-size: 0.85em; - padding: 0.5em 1em; - } - div.zp-ZotpressMetaBox-Field-Radio { - font-size: 1.15em; - float: right; - margin-top: -0.2em; - } - div#ZotpressMetaBox div.zp-ZotpressMetaBox-Field-Radio label { - padding: 0; - } - div#zp-ZotpressMetaBox-Biblio-Options-Inner input, - div#zp-ZotpressMetaBox-Biblio-Options-Inner select, - div#zp-ZotpressMetaBox-InTextCreator-Options-Inner input, - div#zp-ZotpressMetaBox-InTextCreator-Options-Inner select { - font-size: 0.85em; - margin: 0.5em 1em 0.5em 0; - line-height: 1em; - } - div#zp-ZotpressMetaBox-Biblio-Options-Inner select, - div#zp-ZotpressMetaBox-InTextCreator-Options-Inner select { - height: auto; - } - - div#zp-ZotpressMetaBox-Biblio-Options div.right, - div#zp-ZotpressMetaBox-InTextCreator-Options div.right { - float: right; - line-height: 1; - } - - div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Options h5, - div#ZotpressMetaBox div#zp-ZotpressMetaBox-InTextCreator-Options h5 { - background-color: #f9f9f9; - border-top: 1px solid #eee; - border-bottom: 1px solid #eee; - font-size: 1em; - font-weight: normal; - margin: 0.5em 0; - padding: 0.5em 0.75em; - } - div#ZotpressMetaBox div#zp-ZotpressMetaBox-InTextCreator-Options h5.first { - margin-top: -0.3em; - } - - div#zp-ZotpressMetaBox-Biblio-Options h4 span.toggle, - div#zp-ZotpressMetaBox-InTextCreator-Options h4 span.toggle { - background: #f7f7f7 url('../images/sprite.png') no-repeat -22px -466px; - border: 1px solid #dadada; - cursor: pointer; - display: inline-block; - line-height: 1em; - margin-left: 0.35em; - padding: 0; - /*padding: 0 0.65em;*/ - vertical-align: bottom; - width: 1.3em; - height: 1.3em; - - border-radius: 1em; - -moz-border-radius: 1em; - -webkit-border-radius: 1em; - } - div#zp-ZotpressMetaBox-Biblio-Options h4 span.toggle.active, - div#zp-ZotpressMetaBox-InTextCreator-Options h4 span.toggle.active { - background-color: #dadada; - } - - div#zp-ZotpressMetaBox-Biblio-Options hr, - div#zp-ZotpressMetaBox-InTextCreator-Options hr { - border: none; - background-color: #fff; - border-bottom: 1px solid #f6f6f6; - margin: 0.25em 0; - padding: 0; - height: 1px; - } - - input#zp-ZotpressMetaBox-Biblio-Options-Format, - input#zp-ZotpressMetaBox-InTextCreator-Options-Format { - min-width: 185px; - } - - div#zp-ZotpressMetaBox-Biblio-Options p.note, - div#zp-ZotpressMetaBox-InTextCreator-Options p.note { - color: #999; - font-size: 0.75em; - margin: 0 1em 0.75em; - } - - /* END OF IN-TEXT CSS */ - - - - /* START OF GENERIC METABOX CSS */ - - div#ZotpressMetaBox.postbox div.inside { - /*padding: 0 6px;*/ - margin: 0; - padding: 0; - } - - div#ZotpressMetaBox h3.hndle span { - background: transparent url('../images/icon.png') no-repeat left center; - padding-left: 22px; - } - - div.zp-ZotpressMetaBox-Tabs { - border-radius: 5px; - -moz-border-radius: 5px; - border: 1px solid #ccc; - padding: 1px; - margin-bottom: 10px; - } - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav { - display: none; - border-radius: 4px 4px 0 0; - -moz-border-radius: 4px 4px 0 0; - background-color: #f6f6f6; - padding: 3px; - padding-bottom: 0; - overflow: hidden; - /*height: 20px;*/ - } - div.zp-ZotpressMetaBox-Tabs ul li, - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li { - margin: 0; - padding: 5px 5px 0; - float: left; - height: 13px; - } - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active { - border-radius: 4px 4px 0 0; - -moz-border-radius: 4px 4px 0 0; - background-color: #fff; - height: 13px; - } - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li a { - /*font: 9px/10px 'Arial', sans-serif;*/ - letter-spacing: 1px; - padding: 0 3px; - text-decoration: none; - text-transform: uppercase; - vertical-align: top; - } - div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active a { - color: #333; - } - div.zp-ZotpressMetaBox-Tabs input[type="radio"] { - vertical-align: text-top; - } - - div#ZotpressMetaBox h4 { - margin: 0; - padding: 0; - } - - div#zp-ZotpressMetaBox-Biblio-Options label, - div#zp-ZotpressMetaBox-InTextCreator-Options label{ - font-size: 0.85em; - margin: 0; - padding: 0 1em; - font-weight: bold; - } - div#ZotpressMetaBox div.zp-Tab label { - font-size: 12px; - display: block; - margin: 0; - padding: 0 0 5px 0; - } - div#ZotpressMetaBox div.zp-Tab select { - width: 100%; - height: 5em !important; - } - - div.zp-Tab { - background-color: #fff; - padding: 0.6em !important; - } - p.zp-Note { - font-size: 9px !important; - font-style: italic !important; - color: #aaaaaa !important; - margin-top: 0 !important; - } - p.zp-Note { - font-size: 10px !important; - color: #888 !important; - } - div.zp-Tab span.label { - margin-top: 5px; - font-weight: bold; - } - div.zp-Tab span.label em { - font-style: normal; - text-decoration: underline; - } - - .postbox div.zp-Tab input[type="text"], - div.zp-Tab select { - margin-bottom: 10px; - } - - /* MAIN */ - #normal-sortables .zp-ZotpressMetaBox-Tabs .sm { - display: none; - } - #normal-sortables .zp-ZotpressMetaBox-Tabs .wide { - display: block; - } - /* MAIN */ - - /* SIDEBAR */ - #side-sortables .zp-ZotpressMetaBox-Tabs .sm { - display: block; - } - #side-sortables .zp-ZotpressMetaBox-Tabs .wide { - display: none; - } - /* SIDEBAR */ - - .bibOnly { - display: none; - } - - - - /* START OF CKEDIT STYLES */ - - span.zp-Zotpress-Citation { - background-color: #eee !important; - } - span.zp-Zotpress-Citation:hover { - background-color: #ddd !important; - } - - span.zp-Zotpress-Citation span.zp-Zotpress-Citation-Shortcode { - display: none !important; - } - - span.zp-Zotpress-Citation span.zp-Zotpress-Citation-Info { - display: inline !important; - } - - /* END OF CKEDIT STYLES */ - \ No newline at end of file + +/* START OF SHORTCODE BUILDER CSS */ + +#zp-ZotpressMetaBox.zp-ShortcodeBuilder { + z-index: 100; + position: absolute; + top: calc(50% - 25vh); + left: calc(50% - 18vw); + width: 34vw; + height: auto; + max-height: 50vh; + + background-color: #fff; + border: 1px solid #333; + filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.1)); + overflow-y: auto; +} +.is-sidebar-opened #zp-ZotpressMetaBox.zp-ShortcodeBuilder { + left: calc(((100% - 280px) / 2) - 18vw); +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Inner { + padding: 6px 15px 15px 15px; +} + +#zp-ShortcodeBuilder-Close { + display: none; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ShortcodeBuilder-Close { + position: absolute; + top: 3px; + right: 3px; + display: inline-block; +} + +/* search autocomplete */ + +#zp-ZotpressMetaBox.zp-ShortcodeBuilder select#zp-ZotpressMetaBox-Acccount-Select { + border: none; + font-size: 0.9em; + width: auto; +} + +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Account, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Search-Inner, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-List, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Type, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Biblio-Options, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Biblio-Generate, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InText-Options, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InText-Generate, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InTextBib-Options, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InTextBib-Generate { + margin-left: 0; + margin-right: 0; +} + +#zp-ZotpressMetaBox-Type { + border: none; + margin: 0 15px; + padding: 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Type { + margin: 0; + padding: 0; + overflow: auto; +} +#zp-ZotpressMetaBox-Type h4 { + display: none; +} +#zp-ZotpressMetaBox-Type ul, +#zp-ZotpressMetaBox-Type ul li { + margin: 0; + padding: 0; +} +#zp-ZotpressMetaBox-Type ul li.ui-tab a { + box-shadow: none !important; + color: #1e1e1e; + float: left; + padding: 8px 14px; + text-decoration: none; +} +#zp-ZotpressMetaBox-Type ul li.ui-tabs-active a { + border-bottom: 3px solid var(--wp-admin-theme-color); + padding-bottom: 5px; +} + +/* options */ + +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Biblio-Options-Inner, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InText-Options-Inner, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InTextBib-Options-Inner { + padding: 8px 0; +} + +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub { + margin: 0; + padding: 8px 12px; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub h4 { + margin: 0; + padding: 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub h4 span.toggle { + padding: 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub h4 span.toggle-button { + margin: 4px 0 0 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub-Inner { + padding: 10px 0 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub label { + display: block; + padding: 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub p.note { + margin: 0.5em 0 0.75em 14px; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub .zp-ZotpressMetaBox-Field-Radio label { + padding: 0 0 0 1em; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub .zp-ZotpressMetaBox-Field-Radio input { + margin: 0 4px; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder div.zp-ZotpressMetaBox-Sub hr { + margin: 5px 0; +} +#zp-ZotpressMetaBox.zp-ShortcodeBuilder div#zp-ZotpressMetaBox-Biblio-Generate, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder div#zp-ZotpressMetaBox-InText-Generate, +#zp-ZotpressMetaBox.zp-ShortcodeBuilder div#zp-ZotpressMetaBox-InTextBib-Generate { + margin-bottom: 0; +} + +/* There's a CSS gap/bug where Dashicons aren't styled in the editor menu */ + +#editor .components-dropdown-menu__menu .components-button.has-icon .dashicon { + margin-right: 12px; +} + +/* END OF SHORTCODE BUILDER CSS */ + + + +/* + THE BELOW IS POTENTIALLY LEGACY CODE + and should be incorporated above +*/ + + + +/* START OF AUTOCOMPLETE CSS */ + +.ui-autocomplete.zp-autocomplete { + background: none; + background-color: #fff; + border: 1px solid #ddd; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); + -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); + margin: 0; + padding: 0; + max-height: 200px; + width: 253px !important; + overflow-y: auto; + overflow-x: hidden; /* prevent horizontal scrollbar */ +} +.ui-autocomplete.zp-autocomplete-wide { + width: 775px !important; +} + +.ui-autocomplete.zp-autocomplete li { + background: none; + border: none; + font-weight: 400; + font-size: 0.75rem; + line-height: 1.2; + margin: 0; + padding: 0; + white-space: normal; +} + +.ui-autocomplete.zp-autocomplete-wide li strong { + font-weight: 600; +} + +.ui-autocomplete.zp-autocomplete li a { + background: none; + border: none; + border-bottom: 1px solid #ddd; + display: block; + color: #666; + margin: 0; + padding: 6px 10px 6px 10px; +} +.ui-autocomplete.zp-autocomplete li a.ui-state-focus, +.ui-autocomplete.zp-autocomplete li a.ui-state-hover { + background: none; + background-color: #eee; /* 8ec5fb */ + margin: 0; + + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; +} + +.ui-tabs .ui-tabs-nav li a, +.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { + outline: none; +} + +/* END OF AUTOCOMPLETE CSS */ + + + +/* START OF CREATOR BASICS */ + +.zp-ZotpressMetaBox-Sub { + border: 1px solid #EEEEEE; + margin: 0 15px; + padding: 0 5px; +} + +/* END OF CREATOR BASICS */ + + + +/* START OF IN-TEXT CREATOR CSS */ + +div#zp-ZotpressMetaBox-InText { + display: none; +} + + +/* START OF SEARCH CSS */ + +div#zp-ZotpressMetaBox-Search { + margin-bottom: 10px; +} +div#zp-ZotpressMetaBox-Search-Inner { + border: 5px solid #E14D43; + margin: 5px 15px; + + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +input#zp-ZotpressMetaBox-Search-Input { + border: none; + box-shadow: none !important; + background: #fff; + font-size: inherit; + margin: 0; + padding: 4px 10px; + width: calc(100% - 4px); + height: 22px; +} +input#zp-ZotpressMetaBox-Search-Input.ui-autocomplete-loading { + background: #fff url("../images/loading_default.gif") no-repeat right center; +} +/* input#zp-ZotpressMetaBox-Search-Input.help { + color: #aaa; +} */ + + +/* Start of generate */ + +div#zp-ZotpressMetaBox-Biblio-Generate, +div#zp-ZotpressMetaBox-InText-Generate, +div#zp-ZotpressMetaBox-InTextBib-Generate { + background: none; + margin: 15px; +} +div#zp-ZotpressMetaBox-Biblio-Generate-Inner, +div#zp-ZotpressMetaBox-InText-Generate-Inner, +div#zp-ZotpressMetaBox-InTextBib-Generate-Inner { + display: none; + margin: 15px 0 0 0; +} + +#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-Biblio-Generate-Button, +#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InText-Generate-Button, +#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InTextBib-Generate-Button { + color: #fff; + height: auto; +} +#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-Biblio-Clear-Button, +#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InText-Clear-Button, +#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InTextBib-Clear-Button { + float: right; + height: auto; +} + +div#zp-ZotpressMetaBox-Biblio-Generate hr.clear, +div#zp-ZotpressMetaBox-InText-Generate hr.clear, +div#zp-ZotpressMetaBox-InTextBib-Generate hr.clear { + border: none; + clear: both; + margin: 0; + padding: 0; + visibility: hidden; + height: 1px; +} + +div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Generate label, +div#ZotpressMetaBox div#zp-ZotpressMetaBox-InText-Generate label, +div#ZotpressMetaBox div#zp-ZotpressMetaBox-InTextBib-Generate label { + font-size: 13px; + display: block; + line-height: 1em; + margin-bottom: 0.5em; + padding: 0; +} + +#zp-ZotpressMetaBox-Biblio-Generate-Text, +#zp-ZotpressMetaBox-InText-Generate-Text, +#zp-ZotpressMetaBox-InTextBib-Generate-Text { + font-size: 13px; + width: 100%; +} + +/* Start of Visual Indicator Item CSS */ + +div#zp-ZotpressMetaBox-List { + margin-bottom: 10px; + padding: 0 20px; +} + +div#zp-ZotpressMetaBox-List div.item { + position: relative; + border-top: 1px solid #eee; + font-weight: 400; + font-size: 0.7rem; + line-height: 1.2; + padding: 0.5rem 0; + width: 100%; +} +div#zp-ZotpressMetaBox-List div.item:first-child { + border-top: none; +} + +div#zp-ZotpressMetaBox-List div.item .label { + display: block; + width: 90%; +} + +div#zp-ZotpressMetaBox-List div.item .options { + margin: 0.5rem 0; + display: none; + width: 90%; +} +div#zp-ZotpressMetaBox-List.intext div.item .options { + display: block; +} +div#zp-ZotpressMetaBox-List div.item .options:before, +div#zp-ZotpressMetaBox-List div.item .options:after { + content: ""; + display: table; +} +div#zp-ZotpressMetaBox-List div.item .options:after { + clear: both; +} +div#zp-ZotpressMetaBox-List div.item .options label { + float: left; + line-height: 1.5; + margin-right: 0.2rem; +} +div#zp-ZotpressMetaBox-List div.item .options input { + text-transform: uppercase; + font-weight: 600; + float: left; + font-size: 0.7rem; + padding: 0 0.2rem; + width: 40%; +} + +div#zp-ZotpressMetaBox-List div.item .item_key, +div#zp-ZotpressMetaBox-List div.item .account { + display: block; + margin-top: 0.25rem; +} +div#zp-ZotpressMetaBox-List div.item .account { + margin-top: 0; +} + +div#zp-ZotpressMetaBox-List div.item .delete { + position: absolute; + top: 0.5rem; + right: 0; + background-color: #e14d43; + color: #fff; + cursor: pointer; + font-size: 1.25em; + line-height: 1; + padding: 0.05em 0.35em 0.25em 0.35em; + + border-radius: 1em; + -moz-border-radius: 1em; + -webkit-border-radius: 1em; +} + +div#zp-ZotpressMetaBox-List hr.clear { + background: none; + border: none; + height: 1px; + margin: 0; + padding: 0; + visibility: hidden; +} + + +/* Start of Account CSS */ + +.edit-post-meta-boxes-area #poststuff div#ZotpressMetaBox h2.hndle { + color: #191e23; /* 555d66 */ + font-size: inherit; + border-bottom: 0; +} + +#zp-ZotpressMetaBox-Account { + margin: 0 15px; +} +#zp-ZotpressMetaBox-Account label { + display: none; +} +select#zp-ZotpressMetaBox-Acccount-Select { + /* width: calc(100% - 4px); */ + width: calc(100% - 35px); + height: 22px; +} + + +/* START OF OPTIONS CSS */ + +#zp-ZotpressMetaBox #zp-ZotpressMetaBox-Biblio-Options-Inner, +#zp-ZotpressMetaBox #zp-ZotpressMetaBox-InText-Options-Inner, +#zp-ZotpressMetaBox #zp-ZotpressMetaBox-InTextBib-Options-Inner { + display: none; + font-size: 0.9em; + line-height: 2; + padding: 5px; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub h4 { + color: #555d66; + font-weight: normal; + margin: 0; + padding: 0; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Field { + font-size: inherit; + display: flex; + align-items: center; + justify-content: space-between; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Field-Radio { + display: flex; + align-items: center; + justify-content: space-between; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Field-Radio label { + font-size: 0.9em; + text-transform: uppercase; + margin: 0 4px 0 15px; + padding: 0; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub input, +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub select { + font-size: inherit; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub select { + height: auto; + min-height: 1em; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub .right { + float: right; + line-height: 1; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub h5 { + border-top: 1px solid #eee; + font-size: 1em; + font-weight: bold; + margin: 0.5em 0; + padding: 1em 0 0.25em; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub span.toggle { + cursor: pointer; + display: block; + font-size: 0.8em; + font-weight: normal; + line-height: 2; + padding: 5px; + text-transform: uppercase; + width: 100%; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub span.toggle-button { + content: "\f347"; + cursor: pointer; + display: inline-block; + float: right; + font-size: 15px; + line-height: 15px; + margin: 4px 8px 0 0; + padding: 0; + text-align: right; + width: auto; + height: 16px; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub span.toggle-button.dashicons-arrow-up-alt2 { + content: "\f343"; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub hr { + border: none; + background-color: #fff; + clear: both; + margin: 10px 0 0; + padding: 0; + height: 1px; +} +div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Options select#zp-ZotpressMetaBox-Biblio-Options-Style { + float: none; +} + +input#zp-ZotpressMetaBox-Biblio-Options-Format, +input#zp-ZotpressMetaBox-InText-Options-Format, +input#zp-ZotpressMetaBox-InTextBib-Options-Format { + min-width: 185px; +} + +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub p.note { + color: #666; + font-size: 0.8em; + margin: 0.5em 1em 1em; +} +#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub p.note code { + font-size: 1.1em; +} + +/* END OF IN-TEXT CSS */ + + + +/* START OF GENERIC METABOX CSS */ + +div#zp-ZotpressMetaBox-Inner { + padding: 15px 0; +} + +div#ZotpressMetaBox.postbox div.inside { + margin: 0; + padding: 0; +} + +div#ZotpressMetaBox h3.hndle span { + background: transparent url('../images/icon.png') no-repeat left center; + padding-left: 22px; +} + +div.zp-ZotpressMetaBox-Tabs { + border-radius: 5px; + -moz-border-radius: 5px; + border: 1px solid #ccc; + padding: 1px; + margin-bottom: 10px; +} +div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav { + display: none; + border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + background-color: #f6f6f6; + padding: 3px; + padding-bottom: 0; + overflow: hidden; +} +div.zp-ZotpressMetaBox-Tabs ul li, +div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li { + margin: 0; + padding: 5px 5px 0; + float: left; + height: 13px; +} +div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active { + border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + background-color: #fff; + height: 13px; +} +div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li a { + /*font: 9px/10px 'Arial', sans-serif;*/ + letter-spacing: 1px; + padding: 0 3px; + text-decoration: none; + text-transform: uppercase; + vertical-align: top; +} +div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active a { + color: #333; +} +div.zp-ZotpressMetaBox-Tabs input[type="radio"] { + vertical-align: text-top; +} + +div#ZotpressMetaBox h4 { + margin: 0; + padding: 0; +} + +div#ZotpressMetaBox div.zp-Tab label { + font-size: 12px; + display: block; + margin: 0; + padding: 0 0 5px 0; +} +div#ZotpressMetaBox div.zp-Tab select { + width: 100%; + height: 5em !important; +} + +div.zp-Tab { + background-color: #fff; + padding: 0.6em !important; +} +p.zp-Note { + font-size: 9px !important; + font-style: italic !important; + color: #aaaaaa !important; + margin-top: 0 !important; +} +p.zp-Note { + font-size: 10px !important; + color: #888 !important; +} +div.zp-Tab span.label { + margin-top: 5px; + font-weight: bold; +} +div.zp-Tab span.label em { + font-style: normal; + text-decoration: underline; +} + +.postbox div.zp-Tab input[type="text"], +div.zp-Tab select { + margin-bottom: 10px; +} + +/* MAIN */ +#normal-sortables .zp-ZotpressMetaBox-Tabs .sm { + display: none; +} +#normal-sortables .zp-ZotpressMetaBox-Tabs .wide { + display: block; +} +/* MAIN */ + +/* SIDEBAR */ +#side-sortables .zp-ZotpressMetaBox-Tabs .sm { + display: block; +} +#side-sortables .zp-ZotpressMetaBox-Tabs .wide { + display: none; +} +/* SIDEBAR */ diff --git a/css/zotpress.metabox.min.css b/css/zotpress.metabox.min.css new file mode 100644 index 0000000..1d2a73a --- /dev/null +++ b/css/zotpress.metabox.min.css @@ -0,0 +1 @@ +#zp-ZotpressMetaBox.zp-ShortcodeBuilder{z-index:100;position:absolute;top:calc(50% - 25vh);left:calc(50% - 18vw);width:34vw;height:auto;max-height:50vh;background-color:#fff;border:1px solid #333;filter:drop-shadow(3px 3px 0 rgba(0, 0, 0, .1));overflow-y:auto}.is-sidebar-opened #zp-ZotpressMetaBox.zp-ShortcodeBuilder{left:calc(((100% - 280px)/ 2) - 18vw)}#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Inner{padding:6px 15px 15px 15px}#zp-ShortcodeBuilder-Close{display:none}#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ShortcodeBuilder-Close{position:absolute;top:3px;right:3px;display:inline-block}#zp-ZotpressMetaBox.zp-ShortcodeBuilder select#zp-ZotpressMetaBox-Acccount-Select{border:none;font-size:.9em;width:auto}#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Account,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Biblio-Generate,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Biblio-Options,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InText-Generate,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InText-Options,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InTextBib-Generate,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InTextBib-Options,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-List,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Search-Inner,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Type{margin-left:0;margin-right:0}#zp-ZotpressMetaBox-Type{border:none;margin:0 15px;padding:0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Type{margin:0;padding:0;overflow:auto}#zp-ZotpressMetaBox-Type h4{display:none}#zp-ZotpressMetaBox-Type ul,#zp-ZotpressMetaBox-Type ul li{margin:0;padding:0}#zp-ZotpressMetaBox-Type ul li.ui-tab a{box-shadow:none!important;color:#1e1e1e;float:left;padding:8px 14px;text-decoration:none}#zp-ZotpressMetaBox-Type ul li.ui-tabs-active a{border-bottom:3px solid var(--wp-admin-theme-color);padding-bottom:5px}#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-Biblio-Options-Inner,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InText-Options-Inner,#zp-ZotpressMetaBox.zp-ShortcodeBuilder #zp-ZotpressMetaBox-InTextBib-Options-Inner{padding:8px 0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub{margin:0;padding:8px 12px}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub h4{margin:0;padding:0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub h4 span.toggle{padding:0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub h4 span.toggle-button{margin:4px 0 0 0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub-Inner{padding:10px 0 0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub label{display:block;padding:0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub p.note{margin:.5em 0 .75em 14px}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub .zp-ZotpressMetaBox-Field-Radio label{padding:0 0 0 1em}#zp-ZotpressMetaBox.zp-ShortcodeBuilder .zp-ZotpressMetaBox-Sub .zp-ZotpressMetaBox-Field-Radio input{margin:0 4px}#zp-ZotpressMetaBox.zp-ShortcodeBuilder div.zp-ZotpressMetaBox-Sub hr{margin:5px 0}#zp-ZotpressMetaBox.zp-ShortcodeBuilder div#zp-ZotpressMetaBox-Biblio-Generate,#zp-ZotpressMetaBox.zp-ShortcodeBuilder div#zp-ZotpressMetaBox-InText-Generate,#zp-ZotpressMetaBox.zp-ShortcodeBuilder div#zp-ZotpressMetaBox-InTextBib-Generate{margin-bottom:0}#editor .components-dropdown-menu__menu .components-button.has-icon .dashicon{margin-right:12px}.ui-autocomplete.zp-autocomplete{background:0 0;background-color:#fff;border:1px solid #ddd;box-shadow:0 1px 1px rgba(0,0,0,.04);-moz-box-shadow:0 1px 1px rgba(0,0,0,.04);margin:0;padding:0;max-height:200px;width:253px!important;overflow-y:auto;overflow-x:hidden}.ui-autocomplete.zp-autocomplete-wide{width:775px!important}.ui-autocomplete.zp-autocomplete li{background:0 0;border:none;font-weight:400;font-size:.75rem;line-height:1.2;margin:0;padding:0;white-space:normal}.ui-autocomplete.zp-autocomplete-wide li strong{font-weight:600}.ui-autocomplete.zp-autocomplete li a{background:0 0;border:none;border-bottom:1px solid #ddd;display:block;color:#666;margin:0;padding:6px 10px 6px 10px}.ui-autocomplete.zp-autocomplete li a.ui-state-focus,.ui-autocomplete.zp-autocomplete li a.ui-state-hover{background:0 0;background-color:#eee;margin:0;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0}.ui-tabs .ui-tabs-nav li a,.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a{outline:0}.zp-ZotpressMetaBox-Sub{border:1px solid #eee;margin:0 15px;padding:0 5px}div#zp-ZotpressMetaBox-InText{display:none}div#zp-ZotpressMetaBox-Search{margin-bottom:10px}div#zp-ZotpressMetaBox-Search-Inner{border:5px solid #e14d43;margin:5px 15px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px}input#zp-ZotpressMetaBox-Search-Input{border:none;box-shadow:none!important;background:#fff;font-size:inherit;margin:0;padding:4px 10px;width:calc(100% - 4px);height:22px}input#zp-ZotpressMetaBox-Search-Input.ui-autocomplete-loading{background:#fff url(../images/loading_default.gif) no-repeat right center}div#zp-ZotpressMetaBox-Biblio-Generate,div#zp-ZotpressMetaBox-InText-Generate,div#zp-ZotpressMetaBox-InTextBib-Generate{background:0 0;margin:15px}div#zp-ZotpressMetaBox-Biblio-Generate-Inner,div#zp-ZotpressMetaBox-InText-Generate-Inner,div#zp-ZotpressMetaBox-InTextBib-Generate-Inner{display:none;margin:15px 0 0 0}#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-Biblio-Generate-Button,#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InText-Generate-Button,#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InTextBib-Generate-Button{color:#fff;height:auto}#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-Biblio-Clear-Button,#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InText-Clear-Button,#ZotpressMetaBox .ui-widget-content a#zp-ZotpressMetaBox-InTextBib-Clear-Button{float:right;height:auto}div#zp-ZotpressMetaBox-Biblio-Generate hr.clear,div#zp-ZotpressMetaBox-InText-Generate hr.clear,div#zp-ZotpressMetaBox-InTextBib-Generate hr.clear{border:none;clear:both;margin:0;padding:0;visibility:hidden;height:1px}div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Generate label,div#ZotpressMetaBox div#zp-ZotpressMetaBox-InText-Generate label,div#ZotpressMetaBox div#zp-ZotpressMetaBox-InTextBib-Generate label{font-size:13px;display:block;line-height:1em;margin-bottom:.5em;padding:0}#zp-ZotpressMetaBox-Biblio-Generate-Text,#zp-ZotpressMetaBox-InText-Generate-Text,#zp-ZotpressMetaBox-InTextBib-Generate-Text{font-size:13px;width:100%}div#zp-ZotpressMetaBox-List{margin-bottom:10px;padding:0 20px}div#zp-ZotpressMetaBox-List div.item{position:relative;border-top:1px solid #eee;font-weight:400;font-size:.7rem;line-height:1.2;padding:.5rem 0;width:100%}div#zp-ZotpressMetaBox-List div.item:first-child{border-top:none}div#zp-ZotpressMetaBox-List div.item .label{display:block;width:90%}div#zp-ZotpressMetaBox-List div.item .options{margin:.5rem 0;display:none;width:90%}div#zp-ZotpressMetaBox-List.intext div.item .options{display:block}div#zp-ZotpressMetaBox-List div.item .options:after,div#zp-ZotpressMetaBox-List div.item .options:before{content:"";display:table}div#zp-ZotpressMetaBox-List div.item .options:after{clear:both}div#zp-ZotpressMetaBox-List div.item .options label{float:left;line-height:1.5;margin-right:.2rem}div#zp-ZotpressMetaBox-List div.item .options input{text-transform:uppercase;font-weight:600;float:left;font-size:.7rem;padding:0 .2rem;width:40%}div#zp-ZotpressMetaBox-List div.item .account,div#zp-ZotpressMetaBox-List div.item .item_key{display:block;margin-top:.25rem}div#zp-ZotpressMetaBox-List div.item .account{margin-top:0}div#zp-ZotpressMetaBox-List div.item .delete{position:absolute;top:.5rem;right:0;background-color:#e14d43;color:#fff;cursor:pointer;font-size:1.25em;line-height:1;padding:.05em .35em .25em .35em;border-radius:1em;-moz-border-radius:1em;-webkit-border-radius:1em}div#zp-ZotpressMetaBox-List hr.clear{background:0 0;border:none;height:1px;margin:0;padding:0;visibility:hidden}.edit-post-meta-boxes-area #poststuff div#ZotpressMetaBox h2.hndle{color:#191e23;font-size:inherit;border-bottom:0}#zp-ZotpressMetaBox-Account{margin:0 15px}#zp-ZotpressMetaBox-Account label{display:none}select#zp-ZotpressMetaBox-Acccount-Select{width:calc(100% - 35px);height:22px}#zp-ZotpressMetaBox #zp-ZotpressMetaBox-Biblio-Options-Inner,#zp-ZotpressMetaBox #zp-ZotpressMetaBox-InText-Options-Inner,#zp-ZotpressMetaBox #zp-ZotpressMetaBox-InTextBib-Options-Inner{display:none;font-size:.9em;line-height:2;padding:5px}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub h4{color:#555d66;font-weight:400;margin:0;padding:0}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Field{font-size:inherit;display:flex;align-items:center;justify-content:space-between}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Field-Radio{display:flex;align-items:center;justify-content:space-between}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Field-Radio label{font-size:.9em;text-transform:uppercase;margin:0 4px 0 15px;padding:0}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub input,#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub select{font-size:inherit}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub select{height:auto;min-height:1em}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub .right{float:right;line-height:1}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub h5{border-top:1px solid #eee;font-size:1em;font-weight:700;margin:.5em 0;padding:1em 0 .25em}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub span.toggle{cursor:pointer;display:block;font-size:.8em;font-weight:400;line-height:2;padding:5px;text-transform:uppercase;width:100%}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub span.toggle-button{content:"\f347";cursor:pointer;display:inline-block;float:right;font-size:15px;line-height:15px;margin:4px 8px 0 0;padding:0;text-align:right;width:auto;height:16px}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub span.toggle-button.dashicons-arrow-up-alt2{content:"\f343"}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub hr{border:none;background-color:#fff;clear:both;margin:10px 0 0;padding:0;height:1px}div#ZotpressMetaBox div#zp-ZotpressMetaBox-Biblio-Options select#zp-ZotpressMetaBox-Biblio-Options-Style{float:none}input#zp-ZotpressMetaBox-Biblio-Options-Format,input#zp-ZotpressMetaBox-InText-Options-Format,input#zp-ZotpressMetaBox-InTextBib-Options-Format{min-width:185px}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub p.note{color:#666;font-size:.8em;margin:.5em 1em 1em}#zp-ZotpressMetaBox .zp-ZotpressMetaBox-Sub p.note code{font-size:1.1em}div#zp-ZotpressMetaBox-Inner{padding:15px 0}div#ZotpressMetaBox.postbox div.inside{margin:0;padding:0}div#ZotpressMetaBox h3.hndle span{background:transparent url(../images/icon.png) no-repeat left center;padding-left:22px}div.zp-ZotpressMetaBox-Tabs{border-radius:5px;-moz-border-radius:5px;border:1px solid #ccc;padding:1px;margin-bottom:10px}div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav{display:none;border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;background-color:#f6f6f6;padding:3px;padding-bottom:0;overflow:hidden}div.zp-ZotpressMetaBox-Tabs ul li,div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li{margin:0;padding:5px 5px 0;float:left;height:13px}div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active{border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;background-color:#fff;height:13px}div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li a{letter-spacing:1px;padding:0 3px;text-decoration:none;text-transform:uppercase;vertical-align:top}div.zp-ZotpressMetaBox-Tabs ul.ui-tabs-nav li.ui-state-active a{color:#333}div.zp-ZotpressMetaBox-Tabs input[type=radio]{vertical-align:text-top}div#ZotpressMetaBox h4{margin:0;padding:0}div#ZotpressMetaBox div.zp-Tab label{font-size:12px;display:block;margin:0;padding:0 0 5px 0}div#ZotpressMetaBox div.zp-Tab select{width:100%;height:5em!important}div.zp-Tab{background-color:#fff;padding:.6em!important}p.zp-Note{font-size:9px!important;font-style:italic!important;color:#aaa!important;margin-top:0!important}p.zp-Note{font-size:10px!important;color:#888!important}div.zp-Tab span.label{margin-top:5px;font-weight:700}div.zp-Tab span.label em{font-style:normal;text-decoration:underline}.postbox div.zp-Tab input[type=text],div.zp-Tab select{margin-bottom:10px}#normal-sortables .zp-ZotpressMetaBox-Tabs .sm{display:none}#normal-sortables .zp-ZotpressMetaBox-Tabs .wide{display:block}#side-sortables .zp-ZotpressMetaBox-Tabs .sm{display:block}#side-sortables .zp-ZotpressMetaBox-Tabs .wide{display:none} diff --git a/css/zotpress.shortcode.css b/css/zotpress.shortcode.css index dbeaed4..ac1365d 100644 --- a/css/zotpress.shortcode.css +++ b/css/zotpress.shortcode.css @@ -1,196 +1,316 @@ +/* START OF BASIC SHORTCODES */ - /* START OF BASIC SHORTCODE CSS */ - - div.zp-Zotpress { - margin: 0 0 1em; - } - - /* Thanks to http://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ */ - div.zp-Zotpress a { - -ms-word-break: break-all; - word-break: break-all; - word-break: break-word; - -webkit-hyphens: auto; - -moz-hyphens: auto; - hyphens: auto; - } - - div.zp-Zotpress div.zp-Entry.zp-HasImage { - clear: both; - min-height: 150px; - } - div.zp-Zotpress div.zp-Entry-Image { - float: left; - } - - div.zp-Zotpress div.zp-Entry .csl-left-margin { - width: auto !important; - } - - div.zp-Zotpress div.zp-Entry.zp-HasImage div.csl-bib-body { - margin-left: 170px; - } - - div.zp-Zotpress span.zp-Loading { - border: 1px solid #ddd; - border-radius: 5px; - -moz-border-radius: 5px; - background: #f3f3f3 url('images/loading_list.gif') no-repeat top left; - display: block; - margin: auto; - overflow: hidden; - width: 33px; - height: 32px; - } - div.zp-Zotpress span.zp-Loading span { - visibility: hidden; - } - div.zp-Zotpress p.zp-NoCitations { - margin: 0; - } - - a.zp-CiteRIS, - a.zp-DownloadURL { - font-size: 0.9em; - text-transform: uppercase; - } - a.zp-CiteRIS:before, - a.zp-DownloadURL:before { - content: "("; - } - a.zp-CiteRIS:after, - a.zp-DownloadURL:after { - content: ")"; - } - - - /* In-Text Citations */ - - .zp-ZotpressShortcode.cite .summary, - .zp-ZotpressShortcode.bib .summary { - display: none; - } - - - - /* START OF BROWSE LIB */ - - #zp-Browse-Bar { - background-color: #fff; - border: 2px solid #000; - } - #zp-Browse-Bar:before, - #zp-Browse-Bar:after { - content: ""; - display: table; - } - #zp-Browse-Bar:after { - clear: both; - } - - #zp-Browse-Collections, - #zp-Browse-Tags { - float: left; - width: 50%; - } - - .zp-Browse-Select { - overflow: hidden; - width: 100%; - height: 34px; - } - .zp-Browse-Select select { - background: transparent; - border: none; - color: #000; - cursor: pointer; - font-size: 1em; - margin: 0; - padding: 0 0.5em; - width: 100%; - height: 34px; - } - #zp-Browse-Collections-Select { - border-right: 2px solid #000; - } - - #zp-Pagination, - .zp-Collection-Title { - letter-spacing: 0.15em; - font-size: 0.9em; - font-weight: bold; - margin: 3em 0 2em; - text-transform: uppercase; - } - #zp-Pagination { - margin: 2em 0 0; - } - - .zp-Entry-Image { - float: right; - margin: 0 0 1em 1em; - } - - #zp-Zotpress-SearchBox input[type="radio"] { - cursor: pointer; - margin: 0.5em; - vertical-align: middle; - } - #zp-Zotpress-SearchBox label { - cursor: pointer; - } - #zp-Zotpress-SearchBox .zp-SearchBy { - margin-left: 0.5em; - } - - .zpSearchLoading { - visibility: hidden; - display: block; - margin: 1em auto; - } - .zpSearchLoading.show { - visibility: visible; - } - - .zpSearchResultsItem .item_key { - display: block; - font-weight: bold; - margin-bottom: 2em; - } - - .zpSearchResultsItem.hidden { - display: none; - } - - #zpSearchResultsPaging:before, - #zpSearchResultsPaging:after { - content: ""; - display: table; - } - #zpSearchResultsPaging:after { - clear: both; - } - #zpSearchResultsPaging span.title { - display: block; - float: left; - font-weight: bold; - margin: 2px; margin-left: 0; - padding: 0.5em 1em 0.5em 0; - text-transform: uppercase; - } - #zpSearchResultsPaging a { - border: none; - display: block; - float: left; - margin: 2px; - padding: 0.5em 1em; - text-decoration: none; - } - #zpSearchResultsPaging a.selected { - border: 2px solid #000; - margin: 0; - } - - /* END OF BROWSE LIB */ - \ No newline at end of file +div.zp-Zotpress { + /* Modified to fit with WP 2020 theme */ + margin-top: 0; + margin-bottom: 1em; + /* margin: 0 0 1em; */ +} +div.zp-Zotpress div.zp-List.loading { + background: transparent url('../images/loading_default.gif') no-repeat center bottom; + padding-bottom: 21px; + min-height: 2em; +} + +/* Thanks to http://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ */ +div.zp-Zotpress a { + -ms-word-break: break-all; + word-break: break-all; + word-break: break-word; + -webkit-hyphens: auto; + -moz-hyphens: auto; + hyphens: auto; +} + +div.zp-Zotpress div.zp-Entry.zp-HasImage { + clear: both; +} +div.zp-Zotpress div.zp-Entry-Image { + float: right; +} + +a.zp-CiteRIS, +a.zp-DownloadURL { + font-size: 0.8em; + text-transform: uppercase; +} +a.zp-CiteRIS:before, +a.zp-DownloadURL:before { + content: "("; +} +a.zp-CiteRIS:after, +a.zp-DownloadURL:after { + content: ")"; +} + +.zp-List p.hide { + display: none; +} + +.zp-Info { + background: #ffeaa7 url('../images/icon-64x64.png') no-repeat top 0.4em right 0.4em; + background-size: auto 2em; + border: 1px solid #fdcb6e; + padding: 0.5em; + padding-right: 3em; +} + + +/* In-Text Citations */ + +.zp-ZotpressShortcode.cite .summary, +.zp-ZotpressShortcode.bib .summary { + display: none; +} + +.zp-InText-Citation.loading { + background: transparent url('../images/loading_default.gif') no-repeat center; + background-size: contain; + display: inline-block; + margin: 0 !important; + width: 1em; + height: 1em; +} + +/* END OF BASIC SHORTCODES */ + + + +/* START OF BROWSE LIB */ + +.zp-Browse-Bar { + background-color: #fff; + border: 2px solid #000; +} +.zp-Browse-Bar:before, +.zp-Browse-Bar:after { + content: ""; + display: table; +} +.zp-Browse-Bar:after { + clear: both; +} + +.zp-Browse-Collections, +.zp-Browse-Tags { + float: left; + width: 50%; +} + +.zp-Browse-Select { + overflow: hidden; + width: 100%; + /* height: 34px; */ +} +.zp-Browse-Select select { + background: transparent; + border: none; + color: #000; + cursor: pointer; + font-size: 1em; + margin: 0; + padding: 0 0.5em; + width: 100%; + height: 34px; +} +.zp-Browse-Collections-Select { + border-right: 2px solid #000; +} + +.zp-Collection-Title { + letter-spacing: 0.15em; + font-size: 0.9em; + font-weight: bold; + margin: 3em 0 0 0; + padding: 0 0 2em; + text-transform: uppercase; +} + +.zp-Entry-Image { + float: right; + margin: 0 0 1em 1em; +} + +.zp-Zotpress-SearchBox .zp-SearchBy-Container { + border-top: 1px solid #ccc; + display: flex; + justify-content: flex-start; + align-items: center; + padding: 0.5em 0; +} +.zp-Zotpress-SearchBox .zpSearchFilterContainer { + display: flex; + justify-content: space-evenly; + align-items: center; + margin: 0 0.5em; +} +.zp-Zotpress-SearchBox input[type="radio"] { + cursor: pointer; + margin: 0 0.5em 0 0; + vertical-align: middle; +} +.zp-Zotpress-SearchBox label { + cursor: pointer; + margin: 0; +} +.zp-Zotpress-SearchBox .zp-SearchBy { + margin: 0 1.5em; +} +.zp-Zotpress-SearchBox label, +.zp-Zotpress-SearchBox .zp-SearchBy { + font-size: 0.5em; + letter-spacing: 0.1em; + text-transform: uppercase; +} + +.zpSearchLoading { + visibility: hidden; + display: block; + margin: 1em auto; +} +.zpSearchLoading.show { + visibility: visible; +} + +.zpSearchResultsItem:after { + clear: both; + content: ""; + display: table; +} + +.zpSearchResultsItem .item_key { + display: block; + font-weight: bold; + margin-bottom: 2em; +} + +.zpSearchResultsItem.hidden { + display: none; +} + +.zp-Zotpress-SearchBox-Input { + border: none; + width: 100%; +} + +.zpSearchResultsPagingContainer { + display: none; + margin: 2rem 0; +} + +.zpSearchResultsPagingContainer:before, +.zpSearchResultsPagingContainer:after { + content: ""; + display: table; +} +.zpSearchResultsPagingContainer:after { + clear: both; +} +.zpSearchResultsPagingContainerInner { + display: flex; + align-items: center; + justify-content: flex-start; +} +.zpSearchResultsPagingContainer span.title { + /* display: block; */ + /* float: left; */ + font-size: 0.8em; + font-weight: bold; + line-height: 2.6; + margin-right: 2rem; + /* margin: 2px; */ + /* margin-left: 0; */ + /* padding: 0 20px 0; */ + text-transform: uppercase; +} + +.zpSearchResultsPagingCrop { + position: relative; + /* float: left; */ + overflow: hidden; + width: calc(3.5rem * 5); + /* width: 13em; */ + height: 3.5rem; +} + +.zpSearchResultsPaging { + /* z-index: 0; */ + position: absolute; + top: 0; + left: 0; + /* height: inherit; */ + display: flex; +} + +.zpSearchResultsPaging a, +.zpSearchResultsPaging a:link { + display: block; + /* float: left; */ + line-height: 0.9; + margin: 0; + text-align: center; + text-decoration: none; + flex-shrink: 0; + /* width: 50px; */ + width: 3.5rem; +} +.zpSearchResultsPaging a:focus { + box-shadow: none; + outline: none; +} +.zpSearchResultsPaging a span { + border: 2px solid transparent; + display: block; + padding: calc(1rem - 4px) calc(1.2rem - 4px); +} +.zpSearchResultsPaging a.selected span { + border-color: #000; +} + +.zpSearchResultsPagingScroller { + /* float: left; */ + /* background-color: #fff; */ + margin-left: 2rem; + text-align: center; + /* width: 4.2em; */ + /* height: 3rem; */ +} +.zpSearchResultsPagingScroller span { + cursor: pointer; + display: inline-block; + font-size: 3.5rem; + line-height: 0.8; + /* padding: 5px 10px; */ + padding: 0 1rem; + + -webkit-user-select: none; /* Chrome all / Safari all */ + -moz-user-select: none; /* Firefox all */ + -ms-user-select: none; /* IE 10+ */ + user-select: none; +} +.zpSearchResultsPagingScroller span:active { + opacity: 0.2; +} + + +div.zp-List .zp_display_progress { + background: transparent url('../images/loading_default.gif') no-repeat center left; + font-size: 0.7em; + line-height: 2; + padding-left: 3em; + text-transform: uppercase; +} +div.zp-List .csl-left-margin { + text-align: left; + width: 2.5em !important; +} +div.zp-List .csl-right-inline { + margin-left: 2.75em !important; +} + +.ui-helper-hidden-accessible { + display: none; +} + +/* END OF BROWSE LIB */ diff --git a/css/zotpress.shortcode.min.css b/css/zotpress.shortcode.min.css new file mode 100644 index 0000000..9acb3f8 --- /dev/null +++ b/css/zotpress.shortcode.min.css @@ -0,0 +1 @@ +div.zp-Zotpress{margin-top:0;margin-bottom:1em}div.zp-Zotpress div.zp-List.loading{background:transparent url('../images/loading_default.gif') no-repeat center bottom;padding-bottom:21px;min-height:2em}div.zp-Zotpress a{-ms-word-break:break-all;word-break:break-all;word-break:break-word;-webkit-hyphens:auto;-moz-hyphens:auto;hyphens:auto}div.zp-Zotpress div.zp-Entry.zp-HasImage{clear:both}div.zp-Zotpress div.zp-Entry-Image{float:right}a.zp-CiteRIS,a.zp-DownloadURL{font-size:.8em;text-transform:uppercase}a.zp-CiteRIS:before,a.zp-DownloadURL:before{content:"("}a.zp-CiteRIS:after,a.zp-DownloadURL:after{content:")"}.zp-List p.hide{display:none}.zp-Info{background:#ffeaa7 url('../images/icon-64x64.png') no-repeat top .4em right .4em;background-size:auto 2em;border:1px solid #fdcb6e;padding:.5em;padding-right:3em}.zp-ZotpressShortcode.bib .summary,.zp-ZotpressShortcode.cite .summary{display:none}.zp-InText-Citation.loading{background:transparent url('../images/loading_default.gif') no-repeat center;background-size:contain;display:inline-block;margin:0!important;width:1em;height:1em}.zp-Browse-Bar{background-color:#fff;border:2px solid #000}.zp-Browse-Bar:after,.zp-Browse-Bar:before{content:"";display:table}.zp-Browse-Bar:after{clear:both}.zp-Browse-Collections,.zp-Browse-Tags{float:left;width:50%}.zp-Browse-Select{overflow:hidden;width:100%}.zp-Browse-Select select{background:0 0;border:none;color:#000;cursor:pointer;font-size:1em;margin:0;padding:0 .5em;width:100%;height:34px}.zp-Browse-Collections-Select{border-right:2px solid #000}.zp-Collection-Title{letter-spacing:.15em;font-size:.9em;font-weight:700;margin:3em 0 0 0;padding:0 0 2em;text-transform:uppercase}.zp-Entry-Image{float:right;margin:0 0 1em 1em}.zp-Zotpress-SearchBox .zp-SearchBy-Container{border-top:1px solid #ccc;display:flex;justify-content:flex-start;align-items:center;padding:.5em 0}.zp-Zotpress-SearchBox .zpSearchFilterContainer{display:flex;justify-content:space-evenly;align-items:center;margin:0 .5em}.zp-Zotpress-SearchBox input[type=radio]{cursor:pointer;margin:0 .5em 0 0;vertical-align:middle}.zp-Zotpress-SearchBox label{cursor:pointer;margin:0}.zp-Zotpress-SearchBox .zp-SearchBy{margin:0 1.5em}.zp-Zotpress-SearchBox .zp-SearchBy,.zp-Zotpress-SearchBox label{font-size:.5em;letter-spacing:.1em;text-transform:uppercase}.zpSearchLoading{visibility:hidden;display:block;margin:1em auto}.zpSearchLoading.show{visibility:visible}.zpSearchResultsItem:after{clear:both;content:"";display:table}.zpSearchResultsItem .item_key{display:block;font-weight:700;margin-bottom:2em}.zpSearchResultsItem.hidden{display:none}.zp-Zotpress-SearchBox-Input{border:none;width:100%}.zpSearchResultsPagingContainer{display:none;margin:2rem 0}.zpSearchResultsPagingContainer:after,.zpSearchResultsPagingContainer:before{content:"";display:table}.zpSearchResultsPagingContainer:after{clear:both}.zpSearchResultsPagingContainerInner{display:flex;align-items:center;justify-content:flex-start}.zpSearchResultsPagingContainer span.title{font-size:.8em;font-weight:700;line-height:2.6;margin-right:2rem;text-transform:uppercase}.zpSearchResultsPagingCrop{position:relative;overflow:hidden;width:calc(3.5rem * 5);height:3.5rem}.zpSearchResultsPaging{position:absolute;top:0;left:0;display:flex}.zpSearchResultsPaging a,.zpSearchResultsPaging a:link{display:block;line-height:.9;margin:0;text-align:center;text-decoration:none;flex-shrink:0;width:3.5rem}.zpSearchResultsPaging a:focus{box-shadow:none;outline:0}.zpSearchResultsPaging a span{border:2px solid transparent;display:block;padding:calc(1rem - 4px) calc(1.2rem - 4px)}.zpSearchResultsPaging a.selected span{border-color:#000}.zpSearchResultsPagingScroller{margin-left:2rem;text-align:center}.zpSearchResultsPagingScroller span{cursor:pointer;display:inline-block;font-size:3.5rem;line-height:.8;padding:0 1rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zpSearchResultsPagingScroller span:active{opacity:.2}div.zp-List .zp_display_progress{background:transparent url('../images/loading_default.gif') no-repeat center left;font-size:.7em;line-height:2;padding-left:3em;text-transform:uppercase}div.zp-List .csl-left-margin{text-align:left;width:2.5em!important}div.zp-List .csl-right-inline{margin-left:2.75em!important}.ui-helper-hidden-accessible{display:none} diff --git a/eb-mods/eb-mods.php b/eb-mods/eb-mods.php new file mode 100644 index 0000000..2b90b8c --- /dev/null +++ b/eb-mods/eb-mods.php @@ -0,0 +1,84 @@ +prepare("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id = %d", $api_user_id); + } + else { + $query = $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname = %s", $nickname); + } + } + else { + $query = "SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY id DESC LIMIT 1"; + } + $zp_account = $wpdb->get_row($query); + + set_transient($hash, $zp_account); + } + + return $zp_account; +} + +function eb_zotpress_refresh_account($api_user_id = false, $nickname = false) { + $hash = 'zotpress_api_user_'.$api_user_id.$nickname; + + delete_transient($hash); +} + + +function eb_zotpress_get_cache($request_id, $api_user_id) { + global $wpdb; + + $cache_ver = get_option('zotpress_cache_ver_user_'.$api_user_id, 1); + $hash = 'zotpress_cache_'.md5($request_id.$api_user_id.$cache_ver); + + $zp_account = get_transient($hash); + if($zp_account === false) { + $zp_account = $wpdb->get_results($wpdb->prepare( + "SELECT DISTINCT ".$wpdb->prefix."zotpress_cache.* + FROM ".$wpdb->prefix."zotpress_cache + WHERE ".$wpdb->prefix."zotpress_cache.request_id = %s + AND ".$wpdb->prefix."zotpress_cache.api_user_id = %d", + $request_id, $api_user_id + )); + + set_transient($hash, $zp_account); + } + + return $zp_account; +} + +function eb_zotpress_refresh_cache($request_id, $api_user_id) { + $cache_ver = get_option('zotpress_cache_ver_user_'.$api_user_id, 1); + $hash = 'zotpress_cache_'.md5($request_id.$api_user_id.$cache_ver); + + delete_transient($hash); +} + + +function eb_zotpress_escape_array($arr) { + global $wpdb; + $escaped = array(); + foreach($arr as $k => $v){ + $v = trim($v); + if(!$v) + continue; + + if(is_numeric($v)) + $escaped[] = $wpdb->prepare('%d', $v); + else + $escaped[] = $wpdb->prepare('%s', $v); + } + return implode(',', $escaped); +} + +add_action( 'plugins_loaded', 'eb_zotpress_remove_filters' ); +function eb_zotpress_remove_filters() { + remove_filter( 'http_request_timeout', 'Zotpress_change_timeout' ); +} \ No newline at end of file diff --git a/images/bullet.gif b/images/bullet.gif deleted file mode 100644 index 9ff1fb2..0000000 Binary files a/images/bullet.gif and /dev/null differ diff --git a/images/help.png b/images/help.png deleted file mode 100644 index da1889e..0000000 Binary files a/images/help.png and /dev/null differ diff --git a/images/icon-64x64.png b/images/icon-64x64.png new file mode 100644 index 0000000..9ae9e43 Binary files /dev/null and b/images/icon-64x64.png differ diff --git a/images/icon-add.png b/images/icon-add.png deleted file mode 100644 index 3b425a8..0000000 Binary files a/images/icon-add.png and /dev/null differ diff --git a/images/icon-bib.png b/images/icon-bib.png deleted file mode 100644 index 5e3a7aa..0000000 Binary files a/images/icon-bib.png and /dev/null differ diff --git a/images/icon-cite.png b/images/icon-cite.png deleted file mode 100644 index b3479c6..0000000 Binary files a/images/icon-cite.png and /dev/null differ diff --git a/images/icon-edit.png b/images/icon-edit.png deleted file mode 100644 index 1305387..0000000 Binary files a/images/icon-edit.png and /dev/null differ diff --git a/images/icon-list.png b/images/icon-list.png deleted file mode 100644 index 6b7c191..0000000 Binary files a/images/icon-list.png and /dev/null differ diff --git a/images/icon-menu.svg b/images/icon-menu.svg new file mode 100644 index 0000000..c3b58cf --- /dev/null +++ b/images/icon-menu.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/images/loading_import.GIF b/images/loading_import.gif similarity index 100% rename from images/loading_import.GIF rename to images/loading_import.gif diff --git a/images/loading_import_lg.gif b/images/loading_import_lg.gif deleted file mode 100644 index c49f4d8..0000000 Binary files a/images/loading_import_lg.gif and /dev/null differ diff --git a/images/loading_list.gif b/images/loading_list.gif deleted file mode 100644 index bce8e07..0000000 Binary files a/images/loading_list.gif and /dev/null differ diff --git a/images/loading_select.gif b/images/loading_select.gif deleted file mode 100644 index ec34d55..0000000 Binary files a/images/loading_select.gif and /dev/null differ diff --git a/images/pp.png b/images/pp.png new file mode 100644 index 0000000..2900df7 Binary files /dev/null and b/images/pp.png differ diff --git a/images/sprite.png b/images/sprite.png index 24e24cb..ae35f90 100644 Binary files a/images/sprite.png and b/images/sprite.png differ diff --git a/images/syncing_bw.gif b/images/syncing_bw.gif deleted file mode 100644 index 0443387..0000000 Binary files a/images/syncing_bw.gif and /dev/null differ diff --git a/js/jquery.livequery.js b/js/jquery.livequery.js deleted file mode 100644 index dde8ad8..0000000 --- a/js/jquery.livequery.js +++ /dev/null @@ -1,250 +0,0 @@ -/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net) - * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) - * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. - * - * Version: 1.0.3 - * Requires jQuery 1.1.3+ - * Docs: http://docs.jquery.com/Plugins/livequery - */ - -(function($) { - -$.extend($.fn, { - livequery: function(type, fn, fn2) { - var self = this, q; - - // Handle different call patterns - if ($.isFunction(type)) - fn2 = fn, fn = type, type = undefined; - - // See if Live Query already exists - $.each( $.livequery.queries, function(i, query) { - if ( self.selector == query.selector && self.context == query.context && - type == query.type && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) ) - // Found the query, exit the each loop - return (q = query) && false; - }); - - // Create new Live Query if it wasn't found - q = q || new $.livequery(this.selector, this.context, type, fn, fn2); - - // Make sure it is running - q.stopped = false; - - // Run it immediately for the first time - q.run(); - - // Contnue the chain - return this; - }, - - expire: function(type, fn, fn2) { - var self = this; - - // Handle different call patterns - if ($.isFunction(type)) - fn2 = fn, fn = type, type = undefined; - - // Find the Live Query based on arguments and stop it - $.each( $.livequery.queries, function(i, query) { - if ( self.selector == query.selector && self.context == query.context && - (!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped ) - $.livequery.stop(query.id); - }); - - // Continue the chain - return this; - } -}); - -$.livequery = function(selector, context, type, fn, fn2) { - this.selector = selector; - this.context = context || document; - this.type = type; - this.fn = fn; - this.fn2 = fn2; - this.elements = []; - this.stopped = false; - - // The id is the index of the Live Query in $.livequery.queries - this.id = $.livequery.queries.push(this)-1; - - // Mark the functions for matching later on - fn.$lqguid = fn.$lqguid || $.livequery.guid++; - if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++; - - // Return the Live Query - return this; -}; - -$.livequery.prototype = { - stop: function() { - var query = this; - - if ( this.type ) - // Unbind all bound events - this.elements.unbind(this.type, this.fn); - else if (this.fn2) - // Call the second function for all matched elements - this.elements.each(function(i, el) { - query.fn2.apply(el); - }); - - // Clear out matched elements - this.elements = []; - - // Stop the Live Query from running until restarted - this.stopped = true; - }, - - run: function() { - // Short-circuit if stopped - if ( this.stopped ) return; - var query = this; - - var oEls = this.elements, - els = $(this.selector, this.context), - nEls = els.not(oEls); - - // Set elements to the latest set of matched elements - this.elements = els; - - if (this.type) { - // Bind events to newly matched elements - nEls.bind(this.type, this.fn); - - // Unbind events to elements no longer matched - if (oEls.length > 0) - $.each(oEls, function(i, el) { - if ( $.inArray(el, els) < 0 ) - $.event.remove(el, query.type, query.fn); - }); - } - else { - // Call the first function for newly matched elements - nEls.each(function() { - query.fn.apply(this); - }); - - // Call the second function for elements no longer matched - if ( this.fn2 && oEls.length > 0 ) - $.each(oEls, function(i, el) { - if ( $.inArray(el, els) < 0 ) - query.fn2.apply(el); - }); - } - } -}; - -$.extend($.livequery, { - guid: 0, - queries: [], - queue: [], - running: false, - timeout: null, - - checkQueue: function() { - if ( $.livequery.running && $.livequery.queue.length ) { - var length = $.livequery.queue.length; - // Run each Live Query currently in the queue - while ( length-- ) - $.livequery.queries[ $.livequery.queue.shift() ].run(); - } - }, - - pause: function() { - // Don't run anymore Live Queries until restarted - $.livequery.running = false; - }, - - play: function() { - // Restart Live Queries - $.livequery.running = true; - // Request a run of the Live Queries - $.livequery.run(); - }, - - registerPlugin: function() { - $.each( arguments, function(i,n) { - // Short-circuit if the method doesn't exist - if (!$.fn[n]) return; - - // Save a reference to the original method - var old = $.fn[n]; - - // Create a new method - $.fn[n] = function() { - // Call the original method - var r = old.apply(this, arguments); - - // Request a run of the Live Queries - $.livequery.run(); - - // Return the original methods result - return r; - } - }); - }, - - run: function(id) { - if (id != undefined) { - // Put the particular Live Query in the queue if it doesn't already exist - if ( $.inArray(id, $.livequery.queue) < 0 ) - $.livequery.queue.push( id ); - } - else - // Put each Live Query in the queue if it doesn't already exist - $.each( $.livequery.queries, function(id) { - if ( $.inArray(id, $.livequery.queue) < 0 ) - $.livequery.queue.push( id ); - }); - - // Clear timeout if it already exists - if ($.livequery.timeout) clearTimeout($.livequery.timeout); - // Create a timeout to check the queue and actually run the Live Queries - $.livequery.timeout = setTimeout($.livequery.checkQueue, 20); - }, - - stop: function(id) { - if (id != undefined) - // Stop are particular Live Query - $.livequery.queries[ id ].stop(); - else - // Stop all Live Queries - $.each( $.livequery.queries, function(id) { - $.livequery.queries[ id ].stop(); - }); - } -}); - -// Register core DOM manipulation methods -$.livequery.registerPlugin('append', 'prepend', 'after', 'before', 'wrap', 'attr', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove'); - -// Run Live Queries when the Document is ready -$(function() { $.livequery.play(); }); - - -// Save a reference to the original init method -var init = $.prototype.init; - -// Create a new init method that exposes two new properties: selector and context -$.prototype.init = function(a,c) { - // Call the original init and save the result - var r = init.apply(this, arguments); - - // Copy over properties if they exist already - if (a && a.selector) - r.context = a.context, r.selector = a.selector; - - // Set properties - if ( typeof a == 'string' ) - r.context = c || document, r.selector = a; - - // Return the result - return r; -}; - -// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091) -$.prototype.init.prototype = $.prototype; - -})(jQuery); \ No newline at end of file diff --git a/js/zotpress.accounts.js b/js/zotpress.accounts.js deleted file mode 100644 index dc27960..0000000 --- a/js/zotpress.accounts.js +++ /dev/null @@ -1,347 +0,0 @@ -jQuery(document).ready( function() -{ - - - /* - - SETUP BUTTONS - - */ - - jQuery("input#zp-Zotpress-Setup-Options-Next").click(function() - { - window.parent.location = "admin.php?page=Zotpress&setup=true&setupstep=three"; - return false; - }); - - jQuery("input#zp-Zotpress-Setup-Options-Complete").click(function() - { - if ( jQuery(this).hasClass("import") ) - window.parent.location = "admin.php?page=Zotpress"; - else - window.parent.location = "admin.php?page=Zotpress&accounts=true"; - return false; - }); - - - - /* - - SYNC ACCOUNT WITH ZOTPRESS - - */ - - jQuery('#zp-Connect').click(function () - { - var data = 'connect=true' - + '&account_type=' + jQuery('select[name=account_type] option:selected').val() - + '&api_user_id=' + jQuery('input[name=api_user_id]').val() - + '&public_key=' + jQuery('input[name=public_key]').val() - + '&nickname=' + escape(jQuery('input[name=nickname]').val()); - - // Disable all the text fields - jQuery('input[name!=update], textarea, select').attr('disabled','true'); - - // Show the loading sign - jQuery('.zp-Errors').hide(); - jQuery('.zp-Success').hide(); - jQuery('.zp-Loading').show(); - - // Set up uri - var xmlUri = jQuery('input[name=ZOTPRESS_PLUGIN_URL]').val() + 'lib/actions/actions.php?'+data; - - if (jQuery('input[name=update]').val() !== undefined) - xmlUri += "&update=" + jQuery('input[name=update]').val(); - - // AJAX - jQuery.get(xmlUri, {}, function(xml) - { - var $result = jQuery('result', xml).attr('success'); - - if ($result == "true") - { - jQuery('div.zp-Errors').hide(); - jQuery('.zp-Loading').hide(); - jQuery('div.zp-Success').html("

Success! Your Zotero account has been validated.

\n"); - - jQuery('div.zp-Success').show(); - - // SETUP - if (jQuery("div#zp-Setup").length > 0) - { - jQuery.doTimeout(1000,function() { - window.parent.location = "admin.php?page=Zotpress&setup=true&setupstep=two"; - }); - } - - // REGULAR - else - { - jQuery.doTimeout(1000,function() - { - jQuery('div#zp-AddAccount').slideUp("fast"); - jQuery('form#zp-Add')[0].reset(); - jQuery('input[name!=update], textarea, select').removeAttr('disabled'); - jQuery('div.zp-Success').hide(); - - DisplayAccounts(); - }); - } - } - else // Show errors - { - jQuery('input, textarea, select').removeAttr('disabled'); - jQuery('div.zp-Errors').html("

Oops! "+jQuery('errors', xml).text()+"

\n"); - jQuery('div.zp-Errors').show(); - jQuery('.zp-Loading').hide(); - } - }); - - return false; - }); - - - - /* - - OAUTH MODAL - - */ - - jQuery('a.zp-OAuth-Button').livequery('click', function() { - tb_show('', jQuery(this).attr('href')+'&TB_iframe=true'); - return false; - }); - - - - - /* - - REMOVE ACCOUNT - - */ - - jQuery('#zp-Accounts').delegate(".actions a.delete", "click", function () { - - $this = jQuery(this); - $thisProject = $this.parent().parent(); - - var confirmDelete = confirm("Are you sure you want to remove this account?"); - - if (confirmDelete==true) - { - var xmlUri = jQuery('#ZOTPRESS_PLUGIN_URL').text() + 'lib/actions/actions.php?delete=' + $this.attr("href").replace("#", ""); - - jQuery.get(xmlUri, {}, function(xml) - { - if ( jQuery('result', xml).attr('success') == "true" ) - { - if ( jQuery('result', xml).attr('total_accounts') == 0 ) - window.location = 'admin.php?page=Zotpress'; - else - window.location = 'admin.php?page=Zotpress&accounts=true'; - } - else - { - alert( "Sorry - couldn't delete that account." ); - } - }); - } - - }); - - - - /* - - SET UP IMPORT BUTTON - - */ - - jQuery("iframe#zp-Setup-Import").ready(function() - { - jQuery("input#zp-Zotpress-Setup-Import").removeAttr('disabled'); - jQuery("input.zp-Import-Button").removeAttr('disabled'); - - // IMPORT ITEMS - jQuery("input#zp-Zotpress-Setup-Import-Items").click(function() - { - jQuery(".import .zp-Loading-Initial").show(); - jQuery(".import .zp-Import-Messages").show(); - jQuery("input[type=button]").attr('disabled', 'true'); - - jQuery("iframe#zp-Setup-Import").attr('src', jQuery("iframe#zp-Setup-Import").attr('src') + "&go=true&step=items&singlestep=true"); - - return false; - }); - - // IMPORT COLLECTIONS - jQuery("input#zp-Zotpress-Setup-Import-Collections").click(function() - { - jQuery(".import .zp-Loading-Initial").show(); - jQuery(".import .zp-Import-Messages").text("Importing collections 1-50 ...").show(); - jQuery("input[type=button]").attr('disabled', 'true'); - - jQuery("iframe#zp-Setup-Import").attr('src', jQuery("iframe#zp-Setup-Import").attr('src') + "&go=true&step=collections&singlestep=true"); - - return false; - }); - - // IMPORT TAGS - jQuery("input#zp-Zotpress-Setup-Import-Tags").click(function() - { - jQuery(".import .zp-Loading-Initial").show(); - jQuery(".import .zp-Import-Messages").text("Importing tags 1-50 ...").show(); - jQuery("input[type=button]").attr('disabled', 'true'); - - jQuery("iframe#zp-Setup-Import").attr('src', jQuery("iframe#zp-Setup-Import").attr('src') + "&go=true&step=tags&singlestep=true"); - - return false; - }); - - // IMPORT EVERYTHING - jQuery("input#zp-Zotpress-Setup-Import").click(function() - { - jQuery(".import .zp-Loading-Initial").show(); - jQuery(".import .zp-Import-Messages").show(); - jQuery("input[type=button]").attr('disabled', 'true'); - - jQuery("iframe#zp-Setup-Import").attr('src', jQuery("iframe#zp-Setup-Import").attr('src') + "&go=true&step=items"); - - return false; - }); - }); - - - - /* - - SET UP SYNC BUTTON - - */ - - //jQuery('div#zp-AccountsList div.zp-Account .actions a.sync').click(function(e) - //{ - // var $this = jQuery(this); - // - // // Disable sync link until done - // e.preventDefault(); - // - // // Prep and show loading sign - // $this.removeClass("success"); - // $this.removeClass("error"); - // $this.addClass("syncing"); - // - // // Add sync iframe to DOM - // if (jQuery("iframe#zp-Sync-" + jQuery("span", $this).text()).length == 0) - // { - // jQuery(' - - - - -
-
-
Importing selected collection(s) ...
-
- - - - - - - - - - - - \ No newline at end of file + + +
+ +
+ +
+ +
+ + + +
+ +
+ + +
+

!

+
+ + +
+ +
+ +
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +
+ +
+ +

+ + + +
+ +
+ +
+ +
+ + diff --git a/lib/import/import.actions.php b/lib/import/import.actions.php deleted file mode 100644 index a20d499..0000000 --- a/lib/import/import.actions.php +++ /dev/null @@ -1,230 +0,0 @@ -array(0,"User ID was left blank."), - "api_user_id_format"=>array(0,"User ID was formatted incorrectly."), - "step_blank"=>array(0,"Step was not set."), - "step_format"=>array(0,"Step was not formatted correctly."), - "start_blank"=>array(0,"Start were not set."), - "start_format"=>array(0,"Start were not formatted correctly.") - ); - - - // CHECK API USER ID - - if ($_GET['api_user_id'] != "") - if (preg_match("/^[0-9]+$/", $_GET['api_user_id']) == 1) - $api_user_id = htmlentities($_GET['api_user_id']); - else - $errors['api_user_id_format'][0] = 1; - else - $errors['api_user_id_blank'][0] = 1; - - - // CHECK STEP - - if ($_GET['step'] != "") - if (preg_match("/^[a-z]+$/", $_GET['step']) == 1) - $step = htmlentities($_GET['step']); - else - $errors['step_format'][0] = 1; - else - $errors['step_blank'][0] = 1; - - - // CHECK START - - if ($_GET['start'] != "") - if (preg_match("/^[a-zA-Z0-9,]+$/", $_GET['start']) == 1) - if ( $step == "selective") - $start = htmlentities($_GET['start']); - else - $start = intval(htmlentities($_GET['start'])); - else - $errors['start_format'][0] = 1; - else - $errors['start_blank'][0] = 1; - - - // CHECK ERRORS - - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // IMPORT - - if ($errorCheck == false) - { - // Setup - - $GLOBALS['zp_session'][$api_user_id]['items']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries'] = 0; - - $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] = 0; - - $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries'] = 0; - - - // ITEMS - - if ( isset($_GET['step']) && $_GET['step'] == "items") - { - global $wpdb; - - $zp_selective = false; - if ( isset($_GET['selective']) && preg_match("/^[a-zA-Z0-9,]+$/", $_GET['selective']) && $_GET['selective'] != "false" ) - $zp_selective = $_GET['selective']; - - $zp_continue = zp_get_items ($wpdb, $api_user_id, $start, $zp_selective); - - if ($zp_continue === true) - { - zp_save_items ($wpdb, $api_user_id, true); - - $xml = "\n"; - } - else if ($zp_continue === false) // Execute import query, then move on - { - zp_save_items ($wpdb, $api_user_id, false); - - $xml = "\n"; - } - else // error - { - $xml = "\n"; - $xml = "". $zp_continue ."\n"; - } - } - - - // COLLECTIONS - - else if ( isset($_GET['step']) && $_GET['step'] == "collections") - { - global $wpdb; - - $zp_selective = false; - if ( isset($_GET['selective']) && preg_match("/^[a-zA-Z0-9,]+$/", $_GET['selective']) && $_GET['selective'] != "false" ) - $zp_selective = $_GET['selective']; - - $zp_continue = zp_get_collections ($wpdb, $api_user_id, $start, false, $zp_selective); - - if ($zp_continue["continue"] === true) - { - zp_save_collections ($wpdb, $api_user_id, true); - - $xml = "\n"; - - if ( $zp_selective) $xml .= "" . $zp_continue["collections"] . "\n"; - } - else // Execute import query, then move on - { - zp_save_collections ($wpdb, $api_user_id, false); - //zp_link_collections ($wpdb, $api_user_id); for wp custom types - - $xml = "\n"; - - if ( $zp_selective ) $xml .= "" . $zp_continue["collections"] . "\n"; - } - } - - - // TAGS - - else if ( isset($_GET['step']) && $_GET['step'] == "tags") - { - global $wpdb; - - $zp_selective = false; - if ( isset($_GET['selective']) && preg_match("/^[a-zA-Z0-9,]+$/", $_GET['selective']) && $_GET['selective'] != "false" ) - $zp_selective = $_GET['selective']; - - $zp_continue = zp_get_tags ($wpdb, $api_user_id, $start, $zp_selective); - - if ($zp_continue === true) - { - zp_save_tags ($wpdb, $api_user_id, true); - - $xml = "\n"; - } - else // Execute import query, then move on - { - zp_save_tags ($wpdb, $api_user_id, false); - - $xml = "\n"; - } - } - - } - - - // DISPLAY ERRORS - - else - { - $xml .= "\n"; - $xml .= "\n"; - $xml .= "\n"; - foreach ($errors as $field => $error) - if ($error[0] == 1) - $xml .= $error[1]."\n"; - $xml .= "\n"; - $xml .= "\n"; - } - } - - - - /* - - DISPLAY XML - - */ - - header('Content-Type: application/xml; charset=ISO-8859-1'); - echo "\n"; - echo "\n"; - echo $xml; - echo ""; - - exit; - - } // nonce - } - - add_action( 'wp_ajax_zotpress_import_ajax', 'zotpress_import_ajax' ); - -?> \ No newline at end of file diff --git a/lib/import/import.collection.php b/lib/import/import.collection.php deleted file mode 100644 index b96bbb0..0000000 --- a/lib/import/import.collection.php +++ /dev/null @@ -1,131 +0,0 @@ - 403 ) ); - -// Check api user id -$api_user_id = false; -if ($_GET['api_user_id'] != "") - if (preg_match("/^[0-9]+$/", $_GET['api_user_id']) == 1) $api_user_id = htmlentities($_GET['api_user_id']); - else wp_die( __('Only editors can access this page.'), __('Zotpress: Access Denied'), array( 'response' => '403' ) ); -else - wp_die( __('Only editors can access this page.'), __('Zotpress: Access Denied'), array( 'response' => '403' ) ); - -// Check nonce -if ( check_admin_referer( 'zp_importing_' . intval($api_user_id) . '_' . date('Y-j-G'), 'zp_nonce' ) ) -{ - // Access WordPress db - global $wpdb; - - // Ignore user abort - ignore_user_abort(true); - set_time_limit(60); // 1 minute (vs. 60*10) - - // Include Request Functionality - require("../request/rss.request.php"); - - // Include Import Functions - require("import.functions.php"); - - $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] = 0; - $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] = 0; - - $zp_current_set = 0; - - while ( $zp_current_set <= $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] ) - { - $zp_continue = zp_get_collections ($wpdb, $api_user_id, $zp_current_set, true); - //zp_save_collections ($wpdb, $api_user_id, true, true); // saving now might be confusing to users because it doesn't import items or subcollections - $zp_current_set += 50; - } - - $output = "\n\n"; - $output .= ''; - $output .= ''; - $output .= "\n"; - $output .= "\n\n"; - - // Display - if ( $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] > 0 ) - { - $output .= "
\n"; - for ($i = 0; $i <= ($GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] - 1); $i++ ) - { - $mod = $i * 7; - - $output .= "
"; - $output .= "" . $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][1+$mod] . ""; - $output .= "" . $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][6+$mod] . " items, "; - $output .= $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][5+$mod] . " subcollections"; - $output .= "
\n"; - } - $output .= "
\n\n"; - } - else // No collections exist - { - $output .= "

Sorry, no collections to display.

"; - } - - $output .= "\n"; - - echo $output; - - // Unset - $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] = 0; - -} // nonce - -?> \ No newline at end of file diff --git a/lib/import/import.functions.php b/lib/import/import.functions.php deleted file mode 100644 index 93685e4..0000000 --- a/lib/import/import.functions.php +++ /dev/null @@ -1,1271 +0,0 @@ - 0 ): - preg_match_all( '/(\d{4})/', $date, $matches ); - if ( isset($matches[0][0]) ): - return $matches[0][0]; - else: - return ""; - endif; - else: - return ""; - endif; - } - - - - function zp_set_update_time ($time) - { - update_option("Zotpress_LastAutoUpdate", $time); - } - - - - function zp_get_api_user_id ($api_user_id_incoming=false) - { - if (isset($_GET['api_user_id']) && preg_match("/^[0-9]+$/", $_GET['api_user_id']) == 1) - $api_user_id = htmlentities($_GET['api_user_id']); - else if ($api_user_id_incoming !== false) - $api_user_id = $api_user_id_incoming; - else - $api_user_id = false; - - return $api_user_id; - } - - - - function zp_get_account ($wpdb, $api_user_id_incoming=false) - { - if ($api_user_id_incoming !== false) - $zp_account = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id_incoming."'"); - else - $zp_account = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress ORDER BY id DESC LIMIT 1"); - - return $zp_account; - } - - - - function zp_get_accounts ($wpdb) - { - $zp_accounts = $wpdb->get_results("SELECT api_user_id FROM ".$wpdb->prefix."zotpress"); - - return $zp_accounts; - } - - - - //function zp_delete_collection ($term_id) - //{ - // wp_delete_term( $term_id, 'zp_collections' ); - // delete_option( 'zp_collection-'.$term_id.'-api_user_id' ); - // delete_option( 'zp_collection-'.$term_id.'-retrieved' ); - // delete_option( 'zp_collection-'.$term_id.'-parent' ); - // delete_option( 'zp_collection-'.$term_id.'-item_key' ); - // delete_option( 'zp_collection-'.$term_id.'-numCollections' ); - // delete_option( 'zp_collection-'.$term_id.'-numItems' ); - // delete_option( 'zp_collection-'.$term_id.'-items' ); - //} - // - // - // - //function zp_delete_tag ($term_id) - //{ - // wp_delete_term( $term_id, 'zp_tags' ); - // delete_option( 'zp_tag-'.$term_id.'-api_user_id' ); - // delete_option( 'zp_tag-'.$term_id.'-retrieved' ); - // delete_option( 'zp_tag-'.$term_id.'-numItems' ); - // delete_option( 'zp_tag-'.$term_id.'-items' ); - //} - - - // Function to recursively delete collections and their items - function zp_selectively_delete_collection ( $wpdb, $api_user_id, $collection ) - { - $collection_item_list = array(); - - // First, get items - $items = $wpdb->get_results( - " - SELECT ".$wpdb->prefix."zotpress_zoteroRelItemColl.item_key - FROM ".$wpdb->prefix."zotpress_zoteroRelItemColl - WHERE api_user_id='".$api_user_id."' - AND ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key='".$collection."' - ", - OBJECT - ); - - if ( count($items) > 0 ) - { - foreach ( $items as $item ) - { - // Remember item to check tags later - $collection_item_list[count($collection_item_list)] = $item->item_key; - - // Delete item's children - $wpdb->query( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE api_user_id='".$api_user_id."' AND parent='".$item->item_key."' - " - ); - } - // Then delete items - $wpdb->query( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE api_user_id='".$api_user_id."' AND item_key IN ( '".implode("','", $collection_item_list)."' ) - " - ); - // And their relationships with collections - $wpdb->query( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroRelItemColl - WHERE api_user_id='".$api_user_id."' AND item_key IN ( '".implode("','", $collection_item_list)."' ) - " - ); - } - - unset( $items ); - - // Then delete collection - $wpdb->query( - $wpdb->prepare( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='%s' AND item_key='%s' - ", - $api_user_id, $collection - ) - ); - - // Next, delete subcollections - $subcollections = $wpdb->get_results( - " - SELECT item_key FROM ".$wpdb->prefix."zotpress_zoteroCollections - WHERE api_user_id='".$api_user_id."' AND parent='".$collection."' - " - ); - - if ( count($subcollections) > 0 ) - { - foreach ( $subcollections as $subcollection ) - { - $temp = zp_selectively_delete_collection( $wpdb, $api_user_id, $subcollection->item_key ); - - if ( $temp ) $GLOBALS['zp_session'][$api_user_id]['collection_item_list'] = array_merge( $temp, $GLOBALS['zp_session'][$api_user_id]['collection_item_list'] ); - } - } - - unset( $subcollections ); - - if ( count($collection_item_list) > 0) return $collection_item_list; else return false; - } - - - - function zp_clear_last_import ($wpdb, $api_user_id, $step, $collections=false) - { - switch ($step) - { - case "items": - $wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$api_user_id."'"); - $wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroRelItemColl WHERE api_user_id='".$api_user_id."'"); - $wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroRelItemTags WHERE api_user_id='".$api_user_id."'"); - //$zp_entry_array = get_posts( - // array( - // 'posts_per_page' => -1, - // 'post_type' => 'zp_entry', - // 'meta_key' => 'api_user_id', - // 'meta_value' => $api_user_id - // ) - //); - //foreach ($zp_entry_array as $zp_entry) wp_delete_post( $zp_entry->ID, true ); - break; - - case "collections": - $wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='".$api_user_id."'"); - //$zp_collections_array = get_terms( - // 'zp_collections', - // array( - // 'hide_empty' => false - // ) - //); - //foreach ($zp_collections_array as $zp_collection_term) - // if ( get_option( 'zp_collection-'.$zp_collection_term->term_id.'-api_user_id' ) ) - // zp_delete_collection ($zp_collection_term->term_id); - break; - - case "tags": - $wpdb->query("DELETE FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE api_user_id='".$api_user_id."'"); - //$zp_tags_array = get_terms( - // 'zp_tags', - // array( - // 'hide_empty' => false - // ) - //); - //foreach ($zp_tags_array as $zp_tag_term) - // if ( get_option( 'zp_tag-'.$zp_tag_term->term_id.'-api_user_id' ) ) - // zp_delete_tag ($zp_tag_term->term_id); - break; - - case "selective": - if ( $collections !== false ) - { - $collection_item_list = array(); // for tags - //$collections = str_replace( ",", "', '", $collections ); - //$collections = explode( ",", $collections ); - //$all_top_level_collections = get_terms( 'zp_collections', array( 'hide_empty' => false, 'parent' => 0 ) ); - //$all_top_level_collections = $wpdb->get_results( - // " - // SELECT item_key FROM ".$wpdb->prefix."zotpress_zoteroCollections - // WHERE api_user_id='".$api_user_id."' AND item_key IN ( '".$collections."' ) - // " - //); - $collections = explode(",", $collections); - $GLOBALS['zp_session'][$api_user_id]['collection_item_list'] = array(); - - // Delete selected top level collection, items, subcollections and their items - if ( count($collections) > 0 ) - { - foreach ( $collections as $top_level_collection ) - { - $temp = zp_selectively_delete_collection( $wpdb, $api_user_id, $top_level_collection ); - - if ( $temp ) $collection_item_list = array_merge( $temp, $collection_item_list ); - } - } - - // Merge item lists from top level collection with subcollection item lists - $collection_item_list = array_merge( $collection_item_list, $GLOBALS['zp_session'][$api_user_id]['collection_item_list'] ); - - // Remove items from tags, delete tags if no items - // This means that once imported, tags will remain if there's another item key, even if the item itself isn't imported - if ( count($collection_item_list) > 0 ) - { - foreach ( $collection_item_list as $item_key ) - { - // Get this item's tags - $item_tags = $wpdb->get_results( - " - SELECT tag_title FROM ".$wpdb->prefix."zotpress_zoteroRelItemTags - WHERE api_user_id='".$api_user_id."' AND item_key='".$item_key."' - " - ); - - if ( count($item_tags) > 0 ) - { - foreach ( $item_tags as $item_tag ) - { - // Delete relationship with item - $wpdb->query( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroRelItemTags - WHERE api_user_id='".$api_user_id."' - AND (item_key = '".$item_key."' AND tag_title = '".$item_tag->tag_title."') - " - ); - - // Delete tags if they don't have items - $tag_itemrel_count = $wpdb->get_results( - " - SELECT COUNT(*) AS itemrel_count FROM ".$wpdb->prefix."zotpress_zoteroRelItemTags - WHERE api_user_id='".$api_user_id."' AND tag_title='".$item_tag->tag_title."' - " - ); - - if ( $tag_itemrel_count[0]->itemrel_count < 1) - { - $wpdb->query( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroTags - WHERE api_user_id='".$api_user_id."' - AND title = '".$item_tag->tag_title."' - " - ); - } - - //$tag_items = str_replace( $item_key.",", "", $item_tag->listItems."," ); - // - //// Update tag's item list - //if ( strlen($tag_items) > 0 ) - //{ - // $wpdb->query( - // $wpdb->prepare( - // " - // UPDATE ".$wpdb->prefix."zotpress_zoteroTags - // SET listItems=%s - // WHERE id=%d - // ", - // rtrim( $tag_items, "," ), $item_tag->id - // ) - // ); - //} - //else // No items, so delete - //{ - // $wpdb->query( - // $wpdb->prepare( - // " - // DELETE FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE id=%d - // ", - // $item_tag->id - // ) - // ); - //} - } - } - unset($item_tags); - } - unset($collection_item_list); - - /* - $all_tags = $wpdb->get_results( - " - SELECT id, title, listItems FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE api_user_id='".$api_user_id."' - " - ); - - foreach ( $all_tags as $zp_tag ) - { - $zp_tag_items = explode( ',', $zp_tag->listItems ); - $updated_item_list = $zp_tag->listItems; - - // Create new item list for tag - foreach ( $zp_tag_items as $zp_tag_item ) { - if ( in_array( $zp_tag_item, $collection_item_list ) ) { - $updated_item_list = str_replace( $zp_tag_item.',', '', $updated_item_list ); - } - } - - if ( strlen($updated_item_list) > 0 ) - { - // Update tag's item list - $wpdb->query( - $wpdb->prepare( - " - UPDATE ".$wpdb->prefix."zotpress_zoteroTags - SET listItems=%s - WHERE id=%s - ", - rtrim( $updated_item_list, "," ), $zp_tag->id - ) - ); - } - else // No items left, so delete tag - { - $wpdb->query( - $wpdb->prepare( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE id=%s - ", - $zp_tag->id - ) - ); - } - - unset($zp_tag_items); - unset($updated_item_list); - } - - unset($all_tags); - unset($collection_item_list); - unset($all_top_level_collections); - */ - } - - /* - if ( count($all_top_level_collections) > 0 ) - { - // Delete selected top level collection, items, subcollections and their items - foreach ( $all_top_level_collections as $top_level_collection ) - { - if ( in_array( $top_level_collection->description, $collections ) ) - { - // Get subcollections - $subcollections = get_terms( 'zp_collections', array( 'hide_empty' => true, 'child_of' => $top_level_collection->term_id ) ); - - if ( count($subcollections) > 0 ) - { - foreach ( $subcollections as $subcollection ) - { - // Get subcollection items - $subcollection_items = get_option( 'zp_collection-'.$subcollection->term_id.'-items' ); - if ( $subcollection_items !== false && strlen(trim($subcollection_items)) > 0 ) $collection_item_list .= trim($subcollection_items).','; // add to item list - unset($subcollection_items); - - // Delete subcollection - wp_delete_term( $subcollection->term_id, 'zp_collections' ); - } - } - unset($subcollections); - - // Get collection items - $collection_items = get_option( 'zp_collection-'.$top_level_collection->term_id.'-items' ); - if ( $collection_items !== false && strlen(trim($collection_items)) > 0 ) $collection_item_list .= trim($collection_items).','; // add to item list - unset($collection_items); - - // Delete collection - wp_delete_term( $top_level_collection->term_id, 'zp_collections' ); - } - } - - if ( trim($collection_item_list) != '' ) - { - $collection_item_list_arr = explode( ',', rtrim( $collection_item_list, ',' ) ); - $all_tags = get_terms( 'zp_tags', array( 'hide_empty' => false ) ); - - // Remove items and thier children - foreach ( $collection_item_list_arr as $c_item ) - { - // Get item's data - $c_item_data = get_posts( array( 'posts_per_page' => 1, 'post_type' => 'zp_entry', 'meta_key' => 'item_key', 'meta_value' => $c_item ) ); - - // Get item's children - $c_item_children = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'zp_entry', 'meta_key' => 'parent', 'meta_value' => $c_item ) ); - - if ( count($c_item_children) > 0 ) - { - foreach ( $c_item_children as $c_item_child ) - { - $collection_item_list .= get_metadata( 'zp_entry', $c_item_child->ID, 'item_key' ).','; - wp_delete_post( $c_item_child->ID, true ); - } - unset($c_item_children); - } - foreach ( $c_item_data as $i ) wp_delete_post( $i->ID, true ); - unset($c_item_data); - } - unset($collection_item_list_arr); - - - // Remove items from tags, delete tags if no items - foreach ( $all_tags as $zp_tag ) - { - $zp_tag_items = explode( ',', $zp_tag->description ); - $updated_item_list = $zp_tag->description; - - // Create new item list for tag - foreach ( $zp_tag_items as $zp_tag_item ) if ( in_array( $zp_tag_item, $collection_item_list ) ) $updated_item_list = str_replace( $zp_tag_item.',', '', $updated_item_list ); - - if ( strlen($updated_item_list) > 0 ) - { - // Update tag's item list - wp_update_term( $zp_tag->term_id, 'zp_tags', array( 'description' => rtrim( $updated_item_list, ',' ) ) ); - } - else // No items left, so delete tag - { - wp_delete_term( $tag_to_delete->term_id, 'zp_tags' ); - } - - unset($zp_tag_items); - unset($updated_item_list); - } - unset($all_tags); - - } // collection items exist - } // top level collections exist - */ - } // collections to review exist - - break; - } - } - - - - /**************************************************************************************** - * - * ZOTPRESS IMPORT ITEMS - * - ****************************************************************************************/ - - function zp_get_items ($wpdb, $api_user_id, $zp_start, $zp_collection=false) - { - $zp_import_contents = new ZotpressRequest(); - $zp_account = zp_get_account($wpdb, $api_user_id); - - - // Get default style - $zp_default_style = "apa"; - if (get_option("Zotpress_DefaultStyle")) $zp_default_style = strtolower( get_option("Zotpress_DefaultStyle") ); - - // Build request URL - if ( $zp_collection ) $zp_collection_url = '/collections/'.$zp_collection; else $zp_collection_url = ''; - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id.$zp_collection_url."/items?"; - if ( is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "" ) - $zp_import_url .= "key=".$zp_account[0]->public_key."&"; - $zp_import_url .= "format=atom&content=json,bib&style=".$zp_default_style."&limit=50&start=".$zp_start; - - - // Make the request - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - // Stop in our tracks if there's a request error - if ($zp_import_contents->request_error) return $zp_import_contents->request_error; - - // Report any errors returned from Zotero - if ( trim(strtolower($zp_xml)) == "forbidden" ) - { - return "Zotero is telling Zotpress that access is forbidden. Are you sure that the Zotero API key you're using for this account is correct?"; - } - else if ( trim(strtolower($zp_xml)) == "invalid style" ) - { - return "Zotero is telling Zotpress that the style you're using is invalid. Are you sure that the name of the default style you've selected is correct?"; - } - - - // Make it DOM-traversable - $doc_citations = new DOMDocument(); - $doc_citations->loadXML($zp_xml); - - - // Get last set - if (!isset($GLOBALS['zp_session'][$api_user_id]['items']['last_set'])) - { - $last_set = ""; - $links = $doc_citations->getElementsByTagName("link"); - - foreach ($links as $link) - { - if ($link->getAttribute('rel') == "last") - { - if (stripos($link->getAttribute('href'), "start=") !== false) - { - $last_set = explode("start=", $link->getAttribute('href')); - $GLOBALS['zp_session'][$api_user_id]['items']['last_set'] = intval($last_set[1]); - } - else - { - $GLOBALS['zp_session'][$api_user_id]['items']['last_set'] = 0; - } - } - } - } - - - // PREPARE EACH ENTRY FOR DB INSERT - // Entries can be items or attachments (e.g. notes) - - $entries = $doc_citations->getElementsByTagName("entry"); - - foreach ($entries as $entry) - { - $item_key = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "key")->item(0)->nodeValue; - - //// For selective import: Keep track of and skip duplicates - //// Not working for some reason - ////if ( $zp_collection ) - ////{ - // if ( array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['duplicates']['items'] ) ) - // continue; - // else - // $GLOBALS['zp_session'][$api_user_id]['duplicates']['items'][$item_key] = true; - ////} - - $retrieved = $entry->getElementsByTagName("updated")->item(0)->nodeValue; - $item_type = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "itemType")->item(0)->nodeValue; - - // Get citation content (json and bib) - - $citation_content = ""; - $citation_content_temp = new DOMDocument(); - - foreach($entry->getElementsByTagNameNS("http://zotero.org/ns/api", "subcontent") as $child) - { - if ($child->attributes->getNamedItem("type")->nodeValue == "json") - { - $json_content = $child->nodeValue; - } - else // Styled citation - { - foreach($child->childNodes as $child_content) { - $citation_content_temp->appendChild($citation_content_temp->importNode($child_content, true)); - $citation_content = $citation_content_temp->saveHTML(); - } - } - } - - // Get basic metadata from JSON - $json_content_decoded = json_decode($json_content); - - $author = ""; - $author_other = ""; - $date = ""; - $year = ""; - $title = ""; - $numchildren = 0; - $parent = ""; - $link_mode = ""; - - - if ( isset($json_content_decoded->creators) ) - { - if ( count($json_content_decoded->creators) > 0 ) - { - foreach ($json_content_decoded->creators as $creator) - if ($creator->creatorType == "author") - if (isset($creator->name)) // One-name authors - $author .= $creator->name . ", "; - else - $author .= $creator->lastName . ", "; - else - if (isset($creator->name)) // One-name authors - $author_other .= $creator->name . ", "; - else - $author_other .= $creator->lastName . ", "; - } - else // no creator - { - $author = ""; - //if (isset($creator->name)) // One-name authors - // $author .= $creator->creators["name"]; - //else - // $author .= $creator->creators["lastName"]; - } - } - else // no creator - { - $author = ""; - } - - // Determine if we use author or other author type - if (trim($author) == "") $author = $author_other; - - // Remove last comma - $author = preg_replace('~(.*)' . preg_quote(', ', '~') . '~', '$1' . '', $author, 1); - - $date = ""; if ( isset($json_content_decoded->date) ) $date = $json_content_decoded->date; - $year = zp_extract_year($date); - - if (trim($year) == "") $year = "0000"; - - $title = ""; if ( isset($json_content_decoded->title) ) $title = $json_content_decoded->title; - - $numchildren = 0; if ( isset($entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numChildren")->item(0)->nodeValue) ) $numchildren = intval($entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numChildren")->item(0)->nodeValue); - - // DOWNLOAD: Find URL - // for attachments, look at zapi:subcontent zapi:type="json" - linkMode - either imported_file or linked_url - if ($item_type == "attachment") - if (isset($json_content_decoded->linkMode)) $link_mode = $json_content_decoded->linkMode; - - // PARENT - //if ( $zp_collection ) // This was setting the parent of attachments to the collection - //{ - // $parent = $zp_collection; - //} - //else // Regular - //{ - foreach($entry->getElementsByTagName("link") as $entry_link) - { - if ($entry_link->getAttribute('rel') == "up") { - $temp = explode("items/", $entry_link->getAttribute('href')); - $temp = explode("?", $temp[1]); - $parent = $temp[0]; - } - - // Get download URL - if ($link_mode == "imported_file" && $entry_link->getAttribute('rel') == "self") { - $citation_content = substr($entry_link->getAttribute('href'), 0, strpos($entry_link->getAttribute('href'), "?")); - } - } - //} - - // Prep for insert into db - array_push($GLOBALS['zp_session'][$api_user_id]['items']['query_params'], - $zp_account[0]->api_user_id, - $item_key, - zp_db_prep($retrieved), - zp_db_prep($json_content), - zp_db_prep($author), - zp_db_prep($date), - zp_db_prep($year), - zp_db_prep($title), - $item_type, - $link_mode, - zp_db_prep($citation_content), - zp_db_prep($zp_default_style), - $numchildren, - $parent); - - $GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries']++; - - } // foreach entry - - - // LAST SET - if ($GLOBALS['zp_session'][$api_user_id]['items']['last_set'] == $zp_start) - { - return false; - } - else // continue to next set of items - { - return true; - } - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - unset($doc_citations); - unset($entries); - - } // FUNCTION: zp_get_items - - - - function zp_save_items ($wpdb, $api_user_id, $not_done=false) - { - if ($GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries'] > 0) - { - // Prepare query strings - $zp_relItemColl = ""; - $zp_relItemTags = ""; - - // Determine item-collection and item-tag relationships with JSON - for ( $i = 3; $i < count($GLOBALS['zp_session'][$api_user_id]['items']['query_params']); $i += 14 ) - { - $i_json = json_decode($GLOBALS['zp_session'][$api_user_id]['items']['query_params'][$i]); - - if ( isset($i_json->collections) && count($i_json->collections) > 0 ) - foreach ( $i_json->collections as $i_collection ) - $zp_relItemColl .= "('" . $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][$i-3] . "', '" . $i_json->itemKey . "', '" . htmlentities($i_collection, ENT_QUOTES ) . "'), "; - - if ( isset($i_json->tags) && count($i_json->tags) > 0 ) - foreach ( $i_json->tags as $i_tag ) - if ( trim($i_tag->tag) != "" ) - $zp_relItemTags .= "('" . $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][$i-3] . "', '" . $i_json->itemKey . "', '" . htmlentities(str_replace("&", "__and__", $i_tag->tag), ENT_QUOTES ) . "'), "; - } - - // Prepare string: remove extra comma and space OR set to blank if nothing to add - if ( strlen($zp_relItemColl) > 0 ) - { - $zp_relItemColl = "INSERT IGNORE INTO ".$wpdb->prefix."zotpress_zoteroRelItemColl - ( api_user_id, item_key, collection_key ) VALUES " . substr( $zp_relItemColl, 0, -2 ) . "; "; - } - - if ( strlen($zp_relItemTags) > 0 ) - { - $zp_relItemTags = "INSERT IGNORE INTO ".$wpdb->prefix."zotpress_zoteroRelItemTags - ( api_user_id, item_key, tag_title ) VALUES " . substr( $zp_relItemTags, 0, -2 ) . "; "; - } - - // Execute queries - if ( strlen($zp_relItemColl) > 0 ) $wpdb->query( $zp_relItemColl ); - if ( strlen($zp_relItemTags) > 0 ) $wpdb->query( $zp_relItemTags ); - $wpdb->query( - $wpdb->prepare( - " INSERT IGNORE INTO ".$wpdb->prefix."zotpress_zoteroItems - ( api_user_id, item_key, retrieved, json, author, zpdate, year, title, itemType, linkMode, citation, style, numchildren, parent ) - VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s )" . str_repeat(", ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s )", $GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries']-1) .";", - $GLOBALS['zp_session'][$api_user_id]['items']['query_params'] - ) - ); - - $wpdb->flush(); - } - /*if ($GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries'] > 0) - { - global $user_ID; - - for ($i = 0; $i <= ($GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries'] - 1); $i++ ) - { - $mod = $i * 14; - - $post_id = wp_insert_post(array( - 'post_title' => $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][7+$mod], - 'post_content' => $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][10+$mod], - 'post_status' => 'publish', - 'post_date' => date('Y-m-d H:i:s'), - 'post_author' => $user_ID, - 'post_type' => 'zp_entry' - )); - - update_post_meta($post_id, 'api_user_id', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][0+$mod]); - update_post_meta($post_id, 'item_key', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][1+$mod]); - update_post_meta($post_id, 'retrieved', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][2+$mod]); - update_post_meta($post_id, 'json_content', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][3+$mod]); - update_post_meta($post_id, 'author', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][4+$mod]); - update_post_meta($post_id, 'date', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][5+$mod]); - update_post_meta($post_id, 'year', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][6+$mod]); - update_post_meta($post_id, 'item_type', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][8+$mod]); - update_post_meta($post_id, 'link_mode', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][9+$mod]); - update_post_meta($post_id, 'style', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][11+$mod]); - update_post_meta($post_id, 'numchildren', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][12+$mod]); - update_post_meta($post_id, 'parent', $GLOBALS['zp_session'][$api_user_id]['items']['query_params'][13+$mod]); - } - }*/ - - if ($not_done) // reset everything - { - $GLOBALS['zp_session'][$api_user_id]['items']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['items']['query_total_entries'] = 0; - } - else // unset everything - { - unset($GLOBALS['zp_session'][$api_user_id]['items']); - } - } - - - - /**************************************************************************************** - * - * ZOTPRESS IMPORT COLLECTIONS - * - ****************************************************************************************/ - - function zp_get_collections ($wpdb, $api_user_id, $zp_start, $toplevel=false, $zp_collection=false, $zp_single=false) - { - $zp_import_contents = new ZotpressRequest(); - $zp_account = zp_get_account($wpdb, $api_user_id); - $zp_collection_keys = ""; - - // Build request URL - if ( $toplevel === true ) $toplevel = '/top'; else $toplevel = ''; - if ( $zp_single ) $zp_single = '/'.$zp_single; else $zp_single = ''; - if ( $zp_collection ) $zp_collection = '/'.$zp_collection.'/collections'; else $zp_collection = ''; - - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/collections".$toplevel.$zp_collection.$zp_single."?"; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") $zp_import_url .= "key=".$zp_account[0]->public_key."&"; - $zp_import_url .= "limit=50&start=".$zp_start; - - // Grab contents - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - // Report any errors returned from Zotero - if ( trim(strtolower($zp_xml)) == "forbidden" ) - { - return "Zotero is telling Zotpress that access is forbidden. Are you sure that the Zotero API key you're using for this account is correct?"; - } - - // Make it DOM-traversable - $doc_citations = new DOMDocument(); - $doc_citations->loadXML($zp_xml); - - - // Get last set - if (!isset($GLOBALS['zp_session'][$api_user_id]['collections']['last_set']) ) - { - $last_set = ""; - $links = $doc_citations->getElementsByTagName("link"); - - foreach ($links as $link) - { - if ($link->getAttribute('rel') == "last") - { - if (stripos($link->getAttribute('href'), "start=") !== false) - { - $last_set = explode("start=", $link->getAttribute('href')); - $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] = intval($last_set[1]); - } - else - { - $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] = 0; - } - } - } - } - - - - // GET COLLECTION META - - $entries = $doc_citations->getElementsByTagName("entry"); - - foreach ($entries as $entry) - { - $title = $entry->getElementsByTagName("title")->item(0)->nodeValue; - $retrieved = $entry->getElementsByTagName("updated")->item(0)->nodeValue; - $parent = ""; - - // Get parent collection - foreach($entry->getElementsByTagName("link") as $link) - { - if ($link->attributes->getNamedItem("rel")->nodeValue == "up") - { - $parent_temp = explode("/", $link->attributes->getNamedItem("href")->nodeValue); - $parent = $parent_temp[count($parent_temp)-1]; - } - } - - $item_key = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "key")->item(0)->nodeValue; - $numCollections = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numCollections")->item(0)->nodeValue; - $numItems = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numItems")->item(0)->nodeValue; - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - - - - // GET LIST OF ITEM KEYS - now dealt with in Items import -// $zp_import_contents = new ZotpressRequest(); -// -// // Build request URL -// $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/collections/".$item_key."/items?format=keys"; -// if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") $zp_import_url .= "&key=".$zp_account[0]->public_key; -// -// // Import item keys -// $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); -// -// $zp_collection_itemkeys = rtrim(str_replace("\n", ",", $zp_xml), ","); -// -// unset($zp_import_contents); -// unset($zp_import_url); -// unset($zp_xml); - - - - // Prep for insert into db - array_push($GLOBALS['zp_session'][$api_user_id]['collections']['query_params'], - $zp_account[0]->api_user_id, - zp_db_prep($title), - zp_db_prep($retrieved), - zp_db_prep($parent), - $item_key, - $numCollections, - $numItems - ); - - $zp_collection_keys .= $item_key . ","; - - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries']++; - - unset($title); - unset($retrieved); - unset($parent); - unset($item_key); - unset($numCollections); - unset($numItems); - //unset($zp_collection_itemkeys); - - } // entry - - - // LAST SET - if ( - isset($GLOBALS['zp_session'][$api_user_id]['collections']['last_set']) - && $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] == $zp_start - ) - { - return array( "continue" => false, "collections" => rtrim( $zp_collection_keys, "," ) ); - } - else // continue to next set of collections - { - return array( "continue" => true, "collections" => rtrim( $zp_collection_keys, "," ) ); - } - - unset($doc_citations); - unset($entries); - - } // FUNCTION: zp_get_collections - - - - function zp_save_collections ($wpdb, $api_user_id, $not_done=false, $selective=false) - { - if ($GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] > 0) - { - $wpdb->query( $wpdb->prepare( - " - INSERT INTO ".$wpdb->prefix."zotpress_zoteroCollections - ( api_user_id, title, retrieved, parent, item_key, numCollections, numItems ) - VALUES ( %s, %s, %s, %s, %s, %d, %d )".str_repeat(", ( %s, %s, %s, %s, %s, %d, %d )", $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries']-1), - $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'] - ) ); - - $wpdb->flush(); - } - /*if ($GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] > 0) - { - for ($i = 0; $i <= ($GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] - 1); $i++ ) - { - $mod = $i * 8; - - $collection_id = get_term_by( "name", $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][1+$mod], 'zp_collections', 'ARRAY_A' ); - if ( $collection_id === false ) $collection_id = wp_insert_term( $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][1+$mod], 'zp_collections', array( 'description' => $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][4+$mod] ) ); // description is collection key - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-api_user_id' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-api_user_id' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-api_user_id', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][0+$mod], '', false ); - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-retrieved' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-retrieved' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-retrieved', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][2+$mod], '', false ); - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-parent' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-parent' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-parent', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][3+$mod], '', false ); - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-item_key' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-item_key' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-item_key', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][4+$mod], '', false ); - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-numCollections' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-numCollections' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-numCollections', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][5+$mod], '', false ); - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-numItems' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-numItems' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-numItems', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][6+$mod], '', false ); - - if ( get_option( 'zp_collection-'.$collection_id['term_id'].'-items' ) ) delete_option( 'zp_collection-'.$collection_id['term_id'].'-items' ); - add_option( 'zp_collection-'.$collection_id['term_id'].'-items', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][7+$mod], '', false ); - - // Link collections to entries - if ( trim($GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][7+$mod]) != "" ) - { - foreach ( explode(',', $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][7+$mod]) as $zp_entry ) - { - $zp_entry = get_posts( array( 'meta_key' => 'item_key', 'meta_value' => $zp_entry, 'post_type' => 'zp_entry' ) ); - wp_set_object_terms( $zp_entry[0]->ID, $collection_id['term_id'], 'zp_collections' ); - } - } - } - }*/ - - if (!$selective) - { - if ($not_done) // reset everything - { - $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_entries'] = 0; - } - else // unset everything - { - unset($GLOBALS['zp_session'][$api_user_id]['collections']); - } - } - } - - - - /*function zp_link_collections ($wpdb, $api_user_id) - { - delete_option('zp_collections_children'); - $collection_terms = get_terms( 'zp_collections', array( 'hide_empty' => false ) ); - - // Find parent, if exists - foreach ($collection_terms as $collection_term) - { - if ( strlen(trim(get_option( 'zp_collection-'.$collection_term->term_id.'-parent' ))) > 0 ) - { - foreach ($collection_terms as $collection_term_parent) - { - if ( get_option( 'zp_collection-'.$collection_term_parent->term_id.'-item_key' ) == - get_option( 'zp_collection-'.$collection_term->term_id.'-parent' ) ) - { - wp_update_term( $collection_term->term_id, 'zp_collections', - array( - 'parent' => $collection_term_parent->term_id - ) - ); - } - } - } - } - }*/ - - - - /**************************************************************************************** - * - * ZOTPRESS IMPORT TAGS - * - ****************************************************************************************/ - - function zp_get_tags ($wpdb, $api_user_id, $zp_start, $zp_collection=false) - { - $zp_import_contents = new ZotpressRequest(); - $zp_account = zp_get_account($wpdb, $api_user_id); - - // Get import url - if ( $zp_collection ) $zp_collection = '/collections/'.$zp_collection; else $zp_collection = ''; - - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id.$zp_collection."/tags?limit=50&start=".$zp_start; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") - $zp_import_url .= "&key=".$zp_account[0]->public_key; - - // Import content - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - // Report any errors returned from Zotero - if ( trim(strtolower($zp_xml)) == "forbidden" ) - { - return "Zotero is telling Zotpress that access is forbidden. Are you sure that the Zotero API key you're using for this account is correct?"; - } - - // Make it DOM-traversable - $doc_citations = new DOMDocument(); - $doc_citations->loadXML($zp_xml); - - - // Get last set - if (!isset($GLOBALS['zp_session'][$api_user_id]['tags']['last_set'])) - { - $last_set = ""; - $links = $doc_citations->getElementsByTagName("link"); - - foreach ($links as $link) - { - if ($link->getAttribute('rel') == "last") - { - if (stripos($link->getAttribute('href'), "start=") !== false) - { - $last_set = explode("start=", $link->getAttribute('href')); - $GLOBALS['zp_session'][$api_user_id]['tags']['last_set'] = intval($last_set[1]); - } - else - { - $GLOBALS['zp_session'][$api_user_id]['tags']['last_set'] = 0; - } - } - } - } - - - // PREPARE EACH ENTRY FOR DB INSERT - - $entries = $doc_citations->getElementsByTagName("entry"); - - foreach ($entries as $entry) - { - $title = str_replace("&", "__and__", $entry->getElementsByTagName("title")->item(0)->nodeValue); - $retrieved = $entry->getElementsByTagName("updated")->item(0)->nodeValue; - $numItems = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numItems")->item(0)->nodeValue; - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - - - // GET LIST OF ITEM KEYS - now handled in Items import -// $zp_import_contents = new ZotpressRequest(); -// -// $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/tags/".urlencode($title)."/items?format=keys"; -// if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") -// $zp_import_url .= "&key=".$zp_account[0]->public_key; -// -// // Import content -// $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); -// -// $zp_tag_itemkeys = rtrim(str_replace("\n", ",", $zp_xml), ","); -// -// unset($zp_import_contents); -// unset($zp_import_url); -// unset($zp_xml); - - - // Prep for insert into db - array_push($GLOBALS['zp_session'][$api_user_id]['tags']['query_params'], - $zp_account[0]->api_user_id, - zp_db_prep($title), - zp_db_prep($retrieved), - $numItems - ); - - $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries']++; - - unset($title); - unset($retrieved); - unset($numItems); - //unset($zp_tag_itemkeys); - - } // entry - - - // LAST SET - if ($GLOBALS['zp_session'][$api_user_id]['tags']['last_set'] == $zp_start) - { - return false; - } - else // continue to next set of collections - { - return true; - } - - unset($entries); - unset($doc_citations); - - } // FUNCTION: zp_get_tags - - - - function zp_save_tags ($wpdb, $api_user_id, $not_done=false) - { - if ($GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries'] > 0) - { - $wpdb->query( $wpdb->prepare( - " - INSERT INTO ".$wpdb->prefix."zotpress_zoteroTags - ( api_user_id, title, retrieved, numItems ) - VALUES ( %s, %s, %s, %d )".str_repeat(", ( %s, %s, %s, %d )", $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries']-1) ." - ON DUPLICATE KEY UPDATE - api_user_id = VALUES(api_user_id), - title = VALUES(title), - retrieved = VALUES(retrieved), - numItems = VALUES(numItems) - ", - $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'] - ) ); - - $wpdb->flush(); - } - /*if ($GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries'] > 0) - { - for ($i = 0; $i <= ($GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries'] - 1); $i++ ) - { - $mod = $i * 5; - - $tag_id = get_term_by( "name", $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][1+$mod], 'zp_tags', 'ARRAY_A' ); - if ( $tag_id === false ) $tag_id = wp_insert_term( $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][1+$mod], 'zp_tags', array( 'description' => $GLOBALS['zp_session'][$api_user_id]['collections']['query_params'][4+$mod] ) ); // description is list of items (note: different from collections, where description is collection key) - - if ( get_option( 'zp_tag-'.$tag_id['term_id'].'-api_user_id' ) ) delete_option( 'zp_tag-'.$tag_id['term_id'].'-api_user_id' ); - add_option( 'zp_tag-'.$tag_id['term_id'].'-api_user_id', $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][0+$mod], '', false ); - - if ( get_option( 'zp_tag-'.$tag_id['term_id'].'-retrieved' ) ) delete_option( 'zp_tag-'.$tag_id['term_id'].'-retrieved' ); - add_option( 'zp_tag-'.$tag_id['term_id'].'-retrieved', $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][2+$mod], '', false ); - - //if ( get_option( 'zp_tag-'.$tag_id['term_id'].'-numItems' ) ) delete_option( 'zp_tag-'.$tag_id['term_id'].'-numItems' ); - //add_option( 'zp_tag-'.$tag_id['term_id'].'-numItems', $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][3+$mod], '', false ); - - if ( get_option( 'zp_tag-'.$tag_id['term_id'].'-items' ) ) delete_option( 'zp_tag-'.$tag_id['term_id'].'-items' ); - add_option( 'zp_tag-'.$tag_id['term_id'].'-items', $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][4+$mod], '', false ); - - // Link tags to entries - if ( trim($GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][4+$mod]) != "" ) - { - foreach ( explode(',', $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'][4+$mod]) as $zp_entry ) - { - $zp_entry = get_posts( array( 'meta_key' => 'item_key', 'meta_value' => $zp_entry, 'post_type' => 'zp_entry' ) ); - wp_set_object_terms( $zp_entry[0]->ID, $tag_id['term_id'], 'zp_tags', true ); - } - } - } - }*/ - - if ($not_done) // reset everything - { - $GLOBALS['zp_session'][$api_user_id]['tags']['query_params'] = array(); - $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_entries'] = 0; - } - else // unset everything - { - unset($GLOBALS['zp_session'][$api_user_id]['tags']); - } - } - - - -?> \ No newline at end of file diff --git a/lib/import/import.iframe.php b/lib/import/import.iframe.php deleted file mode 100644 index c6641ba..0000000 --- a/lib/import/import.iframe.php +++ /dev/null @@ -1,470 +0,0 @@ - 403 ) ); - - -/* -* IMPORT PSEUDOCODE: -* -* Get list of all item keys -* Import items in sets of 50 -* Import categories in sets of 50 -* Get list of all item keys for each tag -* Import tags in sets of 50 -* Get list of all item keys for each tag -* -* Requests to Zotero given 100 of each: -* 1 + 2 + 2 + 100 + 2 + 100 = 207 -* -*/ - -if ( isset($_GET['go']) && $_GET['go'] == "true" - && check_admin_referer( 'zp_importing_' . intval($_GET['api_user_id']) . '_' . date('Y-j-G'), 'zp_nonce' ) ) -{ - // Access WordPress db - global $wpdb; - - // Ignore user abort - ignore_user_abort(true); - set_time_limit(60*10); // ten minutes - - // Include Request Functionality - require( dirname(__FILE__) . '/../request/rss.request.php' ); - - // Include Import Functions - require( dirname(__FILE__) . '/import.functions.php' ); - - - ?> - - - - - Importing - - - - - ID, 'zotpress_5_2_ignore_notice') ) - add_user_meta($current_user->ID, 'zotpress_5_2_ignore_notice', 'true', true); - - ?> - - - \ No newline at end of file diff --git a/lib/import/import.php b/lib/import/import.php deleted file mode 100644 index 12003d7..0000000 --- a/lib/import/import.php +++ /dev/null @@ -1,55 +0,0 @@ -get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'", OBJECT); - -?> - -
- - - -
- - get_row("SELECT nickname FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'", OBJECT); - ?> -

Import nickname) > 0) { echo $temp->nickname; } else { echo $api_user_id; }?>'s Library

- -

Import Zotero Library

- - -
- -

- The importing process might take a few minutes, depending on what you choose to import and the size of your Zotero library. -

- -
- - - - - -
-
-
Importing items 1-50 ...
-
-
- -
- - - - - -
- -
- - \ No newline at end of file diff --git a/lib/import/import.selective.php b/lib/import/import.selective.php deleted file mode 100644 index bc17621..0000000 --- a/lib/import/import.selective.php +++ /dev/null @@ -1,54 +0,0 @@ -get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'", OBJECT); - -?> - -
- - - -
- -

Selective Import

-

nickname) > 0) { echo $api_user_id_data->nickname; } else { echo $api_user_id; }?>'s Library

- -
- -

- You can selectively import top-level collections (which includes their items, subcollections, and subcollection items) below. You may need to wait a few moments if you have several top-level collections. -

- -
- -
- - - -
-
-
Importing selected collection(s) ...
-
- -
- - - - - -
- -
- - \ No newline at end of file diff --git a/lib/import/sync.functions.php b/lib/import/sync.functions.php deleted file mode 100644 index 4c26537..0000000 --- a/lib/import/sync.functions.php +++ /dev/null @@ -1,864 +0,0 @@ - 403 ) ); - - - /**************************************************************************************** - * - * ZOTPRESS BASIC SYNC FUNCTIONS - * - ****************************************************************************************/ - - function zp_autoupdate() - { - // Get interval - $zp_default_autoupdate = "weekly"; - if (get_option("Zotpress_DefaultAutoUpdate")) - $zp_default_autoupdate = get_option("Zotpress_DefaultAutoUpdate"); - - // Get last update date - $zp_last_autoupdate = date('Y-m-d-'); - if (get_option("Zotpress_LastAutoUpdate")) - $zp_last_autoupdate= get_option("Zotpress_LastAutoUpdate"); - - // Find difference - $diff_in_days = intval( floor((strtotime(date('Y-m-d')) - strtotime($zp_last_autoupdate))/3600/24) ); - - $to_update_or_not = false; - - // Determine whether to update - if (($zp_default_autoupdate == "weekly" && $diff_in_days > 7) || - ($zp_default_autoupdate == "daily" && $diff_in_days > 1)) - $to_update_or_not = true; - - return $to_update_or_not; - } - - - - /**************************************************************************************** - * - * ZOTPRESS SYNC ITEMS - * - ****************************************************************************************/ - - function zp_get_local_items ($wpdb, $api_user_id) - { - $query = "SELECT * FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$api_user_id."'"; - - $results = $wpdb->get_results( $query, OBJECT ); - $items = array(); - - // Set item key as id, updated to false - foreach ($results as $item) { - $item->updated = 0; - $items[$item->item_key] = $item; - } - - unset($results); - return $items; - } - - - - function zp_get_server_items ($wpdb, $api_user_id, $zp_start) - { - $zp_import_contents = new ZotpressRequest(); - $zp_account = zp_get_account($wpdb, $api_user_id); - //$zp_account = $GLOBALS['zp_session'][$api_user_id]['zp_account']; - - - // See if default exists - $zp_default_style = "apa"; - if (get_option("Zotpress_DefaultStyle")) - $zp_default_style = get_option("Zotpress_DefaultStyle"); - - // Build request URL - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$api_user_id."/items?"; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") - $zp_import_url .= "key=".$zp_account[0]->public_key."&"; - $zp_import_url .= "format=atom&content=json,bib&style=".$zp_default_style."&limit=50&start=".$zp_start; - //var_dump($zp_import_url); - - // Read the external data - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - // Stop in our tracks if there's a request error - if ($zp_import_contents->request_error) - return $zp_import_contents->request_error; - - // Make it DOM-traversable - $doc_citations = new DOMDocument(); - $doc_citations->loadXML($zp_xml); - - // Get last set - if (!isset($GLOBALS['zp_session'][$api_user_id]['items']['last_set'])) - { - $last_set = ""; - $links = $doc_citations->getElementsByTagName("link"); - - foreach ($links as $link) - { - if ($link->getAttribute('rel') == "last") - { - if (stripos($link->getAttribute('href'), "start=") !== false) - { - $last_set = explode("start=", $link->getAttribute('href')); - $GLOBALS['zp_session'][$api_user_id]['items']['last_set'] = intval($last_set[1]); - } - else - { - $GLOBALS['zp_session'][$api_user_id]['items']['last_set'] = 0; - } - } - } - } - - $entries = $doc_citations->getElementsByTagName("entry"); - - - // COMPARE EACH ENTRY TO LOCAL - // Entries can be items or attachments (e.g. notes) - - foreach ($entries as $entry) - { - $item_key = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "key")->item(0)->nodeValue; - $retrieved = $entry->getElementsByTagName("updated")->item(0)->nodeValue; - - // Check to see if item key exists in local - if (array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'] )) - { - // Check to see if it needs updating - if ($retrieved != $GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'][$item_key]->retrieved) - { - $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update'][$item_key] = $GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'][$item_key]->id; - //unset($GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'][$item_key]); // Leave only the local ones that should be deleted - update_option('ZOTPRESS_DELETE_'.$api_user_id, get_option('ZOTPRESS_DELETE_'.$api_user_id) . "," . $item_key); - } - else // ignore - { - //unset($GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'][$item_key]); // Leave only the local ones that should be deleted - update_option('ZOTPRESS_DELETE_'.$api_user_id, get_option('ZOTPRESS_DELETE_'.$api_user_id) . "," . $item_key); - continue; - } - } - - // Item key doesn't exist in local, or needs updating, so collect metadata and add - $item_type = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "itemType")->item(0)->nodeValue; - - // Get citation content (json and bib) - - $citation_content = ""; - $citation_content_temp = new DOMDocument(); - - foreach($entry->getElementsByTagNameNS("http://zotero.org/ns/api", "subcontent") as $child) - { - if ($child->attributes->getNamedItem("type")->nodeValue == "json") - { - $json_content = $child->nodeValue; - } - else // Styled citation - { - foreach($child->childNodes as $child_content) { - $citation_content_temp->appendChild($citation_content_temp->importNode($child_content, true)); - $citation_content = $citation_content_temp->saveHTML(); - } - } - } - - // Get basic metadata from JSON - $json_content_decoded = json_decode($json_content); - - $author = ""; - $author_other = ""; - $date = ""; - $year = ""; - $title = ""; - $numchildren = 0; - $parent = ""; - $link_mode = ""; - - if (count($json_content_decoded->creators) > 0) - foreach ( $json_content_decoded->creators as $creator ) - if ($creator->creatorType == "author") - $author .= $creator->lastName . ", "; - else - $author_other .= $creator->lastName . ", "; - else - $author .= $creator->creators["lastName"]; - - // Determine if we use author or other author type - if (trim($author) == "") - $author = $author_other; - - // Remove last comma - $author = preg_replace('~(.*)' . preg_quote(', ', '~') . '~', '$1' . '', $author, 1); - - $date = $json_content_decoded->date; - $year = zp_extract_year($date); - - if (trim($year) == "") - $year = "1977"; - - $title = $json_content_decoded->title; - - $numchildren = intval($entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numChildren")->item(0)->nodeValue); - - // DOWNLOAD: Find URL - if ($item_type == "attachment") - { - if (isset($json_content_decoded->linkMode)) - $link_mode = $json_content_decoded->linkMode; - } - - // PARENT - foreach($entry->getElementsByTagName("link") as $entry_link) - { - if ($entry_link->getAttribute('rel') == "up") { - $temp = explode("items/", $entry_link->getAttribute('href')); - $temp = explode("?", $temp[1]); - $parent = $temp[0]; - } - - // Get download URL - if ($link_mode == "imported_file" && $entry_link->getAttribute('rel') == "self") { - $citation_content = substr($entry_link->getAttribute('href'), 0, strpos($entry_link->getAttribute('href'), "?")); - } - } - - - // If item key needs updating - if (array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update'] )) - { - $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update'][$item_key] = array ( - "api_user_id" => $zp_account[0]->api_user_id, - "item_key" => $item_key, - "retrieved" => zp_db_prep($retrieved), - "json" => zp_db_prep($json_content), - "author" => zp_db_prep($author), - "zpdate" => zp_db_prep($date), - "year" => zp_db_prep($year), - "title" => zp_db_prep($title), - "itemType" => $item_type, - "linkMode" => $link_mode, - "citation" => zp_db_prep($citation_content), - "style" => zp_db_prep($zp_default_style), - "numchildren" => $numchildren, - "parent" => $parent); - } - // If item key isn't in local, add it - else if (!array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'] )) - { - array_push($GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_add'], - $zp_account[0]->api_user_id, - $item_key, - zp_db_prep($retrieved), - zp_db_prep($json_content), - zp_db_prep($author), - zp_db_prep($date), - zp_db_prep($year), - zp_db_prep($title), - $item_type, - $link_mode, - zp_db_prep($citation_content), - zp_db_prep($zp_default_style), - $numchildren, - $parent); - - $GLOBALS['zp_session'][$api_user_id]['items']['query_total_items_to_add']++; - } - - } // foreach entry - - // LAST ITEM - if ($GLOBALS['zp_session'][$api_user_id]['items']['last_set'] == $zp_start) - { - return false; - } - else // continue to next set of items - { - return true; - } - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - unset($doc_citations); - unset($entries); - - } // FUNCTION: zp_get_server_items - - - - function zp_save_synced_items ($wpdb, $api_user_id, $done=true) - { - // RUN QUERIES: UPDATE - - if (count($GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update']) > 0) - { - foreach ($GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update'] as $item_params) - { - $wpdb->update( - $wpdb->prefix.'zotpress_zoteroItems', - $item_params, - array( 'item_key' => $item_params["item_key"], 'api_user_id' => $item_params["api_user_id"] ), - array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%s' ), - array( '%s', '%s' ) - ); - } - - $wpdb->flush(); - } - - // ADD - if (count($GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_add']) > 0) - { - $wpdb->query( $wpdb->prepare( - " - INSERT INTO ".$wpdb->prefix."zotpress_zoteroItems - ( api_user_id, item_key, retrieved, json, author, zpdate, year, title, itemType, linkMode, citation, style, numchildren, parent ) - VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s )".str_repeat(", ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s )", $GLOBALS['zp_session'][$api_user_id]['items']['query_total_items_to_add']-1), - $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_add'] - ) ); - - $wpdb->flush(); - } - - // REMOVE: Only at the last set - - if ($done && count($GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items']) > 0) - { - $zp_delete_items = explode(",", get_option('ZOTPRESS_DELETE_'.$api_user_id)); - - foreach ($zp_delete_items as $item_params) - //foreach ($GLOBALS['zp_session'][$api_user_id]['items']['zp_local_items'] as $item_params) - { - $wpdb->query( $wpdb->prepare( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE item_key = %s - AND api_user_id = %s - ", - $item_params->item_key, $item_params->api_user_id - ) ); - } - - $wpdb->flush(); - } - - if ($done) // unset everything - { - unset($GLOBALS['zp_session'][$api_user_id]['items']); - } - else // reset add and update - { - $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_add'] = array(); - $GLOBALS['zp_session'][$api_user_id]['items']['zp_items_to_update'] = array(); - $GLOBALS['zp_session'][$api_user_id]['items']['query_total_items_to_add'] = 0; - } - - } // FUNCTION: zp_save_synced_items - - - - /**************************************************************************************** - * - * ZOTPRESS SYNC COLLECTIONS - * - ****************************************************************************************/ - - function zp_get_local_collections ($wpdb, $api_user_id) - { - $query = "SELECT * FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='".$api_user_id."'"; - - $results = $wpdb->get_results( $query, OBJECT ); - $items = array(); - - // Set item key as id, updated to false - foreach ($results as $item) { - $item->updated = 0; - $items[$item->item_key] = $item; - } - - unset($results); - return $items; - } - - - - function zp_get_server_collections ($wpdb, $api_user_id, $zp_start) - { - $zp_import_contents = new ZotpressRequest(); - $zp_account = zp_get_account($wpdb, $api_user_id); - //$zp_account = $GLOBALS['zp_session'][$api_user_id]['zp_account']; - - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/collections?limit=50&start=".$zp_start; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") - $zp_import_url .= "&key=".$zp_account[0]->public_key; - - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - - // Make it DOM-traversable - $doc_citations = new DOMDocument(); - $doc_citations->loadXML($zp_xml); - - // Get last set - if (!isset($GLOBALS['zp_session'][$api_user_id]['collections']['last_set'])) - { - $last_set = ""; - $links = $doc_citations->getElementsByTagName("link"); - - foreach ($links as $link) - { - if ($link->getAttribute('rel') == "last") - { - if (stripos($link->getAttribute('href'), "start=") !== false) - { - $last_set = explode("start=", $link->getAttribute('href')); - $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] = intval($last_set[1]); - } - else - { - $GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] = 0; - } - } - } - } - - - // PREPARE EACH ENTRY FOR DB INSERT - - $entries = $doc_citations->getElementsByTagName("entry"); - - foreach ($entries as $entry) - { - $item_key = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "key")->item(0)->nodeValue; - $retrieved = $entry->getElementsByTagName("updated")->item(0)->nodeValue; - - // Check to see if item key exists in local - if (array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'] )) - { - // Check to see if it needs updating - if ($retrieved != $GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'][$item_key]->retrieved) - { - $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update'][$item_key] = $GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'][$item_key]->id; - //unset($GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'][$item_key]); // Leave only the local ones that should be deleted - update_option('ZOTPRESS_DELETE_'.$api_user_id, get_option('ZOTPRESS_DELETE_'.$api_user_id) . "," . $item_key); - } - else // ignore - { - //unset($GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'][$item_key]); // Leave only the local ones that should be deleted - update_option('ZOTPRESS_DELETE_'.$api_user_id, get_option('ZOTPRESS_DELETE_'.$api_user_id) . "," . $item_key); - continue; - } - } - - $title = $entry->getElementsByTagName("title")->item(0)->nodeValue; - $parent = ""; - - // Get parent collection - foreach($entry->getElementsByTagName("link") as $link) - { - if ($link->attributes->getNamedItem("rel")->nodeValue == "up") - { - $parent_temp = explode("/", $link->attributes->getNamedItem("href")->nodeValue); - $parent = $parent_temp[count($parent_temp)-1]; - } - } - - $numCollections = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numCollections")->item(0)->nodeValue; - $numItems = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numItems")->item(0)->nodeValue; - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - - - - // GET LIST OF ITEM KEYS - $zp_import_contents = new ZotpressRequest(); - - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/collections/".$item_key."/items?format=keys"; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") - $zp_import_url .= "&key=".$zp_account[0]->public_key; - - // Import content - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - $zp_collection_itemkeys = rtrim(str_replace("\n", ",", $zp_xml), ","); - - - - // If item key needs updating - if (array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update'] )) - { - $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update'][$item_key] = array ( - "api_user_id" => $zp_account[0]->api_user_id, - "title" => zp_db_prep($title), - "retrieved" => zp_db_prep($retrieved), - "parent" => $parent, - "item_key" => $item_key, - "numCollections" => $numCollections, - "numItems" => $numItems, - "listItems" => zp_db_prep($zp_collection_itemkeys) - ); - } - // If item key isn't in local, add it - else if (!array_key_exists( $item_key, $GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'] )) - { - array_push($GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_add'], - $zp_account[0]->api_user_id, - zp_db_prep($title), - zp_db_prep($retrieved), - $parent, - $item_key, - $numCollections, - $numItems, - zp_db_prep($zp_collection_itemkeys) - ); - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_collections_to_add']++; - } - - unset($title); - unset($retrieved); - unset($parent); - unset($item_key); - unset($numCollections); - unset($numItems); - unset($zp_collection_itemkeys); - - } // entry - - - // LAST SET - if ($GLOBALS['zp_session'][$api_user_id]['collections']['last_set'] == $zp_start) - { - return false; - } - else // continue to next set of collections - { - return true; - } - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - unset($doc_citations); - unset($entries); - - } // FUNCTION: zp_get_server_collections - - - - function zp_save_synced_collections ($wpdb, $api_user_id, $done=true) - { - // RUN QUERIES: UPDATE - - if (count($GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update']) > 0) - { - foreach ($GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update'] as $item_params) - { - $wpdb->update( - $wpdb->prefix.'zotpress_zoteroCollections', - $item_params, - array( 'item_key' => $item_params["item_key"], 'api_user_id' => $item_params["api_user_id"] ), - array( '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s' ), - array( '%s', '%s' ) - ); - } - - $wpdb->flush(); - } - - // ADD - - if (count($GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_add']) > 0) - { - $wpdb->query( $wpdb->prepare( - " - INSERT INTO ".$wpdb->prefix."zotpress_zoteroCollections - ( api_user_id, title, retrieved, parent, item_key, numCollections, numItems, listItems ) - VALUES ( %s, %s, %s, %s, %s, %d, %d, %s )".str_repeat(", ( %s, %s, %s, %s, %s, %d, %d, %s )", $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_collections_to_add']-1), - $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_add'] - ) ); - - $wpdb->flush(); - } - - // REMOVE - - if ($done && count($GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections']) > 0) - { - $zp_delete_items = explode(",", get_option('ZOTPRESS_DELETE_'.$api_user_id)); - - foreach ($zp_delete_items as $item_params) - //foreach ($GLOBALS['zp_session'][$api_user_id]['collections']['zp_local_collections'] as $item_params) - { - $wpdb->query( $wpdb->prepare( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroCollections - WHERE item_key = %s - AND api_user_id = %s - ", - $item_params->item_key, $item_params->api_user_id - ) ); - } - - $wpdb->flush(); - } - - if ($done) // unset everything - { - unset($GLOBALS['zp_session'][$api_user_id]['collections']); - } - else // reset add and update - { - $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_update'] = array(); - $GLOBALS['zp_session'][$api_user_id]['collections']['zp_collections_to_add'] = array(); - $GLOBALS['zp_session'][$api_user_id]['collections']['query_total_collections_to_add'] = 0; - } - - } // FUNCTION: zp_save_synced_collections - - - - /**************************************************************************************** - * - * ZOTPRESS SYNC TAGS - * - ****************************************************************************************/ - - function zp_get_local_tags ($wpdb, $api_user_id) - { - $query = "SELECT * FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE api_user_id='".$api_user_id."'"; - - $results = $wpdb->get_results( $query, OBJECT ); - $items = array(); - - // Set title as id, updated to false - foreach ($results as $item) { - $item->updated = 0; - $items[($item->title)] = $item; - } - - unset($results); - return $items; - } - - - - function zp_get_server_tags ($wpdb, $api_user_id, $zp_start) - { - $zp_import_contents = new ZotpressRequest(); - $zp_account = zp_get_account($wpdb, $api_user_id); - //$zp_account = $GLOBALS['zp_session'][$api_user_id]['zp_account']; - - // Build request URL - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/tags?limit=50&start=".$zp_start; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") - $zp_import_url .= "&key=".$zp_account[0]->public_key; - - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - // Make it DOM-traversable - $doc_citations = new DOMDocument(); - $doc_citations->loadXML($zp_xml); - - // Get last set - if (!isset($GLOBALS['zp_session'][$api_user_id]['tags']['last_set'])) - { - $last_set = ""; - $links = $doc_citations->getElementsByTagName("link"); - - foreach ($links as $link) - { - if ($link->getAttribute('rel') == "last") - { - if (stripos($link->getAttribute('href'), "start=") !== false) - { - $last_set = explode("start=", $link->getAttribute('href')); - $GLOBALS['zp_session'][$api_user_id]['tags']['last_set'] = intval($last_set[1]); - } - else - { - $GLOBALS['zp_session'][$api_user_id]['tags']['last_set'] = 0; - } - } - } - } - - $entries = $doc_citations->getElementsByTagName("entry"); - - foreach ($entries as $entry) - { - $title = $entry->getElementsByTagName("title")->item(0)->nodeValue; - $retrieved = $entry->getElementsByTagName("updated")->item(0)->nodeValue; - - // Check to see if tags exists in local - if (array_key_exists( trim($title), $GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'] )) - { - // Check to see if it needs updating - if ($retrieved != $GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'][trim($title)]->retrieved) - { - $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update'][trim($title)] = $GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'][trim($title)]->id; - //unset($GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'][trim($title)]); // Leave only the local ones that should be deleted - update_option('ZOTPRESS_DELETE_'.$api_user_id, get_option('ZOTPRESS_DELETE_'.$api_user_id) . "," . $item_key); - } - else // ignore - { - //unset($GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'][trim($title)]); // Leave only the local ones that should be deleted - update_option('ZOTPRESS_DELETE_'.$api_user_id, get_option('ZOTPRESS_DELETE_'.$api_user_id) . "," . $item_key); - continue; - } - } - - $numItems = $entry->getElementsByTagNameNS("http://zotero.org/ns/api", "numItems")->item(0)->nodeValue; - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - - - - // GET LIST OF ITEM KEYS - $zp_import_contents = new ZotpressRequest(); - - $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/tags/".urlencode($title)."/items?format=keys"; - if (is_null($zp_account[0]->public_key) === false && trim($zp_account[0]->public_key) != "") - $zp_import_url .= "&key=".$zp_account[0]->public_key; - - // Import content - $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, false ); - - $zp_tag_itemkeys = rtrim(str_replace("\n", ",", $zp_xml), ","); - - - - // If item key needs updating - if (array_key_exists( trim($title), $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update'] )) - { - $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update'][trim($title)] = array ( - "api_user_id" => $zp_account[0]->api_user_id, - "title" => zp_db_prep($title), - "retrieved" => zp_db_prep($retrieved), - "numItems" => $numItems, - "listItems" => zp_db_prep($zp_tag_itemkeys) - ); - } - // If item key isn't in local, add it - else if (!array_key_exists( trim($title), $GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'] )) - { - array_push($GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_add'], - $zp_account[0]->api_user_id, - zp_db_prep($title), - zp_db_prep($retrieved), - $numItems, - zp_db_prep($zp_tag_itemkeys) - ); - $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_tags_to_add']++; - } - - unset($title); - unset($retrieved); - unset($numItems); - unset($zp_tag_itemkeys); - - } // entry - - - // LAST SET - if ($GLOBALS['zp_session'][$api_user_id]['tags']['last_set'] == $zp_start) - { - return false; - } - else // continue to next set of tags - { - return true; - } - - unset($zp_import_contents); - unset($zp_import_url); - unset($zp_xml); - unset($doc_citations); - unset($entries); - - } // FUNCTION: zp_get_server_tags - - - - function zp_save_synced_tags ($wpdb, $api_user_id, $done=true) - { - // RUN QUERIES: UPDATE - - if (count($GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update']) > 0) - { - foreach ($GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update'] as $item_params) - { - $wpdb->update( - $wpdb->prefix.'zotpress_zoteroTags', - $item_params, - array( 'title' => trim($item_params["title"]), 'api_user_id' => $item_params["api_user_id"] ), - array( '%s', '%s', '%s', '%d', '%s' ), - array( '%s', '%s' ) - ); - } - - $wpdb->flush(); - } - - // ADD - - if (count($GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_add']) > 0) - { - $wpdb->query( $wpdb->prepare( - " - INSERT INTO ".$wpdb->prefix."zotpress_zoteroTags - ( api_user_id, title, retrieved, numItems, listItems ) - VALUES ( %s, %s, %s, %d, %s )".str_repeat(", ( %s, %s, %s, %d, %s )", $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_tags_to_add']-1), - $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_add'] - ) ); - - $wpdb->flush(); - } - - // REMOVE - - if ($done && count($GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags']) > 0) - { - $zp_delete_items = explode(",", get_option('ZOTPRESS_DELETE_'.$api_user_id)); - - foreach ($zp_delete_items as $item_params) - //foreach ($GLOBALS['zp_session'][$api_user_id]['tags']['zp_local_tags'] as $item_params) - { - $wpdb->query( $wpdb->prepare( - " - DELETE FROM ".$wpdb->prefix."zotpress_zoteroTags - WHERE title = %s - AND api_user_id = %s - ", - trim($item_params->title), $item_params->api_user_id - ) ); - } - - $wpdb->flush(); - } - - if ($done) // unset everything - { - unset($GLOBALS['zp_session'][$api_user_id]['tags']); - } - else // reset add and update - { - $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_update'] = array(); - $GLOBALS['zp_session'][$api_user_id]['tags']['zp_tags_to_add'] = array(); - $GLOBALS['zp_session'][$api_user_id]['tags']['query_total_tags_to_add'] = 0; - } - - } // FUNCTION: zp_save_synced_tags - - - -?> \ No newline at end of file diff --git a/lib/import/sync.php b/lib/import/sync.php deleted file mode 100644 index 5f0be27..0000000 --- a/lib/import/sync.php +++ /dev/null @@ -1,232 +0,0 @@ - 403 ) ); - - // Ignore user abort - ignore_user_abort(true); - set_time_limit(60*10); // ten minutes - - // Access WordPress db - global $wpdb; - - // Include Request Functionality - require("../request/rss.request.php"); - - // Include Import and Sync Functions - require("import.functions.php"); - require("sync.functions.php"); - - - -?> - - - - - Syncing - - - - - - - - \ No newline at end of file diff --git a/lib/request/request.cite.php b/lib/request/request.cite.php new file mode 100644 index 0000000..924cb5e --- /dev/null +++ b/lib/request/request.cite.php @@ -0,0 +1,62 @@ +account_type."/".$zp_api_user_id."/items/".$zp_item_key."?format=ris&key=".$zp_account[0]->public_key; + + // Read the external data + $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, true, 'ris' ); + + if ( $zp_xml !== false + && strlen(trim($zp_xml["json"])) > 0 ) + { + header('Content-Type: application/x-research-info-systems'); + header('Content-Disposition: attachment; filename="itemkey-'.$zp_item_key.'.ris"'); + header('Content-Description: Cite with RIS'); + echo $zp_xml["json"]; + } + else + { + echo "No RIS file found."; + } + } + else + { + echo $zp_xml; + } +?> diff --git a/lib/request/request.class.php b/lib/request/request.class.php new file mode 100644 index 0000000..ef79de6 --- /dev/null +++ b/lib/request/request.class.php @@ -0,0 +1,418 @@ +update = $update; + + if ( $request_type != 'item' ) + $this->request_type = $request_type; + + // Get and set api user id + $divider = "users/"; + if ( strpos( $url, "groups" ) !== false ) + $divider = "groups/"; + $temp1 = explode( $divider, $url ); + $temp2 = explode( "/", $temp1[1] ); + $this->api_user_id = $temp2[0]; + } + + + // NOTE: used by shortcode.request.php + function get_request_cache( $url, $update, $request_type = 'item' ) + { + $this->set_request_meta( $url, $update, $request_type ); + + $data = $this->check_and_get_cache( $url ); + + // Check for request errors + if ( $this->request_error !== false ) + return 'Error: ' . $this->request_error; // exit(); + else // Otherwise, return the data + return $data; + } + + + function get_request_contents( $url, $update, $request_type = 'item' ) + { + $this->set_request_meta( $url, $update, $request_type ); + + $data = $this->get_xml_data( $url ); + + // Check for request errors + if ( $this->request_error !== false ) + return 'Error: ' . $this->request_error; // exit(); + else // Otherwise, return the data + return $data; + } + + + // Limit Zotero request calls based on elapsed time + function checkTime( $last_time ) + { + // Set time zone based on WP installation + date_default_timezone_set( wp_timezone_string() ); + + // Set up the dates to compare + $last_time = date_create($last_time); + $now = date_create(); + + // OLD: + // $last_time = explode( " ", $last_time ); + // $last_time = strtotime( $last_time[1] ); + // $now = strtotime( date('h:i:s') ); + // if ( round(abs($now - $last_time) / 60,2) > 10 ) + + $timeElapsed = date_diff($last_time, $now); + + // Convert to total minutes difference + $timeElapsedMin = ( $timeElapsed->y * 525600 ) + + ( $timeElapsed->m * 43800 ) + + ( $timeElapsed->d * 1440 ) + + ( $timeElapsed->i ) + + ( $timeElapsed->s * 0.0166667 ); + + if ( $timeElapsedMin > $this->checkEveryMin ) + return true; + else // Not time yet + return false; + } + + + function check_and_get_cache( $url ) + { + global $wpdb; + + // First, check db to see if cached version exists + $zp_query = + " + SELECT DISTINCT ".$wpdb->prefix."zotpress_cache.* + FROM ".$wpdb->prefix."zotpress_cache + WHERE ".$wpdb->prefix."zotpress_cache.request_id = '".md5( $url )."' + AND ".$wpdb->prefix."zotpress_cache.api_user_id = '".$this->api_user_id."' + "; + $zp_results = $wpdb->get_results( $zp_query, OBJECT ); + unset($zp_query); + + if ( count($zp_results) != 0 ) + { + $json = $this->zp_gzdecode( $zp_results[0]->json ); + $tags = $this->zp_gzdecode( $zp_results[0]->tags ); + $headers = $zp_results[0]->headers; + } + + else // No cache + { + $json = json_encode( array('status' => 'No Cache') ); + $tags = false; + $headers = false; + } + + $wpdb->flush(); + + return array( "json" => $json, "tags" => $tags, "headers" => $headers ); + } + + + function get_xml_data( $url ) + { + global $wpdb; + + // Just want to check for cached version + if ( $this->update === false ) + { + // First, check db to see if cached version exists + $zp_results = eb_zotpress_get_cache(md5( $url ), $this->api_user_id); + + + // Cache exists + if ( count($zp_results) > 0 ) + { + $json = $this->zp_gzdecode($zp_results[0]->json); + $tags = $this->zp_gzdecode($zp_results[0]->tags); + $headers = $zp_results[0]->headers; + } + + else // No cached + { + $regular = $this->getRegular( $wpdb, $url ); + + $json = $regular['data']; + $tags = $regular['tags']; + $headers = $regular['headers']; + } + + } + + else // Normal or RIS + { + $regular = $this->getRegular( $wpdb, $url ); + + $json = $regular['data']; + $tags = $regular['tags']; + $headers = $regular['headers']; + } + + return array( "json" => $json, "tags" => $tags, "headers" => $headers ); + } + + + function getRegular( $wpdb, $url ) + { + // First, check db to see if cached version exists + $zp_results = eb_zotpress_get_cache(md5( $url ), $this->api_user_id); + + + // Then, if no cached version, proceed and save one. + // Or, if cached version exists, check to see if it's out of date, + // and return whichever is newer (and cache the newest). + // if ( count($zp_results) == 0 + // || ( property_exists($zp_results[0], 'retrieved') && $zp_results[0]->retrieved !== null + // && $this->checkTime($zp_results[0]->retrieved) ) ) + // { + if ( count($zp_results) == 0 + || ( isset($zp_results[0]->retrieved) + && $this->checkTime($zp_results[0]->retrieved) ) ) + { + $headers_arr = array ( "Zotero-API-Version" => "3" ); + + if ( count($zp_results) > 0 ) + $headers_arr["If-Modified-Since-Version"] = $zp_results[0]->libver; + + // Get response + $response = wp_remote_get( $url, array ( 'headers' => $headers_arr ) ); + + if ( is_wp_error($response) ) + $this->request_error = $response->get_error_message(); + else { + $headers = wp_remote_retrieve_headers($response); + $headers = $headers->getAll(); + $headers = json_encode($headers); + } + } + + if($this->request_error) { + return array( "data" => array(), "headers" => array() ); + } else { + // Proceed if no cached version or to check server for newer + if ( count($zp_results) == 0 + || ( isset($response["response"]["code"]) + && $response["response"]["code"] != "304" ) ) + { + // Deal with errors + if ( is_wp_error($response) + || ! isset($response['body']) ) + { + $this->request_error = $response->get_error_message(); + if ( $response->get_error_code() == "http_request_failed" ) + { + // Try again with less restrictions + add_filter('https_ssl_verify', '__return_false'); + $response = wp_remote_get( $url, array( 'headers' => array("Zotero-API-Version" => "2") ) ); + + if (is_wp_error($response) || ! isset($response['body'])) { + $this->request_error = $response->get_error_message(); + } elseif ($response == "An error occurred" || ( isset($response['body']) && $response['body'] == "An error occurred")) { + $this->request_error = "WordPress was unable to import from Zotero. This is likely caused by an incorrect citation style name. For example, 'mla' is now 'modern-language-association'. Use the name found in the style's URL at the Zotero Style Repository."; + } else // no errors this time + { + $this->request_error = false; + } + } + } + + elseif ( $response == "An error occurred" + || ( isset($response['body']) + && $response['body'] == "An error occurred") ) + { + $this->request_error = "WordPress was unable to import from Zotero. This is likely caused by an incorrect citation style name. For example, 'mla' is now 'modern-language-association'. Use the name found in the style's URL at the Zotero Style Repository."; + } + + // Then, get actual data + $data = wp_remote_retrieve_body( $response ); // Thanks to Trainsmart.com developer! + + // Make sure tags didn't return an error -- redo if so + if ( $data == "Tag not found" ) + { + $url_break = explode("/", $url); + $url = $url_break[0]."//".$url_break[2]."/".$url_break[3]."/".$url_break[4]."/".$url_break[7]; + $url = str_replace("=50", "=5", $url); + + $data = $this->get_xml_data( $url ); + } + + // Add or update cache, if not attachment, etc. + if ( isset($response["headers"]["last-modified-version"]) ) + { + if ( $this->request_type != 'ris' ) + { + $data = json_decode($data); // will become 'json' + $tags = array(); // empty for now; by item key later + + // If not array, turn into one for simplicity + if ( ! is_array($data) ) $data = array($data); + + // Remove unncessary details + // REVIEW: Does this account for all unused metadata? Depends on item type ... + foreach( $data as $id => $item ) + { + if ( property_exists($data[$id], 'version') ) unset($data[$id]->version); + if ( property_exists($data[$id], 'links') ) unset($data[$id]->links); + + if ( property_exists($data[$id], 'library') ) + { + if ( property_exists($data[$id]->library, 'type') ) unset($data[$id]->library->type); + if ( property_exists($data[$id]->library, 'name') ) unset($data[$id]->library->name); + if ( property_exists($data[$id]->library, 'links') ) unset($data[$id]->library->links); + } + if ( property_exists($data[$id], 'data') ) + { + if ( property_exists($data[$id]->data, 'key') ) unset($data[$id]->data->key); + if ( property_exists($data[$id]->data, 'version') ) unset($data[$id]->data->version); + if ( property_exists($data[$id]->data, 'series') ) unset($data[$id]->data->series); + if ( property_exists($data[$id]->data, 'seriesNumber') ) unset($data[$id]->data->seriesNumber); + if ( property_exists($data[$id]->data, 'seriesTitle') ) unset($data[$id]->data->seriesTitle); + if ( property_exists($data[$id]->data, 'seriesText') ) unset($data[$id]->data->seriesText); + if ( property_exists($data[$id]->data, 'publicationTitle') ) unset($data[$id]->data->publicationTitle); + if ( property_exists($data[$id]->data, 'journalAbbreviation') ) unset($data[$id]->data->journalAbbreviation); + if ( property_exists($data[$id]->data, 'issue') ) unset($data[$id]->data->issue); + if ( property_exists($data[$id]->data, 'volume') ) unset($data[$id]->data->volume); + if ( property_exists($data[$id]->data, 'numberOfVolumes') ) unset($data[$id]->data->numberOfVolumes); + if ( property_exists($data[$id]->data, 'edition') ) unset($data[$id]->data->edition); + if ( property_exists($data[$id]->data, 'place') ) unset($data[$id]->data->place); + if ( property_exists($data[$id]->data, 'publisher') ) unset($data[$id]->data->publisher); + if ( property_exists($data[$id]->data, 'pages') ) unset($data[$id]->data->pages); + if ( property_exists($data[$id]->data, 'numPages') ) unset($data[$id]->data->numPages); + if ( property_exists($data[$id]->data, 'shortTitle') ) unset($data[$id]->data->shortTitle); + if ( property_exists($data[$id]->data, 'accessDate') ) unset($data[$id]->data->accessDate); + if ( property_exists($data[$id]->data, 'archive') ) unset($data[$id]->data->archive); + if ( property_exists($data[$id]->data, 'archiveLocation') ) unset($data[$id]->data->archiveLocation); + if ( property_exists($data[$id]->data, 'libraryCatalog') ) unset($data[$id]->data->libraryCatalog); + if ( property_exists($data[$id]->data, 'callNumber') ) unset($data[$id]->data->callNumber); + if ( property_exists($data[$id]->data, 'rights') ) unset($data[$id]->data->rights); + if ( property_exists($data[$id]->data, 'extra') ) unset($data[$id]->data->extra); + if ( property_exists($data[$id]->data, 'relations') ) unset($data[$id]->data->relations); + if ( property_exists($data[$id]->data, 'dateAdded') ) unset($data[$id]->data->dateAdded); + if ( property_exists($data[$id]->data, 'websiteTitle') ) unset($data[$id]->data->websiteTitle); + if ( property_exists($data[$id]->data, 'websiteType') ) unset($data[$id]->data->websiteType); + if ( property_exists($data[$id]->data, 'inPublications') ) unset($data[$id]->data->inPublications); + if ( property_exists($data[$id]->data, 'presentationType') ) unset($data[$id]->data->presentationType); + if ( property_exists($data[$id]->data, 'meetingName') ) unset($data[$id]->data->meetingName); + } + + // As of 7.1.4, tags are saved separately + // due to possibily large quantities and the + // limits of blob; so we always save now + // REVIEW: Do we need the account, too? + $tags[$item->key] = ""; + + if ( property_exists($data[$id], 'data') + && property_exists($data[$id]->data, 'tags') ) + { + $tags[$item->key] = $data[$id]->data->tags; + unset($data[$id]->data->tags); + } + + // if ( ! $this->showtags + // && property_exists($data[$id], 'data->tags') ) + // unset($data[$id]->data->tags); + } + + $json = json_encode($data); + $tags = json_encode($tags); + + $wpdb->query( $wpdb->prepare( + " + INSERT INTO ".$wpdb->prefix."zotpress_cache + ( request_id, api_user_id, json, tags, headers, libver, retrieved ) + VALUES ( %s, %s, %s, %s, %s, %d, %s ) + ON DUPLICATE KEY UPDATE + json = VALUES(json), + tags = VALUES(tags), + headers = VALUES(headers), + libver = VALUES(libver), + retrieved = VALUES(retrieved) + ", + array + ( + md5( $url ), + $this->api_user_id, + gzencode($json), + gzencode($tags), // 7.1.4: separated from $data + $headers, + $response["headers"]["last-modified-version"], + date('m/d/Y h:i:s a') + ) + ) ); + + eb_zotpress_refresh_cache(md5( $url ), $this->api_user_id); + } + + else // assume 'ris' + { + // REVIEW: Eventually cache? + // NOTE: $data is everything / the RIS + $json = $data; + $tags = false; + // $headers = $response["headers"]; + } + } + + else // If not an item, e.g., if attachment, PDF, etc. + { + $json = $data; + $tags = false; + $headers = $response["headers"]; + } + } + + // Retrieve cached version + else + { + $json = $this->zp_gzdecode($zp_results[0]->json); + $tags = $this->zp_gzdecode($zp_results[0]->tags); + $headers = $zp_results[0]->headers; + } + } + + return array( "data" => $json, "tags" => $tags, "headers" => $headers ); + } + } +} + +?> diff --git a/lib/request/request.dl.php b/lib/request/request.dl.php new file mode 100644 index 0000000..6375264 --- /dev/null +++ b/lib/request/request.dl.php @@ -0,0 +1,87 @@ +account_type."/".$zp_api_user_id."/items/".$zp_item_key; + $zp_import_meta_url = $zp_import_baseurl."?key=".$zp_account[0]->public_key; + $zp_import_data_url = $zp_import_baseurl."/file/view?key=".$zp_account[0]->public_key; + + // Read the external data + $zp_meta_xml = $zp_import_filemeta->get_request_contents( $zp_import_meta_url, true ); // Unsure about "true" + $zp_data_xml = $zp_import_filedata->get_request_contents( $zp_import_data_url, true ); // Unsure about "true" + + // var_dump($zp_data_xml);exit; + + // Determine filename based on content type + // $zp_filename = "download-".$zp_item_key."."; + // if ( strpos( $zp_content_type, "pdf" ) ) $zp_filename .= "pdf"; + // else if ( strpos( $zp_content_type, "wordprocessingml.document" ) ) $zp_filename .= "docx"; + // else if ( strpos( $zp_content_type, "msword" ) ) $zp_filename .= "doc"; + // else if ( strpos( $zp_content_type, "latex" ) ) $zp_filename .= "latex"; + // else if ( strpos( $zp_content_type, "presentationml.presentation" ) ) $zp_filename .= "pptx"; + // else if ( strpos( $zp_content_type, "ms-powerpointtd" ) ) $zp_filename .= "ppt"; + // else if ( strpos( $zp_content_type, "rtf" ) ) $zp_filename .= "rtf"; + // else if ( strpos( $zp_content_type, "opendocument.text" ) ) $zp_filename .= "odt"; + // else if ( strpos( $zp_content_type, "opendocument.presentation" ) ) $zp_filename .= "odp"; + + if ( $zp_meta_xml !== false + && $zp_data_xml !== false + && strlen(trim($zp_meta_xml["json"])) > 0 + && strlen(trim($zp_data_xml["json"])) > 0 ) + { + $zp_meta_xml_json = json_decode($zp_meta_xml["json"]); + + header( "Content-Type:".$zp_content_type); + header( "Content-Disposition:inline;filename=".$zp_meta_xml_json[0]->data->filename ); + echo $zp_data_xml["json"]; + } + else { + $zp_data_xml = "No file found."; + } + } + else { + echo $zp_data_xml; + } +?> diff --git a/lib/request/request.functions.php b/lib/request/request.functions.php new file mode 100644 index 0000000..9d1b41d --- /dev/null +++ b/lib/request/request.functions.php @@ -0,0 +1,184 @@ + 0 ): + preg_match_all( '/(\d{4})/', $date, $matches ); + if ( isset($matches[0][0]) ): + return $matches[0][0]; + else: + return ""; + endif; + else: + return ""; + endif; + } + } + + + if ( ! function_exists('zp_get_api_user_id') ) + { + function zp_get_api_user_id ($api_user_id_incoming=false) + { + if (isset($_GET['api_user_id']) && preg_match("/^\\d+\$/", $_GET['api_user_id']) == 1) { + $api_user_id = htmlentities($_GET['api_user_id']); + } elseif ($api_user_id_incoming !== false) { + $api_user_id = $api_user_id_incoming; + } else + $api_user_id = false; + + return $api_user_id; + } + } + + + if ( ! function_exists('zp_get_account') ) + { + function zp_get_account ($wpdb, $api_user_id_incoming=false) + { + $zp_account = array(); + if ($api_user_id_incoming !== false) + { + $zp_account[] = eb_zotpress_get_account($api_user_id_incoming = false); + } + else + { + $zp_account[] = eb_zotpress_get_account(); + } + + return $zp_account; + } + } + + + + if ( ! function_exists('zp_clear_cache_for_user') ) + { + function zp_clear_cache_for_user ($wpdb, $api_user_id) + { + $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->prefix."zotpress_cache WHERE api_user_id=%d", $api_user_id)); + + $cache_ver = get_option('zotpress_cache_ver_user_'.$api_user_id, 1) +1; + update_option('zotpress_cache_ver_user_'.$api_user_id, $cache_ver); + } + } + + + if ( ! function_exists('zp_check_author_continue') ) + { + // Takes single author + function zp_check_author_continue( $item, $author ) + { + $author_continue = false; + $author = strtolower($author); + + // Accounts for last names with: de, van, el, seif + if (stripos( $author, "van " ) !== false) { + $author = explode( "van ", $author ); + $author[1] = "van ".$author[1]; + } elseif (stripos( $author, "de " ) !== false) { + $author = explode( "de ", $author ); + $author[1] = "de ".$author[1]; + } elseif (stripos( $author, "el " ) !== false) { + $author = explode( "el ", $author ); + $author[1] = "el ".$author[1]; + } elseif (stripos( $author, "seif " ) !== false) { + $author = explode( "seif ", $author ); + $author[1] = "seif ".$author[1]; + } elseif (stripos( $author, " " ) !== false) { + $author = explode( " ", $author ); + // Deal with multiple blanks + // NOTE: Previously assumed multiple first/middle names + // CHANGED: Check this possibility as well as multiple (7.3) + // last names; so keep array of 1-3+ items + // if ( count($author) > 2 ) + // { + // $new_name = array(); + // foreach ( $author as $num => $author_name ) + // { + // if ( $num == 0 ) $new_name[0] .= $author_name; + // else if ( $num != count($author)-1 ) $new_name[0] .= " ". $author_name; + // else if ( $num == count($author)-1 ) $new_name[1] .= $author_name; + // } + // $author = $new_name; + // } + } elseif (stripos( $author, "+" ) !== false) { + // $author = explode( "+", $author ); + $author = array( str_replace( "+", " ", $author ) ); + } else // Just last name + { + $author = array( $author ); + } + + // Deal with blank firstname + if ( $author[0] == "" ) + { + $author[0] = $author[1]; + unset( $author[1] ); + } + + // Trim firstname + // QUESTION: Is this needed? + $author[0] = trim($author[0]); + + // Check + foreach ( $item->data->creators as $creator ) + { + // NOTE: Assumes last name only + if ( count($author) == 1 ) + { + if ( ( property_exists($creator, 'lastName') && $creator->lastName !== null + && strtolower($creator->lastName) === $author[0] ) + || ( property_exists($creator, 'name') && $creator->name !== null + && strtolower($creator->name) === $author[0] ) ) + $author_continue = true; + } + + // NOTE: Assumes first and last names OR two last names + elseif ( count($author) == 2 ) + { + if ( ( property_exists($creator, 'firstName') && $creator->firstName !== null + && ( strtolower($creator->firstName) === $author[0] + && strtolower($creator->lastName) === $author[1] ) + ) + || ( strtolower($creator->lastName) === $author[0]." ".$author[1] ) + || ( property_exists($creator, 'name') && $creator->name !== null + && ( strtolower($creator->name) === implode(" ", $author) ) ) ) + $author_continue = true; + } + + elseif (( property_exists($creator, 'firstName') && $creator->firstName !== null + && ( strtolower($creator->firstName) === $author[0]." ".$author[1] + && strtolower($creator->lastName) === $author[2] ) ) + // One first name and two last names + || ( property_exists($creator, 'firstName') && $creator->firstName !== null + && ( strtolower($creator->firstName) === $author[0] + && strtolower($creator->lastName) === $author[1]." ".$author[2] ) ) + // All combined + || ( property_exists($creator, 'name') && $creator->name !== null + && strtolower($creator->name) === implode(" ", $author) )) { + $author_continue = true; + } + } + + return $author_continue; + + } // function zp_check_author_continue + } + +?> diff --git a/lib/request/rss.file.php b/lib/request/rss.file.php deleted file mode 100644 index cd80346..0000000 --- a/lib/request/rss.file.php +++ /dev/null @@ -1,52 +0,0 @@ -prefix."zotpress.public_key, ".$wpdb->prefix."zotpress_zoteroItems.citation - FROM ".$wpdb->prefix."zotpress - JOIN ".$wpdb->prefix."zotpress_zoteroItems ON ".$wpdb->prefix."zotpress.api_user_id = ".$wpdb->prefix."zotpress_zoteroItems.api_user_id - WHERE ".$wpdb->prefix."zotpress_zoteroItems.item_key='".$zp_item_key."' - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id='".$zp_api_user_id."';"; - - $zp_download_url = $wpdb->get_results( $zp_download_url_query, OBJECT ); - - if (count($zp_download_url) > 0) - { - header("Location: ".$zp_download_url[0]->citation."/file?key=".$zp_download_url[0]->public_key); - exit; - } - else { - $zp_xml = "No file to download found."; - } - } - else { - echo $zp_xml; - } -?> \ No newline at end of file diff --git a/lib/request/rss.php b/lib/request/rss.php deleted file mode 100644 index 8284851..0000000 --- a/lib/request/rss.php +++ /dev/null @@ -1,286 +0,0 @@ -\n"; - - $image_xml = ""; - - global $wpdb; - - if (isset($_GET['displayImageByCitationID']) && preg_match("/^[a-zA-Z0-9]+$/", $_GET['displayImageByCitationID'])) - $images = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress_images WHERE citation_id='".trim($_GET['displayImageByCitationID'])."'"); - else - $images = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress_images"); - - $total = $wpdb->num_rows; - - foreach ($images as $image) - $image_xml .= " \n"; - - $zp_xml .= "\n\n"; - $zp_xml .= $image_xml; - $zp_xml .= ""; - } - else - { - - // DATA TYPE - - if ($mzr_data_type == false) - { - if (isset($_GET['data_type']) && $mzr_include == false && preg_match("/^[a-zA-Z]+$/", $_GET['data_type'])) - $urlDataType = $_GET['data_type']; - else - $urlDataType = "items/top"; - } - else - { - $urlDataType = $mzr_data_type; - - if ($urlDataType == "items") - $urlDataType = "items/top"; - } - - - // LIST - - // Collection ID - if ($mzr_collection_id == false) - { - if (isset($_GET['collection_id']) && $mzr_include == false && preg_match("/^[a-zA-Z0-9]+$/", $_GET['collection_id'])) { - $urlDataType = "collections/".$_GET['collection_id']."/items"; - } - } - else - { - $urlDataType = "collections/".$mzr_collection_id."/items"; - } - - // Item Key - if ($mzr_item_key != false) - { - $urlDataType = "items/".$mzr_item_key; - } - else if (isset($_GET['item_key']) && $mzr_include == false && preg_match("/^[a-zA-Z0-9]+$/", $_GET['item_key'])) { - $urlDataType = "items/".$_GET['item_key']; - } - - // Children - if ($mzr_get_children === true) - { - $urlDataType .= "/children"; - } - - - // Tag Name - if ($mzr_tag_name == false) - { - if (isset($_GET['tag_name']) && $mzr_include == false && preg_match("/^[a-zA-Z0-9 -_+]+$/", $_GET['tag_name'])) { - $urlDataType = "tags/".str_replace(" ", "+", trim($_GET['tag_name']))."/items"; - } - } - else - { - $mzr_tag_name = str_replace(" ", "+", trim($mzr_tag_name)); - $urlDataType = "tags/".$mzr_tag_name."/items"; - } - - - // PARAMETERS - - // Author - $author = false; - if (isset($_GET['author']) && preg_match("/^[a-zA-Z0-9 -_+]+$/", $_GET['author'])) - { - $author = $_GET['author']; - } - - // Year - $year = false; - if (isset($_GET['year']) && preg_match("/^[0-9]+$/", $_GET['year'])) - { - $year = $_GET['year']; - } - - // Content - if (isset($_GET['content']) && preg_match("/^[a-zA-Z]+$/", $_GET['content'])) - { - $content = "&content=" . $_GET['content']; - } - else - { - if ($mzr_get_meta == true) { - $content = "&content=json"; - } - else if ($mzr_get_children == true) { - $content = ""; - } - else { - $content = "&content=bib"; - } - } - - // Style - if (isset($_GET['style']) && preg_match("/^[a-zA-Z-_]+$/", $_GET['style'])) { - $style = "&style=" . $_GET['style']; - } - else { - $style = "&style=apa"; - } - if ($mzr_get_style == true) { - $style = "&style=".$mzr_get_style; - } - - // Order - $order = false; - if (isset($_GET['order']) && preg_match("/^[a-zA-Z]+$/", $_GET['order'])) - { - $order = "&order=" . $_GET['order']; - } - - // Sort - $sort = false; - if (isset($_GET['sort']) && preg_match("/^[a-zA-Z]+$/", $_GET['sort'])) { - $sort = "&sort=" . $_GET['sort']; - } - - // Limit - if ($mzr_limit != false) - { - if ($mzr_limit == -1) { - $mzr_limit = false; - } - else { - $mzr_limit = "&limit=".$mzr_limit; - } - } - else - { - if (isset($_GET['limit']) && $mzr_include == false && preg_match("/^[0-9]+$/", $_GET['limit'])) { - $mzr_limit = "&limit=".$_GET['limit']; - } - } - - if ($author || $year) - { - $mzr_limit = false; - } - - - - // PUBLIC KEY - $zp_account = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$mzr_api_user_id."'"); - $public_key = $zp_account[0]->public_key; - - - - // GENERATE URL: Users & Groups [& Children] ASSUMED TO BE SET AS: &format=bib - - if (isset($_GET['children']) && preg_match("/^[a-zA-Z0-9]+$/", $_GET['children'])) - $zp_url = "https://api.zotero.org/".$mzr_account_type."/".$mzr_api_user_id."/".$urlDataType."/".$_GET['children']."/children?key=".$public_key; - else if (isset($_GET['topLevel']) && trim($_GET['topLevel']) == "true") - $zp_url = str_replace("/items", "/items/top", "https://api.zotero.org/".$mzr_account_type."/".$mzr_api_user_id."/".$urlDataType."?key=".$public_key.$content.$style.$order.$sort.$mzr_limit); - else - $zp_url = "https://api.zotero.org/".$mzr_account_type."/".$mzr_api_user_id."/".$urlDataType."?key=".$public_key.$content.$style.$order.$sort.$mzr_limit; - - - //echo "
" . $zp_url . "
"; - - - - // GET & DISPLAY CITATIONS - - $zp_request = new ZotpressRequest(); - $zp_xml = $zp_request->get_request_contents( $zp_url, $mzr_force_recache ); - } - - return $zp_xml; - } - } - - - - // DISPLAY XML - - if (!isset($include)) - print MakeZotpressRequest(); - - - -?> \ No newline at end of file diff --git a/lib/request/rss.request.php b/lib/request/rss.request.php deleted file mode 100644 index d3775b8..0000000 --- a/lib/request/rss.request.php +++ /dev/null @@ -1,124 +0,0 @@ -update = $update; - return $this->doRequest( $url ); - } - - // DO REQUEST - function doRequest( $xml_url ) - { - //global $wpdb; - - // NOTE: When If-Modified-Since header 304 implemented, this needs to change ... - - // RECACHE IF PAST THE TIME OR IF FORCED - //if ($this->checkTime($zp_cache[0]->cache_time) === true || $this->update === true) // Every hour (3600), or when forced - //{ - // // UPDATE - //} - // - //// NOT TIME TO CHECK YET, SO JUST DISPLAY CACHED DATA - //else - //{ - // return $zp_cache[0]->xml_data; - // exit(); - //} - - // Get the data - $data = $this->getXmlData( $xml_url ); - - // Check for request errors - if ($this->request_error !== false) { - return $this->request_error; - exit(); - } - - // Otherwise, return the data - else { - return $data; - } - } - - - function checkTime( $cache_time ) - { - if (isset( $cache_time )) - { - $diff = time() - $cache_time; - - if ($diff >= $this->timelimit) - return true; - else - return false; - } - else // No cache time set - { - return false; - } - } - - function getXmlData( $url ) - { - $response = wp_remote_get( $url, array( 'headers' => array("Zotero-API-Version" => "2") ) ); - - if ( is_wp_error($response) || ! isset($response['body']) ) - { - $this->request_error = $response->get_error_message(); - - if ($response->get_error_code() == "http_request_failed") - { - // Try again with less restrictions - add_filter('https_ssl_verify', '__return_false'); //add_filter('https_local_ssl_verify', '__return_false'); - $response = wp_remote_get( $url, array( 'headers' => array("Zotero-API-Version" => "2") ) ); - - if ( is_wp_error($response) || ! isset($response['body']) ) - { - $this->request_error = $response->get_error_message(); - } - else if ( $response == "An error occurred" || ( isset($response['body']) && $response['body'] == "An error occurred") ) - { - $this->request_error = "WordPress was unable to import from Zotero. This is likely caused by an incorrect citation style name. For example, 'mla' is now 'modern-language-association'. Use the name found in the style's URL at the Zotero Style Repository."; - } - else // no errors this time - { - $this->request_error = false; - } - } - } - else if ( $response == "An error occurred" || ( isset($response['body']) && $response['body'] == "An error occurred") ) - { - $this->request_error = "WordPress was unable to import from Zotero. This is likely caused by an incorrect citation style name. For example, 'mla' is now 'modern-language-association'. Use the name found in the style's URL at the Zotero Style Repository."; - } - - $data = wp_remote_retrieve_body( $response ); // Thanks to Trainsmart.com developer! - - // Make sure tags didn't return an error -- redo if so - if ($data == "Tag not found") - { - $url_break = explode("/", $url); - $url = $url_break[0]."//".$url_break[2]."/".$url_break[3]."/".$url_break[4]."/".$url_break[7]; - $url = str_replace("=50", "=5", $url); - - $data = $this->getXmlData( $url ); - } - - return $data; - } - } -} - -?> \ No newline at end of file diff --git a/lib/shortcode/shortcode.class.lib.php b/lib/shortcode/shortcode.class.lib.php new file mode 100644 index 0000000..f4c5f5b --- /dev/null +++ b/lib/shortcode/shortcode.class.lib.php @@ -0,0 +1,505 @@ +account = $account; + } + + public function getAccount() + { + return $this->account; + } + + public function setType($type) + { + $this->type = $type; + } + + public function setFilters($filters) + { + $this->filters = $filters; + } + + public function setMinLength($minlength) + { + $this->minlength = $minlength; + } + + public function getMinLength() + { + return $this->minlength; + } + + public function setMaxResults($maxresults) + { + $this->maxresults = $maxresults; + } + + public function getMaxResults() + { + return $this->maxresults; + } + + public function setMaxPerPage($maxperpage) + { + $this->maxperpage = $maxperpage; + } + + public function getMaxPerPage() + { + return $this->maxperpage; + } + + public function setMaxTags($maxtags) + { + $this->maxtags = $maxtags; + } + + public function setCiteable($citeable) + { + $this->citeable = $citeable; + } + + public function setStyle($style) + { + $this->style = strtolower( $style ); + } + + public function setCollection($collection_id) + { + $this->collection = $collection_id; + } + + public function setSortBy($sortby) + { + $this->sortby = strtolower( $sortby ); + } + + public function setOrder($order) + { + $this->order = strtolower( $order ); + } + + public function setDownloadable($download) + { + $this->downloadable = $download; + } + + public function setShowTags($showtags) + { + $showtags = $showtags == "yes" || $showtags == "true" || $showtags === true; + + $this->showtags = $showtags; + } + + public function setShowImage($showimage) + { + $showimage = $showimage == "yes" || $showimage == "true" || $showimage === true; + + $this->showimage = $showimage; + } + + public function setAdmin($setAdmin) + { + $this->is_admin = $setAdmin; + } + + public function setURLWrap($urlwrap) + { + $this->urlwrap = $urlwrap; + } + + public function setTopLevel($toplevel) + { + $this->toplevel = $toplevel; + } + + public function setTarget($target) + { + $this->target = $target; + } + + + public function setMaxPages($maxpages) + { + $this->maxpages = $maxpages; + } + public function getMaxPages() + { + return $this->maxpages; + } + + public function setBrowseBar($browsebar) + { + if ( $browsebar == "show" || $browsebar == "active" || $browsebar == "visible" || $browsebar == "yes" || $browsebar == "true" || $browsebar === true || $browsebar == 1 ) $browsebar = true; + else $browsebar = false; + + $this->browsebar = $browsebar; + } + + public function getLib() + { + global $wpdb; + $content = ""; + + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + // Enqueue scripts + if ( $this->type == "dropdown" ) + { + wp_enqueue_script( 'zotpress.lib'.$minify.'.js' ); + wp_enqueue_script( 'zotpress.lib.dropdown'.$minify.'.js' ); + } + else + { + wp_enqueue_script( 'jquery-ui-autocomplete' ); + wp_enqueue_script( 'zotpress.lib'.$minify.'.js' ); + wp_enqueue_script( 'zotpress.lib.searchbar'.$minify.'.js' ); + } + + // API User ID + + global $api_user_id; + + if ( isset($_GET['page']) + && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? + && isset($_GET['account_id']) + && preg_match("/^\\d+\$/", $_GET['account_id']) ) { + $api_user_id = eb_zotpress_get_account( $_GET['account_id'] ); + $api_user_id = $api_user_id->nickname; + } else { + $api_user_id = $this->getAccount()->api_user_id; + } + + + // Collection ID + global $collection_id; + + if (isset($_GET['page']) + && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? + && isset($_GET['collection_id']) + && preg_match("/^[0-9a-zA-Z]+$/", $_GET['collection_id'])) { + $collection_id = trim($_GET['collection_id']); + } elseif (isset($_GET['page']) + && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? + && isset($_GET['subcollection_id']) + && preg_match("/^[0-9a-zA-Z]+$/", $_GET['subcollection_id'])) { + $collection_id = trim($_GET['subcollection_id']); + } else + $collection_id = $this->collection; // from false + + + // Collection Name + global $collection_name; + + // if ( isset($_GET['page']) + // && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? + // && isset($_GET['collection_name']) ) + // if ( strpos( $_GET['collection_name'], "- " ) == 0 ) + // $collection_name = stripslashes(htmlentities(strip_tags(preg_replace( "/- /", "", urldecode($_GET['collection_name']), 1 )))); + // else + // $collection_name = stripslashes(htmlentities(strip_tags(urldecode(trim($_GET['collection_name']))))); + // else + if ( isset($_GET['subcollection_name']) ) + if ( strpos( $_GET['subcollection_name'], "- " ) == 0 ) + $collection_name = stripslashes(htmlentities(strip_tags(preg_replace( "/- /", "", urldecode(trim($_GET['subcollection_name'])), 1 )))); + else + $collection_name = stripslashes(htmlentities(strip_tags(urldecode(trim($_GET['subcollection_name']))))); + else + $collection_name = false; + + // Top Level + if ( isset($_GET['page']) + && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? + && isset($_GET['toplevel']) ) + $this->toplevel = "toplevel"; + + + // Tag Name + + global $tag_id; + + // if ( isset($_GET['page']) + // && $_GET['page'] == "Zotpress" // REVIEW: only include GET if admin? + // && isset($_GET['tag_id']) + // && strlen(trim($_GET['tag_id'])) > 0 ) + // $tag_id = htmlentities(strip_tags(trim($_GET['tag_id']))); + // else if + if ( isset($_GET['lib_tag']) + && strlen(trim($_GET['lib_tag'])) > 0 ) + $tag_id = urldecode(htmlentities(strip_tags(trim($_GET['lib_tag'])))); + else + $tag_id = false; + // var_dump($tag_id); + + // Remove default collection if tag selected + // REVIEW: But we want tags within collections ... I think? + // if ( $tag_id ) { + // $collection_id = false; + // $collection_name = false; + // } + + + // Browse instance ID + // REVIEW: Added post ID + $instance_id = "zotpress-lib-" + .md5( + get_the_ID() + .$api_user_id + .$collection_id + .$collection_name + .$this->type + .$tag_id + .$this->style + .$this->sortby + .$this->order + .$this->citeable + .$this->downloadable + .$this->showtags + .$this->showimage + .$this->toplevel + .$this->target + .$this->urlwrap + .$this->is_admin + .$this->minlength + .$this->maxresults + .$this->maxperpage + .$this->maxtags + .$this->maxpages + .$this->filters + .$this->browsebar + ); + + $content .= "\n"; + $content .= "
\n"; + $content .= ''; + $content .= "\n"; + if ( $collection_id ) $content .= ''; + if ( $collection_name ) $content .= ''; + if ( $tag_id ) $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + $content .= ''; + $content .= "\n"; + if ( $this->toplevel ) $content .= ''; + $content .= ''; + $content .= "\n"; + $content .= ''; + if ( $this->is_admin ) $content .= ''; + $content .= ''; + $content .= "\n"; + + // Deal with Browse Bar by Type + if ( $this->type == "dropdown" ): + + if ( $this->browsebar ): + + $content .= '
'; + $content .= '
'; + $content .= "
\n"; + $content .= "\n"; + $content .= "
\n\n"; + $content .= '
'; + $content .= "\n"; + + $content .= '
'; + $content .= "
\n"; + $content .= '\n"; + $content .= "
\n\n"; + $content .= '
'; + $content .= "\n"; + $content .= '
'; + + endif; // if Browse Bar + + else: // Search Bar needs the Browse Bar / search input to function + + $content .= '
'; + $content .= ''; + $content .= "\n"; + + $content .= '
'; + + endif; // Type + + $content .= "\n\n"; + + + $content .= '
\n"; + $content .= "
\n"; + } elseif ($tag_id) { + // Top Level + $content .= "
".__('Viewing items tagged','zotpress')." \"".str_replace("+", " ", $tag_id)."\"
\n"; + } elseif ($this->toplevel == "toplevel" || $this->toplevel === false) { + $content .= "
".__('Top Level Items','zotpress')."
\n"; + } else + $content .= "
".__('Default Collection Items','zotpress')."
\n"; + } + + // Searchbar + else + { + $content .= "\">"; + + // Autocomplete will fill this up + $content .= 'thinking'; + } + + // Container for results + $content .= '
'; + + // Pagination + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + $content .= '
'; + + $content .= '
'; + $content .= "\n"; + + $content .= ''; + + return $content . "\n\n"; + } +} + +?> diff --git a/lib/shortcode/shortcode.classes.php b/lib/shortcode/shortcode.classes.php deleted file mode 100644 index 52b6dee..0000000 --- a/lib/shortcode/shortcode.classes.php +++ /dev/null @@ -1,645 +0,0 @@ -account = $account; - } - - public function getAccount() - { - return $this->account; - } - - public function setType($type) - { - $this->type = $type; - } - - public function getType() - { - return $this->type; - } - - public function setFilters($filters) - { - $this->filters = $filters; - } - - public function getFilters() - { - return $this->filters; - } - - public function setMinLength($minlength) - { - $this->minlength = $minlength; - } - - public function getMinLength() - { - return $this->minlength; - } - - public function setMaxResults($maxresults) - { - $this->maxresults = $maxresults; - } - - public function getMaxResults() - { - return $this->maxresults; - } - - public function setMaxPerPage($maxperpage) - { - $this->maxperpage = $maxperpage; - } - - public function getMaxPerPage() - { - return $this->maxperpage; - } - - public function setCiteable($citeable) - { - $this->citeable = $citeable; - } - - public function getCiteable() - { - return $this->citeable; - } - - public function setDownloadable($download) - { - $this->downloadable = $download; - } - - public function getDownloadable() - { - return $this->downloadable; - } - - - - public function getLib() - { - global $wpdb; - - - // Account ID - - global $api_user_id; - - if ( isset($_GET['account_id']) && preg_match("/^[0-9]+$/", $_GET['account_id']) ) - { - $api_user_id = $wpdb->get_var("SELECT nickname FROM ".$wpdb->prefix."zotpress WHERE id='".$_GET['account_id']."'", OBJECT); - } - else - { - $api_user_id = $this->getAccount()->api_user_id; - } - - - // Collection ID - - global $collection_id; - - if (isset($_GET['collection_id']) && preg_match("/^[0-9a-zA-Z]+$/", $_GET['collection_id'])) - $collection_id = trim($_GET['collection_id']); - else - $collection_id = false; - - - // Tag Name and ID - - global $tag_id; - - if (isset($_GET['tag_id']) && preg_match("/^[0-9]+$/", $_GET['tag_id'])) - $tag_id = trim($_GET['tag_id']); - else - $tag_id = false; - - - ?> -
- -
- - getType() == "dropdown" ): ?> - -
- Collections'; - } - - // Display Collection List - - if ( $collection_id ) // parent - { - //$zp_collection = get_term( $collection_id, 'zp_collections', 'OBJECT' ); - if ( is_admin( ) ) $zp_top_collection = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='".$this->getAccount()->api_user_id."' AND id='".$collection_id."'", OBJECT); - if ( ! is_admin( ) ) $zp_top_collection = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='".$this->getAccount()->api_user_id."' AND item_key='".$collection_id."'", OBJECT); - } - - $zp_collections_query = "SELECT * FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE api_user_id='".$this->getAccount()->api_user_id."' "; - if ( $collection_id ) $zp_collections_query .= "AND parent='".$zp_top_collection->item_key."' "; else $zp_collections_query .= "AND parent='' "; - $zp_collections_query .= "ORDER BY title ASC"; - //$zp_collections = get_terms( 'zp_collections', array( 'parent' => $collection_id, 'hide_empty' => false ) ); - $zp_collections = $wpdb->get_results($zp_collections_query, OBJECT); - - if ( ! is_admin() ) - { - echo "
\n"; - } - ?> -
- - -
- Tags'; - - if ( ! is_admin() ) echo "
"; - echo '\n"; - - if ( ! is_admin() ) echo "
\n"; - ?> -
- - - - - - - -
- - -
- - getType() == "dropdown" ) - { - - // Display title if on collection page - - if ( $collection_id ) - { - echo "
"; - echo "".$zp_top_collection->title.""; - if ( is_admin() ) - { - echo "
"; - echo "Collection key:"; - echo "
"; - echo "".$zp_top_collection->item_key.""; - echo ""; - echo "
\n"; - echo "
\n"; - } - echo "
\n"; - } - else if ( $tag_id ) // Top Level - { - $tag_title = $wpdb->get_row("SELECT title FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE api_user_id='".$this->getAccount()->api_user_id."' AND id='".$tag_id."'", OBJECT); - echo "
Viewing items with the \"".str_replace("__and__", "&", $tag_title->title)."\" tag
\n"; - } - else - { - echo "
Top Level Items
\n"; - } - - - /*$zp_citation_attr = - array( - 'posts_per_page' => -1, - 'post_type' => 'zp_entry', - 'orderby' => 'post_date', - 'order' => 'DESC', - 'meta_query' => array( - 'relation' => 'AND', - array( - 'key' => 'api_user_id', - 'value' => $account_id, - 'compare' => 'LIKE' - ), - array( - 'key' => 'item_type', - 'value' => array( 'attachment', 'note' ), - 'compare' => 'NOT IN' - ) - ) - ); - - // By Collection ID - if (isset($_GET['collection_id']) && preg_match("/^[a-zA-Z0-9]+$/", $_GET['collection_id']) == 1) - { - $zp_citation_attr = array_merge( $zp_citation_attr, - array( - 'tax_query' => array( - array( - 'taxonomy' => 'zp_collections', - 'field' => 'id', - 'terms' => $_GET['collection_id'], - 'include_children' => false - ) - ) - ) - ); - - // By Tag ID - } else if (isset($_GET['tag_id']) && preg_match("/^[0-9]+$/", $_GET['tag_id']) == 1) - { - $zp_citation_attr = array_merge( $zp_citation_attr, - array( - 'tax_query' => array( - array( - 'taxonomy' => 'zp_tags', - 'field' => 'id', - 'terms' => $_GET['tag_id'] - ) - ) - ) - ); - } - - $zp_citations = get_posts( $zp_citation_attr );*/ - - // By Collection ID - if (isset($_GET['collection_id']) && preg_match("/^[a-zA-Z0-9]+$/", $_GET['collection_id']) == 1) - { - $zp_citations_query = - " - SELECT ".$wpdb->prefix."zotpress_zoteroItems.*, - ".$wpdb->prefix."zotpress_zoteroItemImages.image AS itemImage - FROM ".$wpdb->prefix."zotpress_zoteroItems - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemColl - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemColl.item_key - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroItemImages - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroItemImages.item_key - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id=".$wpdb->prefix."zotpress_zoteroItemImages.api_user_id - WHERE ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key = '".$zp_top_collection->item_key."' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'attachment' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'note' - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id = '".$this->getAccount()->api_user_id."' - ORDER BY author ASC - "; - $zp_citations = $wpdb->get_results( $zp_citations_query ); - } - // By Tag ID - else if (isset($_GET['tag_id']) && preg_match("/^[0-9]+$/", $_GET['tag_id']) == 1) - { - $zp_citations_query = - " - SELECT ".$wpdb->prefix."zotpress_zoteroItems.*, - ".$wpdb->prefix."zotpress_zoteroItemImages.image AS itemImage - FROM ".$wpdb->prefix."zotpress_zoteroItems - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemTags - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemTags.item_key - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroItemImages - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroItemImages.item_key - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id=".$wpdb->prefix."zotpress_zoteroItemImages.api_user_id - WHERE ".$wpdb->prefix."zotpress_zoteroRelItemTags.tag_title = '".str_replace("__and__", "&", $tag_title->title)."' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'attachment' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'note' - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id = '".$this->getAccount()->api_user_id."' - ORDER BY author ASC - "; - $zp_citations = $wpdb->get_results( $zp_citations_query ); - } - // Top-level - else - { - $zp_citations_query = - " - SELECT ".$wpdb->prefix."zotpress_zoteroItems.*, - ".$wpdb->prefix."zotpress_zoteroItemImages.image AS itemImage, - ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key - FROM ".$wpdb->prefix."zotpress_zoteroItems - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemColl - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemColl.item_key - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroItemImages - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroItemImages.item_key - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id=".$wpdb->prefix."zotpress_zoteroItemImages.api_user_id - WHERE ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key IS NULL - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'attachment' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'note' - AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id = '".$this->getAccount()->api_user_id."' - ORDER BY author ASC - "; - $zp_citations = $wpdb->get_results( $zp_citations_query ); - } - - - if ( $this->getDownloadable() !== false && $this->getDownloadable() != "no" ) - { - if (count($zp_citations) > 0) - { - $zp_downloads_count = ""; - - foreach ($zp_citations as $entry) - { - if ( $entry->numchildren > 0 ) // Might have downloads - { - if ( strlen($zp_downloads_count) >0 ) $zp_downloads_count .= ", "; - $zp_downloads_count .= "'".$entry->item_key."'"; - } - } - - // If there's items with children, create query - if ( strlen($zp_downloads_count) > 0 ) - { - $zp_downloads_query = - " - SELECT - ".$wpdb->prefix."zotpress_zoteroItems.parent AS parent, - ".$wpdb->prefix."zotpress_zoteroItems.citation AS content, - ".$wpdb->prefix."zotpress_zoteroItems.item_key AS item_key, - ".$wpdb->prefix."zotpress_zoteroItems.json AS data, - ".$wpdb->prefix."zotpress_zoteroItems.linkmode AS linkmode - FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE api_user_id='".$api_user_id."' AND - ".$wpdb->prefix."zotpress_zoteroItems.parent IN (".$zp_downloads_count.") AND - ".$wpdb->prefix."zotpress_zoteroItems.linkmode IN ( 'imported_file', 'linked_url' ) - ORDER BY linkmode ASC - "; - $zp_downloads = $wpdb->get_results( $zp_downloads_query ); - } - } - } - - - // DISPLAY EACH ENTRY - - $entry_zebra = true; - - if (count($zp_citations) == 0) - { - echo "

There are no citations to display."; - if ( is_admin() ) echo " If you think you're receiving this message in error, you may need to getAccount()->api_user_id."\" style=\"color: #f00000; text-shadow: none;\">import your Zotero library."; - echo "

"; - } - else // display - { - foreach ($zp_citations as $entry) - { - $citation_id = $entry->item_key; - $citation_content = htmlentities( $entry->citation, ENT_QUOTES, "UTF-8", true ); - - $zp_thumbnail = false; - //if ( has_post_thumbnail( $entry->ID ) ) $zp_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $entry->ID ) ); - if ( !is_null($entry->itemImage) ) $zp_thumbnail = wp_get_attachment_image_src($entry->itemImage); - - if ($entry_zebra === true) echo "
\n"; else echo "
\n"; - - - // CITEABLE - if ( $this->getCiteable() !== false && $this->getCiteable() != "no" ) - { - $cite_url = "https://api.zotero.org/".$this->getAccount()->account_type."/".$this->getAccount()->api_user_id."/items/".$citation_id."?format=ris"; - $citation_content = preg_replace('~(.*)' . preg_quote(htmlentities('
', ENT_QUOTES, "UTF-8", true ), '~') . '(.*?)~', '$1' . htmlentities(" Cite
", ENT_QUOTES, "UTF-8", true ) . '$2', $citation_content, 1); - } - - // DOWNLOADABLE - if ( $this->getDownloadable() !== false && $this->getDownloadable() != "no" && isset($zp_downloads) && count($zp_downloads) > 0 ) - { - foreach( $zp_downloads as $id => $zp_download ) - { - if ( $zp_download->parent == $entry->item_key ) - { - if ($zp_download->linkmode == "imported_file") - { - $zp_download_url = " "; - } - else // URL - { - $zp_download->data = json_decode($zp_download->data); - $zp_download_url = " "; - } - - $citation_content = preg_replace('~(.*)' . preg_quote(htmlentities('
', ENT_QUOTES, "UTF-8", true ), '~') . '(.*?)~', '$1' . $zp_download_url . "Download
" . '$2', $citation_content, 1); - } - } - } - - - // START OF DISPLAY IMAGE - - if ( is_admin() || $zp_thumbnail !== false ) echo "
\n"; - - $citation_image = ""; - - if ( is_admin() ) $citation_image .= "Set Image\n"; - - if ( $zp_thumbnail !== false ) - { - if ( is_admin() ) $citation_image .= "×\n"; - $citation_image .= "image\n"; - } - - echo $citation_image; - if ( is_admin() || $zp_thumbnail !== false ) echo "
\n"; - - // END OF DISPLAY IMAGE - - - // DISPLAY CONTENT - echo html_entity_decode($citation_content, ENT_QUOTES)."\n"; - - if ( is_admin() ) echo "
Item Key:
".$citation_id."
\n"; - echo "\n\n"; - - // Zebra striping - if ($entry_zebra === true) $entry_zebra = false; else $entry_zebra = true; - } - } - - } - - // Searchbar - else - { - // Autocomplete will fill this up - echo 'thinking'; - - // Container for results - echo '
'; - - // Pagination - echo '
'; - } - - ?> - - - - getType() == "dropdown" ): ?>
-
- - Showing - -
-
- - - \ No newline at end of file diff --git a/lib/shortcode/shortcode.functions.php b/lib/shortcode/shortcode.functions.php index c02b7c4..b2ea9c1 100644 --- a/lib/shortcode/shortcode.functions.php +++ b/lib/shortcode/shortcode.functions.php @@ -1,326 +1,751 @@ + ); + + // Fix the String + $clean_param = htmlspecialchars( $param, ENT_QUOTES ); + + return str_replace( $search, "", $clean_param ); +} + + +/** + * Gets the year from a date. + * + * Used by: In-Text Shortcode, In-Text Bibliography Shortcode + * + * @param str $date The date to search in. + * @param bol $yesnd Return with a "n.d." if no year found. + * + * @return str $date_return The year found or blank/n.d. if not found. + */ +function zp_get_year( $date, $yesnd=false ) +{ + $date_return = false; + + preg_match_all( '/(\d{4})/', $date, $matches ); + + if (is_null($matches[0][0])) + $date_return = $yesnd === true ? "n.d." : ""; + else + $date_return = $matches[0][0]; + + return $date_return; +} + + +/** + * Sorts by a secondary value. + * + * Used by: Bibliography Shortcode, In-Text Bibliography Shortcode + * + * @param arr $item_arr The date to format. + * @param str $sortby What attribute to sort by. + * @param str $order What is the order (direction of the sort): ASC, DESC. + * + * @return arr $item_arr The newly sorted array of items. + */ +function subval_sort( $item_arr, $sortby, $order ) +{ + // Format sort order + $order = strtolower($order) == "desc" ? SORT_DESC : SORT_ASC; + + // Author or date + if ($sortby == "author" || $sortby == "date") { + foreach ($item_arr as $key => $val) + { + $author[$key] = $val["author"]; + + $zpdate = ""; $zpdate = isset( $val["zpdate"] ) ? $val["zpdate"] : $val["date"]; + + $date[$key] = zp_date_format($zpdate); + } + } elseif ($sortby == "title") { + foreach ($item_arr as $key => $val) + { + $title[$key] = $val["title"]; + $author[$key] = $val["author"]; + } + } + + // NOTE: array_multisort seems to be ignoring second sort for date->author + if ($sortby == "author" && isset($author) && is_array($author)) { + array_multisort( $author, $order, $date, $order, $item_arr ); + } elseif ($sortby == "date" && isset($date) && is_array($date)) { + array_multisort( $date, $order, $author, SORT_ASC, $item_arr ); + } elseif ($sortby == "title" && isset($title) && is_array($title)) { + array_multisort( $title, $order, $author, $order, $item_arr ); + } + + return $item_arr; +} + + +/** + * Reformats the date in a standard format: yyyy-mm-dd. + * + * Can read the following: + * - yyyy/mm/dd, mm/dd/yyyy + * - the dash equivalents of the above + * - mmmm dd, yyyy + * - yyyy mmmm, yyyy mmm (and the reverse) + * - mm-mm yyyy + * + * Used by: subval_sort + * + * @param str $date The date to format. + * + * @return str The formatted date, or the original if formatting fails. + */ +function zp_date_format ($date) +{ + // Set up search lists + $list_month_long = array ( "01" => "January", "02" => "February", "03" => "March", "04" => "April", "05" => "May", "06" => "June", "07" => "July", "08" => "August", "09" => "September", "10" => "October", "11" => "November", "12" => "December" ); + $list_month_short = array ( "01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr", "05" => "May", "06" => "Jun", "07" => "Jul", "08" => "Aug", "09" => "Sept", "10" => "Oct", "11" => "Nov", "12" => "Dec" ); + + + // Check if it's a mm-mm dash + if ( preg_match("/^[a-zA-Z]+[-][a-zA-Z]+[ ]\\d+\$/", $date ) == 1) { - $year = zp_get_year($date); // 4 digits - - preg_match_all( '/(\w)/', $date, $matches ); - //var_dump($matches); - - $month = date_parse( $matches[0][0] ); - - //var_dump($date['month']); - - //var_dump($month); + $temp1 = preg_split( "/-|\//", $date ); + $temp2 = preg_split( "[\s]", $temp1[1] ); + + $date = $temp1[0]." ".$temp2[1]; } - - - - // SUBVAL SORT - // Used by: Bibliography Shortcode, In-Text Bibliography Shortcode - function subval_sort($item_arr, $sortby, $order) - { - // Format sort order - if ( strtolower($order) == "desc" ) $order = SORT_DESC; else $order = SORT_ASC; - - // Author or date - if ( $sortby == "author" || $sortby == "date" ) - { - foreach ($item_arr as $key => $val) - { - $author[$key] = $val["author"]; - - $zpdate = ""; if ( isset( $val["zpdate"] ) ) $zpdate = $val["zpdate"]; else $zpdate = $val["date"]; - - $date[$key] = zp_date_format($zpdate); - } - } - - // Title - else if ( $sortby == "title" ) - { - foreach ($item_arr as $key => $val) - { - $title[$key] = $val["title"]; - $author[$key] = $val["author"]; - } - } - - // NOTE: array_multisort seems to be ignoring second sort for date->author - if ( $sortby == "author" && isset($author) && is_array($author) ) array_multisort( $author, $order, $date, $order, $item_arr ); - else if ( $sortby == "date" && isset($date) && is_array($date) ) array_multisort( $date, $order, $author, SORT_ASC, $item_arr ); - else if ( $sortby == "title" && isset($title) && is_array($title) ) array_multisort( $title, $order, $author, $order, $item_arr ); - - return $item_arr; - } - - - /** - * Returns the date in a standard format: yyyy-mm-dd. - * - * Can read the following: - * - yyyy/mm/dd, mm/dd/yyyy - * - the dash equivalents of the above - * - mmmm dd, yyyy - * - yyyy mmmm, yyyy mmm (and the reverse) - * - mm-mm yyyy - * - * Used by: subval_sort - * - * @param string $date the date to format - * - * @return string the formatted date, or the original if formatting fails - */ - function zp_date_format ($date) + + // If it's already formatted with a dash or forward slash + if (strpos( $date, "-" ) !== false || strpos( $date, "/" ) !== false) { + // Break it up + $temp = preg_split( "/-|\//", $date ); + // If year is last, switch it with first + if (strlen( $temp[0] ) != 4) { + // Just month and year + if ( count( $temp ) == 2 ) + $date_formatted = array( + "year" => $temp[1], + "month" => $temp[0], + "day" => false + ); + // Assuming mm dd yyyy + else + $date_formatted = array( + "year" => $temp[2], + "month" => $temp[0], + "day" => $temp[1] + ); + } elseif (isset($temp[2])) { + // day is set + $date_formatted = array( + "year" => $temp[0], + "month" => $temp[1], + "day" => $temp[2] + ); + } else + { + $date_formatted = array( + "year" => $temp[0], + "month" => $temp[1], + "day" => false + ); + } + } elseif (strpos( $date, "," )) { + $date = trim( str_replace( ", ", ",", $date ) ); + $temp = preg_split( "/,| /", $date ); + // Convert month + $month = array_search( $temp[0], $list_month_long ); + if ( !$month ) $month = array_search( $temp[0], $list_month_short ); + $date_formatted = array( + "year" => $temp[2], + "month" => $month, + "day" => $temp[1] + ); + } else { - // Set up search lists - $list_month_long = array ( "01" => "January", "02" => "February", "03" => "March", "04" => "April", "05" => "May", "06" => "June", "07" => "July", "08" => "August", "09" => "September", "10" => "October", "11" => "November", "12" => "December" ); - $list_month_short = array ( "01" => "Jan", "02" => "Feb", "03" => "Mar", "04" => "Apr", "05" => "May", "06" => "Jun", "07" => "Jul", "08" => "Aug", "09" => "Sept", "10" => "Oct", "11" => "Nov", "12" => "Dec" ); - - - // Check if it's a mm-mm dash - if ( preg_match("/^[a-zA-Z]+[-][a-zA-Z]+[ ][0-9]+$/", $date ) == 1) - { - $temp1 = preg_split( "/-|\//", $date ); - $temp2 = preg_split( "[\s]", $temp1[1] ); - - $date = $temp1[0]." ".$temp2[1]; - } - - // If it's already formatted with a dash or forward slash - if ( strpos( $date, "-" ) !== false || strpos( $date, "/" ) !== false ) + $date = trim( str_replace( " ", "-", $date ) ); + $temp = explode ( " ", $date ); + + // If there's at least two parts to the date + if ( $temp !== [] ) { - // Break it up - $temp = preg_split( "/-|\//", $date ); - - // If year is last, switch it with first - if ( strlen( $temp[0] ) != 4 ) - { - // Just month and year - if ( count( $temp ) == 2 ) - $date_formatted = array( - "year" => $temp[1], - "month" => $temp[0], - "day" => false - ); - // Assuming mm dd yyyy - else - $date_formatted = array( - "year" => $temp[2], - "month" => $temp[0], - "day" => $temp[1] - ); - } - else // Year is first - { - if ( isset($temp[2]) ) // day is set - { - $date_formatted = array( - "year" => $temp[0], - "month" => $temp[1], - "day" => $temp[2] - ); - } - else + // Check if name is first + if (!is_numeric( $temp[0] )) { + if (in_array( $temp[0], $list_month_long )) { + $date_formatted = array( + "year" => $temp[1], + "month" => array_search( $temp[0], $list_month_long ), + "day" => false + ); + } elseif (in_array( $temp[0], $list_month_short )) { + $date_formatted = array( + "year" => $temp[1], + "month" => array_search( $temp[0], $list_month_short ), + "day" => false + ); + } else // Not a recognizable month word + $date_formatted = array( + "year" => $temp[0], // $temp[1] + "month" => false, + "day" => false + ); + } elseif (count($temp) > 1) { + if (in_array( $temp[1], $list_month_long )) { + $date_formatted = array( + "year" => $temp[0], + "month" => array_search( $temp[1], $list_month_long ), + "day" => false + ); + } elseif (in_array( $temp[1], $list_month_short )) { + $date_formatted = array( + "year" => $temp[0], + "month" => array_search( $temp[1], $list_month_short ), + "day" => false + ); + } else // Not a recognizable month word + $date_formatted = array( + "year" => $temp[0], + "month" => false, + "day" => false + ); + } else // Only one part in the array { $date_formatted = array( "year" => $temp[0], - "month" => $temp[1], + "month" => false, "day" => false ); } - } } - - // If it's already formatted in mmmm dd, yyyy form - else if ( strpos( $date, "," ) ) + + // Otherwise, assume year + else { - $date = trim( str_replace( ", ", ",", $date ) ); - $temp = preg_split( "/,| /", $date ); - - // Convert month - $month = array_search( $temp[0], $list_month_long ); - if ( !$month ) $month = array_search( $temp[0], $list_month_short ); - $date_formatted = array( - "year" => $temp[2], - "month" => $month, - "day" => $temp[1] + "year" => $temp[0], + "month" => false, + "day" => false ); } - // Check for full names - else + } + + // Format date in standard form: yyyy-mm-dd + $date_formatted = implode( "-", array_filter( $date_formatted ) ); + + if ( !isset($date_formatted) ) $date_formatted = $date; + + return $date_formatted; +} + + +/** + * Processes the WP AJAX Zotero request variables. + * TODO: Is this necessary? + * + * Used by: shortcode.php + * + * @return string Array with the processed variables. + */ +function Zotpress_prep_ajax_request_vars() +{ + $zpr = array(); + + $zpr["limit"] = 50; // max 100, 22 seconds + $zpr["overwrite_request"] = false; + $zpr["overwrite_last_request"] = false; + + // Deal with incoming variables + $zpr["type"] = "basic"; if ( isset($_GET['type']) && $_GET['type'] != "" ) $zpr["type"] = $_GET['type']; + $zpr["api_user_id"] = isset( $_GET['api_user_id'] ) ? $_GET['api_user_id'] : false; + $zpr["item_type"] = "items"; if ( isset($_GET['item_type']) && $_GET['item_type'] != "" ) $zpr["item_type"] = $_GET['item_type']; + $zpr["get_top"] = false; if ( isset($_GET['get_top']) ) $zpr["get_top"] = true; + $zpr["sub"] = false; + $zpr["is_dropdown"] = false; if ( isset($_GET['is_dropdown']) ) $zpr["is_dropdown"] = true; + $zpr["update"] = false; if ( isset($_GET['update']) && $_GET['update'] == "true" ) $zpr["update"] = true; + + // instance id, item key, collection id, tag id + $zpr["instance_id"] = false; if ( isset($_GET['instance_id']) ) $zpr["instance_id"] = $_GET['instance_id']; + + $zpr["item_key"] = false; + if ( isset($_GET['item_key']) + && ( $_GET['item_key'] != "false" && $_GET['item_key'] !== false ) ) + $zpr["item_key"] = $_GET['item_key']; + + // REVIEW: Make sure item_key is formatting in the new style + // + // BIB FORMATS: + // [zotpress item="GMGCJU34"] + // [zotpress items="GMGCJU34,U9Z5JTKC"] + if ( $zpr["item_key"] != false + && strpos( $zpr["item_key"], ":" ) == false ) + { + $temp_reformatted = ""; + $temp_items = explode( ",", $zpr["item_key"] ); + + foreach ( $temp_items as $item ) + $temp_reformatted .= "{".$zpr["api_user_id"].":".$item."},"; + + $zpr["item_key"] = rtrim( $temp_reformatted, ',' ); + } + + $zpr["itemtype"] = false; + if ( isset($_GET['itemtype']) + && ( $_GET['itemtype'] != "false" && $_GET['itemtype'] !== false && $_GET['itemtype'] !== '' ) ) + $zpr["itemtype"] = $_GET['itemtype']; + + $zpr["collection_id"] = false; + if ( isset($_GET['collection_id']) + && ( $_GET['collection_id'] != "false" && $_GET['collection_id'] !== false && $_GET['collection_id'] !== '' ) ) + $zpr["collection_id"] = $_GET['collection_id']; + + $zpr["tag_id"] = false; + if ( isset($_GET['tag_id']) + && ( $_GET['tag_id'] != "false" && $_GET['tag_id'] !== false && $_GET['tag_id'] !== '' ) ) + { + $zpr["tag_id"] = $_GET['tag_id']; + // $zpr["collection_id"] = false; // Can have tags in collection + } + + // Author, year, style, limit, title + $zpr["author"] = false; if ( isset($_GET['author']) && $_GET['author'] != "false" && $_GET['author'] != "" ) $zpr["author"] = $_GET['author']; +// TESTING: urldecode + $zpr["author"] = urldecode($zpr["author"]); + + $zpr["year"] = false; if ( isset($_GET['year']) && $_GET['year'] != "false" && $_GET['year'] != "" ) $zpr["year"] = $_GET['year']; + $zpr["style"] = zp_Get_Default_Style(); if ( isset($_GET['style']) && $_GET['style'] != "false" && $_GET['style'] != "" && $_GET['style'] != "default" ) $zpr["style"] = $_GET['style']; + + // NOTE: With PHP 8, watch for URL params that are strings but need to be ints + if ( isset($_GET['limit']) + && (int) $_GET['limit'] != 0 ) + { + $zpr["limit"] = (int) $_GET['limit']; + $zpr["overwrite_request"] = true; + } + + $zpr["title"] = false; if ( isset($_GET['title']) ) $zpr["title"] = $_GET['title']; + + // Max tags, max results + $zpr["maxtags"] = false; if ( isset($_GET['maxtags']) ) $zpr["maxtags"] = (int) $_GET['maxtags']; + $zpr["maxresults"] = false; if ( isset($_GET['maxresults']) ) $zpr["maxresults"] = (int) $_GET['maxresults']; + + // Term, filter + $zpr["term"] = false; if ( isset($_GET['term']) ) $zpr["term"] = $_GET['term']; + $zpr["filter"] = false; if ( isset($_GET['filter']) ) $zpr["filter"] = $_GET['filter']; + + // Sorty by, order + $zpr["sortby"] = false; + $zpr["order"] = false; + $zpr["item_keys_order"] = array(); + + // Lib toplevel + // Set UNLESS there's a tag + $zpr["toplevel"] = false; + if ( isset($_GET['toplevel']) + && $zpr["tag_id"] === false ) + { + $zpr["toplevel"] = $_GET['toplevel']; + // $zpr["collection_id"] = false; + } + if ( $zpr["collection_id"] == "toplevel" ) + $zpr["collection_id"] = false; + + // SPECIAL SETTINGS + + if ( isset($_GET['sortby']) ) + { + if ($_GET['sortby'] == "author") { + $zpr["sortby"] = "creator"; + $zpr["order"] = "asc"; + } elseif ($_GET['sortby'] == "default") { + $zpr["sortby"] = "default"; + // entry order + } elseif ($_GET['sortby'] == "year") { + $zpr["sortby"] = "date"; + $zpr["order"] = "desc"; + } elseif ($zpr["type"] == "intext" && $_GET['sortby'] == "default") { + $zpr["sortby"] = "default"; + } else { + $zpr["sortby"] = $_GET['sortby']; + } + } + + if ( isset($_GET['order']) + && ( strtolower($_GET['order']) == "asc" || strtolower($_GET['order']) == "desc" ) ) + $zpr["order"] = strtolower($_GET['order']); + + // Show images, show tags, downloadable, inclusive, notes, abstracts, citeable + $zpr["showimage"] = false; + if ( isset($_GET['showimage']) ) + if ( $_GET['showimage'] == "yes" || $_GET['showimage'] == "true" + || $_GET['showimage'] === true || $_GET['showimage'] == 1 ) + $zpr["showimage"] = true; + elseif ( $_GET['showimage'] == "openlib" ) + $zpr["showimage"] = "openlib"; + + $zpr["showtags"] = false; + if ( isset($_GET['showtags']) + && ( $_GET['showtags'] == "yes" || $_GET['showtags'] == "true" + || $_GET['showtags'] === true || $_GET['showtags'] == 1 ) ) + $zpr["showtags"] = true; + + $zpr["downloadable"] = false; + if ( isset($_GET['downloadable']) + && ( $_GET['downloadable'] == "yes" || $_GET['downloadable'] == "true" || $_GET['downloadable'] === true || $_GET['downloadable'] == 1 ) ) + $zpr["downloadable"] = true; + + $zpr["inclusive"] = false; + if ( isset($_GET['inclusive']) + && ( $_GET['inclusive'] == "yes" || $_GET['inclusive'] == "true" || $_GET['inclusive'] === true || $_GET['inclusive'] == 1 ) ) + $zpr["inclusive"] = true; + + $zpr["shownotes"] = false; + if ( isset($_GET['shownotes']) + && ( $_GET['shownotes'] == "yes" || $_GET['shownotes'] == "true" || $_GET['shownotes'] === true || $_GET['shownotes'] == 1 ) ) + $zpr["shownotes"] = true; + + $zpr["showabstracts"] = false; + if ( isset($_GET['showabstracts']) + && ( $_GET['showabstracts'] == "yes" || $_GET['showabstracts'] == "true" || $_GET['showabstracts'] === true || $_GET['showabstracts'] == 1 ) ) + $zpr["showabstracts"] = true; + + $zpr["citeable"] = false; + if ( isset($_GET['citeable']) + && ( $_GET['citeable'] == "yes" || $_GET['citeable'] == "true" || $_GET['citeable'] === true || $_GET['citeable'] == 1 ) ) + $zpr["citeable"] = true; + + // Target, urlwrap, forcenum + $zpr["target"] = false; + if ( isset($_GET['target']) + && ( $_GET['target'] == "yes" || $_GET['target'] == "true" || $_GET['target'] === true || $_GET['target'] == 1 ) ) + $zpr["target"] = true; + + $zpr["urlwrap"] = false; + if ( isset($_GET['urlwrap']) && ( $_GET['urlwrap'] == "title" || $_GET['urlwrap'] == "image" ) ) + $zpr["urlwrap"] = $_GET['urlwrap']; + + $zpr["highlight"] = false; + if ( isset($_GET['highlight']) + && $_GET['highlight'] !== "" + && $_GET['highlight'] !== false + && $_GET['highlight'] !== 0 + && $_GET['highlight'] !== "false" ) $zpr["highlight"] = trim( htmlentities( $_GET['highlight'] ) ); + + $zpr["forcenumber"] = false; + if ( isset($_GET['forcenumber']) + && ( $_GET['forcenumber'] == "yes" || $_GET['forcenumber'] == "true" || $_GET['forcenumber'] === true || $_GET['forcenumber'] == 1 ) ) + $zpr["forcenumber"] = true; + + $zpr["request_start"] = 0; if ( isset($_GET['request_start']) ) $zpr["request_start"] = (int) $_GET['request_start']; + $zpr["request_last"] = 0; if ( isset($_GET['request_last']) ) $zpr["request_last"] = (int) $_GET['request_last']; + + return $zpr; + +} // function Zotpress_prep_ajax_request_vars + + +/** + * Preps and formats the Zotero API request URL. + * + * Handles all possible Zotpress parameters for bibliography + * shortcodes. Per user account. + * + * @param obj $wpdb WP DB object. + * @param arr $zpr Holds all params for request. + * @param arr $zp_request_queue Holds all requests for all accounts. + * @param str $api_user_id Optional. API user ID. + * + * @return arr $zp_request_queue The new request queue of formatted URLs. + */ +function Zotpress_prep_request_URL( $wpdb, $zpr, $zp_request_queue, $api_user_id=false, $zp_request_data=false ) +{ + $tempItemType = ""; + + // Get account and $api_user_id + if ($api_user_id) { + $zp_account = zp_get_account ($wpdb, $api_user_id); + } elseif ($zpr["api_user_id"]) { + $zp_account = zp_get_account ($wpdb, $zpr["api_user_id"]); + $api_user_id = $zpr["api_user_id"]; + } else + { + $zp_account = zp_get_account ($wpdb); + $api_user_id = $zp_account[0]->api_user_id; + } + + // Make sure account was founded (is synced) + if ( count($zp_account) > 0 ) + { + // Basic URL: User type, user id, item type + $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$api_user_id."/".$zpr["item_type"]; + + // Deal with item type Items + if ( $zpr['item_type'] == 'items' ) + { + // Account for single item with new style + if (gettype( $zpr["item_key"] ) == "string" + && strlen($zpr["item_key"]) > 0 + && $zpr["item_key"][0] == "{") { + $zpr_temp = explode(':', $zpr["item_key"]); + $zpr_temp = count($zpr_temp) > 1 ? $zpr_temp[1] : $zpr_temp[0]; + $zpr["item_key"] = rtrim( $zpr_temp, "}"); + // Account for page numbers + if ( strpos( $zpr["item_key"], ',' ) ) + { + $zpr_temp = explode(',', $zpr["item_key"]); + $zpr["item_key"] = rtrim( $zpr_temp[0], "}"); + } + } elseif (gettype( $zpr["item_key"] ) == "array" + && count( $zpr["item_key"] ) == 1 + && $zpr["item_key"][0][0] == "{") { + // $zpr["item_key"] = rtrim( explode(':', $zpr["item_key"][0])[1] , "}"); + $zpr["item_key"] = ltrim( rtrim( $zpr["item_key"][0], "}" ), "{" ); + // Account for page numbers + if ( strpos( $zpr["item_key"], ',' ) ) + { + $zpr_temp = explode(',', $zpr["item_key"]); + $zpr["item_key"] = rtrim( $zpr_temp[0], "}" ); + } + } + } // item type Items + + // Top + if ( $zpr["get_top"] ) $zp_import_url .= "/top"; + + // Single item key + if ( ! empty( $zp_request_queue ) + && ( ! isset( $zp_request_queue[$api_user_id]["items"] ) + || strpos($zp_request_queue[$api_user_id]["items"], ',') == false ) + ) + { + if (isset( $zp_request_data["items"] )) { + $zp_import_url .= "/" . $zp_request_data["items"]; + } elseif (gettype( $zpr["item_key"] ) == "array" + && count( $zpr["item_key"] ) == 1 + && strpos( $zpr["item_key"][0], ',' ) == false) { + $zp_import_url .= "/" . $zpr["item_key"][0]; + } elseif (gettype( $zpr["item_key"] ) == "string" + && ( strpos( $zpr["item_key"], "," ) === false + && strpos( $zpr["item_key"], ";" ) === false )) { + $zp_import_url .= "/" . $zpr["item_key"]; + } + } + if ( $zpr["collection_id"] ) $zp_import_url .= "/" . $zpr["collection_id"]; + if ( $zpr["sub"] ) $zp_import_url .= "/" . $zpr["sub"]; + $zp_import_url .= "?"; + + // Public key, if needed + if (!is_null($zp_account[0]->public_key) && trim($zp_account[0]->public_key) != "") + $zp_import_url .= "key=".$zp_account[0]->public_key."&"; + + // Style + $zp_import_url .= "style=".$zpr["style"]; + + // Format, limit, etc. + $zp_import_url .= "&format=json&include=data,bib&limit=".$zpr["limit"]; + + // Sort and order + if ( $zpr["sortby"] && $zpr["sortby"] != "default" ) { - $date = trim( str_replace( " ", "-", $date ) ); - $temp = explode ( " ", $date ); - - // If there's at least two parts to the date - if ( count( $temp) > 0 ) + $zp_import_url .= "&sort=".$zpr["sortby"]; + if ( $zpr["order"] ) $zp_import_url .= "&direction=".$zpr["order"]; + } + + // Start if multiple + if ( $zpr["request_start"] != 0 ) $zp_import_url .= "&start=".$zpr["request_start"]; + + // Multiple item keys + // EVENTUAL TODO: Limited to 50 item keys at a time ... can I get around this? + // TODO: Test this with a bib that has 50+ items + // if ( $zpr["item_key"] && strpos( $zpr["item_key"],"," ) !== false ) $zp_import_url .= "&itemKey=" . $zpr["item_key"]; + if ( $zp_request_data ) + { + if ( substr_count($zp_request_data["items"], ",") >= 50 ) + { + // Split items by comma + $items = explode( ",", $zp_request_data["items"] ); + + $requests = array(); + $request_items = array(); + + foreach ( $items as $item ) { + if ( count($request_items) < 50 ) { + $request_items[] = $item; + } + else { + $requests[] = $request_items; + unset( $request_items ); + } + } + + $zp_request_queue[$api_user_id]["requests"] = $requests; + } + else { + // TODO: Is this necessary? + // $zp_request_queue[$api_user_id]["requests"] = explode( ",", $zp_request_data["items"] ); + } + } + + // Itemtype-specific + if ( $zpr["itemtype"] ) + { + $zp_import_url .= "&itemType=" . urlencode( stripslashes( $zpr["itemtype"] )); + } + + // Tag-specific + if ( $zpr["tag_id"] ) + { + if ( strpos($zpr["tag_id"], ",") !== false ) { - // Check if name is first - if ( !is_numeric( $temp[0] ) ) - { - if ( in_array( $temp[0], $list_month_long ) ) - $date_formatted = array( - "year" => $temp[1], - "month" => array_search( $temp[0], $list_month_long ), - "day" => false - ); - else if ( in_array( $temp[0], $list_month_short ) ) - $date_formatted = array( - "year" => $temp[1], - "month" => array_search( $temp[0], $list_month_short ), - "day" => false - ); - else // Not a recognizable month word - $date_formatted = array( - "year" => $temp[0], // $temp[1] - "month" => false, - "day" => false - ); - } - // Otherwise, check if name is last - else + $temp = explode( ",", $zpr["tag_id"] ); + + foreach ( $temp as $temp_tag ) { - if ( count($temp) > 1 ) - { - if ( in_array( $temp[1], $list_month_long ) ) - $date_formatted = array( - "year" => $temp[0], - "month" => array_search( $temp[1], $list_month_long ), - "day" => false - ); - else if ( in_array( $temp[1], $list_month_short ) ) - $date_formatted = array( - "year" => $temp[0], - "month" => array_search( $temp[1], $list_month_short ), - "day" => false - ); - else // Not a recognizable month word - $date_formatted = array( - "year" => $temp[0], - "month" => false, - "day" => false - ); - } - else // Only one part in the array - { - $date_formatted = array( - "year" => $temp[0], - "month" => false, - "day" => false - ); - } + $zp_import_url .= "&tag=" . urlencode( stripslashes( $temp_tag )); } } - - // Otherwise, assume year else { - $date_formatted = array( - "year" => $temp[0], - "month" => false, - "day" => false - ); + $zp_import_url .= "&tag=" . urlencode( stripslashes( $zpr["tag_id"] )); } } - - // Format date in standard form: yyyy-mm-dd - $date_formatted = implode( "-", array_filter( $date_formatted ) ); - - //var_dump($date, $date_formatted, "

"); - - if ( !isset($date_formatted) ) $date_formatted = $date; - - return $date_formatted; - } - - - - /** - * Returns HTML-formatted subcollections for parent collection. - * - * Used by: shortcode.php - * - * @param resource $wpdb the WP db resource link - * @param string $api_user_id the Zotero API user ID - * @param string $parent the parent collection - * @param string $sortby what to sort by - * @param string $order the order of the sort, e.g. asc, desc - * @param string $link whether to add the URL - * - * @return string the HTML-formatted subcollections - */ - function zp_get_subcollections ($wpdb, $api_user_id, $parent, $sortby, $order, $link=false) - { - $zp_query = "SELECT ".$wpdb->prefix."zotpress_zoteroCollections.* FROM ".$wpdb->prefix."zotpress_zoteroCollections"; - $zp_query .= " WHERE api_user_id='".$api_user_id."' AND parent = '".$parent."' "; - - // Sort by and sort direction - if ($sortby) - { - if ($sortby == "default") $sortby = "retrieved"; - else if ($sortby == "date" || $sortby == "author") continue; - - $zp_query .= " ORDER BY ".$sortby." " . $order; - } - - $zp_results = $wpdb->get_results($zp_query, OBJECT); - - $zp_output = ""; - - //$zp_output = "
    • \n"; - $zp_output .= "
        \n"; - - foreach ($zp_results as $zp_collection) + + // Filtering: collections and tags take priority over authors and year + // EVENTUAL TODO: Searching by two+ values is not supported on the Zotero side ... + // For now, we get all and manually filter below + $zp_author_or_year_multiple = false; + + if ($zpr["collection_id"] || $zpr["tag_id"]) { + // Check if author or year is set + if ( $zpr["year"] || $zpr["author"] ) + { + // Check if author year is set and multiple + if ( ( $zpr["author"] && strpos( $zpr["author"], "," ) !== false ) + || ( $zpr["year"] && strpos( $zpr["year"], "," ) !== false ) ) + { + $zp_author_or_year_multiple = $zpr["author"] && strpos( $zpr["author"], "," ) !== false ? "author" : "year"; + } + else // Set but not multiple + { + $zp_import_url .= "&qmode=titleCreatorYear"; + if ( $zpr["author"] ) $zp_import_url .= "&q=".urlencode( $zpr["author"] ); + if ( $zpr["year"] && ! $zpr["author"] ) $zp_import_url .= "&q=".$zpr["year"]; + } + } + } elseif ($zpr["year"] || $zpr["author"]) { + $zp_import_url .= "&qmode=titleCreatorYear"; + if ( $zpr["author"] ) + { + // REVIEW: Deal with authors with multi-part last names + // Replace plus signs with spaces + if ( strpos( $zpr["author"], "+" ) !== -1 ) + $zpr["author"] = str_replace( '+', ' ', $zpr["author"] ); + + if ( $zpr["inclusive"] === false ) + { + $zp_authors = explode( ",", $zpr["author"] ); + $zp_import_url .= "&q=".urlencode( $zp_authors[0] ); + unset( $zp_authors[0] ); + $zpr["author"] = $zp_authors; + } + else // inclusive + { + $zp_import_url .= "&q=".urlencode( $zpr["author"] ); + } + } + // CHANGED (7.3): For some reason, urlencode will replace apostrophes + // with ' and then encode that to %26%23039%3B + // which breaks ... so let's replace with %27 manually + $zp_import_url = str_replace("%26%23039%3B", "%27", $zp_import_url); + // Deal with just year, no author + if ( $zpr["year"] && ! $zpr["author"] ) $zp_import_url .= "&q=".$zpr["year"]; + } + + // Avoid attachments and notes, if not using itemtype filtering + if ( ! $zpr["itemtype"] + && $zpr["item_type"] == "items" + || ( $zpr["sub"] && $zpr["sub"] == "items" ) ) + $zp_import_url .= "&itemType=-attachment+||+note"; + + // Deal with possible term + if ( $zpr["term"] ) + if ( $zpr["filter"] && $zpr["filter"] == "tag") + $zp_import_url .= "&tag=".urlencode( $wpdb->esc_like($zpr["term"]) ); + else + $zp_import_url .= "&q=".urlencode( $wpdb->esc_like($zpr["term"]) ); + + + // DEAL WITH MULTIPLE REQUESTS + // if ( count($zp_request_queue) > 0 ) + if ($zp_request_queue + && array_key_exists($api_user_id, $zp_request_queue)) { + // Assume items + // if ( array_key_exists("requests", $zp_request_queue[$api_user_id]) + // && count($zp_request_queue[$api_user_id]["requests"]) > 1 ) + // Multiple requests + if (array_key_exists("requests", $zp_request_queue[$api_user_id]) + && count($zp_request_queue[$api_user_id]["requests"]) > 1) { + $item_keys = ""; + foreach ( $zp_request_queue[$api_user_id]["requests"] as $num => $request ) { + if ( $item_keys != "" ) $item_keys .= ","; + $item_keys .= $request; + } + $zp_request_queue[$api_user_id]["requests"][$num] = $zp_import_url . "&itemKey=" . $item_keys; + } elseif (strpos( $zp_request_queue[$api_user_id]["items"], "," ) !== false) { + if ( is_array($zp_request_queue[$api_user_id]["items"]) ) + $zp_request_queue[$api_user_id]["items"] = implode(",", $zp_request_queue[$api_user_id]["items"]); + $zp_request_queue[$api_user_id]["requests"] = array( $zp_import_url . "&itemKey=" . $zp_request_queue[$api_user_id]["items"] ); + } else // one item + { + $zp_request_queue[$api_user_id]["requests"] = array( $zp_import_url ); + } + } elseif (! $zp_request_queue + && $api_user_id) { + // Assume normal + $zp_request_queue[$api_user_id]["requests"] = array( $zp_import_url ); + } else { - $zp_output .= "
      • "; - if ($link == "yes") - { - $zp_output .= ""; - } - $zp_output .= $zp_collection->title; - if ($link == "yes") { $zp_output .= ""; } - - // Thanks to @mlwk for 2+ level nexted collections fix - if ($zp_collection->numCollections > 0) - $zp_output .= zp_get_subcollections($wpdb, $api_user_id, $zp_collection->item_key, $sortby, $order, $link); - - $zp_output .= "
      • \n"; + // Assume broken or no requests + $zp_request_queue = false; + // Assume normal + // $zp_request_queue[$api_user_id]["requests"] = array( $zp_import_url ); } - - //$zp_output .= "
      \n"; - $zp_output .= "
    \n"; - - return $zp_output; - } - - - -?> \ No newline at end of file + } // count($zp_account) > 0 + + else // account not synced + { + $zp_request_queue = false; + } + + return $zp_request_queue; + +} // function Zotpress_prep_request_URL + + + +?> diff --git a/lib/shortcode/shortcode.intext.php b/lib/shortcode/shortcode.intext.php index 00bf000..06c5455 100644 --- a/lib/shortcode/shortcode.intext.php +++ b/lib/shortcode/shortcode.intext.php @@ -1,462 +1,196 @@ false, - 'items' => false, - - 'pages' => false, - 'format' => "(%a%, %d%, %p%)", - 'brackets' => false, - 'etal' => false, // default (false), yes, no - 'separator' => false, // default (comma), semicolon - 'and' => false, // default (no), and, comma-and - - 'userid' => false, - 'api_user_id' => false, - 'nickname' => false, - 'nick' => false - - ), $atts)); - - - - // PREPARE ATTRIBUTES - - if ($items) $items = str_replace('"','',html_entity_decode($items)); - else if ($item) $items = str_replace('"','',html_entity_decode($item)); - - $pages = str_replace('"','',html_entity_decode($pages)); - $format = str_replace('"','',html_entity_decode($format)); - $brackets = str_replace('"','',html_entity_decode($brackets)); - - $etal = str_replace('"','',html_entity_decode($etal)); - if ($etal == "default") { $etal = false; } - - $separator = str_replace('"','',html_entity_decode($separator)); - if ($separator == "default") { $separator = false; } - - $and = str_replace('"','',html_entity_decode($and)); - if ($and == "default") { $and = false; } - - if ($userid) { $api_user_id = str_replace('"','',html_entity_decode($userid)); } - if ($nickname) { $nickname = str_replace('"','',html_entity_decode($nickname)); } - if ($nick) { $nickname = str_replace('"','',html_entity_decode($nick)); } - - - - // GET ACCOUNTS - - global $wpdb; - - $zp_account = false; - - if ($nickname !== false) - { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'", OBJECT); +function zpStripQuotes($string) +{ + // Strip quotes and decode + $string = str_replace("”", "", str_replace('"','', html_entity_decode( $string ))); + return $string; +} + +function Zotpress_zotpressInText ($atts) +{ + /* + * GLOBAL VARIABLES + * + * $GLOBALS['zp_shortcode_instances'] {instantiated in zotpress.php} + * + */ + + extract(shortcode_atts(array( + + 'item' => false, + 'items' => false, + + 'pages' => false, + 'format' => "(%a%, %d%, %p%)", + 'brackets' => false, + 'etal' => false, // default (false), yes, no + 'separator' => false, // default (comma), semicolon + 'and' => false, // ampersand [default], and, comma, comma-amp, comma-and + + 'userid' => false, + 'api_user_id' => false, + 'nickname' => false, + 'nick' => false + + ), $atts)); + + + // PREPARE ATTRIBUTES + if ($items) { + $items = zpStripQuotes( str_replace(" ", "", $items )); + } elseif ($item) { + $items = zpStripQuotes( str_replace(" ", "", $item )); + } + + $pages = zpStripQuotes( $pages ); + $format = zpStripQuotes( $format ); + $brackets = zpStripQuotes( $brackets ); + + $etal = zpStripQuotes( $etal ); + if ( $etal == "default" ) $etal = false; + + $separator = zpStripQuotes( $separator ); + if ( $separator == "default" ) $separator = false; + + $and = zpStripQuotes( $and ); + if ( $and == "default" ) $and = false; + + if ( $userid ) $api_user_id = zpStripQuotes( $userid ); + if ( $nickname ) $nickname = zpStripQuotes( $nickname ); + if ( $nick ) $nickname = zpStripQuotes( $nick ); + + + + // GET ACCOUNTS + + global $wpdb; + + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_enqueue_script( 'zotpress.shortcode.intext'.$minify.'.js' ); + + $zp_account = false; + + if ($nickname !== false) { + $zp_account = eb_zotpress_get_account(false, $nickname); + if ( $zp_account !== null ) $api_user_id = $zp_account->api_user_id; + } elseif ($api_user_id !== false) { + $zp_account = eb_zotpress_get_account($api_user_id); + if ( $zp_account !== null ) + $api_user_id = $zp_account->api_user_id; + } elseif ($api_user_id === false && $nickname === false) { + if ( get_option("Zotpress_DefaultAccount") !== false ) + { + $api_user_id = get_option("Zotpress_DefaultAccount"); + $zp_account = eb_zotpress_get_account($api_user_id); } - else if ($api_user_id !== false) + else // When all else fails ... { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'", OBJECT); + $zp_account = eb_zotpress_get_account(); $api_user_id = $zp_account->api_user_id; } - else if ($api_user_id === false && $nickname === false) + } + + // Format in-text items: + // Handle the possible formats of item/s for in-text + // + // IN-TEXT FORMATS: + // [zotpressInText item="NCXAA92F"] + // [zotpressInText item="{NCXAA92F}"] + // [zotpressInText item="{NCXAA92F,10-15}"] + // [zotpressInText items="{NCXAA92F,10-15},{55MKF89B,1578},{3ITTIXHP}"] + // [zotpressInText items="{000001:NCXAA92F,10-15},{000003:3ITTIXHP}"] + // So no multiples without curlies or non-curlies in multiples + + $all_page_instances = array(); + + // // Add `ppp` in front of pages, so we can ignore pages later + // $intextitem["items"] = preg_replace( "/((?=[^}]),(?=[^{]))+/", ",ppp", $intextitem["items"] ); + // REVIEW: Actually, let's just remove pages + // $items = preg_replace( "/(((,))+([\w\d-]+(})+))++/", "}", $items ); + // REVIEW: Actually, we need them for now, remove later + // $items = preg_replace( "/((?=[^}]),(?=[^{]))+/", ",ppp", $items ); + + // Add api_user_id if not there + // if ( strpos( $items, $api_user_id ) === false ) // WRONG: assumes default/global api_user_id rather than the one for this shortcode + if ( strpos( $items, ":" ) === false ) + { + if (strpos( $items, "{" ) !== false) { + $items = str_replace( "{", "{".$api_user_id.":", $items ); + } elseif (strpos( $items, "," ) !== false) { + $items = "{".$api_user_id.":" . str_replace( ",", "},{".$api_user_id.":", $items )."}"; + } else // assume unformatted and single, so place at front { - if (get_option("Zotpress_DefaultAccount") !== false) - { - $api_user_id = get_option("Zotpress_DefaultAccount"); - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id ='".$api_user_id."'", OBJECT); - } - else // When all else fails ... - { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress LIMIT 1", OBJECT); - $api_user_id = $zp_account->api_user_id; - } + $items = "{".$api_user_id.":".$items."}"; } - - - // Generate instance id for shortcode - $zp_instance_id = "zotpress-".md5($api_user_id.$nickname.$pages.$items.$format); - - if ($items !== false) + } + + // Determine page instances and where + $temp_items = explode( "},{", $items ); + $all_np = true; + + foreach ( $temp_items as $id => $item ) + { + // if ( strpos( $item, "," ) !== false ) // assume page/s + // if ( preg_match( '/,(.)+\}/', $item, $match ) == 1 ) + if ( preg_match( '/,(.)+/', $item, $match ) == 1 ) { - - // PREPARE ITEM KEYS: Single, with or without curly bracket, or multiple - - if (strpos($items, "{") !== false) - { - if (strpos($items, "},") !== false) - { - $items = explode("},", $items); - foreach ($items as $id => $item) $items[$id] = explode(",", str_replace("{", "", str_replace("}", "", $item))); - } - else - { - $items = str_replace("{", "", str_replace("}", "", $items)); - if (strpos($items, ",") !== false) $items = explode(",", $items); - } - } - - - // PREPARE ITEM QUERY - - $zp_query = "SELECT items.*, ".$wpdb->prefix."zotpress_zoteroItemImages.image AS itemImage "; - - $zp_query .= "FROM ".$wpdb->prefix."zotpress_zoteroItems AS items "; - $zp_query .= "LEFT JOIN ".$wpdb->prefix."zotpress_zoteroItemImages - ON items.item_key=".$wpdb->prefix."zotpress_zoteroItemImages.item_key - AND items.api_user_id=".$wpdb->prefix."zotpress_zoteroItemImages.api_user_id "; - - $zp_query .= "WHERE items.api_user_id='".$api_user_id."' AND "; - - /*$zp_citation_attr = - array( - 'posts_per_page' => -1, - 'post_type' => 'zp_entry', - 'meta_key' => 'author', - 'orderby' => 'meta_value', - 'order' => 'ASC', - 'meta_query' => '' - ); - - $zp_citation_meta_query = - array( - 'relation' => 'AND', - array( - 'key' => 'api_user_id', - 'value' => $api_user_id, - 'compare' => '=' - ) - );*/ - - if ( is_array($items) ) - { - if ( count($items) == 2 && !is_array($items[0]) ) - { - $zp_query .= " items.item_key='" . $items[0] . "'"; - /*array_push( $zp_citation_meta_query, - array( - 'key' => 'item_key', - 'value' => $items[0], - 'compare' => '=' - ) - );*/ - } - else - { - $zp_query .= " items.item_key IN ( "; - foreach ($items as $id => $item) - { - $zp_query .= "'" . $item[0] . "'"; - if (count($items)-1 != $id) $zp_query .= ","; - /*array_push( $zp_citation_meta_query, - array( - 'key' => 'item_key', - 'value' => $items[0], - 'compare' => '=' - ) - );*/ - } - $zp_query .=" )"; - } - } - else // single item - { - $zp_query .= " items.item_key='" . $items . "'"; - /*array_push( $zp_citation_meta_query, - array( - 'key' => 'item_key', - 'value' => $items, - 'compare' => '=' - ) - );*/ - } - - //$zp_citation_attr['meta_query'] = $zp_citation_meta_query; - $zp_query .= " ORDER BY items.author ASC, items.zpdate ASC;"; - - - - // QUERY DATABASE - //var_dump($zp_query); - $zp_results = $wpdb->get_results($zp_query, OBJECT); - //var_dump($zp_results); - - $zp_intext_citation = ""; // Output for display - $zp_intext_citation_arr = array(); // Array for sorting - - - - // FORMAT IN-TEXT CITATION - - $prev_num = 1; - - foreach ($zp_results as $id => $item) - { - $zp_json = json_decode( $item->json ); - - // Determine author if "author" doesn't exist - if ( trim($item->author) == "" ) - { - if ( isset($zp_json->creators) && count($zp_json->creators) > 0 ) - { - foreach ( $zp_json->creators as $i => $zp_creator ) - { - $item->author = $zp_creator->name; - if ( $i != (count($zp_json->creators)-1) ) $item->author .= ", "; - } - } - else // assume no author exists; use title instead - { - $item->author .= "\"" . $item->title . "\""; - } - } - - // Shorten author ... - if ($etal) - { - if ($etal == "yes") $item->author = substr($item->author, 0, strpos($item->author, ",")) . " et al."; - } - else // default - { - if (isset($GLOBALS['zp_shortcode_instances'][get_the_ID()][$api_user_id.",".$item->item_key]) - && count(explode(",", $item->author)) > 3) - { - $item->author = substr($item->author, 0, strpos($item->author, ",")) . " et al."; - } - } - - // Deal with 'and' => false, // default (no), and, comma-and - if ($and) - { - if ($and == "and") - { - if ( strrpos($item->author, ",") !== false ) - $item->author = substr_replace( $item->author, " and", strrpos($item->author, ","), 1 ); - } - else if ($and == "comma-and") - { - if ( strrpos($item->author, ",") !== false ) - $item->author = substr_replace( $item->author, ", and", strrpos($item->author, ","), 1 ); - } - } - - // Determine %num% - // Determine if this citation has already been referenced - $num = false; - if (isset($GLOBALS['zp_shortcode_instances'][get_the_ID()]) && count($zp_results) >= 1) - { - $numloop = 1; - foreach ($GLOBALS['zp_shortcode_instances'][get_the_ID()] as $position => $instance) - { - if ($position == $api_user_id.",".$item->item_key) - { - $num = $numloop; - break; - } - $numloop++; - } - } - - // Determine what %num% is if not already referenced - if ($num === false) - if (isset($GLOBALS['zp_shortcode_instances'][get_the_ID()])) - $num = count($GLOBALS['zp_shortcode_instances'][get_the_ID()])+1; - else - $num = 1; - - // Fill in author, date and number - $citation = str_replace("%num%", $num, str_replace("%a%", $item->author, str_replace("%d%", zp_get_year($item->zpdate, true), $format))); - - // Deal with pages - if ($pages) - { - $citation = str_replace("%p%", $pages, $citation); - } - else // New way - { - if (is_array($items)) - { - if (count($items) == 2 && !is_array($items[0])) - { - $citation = str_replace("%p%", $items[1], $citation); - } - else - { - // Multiple citations -- shouldn't have page numbers - //if (isset($items[$id][1])) { - // $citation = str_replace("%p%", $items[$id][1], $citation); - //} - //else { - $citation = str_replace("%p%", "", str_replace(" %p%", "", str_replace(", %p%", "", $citation))); - //} - } - } - else // No pages - { - $citation = str_replace("%p%", "", str_replace(" %p%", "", str_replace(", %p%", "", $citation))); - } - } - - // Format for multiple (only expected characters) - if (count($zp_results) > 1) - { - if ($id == 0) - $citation = str_replace("]", "", str_replace(")", "", $citation)); - else if ($id == (count($zp_results)-1)) - $citation = str_replace("[", "", str_replace("(", " ", $citation)); - else - $citation = str_replace("]", "", str_replace("[", "", str_replace(")", "", str_replace("(", " ", $citation)))); - } - - // Deal with download - $item_download = false; if (isset($item->attachment_data)) $item_download = $item->attachment_data; - $item_download_key = false; if (isset($item->attachment_key)) $item_download_key = $item->attachment_key; - - // SET SORT ARRAY - $zp_intext_citation_arr[$api_user_id.",".$item->item_key] = array( - "instance_id" => $zp_instance_id, - "api_user_id" => $api_user_id, - "item_key" => $item->item_key, - "author" => $item->author, - "title" => $item->title, - "zpdate" => zp_get_year($item->zpdate), - "citation" => $citation, - "alphacount" => "" - ); - - // SET BIBLIOGRAPHY CITATIONS: Per item - $GLOBALS['zp_shortcode_instances'][get_the_ID()][$api_user_id.",".$item->item_key] = array( - "instance_id" => $zp_instance_id, - "userid" => $api_user_id, - "account_type" => $zp_account->account_type, - "public_key" => $zp_account->public_key, - "item_key" => $item->item_key, - "author" => $item->author, - "title" => $item->title, - "date" => zp_get_year($item->zpdate), - "download" => $item_download, - "download_key" => $item_download_key, - "image" => $item->itemImage, - "json" => $item->json, - "citation" => $item->citation, - "style" => $item->style, - "alphacount" => "" - ); - } - - // First, sort in-text items - //$zp_intext_citation_arr = subval_sort($zp_intext_citation_arr, "author", "asc"); - $zp_intext_citation_output_arr = array(); - - $zp_alphacount = ""; - $zp_alphacount_author = ""; - - // Then build output array - - foreach ( $zp_intext_citation_arr as $id => $item_arr ) - $zp_intext_citation_output_arr[count($zp_intext_citation_output_arr)] = $item_arr; - - - foreach ( $zp_intext_citation_output_arr as $i => $item ) - { - $zp_alphacount_this = ""; - - if ( isset($zp_intext_citation_output_arr[$i+1]["author"]) - && $item["author"] == $zp_intext_citation_output_arr[$i+1]["author"] - && $item["zpdate"] == $zp_intext_citation_output_arr[$i+1]["zpdate"] ) - { - if ( $zp_alphacount == "" ) - $zp_alphacount_this = "a"; - else - if ( $zp_alphacount_author != $item["author"] ) - $zp_alphacount_this = "a"; - else - $zp_alphacount_this = ++$zp_alphacount; - - $zp_alphacount_author = $item["author"]; - - // Update the counts on this and the next one - $item["alphacount"] = $zp_alphacount_this; - $GLOBALS['zp_shortcode_instances'][get_the_ID()][$item["api_user_id"].",".$item["item_key"]]["alphacount"] = $zp_alphacount_this; - $GLOBALS['zp_shortcode_instances'][get_the_ID()][$zp_intext_citation_output_arr[$i+1]["api_user_id"].",".$zp_intext_citation_output_arr[$i+1]["item_key"]]["alphacount"] = ++$zp_alphacount_this; - - $zp_alphacount = $zp_alphacount_this; - } - - $item["alphacount"] = $GLOBALS['zp_shortcode_instances'][get_the_ID()][$zp_intext_citation_output_arr[$i]["api_user_id"].",".$zp_intext_citation_output_arr[$i]["item_key"]]["alphacount"]; - - $zp_intext_citation .= "" . $item["citation"] . ""; - $zp_intext_citation = str_replace( "al..", "al.", $zp_intext_citation); - - // Determine delineation for multiple citations - if ( count($zp_intext_citation_arr) > 1 && $i != (count($zp_intext_citation_arr)-1) ) - if ( $separator && $separator == "comma" ) - $zp_intext_citation .= ","; - else - if ( isset($zp_intext_citation_output_arr[$i+1]["author"]) - && $item["author"] == $zp_intext_citation_output_arr[$i+1]["author"] ) - $zp_intext_citation .= ","; - else - if ( $brackets ) - $zp_intext_citation .= ", "; - else - $zp_intext_citation .= ";"; - } - - // Add brackets, if necessary - if ( $brackets ) $zp_intext_citation = "[" . $zp_intext_citation . "]"; - - return $zp_intext_citation; - - unset($zp_query); - unset($zp_results); - unset($zp_intext_citation); - unset($zp_intext_citation_arr); - unset($zp_intext_citation_output_arr); - - $wpdb->flush(); + // Remove curlies and commas + $all_page_instances[$id] = str_replace( "}", "", str_replace( ",", "", $match[0] ) ); + $all_np = false; } - - // Display notification if no citations found else { - return "\n
    Sorry, no citation(s) found.
    \n"; + $all_page_instances[$id] = "np"; } - - // Show theme scripts - $GLOBALS['zp_is_shortcode_displayed'] = true; - } - -?> \ No newline at end of file + // REVIEW: Replace ndashes and mdashes with dashes (7.3) + $items = str_replace("–", "-", str_replace("–", "-", $items)); + + // Remove pages from item key/s + $items = preg_replace( "/(((,))+([\w\d-]+(})+))++/", "}", $items ); + unset($temp_items); + + + // Generate instance id for shortcode + // REVIEW: Changed for new item format + // e.g., zp-ID--66010-FKNL6ECC-_-66010-FZF9BN8L--wp406 + // $instance_id = "zp-ID-".$api_user_id."-" . str_replace( " ", "_", str_replace( "&", "_", str_replace( "+", "_", str_replace( "/", "_", str_replace( "{", "-", str_replace( "}", "-", str_replace( ",", "_", $items ) ) ) ) ) ) ) ."-".get_the_ID(); + $instance_id = "zp-InText-zp-ID-" . str_replace( " ", "_", str_replace( "&", "_", str_replace( "+", "_", str_replace( "/", "_", str_replace( "{", "-", str_replace( "}", "-", str_replace( ":", "-", str_replace( ",", "_", $items ) ) ) ) ) ) ) ) ."-wp".get_the_ID(); + + // Set up array for this post, if it doesn't exist + if ( ! isset( $GLOBALS['zp_shortcode_instances'][get_the_ID()] ) ) + $GLOBALS['zp_shortcode_instances'][get_the_ID()] = array(); + + // Determine if all items are np + if ( $all_np ) + $all_page_instances = array("np"); + + // Then, add the instance to the array + // REVIEW: Don't need api_user_id ... or maybe need multiple? + // $GLOBALS['zp_shortcode_instances'][get_the_ID()][] = array( "instance_id" => $instance_id, "api_user_id" =>$api_user_id, "items" => $items ); + $GLOBALS['zp_shortcode_instances'][get_the_ID()][] = array( + "instance_id" => $instance_id, + "items" => $items, + "page_instances" => $all_page_instances + ); + + // Show theme scripts + $GLOBALS['zp_is_shortcode_displayed'] = true; + + // Output attributes and loading + // REVIEW: Changed for new format + // return ''; + $output = ''; + + return $output; +} + + +?> diff --git a/lib/shortcode/shortcode.intextbib.php b/lib/shortcode/shortcode.intextbib.php index c613620..b43109a 100644 --- a/lib/shortcode/shortcode.intextbib.php +++ b/lib/shortcode/shortcode.intextbib.php @@ -1,328 +1,219 @@ - false, - 'sortby' => "default", - 'sort' => false, - 'order' => false, - - 'image' => false, - 'images' => false, - 'showimage' => "no", - - 'showtags' => "no", - 'title' => "no", - 'download' => "no", - 'downloadable' => false, - 'notes' => false, - 'abstract' => false, - 'abstracts' => false, - 'cite' => false, - 'citeable' => false, - 'target' => false, - 'forcenumber' => false - ), $atts)); - - - - // FORMAT PARAMETERS - $style = str_replace('"','',html_entity_decode($style)); - $sortby = str_replace('"','',html_entity_decode($sortby)); - - if ($order) $order = str_replace('"','',html_entity_decode($order)); - else if ($sort) $order = str_replace('"','',html_entity_decode($sort)); - else $order = "ASC"; - - // Show image - if ($showimage) $showimage = str_replace('"','',html_entity_decode($showimage)); - if ($image) $showimage = str_replace('"','',html_entity_decode($image)); - if ($images) $showimage = str_replace('"','',html_entity_decode($images)); - - if ($showimage == "yes" || $showimage == "true" || $showimage === true) $showimage = true; - else $showimage = false; - - // Show tags - if ($showtags == "yes" || $showtags == "true" || $showtags === true) $showtags = true; - else $showtags = false; - - $title = str_replace('"','',html_entity_decode($title)); - - if ($download) $download = str_replace('"','',html_entity_decode($download)); - else if ($downloadable) $download = str_replace('"','',html_entity_decode($downloadable)); - if ($download == "yes" || $download == "true" || $download === true) $download = true; else $download = false; - - $notes = str_replace('"','',html_entity_decode($notes)); - - if ($abstracts) $abstracts = str_replace('"','',html_entity_decode($abstracts)); - else if ($abstract) $abstracts = str_replace('"','',html_entity_decode($abstract)); - - if ($cite) $cite = str_replace('"','',html_entity_decode($cite)); - else if ($citeable) $cite = str_replace('"','',html_entity_decode($citeable)); - - if ($target == "new" || $target == "yes" || $target == "_blank" || $target == "true" || $target === true) $target = true; - else $target = false; - - if ($forcenumber == "yes" || $forcenumber == "true" || $forcenumber === true) - $forcenumber = true; else $forcenumber = false; - - - // SORT BY AND SORT ORDER - if ( $sortby != "default" && isset($GLOBALS['zp_shortcode_instances'][get_the_ID()]) ) - $GLOBALS['zp_shortcode_instances'][get_the_ID()] = subval_sort( $GLOBALS['zp_shortcode_instances'][get_the_ID()], $sortby, $order ); - - // TITLE: Sort by date and add headings - if ( ( strtolower($title) == "yes" || strtolower($title) == "true" ) && isset($GLOBALS['zp_shortcode_instances'][get_the_ID()]) ) - $GLOBALS['zp_shortcode_instances'][get_the_ID()] = subval_sort( $GLOBALS['zp_shortcode_instances'][get_the_ID()], "date", $order ); - - - // DISPLAY IN-TEXT BIBLIOGRAPHY - - $current_title = ""; - $citation_abstract = ""; - $citation_tags = ""; - $citation_notes = array(); - $zp_notes_num = 1; - - $zp_output = "\n
    \n\n"; - $zp_output .= "" . ZOTPRESS_PLUGIN_URL . "\n\n"; - - //$zp_output .= "Checking ...\n\n"; - - // Add style, if set - if ($style) $zp_output .= "".$style."\n\n"; - - if ( isset($GLOBALS['zp_shortcode_instances'][get_the_ID()]) ) - { - foreach ($GLOBALS['zp_shortcode_instances'][get_the_ID()] as $item => $zp_citation) - { - $citation_image = false; - $has_citation_image = false; - $zp_this_meta = json_decode( $zp_citation["json"] ); - $zp_output .= "".$zp_citation['userid']."\n\n"; - - // AUTOUPDATE - //if (!isset($_SESSION['zp_session'][$zp_citation['userid']]['key'])) - // $_SESSION['zp_session'][$zp_citation['userid']]['key'] = substr(number_format(time() * rand(),0,'',''),0,10); /* Thanks to http://elementdesignllc.com/2011/06/generate-random-10-digit-number-in-php/ */ - //$zp_output .= "" . $_SESSION['zp_session'][$zp_citation['userid']]['key'] . "\n\n"; - - // IMAGE - if ($showimage == "yes" && is_null($zp_citation["image"]) === false && $zp_citation["image"] != "") - { - if ( is_numeric($zp_citation["image"]) ) - { - $zp_citation["image"] = wp_get_attachment_image_src( $zp_citation["image"], "full" ); - $zp_citation["image"] = $zp_citation["image"][0]; - } - - $citation_image = "
    "; - $citation_image .= "image"; - $citation_image .= "
    \n"; - $has_citation_image = " zp-HasImage"; - } - - // TAGS - // Grab tags associated with item - if ( $showtags ) - { - global $wpdb; - - $zp_showtags_query = "SELECT DISTINCT ".$wpdb->prefix."zotpress_zoteroTags.title FROM ".$wpdb->prefix."zotpress_zoteroTags LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemTags ON ".$wpdb->prefix."zotpress_zoteroRelItemTags.tag_title=".$wpdb->prefix."zotpress_zoteroTags.title WHERE ".$wpdb->prefix."zotpress_zoteroRelItemTags.item_key='".$zp_citation["item_key"]."' ORDER BY ".$wpdb->prefix."zotpress_zoteroTags.title ASC;"; - $zp_showtags_results = $wpdb->get_results($zp_showtags_query, ARRAY_A); - - if ( count($zp_showtags_results) > 0) - { - $citation_tags = "

    Tags: "; - - foreach ($zp_showtags_results as $i => $zp_showtags_tag) - { - $citation_tags .= "" . $zp_showtags_tag["title"] . ""; - if ( $i != (count($zp_showtags_results)-1) ) $citation_tags .= ", "; - } - $citation_tags .= "

    \n"; - } - unset($zp_showtags_results); - unset($zp_showtags_query); - } - - // ABSTRACT - if ($abstracts) - { - if (isset($zp_this_meta->abstractNote) && strlen(trim($zp_this_meta->abstractNote)) > 0) - { - $citation_abstract = "

    Abstract: " . sprintf($zp_this_meta->abstractNote) . "

    \n"; - } - } - - // NOTES - if ($notes == "yes") - { - global $wpdb; - - $zp_notes = $wpdb->get_results("SELECT json FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$zp_citation['userid']."' - AND parent = '".$zp_citation["item_key"]."' AND itemType = 'note';", OBJECT); - - if (count($zp_notes) > 0) - { - $temp_notes = "
  • \n"; - - // Only create a list if there's more than one note for this item - if ( count($zp_notes) == 1 ) - { - $note_json = json_decode($zp_notes[0]->json); - $temp_notes .= $note_json->note . "\n"; - } - else if ( count($zp_notes) > 1 ) - { - $temp_notes .= "
      \n"; - - foreach ($zp_notes as $note) - { - $note_json = json_decode($note->json); - $temp_notes .= "
    • " . $note_json->note . "\n
    • \n"; - } - $temp_notes .= "\n
    "; - } - - $temp_notes .= "\n
  • \n\n"; - - $citation_notes[count($citation_notes)] = $temp_notes; - - // Add note reference - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " ".$zp_notes_num." " . '$2', $zp_citation['citation'], 1); - $zp_notes_num++; - } - unset($zp_notes); - } - - // Hyperlink URL: Has to go before Download - if (isset($zp_this_meta->url) && strlen($zp_this_meta->url) > 0) - { - $zp_url_replacement = "url)))."'>".urldecode(urlencode(htmlentities($zp_this_meta->url))).""; - - // Replace ampersands - $zp_citation['citation'] = str_replace(htmlspecialchars($zp_this_meta->url), $zp_this_meta->url, $zp_citation['citation']); - - // Then replace with linked URL - $zp_citation['citation'] = str_replace($zp_this_meta->url, $zp_url_replacement, $zp_citation['citation']); - } - - // DOWNLOAD - if ( $download ) - { - global $wpdb; - // - //$zp_download_url = $wpdb->get_row("SELECT item_key, citation, json, linkMode FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$zp_citation['userid']."' - // AND parent = '".$zp_citation["item_key"]."' AND linkMode IN ( 'imported_file', 'linked_url' ) ORDER BY linkMode ASC LIMIT 1;", OBJECT); - - //$zp_download_url = json_decode($zp_citation["download"]); - - $zp_download = $wpdb->get_results( - " - SELECT * FROM - ( - SELECT - ".$wpdb->prefix."zotpress_zoteroItems.parent AS parent, - ".$wpdb->prefix."zotpress_zoteroItems.citation AS content, - ".$wpdb->prefix."zotpress_zoteroItems.item_key AS item_key, - ".$wpdb->prefix."zotpress_zoteroItems.json AS data, - ".$wpdb->prefix."zotpress_zoteroItems.linkmode AS linkmode - FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE api_user_id='".$zp_citation["userid"]."' - AND ".$wpdb->prefix."zotpress_zoteroItems.parent = '".$zp_citation["item_key"]."' - AND ".$wpdb->prefix."zotpress_zoteroItems.linkmode IN ( 'imported_file', 'linked_url' ) - ORDER BY linkmode ASC - ) - AS attachments_sub - GROUP BY parent; - " - , OBJECT - ); - - if ( count($zp_download) > 0 ) - { - $zp_download_url = json_decode($zp_download[0]->data); - - if ($zp_download_url->linkMode == "imported_file") - { - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Download " . '$2', $zp_citation['citation'], 1); // Thanks to http://ideone.com/vR073 - } - else - { - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Download " . '$2', $zp_citation['citation'], 1); - } - - unset($zp_download_url); - unset($zp_download); - } - } - - // CITE LINK - if ($cite == "yes" || $cite == "true" || $cite === true) - { - $cite_url = "https://api.zotero.org/".$zp_citation["account_type"]."/".$zp_citation['userid']."/items/".$zp_citation["item_key"]."?format=ris"; - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Cite " . '$2', $zp_citation['citation'], 1); - } - - // TITLE - if (strtolower($title) == "yes" || strtolower($title) == "true") - { - if ($current_title == "" || (strlen($current_title) > 0 && $current_title != $zp_citation["date"])) - { - $current_title = $zp_citation["date"]; - $zp_output .= "

    ".$current_title."

    \n"; - } - } - - // HYPERLINK DOIs - if ( isset($zp_this_meta->DOI) ) - $zp_citation['citation'] = str_replace( 'http://doi.org/'.$zp_this_meta->DOI, "http://doi.org/".$zp_this_meta->DOI."", $zp_citation['citation'] ); - - // SHOW CURRENT STYLE AS REL - $zp_citation['citation'] = str_replace( "class=\"csl-bib-body\"", "rel=\"".$zp_citation['style']."\" class=\"csl-bib-body\"", $zp_citation['citation'] ); - - // Add alphabetical dates - $zp_citation['citation'] = str_replace( $zp_citation["date"], $zp_citation["date"].$zp_citation["alphacount"], $zp_citation['citation'] ); - - // OUTPUT - $zp_output .= "
    \n"; - $zp_output .= $citation_image . $zp_citation['citation'] . $citation_abstract . $citation_tags . "\n"; - $zp_output .= "
    \n\n"; - } - } - - // DISPLAY NOTES, if exist - if ( count($citation_notes) > 0 ) - { - $zp_output .= "
    \n

    Notes

    \n
      \n"; - - foreach ( $citation_notes as $citation_note ) - $zp_output .= $citation_note; - - $zp_output .= "
    \n
    \n\n"; - } - - $zp_output .= "\n\n"; - - // Show theme scripts - $GLOBALS['zp_is_shortcode_displayed'] = true; - - return $zp_output; - } - -?> \ No newline at end of file + false, + 'sortby' => "default", + 'sort' => false, + 'order' => false, + + 'image' => false, + 'images' => false, + 'showimage' => "no", + 'showtags' => "no", + + 'title' => "no", + + 'download' => "no", + 'downloadable' => false, + 'notes' => false, + 'abstract' => false, + 'abstracts' => false, + 'cite' => false, + 'citeable' => false, + + 'target' => false, + 'urlwrap' => false, + + 'highlight' => false, + 'forcenumber' => false, + 'forcenumbers' => false + + ), $atts)); + + + + // FORMAT PARAMETERS + $style = str_replace('"','',html_entity_decode($style)); + $sortby = str_replace('"','',html_entity_decode($sortby)); + + if ($order) { + $order = str_replace('"','',html_entity_decode($order)); + } elseif ($sort) { + $order = str_replace('"','',html_entity_decode($sort)); + } else $order = "asc"; + $order = strtolower($order); + + // Show image + if ($showimage) $showimage = str_replace('"','',html_entity_decode($showimage)); + if ($image) $showimage = str_replace('"','',html_entity_decode($image)); + if ($images) $showimage = str_replace('"','',html_entity_decode($images)); + + if ($showimage == "yes" || $showimage == "true" || $showimage === true) { + $showimage = true; + } elseif ($showimage === "openlib") { + $showimage = "openlib"; + } else $showimage = false; + + // Show tags + $showtags = $showtags == "yes" || $showtags == "true" || $showtags === true; + + $title = str_replace('"','',html_entity_decode($title)); + + if ($download) { + $download = str_replace('"','',html_entity_decode($download)); + } elseif ($downloadable) { + $download = str_replace('"','',html_entity_decode($downloadable)); + } + $download = $download == "yes" || $download == "true" || $download === true; + + $shownotes = str_replace('"','',html_entity_decode($notes)); + + if ($abstracts) { + $abstracts = str_replace('"','',html_entity_decode($abstracts)); + } elseif ($abstract) { + $abstracts = str_replace('"','',html_entity_decode($abstract)); + } + + if ($citeable) { + $citeable = str_replace('"','',html_entity_decode($citeable)); + } elseif ($cite) { + $citeable = str_replace('"','',html_entity_decode($cite)); + } + + if ($target == "new" || $target == "yes" || $target == "_blank" || $target == "true" || $target === true) $target = true; + else $target = false; + + $urlwrap = $urlwrap == "title" || $urlwrap == "image" ? str_replace('"','',html_entity_decode($urlwrap)) : false; + + $highlight = $highlight ? str_replace('"','',html_entity_decode($highlight)) : false; + + if ($forcenumber == "yes" || $forcenumber == "true" || $forcenumber === true) + $forcenumber = true; + if ($forcenumbers == "yes" || $forcenumbers == "true" || $forcenumbers === true) + $forcenumber = true; + + // Set up request vars + $request_start = 0; + $request_last = 0; + $overwrite_last_request = false; + $update = false; + + // Set up item key + $item_key = ""; + + + // Get in-text items + if ( isset( $GLOBALS['zp_shortcode_instances'][get_the_ID()] ) ) + { + // Handle the possible formats of item/s for in-text + // + // IN-TEXT FORMATS: + // [zotpressInText item="NCXAA92F"] + // [zotpressInText item="{NCXAA92F}"] + // [zotpressInText item="{NCXAA92F,10-15}"] + // [zotpressInText items="{NCXAA92F,10-15},{55MKF89B,1578},{3ITTIXHP}"] + // [zotpressInText items="{000001:NCXAA92F,10-15},{000003:3ITTIXHP}"] + // So no multiples without curlies or non-curlies in multiples + + foreach ( $GLOBALS['zp_shortcode_instances'][get_the_ID()] as $intextitem ) + { + // REVIEW: Actually, let's just remove pages + $intextitem["items"] = preg_replace( "/(((,))+([\w\d-]+(})+))++/", "}", $intextitem["items"] ); + + // Add separator if not the start + if ( $item_key != "" ) $item_key .= ";"; + + // Add to the item key + $item_key .= $intextitem["items"]; + } + } + + // Generate instance id for shortcode + // REVIEW: Added Post ID and newish attributes + $instance_id = "zotpress-".md5($item_key.$style.$sortby.$order.$title.$showimage.$showtags.$download.$shownotes.$abstracts.$citeable.$target.$urlwrap.$forcenumber.$highlight.get_the_ID()); + + + // GENERATE IN-TEXT BIB STRUCTURE + $zp_output = "\n
    "; + $zp_output .= ' + + + + + + + + + + + + + + + + '; + + // + // ' + + // $zp_output .= "
    \n\n"; + $zp_output .= "
    "; + + $_GET['instance_id'] = $instance_id; + // $_GET['api_user_id'] = $api_user_id; + $_GET['item_key'] = $item_key; + // $_GET['collection_id'] = $collection_id; + // $_GET['tag_id'] = $tag_id; + // $_GET['author'] = $author; + // $_GET['year'] = $year; + // $_GET['item_type'] = $item_type; + // $_GET['inclusive'] = $inclusive; + $_GET['style'] = $style; + // $_GET['limit'] = $limit; + $_GET['sortby'] = $sortby; + $_GET['order'] = $order; + $_GET['title'] = $title; + $_GET['showimage'] = $showimage; + $_GET['showtags'] = $showtags; + $_GET['downloadable'] = $downloadable; + $_GET['shownotes'] = $shownotes; + $_GET['abstracts'] = $abstracts; + $_GET['citeable'] = $citeable; + $_GET['target'] = $target; + $_GET['urlwrap'] = $urlwrap; + $_GET['forcenumber'] = $forcenumber; + $_GET['highlight'] = $highlight; + + $_GET['request_start'] = $request_start; + $_GET['request_last'] = $request_last; + // $_GET['is_dropdown'] = $is_dropdown; + // $_GET['maxresults'] = $maxresults; + // $_GET['maxperpage'] = $maxperpage; + // $_GET['maxtags'] = $maxtags; + // $_GET['term'] = $term; + $_GET['update'] = $update; + $_GET['overwrite_last_request'] = $overwrite_last_request; + + $zp_output .= "\n
    "; + $zp_output .= Zotpress_shortcode_request( true ); // Check catche first + $zp_output .= "
    \n"; + + // Show theme scripts + $GLOBALS['zp_is_shortcode_displayed'] = true; + + return $zp_output . "
    \n\n"; +} + +?> diff --git a/lib/shortcode/shortcode.lib.php b/lib/shortcode/shortcode.lib.php index 3e65282..409aaef 100644 --- a/lib/shortcode/shortcode.lib.php +++ b/lib/shortcode/shortcode.lib.php @@ -1,126 +1,188 @@ false, // deprecated - 'userid' => false, - 'nickname' => false, - 'nick' => false, - - 'type' => false, // dropdown, searchbar - 'searchby' => false, // searchbar only - all [default], collections, items, tags - 'minlength' => 3, // searchbar only - 3 [default] - 'maxresults' => 100, - 'maxperpage' => 10, - - 'cite' => false, - 'citeable' => false, - 'download' => false, - 'downloadable' => false - - ), $atts, "zotpress")); - - - // FORMAT PARAMETERS - - // Filter by account - if ($user_id) $api_user_id = str_replace('"','',html_entity_decode($user_id)); - else if ($userid) $api_user_id = str_replace('"','',html_entity_decode($userid)); - else $api_user_id = false; - - if ($nickname) $nickname = str_replace('"','',html_entity_decode($nickname)); - if ($nick) $nickname = str_replace('"','',html_entity_decode($nick)); - - - // Type of display - if ( $type ) $type = str_replace('"','',html_entity_decode($type)); - else $type = "dropdown"; - - // Enqueue autocomplete UI scripts if type is "searchbar" - if ( $type == "searchbar" ) - { - wp_enqueue_script( 'jquery-ui-autocomplete' ); - wp_enqueue_script( 'zotpress.lib.searchbar.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.lib.searchbar.js', array( 'jquery' ) ); - } - - - // Filters - if ( $searchby ) $searchby = str_replace('"','',html_entity_decode($searchby)); - - // Min length - if ( $minlength ) $minlength = str_replace('"','',html_entity_decode($minlength)); - - // Max results - if ( $maxresults ) $maxresults = str_replace('"','',html_entity_decode($maxresults)); - - // Max per page - if ( $maxperpage ) $maxperpage = str_replace('"','',html_entity_decode($maxperpage)); - - // Citeable - if ( $cite ) $cite = str_replace('"','',html_entity_decode($cite)); - if ( $citeable ) $cite = str_replace('"','',html_entity_decode($citeable)); - - // Downloadable - if ( $download ) $download = str_replace('"','',html_entity_decode($download)); - if ( $downloadable ) $download = str_replace('"','',html_entity_decode($downloadable)); - - - // Get API User ID - - global $wpdb; - - if ($nickname !== false) +require(__DIR__ . '/shortcode.class.lib.php'); + +function Zotpress_zotpressLib( $atts ) +{ + extract( shortcode_atts( array( + + 'user_id' => false, // deprecated + 'userid' => false, + 'nickname' => false, + 'nick' => false, + + 'type' => false, // dropdown, searchbar + 'searchby' => false, // searchbar only - all [default], collections, items, tags + 'minlength' => 3, // searchbar only - 3 [default] + 'maxresults' => 20, + 'maxperpage' => 10, + 'maxtags' => 100, // dropdown only + + 'sortby' => 'default', + 'order' => 'asc', + + 'collection_id' => false, + 'collection' => false, + 'collections' => false, // only single for now, though + + 'style' => false, + 'cite' => false, + 'citeable' => false, + 'download' => false, + 'downloadable' => false, + 'showimage' => false, + 'showimages' => false, + 'showtags' => false, // not implemented + 'abstract' => false, // not implemented + 'notes' => false, // not implemented + 'forcenumber' => false, // not implemented + + 'toplevel' => 'toplevel', + + 'target' => false, + 'urlwrap' => false, + + 'browsebar' => true // added 7.3.1 + + ), $atts, "zotpress")); + + + // FORMAT PARAMETERS + + // Filter by account + if ($user_id) { + $api_user_id = str_replace('"','',html_entity_decode($user_id)); + } elseif ($userid) { + $api_user_id = str_replace('"','',html_entity_decode($userid)); + } else $api_user_id = false; + + if ($nickname) $nickname = str_replace('"','',html_entity_decode($nickname)); + if ($nick) $nickname = str_replace('"','',html_entity_decode($nick)); + + + // Type of display + $type = $type ? str_replace('"','',html_entity_decode($type)) : "dropdown"; + + // Filter by collection + if ($collection_id) { + $collection_id = zp_clean_param( $collection_id ); + } elseif ($collection) { + $collection_id = zp_clean_param( $collection ); + } elseif ($collections) { + $collection_id = zp_clean_param( $collections ); + } elseif (isset($_GET['collection_id']) + && preg_match("/^[a-zA-Z0-9]+$/", $_GET['collection_id'])) { + $collection_id = zp_clean_param( $_GET['collection_id'] ); + } elseif (isset($_GET['subcollection_id']) + && preg_match("/^[a-zA-Z0-9]+$/", $_GET['subcollection_id'])) { + $collection_id = zp_clean_param( $_GET['subcollection_id'] ); + } + + // Filters + if ( $searchby ) $searchby = str_replace('"','',html_entity_decode($searchby)); + + // Style + if ( $style ) $style = str_replace('"','',html_entity_decode($style)); + + // Min length + if ( $minlength ) $minlength = str_replace('"','',html_entity_decode($minlength)); + + // Max results + if ( $maxresults ) $maxresults = str_replace('"','',html_entity_decode($maxresults)); + + // Max per page + if ( $maxperpage ) $maxperpage = str_replace('"','',html_entity_decode($maxperpage)); + + // Max tags + if ( $maxtags ) $maxtags = str_replace('"','',html_entity_decode($maxtags)); + + // Sortby + if ( $sortby ) $sortby = str_replace('"','',html_entity_decode($sortby)); + + // Order + if ( $order ) $order = str_replace('"','',html_entity_decode($order)); + + // Citeable + if ( $cite ) $cite = str_replace('"','',html_entity_decode($cite)); + if ( $citeable ) $cite = str_replace('"','',html_entity_decode($citeable)); + + // Downloadable + if ( $download ) $download = str_replace('"','',html_entity_decode($download)); + if ( $downloadable ) $download = str_replace('"','',html_entity_decode($downloadable)); + + // Show tags + if ( $showtags ) $showtags = str_replace('"','',html_entity_decode($showtags)); + if ( strpos( $searchby, "tags" ) !== false ) $showtags = true; + + // Show image + if ( $showimages ) $showimage = str_replace('"','',html_entity_decode($showimages)); + if ( $showimage ) $showimage = str_replace('"','',html_entity_decode($showimage)); + + if ( $urlwrap ) $urlwrap = str_replace('"','',html_entity_decode($urlwrap)); + + if ( $toplevel ) $toplevel = str_replace('"','',html_entity_decode($toplevel)); + + $target = $target && $target != "no"; + + if ( $browsebar ) $browsebar = str_replace('"','',html_entity_decode($browsebar)); + + + // Get API User ID + + global $wpdb; + + if ($nickname !== false) { + $zp_account = eb_zotpress_get_account(false, $nickname); + if ( is_null($zp_account) ): echo "

    Sorry, but the selected Zotpress nickname can't be found.

    "; return false; endif; + $api_user_id = $zp_account->api_user_id; + } elseif ($api_user_id !== false) { + $zp_account = eb_zotpress_get_account($api_user_id); + if ( is_null($zp_account) ): echo $api_user_id."

    Sorry, but the selected Zotpress account can't be found.

    "; return false; endif; + $api_user_id = $zp_account->api_user_id; + } elseif ($api_user_id === false && $nickname === false) { + if (get_option("Zotpress_DefaultAccount") !== false) { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'", OBJECT); - - if ( is_null($zp_account) ): echo "

    Sorry, but the selected Zotpress nickname can't be found.

    "; return false; endif; - - $api_user_id = $zp_account->api_user_id; + $api_user_id = get_option("Zotpress_DefaultAccount"); + $zp_account = eb_zotpress_get_account($api_user_id); } - else if ($api_user_id !== false) + else // When all else fails ... { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'", OBJECT); - - if ( is_null($zp_account) ): echo "

    Sorry, but the selected Zotpress account can't be found.

    "; return false; endif; - + $zp_account = eb_zotpress_get_account(); $api_user_id = $zp_account->api_user_id; } - else if ($api_user_id === false && $nickname === false) - { - if (get_option("Zotpress_DefaultAccount") !== false) - { - $api_user_id = get_option("Zotpress_DefaultAccount"); - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id ='".$api_user_id."'", OBJECT); - } - else // When all else fails ... - { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress LIMIT 1", OBJECT); - $api_user_id = $zp_account->api_user_id; - } - } - - - // Use Browse class - - $zpLib = new zotpressBrowse; - - $zpLib->setAccount($zp_account); - $zpLib->setType($type); - if ( $searchby ) $zpLib->setFilters($searchby); - $zpLib->setMinLength($minlength); - $zpLib->setMaxResults($maxresults); - $zpLib->setMaxPerPage($maxperpage); - $zpLib->setCiteable($cite); - $zpLib->setDownloadable($download); - - $zpLib->getLib(); - } - - -?> \ No newline at end of file + } + + + // Use Browse class + + $zpLib = new zotpressLib; + + $zpLib->setAccount($zp_account); + $zpLib->setType($type); + if ( $searchby ) $zpLib->setFilters($searchby); + $zpLib->setMinLength($minlength); + $zpLib->setMaxResults($maxresults); + $zpLib->setMaxPerPage($maxperpage); + $zpLib->setMaxTags($maxtags); + $zpLib->setStyle($style); + $zpLib->setSortBy($sortby); + $zpLib->setOrder($order); + $zpLib->setCollection($collection_id); + $zpLib->setCiteable($cite); + $zpLib->setDownloadable($download); + $zpLib->setShowTags($showtags); + $zpLib->setShowImage($showimage); + $zpLib->setURLWrap($urlwrap); + $zpLib->setTopLevel($toplevel); + $zpLib->setTarget($target); + $zpLib->setBrowseBar($browsebar); + + // Show theme scripts + $GLOBALS['zp_is_shortcode_displayed'] = true; + + return $zpLib->getLib(); +} + + +?> diff --git a/lib/shortcode/shortcode.lib.search.php b/lib/shortcode/shortcode.lib.search.php deleted file mode 100644 index 693367c..0000000 --- a/lib/shortcode/shortcode.lib.search.php +++ /dev/null @@ -1,173 +0,0 @@ - 403 ) ); - - global $wpdb; - - header('Content-type: text/html; charset=utf-8'); - - - // Determine account - if ( isset($_GET['user']) && preg_match("/^[0-9]+$/", $_GET['user']) == 1 ) - { - $zp_api_user_id = $_GET['user']; - } - else // No user id passed through - { - if (get_option("Zotpress_DefaultAccount")) - { - $zp_api_user_id = get_option("Zotpress_DefaultAccount"); - } - else - { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress LIMIT 1", OBJECT); - $zp_api_user_id = $zp_account->api_user_id; - } - } - - - // Determine filter, if any - $filter = "item"; if ( isset($_GET['filter']) && preg_match("/^[a-z]+$/", $_GET['filter']) == 1 ) $filter = $_GET['filter']; - - // Determine max results, if set - $limit = "100"; if ( isset($_GET['maxresults']) && preg_match("/^[0-9]+$/", $_GET['maxresults']) == 1 ) $limit = $_GET['maxresults']; - - - if ( $filter ) - { - if ( $filter == "item" ) - { - $tempquery = - " - SELECT DISTINCT ".$wpdb->prefix."zotpress_zoteroItems.author, - ".$wpdb->prefix."zotpress_zoteroItems.json, - ".$wpdb->prefix."zotpress_zoteroItems.citation AS item, - ".$wpdb->prefix."zotpress_zoteroItems.item_key - FROM ".$wpdb->prefix."zotpress_zoteroItems - - WHERE ".$wpdb->prefix."zotpress_zoteroItems.api_user_id='".$zp_api_user_id."' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType NOT IN ('attachment', 'note') - AND ".$wpdb->prefix."zotpress_zoteroItems.citation LIKE %s - - ORDER BY ".$wpdb->prefix."zotpress_zoteroItems.author ASC LIMIT ".$limit." - "; - - $zpSearchResults = $wpdb->get_results( - $wpdb->prepare( $tempquery, '%' . $wpdb->esc_like($_GET['term']) . '%' - ), OBJECT ); - } - elseif ( $filter == "collection" ) - { - // CONCAT( ".$wpdb->prefix."zotpress_zoteroCollections.title, ' (', ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key, ')' ) AS item_key - $tempquery = - " - SELECT DISTINCT ".$wpdb->prefix."zotpress_zoteroItems.author, - ".$wpdb->prefix."zotpress_zoteroItems.json, - ".$wpdb->prefix."zotpress_zoteroItems.citation AS item, - ".$wpdb->prefix."zotpress_zoteroCollections.title AS item_key - FROM ".$wpdb->prefix."zotpress_zoteroRelItemColl - - LEFT JOIN ".$wpdb->prefix."zotpress_zoteroCollections - ON ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key=".$wpdb->prefix."zotpress_zoteroCollections.item_key - - INNER JOIN ".$wpdb->prefix."zotpress_zoteroItems - ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemColl.item_key - - WHERE ".$wpdb->prefix."zotpress_zoteroRelItemColl.api_user_id='".$zp_api_user_id."' - AND ".$wpdb->prefix."zotpress_zoteroRelItemColl.api_user_id=".$wpdb->prefix."zotpress_zoteroItems.api_user_id - AND ".$wpdb->prefix."zotpress_zoteroRelItemColl.api_user_id=".$wpdb->prefix."zotpress_zoteroCollections.api_user_id - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType NOT IN ('attachment', 'note') - AND ".$wpdb->prefix."zotpress_zoteroCollections.title LIKE %s - - ORDER BY ".$wpdb->prefix."zotpress_zoteroItems.author ASC LIMIT ".$limit." - "; - - $zpSearchResults = $wpdb->get_results( - $wpdb->prepare( $tempquery, '%' . $wpdb->esc_like($_GET['term']) . '%' - ), OBJECT ); - } - elseif ( $filter == "tag" ) - { - $tempquery = - " - SELECT DISTINCT ".$wpdb->prefix."zotpress_zoteroItems.author, - ".$wpdb->prefix."zotpress_zoteroItems.json, - ".$wpdb->prefix."zotpress_zoteroItems.citation AS item, - ".$wpdb->prefix."zotpress_zoteroRelItemTags.tag_title AS item_key - FROM ".$wpdb->prefix."zotpress_zoteroItems - - INNER JOIN ".$wpdb->prefix."zotpress_zoteroRelItemTags - ON ".$wpdb->prefix."zotpress_zoteroItems.api_user_id=".$wpdb->prefix."zotpress_zoteroRelItemTags.api_user_id - AND ".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemTags.item_key - - WHERE ".$wpdb->prefix."zotpress_zoteroItems.api_user_id='".$zp_api_user_id."' - AND ".$wpdb->prefix."zotpress_zoteroItems.itemType NOT IN ('attachment', 'note') - AND ".$wpdb->prefix."zotpress_zoteroRelItemTags.tag_title LIKE %s - - ORDER BY ".$wpdb->prefix."zotpress_zoteroItems.author ASC LIMIT ".$limit." - "; - - $zpSearchResults = $wpdb->get_results( - $wpdb->prepare( $tempquery, '%' . $wpdb->esc_like($_GET['term']) . '%' - ), OBJECT ); - } - } - //else // ALL: How? Would be a really complex query - //{ - //} - - - // Format results for display - - $zpSearch = array(); - - if ( isset($zpSearchResults) && count($zpSearchResults) > 0 ) - { - foreach ( $zpSearchResults as $zpResult ) - { - // Deal with author - $author = $zpResult->author; - $zpResultJSON = json_decode( $zpResult->json ); - - if ( $author == "" ) - { - if ( isset($zpResultJSON->creators) && count($zpResultJSON->creators) > 0 ) - foreach ( $zpResultJSON->creators as $i => $creator ) - if ( $i != (count($zpResultJSON->creators)-1) ) - $author .= $creator->name . ', '; - else - $author .= $creator->name; - } - array_push( $zpSearch, array( "author" => $author, "item" => $zpResult->item, "item_key" => $zpResult->item_key, "url" => $zpResultJSON->url) ); - //array_push( $zpSearch, array( "author" => $author, "item" => $zpResult->item, "item_key" => $zpResult->item_key) ); - } - } - - echo json_encode($zpSearch); - - unset($zp_api_user_id); - unset($zp_account); - $wpdb->flush(); - -?> \ No newline at end of file diff --git a/lib/shortcode/shortcode.php b/lib/shortcode/shortcode.php index c9c9107..c18ed73 100644 --- a/lib/shortcode/shortcode.php +++ b/lib/shortcode/shortcode.php @@ -1,984 +1,453 @@ false, // deprecated + 'userid' => false, + 'nickname' => false, + 'nick' => false, + + 'author' => false, + 'authors' => false, + 'year' => false, + 'years' => false, + + 'itemtype' => false, // for selecting by itemtype; assumes one type + 'item_type' => 'items', + 'data_type' => false, // deprecated + 'datatype' => 'items', + + 'collection_id' => false, + 'collection' => false, + 'collections' => false, + + 'item_key' => false, + 'item' => false, + 'items' => false, + + 'inclusive' => 'yes', + + 'tag_name' => false, + 'tag' => false, + 'tags' => false, + + 'style' => false, + 'limit' => false, + + 'sortby' => 'default', + 'order' => false, + 'sort' => false, + + 'title' => 'no', + + 'image' => false, + 'images' => false, + 'showimage' => 'no', + + 'showtags' => 'no', + + 'downloadable' => 'no', + 'download' => 'no', + + 'shownotes' => false, + 'note' => false, + 'notes' => 'no', + + 'abstract' => false, + 'abstracts' => 'no', + + 'cite' => 'no', + 'citeable' => false, + + 'metadata' => false, + + 'target' => false, + 'urlwrap' => false, + + 'highlight' => false, + 'forcenumber' => false, + 'forcenumbers' => false + + ), $atts, 'zotpress')); + + + // +---------------------------+ + // | FORMAT & CLEAN PARAMETERS | + // +---------------------------+ + + // Filter by account + if ($user_id) { + $api_user_id = zp_clean_param( $user_id ); + } elseif ($userid) { + $api_user_id = zp_clean_param( $userid ); + } else $api_user_id = false; + + if ($nickname) $nickname = zp_clean_param( $nickname ); + if ($nick) $nickname = zp_clean_param( $nick ); + + // Filter by author + $author = zp_clean_param( $author ); + if ($authors) $author = zp_clean_param( $authors ); + + // Filter by year + if ($year) { + $year = zp_clean_param( $year ); + } elseif ($years) { + $year = zp_clean_param( $years ); + } elseif (strpos($year, ",") > 0) { + $year = explode(",", $year); + } else $year = ""; + + // Filter by itemtype + // TODO: Allow for a list of itemtypes in one shortcode? + $itemtype = zp_clean_param( $itemtype ); + if ( $itemtype !== false ) { - extract(shortcode_atts(array( - - 'user_id' => false, // deprecated - 'userid' => false, - 'nickname' => false, - 'nick' => false, - - 'author' => false, - 'authors' => false, - 'year' => false, - 'years' => false, - - 'data_type' => false, // deprecated - 'datatype' => "items", - - 'collection_id' => false, - 'collection' => false, - 'collections' => false, - - 'item_key' => false, - 'item' => false, - 'items' => false, - - 'inclusive' => "yes", - - 'tag_name' => false, - 'tag' => false, - 'tags' => false, - - 'content' => false, // deprecated - 'style' => false, - 'limit' => false, - - 'sortby' => "default", - 'order' => false, - 'sort' => false, - - 'title' => "no", - - 'image' => false, - 'images' => false, - 'showimage' => "no", - - 'showtags' => "no", - - 'downloadable' => "no", - 'download' => "no", - - 'note' => false, - 'notes' => "no", - - 'abstract' => false, - 'abstracts' => "no", - - 'cite' => "no", - 'citeable' => false, - - 'metadata' => false, - - 'link' => "no", - 'linkedlist' => "no", - - 'target' => false, - - 'forcenumber' => false, - - 'depth' => false - - ), $atts, "zotpress")); - - - // FORMAT PARAMETERS - - // Filter by account - if ($user_id) $api_user_id = str_replace('"','',html_entity_decode($user_id)); - else if ($userid) $api_user_id = str_replace('"','',html_entity_decode($userid)); - else $api_user_id = false; - - if ($nickname) $nickname = str_replace('"','',html_entity_decode($nickname)); - if ($nick) $nickname = str_replace('"','',html_entity_decode($nick)); - - // Filter by author - $author = str_replace('"','',html_entity_decode($author)); - if ($authors) $author = str_replace('"','',html_entity_decode($authors)); - - // Filter by year - $year = str_replace('"','',html_entity_decode($year)); - if ($years) $year = str_replace('"','',html_entity_decode($years)); - if (strpos($year, ",") > 0) $year = explode(",", $year); - - // Format with datatype and content - if ($data_type) $data_type = str_replace('"','',html_entity_decode($data_type)); - else $data_type = str_replace('"','',html_entity_decode($datatype)); - - // Filter by collection - if ($collection_id) $collection_id = str_replace('"','',html_entity_decode($collection_id)); - else if ($collection) $collection_id = str_replace('"','',html_entity_decode($collection)); - else if ($collections) $collection_id = str_replace('"','',html_entity_decode($collections)); - //else $collection_id = str_replace('"','',html_entity_decode($collection)); - - if (strpos($collection_id, ",") > 0) $collection_id = explode(",", $collection_id); - if ($data_type == "collections" && isset($_GET['zpcollection']) ) $collection_id = htmlentities( urldecode( $_GET['zpcollection'] ) ); - - // Filter by tag - if ($tag_name) $tag_name = str_replace('"','',html_entity_decode($tag_name)); - else if ($tags) $tag_name = str_replace('"','',html_entity_decode($tags)); - else $tag_name = str_replace('"','',html_entity_decode($tag)); - - $tag_name = str_replace("+", "", $tag_name); - if (strpos($tag_name, ",") > 0) $tag_name = explode(",", $tag_name); - if ($data_type == "tags" && isset($_GET['zptag']) ) $tag_name = htmlentities( urldecode( $_GET['zptag'] ) ); - - // Filter by itemkey - if ($item_key) $item_key = str_replace('"','',html_entity_decode($item_key)); - if ($items) $item_key = str_replace('"','',html_entity_decode($items)); - if ($item) $item_key = str_replace('"','',html_entity_decode($item)); - if (strpos($item_key, ",") > 0) $item_key = explode(",", $item_key); - - $content = str_replace('"','',html_entity_decode($content)); - $inclusive = str_replace('"','',html_entity_decode($inclusive)); - - // Format style - $style = str_replace('"','',html_entity_decode($style)); - - // Limit - $limit = str_replace('"','',html_entity_decode($limit)); - - // Order / sort - $sortby = str_replace('"','',html_entity_decode($sortby)); - - if ($order) $order = str_replace('"','',html_entity_decode($order)); - else if ($sort) $order = str_replace('"','',html_entity_decode($sort)); - if ($order === false) $order = "ASC"; - - // Show title - $title = str_replace('"','',html_entity_decode($title)); - if ($title == "yes" || $title == "true" || $title === true) - { - $title = true; - $sortby = "year"; - $order= "DESC"; - } - else { $title = false; } - - // Show image - if ($showimage) $showimage = str_replace('"','',html_entity_decode($showimage)); - if ($image) $showimage = str_replace('"','',html_entity_decode($image)); - if ($images) $showimage = str_replace('"','',html_entity_decode($images)); - - if ($showimage == "yes" || $showimage == "true" || $showimage === true) $showimage = true; - else $showimage = false; - - // Show tags - if ($showtags == "yes" || $showtags == "true" || $showtags === true) $showtags = true; - else $showtags = false; - - // Show download link - if ($download == "yes" || $download == "true" || $download === true - || $downloadable == "yes" || $downloadable == "true" || $downloadable === true) - $download = true; else $download = false; - - // Show notes - if ($notes) $notes = str_replace('"','',html_entity_decode($notes)); - else if ($note) $notes = str_replace('"','',html_entity_decode($note)); - - if ($notes == "yes" || $notes == "true" || $notes === true) $notes = true; - else $notes = false; - - // Show abstracts - if ($abstracts) $abstracts = str_replace('"','',html_entity_decode($abstracts)); - if ($abstract) $abstracts = str_replace('"','',html_entity_decode($abstract)); - - if ($abstracts == "yes" || $abstracts == "true" || $abstracts === true) $abstracts = true; - else $abstracts = false; - - // Show cite link - if ($cite) $cite = str_replace('"','',html_entity_decode($cite)); - if ($citeable) $cite = str_replace('"','',html_entity_decode($citeable)); - - if ($cite == "yes" || $cite == "true" || $cite === true) $cite = true; - else $cite = false; - - if ( !preg_match("/^[0-9a-zA-Z]+$/", $metadata) ) $metadata = false; - - if ( $link == "yes" || $link == "true" || $link === true ) $link = str_replace('"','',html_entity_decode($link)); - else if ( $linkedlist == "yes" || $linkedlist == "true" || $linkedlist === true ) $link = str_replace('"','',html_entity_decode($linkedlist)); - - if ($target == "yes" || $target == "_blank" || $target == "new" || $target == "true" || $target === true) - $target = true; else $target = false; - - if ($forcenumber == "yes" || $forcenumber == "true" || $forcenumber === true) + // Make sure it's one of the accepted types + $officialItemTypes = array( + 'book', + 'bookSection', + 'journalArticle', + 'conferencePaper', + 'thesis', + 'report', + 'encyclopediaArticle', + 'newspaperArticle', + 'magazineArticle', + 'presentation', + 'interview', + 'dictionaryEntry', + 'document', + 'manuscript', + 'patent', + 'map', + 'blogPost', + 'webpage', + 'artwork', + 'film', + 'audioRecording', + 'statute', + 'bill', + 'case', + 'hearing', + 'forumPost', + 'letter', + 'email', + 'instantMessage', + 'software', + 'podcast', + 'radioBroadcast', + 'tvBroadcast', + 'videoRecording', + 'attachment', + 'note' + ); + + $itemtypeCheck = false; + + foreach ($officialItemTypes as $type) + if ( $itemtype == $type ) $itemtypeCheck = true; + + if ( !$itemtypeCheck ) + $itemtype = false; // Default is no itemtype filter + } + + // Format with datatype and content + if ($item_type) { + $item_type = zp_clean_param( $item_type ); + } elseif ($data_type) { + $item_type = zp_clean_param( $data_type ); + } else $item_type = zp_clean_param( $datatype ); + + // Filter by collection + if ($collection_id) { + $collection_id = zp_clean_param( $collection_id ); + } elseif ($collection) { + $collection_id = zp_clean_param( $collection ); + } elseif ($collections) { + $collection_id = zp_clean_param( $collections ); + } + $collection_id = str_replace(" ", "", $collection_id ); + + if (strpos($collection_id, ",") > 0) $collection_id = explode(",", $collection_id); + if ($item_type == "collections" && isset($_GET['zpcollection']) ) $collection_id = htmlentities( urldecode( $_GET['zpcollection'] ) ); + + // Filter by tag + if ($tag_name) { + $tag_id = zp_clean_param( $tag_name ); + } elseif ($tags) { + $tag_id = zp_clean_param( $tags ); + } else $tag_id = zp_clean_param( $tag ); + + $tag_id = str_replace("+", "", $tag_id); + if (strpos($tag_id, ",") > 0) $tag_id = explode(",", $tag_id); + if ($item_type == "tags" && isset($_GET['zptag']) ) $tag_id = htmlentities( urldecode( $_GET['zptag'] ) ); + + // Filter by itemkey + if ($item_key) $item_key = zp_clean_param( $item_key ); + if ($items) $item_key = zp_clean_param( $items ); + if ($item) $item_key = zp_clean_param( $item ); + if (strpos($item_key, ", ") > 0) $item_key = str_replace(', ',',',html_entity_decode($item_key)); // remove spces after commas + // if (strpos($item_key, ",") > 0) $item_key = explode(",", $item_key); // ? break at commas? + $item_key = str_replace(" ", "", $item_key ); // remove any spaces + + // Inclusive (for multiple authors) + $inclusive = $inclusive == "yes" || $inclusive == "true" || $inclusive === true; + + // Format style + $style = zp_clean_param( $style ); + + // Limit + $limit = zp_clean_param( $limit ); + + // Order / sort + $sortby = zp_clean_param( $sortby ); + + if ($order) { + $order = strtolower(zp_clean_param( $order )); + } elseif ($sort) { + $order = strtolower(zp_clean_param( $sort )); + } + if ($order === false) $order = "asc"; + + // Show title + // Sorting by secondary sort + $title = zp_clean_param( $title ); + if ($title == "yes" || $title == "true" || $title === true) { + $title = "year"; + } elseif ($title == "no" || $title == "false") { + $title = false; + } + + // Show image + if ($showimage) $showimage = zp_clean_param( $showimage ); + if ($image) $showimage = zp_clean_param( $image ); + if ($images) $showimage = zp_clean_param( $images ); + + if ($showimage == "yes" || $showimage == "true" || $showimage === true) { + $showimage = true; + } elseif ($showimage === "openlib") { + $showimage = "openlib"; + } else $showimage = false; + + // Show tags + $showtags = $showtags == "yes" || $showtags == "true" || $showtags === true; + + // Show download link + if ($download == "yes" || $download == "true" || $download === true + || $downloadable == "yes" || $downloadable == "true" || $downloadable === true) + $downloadable = true; else $downloadable = false; + + // Show notes + if ($shownotes) { + $shownotes = zp_clean_param( $shownotes ); + } elseif ($notes) { + $shownotes = zp_clean_param( $notes ); + } elseif ($note) { + $shownotes = zp_clean_param( $note ); + } + + $shownotes = $notes == "yes" || $notes == "true" || $notes === true; + + // Show abstracts + if ($abstracts) $abstracts = zp_clean_param( $abstracts ); + if ($abstract) $abstracts = zp_clean_param( $abstract ); + + $abstracts = $abstracts == "yes" || $abstracts == "true" || $abstracts === true; + + // Show cite link + if ($cite) $citeable = zp_clean_param( $cite ); + if ($citeable) $citeable = zp_clean_param( $citeable ); + + $citeable = $citeable == "yes" || $citeable == "true" || $citeable === true; + + if ( ! preg_match("/^[0-9a-zA-Z]+$/", $metadata) ) $metadata = false; + + // URL attributes + if ($target == "yes" || $target == "_blank" || $target == "new" || $target == "true" || $target === true) + $target = true; else $target = false; + + $urlwrap = $urlwrap == "title" || $urlwrap == "image" ? zp_clean_param( $urlwrap ) : false; + + $highlight = $highlight ? zp_clean_param( $highlight ) : false; + + if ( $forcenumber == "yes" || $forcenumber == "true" || $forcenumber === true + || $forcenumbers == "yes" || $forcenumbers == "true" || $forcenumbers === true ) $forcenumber = true; else $forcenumber = false; - - if ($depth == "all" || $depth == "true" || $depth === true) - $depth = true; else $depth = false; - - - - // GET ACCOUNT - - global $wpdb; - - // Get account (api_user_id) - $zp_account = false; - - if ($nickname !== false) + + + // +-------------+ + // | GET ACCOUNT | + // +-------------+ + + global $wpdb; + + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_enqueue_script( 'zotpress.shortcode.bib'.$minify.'.js' ); + + // Get account (api_user_id) + $zp_account = false; + + if ($nickname !== false) { + $zp_account = eb_zotpress_get_account( false, $nickname ); + if ( is_null($zp_account) ): + return "

    Sorry, but the selected Zotpress nickname can't be found.

    "; + endif; + $api_user_id = $zp_account->api_user_id; + } elseif ($api_user_id !== false) { + $zp_account = eb_zotpress_get_account( $api_user_id ); + if ( is_null($zp_account) ): + return "

    Sorry, but the selected Zotpress account can't be found.

    "; + endif; + $api_user_id = $zp_account->api_user_id; + } elseif ($api_user_id === false && $nickname === false) { + if (get_option("Zotpress_DefaultAccount") !== false) { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE nickname='".$nickname."'", OBJECT); - - if ( is_null($zp_account) ): echo "

    Sorry, but the selected Zotpress nickname can't be found.

    "; return false; endif; - - $api_user_id = $zp_account->api_user_id; + $api_user_id = get_option("Zotpress_DefaultAccount"); + $zp_account = eb_zotpress_get_account( $api_user_id ); } - else if ($api_user_id !== false) + else // When all else fails ... { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id='".$api_user_id."'", OBJECT); - - if ( is_null($zp_account) ): echo "

    Sorry, but the selected Zotpress account can't be found.

    "; return false; endif; - + $zp_account = eb_zotpress_get_account(); $api_user_id = $zp_account->api_user_id; } - else if ($api_user_id === false && $nickname === false) - { - if (get_option("Zotpress_DefaultAccount") !== false) - { - $api_user_id = get_option("Zotpress_DefaultAccount"); - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress WHERE api_user_id ='".$api_user_id."'", OBJECT); - } - else // When all else fails ... - { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress LIMIT 1", OBJECT); - $api_user_id = $zp_account->api_user_id; - } - } - - // Generate instance id for shortcode - $zp_instance_id = "zotpress-".md5($api_user_id.$nickname.$author.$year.$data_type.$collection_id.$item_key.$tag_name.$content.$style.$sortby.$order.$limit.$showimage.$download.$note.$cite); - - - - // GENERATE SHORTCODE - - if ($zp_account !== false) - { - - - // ITEMS - - if ( $data_type == "items" - || ($data_type == "tags" && isset($_GET['zptag']) ) - || ($data_type == "collections" && isset($_GET['zpcollection'])) ) - { - $zp_query = ""; - - if ($download) - { - $wpdb->get_results( - " - CREATE TEMPORARY TABLE attachments - SELECT * FROM - ( - SELECT - ".$wpdb->prefix."zotpress_zoteroItems.parent AS parent, - ".$wpdb->prefix."zotpress_zoteroItems.citation AS content, - ".$wpdb->prefix."zotpress_zoteroItems.item_key AS item_key, - ".$wpdb->prefix."zotpress_zoteroItems.json AS data, - ".$wpdb->prefix."zotpress_zoteroItems.linkmode AS linkmode - FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE api_user_id='".$api_user_id."' AND - ".$wpdb->prefix."zotpress_zoteroItems.linkmode IN ( 'imported_file', 'linked_url' ) - ORDER BY linkmode ASC - ) - AS attachments_sub - GROUP BY parent; - " - ); - } - - $zp_query .= "SELECT DISTINCT ".$wpdb->prefix."zotpress_zoteroItems.*"; - - if ($download) $zp_query .= ", attachments.content AS attachment_content, attachments.item_key AS attachment_key, attachments.data AS attachment_data, attachments.linkmode AS attachment_linkmode"; - - if ($showimage) $zp_query .= ", ".$wpdb->prefix."zotpress_zoteroItemImages.image AS itemImage"; - - $zp_query .= " FROM ".$wpdb->prefix."zotpress_zoteroItems "; - - - // JOINS: download, itemimage, collections, tags - - if ($download) - $zp_query .= " LEFT JOIN (attachments) ON (".$wpdb->prefix."zotpress_zoteroItems.item_key=attachments.parent) "; - - if ($showimage) - $zp_query .= " LEFT JOIN (".$wpdb->prefix."zotpress_zoteroItemImages) ON (".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroItemImages.item_key) "; - - if ($collection_id) - { - if ( is_array($collection_id) ) - { - // create inner joins - for ($i = 0; $i < count($collection_id); $i++) - $zp_query .= " INNER JOIN ".$wpdb->prefix."zotpress_zoteroRelItemColl AS zpRelItemColl".$i." ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=zpRelItemColl".$i.".item_key "; - - // inclusive? - if ( $inclusive != "yes" ) - { - $zp_query .= " AND ( "; - - // exclusive to specific collections - for ($i = 0; $i < count($collection_id); $i++) - { - if ($i != 0) $zp_query .= " AND "; - $zp_query .= " zpRelItemColl".$i.".collection_key='".$collection_id[$i]."' "; - } - $zp_query .= " ) "; - } - } - else // single collection - { - $zp_query .= " LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemColl ON (".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemColl.item_key) "; - } -// if (!is_array($collection_id) -// || (is_array($collection_id) && $inclusive == "yes")) -// { -// $zp_query .= " LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemColl ON (".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemColl.item_key) "; -// } -// else if (is_array($collection_id) && $inclusive != "yes") -// { -// // create inner joins -// for ($i = 0; $i < count($collection_id); $i++) -// $zp_query .= " INNER JOIN ".$wpdb->prefix."zotpress_zoteroRelItemColl AS zpRelItemColl".$i." ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=zpRelItemColl".$i.".item_key "; -// -// $zp_query .= " AND ( "; -// -// // exclusive to specific collections -// for ($i = 0; $i < count($collection_id); $i++) -// { -// if ($i != 0) $zp_query .= " AND "; -// $zp_query .= " zpRelItemColl".$i.".collection_key='".$collection_id[$i]."' "; -// } -// $zp_query .= " ) "; -// } - } - - if ($tag_name) - { - if (!is_array($tag_name) || (is_array($tag_name) && $inclusive == "yes")) - { - $zp_query .= " LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemTags ON (".$wpdb->prefix."zotpress_zoteroItems.item_key=".$wpdb->prefix."zotpress_zoteroRelItemTags.item_key) "; - } - else if (is_array($tag_name) && $inclusive != "yes") - { - // create inner joins - for ($i = 0; $i < count($tag_name); $i++) - $zp_query .= " INNER JOIN ".$wpdb->prefix."zotpress_zoteroRelItemTags AS zpRelItemTags".$i." ON ".$wpdb->prefix."zotpress_zoteroItems.item_key=zpRelItemTags".$i.".item_key "; - - $zp_query .= " AND ( "; - - // exclusive to specific tags - for ($i = 0; $i < count($tag_name); $i++) - { - if ($i != 0) $zp_query .= " AND "; - $zp_query .= " zpRelItemTags".$i.".tag_title='".str_replace("&", "__and__", $tag_name[$i])."' "; - } - $zp_query .= " ) "; - } - } - - // WHERE - - $zp_query .= " WHERE ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'attachment' AND ".$wpdb->prefix."zotpress_zoteroItems.itemType != 'note' "; - - // Filter by collection(s) - if ($collection_id) - { - // Multiple inclusive collections - if (is_array($collection_id)) - { - if ($inclusive == "yes") - { - $zp_query .= " AND ("; - - foreach ($collection_id as $i => $id) - { - $zp_query .= "zpRelItemColl0.collection_key='".$id."' "; // for some reason, only need first reference to this table - - if ($i != count($collection_id)-1) $zp_query .= " OR "; - } - $zp_query .= ") "; - } - } - // Single collection - else - { - $zp_query .= " AND ".$wpdb->prefix."zotpress_zoteroRelItemColl.collection_key='".$collection_id."' "; - } - } // $collection_id - - // Filter by tag(s) - if ($tag_name) - { - // Multiple inclusive collections - if (is_array($tag_name)) - { - if ($inclusive == "yes") - { - $zp_query .= " AND ("; - - foreach ($tag_name as $i => $id) - { - $zp_query .= $wpdb->prefix."zotpress_zoteroRelItemTags.tag_title='".str_replace("&", "__and__", $id)."' "; - - if ($i != count($tag_name)-1) $zp_query .= " OR "; - } - $zp_query .= ") "; - } - } - // Single collection - else - { - $zp_query .= " AND ".$wpdb->prefix."zotpress_zoteroRelItemTags.tag_title='".str_replace("&", "__and__", $tag_name)."' "; - } - } // $tag_name - - // Filter by account - if ($api_user_id) - $zp_query .= " AND ".$wpdb->prefix."zotpress_zoteroItems.api_user_id='".$api_user_id."'"; - - // Filter by author - // Expects e.g. Name OR Name1,Name2 OR (NameLast,NameFirst) - // OR (Name1Last,Name1First),(Name1Last,Name1First) - if ($author) - { - $zp_query .= " AND ( "; - - $is_multiple_authors = false; - - // Deal with first and last name AND/OR multiple authors - if ( strpos($author, "(") > -1 ) - { - $author = str_replace("), (", "),(", $author); - - // If multiple authors and first name exists: - if ( strpos($author, "),(") > -1) - { - $author = explode("),(", $author); - - foreach ( $author as $id => $fullname ) - { - $author[$id] = explode(", ", str_replace("(", "", str_replace(")", "", $fullname))); - } - $is_multiple_authors = true; - } - else - { - // Just a single author - $author = array( explode(", ", str_replace("(", "", str_replace(")", "", $author))) ); - } - } - else if ( strpos($author, ",") > -1 ) - { - // Multiple last names - $author = explode(",", $author); - $is_multiple_authors = true; - } - - // Deal with multiple authors - if ($is_multiple_authors) - { - foreach ($author as $i => $zp_author) - { - // Prep author - if ( is_array($zp_author) ) $zp_author = $zp_author[0]; - $zp_author = strtolower(trim($zp_author)); - if (strpos($zp_author, " ") > 0) $zp_author = preg_split("/\s+(?=\S*+$)/", $zp_author); - - if (is_array($zp_author)) // full name (or multiple last names) - { - if ($inclusive == "yes" && $i != 0) $zp_query .= " OR "; else if ($inclusive != "yes" && $i != 0) $zp_query .= " AND "; - - $zp_query .= " FIND_IN_SET( '".$zp_author[1]."', REPLACE(".$wpdb->prefix."zotpress_zoteroItems.author, ', ', ',') )"; - $zp_query .= " OR FIND_IN_SET( '".implode(" ", $zp_author)."', REPLACE(".$wpdb->prefix."zotpress_zoteroItems.author, ', ', ',') )"; - } - else // last name only - { - if ($inclusive == "yes" && $i != 0) $zp_query .= " OR "; else if ($inclusive != "yes" && $i != 0) $zp_query .= " AND "; - - $zp_query .= " FIND_IN_SET( '".$zp_author."', REPLACE(".$wpdb->prefix."zotpress_zoteroItems.author, ', ', ',') )"; - } - } - } - else // Single author - { - // Prep author - if ( is_array($author) && is_array($author[0]) ) $zp_author = $author[0][0]; else $zp_author = $author; - $zp_author = strtolower(trim($zp_author)); - if ( strpos($zp_author, " ") > 0 ) $zp_author = preg_split("/\s+(?=\S*+$)/", $zp_author); - - // Full name in array (or multiple last names) - if (is_array($zp_author)) - { - $zp_query .= " FIND_IN_SET( '".$zp_author[1]."', REPLACE(".$wpdb->prefix."zotpress_zoteroItems.author, ', ', ',') )"; - $zp_query .= " OR FIND_IN_SET( '".implode(" ", $zp_author)."', REPLACE(".$wpdb->prefix."zotpress_zoteroItems.author, ', ', ',') )"; - } - // Last name only - else - { - $zp_query .= " FIND_IN_SET( '".$zp_author."', REPLACE(".$wpdb->prefix."zotpress_zoteroItems.author, ', ', ',') )"; - } - } - $zp_query .= " ) "; - } // $author - - // Filter by year: zpdate or year - if ($year) - { - if (is_array($year)) - { - $zp_query .= " AND FIND_IN_SET(".$wpdb->prefix."zotpress_zoteroItems.year, '".implode(",", $year)."')"; - } - else // single - { - $zp_query .= " AND ".$wpdb->prefix."zotpress_zoteroItems.year LIKE '%".$year."%'"; - } - } - - // Filter by item key - if ($item_key) - { - if (is_array($item_key)) - $zp_query .= " AND ".$wpdb->prefix."zotpress_zoteroItems.item_key IN('" . implode("','", $item_key) . "')"; - else // single - $zp_query .= " AND ".$wpdb->prefix."zotpress_zoteroItems.item_key='".$item_key."'"; - } - - // Sort by and sort direction - // Relies on db column and MySQL sorting - // Maybe sort by retrieved here, then do sorting after query execution? - if ($sortby) - { - if ($sortby == "default") - $sortby = "retrieved"; - else if ($sortby == "date") - $sortby = "year"; // zpdate -- MySQL doesn't understand - - if (($tag_name && $collection_id) || (is_array($year))) - $zp_query .= " ORDER BY ".$sortby." " . $order; - else - $zp_query .= " ORDER BY ".$wpdb->prefix."zotpress_zoteroItems.".$sortby." " . $order; - } - - // Limit - if ($limit) $zp_query .= " LIMIT ".$limit; - - - // Prep query -- still necessary? - - if ($item_key || $tag_name || $collection_id) - { - $zp_query = str_replace("AND AND", "AND", $zp_query); - } - else if ($author || $year) { - $zp_query = str_replace("OR ORDER BY", "ORDER BY", str_replace("OR AND", "OR", str_replace(" ", " ", $zp_query))); - } - - - - // GET ITEMS FROM DB - - //var_dump( $zp_query . "

    "); - $zp_results = $wpdb->get_results($zp_query, ARRAY_A); unset($zp_query); - //var_dump( $zp_results ); exit; - - - - /* - - DISPLAY CITATIONS - loop - - */ - - $current_title = ""; - $citation_notes = array(); - $zp_notes_num = 1; - - $zp_output = "\n
    \n\n"; - $zp_output .= "" . ZOTPRESS_PLUGIN_URL . "\n\n"; - //$zp_output .= "Checking ...\n\n"; - - // Add style, if set - if ($style) $zp_output .= "".$style."\n\n"; - - // TAG OR COLLECTION TITLE - if ( $data_type == "collections" && isset($_GET['zpcollection']) ) - { - $collection_title = $wpdb->get_row("SELECT title FROM ".$wpdb->prefix."zotpress_zoteroCollections WHERE item_key='".$collection_id."'"); - $zp_output .= "

    " . $collection_title->title . " / Back

    \n\n"; - } - if ( $data_type == "tags" && isset($_GET['zptag']) ) - { - $zp_output .= "

    " . $tag_name . " / Back

    \n\n"; - } - - // SORT - - if ($sortby) - { - if ($sortby == "default") - $sortby = "retrieved"; - else if ($sortby == "year") - $sortby = "date"; - - $zp_results = subval_sort( $zp_results, $sortby, $order ); - } - - if ( count($zp_results) > 0 ) - { - foreach ($zp_results as $zp_citation) - { - $citation_image = false; - $citation_tags = false; - $citation_abstract = ""; - $has_citation_image = false; - $zp_this_meta = json_decode( $zp_citation["json"] ); - $zp_output .= "".$zp_citation['api_user_id']."\n\n"; - //$zp_output .= "" . $_SESSION['zp_session'][$zp_citation['api_user_id']]['key'] . "\n\n"; - - - // If applicable, filter out authors with the wrong first name - $dont_skip_based_on_author = true; - $exclusive_author_count = 0; - - if ( is_array($author) && is_array($author[0]) ) - { - $dont_skip_based_on_author = false; - - foreach ( $author as $author_to_filter ) - { - foreach ( $zp_this_meta->creators as $creator ) - { - if ( $creator->lastName == $author_to_filter[0] - && $creator->firstName == $author_to_filter[1] ) - { - $dont_skip_based_on_author = true; - - // Count authors if exclusive - $exclusive_author_count++; - } - } - } - if ( $inclusive != "yes" && $exclusive_author_count != count($author) ) - $dont_skip_based_on_author = false; - } - - if ( $dont_skip_based_on_author ) - { - // IMAGE - if ($showimage && !is_null($zp_citation["itemImage"]) && $zp_citation["itemImage"] != "") - { - if ( is_numeric($zp_citation["itemImage"]) ) - { - $zp_citation["itemImage"] = wp_get_attachment_image_src( $zp_citation["itemImage"], "full" ); - $zp_citation["itemImage"] = $zp_citation["itemImage"][0]; - } - - $citation_image = "
    "; - $citation_image .= "image"; - $citation_image .= "
    \n"; - $has_citation_image = " zp-HasImage"; - } - - // TAGS - // Grab tags associated with item - if ( $showtags ) - { - $zp_showtags_query = "SELECT DISTINCT ".$wpdb->prefix."zotpress_zoteroTags.title FROM ".$wpdb->prefix."zotpress_zoteroTags LEFT JOIN ".$wpdb->prefix."zotpress_zoteroRelItemTags ON ".$wpdb->prefix."zotpress_zoteroRelItemTags.tag_title=".$wpdb->prefix."zotpress_zoteroTags.title WHERE ".$wpdb->prefix."zotpress_zoteroRelItemTags.item_key='".$zp_citation["item_key"]."' ORDER BY ".$wpdb->prefix."zotpress_zoteroTags.title ASC;"; - $zp_showtags_results = $wpdb->get_results($zp_showtags_query, ARRAY_A); - - if ( count($zp_showtags_results) > 0) - { - $citation_tags = "

    Tags: "; - - foreach ($zp_showtags_results as $i => $zp_showtags_tag) - { - $citation_tags .= "" . $zp_showtags_tag["title"] . ""; - if ( $i != (count($zp_showtags_results)-1) ) $citation_tags .= ", "; - } - $citation_tags .= "

    \n"; - } - unset($zp_showtags_query); - unset($zp_showtags_results); - } - - // ABSTRACT - if ( $abstracts && isset($zp_this_meta->abstractNote) && strlen(trim($zp_this_meta->abstractNote)) > 0 ) - { - $citation_abstract = "

    Abstract: " . sprintf($zp_this_meta->abstractNote) . "

    \n"; - } - - - // NOTES - if ($notes) - { - $zp_notes = $wpdb->get_results("SELECT json FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$zp_citation['api_user_id']."' - AND parent = '".$zp_citation["item_key"]."' AND itemType = 'note';", OBJECT); - - if (count($zp_notes) > 0) - { - $temp_notes = "
  • \n"; - - // Only create a list if there's more than one note for this item - if ( count($zp_notes) == 1 ) - { - $note_json = json_decode($zp_notes[0]->json); - $temp_notes .= $note_json->note . "\n"; - } - else if ( count($zp_notes) > 1 ) - { - $temp_notes .= "
      \n"; - - foreach ($zp_notes as $note) - { - $note_json = json_decode($note->json); - $temp_notes .= "
    • " . $note_json->note . "\n
    • \n"; - } - $temp_notes .= "\n
    "; - } - - $temp_notes .= "\n
  • \n\n"; - - $citation_notes[count($citation_notes)] = $temp_notes; - - // Add note reference - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('
    ', '~') . '(.*?)~', '$1' . " ".$zp_notes_num." " . '$2', $zp_citation['citation'], 1); - $zp_notes_num++; - } - unset($zp_notes); - - } // end notes - - - // Hyperlink URL: Has to go before Download - if (isset($zp_this_meta->url) && strlen($zp_this_meta->url) > 0) - { - $zp_url_replacement = "title) ."\" rel=\"external\" "; - if ( $target ) $zp_url_replacement .= "target=\"_blank\" "; - $zp_url_replacement .= "href=\"".urldecode(urlencode($zp_this_meta->url))."\">".urldecode(urlencode($zp_this_meta->url)).""; - - // Replace ampersands - $zp_citation['citation'] = str_replace(htmlspecialchars($zp_this_meta->url), $zp_this_meta->url, $zp_citation['citation']); - - // Then replace with linked URL - $zp_citation['citation'] = str_replace($zp_this_meta->url, $zp_url_replacement, $zp_citation['citation']); - } - - // DOWNLOAD - if ($download) - { - //$zp_download_url = $wpdb->get_row("SELECT item_key, citation, json, linkMode FROM ".$wpdb->prefix."zotpress_zoteroItems WHERE api_user_id='".$zp_citation['api_user_id']."' - // AND parent = '".$zp_citation["item_key"]."' AND linkMode IN ( 'imported_file', 'linked_url' ) ORDER BY linkMode ASC LIMIT 1;", OBJECT); - - if ( !is_null($zp_citation['attachment_data']) ) - { - $zp_download_url = json_decode($zp_citation['attachment_data']); - - if ($zp_download_url->linkMode == "imported_file") - { - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Download " . '$2', $zp_citation['citation'], 1); // Thanks to http://ideone.com/vR073 - } - else - { - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Download " . '$2', $zp_citation['citation'], 1); - } - } - unset($zp_download_url); - } - - - // CITE LINK - if ($cite == "yes" || $cite == "true" || $cite === true) - { - $cite_url = "https://api.zotero.org/".$zp_account->account_type."/".$zp_account->api_user_id."/items/".$zp_citation["item_key"]."?format=ris"; - $zp_citation['citation'] = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Cite " . '$2', $zp_citation['citation'], 1); - } - - - // TITLE - if ($title) - { - if ($current_title == "" || (strlen($current_title) > 0 && $current_title != $zp_citation["year"])) - { - $current_title = $zp_citation["year"]; - - if ($zp_citation["year"] == "0000") - $zp_output .= "

    n.d.

    \n"; - else // regular year - $zp_output .= "

    ".$current_title."

    \n"; - } - } - - // HYPERLINK DOIs - if ( isset($zp_this_meta->DOI) ) - { - $zp_url_target = ""; if ( $target ) $zp_url_target = "target=\"_blank\" "; - - $zp_citation['citation'] = str_replace( 'http://doi.org/'.$zp_this_meta->DOI, "http://doi.org/".$zp_this_meta->DOI."", $zp_citation['citation'] ); - } - - // SHOW CURRENT STYLE AS REL - $zp_citation['citation'] = str_replace( "class=\"csl-bib-body\"", "rel=\"".$zp_citation['style']."\" class=\"csl-bib-body\"", $zp_citation['citation'] ); - - - // OUTPUT - - $zp_output .= "
    \n"; - $zp_output .= $citation_image . $zp_citation['citation'] . $citation_abstract . $citation_tags . "\n"; - $zp_output .= "
    \n\n"; - } - } - - // DISPLAY NOTES, if any exist - if ( count($citation_notes) > 0 ) - { - $zp_output .= "
    \n

    Notes

    \n
      \n"; - - foreach ( $citation_notes as $citation_note ) - $zp_output .= $citation_note; - - $zp_output .= "
    \n
    \n\n"; - } - } - - // No items to display - else - { - $zp_output .= "

    Sorry, there's no items to display.

    \n"; - } - - $zp_output .= "\n\n"; - - } // end items - - - - // COLLECTIONS - - else if ($data_type == "collections" && !isset($_GET['zpcollection'])) - { - $zp_query = "SELECT ".$wpdb->prefix."zotpress_zoteroCollections.* FROM ".$wpdb->prefix."zotpress_zoteroCollections "; - $zp_query .= "WHERE api_user_id='".$api_user_id."' AND parent = '' "; - - // Sort by and sort direction - if ($sortby) - { - if ($sortby == "default") - $sortby = "retrieved"; - else if ($sortby == "date" || $sortby == "author") - continue; - - $zp_query .= " ORDER BY ".$sortby." " . $order; - } - - // Limit - if ($limit) $zp_query .= " LIMIT ".$limit; - - $zp_results = $wpdb->get_results($zp_query, OBJECT); unset($zp_query); - - - // DISPLAY CITATIONS - - $zp_output = "\n
    \n\n"; - $zp_output .= "" . ZOTPRESS_PLUGIN_URL . "\n\n"; - $zp_output .= "
      \n"; - - foreach ($zp_results as $zp_collection) - { - $zp_output .= "
    • item_key . "\">"; - if ($link == "yes") - { - $zp_output .= ""; - } - $zp_output .= $zp_collection->title; - if ($link == "yes") { $zp_output .= ""; } - - // Place nested collections here - - if ($zp_collection->numCollections > 0) - $zp_output .= zp_get_subcollections($wpdb, $api_user_id, $zp_collection->item_key, $sortby, $order, $link); - - $zp_output .= "
    • \n"; - } - - $zp_output .= "
    \n"; - $zp_output .= "
    \n\n"; - - } // end collections - - - - // TAGS - - else if ($data_type == "tags" && !isset($_GET['zptag'])) - { - $zp_query = "SELECT * FROM ".$wpdb->prefix."zotpress_zoteroTags WHERE api_user_id='".$api_user_id."' "; - - // Sort by and sort direction - if ($sortby) - { - if ($sortby == "default") $sortby = "retrieved"; - else if ($sortby == "date" || $sortby == "author") continue; - - $zp_query .= " ORDER BY ".$sortby." " . $order; - } - - // Limit - if ($limit) $zp_query .= " LIMIT ".$limit; - - $zp_results = $wpdb->get_results($zp_query, OBJECT); unset($zp_query); - - - // DISPLAY CITATIONS - - $zp_output = "\n
    \n\n"; - $zp_output .= "" . ZOTPRESS_PLUGIN_URL . "\n\n"; - $zp_output .="\n"; - $zp_output .= "
    \n\n"; - - } // end tags - - - // FINISH UP - - // Clean up - $wpdb->flush(); unset($zp_results); - - // Show theme scripts - $GLOBALS['zp_is_shortcode_displayed'] = true; - - return $zp_output; - } - - - // Display notification if no citations found - else - { - return "\n
    Sorry, no citation(s) found.
    \n"; - } } - - -?> \ No newline at end of file + // Generate instance id for shortcode + $temp_item_key = is_array( $item_key ) ? implode( "-", $item_key) : $item_key; + $temp_collection_id = is_array( $collection_id ) ? implode( "-", $collection_id) : $collection_id; + $temp_tag_name = is_array( $tag_id ) ? implode( "-", $tag_id) : $tag_id; + $temp_author = is_array( $author ) ? implode( "-", $author) : $author; + $temp_year = is_array( $year ) ? implode( "-", $year) : $year; + $temp_sortby = is_array( $sortby ) ? implode( "-", $sortby) : $sortby; + + // REVIEW: Added post ID + $instance_id = "zotpress-".md5(get_the_ID().$api_user_id.$nickname.$temp_author.$temp_year.$itemtype.$item_type.$temp_collection_id.$temp_item_key.$temp_tag_name.$style.$temp_sortby.$order.$limit.$showimage.$showtags.$downloadable.$shownotes.$citeable.$inclusive); + + // Prepare item key + if ( $item_key && gettype( $item_key ) != "string" ) $item_key = implode( ",", $item_key ); + + // Prepare collection + if ( $collection_id && gettype( $collection_id ) != "string" ) $collection_id = implode( ",", $collection_id ); + + // Prepare tags + if ( $tag_id && gettype( $tag_id ) != "string" ) $tag_id = implode( ",", $tag_id ); + + // Set up request vars + $request_start = 0; + $request_last = 0; + $overwrite_last_request = false; + + // Set up Library vars + $is_dropdown = false; + $maxresults = 20; + $maxperpage = 10; + $maxtags = 100; + + // Set up Search vars + $term = false; + + // Set up Update vars + $update = false; + + $zp_output = '
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    '; + + + // +--------------------------------+ + // | GENERATE SHORTCODE PLACEHOLDER | + // +--------------------------------+ + + if ( $zp_account === false ) + { + $zp_output .= "\n
    Sorry, no citation(s) found for this account.
    \n"; + } + else // Make the first request via PHP for SEO purposes + { + $_GET['instance_id'] = $instance_id; + $_GET['api_user_id'] = $api_user_id; + $_GET['item_key'] = $item_key; + $_GET['collection_id'] = $collection_id; + $_GET['tag_id'] = $tag_id; + $_GET['author'] = $author; + $_GET['year'] = $year; + $_GET['itemtype'] = $itemtype; + $_GET['item_type'] = $item_type; + $_GET['inclusive'] = $inclusive; + $_GET['style'] = $style; + $_GET['limit'] = $limit; + $_GET['sortby'] = $sortby; + $_GET['order'] = $order; + $_GET['title'] = $title; + $_GET['showimage'] = $showimage; + $_GET['showtags'] = $showtags; + $_GET['downloadable'] = $downloadable; + $_GET['shownotes'] = $shownotes; + $_GET['abstracts'] = $abstracts; + $_GET['citeable'] = $citeable; + $_GET['target'] = $target; + $_GET['urlwrap'] = $urlwrap; + $_GET['forcenumber'] = $forcenumber; + $_GET['highlight'] = $highlight; + $_GET['request_start'] = $request_start; + $_GET['request_last'] = $request_last; + $_GET['is_dropdown'] = $is_dropdown; + $_GET['maxresults'] = $maxresults; + $_GET['maxperpage'] = $maxperpage; + $_GET['maxtags'] = $maxtags; + $_GET['term'] = $term; + $_GET['update'] = $update; + $_GET['overwrite_last_request'] = $overwrite_last_request; + + $zp_output .= "\n
    "; + $zp_output .= Zotpress_shortcode_request( true ); // Check catche first + $zp_output .= "
    \n"; + } + + + // Indicate that shortcode is displayed + + $GLOBALS['zp_is_shortcode_displayed'] = true; + + return $zp_output . "
    \n\n"; +} + +?> diff --git a/lib/shortcode/shortcode.request.php b/lib/shortcode/shortcode.request.php new file mode 100644 index 0000000..cbec098 --- /dev/null +++ b/lib/shortcode/shortcode.request.php @@ -0,0 +1,976 @@ + [items], [requests] + $zp_request_queue = array(); + + // Set up Zotpress request + $zp_import_contents = new ZotpressRequest(); + + // Set up request meta + $zp_request_meta = array( "request_last" => (int) $zpr["request_last"], "request_next" => 0 ); + + // Set up data variable + $zp_all_the_data = array(); + + + + // +---------------------------+ + // | Format Zotero request URL | + // +---------------------------+ + + // Account for items + collection_id + if ( $zpr["item_type"] == "items" + && $zpr["collection_id"] !== false ) + { + $zpr["item_type"] = "collections"; + $zpr["sub"] = "items"; + $zpr["get_top"] = false; + } + + // Account for items + zp_tag_id + if ( $zpr["item_type"] == "items" + && $zpr["tag_id"] !== false ) + $zpr["get_top"] = false; + + // Account for collection_id + get_top + if ( $zpr["get_top"] + && $zpr["collection_id"] !== false ) + { + $zpr["get_top"] = false; + $zpr["sub"] = "collections"; + } + + // Account for tag display - let's limit it + if ( $zpr["is_dropdown"] === true + && $zpr["item_type"] == "tags" ) + { + $zpr["sortby"] = "numItems"; // title + $zpr["order"] = "desc"; // asc + $zpr["limit"] = 100; if ( $zpr["maxtags"] ) $zpr["limit"] = $zpr["maxtags"]; + $zpr["overwrite_last_request"] = $zpr["limit"]; // QUESTION: Unsure + $zpr["overwrite_request"] = true; + + // REVIEW: we don't want tags within a collection, + // accounting for Library Dropdown browse bar (7.3.1.1) + // $zpr["get_top"] = false; + // $zpr["collection_id"] = false; + } + + // Account for $zpr["maxresults"] + if ( $zpr["maxresults"] ) + { + // If 50 or less, set as limit + if ( (int) $zpr["maxresults"] <= 50 ) + { + $zpr["limit"] = $zpr["maxresults"]; + $zpr["overwrite_request"] = true; + } + + // If over 50, then overwrite last_request + else + { + $zpr["overwrite_last_request"] = $zpr["maxresults"]; + } + } + + + // Handle the possible formats of item/s for bib and in-text + // REVIEW: Actually, removed page numbers (if any) in shortcode.intext.php + // + // IN-TEXT FORMATS: + // [zotpressInText item="NCXAA92F"] + // [zotpressInText item="{NCXAA92F}"] + // [zotpressInText item="{NCXAA92F,10-15}"] + // [zotpressInText items="{NCXAA92F,10-15},{55MKF89B,1578},{3ITTIXHP}"] + // [zotpressInText items="{000001:NCXAA92F,10-15},{000003:3ITTIXHP}"] + // So no multiples without curlies or non-curlies in multiples + // + // BIB FORMATS: + // [zotpress item="GMGCJU34"] + // [zotpress items="GMGCJU34,U9Z5JTKC"] + // [zotpress item="{000001:XH4BS8MA},{000001:CN73PTWE},{000003:CZR96TX9}"] + // BASICALLY: Create a list of unique item keys per API User ID + // REVIEW: Deal with everything!!!!!!! In the new format + if ( $zpr["item_key"] + && strpos( $zpr["item_key"], ":" ) !== false ) + { + $zp_items = preg_split( "/((;)|(,))+/", $zpr["item_key"] ); + + foreach ( $zp_items as $id => $zp_item_data ) + { + $zp_item = explode( ":", substr( $zp_item_data, 1, -1 ) ); + + // Create items queue for API User ID, if it doesn't exist + if ( ! array_key_exists( $zp_item[0], $zp_request_queue ) ) + $zp_request_queue[$zp_item[0]]["items"] = ""; + + // Add item if not in queue + if ( strpos( $zp_request_queue[$zp_item[0]]["items"], $zp_item[1] ) === false ) + { + $temp_item_key = $zp_item[1]; + + if ( strlen( $zp_request_queue[$zp_item[0]]["items"] ) != 0 ) + $temp_item_key = ",".$temp_item_key; + + $zp_request_queue[$zp_item[0]]["items"] .= $temp_item_key; + } + } + } + + + + // +--------------------+ + // | Build request URLs | + // +--------------------+ + + if ( $zp_request_queue !== [] ) + { + // REVIEW: Does setting $zp_request_queue here overwrite it for each account? + foreach ( $zp_request_queue as $api_user_id => $zp_request_data ) + $zp_request_queue = Zotpress_prep_request_URL( $wpdb, $zpr, $zp_request_queue, $api_user_id, $zp_request_data ); + } + else + { + $zp_request_queue = Zotpress_prep_request_URL( $wpdb, $zpr, $zp_request_queue ); + } + + + + + // +---------+ + // | TESTING | + // +---------+ + + // var_dump($zp_request_queue);exit; + + // if ( $zpr["request_start"] == 50 ) { + // var_dump("shortcode.request.php TESTING: "); + // print_r($_GET); var_dump("

    url: ".$zp_import_url); + // var_dump(" AFTER \n\n"); + // } + + + + + + + // +------------------+ + // | Request the data | + // +------------------+ + + $zp_request = array(); + $zp_error = false; + $zp_usecache = false; + + // Account for missing/unsynced accounts or no requests + if ( $zp_request_queue === false ) + $zp_error = "Zotpress account not found."; + + if ( ! $zp_error ) + { + foreach ( $zp_request_queue as $zp_request_account ) + { + if ( count($zp_request_account["requests"]) > 1 ) + { + foreach ( $zp_request_account["requests"] as $zp_request_url ) + { + // First, check the cache with PHP + if ( $checkcache ) + { + $zp_checkcache = $zp_import_contents->get_request_cache( $zp_request_url, $zpr["update"] ); + $zp_checkcache_json = json_decode( $zp_checkcache['json'] ); + + if ( gettype($zp_checkcache_json) != 'array' + && property_exists($zp_checkcache_json, 'status') + && $zp_checkcache_json->status == 'No Cache' ) + { + $zp_usecache = false; + } + else // Continue as normal with cache + { + $zp_imported = $zp_checkcache; + $zp_usecache = true; + } + } + else // Otherwise, assume JS Ajax + { + $zp_imported = $zp_import_contents->get_request_contents( $zp_request_url, $zpr["update"] ); + } + + // Stop and let JS Ajax take over + if ( $checkcache + && ! $zp_usecache ) + continue; + + // Deal with possible errors + if ( gettype($zp_imported) == "string" + && substr($zp_imported, 0, 5) == "Error" ) + { + $zp_error = substr($zp_imported, 7, -1); + continue; + } + + // Create all-requests json if doesn't exists + if ( empty($zp_request) ) + $zp_request = $zp_imported; + + // Add to existing all-requests json + $zp_request["json"] = rtrim($zp_request["json"], "]") . "," . $zp_imported["json"] . "]"; + } + } + + // Just one request + else + { + // First, check the cache with PHP + if ( $checkcache ) + { + $zp_checkcache = $zp_import_contents->get_request_cache( $zp_request_account["requests"][0], $zpr["update"] ); + $zp_checkcache_json = json_decode( $zp_checkcache['json'], false ); + + if ( gettype($zp_checkcache_json) != 'array' + && property_exists($zp_checkcache_json, 'status') + && $zp_checkcache_json->status == 'No Cache' ) + { + $zp_usecache = false; + } + else // Continue as normal with cache + { + $zp_imported = $zp_checkcache; + $zp_usecache = true; + } + + } + else // Otherwise, assume JS AJAX + { + $zp_imported = $zp_import_contents->get_request_contents( $zp_request_account["requests"][0], $zpr["update"] ); + } + + // Stop and let JS Ajax take over + if ( $checkcache + && ! $zp_usecache ) + continue; + + // Deal with possible error + if ( gettype($zp_imported) == "string" + && substr($zp_imported, 0, 5) == "Error" ) + { + $zp_error = substr($zp_imported, 7, -1); + } + + // Create all-requests json if doesn't exists + else + { + if ( empty($zp_request) ) + { + $zp_request = $zp_imported; + } + + else // Add to existing all-requests json + { + $zp_request["json"] = rtrim($zp_request["json"], "]") . "," . ltrim($zp_imported["json"], "[") . "]"; + } + } + if ( $zp_request["json"] == "Not found" ) + $zp_error = $zp_request["json"]; + // } elseif ( empty($zp_request) ) { + // $zp_request = $zp_imported; + // } else // Add to existing all-requests json + // { + // $zp_request["json"] = rtrim($zp_request["json"], "]") . "," . ltrim($zp_imported["json"], "[") . "]"; + // } + } // Just one request + } // Request the data (foreach) + } // If no error + + // Fix formatting quirk + if ( ( ! $checkcache && ! $zp_error ) + || ( $checkcache && $zp_usecache && ! $zp_error ) ) + $zp_request["json"] = str_replace("}}]]", "}}]", $zp_request["json"]); + + if ( ( ! $checkcache && ( ! $zp_error && $zp_request["json"] != "0" ) ) + || ( $checkcache && $zp_usecache && ( ! $zp_error && $zp_request["json"] != "0" ) ) ) + { + + // Decode the JSONs + // Thanks to Adnreea Onica @ StackOverflow + $temp_headers = json_decode( $zp_request["headers"] ); + // $temp_headers = json_encode( (array)$zp_request["headers"] ); + // $temp_headers = json_decode( str_replace('\u0000*\u0000','', $temp_headers) ); + + // $temp_data = json_encode( (array)$zp_request["json"] ); + // $temp_data = json_decode( str_replace('\u0000*\u0000','', $temp_data) ); + $temp_data = json_decode( $zp_request["json"] ); + + // Figure out if there's multiple requests and how many + // if ( $zpr["request_start"] == 0 + // && ( property_exists($temp_headers, 'link') + // && $temp_headers->link !== null ) + // && strpos( $temp_headers->link, 'rel="last"' ) !== false ) + + if ( $zpr["request_start"] == 0 + && isset( $temp_headers->link ) + && strpos( $temp_headers->link, 'rel="last"' ) !== false ) + { + $temp_link = explode( ";", $temp_headers->link ); + $temp_link = explode( "start=", $temp_link[1] ); + $temp_link = explode( "&", $temp_link[1] ); + + // // FIX: Accounted for limit ...? + // if ( $zpr["limit"] ) { + // $zp_request_meta["request_last"] = (int) $zpr["limit"]; + // } + // else { + $zp_request_meta["request_last"] = (int) $temp_link[0]; + // } + } + + // Figure out the next starting position for the next request, if any + // 7.3.3: Changed from >= to > + if ( $zp_request_meta["request_last"] >= ($zpr["request_start"] + $zpr["limit"]) ) + $zp_request_meta["request_next"] = $zpr["request_start"] + $zpr["limit"] ; + + // Overwrite request if limit + // 7.3.3: Fix for collections? + if ( ( $zpr["item_type"] == "items" || $zpr["item_type"] == "collections" ) + && $zpr["overwrite_request"] === true ) + { + $zp_request_meta["request_next"] = 0; + $zp_request_meta["request_last"] = 0; + } + + // Overwrite last_request + if ( $zpr["overwrite_last_request"] ) + { + // Make sure it's less than the total available items + if ( isset( $temp_headers->{"total-results"} ) + && $temp_headers->{"total-results"} < $zpr["overwrite_last_request"] ) + $zpr["overwrite_last_request"] = (int) (ceil( (int) $temp_headers->{"total-results"} / $zpr["limit"] ) - 1) * $zpr["limit"]; + else + $zpr["overwrite_last_request"] = (int) ceil( $zpr["overwrite_last_request"] / $zpr["limit"] ) * $zpr["limit"]; + + $zp_request_meta["request_last"] = $zpr["overwrite_last_request"]; + } +// var_dump($zpr["limit"]); +// var_dump( $zpr["request_start"], ((int) $zp_request_meta["request_next"]),$zp_request_meta["request_last"], $zpr["limit"],"

    "); + + + + // +-----------------+ + // | Format the data | + // +-----------------+ + + if ( count($temp_data) > 0 ) + { + // If single, place the object into an array + if ( gettype($temp_data) == "object" ) + { + $temp = $temp_data; + $temp_data = array(); + $temp_data[0] = $temp; + } + + // Set up conditional vars + if ( $zpr["shownotes"] ) $zp_notes_num = 1; + if ( $zpr["showimage"] ) $zp_showimage_keys = ""; + + // Get individual items + foreach ( $temp_data as $item ) + { + // Set target for links + $zp_target_output = ""; + if ( $zpr["target"] ) + $zp_target_output = "target='_blank' "; + + // Author filtering: skip non-matching authors + // TODO: Breaking with multi name + // EVENTUAL TODO: Zotero API 3 searches title and author, so wrong authors can appear + if ( $zpr["author"] + && count($item->data->creators) > 0 ) + { + $zp_authors_check = false; + + // Deal with multiple authors + if ( gettype($zpr["author"]) != "array" + && strpos($zpr["author"], ",") !== false ) + { + $zp_authors = explode( ",", $zpr["author"] ); + + foreach ( $zp_authors as $author ) + if ( zp_check_author_continue( $item, $author ) === true ) + $zp_authors_check = true; + } + + // Single author or inclusive + else + { + if ( $zpr["inclusive"] === false ) + { + $author_exists_count = 1; + + foreach ( $zpr["author"] as $author ) + if ( zp_check_author_continue( $item, $author ) === true ) + $author_exists_count++; + + if ( $author_exists_count === count($zpr["author"]) +1 ) + $zp_authors_check = true; + } + else // inclusive and single + { + if ( zp_check_author_continue( $item, $zpr["author"] ) === true ) + $zp_authors_check = true; + } + + // } elseif (zp_check_author_continue( $item, $zpr["author"] ) === true) { + // $zp_authors_check = true; + // } + } + + if ( $zp_authors_check === false ) + continue; + } // author + + // Year filtering: skip non-matching years + if ( $zpr["year"] + && isset($item->meta->parsedDate) ) + { + // multiple + if (strpos($zpr["year"], ",") !== false) + { + $zp_years_check = false; + $zp_years = explode( ",", $zpr["year"] ); + + foreach ( $zp_years as $year ) + if ( zp_get_year( $item->meta->parsedDate ) == $year ) + $zp_years_check = true; + + if ( ! $zp_years_check ) continue; + } + else // single + { + if ( zp_get_year( $item->meta->parsedDate ) != $zpr["year"] ) + continue; + } + // } elseif (zp_get_year( $item->meta->parsedDate ) != $zpr["year"]) { + // continue; + // } + } + + // Skip non-matching years for author-year pairs + // if ( $zpr["year"] && $zpr["author"] && (property_exists($item->meta, 'parsedDate') && $item->meta->parsedDate !== null) && zp_get_year( $item->meta->parsedDate ) != $zpr["year"] ) + if ( $zpr["year"] + && $zpr["author"] + && isset($item->meta->parsedDate) ) + continue; + + // Add item key for show image + if ( $zpr["showimage"] ) $zp_showimage_keys .= " ".$item->key; + + // Modify style based on language + // Languages: jp + if ( isset($item->data->language) + // && $item->data->language !== null + // && $item->data->language != "" + && $item->data->language == "ja" ) + { + // Change ", and " to comma + $item->bib = str_ireplace(", and ", ", ", $item->bib); + + // Remove "In " + $item->bib = str_ireplace("In ", "", $item->bib); + } + + // Hyperlink or URL Wrap + if ( isset($item->data->url) + // && $item->data->url !== null + && strlen($item->data->url) > 0 ) + { + if ( $zpr["urlwrap"] + && $zpr["urlwrap"] == "title" + && $item->data->title ) + { + // First: Get rid of text URL if it appears as text in the citation: + // REVIEW: Does this account for all citation styles? + /* chicago-author-date */ $item->bib = str_ireplace( htmlentities($item->data->url."."), "", $item->bib ); // Note the period + /* APA */ $item->bib = str_ireplace( htmlentities($item->data->url), "", $item->bib ); + $item->bib = str_ireplace( " Retrieved from ", "", $item->bib ); + $item->bib = str_ireplace( " Available from: ", "", $item->bib ); + + + // Next, get rid of double space characters (two space characters next to each other): + $item->bib = preg_replace( '/ /', ' ', preg_replace( '/[[:blank:]]+/', ' ', $item->bib ) ); + $item->data->title = preg_replace( '/ /', ' ', preg_replace( '/[[:blank:]]+/', ' ', $item->data->title ) ); + + + // Next, replace space entities with real spaces: + $item->bib = str_ireplace(" ", " ", $item->bib ); + $item->data->title = str_ireplace(" ", " ", $item->data->title ); + + + // Next, replace entity quotes: + $item->bib = str_ireplace( "“", """, + str_ireplace( "”", """, + htmlentities( + html_entity_decode( $item->bib, ENT_QUOTES, "UTF-8" ), + ENT_QUOTES, + "UTF-8" + ) + ) + ); + $item->data->title = str_ireplace( "“", """, + str_ireplace( "”", """, + htmlentities( + html_entity_decode( $item->data->title, ENT_QUOTES, "UTF-8" ), + ENT_QUOTES, + "UTF-8" + ) + ) + ); + + + // Next, replace special Word characters: + // Thanks to Walter Tross @ Stack Overflow; CC BY-SA 3.0: https://creativecommons.org/licenses/by-sa/3.0/ + $chr_map = array( + "\xC2\x82" => "'", // U+0082U+201A single low-9 quotation mark + "\xC2\x84" => '"', // U+0084U+201E double low-9 quotation mark + "\xC2\x8B" => "'", // U+008BU+2039 single left-pointing angle quotation mark + "\xC2\x91" => "'", // U+0091U+2018 left single quotation mark + "\xC2\x92" => "'", // U+0092U+2019 right single quotation mark + "\xC2\x93" => '"', // U+0093U+201C left double quotation mark + "\xC2\x94" => '"', // U+0094U+201D right double quotation mark + "\xC2\x9B" => "'", // U+009BU+203A single right-pointing angle quotation mark + "\xC2\xAB" => '"', // U+00AB left-pointing double angle quotation mark + "\xC2\xBB" => '"', // U+00BB right-pointing double angle quotation mark + "\xE2\x80\x98" => "'", // U+2018 left single quotation mark + "\xE2\x80\x99" => "'", // U+2019 right single quotation mark + "\xE2\x80\x9A" => "'", // U+201A single low-9 quotation mark + "\xE2\x80\x9B" => "'", // U+201B single high-reversed-9 quotation mark + "\xE2\x80\x9C" => '"', // U+201C left double quotation mark + "\xE2\x80\x9D" => '"', // U+201D right double quotation mark + "\xE2\x80\x9E" => '"', // U+201E double low-9 quotation mark + "\xE2\x80\x9F" => '"', // U+201F double high-reversed-9 quotation mark + "\xE2\x80\xB9" => "'", // U+2039 single left-pointing angle quotation mark + "\xE2\x80\xBA" => "'" // U+203A single right-pointing angle quotation mark + ); + $chr = array_keys( $chr_map ); + $rpl = array_values( $chr_map ); + $item->bib = str_ireplace( $chr, $rpl, html_entity_decode( $item->bib, ENT_QUOTES, "UTF-8" ) ); + $item->data->title = str_ireplace( $chr, $rpl, html_entity_decode( $item->data->title, ENT_QUOTES, "UTF-8" ) ); + + // Re-encode for foreign characters, but don't encode quotes: + $item->bib = htmlentities( $item->bib, ENT_NOQUOTES, "UTF-8" ); + $item->data->title = htmlentities( $item->data->title, ENT_NOQUOTES, "UTF-8" ); + + + // Next, prep title: + // $item->data->title = htmlentities( $item->data->title, ENT_COMPAT, "UTF-8" ); + + + // If wrapping title, wrap it: + $item->bib = str_ireplace( + $item->data->title, + "".$item->data->title."", + $item->bib + ); + + // Finally, revert bib entities: + $item->bib = html_entity_decode( $item->bib, ENT_QUOTES, "UTF-8" ); + $item->data->title = html_entity_decode( $item->data->title, ENT_QUOTES, "UTF-8" ); + + } + else // Just hyperlink the URL text + { + $item->bib = str_ireplace( + htmlentities($item->data->url), + "".$item->data->url."", + $item->bib + ); + } + } // Hyperlink or URL wrap + + // Hyperlink DOIs + if ( isset($item->data->DOI) + // && $item->data->DOI !== null + && strlen($item->data->DOI) > 0 ) + { + // Styles without http + if ( strpos( $item->bib, "doi:" ) !== false + && strpos( $item->bib, "doi.org" ) == false ) + { + $item->bib = str_ireplace( + "doi:" . $item->data->DOI, + "http://doi.org/".$item->data->DOI."", + $item->bib + ); + } + // Styles with http + elseif ( strpos( $item->bib, "http://doi.org/" ) !== false + && strpos( $item->bib, "" ) == false ) + { + $item->bib = str_ireplace( + "http://doi.org/" . $item->data->DOI, + "http://doi.org/".$item->data->DOI."", + $item->bib + ); + } + // HTTPS format + elseif ( strpos( $item->bib, "https://doi.org/" ) !== false + && strpos( $item->bib, "" ) == false ) + { + $item->bib = str_ireplace( + "https://doi.org/" . $item->data->DOI, + "https://doi.org/".$item->data->DOI."", + $item->bib + ); + } + } + + // Cite link (RIS) + if ( $zpr["citeable"] ) + $item->bib = preg_replace( '~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " Cite " . '$2', $item->bib, 1 ); + + // Highlight text + if ( $zpr["highlight"] ) + $item->bib = str_ireplace( $zpr["highlight"], "".$zpr["highlight"]."", $item->bib ); + + // Downloads, notes + if ( $zpr["downloadable"] + || $zpr["shownotes"] ) + { + // Check if item has children that could be downloads + if ( $item->meta->numChildren > 0 ) + { + // Get the user's account + $zp_account = zp_get_account ($wpdb, $zpr["api_user_id"]); + + $zp_child_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zpr["api_user_id"]."/items"; + $zp_child_url .= "/".$item->key."/children?"; + if (!is_null($zp_account[0]->public_key) && trim($zp_account[0]->public_key) != "") + $zp_child_url .= "key=".$zp_account[0]->public_key."&"; + $zp_child_url .= "&format=json&include=data"; + + // Get data + $zp_import_child = new ZotpressRequest(); + $zp_child_request = $zp_import_child->get_request_contents( $zp_child_url, $zpr["update"] ); + $zp_children = json_decode( $zp_child_request["json"] ); + + // If the item changes and no longer exists on + // the Zotero side, it will return an error message + if ( $zp_children != "Item not found" ) + { + $zp_download_meta = false; + $zp_notes_meta = array(); + + foreach ( $zp_children as $zp_child ) + { + // Check for downloads + if ( $zpr["downloadable"] ) + { + // Check for downloadable file (attached) + if ( isset($zp_child->data->linkMode) + && ( ( $zp_child->data->linkMode == "imported_file" + || $zp_child->data->linkMode == "imported_url" ) + && preg_match('(pdf|doc|docx|ppt|pptx|latex|rtf|odt|odp)', $zp_child->data->filename) === 1 ) ) + { + $zp_download_meta = array ( + "dlkey" => $zp_child->key, + "contentType" => $zp_child->data->contentType + ); + + // Display download link if file exists + if ( $zp_download_meta !== [] ) + $item->bib = preg_replace('~(.*)' . preg_quote( '', '~') . '(.*?)~', '$1' . " Download" . '$2', $item->bib, 1 ); + } + + // Check for link to downloadable file (third-party) + else if ( isset($zp_child->data->linkMode) + && ( $zp_child->data->linkMode == "linked_url" + && preg_match('(pdf|doc|docx|ppt|pptx|latex|rtf|odt|odp)', $zp_child->data->url) === 1 ) ) + { + $item->bib = preg_replace('~(.*)' . preg_quote( '', '~') . '(.*?)~', '$1' . " Download" . '$2', $item->bib, 1 ); + } + } + + // Check for notes + if ( $zpr["shownotes"] + && ( isset($zp_child->data->itemType) + && $zp_child->data->itemType == "note" ) ) + { + $zp_notes_meta[count($zp_notes_meta)] = $zp_child->data->note; + } + } + + // // Display download link if file exists + // if ( $zp_download_meta ) + // $item->bib = preg_replace('~(.*)' . preg_quote( '', '~') . '(.*?)~', '$1' . " Download" . '$2', $item->bib, 1 ); + + // Display notes, if any + if ( $zp_notes_meta !== [] ) + { + $temp_notes = "
  • key."\">\n"; + + if ( count($zp_notes_meta) == 1 ) + { + $temp_notes .= $zp_notes_meta[0]."\n"; + } + else // multiple + { + $temp_notes .= "
      \n"; + + foreach ($zp_notes_meta as $zp_note_meta) + $temp_notes .= "
    • " . $zp_note_meta . "\n
    • \n"; + + $temp_notes .= "\n
    \n\n"; + } + + // Add to item + $item->notes = $temp_notes . "
  • \n"; + + // Add note reference to citation + $note_class = "zp-Notes-Reference"; if ( is_admin_bar_showing() ) $note_class .= " zp-Admin-Bar-Showing"; + $item->bib = preg_replace('~(.*)' . preg_quote('', '~') . '(.*?)~', '$1' . " key."\">".$zp_notes_num." " . '$2', $item->bib, 1); + $zp_notes_num++; + } + } // Children exist; not "Item not found" + } // Check if item has children + } // $zpr["downloadable"] + + $zp_all_the_data[] = $item; + + } // foreach item + + // Show tags + if ( $zpr["showtags"] ) + { + // Decode JSON format + $zp_tags = json_decode( $zp_request["tags"] ); + + // Just add to the data; let the front-end handle the display + // i.e., add to item.data.tags + foreach ( $zp_all_the_data as $id => $data ) + { + // Tags are connected to item key + if ( property_exists( $zp_tags, $data->key ) ) + $zp_all_the_data[$id]->data->tags = $zp_tags->{$data->key}; + } + } + + + // Show images + if ( $zpr["showimage"] ) + { + // Get images for all item keys from zpdb, if they exist + $zp_images = $wpdb->get_results( + " + SELECT * FROM ".$wpdb->prefix."zotpress_zoteroItemImages + WHERE ".$wpdb->prefix."zotpress_zoteroItemImages.item_key IN ('".str_replace( " ", "', '", trim($zp_showimage_keys) )."') + " + ); + + if ( count($zp_images) > 0 ) + { + foreach ( $zp_images as $image ) + { + $zp_thumbnail = wp_get_attachment_image_src($image->image); + + foreach ( $zp_all_the_data as $id => $data ) + { + if ( $data->key == $image->item_key) + { + $zp_all_the_data[$id]->image = $zp_thumbnail; + + // URL Wrap for images + if ( $zpr["urlwrap"] && $zpr["urlwrap"] == "image" && $zp_all_the_data[$id]->data->url != "" ) + { + // Get rid of default URL listing + // TODO: Does this account for all citation styles? + $zp_all_the_data[$id]->bib = str_replace( htmlentities($zp_all_the_data[$id]->data->url), "", $zp_all_the_data[$id]->bib ); + $zp_all_the_data[$id]->bib = str_replace( " Retrieved from ", "", $zp_all_the_data[$id]->bib ); + $zp_all_the_data[$id]->bib = str_replace( " Available from: ", "", $zp_all_the_data[$id]->bib ); + } + } + } + } + } // If images found in zpdb + + // Check open lib next + // REVIEW: Will break if Open Library is down! + if ( $zpr["showimage"] === "openlib" ) + { + $zp_showimage_keys = explode( ",", $zp_showimage_keys ); + + foreach ( $zp_all_the_data as $id => $data ) + { + if ( ! in_array( $data->key, $zp_showimage_keys ) + && ( isset($data->data->ISBN) && $data->data->ISBN != "" ) ) + { + $openlib_url = "http://covers.openlibrary.org/b/isbn/".$data->data->ISBN."-M.jpg"; + + // First, get the headers + $openlib_headers = @get_headers( $openlib_url ); + + // And make sure Open Library / the source is online + if ( $openlib_headers[0] == "HTTP/1.1 302 Found" ) + { + $zp_all_the_data[$id]->image = array( $openlib_url ); + + // URL Wrap for images + if ( $zpr["urlwrap"] + && $zpr["urlwrap"] == 'image' + && $zp_all_the_data[$id]->data->url != '' ) + { + // Get rid of default URL listing + // TODO: Does this account for all citation styles? + $zp_all_the_data[$id]->bib = str_replace( htmlentities($zp_all_the_data[$id]->data->url), "", $zp_all_the_data[$id]->bib ); + $zp_all_the_data[$id]->bib = str_replace( " Retrieved from ", "", $zp_all_the_data[$id]->bib ); + $zp_all_the_data[$id]->bib = str_replace( " Available from: ", "", $zp_all_the_data[$id]->bib ); + } + } + } + } + } + } + + // Re-sort with order of entry if bib and default sort + if ( $zpr["item_type"] == "items" + && $zpr["sortby"] == "default" + && count($zpr["item_keys_order"]) > 0 ) + { + $temp_arr = array(); + + foreach ( $zpr["item_keys_order"] as $temp_key ) + { + foreach ( $zp_all_the_data as $temp_data ) + { + if ( $temp_data->key == $temp_key ) $temp_arr[] = $temp_data; + } + } + + $zp_all_the_data = $temp_arr; + } + } + } + + else // No results + { + // $zp_all_the_data = ""; // Necessary? + } + + + + // +----------------------------+ + // | Finish and output the data | + // +----------------------------+ + + unset($zp_import_contents); + unset($zp_import_url); + unset($zp_xml); + unset($api_user_id); + unset($zp_account); + + $wpdb->flush(); + + // Deal with cache scenario + if ( ( $checkcache && $zp_usecache ) + || ( ! $checkcache ) ) + { + $zp_output = ''; + + if ( count($zp_all_the_data) > 0 + && $zp_all_the_data != "" ) + { + if ( $is_ajax ) + { + $zp_output = json_encode( + array ( + "status" => "success", + "instance" => $zpr["instance_id"], + "meta" => $zp_request_meta, + "data" => $zp_all_the_data + ) + ); + + echo $zp_output; + exit(); // REVIEW: Causing to break if error + } + else // PHP + { + $zp_output = ''; + + foreach ( $zp_all_the_data as $zp_citation ) + { + // QUESTION: Why is it a string? + // $zp_citation = json_decode($zp_citation); + + $zp_output .= '
    bib; + $zp_output .= '
    '; + } + return $zp_output; + } + } + else // No data or error + { + if ( ! isset($zpr["instance_id"]) ) + $zpr["instance_id"] = false; + + if ( $is_ajax ) + if ( $zp_error ) + $zp_output = json_encode( + array ( + "status" => "error", + "instance" => $zpr["instance_id"], + "meta" => $zp_request_meta, + "data" => $zp_error + ) + ); + else // catchall, likely just no items for request + $zp_output = json_encode( + array ( + "status" => "empty", + "instance" => $zpr["instance_id"], + "meta" => $zp_request_meta, + "data" => "0" + ) + ); + + echo $zp_output; + + if ( $is_ajax ) + exit(); // REVIEW: Causing to break if error + } + } +} +add_action( 'wp_ajax_zpRetrieveViaShortcode', 'Zotpress_shortcode_request' ); +add_action( 'wp_ajax_nopriv_zpRetrieveViaShortcode', 'Zotpress_shortcode_request' ); + +?> diff --git a/lib/tinymce-plugin/css/zotpress.tinymce.css b/lib/tinymce-plugin/css/zotpress.tinymce.css deleted file mode 100644 index 359991e..0000000 --- a/lib/tinymce-plugin/css/zotpress.tinymce.css +++ /dev/null @@ -1,12 +0,0 @@ - - - /* Spans that are automatically wrapped around shortcodes in the editor */ - .zp-ZotpressShortcode { - background-color: #eee; - } - .zp-ZotpressShortcode:hover { - background-color: #ccc; - } - .zp-ZotpressShortcode .shortcode { - display: none; - } diff --git a/lib/tinymce-plugin/images/icon-bib.png b/lib/tinymce-plugin/images/icon-bib.png deleted file mode 100644 index bf4d729..0000000 Binary files a/lib/tinymce-plugin/images/icon-bib.png and /dev/null differ diff --git a/lib/tinymce-plugin/images/icon-cite.png b/lib/tinymce-plugin/images/icon-cite.png deleted file mode 100644 index 92ecc79..0000000 Binary files a/lib/tinymce-plugin/images/icon-cite.png and /dev/null differ diff --git a/lib/tinymce-plugin/images/icon-list.png b/lib/tinymce-plugin/images/icon-list.png deleted file mode 100644 index f5f7dbc..0000000 Binary files a/lib/tinymce-plugin/images/icon-list.png and /dev/null differ diff --git a/lib/tinymce-plugin/zotpress-tinymce-plugin.js b/lib/tinymce-plugin/zotpress-tinymce-plugin.js deleted file mode 100644 index d864045..0000000 --- a/lib/tinymce-plugin/zotpress-tinymce-plugin.js +++ /dev/null @@ -1,117 +0,0 @@ -(function() -{ - // Popup window - var zpTinyMCEWidget = function(ed, url, type, shortcode, summary) - { - shortcode = typeof shortcode !== 'undefined' ? shortcode : false; - summary = typeof summary !== 'undefined' ? summary : false; - - var zpurl = url + "/../widget/widget.tinymce.bib.php"; - if (type == 'cite') zpurl = url + "/../widget/widget.tinymce.cite.php"; - else if (type == 'list') zpurl = url + "/../widget/widget.tinymce.list.php"; - - var zptitle = 'Zotpress Bibliography'; - if (type == 'cite') zptitle = 'Zotpress In-Text Citation'; - else if (type == 'list') zptitle = 'Zotpress In-Text Bibliography'; - - ed.windowManager.open( - { - title: zptitle, - url : zpurl, - inline: 1, - scrollbars: 1, - width : 320, - height : 240 - }, - { - shortcode : shortcode, - summary: summary - }); - }; - - - tinymce.create('tinymce.plugins.zotpress', - { - init : function(ed, url) - { - // Styles - ed.contentCSS.push( url + "/css/zotpress.tinymce.css?" + new Date().getTime() ); - - // Buttons - ed.addButton('zotpress-cite', - { - title : 'Add/Edit In-Text Citation', - image : url+'/images/icon-cite.png', - onclick : function() { - var scShortcode = jQuery(ed.selection.getContent({format : 'html'})).find('.shortcode').text(); - var scSummary = jQuery(ed.selection.getContent({format : 'html'})).find('.summary').text(); - zpTinyMCEWidget(ed, url, 'cite', scShortcode, scSummary); - } - }); - ed.addButton('zotpress-list', - { - title : 'Add/Edit In-Text Bibliography', - image : url+'/images/icon-list.png', - onclick : function() { - zpTinyMCEWidget(ed, url, 'list', ed.selection.getContent({format : 'text'})); - } - }); - ed.addButton('zotpress-bib', - { - title : 'Add/Edit Bibliography', - image : url+'/images/icon-bib.png', - onclick : function() { - var scShortcode = jQuery(ed.selection.getContent({format : 'html'})).find('.shortcode').text(); - var scSummary = jQuery(ed.selection.getContent({format : 'html'})).find('.summary').text(); - zpTinyMCEWidget(ed, url, 'bib', scShortcode, scSummary); - } - }); - - // Click events - ed.onClick.add(function(ed, e) - { - if ( jQuery(e.target).hasClass('zp-ZotpressShortcode') ) - { - ed.selection.select(e.target); - } - else if ( jQuery(e.target).hasClass('summary') ) - { - ed.selection.select(e.target.parentElement); // cross-browser? - } - }); - ed.onDblClick.add(function(ed, e) - { - var zpTarget = e.target; - if ( jQuery(zpTarget).hasClass('zp-ZotpressShortcode') || jQuery(zpTarget).hasClass('summary') ) - { - if ( jQuery(zpTarget).hasClass('summary') ) zpTarget = zpTarget.parentElement; - - var zpType = 'bib'; - if ( jQuery(zpTarget).hasClass('cite') ) zpType = 'cite'; - else if ( jQuery(zpTarget).hasClass('list') ) zpType = 'list'; - - if ( zpType == 'cite' || zpType == 'bib' ) - { - //var scText = jQuery(zpTarget).text().split('=zp='); - //zpTinyMCEWidget(ed, zpType, scText[1], scText[0]); - - var scShortcode = jQuery(ed.selection.getContent({format : 'html'})).find('.shortcode').text(); - var scSummary = jQuery(ed.selection.getContent({format : 'html'})).find('.summary').text(); - zpTinyMCEWidget(ed, url, zpType, scShortcode, scSummary); - } - else - { - zpTinyMCEWidget(ed, url, zpType, jQuery(zpTarget).text()); - } - } - }); - - }, - createControl : function(n, cm) { - return null; - } - }); - - tinymce.PluginManager.add('zotpress', tinymce.plugins.zotpress); -} -)(); \ No newline at end of file diff --git a/lib/widget/widget.ckeditor.php b/lib/widget/widget.ckeditor.php deleted file mode 100644 index 006cfda..0000000 --- a/lib/widget/widget.ckeditor.php +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - - - -
    > - - -
    - - - - - - - -
    - - -
    - - - - -
    - - - -
    - - -
    - -
    - - - -
    - - - - -
    - - -
    - -
    - - - - -
    - - - -

    Optional. Single number or a range, e.g. 3-10.

    -
    - - - - - - - -
    - - -
    - - -
    - - - -
    -

    *Only required if you have more than one account.

    -
    - - - - -
    - get_results("SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress ORDER BY account_type DESC"); - $zp_accounts_total = $wpdb->num_rows; - - if ($zp_accounts_total > 0) - { - $zp_userids = ""; - $zp_nicks = ""; - foreach ($zp_accounts as $zp_account) - { - $zp_userids .= "\n"; - $zp_nicks .= "\n"; - } - } - - ?> - - -
    - - - -
    -

    Optional. Be sure to replace spaces with a +.

    - - - - - - -
    - - - -
    -

    Optional. Default is "items."

    - - -
    - - - -
    -

    Optional. Default is "bib."

    - - -

    Optional. Displays title by year.

    - - -

    Optional. Displays image if exists.

    - - -
    - - - -
    - -

    Optional. Default is "."

    - - - - - - - - - -
    loading
    -
    Success!
    -
    Errors!
    - - -
    - - - -
    -

    Optional. Default is "latest."

    - - -

    Optional. Default is "desc."

    - - -
    - - - -
    -

    Optional. Displays download link.

    - - -

    Optional. Displays note/s if they exist.

    - - -
    - - -
    - - -
    - -

    Copy-n-paste at the end of your post.

    - -
    -
    - -
    - -
    - - - - - -
    - - - - - - - -
    - - -
    - - - -
    - - - -
    - - - - - - \ No newline at end of file diff --git a/lib/widget/widget.metabox.actions.php b/lib/widget/widget.metabox.actions.php deleted file mode 100644 index 850976a..0000000 --- a/lib/widget/widget.metabox.actions.php +++ /dev/null @@ -1,376 +0,0 @@ - 403 ) ); - - // Include import functions - require_once("../import/import.functions.php"); - - // Set up XML document - $xml = ""; - - - if (isset($_GET['submit'])) - { - // Set up error array - $errors = array("account_empty"=>array(0,"Account was left blank."), - "account_format"=>array(0,"Account was incorrectly formatted."), - "editor_empty"=>array(0,"Editor was left blank."), - "editor_format"=>array(0,"Editor was incorrectly formatted."), - "style_empty"=>array(0,"Style was left blank."), - "style_format"=>array(0,"Style was incorrectly formatted."), - "reset_empty"=>array(0,"Reset was left blank."), - "reset_format"=>array(0,"Reset was incorrect."), - "cpt_empty"=>array(0,"Reference Widget was left blank."), - "cpt_format"=>array(0,"Reference Widget was incorrect."), - "autoupdate_empty"=>array(0,"Autoupdate was left blank."), - "autoupdate_format"=>array(0,"Autoupdate was incorrectly formatted."), - "post_empty"=>array(0,"Post ID was left blank."), - "post_format"=>array(0,"Post ID was incorrectly formatted.")); - - - - /* - - SET DEFAULT ACCOUNT - - */ - - if (isset($_GET['account'])) - { - - // Check the post variables and record errors - if (trim($_GET['account']) != '') - if (preg_match('/^[\'0-9a-zA-Z -_]+$/', stripslashes($_GET['account'])) == 1) - $account = str_replace("'","",str_replace(" ","",trim(urldecode($_GET['account'])))); - else - $errors['account_format'][0] = 1; - else - $errors['account_empty'][0] = 1; - - - // CHECK ERRORS - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // SET DEFAULT STYLE - if ($errorCheck == false) - { - update_option("Zotpress_DefaultAccount", $account); - $xml .= "\n"; - } - } // default account - - - - /* - - SET REFERENCE WIDGET - - */ - - else if (isset($_GET['cpt'])) - { - // Check the post variables and record errors - if (trim($_GET['cpt']) != '') - if (preg_match('/^[\'0-9a-zA-Z -_,]+$/', stripslashes($_GET['cpt'])) == 1) - $cpt = trim($_GET['cpt']); - else - $errors['account_format'][0] = 1; - else - $errors['account_empty'][0] = 1; - - - // CHECK ERRORS - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // SET DEFAULT STYLE - if ($errorCheck == false) - { - update_option("Zotpress_DefaultCPT", $cpt); - $xml .= "\n"; - } - } // default reference widget - - - - /* - - SET DEFAULT FOR EDITOR FEATURES - - */ - - else if (isset($_GET['editor'])) - { - - // Check the post variables and record errors - if (trim($_GET['editor']) != '') - if (preg_match('/^[\'a-zA-Z _]+$/', stripslashes($_GET['editor'])) == 1) - $editor = str_replace("'","",str_replace(" ","",trim(urldecode($_GET['editor'])))); - else - $errors['editor_format'][0] = 1; - else - $errors['editor_empty'][0] = 1; - - - // CHECK ERRORS - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // SET DEFAULT STYLE - if ($errorCheck == false) - { - update_option("Zotpress_DefaultEditor", $editor); - $xml .= "\n"; - } - } // default editor features - - - - /* - - SET AUTOUPDATE - - */ - - else if (isset($_GET['autoupdate'])) - { - - // Check the post variables and record errors - if (trim($_GET['autoupdate']) != '') - if (preg_match('/^[\'0-9a-zA-Z -_]+$/', stripslashes($_GET['autoupdate'])) == 1) - $autoupdate = str_replace("'","",str_replace(" ","",trim(urldecode($_GET['autoupdate'])))); - else - $errors['autoupdate_format'][0] = 1; - else - $errors['autoupdate_empty'][0] = 1; - - - // CHECK ERRORS - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // SET DEFAULT STYLE - if ($errorCheck == false) - { - update_option("Zotpress_DefaultAutoUpdate", strtolower($autoupdate)); - $xml .= "\n"; - } - } // autoupdate - - - - /* - - SET RESET - - */ - - else if (isset($_GET['reset'])) - { - - // Check the post variables and record errors - if (trim($_GET['reset']) == 'true') - $reset = $_GET['reset']; - else - $errors['reset_empty'][0] = 1; - - - // CHECK ERRORS - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // SET DEFAULT STYLE - if ($errorCheck == false) - { - global $wpdb; - global $current_user; - - // Drop all tables except accounts/main - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress;"); - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_oauth;"); - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroItems;"); - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroCollections;"); - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroTags;"); - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroRelItemColl;"); - $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."zotpress_zoteroRelItemTags;"); - - /*// Delete entries/items - $zp_entry_array = get_posts( - array( - 'posts_per_page' => -1, - 'post_type' => 'zp_entry' - ) - ); - foreach ($zp_entry_array as $zp_entry) wp_delete_post( $zp_entry->ID, true ); - - // Delete collections - $zp_collections_array = get_terms( - 'zp_collections', - array( - 'hide_empty' => false - ) - ); - foreach ($zp_collections_array as $zp_collection_term) zp_delete_collection ($zp_collection_term->term_id); - - // Delete tags - $zp_tags_array = get_terms( - 'zp_tags', - array( - 'hide_empty' => false - ) - ); - foreach ($zp_tags_array as $zp_tag_term) zp_delete_tag ($zp_tag_term->term_id);*/ - - //delete_option( 'ZOTPRESS_PASSCODE' ); - delete_option( 'Zotpress_DefaultAccount' ); - delete_option( 'Zotpress_DefaultEditor' ); - delete_option( 'Zotpress_LastAutoUpdate' ); - delete_option( 'Zotpress_DefaultStyle' ); - delete_option( 'Zotpress_StyleList' ); - delete_option( 'Zotpress_DefaultAutoUpdate' ); - delete_option( 'Zotpress_update_version' ); - delete_option( 'Zotpress_main_db_version' ); - delete_option( 'Zotpress_oauth_db_version' ); - delete_option( 'Zotpress_zoteroItems_db_version' ); - delete_option( 'Zotpress_zoteroCollections_db_version' ); - delete_option( 'Zotpress_zoteroTags_db_version' ); - delete_option( 'Zotpress_zoteroRelItemColl_db_version' ); - delete_option( 'Zotpress_zoteroRelItemTags_db_version' ); - delete_option( 'Zotpress_zoteroItemImages_db_version' ); - - delete_user_meta( $current_user->ID, 'zotpress_5_2_ignore_notice' ); - delete_user_meta( $current_user->ID, 'zotpress_survey_notice_ignore' ); - - $xml .= "\n"; - } - } // reset - - - - /* - - SET DEFAULT STYLE - - */ - - else if (isset($_GET['style'])) - { - - // Check the post variables and record errors - if (trim($_GET['style']) != '') - if (preg_match('/^[\'0-9a-zA-Z -_]+$/', stripslashes($_GET['style'])) == 1) - $style = str_replace("'","",str_replace(" ","",trim(urldecode($_GET['style'])))); - else - $errors['style_format'][0] = 1; - else - $errors['style_empty'][0] = 1; - - // Only for post-specific - if (isset($_GET['forpost']) && $_GET['forpost'] == "true") - if (isset($_GET['post']) && trim($_GET['post']) != '') - if (preg_match('/^[\'0-9]+$/', stripslashes($_GET['post'])) == 1) - $post = str_replace("'","",str_replace(" ","",trim(urldecode($_GET['post'])))); - else - $errors['post_format'][0] = 1; - else - $errors['post_empty'][0] = 1; - - - // CHECK ERRORS - $errorCheck = false; - foreach ($errors as $field => $error) { - if ($error[0] == 1) { - $errorCheck = true; - break; - } - } - - - // SET DEFAULT STYLE - if ($errorCheck == false) - { - // Update style list - if (strpos(get_option("Zotpress_StyleList"), $style) === false) - update_option( "Zotpress_StyleList", get_option("Zotpress_StyleList") . ", " . $style); - - // Update default style - if (isset($_GET['forpost']) && $_GET['forpost'] == "true") - { - update_option("Zotpress_DefaultStyle_".$post, $style); - $xml .= "\n"; - } - else // Overal defaults - { - update_option("Zotpress_DefaultStyle", $style); - $xml .= "\n"; - } - } - } // default style - - - // DISPLAY ERRORS - else - { - $xml .= "\n"; - $xml .= "\n"; - foreach ($errors as $field => $error) - if ($error[0] == 1) - $xml .= $error[1]."\n"; - $xml .= "\n"; - } - - } // isset(submit) - - - - /* - - DISPLAY XML - - */ - - header('Content-Type: application/xml; charset=ISO-8859-1'); - echo "\n"; - echo "\n"; - echo $xml; - echo ""; - -?> \ No newline at end of file diff --git a/lib/widget/widget.metabox.php b/lib/widget/widget.metabox.php index fd8f949..ae59a5e 100644 --- a/lib/widget/widget.metabox.php +++ b/lib/widget/widget.metabox.php @@ -1,496 +1,503 @@ - +
    - - - - - - - - - -
    - - get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."zotpress;") > 1) - { - // See if default exists - $zp_default_account = false; - if (get_option("Zotpress_DefaultAccount")) $zp_default_account = get_option("Zotpress_DefaultAccount"); - - if ($zp_default_account !== false) - { - $zp_account = $wpdb->get_results( - $wpdb->prepare( - " - SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress - WHERE api_user_id = %s - ", - $zp_default_account - ) - ); - } - else - { - $zp_account = $wpdb->get_results( - " - SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress LIMIT 1; - " - ); - } - - if (is_null($zp_account[0]->nickname) === false && $zp_account[0]->nickname != "") - $zp_default_account = $zp_account[0]->nickname . " (" . $zp_account[0]->api_user_id . ")"; - ?> - -
    - Searching . Change account? -
    - - - - - -
    - - - -

    - - - - -
    - -

    Options

    - -
    - - - - -
    - - - - -
    - - - -

    Add more styles here. Note: Requires re-import.

    - -
    - - - - - -
    - -
    - Sort order: -
    - - - - - -
    -
    - -
    - -
    - Show images? -
    - - - - - -
    -
    - -
    - -
    - Show title by year? -
    - - - - - -
    -
    - -
    - -
    - Downloadable? -
    - - - - - -
    -
    - -
    - -
    - Abstract? -
    - - - - - -
    -
    - -
    - -
    - Notes? -
    - - - - - -
    -
    - -
    - -
    - Citable (in RIS format)? -
    - - - - - -
    -
    - -
    - - - - -
    -
    - - - -
    - - Generate Shortcode - Clear - -
    - -
    - - -
    -
    - - -
    - - - - - - - -
    - - get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."zotpress;") > 1) { ?> - -
    - get_results( - $wpdb->prepare( - " - SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress - WHERE api_user_id = %s", - $zp_default_account - ) - ); - } - else - { - $zp_account = $wpdb->get_results( - " - SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress LIMIT 1; - " - ); - } - - if (is_null($zp_account[0]->nickname) === false && $zp_account[0]->nickname != "") - $zp_default_account = $zp_account[0]->nickname . " (" . $zp_account[0]->api_user_id . ")"; - - ?> - Searching . Change account? -
    - - - - -
    - - - -

    - - - -
    - -

    Options

    - -
    - -
    In-Text Options
    - - - -

    Use these placeholders: %a% for author, %d% for date, %p% for page, %num% for list number.

    - -
    - - - - -
    - - - - -
    - - - - -
    Bibliography Options
    - - - -

    Add more styles here. Note: Requires re-import.

    - -
    - - - - - -
    - -
    - Sort order: -
    - - - - - -
    -
    - -
    - -
    - Show images? -
    - - - - - -
    -
    - -
    - -
    - Show title by year? -
    - - - - - -
    -
    - -
    - -
    - Downloadable? -
    - - - - - -
    -
    - -
    - -
    - Abstract? -
    - - - - - -
    -
    - -
    - -
    - Notes? -
    - - - - - -
    -
    - -
    - -
    - Citable (in RIS format)? -
    - - - - - -
    -
    - -
    -
    - - - -
    - - Generate Shortcode - Clear - -
    - -
    - - - -
    - - -
    -
    -
    - - -
    - - - - - -
    - - +
    + + get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."zotpress;") > 1) + { + // See if default exists + $zp_default_account = false; + if (get_option("Zotpress_DefaultAccount")) $zp_default_account = get_option("Zotpress_DefaultAccount"); + + if ($zp_default_account !== false) + { + $zp_account = eb_zotpress_get_account($zp_default_account); + } + else + { + $zp_account = eb_zotpress_get_account(); + } + + if (is_null($zp_account->nickname) === false && $zp_account->nickname != "") { + $zp_default_account = $zp_account->nickname . " (" . $zp_account->api_user_id . ")"; + } + ?> + +
    + +
    + + + +
    +
    + + + + + + + +
    +
    +
    +
    + + + +
    +

    :

    +
      +
    • +
    • +
    • +
    +
    + + + + + + + +
    + + +
    + +

    :

    + +
    + + + + +
    + + + + +
    + + + +

    .

    + +
    + +
    + + +
    + +
    + +
    + : +
    + + + + + +
    +
    + +
    + + + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + + +
    + +
    +
    + + + +
    + + + + +
    + +
    + + +
    +
    + + +
    + + + + + +
    + + +
    + +

    :

    + +
    + + + +

    %a% for author, %d% for date, %p% for page, %num% for list number.
    ','zotpress'); ?>

    +

    + +
    + +
    + + +
    + +
    + +
    + + +
    + +
    + +
    + + +
    + +
    + +
    + + +
    +
    +
    + + + +
    + + + + +
    + +
    + + +
    +
    + + +
    + + + + + + +
    + + +
    + +

    :

    + +
    + + +

    .

    + +
    + + +
    + + +
    + +
    + +
    + : +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + ? +
    + + + + + +
    +
    + +
    + +
    + S? +
    + + + + + +
    +
    +
    +
    + + +
    + + + + +
    + +
    +
    + + +
    +
    +
    + + +
    + +
    + + + + + + + diff --git a/lib/widget/widget.metabox.search.php b/lib/widget/widget.metabox.search.php deleted file mode 100644 index 5acd8ec..0000000 --- a/lib/widget/widget.metabox.search.php +++ /dev/null @@ -1,81 +0,0 @@ - 403 ) ); - - global $wpdb; - - header('Content-type: text/html; charset=utf-8'); - - // Determine account - if (get_option("Zotpress_DefaultAccount")) - { - $zp_api_user_id = get_option("Zotpress_DefaultAccount"); - } - else - { - $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress LIMIT 1", OBJECT); - $zp_api_user_id = $zp_account->api_user_id; - } - - - $zpSearchResults = $wpdb->get_results( - $wpdb->prepare( - " - SELECT author, json, CONCAT(' (', year, '). ', title, '.') AS label, item_key AS value FROM ".$wpdb->prefix."zotpress_zoteroItems - WHERE api_user_id='".$zp_api_user_id."' AND json LIKE %s AND itemType NOT IN ('attachment', 'note') ORDER BY author ASC - ", - '%' . $wpdb->esc_like($_GET['term']) . '%' - ), OBJECT ); - - $zpSearch = array(); - - if ( count($zpSearchResults) > 0 ) - { - foreach ( $zpSearchResults as $zpResult ) - { - // Deal with author - $author = $zpResult->author; - $zpResultJSON = json_decode( $zpResult->json ); - - if ( $author == "" ) - { - if ( isset($zpResultJSON->creators) && count($zpResultJSON->creators) > 0 ) - foreach ( $zpResultJSON->creators as $i => $creator ) - if ( $i != (count($zpResultJSON->creators)-1) ) - $author .= $creator->name . ', '; - else - $author .= $creator->name; - } - - array_push( $zpSearch, array( "author" => $author, "label" => $zpResult->label, "value" => $zpResult->value) ); - } - } - - echo json_encode($zpSearch); - - unset($zp_api_user_id); - unset($zp_account); - $wpdb->flush(); - -?> \ No newline at end of file diff --git a/lib/widget/widget.php b/lib/widget/widget.php new file mode 100644 index 0000000..04779e0 --- /dev/null +++ b/lib/widget/widget.php @@ -0,0 +1,185 @@ + true, + // ) + ); + } +} +add_action('admin_init', 'Zotpress_add_meta_box', 1); // backwards compatible + +function ZotpressMetaBox_callback() { require( dirname(__FILE__) . '/widget.metabox.php'); } + + + +// Set up Widget Metabox AJAX search +function Zotpress_widget_metabox_AJAX_search() +{ + global $wpdb; + + // Determine account based on passed account + if ($_GET['api_user_id'] && is_numeric($_GET['api_user_id'])) { + $zp_account = eb_zotpress_get_account( $_GET['api_user_id'] ); + $zp_api_user_id = $zp_account->api_user_id; + $zp_nickname = $zp_account->nickname; + } elseif (get_option("Zotpress_DefaultAccount")) { + $zp_api_user_id = get_option("Zotpress_DefaultAccount"); + $zp_account = eb_zotpress_get_account( $zp_api_user_id ); + $zp_nickname = $zp_account->nickname; + } else + { + $zp_account = eb_zotpress_get_account(); + $zp_api_user_id = $zp_account->api_user_id; + $zp_nickname = $zp_account->nickname; + } + + $zpSearch = array(); + + // Include relevant classes and functions + include( dirname(__FILE__) . '/../request/request.class.php' ); + include( dirname(__FILE__) . '/../request/request.functions.php' ); + + // Set up Zotpress request + $zp_import_contents = new ZotpressRequest(); + + // Get account + $zp_account = zp_get_account ($wpdb, $zp_api_user_id); + + // Format Zotero request URL + // e.g., https://api.zotero.org/users/#####/items?key=###&format=json&q=###&limit=25 + $zp_import_url = "https://api.zotero.org/".$zp_account[0]->account_type."/".$zp_account[0]->api_user_id."/items?"; + if (!is_null($zp_account[0]->public_key) && trim($zp_account[0]->public_key) != "") + $zp_import_url .= "key=".$zp_account[0]->public_key."&"; + $zp_import_url .= "format=json&q=".urlencode($_GET['term'])."&limit=10&itemType=-attachment+||+note"; + + // Read the external data + $zp_xml = $zp_import_contents->get_request_contents( $zp_import_url, true ); // Unsure about "true" + $zpResultJSON = json_decode( $zp_xml["json"] ); + + if ( count($zpResultJSON) > 0 ) + { + foreach ( $zpResultJSON as $zpResult ) + { + // Deal with author(s) + $author = "N/A"; + if ( property_exists($zpResult->data, 'creators') && $zpResult->data->creators !== null ) + { + $author = ""; + foreach ( $zpResult->data->creators as $i => $creator) + { + if ( property_exists($creator, 'name') && $creator->name !== null ) + $author .= $creator->name; + else + $author .= $creator->lastName; + + if ( $i != count($zpResult->data->creators)-1 ) $author .= ', '; + } + } + + // Deal with label + // e.g., (year). title + $label = " ("; + if ( property_exists($zpResult->data, 'date') && $zpResult->data->date !== null && trim($zpResult->data->date) != "" ) $label .= $zpResult->data->date; else $label .= "n.d."; + $label .= "). "; + $title = "Untitled."; if ( property_exists($zpResult->data, 'title') && $zpResult->data->title !== null && trim($zpResult->data->title) != "" ) $title = $zpResult->data->title . "."; + + // If no author, use title + if ( trim($author) == "" ) + { + $author = $title; + $title = ""; + } + $label .= $title; + + $zpSearch[] = array( "api_user_id" => $zp_api_user_id, "nickname" => $zp_nickname, "author" => $author, "label" => $label, "value" => $zpResult->key); + } + } + + unset($zp_import_contents); + unset($zp_import_url); + unset($zp_xml); + + + $response = json_encode($zpSearch); + echo $response; + + unset($zp_api_user_id); + unset($zp_account); + + exit(); +} +add_action( 'wp_ajax_zpWidgetMetabox-submit', 'Zotpress_widget_metabox_AJAX_search' ); + + + +// Set relevant admin-level Widget Metabox scripts +function Zotpress_zpWidgetMetabox_scripts_css($hook) +{ + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + if ( in_array( $hook, array('post.php', 'post-new.php') ) ) + { + wp_enqueue_script( 'jquery.livequery.min.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.livequery.min.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-tabs', 'jquery-ui-autocomplete' ) ); + wp_enqueue_script( 'zotpress.widget.metabox'.$minify.'.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.widget.metabox'.$minify.'.js', array( 'jquery', 'jquery-form', 'json2' ) ); + + wp_localize_script( + 'zotpress.widget.metabox'.$minify.'.js', + 'zpWidgetMetabox', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpWidgetMetabox_nonce' => wp_create_nonce( 'zpWidgetMetabox_nonce_val' ), + 'action' => 'zpWidgetMetabox-submit', + 'txt_typetosearch' => __( 'Type to search', 'zotpress' ), + 'txt_pages' => __( 'Page(s)', 'zotpress' ), + 'txt_itemkey' => __( 'Item Key', 'zotpress' ), + 'txt_account' => __( 'Account', 'zotpress' ) + ) + ); + } +} +add_action( 'admin_enqueue_scripts', 'Zotpress_zpWidgetMetabox_scripts_css' ); + + + +/** +* Metabox styles +*/ +function Zotpress_admin_post_styles() +{ + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_style('zotpress.metabox'.$minify.'.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.metabox'.$minify.'.css', array(), rand(111,9999), 'all'); + wp_enqueue_style('zotpress.metabox'.$minify.'.css'); + + wp_enqueue_style('jquery-ui-tabs', ZOTPRESS_PLUGIN_URL . 'css/smoothness/jquery-ui-1.8.11.custom'.$minify.'.css', array(), rand(111,9999), 'all'); +} +add_action('admin_print_styles-post.php', 'Zotpress_admin_post_styles'); +add_action('admin_print_styles-post-new.php', 'Zotpress_admin_post_styles'); + + +?> diff --git a/lib/widget/widget.sidebar.php b/lib/widget/widget.sidebar.php index f930286..8baea62 100644 --- a/lib/widget/widget.sidebar.php +++ b/lib/widget/widget.sidebar.php @@ -1,294 +1,308 @@ __('Display your citations on your sidebar', 'zp-ZotpressSidebarWidget')); - parent::WP_Widget(false, __('Zotpress Widget'), $widget_ops); + $widget_ops = array('description' => __('Display your citations on your sidebar','zotpress')); + parent::__construct(false, __('Zotpress Widget','zotpress'), $widget_ops); } - + function widget( $args, $instance ) { extract( $args ); - + // ARGUMENTS $widget_title = apply_filters('widget_title', $instance['widget_title'] ); - + $api_user_id = $instance['api_user_id']; - $nickname = isset( $instance['nickname'] ) ? $instance['nickname'] : false; - + $author = isset( $instance['author'] ) ? $instance['author'] : false; $year = isset( $instance['year'] ) ? $instance['year'] : false; - + $data_type = isset( $instance['data_type'] ) ? $instance['data_type'] : "items"; $collection_id = isset( $instance['collection_id'] ) ? $instance['collection_id'] : false; $item_key = isset( $instance['item_key'] ) ? $instance['item_key'] : false; $tag_name = isset( $instance['tag_name'] ) ? $instance['tag_name'] : false; - + $style = isset( $instance['style'] ) ? $instance['style'] : "apa"; $limit = isset( $instance['limit'] ) ? $instance['limit'] : "false"; - + $inclusive = isset( $instance['inclusive'] ) ? $instance['inclusive'] : false; $sort = isset( $instance['sort'] ) ? $instance['sort'] : false; $sortby = isset( $instance['sortby'] ) ? $instance['sortby'] : false; - if ($sortby == "default") - $sortby = false; - + if ($sortby == "default") + $sortby = false; + $image = isset( $instance['image'] ) ? $instance['image'] : "no"; $download = isset( $instance['download'] ) ? $instance['download'] : "no"; $title = isset( $instance['zptitle'] ) ? $instance['zptitle'] : "no"; $cite = isset( $instance['zpcite'] ) ? $instance['zpcite'] : "no"; $notes = isset( $instance['zpnotes'] ) ? $instance['zpnotes'] : "no"; - - + + // Required for theme echo $before_widget; - - if ($widget_title) - echo $before_title . $widget_title . $after_title; - - - echo "
    \n\n"; - - $zp_sidebar_shortcode = "[zotpress"; - - if ($api_user_id) { $zp_sidebar_shortcode .= " userid='$api_user_id' "; } - if ($nickname) { $zp_sidebar_shortcode .= " nickname='$nickname' "; } - if ($author) { $zp_sidebar_shortcode .= " author='$author' "; } - if ($year) { $zp_sidebar_shortcode .= " year='$year' "; } - if ($data_type) { $zp_sidebar_shortcode .= " datatype='$data_type' "; } - if ($collection_id) { $zp_sidebar_shortcode .= " collection='$collection_id' "; } - if ($item_key) { $zp_sidebar_shortcode .= " item='$item_key' "; } - if ($tag_name) { $zp_sidebar_shortcode .= " tag='$tag_name' "; } - if ($style) { $zp_sidebar_shortcode .= " style='$style' "; } - if ($limit) { $zp_sidebar_shortcode .= " limit='$limit' "; } - if ($sort) { $zp_sidebar_shortcode .= " order='$sort' "; } - if ($sortby) { $zp_sidebar_shortcode .= " sortby='$sortby' "; } - if ($image) { $zp_sidebar_shortcode .= " showimage='$image' "; } - if ($download) { $zp_sidebar_shortcode .= " download='$download' "; } - if ($title) { $zp_sidebar_shortcode .= " title='$title' "; } - if ($cite) { $zp_sidebar_shortcode .= " cite='$cite' "; } - if ($notes) { $zp_sidebar_shortcode .= " note='$notes' "; } - if ($inclusive) { $zp_sidebar_shortcode .= " inclusive='$inclusive' "; } - - $zp_sidebar_shortcode = trim($zp_sidebar_shortcode) . "]"; - - echo do_shortcode($zp_sidebar_shortcode); - - echo "
    \n\n"; - - + + if ($widget_title) echo $before_title . $widget_title . $after_title; + + + echo "
    \n\n"; + + $zp_sidebar_shortcode = "[zotpress"; + + if ($api_user_id) { $zp_sidebar_shortcode .= " userid='$api_user_id' "; } + if ($author) { $zp_sidebar_shortcode .= " author='$author' "; } + if ($year) { $zp_sidebar_shortcode .= " year='$year' "; } + if ($data_type) { $zp_sidebar_shortcode .= " datatype='$data_type' "; } + if ($collection_id) { $zp_sidebar_shortcode .= " collection='$collection_id' "; } + if ($item_key) { $zp_sidebar_shortcode .= " item='$item_key' "; } + if ($tag_name) { $zp_sidebar_shortcode .= " tag='$tag_name' "; } + if ($style) { $zp_sidebar_shortcode .= " style='$style' "; } + if ($limit) { $zp_sidebar_shortcode .= " limit='$limit' "; } + if ($sort) { $zp_sidebar_shortcode .= " order='$sort' "; } + if ($sortby) { $zp_sidebar_shortcode .= " sortby='$sortby' "; } + if ($image) { $zp_sidebar_shortcode .= " showimage='$image' "; } + if ($download) { $zp_sidebar_shortcode .= " download='$download' "; } + if ($title) { $zp_sidebar_shortcode .= " title='$title' "; } + if ($cite) { $zp_sidebar_shortcode .= " cite='$cite' "; } + if ($notes) { $zp_sidebar_shortcode .= " note='$notes' "; } + if ($inclusive) { $zp_sidebar_shortcode .= " inclusive='$inclusive' "; } + + $zp_sidebar_shortcode = trim($zp_sidebar_shortcode) . "]"; + + echo do_shortcode($zp_sidebar_shortcode); + + echo "
    \n\n"; + + // Required for theme echo $after_widget; } - + + + function update( $new_instance, $old_instance ) { $instance = $old_instance; - + $instance['widget_title'] = strip_tags( $new_instance['widget_title'] ); - + $instance['api_user_id'] = strip_tags( $new_instance['api_user_id'] ); - $instance['nickname'] = strip_tags($new_instance['nickname']); - + $instance['author'] = str_replace(" ", "+", strip_tags($new_instance['author'])); $instance['year'] = str_replace(" ", "+", strip_tags($new_instance['year'])); - + $instance['data_type'] = strip_tags( $new_instance['data_type'] ); $instance['collection_id'] = strip_tags($new_instance['collection_id']); $instance['item_key'] = strip_tags($new_instance['item_key']); $instance['tag_name'] = str_replace(" ", "+", strip_tags($new_instance['tag_name'])); - + $instance['style'] = strip_tags($new_instance['style']); $instance['inclusive'] = strip_tags($new_instance['inclusive']); $instance['sort'] = strip_tags($new_instance['sort']); $instance['sortby'] = strip_tags($new_instance['sortby']); - + $instance['limit'] = strip_tags($new_instance['limit']); - + $instance['image'] = strip_tags($new_instance['image']); $instance['download'] = strip_tags($new_instance['download']); $instance['zptitle'] = strip_tags($new_instance['zptitle']); $instance['zpcite'] = strip_tags($new_instance['zpcite']); $instance['zpnotes'] = strip_tags($new_instance['zpnotes']); - + return $instance; } - + + + function form( $instance ) { - $widget_title = esc_attr( $instance['widget_title'] ); + // Set form defaults + if ( ! isset($instance) || count($instance) == 0) + { + $instance['widget_title'] = ""; + + $instance['author'] = ""; + $instance['year'] = ""; + + $instance['collection_id'] = ""; + $instance['item_key'] = ""; + $instance['tag_name'] = ""; + + $instance['style'] = ""; + $instance['limit'] = ""; + } + ?> - + - -
    - -

    - - -

    - -
    - -

    - Fill in one of the below. Req'd. -

    - -

    - - -

    - -

    - - -

    - -
    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -

    - - -

    - -
    - + +
    + +

    + + +

    + +
    + + 0 ) + if ( isset( $instance['api_user_id'] ) ) + echo zp_get_accounts( false, true, true, $this->get_field_id('api_user_id'), $this->get_field_name('api_user_id'), $instance['api_user_id'] ); + else + echo zp_get_accounts( false, true, true, $this->get_field_id('api_user_id'), $this->get_field_name('api_user_id'), false ); + ?> + +
    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +

    + + +

    + +
    + \ No newline at end of file + +?> diff --git a/lib/widget/widget.tinymce.bib.php b/lib/widget/widget.tinymce.bib.php deleted file mode 100644 index a7f3885..0000000 --- a/lib/widget/widget.tinymce.bib.php +++ /dev/null @@ -1,346 +0,0 @@ - - - - Zotpress Bibliography - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - get_var("SELECT COUNT(*) FROM ".$wpdb->prefix."zotpress;") > 1) { ?> - -
    - get_results( $wpdb->prepare( "SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress WHERE api_user_id = '".$zp_default_account."';" ) ); - else - $zp_account = $wpdb->get_results( $wpdb->prepare( "SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress LIMIT 1;" ) ); - ?> - api_user_id; ?> - nickname) === false && $zp_account[0]->nickname != "") - $zp_default_account = $zp_account[0]->nickname . " (" . $zp_account[0]->api_user_id . ")"; - - ?> - Searching . Change account? -
    - - - - - -
    - - - -

    - - - - -
    - -

    Options

    - -
    - - - - -
    - - - - -
    - - - - -

    Styles listed here. Examples: apa, chicago-author-date, nature, modern-language-association.

    - -
    - - - - - -
    - -
    - Sort order: -
    - - - - - -
    -
    - -
    - -
    - Show images? -
    - - - - - -
    -
    - -
    - -
    - Show title by year? -
    - - - - - -
    -
    - -
    - -
    - Downloadable? -
    - - - - - -
    -
    - -
    - -
    - Abstract? -
    - - - - - -
    -
    - -
    - -
    - Notes? -
    - - - - - -
    -
    - -
    - -
    - Citable (in RIS format)? -
    - - - - - -
    -
    - -
    - - - - -
    -
    - - -
    - - - - - - - - \ No newline at end of file diff --git a/lib/widget/widget.tinymce.cite.php b/lib/widget/widget.tinymce.cite.php deleted file mode 100644 index db965c9..0000000 --- a/lib/widget/widget.tinymce.cite.php +++ /dev/null @@ -1,263 +0,0 @@ - - - - Zotpress In-Text Citation - - - - - - - - - - - - - - - - - - - - - - - - -
    - - get_var( "SELECT COUNT(id) FROM ".$wpdb->prefix."zotpress;" )) > 1) { ?> - -
    - get_results( $wpdb->prepare( "SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress WHERE api_user_id = '".$zp_default_account."';" ) ); - else - $zp_account = $wpdb->get_results( $wpdb->prepare( "SELECT api_user_id, nickname FROM ".$wpdb->prefix."zotpress LIMIT 1;" ) ); - - ?> - api_user_id; ?> - nickname) === false && $zp_account[0]->nickname != "") - $zp_default_account = $zp_account[0]->nickname . " (" . $zp_account[0]->api_user_id . ")"; - - ?> - Searching . Change account? -
    - - - get_var( "SELECT api_user_id FROM ".$wpdb->prefix."zotpress;" ); ?> - - - -
    - - - -

    - - - -
    - -

    Options

    - -
    - - - -

    Use these placeholders: %a% for author, %d% for date, %p% for page, %num% for list number.

    - - - - -
    - - - - -
    - - - - -
    - -
    - - -
    - - - - - - \ No newline at end of file diff --git a/lib/widget/widget.tinymce.list.php b/lib/widget/widget.tinymce.list.php deleted file mode 100644 index 3c0e802..0000000 --- a/lib/widget/widget.tinymce.list.php +++ /dev/null @@ -1,233 +0,0 @@ - - - - Zotpress In-Text Bibliography - - - - - - - - - - - - - - - - - - - - - - - -
    - -

    Options

    - - - -
    - - - - -

    Styles listed here. Examples: apa, chicago-author-date, nature, modern-language-association.

    - -
    - - - - - -
    - -
    - Sort order: -
    - - - - - -
    -
    - -
    - -
    - Show images? -
    - - - - - -
    -
    - -
    - -
    - Show title by year? -
    - - - - - -
    -
    - -
    - -
    - Downloadable? -
    - - - - - -
    -
    - -
    - -
    - Abstract? -
    - - - - - -
    -
    - -
    - -
    - Notes? -
    - - - - - -
    -
    - -
    - -
    - Citable (in RIS format)? -
    - - - - - -
    -
    - -
    -
    - - - - - - \ No newline at end of file diff --git a/readme.txt b/readme.txt index dc609bb..fd61d0c 100644 --- a/readme.txt +++ b/readme.txt @@ -1,69 +1,372 @@ -=== Plugin Name === +=== Zotpress === Contributors: kseaborn Plugin Name: Zotpress Plugin URI: http://katieseaborn.com/plugins/ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5HQ8FXAXS9MUQ -Tags: zotero, zotpress, citation manager, citations, citation, cite, citing, bibliography, bibliographies, reference, referencing, references, reference list, reference manager, academic, academia, scholar, scholarly, cv, curriculum vitae, resume, publish, publications +Tags: zotero, zotpress, citation manager, citations, citation, cite, citing, bibliography, bibliographies, reference, referencing, references, reference list, reference manager, academic, academic blogging, academia, scholar, scholarly, scholarly blogging, cv, curriculum vitae, resume, publish, publication, publications Author URI: http://katieseaborn.com/ Author: Katie Seaborn Requires at least: 3.5 -Tested up to: 4.2.2 -Stable tag: 5.5.5 +Tested up to: 6.1.1 +Stable tag: 7.3.3 License: Apache2.0 Zotpress displays your Zotero citations on WordPress. == Description == -[Zotpress](http://katieseaborn.com/plugins/ "Zotpress for WordPress") brings your Zotero library and scholarly blogging to WordPress. [Zotero](http://zotero.org/ "Zotero") is a free, cross-platform reference manager that integrates with your browser and word processor. +[Zotpress](http://katieseaborn.com/plugins/ "Zotpress for WordPress") brings publication broadcasting and scholarly blogging to WordPress through [Zotero](http://zotero.org/ "Zotero"), a free, cross-platform reference manager. = Features = -* Displays your individual and group Zotero items through in-text citations, bibliographies, and searchable libraries -* Supports thumbnail images through WordPress's Featured Image +* Displays your personal and group Zotero items through in-text citations, bibliographies, and searchable libraries +* Supports thumbnail images through WordPress's Media Library and Open Library * Supports selective CSS styling via IDs and classes -* Provides a range of additional features, such as allowing visitors to cite and download citations +* Provides a range of additional features, such as allowing visitors to download citations * And more! -Compatible with Firefox, Safari, Chrome, IE7, IE8, and IE9. Made with jQuery, jQuery UI, jQuery doTimeout, and Live Query. +Compatible with Firefox, Safari, Chrome, and IE9. Made with jQuery, jQuery UI, jQuery doTimeout, Live Query, OAuth, and [Open Library](https://openlibrary.org/ "Open Library"). -Special thanks to Joe Alberts for substantial contributions to the code, comprehensive testing, and design ideation. Thanks also to contributors Christopher Cheung and Jason S. for their development support and advice. Finally, my sincere gratitude goes out to all who have donated in support of this plugin. +Special thanks to Joe Alberts for substantial contributions to the code, comprehensive testing, and design ideation. Thanks also to contributors Christopher Cheung, Jason S., Chris Wentzloff, Karljürgen Feuerherm (@feuerherm), and Mark Dingemanse (@codeispoetry) for their code contributions, testing, and guidance. Finally, my sincere gratitude goes out to all who have donated in support of this plugin. + +Please note that this plugin is on semi-hiatus, with updates expected about 1-3 times a year. = Requirements = jQuery included in your theme (Zotpress will do this for you if it isn't already included), and an HTTP request method supported by WordPress enabled on your server: cURL, fopen with Streams (PHP 5), or fsockopen. In your server config file, X-Frame-Options should be set to SAMEORIGIN. Optional: OAuth enabled on your server. == Installation == -1. Upload the folder `zotpress` to the `/wp-content/plugins/` directory. +1. Install from the `Plugins` page in your WordPress admin panel. Or, download and extract the zip, then manually upload the folder `zotpress` to the `/wp-content/plugins/` directory. 1. Activate the plugin through the 'Plugins' menu in WordPress. -1. Import your Zotero library. -1. In the Browse page, look up the keys of the items, collections or tags you wish to display. Or, use the Zotpress Reference Widget to generate shortcodes. -1. Place the shortcodes in your blog entry or page, or enable the Zotpress sidebar widget. +1. Go to the `Zotpress` page through the admin menu. +1. Add the Zotero API information for each Zotero account you'd like to use. +1. Use the Zotpress Shortcode option in the Gutenberg editor to serach for items and build a shortcode. Or, look up the keys of items, collections, and tags on the `Browse` page. Or, use the Zotpress Reference Meta Box to generate shortcodes. +1. Place the shortcodes in your blog post or page, or enable the Zotpress sidebar widget. Below are a few examples to get you started. Look at the `Help` page for more examples and the full details about all use options and shortcodes. = Shortcode = You can display your Zotero citations in a number of ways. To display a list of five citations from the collection with the key "ZKDTKM3X", use this shortcode: -[zotpress collection="ZKDTKM3X" limit="5"] +> [zotpress collection="ZKDTKM3X" limit="5"] + +You can also use in-text citations as follows: -You can also use in-text citations: +> [zotpressInText item="{U9Z5JTKC,36-45}"] -[zotpressInText item="{U9Z5JTKC,36-45}"] +> [zotpressInTextBib] -This shortcode will display the following in-text citation for the citation with the key "U9Z5JTKC": (Seaborn, 2011, p. 36). The full citation can be displayed in an auto-generated bibliography using the [zotpressInTextBib] shortcode. +The first shortcode will display an in-text citation for an item with the key "U9Z5JTKC", which will look something like this: (Seaborn, 2011, p. 36). The [zotpressInTextBib] will auto-generate a bibliography for all [zotpressInText] shortcodes on the post/page. Check out the "Help" page on your installation of Zotpress for more information and a full listing of parameters for all shortcodes. == Frequently Asked Questions == -The F.A.Q. can be found on the "Help" page of every Zotpress installation. If you have a question that isn't answered there, feel free to post a message in the [forums](http://wordpress.org/tags/zotpress "Zotero forums on Wordpress.com"). +The F.A.Q. can be found on the "Help" page of every Zotpress installation. If you have a question that isn't answered there, feel free to post a message in the [forums](https://wordpress.org/support/plugin/zotpress "Zotpress forums on Wordpress.com"). == Screenshots == -1. Browse your Zotero citations by account, collection or tag. Add custom images to citations. Special characters are supported. -2. Search for items and build bibliography and in-text shortcodes using the "Zotpress Reference" meta box widget. -3. Display your Zotero items on your blog. Write scholarly posts with in-text citations and autogenerated bibliographies. +1. Display items from individual or group Zotero libraries on your WordPress website. Special characters are supported. +2. Search for items and generate shortcodes for bibliographies and in-text citations using the "Zotpress Reference" meta box on edit screens. +3. Find the shortcode builder in the Gutenberg toolbar. Search for items and create bibliographies and in-text citations. +4. Give your citation an image using WordPress's Media Library or Open Library. +5. Share your library through your website. Allow visitors to browse by collection or tag. +6. Allow visitors to search your library by item metadata or tag, or both. == Changelog == += 7.3.3 = + +* Fixed limit attribute issues in PHP 8. + += 7.3.2 = + +* Added support for PHP 8 (tested in PHP 8.0.8), with thanks to K.G. Feuerherm (@kfeuerherm) and Mark Dingemanse (@codeispoetry). + += 7.3.1.2 = + +* Fixed Library "Browse" page account, default account, and subcollection bugs. +* Minor style fixes for Library. + += 7.3.1.1 = + +* Fixed Library collection navigation bug. +* Fixed minor Library style issues. +* Added Library dropdown browsing scroll effect. + += 7.3.1 = + +* New! Show or hide browse bar for Zotpress Library Dropdown. +* Fixed single account library errors. +* Fixed minor issues with thumbnail image. +* Modified Library to allow multiple instances in one page. +* Modified Library pagination styles for modernization. + += 7.3 = + +* New! Target attribute for Zotpress Library. +* Fixed task separation between install and update. +* Fixed caching issue for multiple collections. +* Fixed multipart names and apostrophes. +* Fixed some request errors. +* Fixed mdash/ndash bug. +* Fixed hardcoded paths. +* Added localizable error messages. +* Added error checks when collections or tags are empty. + += 7.2 = + +* New! Added Gutenberg editor toolbar shortcode builder. +* New! Can now retrieve items by itemtype. +* Added disambiguation for in-text citations. +* Added new screenshot. +* Added brackets attribute to in-text shortcode builder/reference. +* Added support for more itemtypes for the title attribute, which should fix incorrect sorting. +* Changed download filename to original filename. +* Fixed shortcode builder bug for order by DESC. +* Fixed non-author types bug for in-text citations. +* Fixed media library set image bug. +* Fixed multisite install/reset bug. +* Fixed highlight-on-scroll issue. +* Updated Help page. +* Minor style and text formatting corrections. + += 7.1.6 = + +* New! Can use the "showtags" attribute with the Library shortcodes. +* Refined "download" attribute to include linked URL downloads. +* Fixed "false" error for author names and the "highlight" attribute. +* Fixed Browse page error when there are no default accounts. +* Optimized for the Twenty Twenty theme. + += 7.1.5 = + +* Fixed bug with shortcodes that use collections and tags. +* Fixed cite/RIS bug. +* Updated notifications to only display if Zotpress accounts exist. +* Updated Account page styles and notifications. +* Several improvements and fixes for Library Dropdown navigation. + += 7.1.4 = + +* Fixed title sort bug with itemtype and date secondary sort. +* Fixed cache bug related to large numbers of tags. +* Fixed Library collection and tag display bugs. +* Refined admin CSS, especially notifications. + += 7.1.3 = + +* Fixed error reporting, esp. for cache. +* Fixed tags with apostrophes error. +* Fixed numbering when multiple posts. +* Fixed title sort bugs. +* Updated icons. + += 7.1.2 = + +* Fixed multi-part last name bug. +* Fixed error feedback-related bug. +* Fixed Zotpress Sidebar widget loading bugs. +* Fixed In-Text Citation separator bug. +* Refined and fixed bugs around sorting/ordering in general. +* Refined In-Text Citation "and" attribute; default returned to ampersand. +* Refined error reporting. +* Refined parameter cleaning of quote characters. + += 7.1.1 = + +* Increased "title" attribute speed and refined its sorting/ordering. +* Fixed Library dropdown version pagination styles. +* Fixed numeric in-text bibliography numbering with cache retrieval. +* Fixed showtags request bug. +* Fixed bibliography "one item" bug. + += 7.1 = + +* New! Now supporting the {api_user_id:item_key,pages} format for in-text citations. +* New! Now displaying cached citations via PHP for SEO purposes. +* New! Can use the "title" attribute to sort by item type. +* New! Can set a "toplevel" collection for the dropdown (default) version of the Library shortcode. +* Several in-text citation bugs fixed. +* Refined request error feedback. +* Refined pagination for the Library display with a scroller. +* Fixed date/numbering issue for american-antiquity style. +* Fixed forcenumber issue for chicago style. +* Fixed several sortby and order issues. + += 7.0.3 = + +* Fixed Sort Order bug. +* More Japanese translations added. +* Account management style updates. + += 7.0.2 = + +* Fixed Cite with RIS bug. +* Fixed activation error. + += 7.0.1 = + +* Started preparing for localization; preliminary Japanese available. +* Fixed single-item error for the In-Text Citation shortcode. +* Fixed note display error for the Bibliography shortcode. +* Fixed download URL error for the Biblography shortcode. + += 7.0 = + +* Introducing new Bibliography shortcode format to support citing items from multiple accounts in one shortcode: {api_user_id:item_key} +* Optimized for WordPress 5 and Gutenberg. +* Reduced the request load (esp. tags) by default. +* In-text numerical citations now support page numbers. +* Fixed date sort for multiple collections filtered by author. +* Fixed forcenumber/s bug. +* Added apostrophe support for tags. +* Minified styles and scripts. +* Updated branding. +* Added search bar for shortcode attributes to Help page. +* Minor style and UI updates to Zotpress Library. +* Removed experimental tinymce code. + += 6.2.4 = + +* Updated shortcode styles and fixed the Search Bar display. +* Updated Zotpress Reset to remove additional options and tables from db. +* Download now looks for import_url as well as import_file. +* Updated the readme and screenshots. + += 6.2.3 = + +* Updated Sidebar Widget constructor. +* Updated Library Shortcode to return rather than echo output. +* Clarified how "showimage" works on the Help page. +* Fixed Library Shortcode display bug for numbered bibliographies. + += 6.2.2 = + +* Fixed notification error for older versions of PHP. + += 6.2.1 = + +* Fixed compression library issue encountered by some users. +* Added notification to clear cache for database update. +* Applied fix for dois that are already hyperlinked. + += 6.2 = + +* Added compression to bring down the size of the cache. +* Fixed logic error around WordPress Media Library images vs. Open Library images. +* Browse page Tags dropdown now accounts for no tags. +* Browse page has clearer loading feedback. +* Browse page collection and item keys are now text inputs to prevent styled text from being copied into the visual editor. +* Now hyperlinking https-based DOI URLs. +* Help page tab links have been fixed. + += 6.1.6 = + +* Fixed wp_remote_retrieve_headers issue (WP core change) that limited total results. +* Removed Google Fonts for quicker admin-side loading. + += 6.1.5 = + +* Fixed author sort in Chrome. +* Fixed urlwrap for chicago-author-date (using ireplace). +* Case applied for author filtering when single field is used instead of double field even though first/last structure exists. + += 6.1.4 = + +* Fixes and extensions made to the "urlwrap" feature for titles, esp. quotes. + += 6.1.3 = + +* Fixed security issue with zp_get_account(). +* New! "style" attribute for searchbar. +* Updated widget account selection and fixed retrieval error. +* Minor image and code style updates. + += 6.1.2 = + +* Applied more cases for URL wrapping. +* Fix for encyclopedia author/editor cases for in-text citations. +* Fix for authors who are also editors for in-text citations. +* Fixed in-text number-based sorting for 50+ items. +* Better in-text error handling. + += 6.1.1 = + +* Applied secondary year sorting for author sort. +* Fixed default ordering for number-based in-text citations. +* Fixed erroneous fix for in-text editors of books. +* Fixed dropdown update bug for collections. +* Migrated Options AJAX to WP AJAX; fixed Default Style option. +* Updated cURL request approach. +* Fixed title wrap issues related to mdashes and quotes in titles. +* Fixed chicago style DOI linking issue. +* Minor style updates. + += 6.1 = + +* Quicker load times through more effective use of cache. +* New! "urlwrap" attribute for wrapping titles and images with the citation URL. +* New! "highlight" attribute for highlighting text in a citation. +* New! Can now use showimage="openlib" to display book covers from the Open Library. +* In-text citations will no longer erroneously display editors. +* Order for In-Text Bib sort fixed. +* Browse navigation for multiple accounts fixed. +* Fixed "target" attribute for in-text bibliography DOI links. +* Now auto-detects https for Google Fonts links. +* Fixed multiple tags unique ID issue. +* Minor style updates. + += 6.0.5 = + +* New way of selecting in-text citations without relying on post IDs as HTML IDs or classes. +* The "items" and "collections" parameters in bib and in-text shortcodes are now flexible around extra spaces. +* Fixed Zotpress In-Text Bibliography non-unique ID issue. +* Fixed parenthesis formatting issue for number-based in-text citations. +* Number-based in-text citations now have bibliographic details on mouse hover. + += 6.0.4 = + +* Re-added item keys on Browse page. +* Set withCredentials attribute to true for AJAX requests. +* Fixed Zotpress Bibliography unique identifier bug. +* Fixed default sorting for in-text citations. +* Fixed in-text format (superscript). +* Re-added bib info as title for non-number-based in-text citation anchors. +* New! Can now use &, + and / with in-text page numbers. + += 6.0.3 = + +* Fixed inclusive="no" bug for tags. +* Fixed pagination for searchbar. +* Fixed non-English characters bug for the Zotpress Reference widget. +* Fixed sidebar widget issues. +* Fixed in-text bug that assumed id rather than class for posts/pages. +* Fixed various in-text formatting bugs. + += 6.0.2 = + +* Fixed multiple terms bug for searchbar. +* Fixed non-English characters bug for searchbar. +* Fixed sortby/order for searchbars. +* Fixed style value "default" bug. +* Pagination for searchbars now hidden on search and no items found. + += 6.0.1 = + +* Fixed "limit" attribute bug for the Zotpress Bibliography Shortcode. +* Fixed single item bug for the Zotpress In-Text Shortcode. + += 6.0 = + +* New! Auto-updating/syncing through realtime data access with cURL and AJAX. +* Now using Zotero API version 3. +* Retired Zotpress Bibliography Shortcode attribute "linkedlist"/"link"; use Zotpress Library Shortcode instead. +* Retired Zotpress Bibliography Shortcode attribute "datatype"; use Zotpress Library Shortcode instead. +* Modified Zotpress Bibliography Shortcode attribute "inclusive"; use with multiple authors only. +* Zotpress Reference widget refined; now uses WP AJAX. +* Fixed "cite" bug for the Library shortcode. +* Shortcode parameter "searchby" for the Library SearchBar is now limited to items and tags. +* Updated deprecated code to WP 4.3 standards. +* Minor bug fixes and updates throughout. + = 5.5.5 = * Bug fix for searchbar filters. @@ -322,30 +625,37 @@ The F.A.Q. can be found on the "Help" page of every Zotpress installation. If yo * Many more additions and bug fixes. Explore and enjoy the new Zotpress! = 4.5.4 = + * Fixed "downloadable" bug. * Updated Help page. = 4.5.3 = + * Styles for metabox tabs added. * In-Text Bibliography fixed (for real this time). = 4.5.2 = + * New! Options page to set blog-wide defaults (more settings coming). * New(ish)! Post-specific style defaults. * In-Text Bibliography display fixed AGAIN! = 4.5.1 = + * In-Text Bibliography display fixed (or, made better). * New! Set default citation style (for all posts, via Zotpress Reference Metabox Widget). = 4.5 = + * New: Shortcode Creator in the Zotpress Reference Metabox Widget. * "Show Image" and "Sort" bugs fixed. = 4.4.1 = + * Security fix! = 4.4 = + * A number of security measures added. * Fixed "Help" page shortcode for in-text citations and private vs. public groups: oops! * The Zotpress shortcode now accepts lists for these parameters: collection, item. @@ -354,6 +664,7 @@ The F.A.Q. can be found on the "Help" page of every Zotpress installation. If yo * Zotpress Reference now working with the latest versions of Chrome and Safari. = 4.3 = + * Introducing "Zotpress InText", a new shortcode that let's you add in-text citations, and then auto-generates a bibliography for you. jQuery must be enabled. Only supports APA style; requests can be made in the forums. Use information can be found in your Zotpress installation's "Help" page. * Recaching and auto-checking for new or updated Zotero data back in action. * The "collection" shortcode parameter now working. @@ -362,80 +673,100 @@ The F.A.Q. can be found on the "Help" page of every Zotpress installation. If yo * Tag shortcode parameter now accepts nonexistent tags. = 4.2.7 = + * Error display error fixed. = 4.2.6 = + * Fixed bullet image issue. = 4.2.5 = + * Fixed sidebar issue: having an author is no longer required. = 4.2.4 = + * Fixed sidebar widget error and display issue. * Added more information to and sorting of citations listed in the Zotpress Reference widget. = 4.2.3 = + * More friendly XML error messages, including ability to (at least try) repeating the Zotero request. * Spite-ified most images for quicker display. * Citation images can now be deleted. = 4.2.2 = + * Bugfix: Typo! = 4.2.1 = + * Bugfix: Limit issue resolved. = 4.2 = + * Bugfix: Styles now working again. * Bugfix: Now only grabbing top level items. * Bugfix: Sidebar widget working again. * Metabox widget refined: Limit removed, account info integrated, and tags and collections alphabetized. = 4.1.1 = + * Bugfix: Can now sort by ASC or DESC order. = 4.1 = + * Bugfixes: Filtering by author and date reinstated. * New: Titles by year. (New parameter: title) = 4.0 = + * Switched method of requesting from jQuery to PHP. Should mean a speed increase (particularly for Firefox users). * Many shortcode parameters have been changed; these parameters are now deprecated: api_user_id (now userid), item_key (now item), tag_name (now tag), data_type (now datatype), collection_id (now collection), download (now downloadable), image (now showimage). * New shortcode parameter "sortby" allows you to sort by "author" (first author) and "date" (publication date). By default, citations are sorted by latest added. = 3.1.3 = + * Temporary fix for web servers that don't support long URLs. Unfortunately no special caching for these folks. New solution in the works. = 3.1.2 = + * Added backwards compatibility measure with respect to the new api_user_id / nickname requirement. * Fixed citation display positioning bugs. * Applied new caching method to sidebar widget. = 3.1.1 = + * Fix: Sidebar widget bug. = 3.1 = + * New way of caching requests. Speed increase for requests that have already been cached. * No more multiple accounts per shortcode. A "user_api_id" or "nickname" must be set. * No more collection titles. You can use the Zotero Reference meta box to find and add this information above collection shortcode calls. = 3.0.4 = + * Fixed display images issue. * Separated out sidebar widget code from main file. = 3.0.3 = + * Groups accounts citation display fixed. = 3.0.2 = + * Meta box fixed in IE and Safari. * Styles fixed in IE and Safari. = 3.0.1 = + * Sidebar widget fixed. * Styles in IE refined. * Conditional OAuth messages implemented. = 3.0 = + * New "Zotpress Reference" widget, meant to speed up the process of adding shortcodes to your posts and pages by allowing you to selectively search for ids directly on the add and edit pages. * OAuth is now supported, which means that you don't have to go out of your way to generate the required private key for your Zotero account anymore (unless your server doesn't support OAuth, of course). * I've changed the way Zotpress's admin splash page loads. Before, the page would hang until finished loading the latest citations from Zotero. This is a friendlier way of letting you know what Zotpress is up to. @@ -445,42 +776,52 @@ The F.A.Q. can be found on the "Help" page of every Zotpress installation. If yo * Improved handling of multiple Zotpress shortcode calls on a single page. * Code reduced and refined plugin-wide, which should equal an overall performance improvement. * "Order" parameter no longer available, at least for now; see http://www.zotero.org/support/dev/server_api -* "Forcing cURL" option abandoned. If your server supports it, cURL will be used; otherwise, Zotpress will resort to file_get_contents(). +* "Forcing cURL" option abandoned. If your server supports it, cURL will be used; otherwise, Zotpress will resort to file_get_contents(). = 2.6.1 = + * Can now give group accounts a public key. * Downloads can now be accessed by anyone (assuming you've enabled downloading). = 2.6 = + * Important: Reduced multiple instantiations of JavaScript. * Download option added to Widget. * Proper download links for PDFs implemented. = 2.5.2 = + * Fixed image display for author/year citations. = 2.5.1 = + * Fixed single citation display bug. = 2.5 = + * Re-wrote display code. * Tidied up JavaScript. * Fixed update table code. = 2.4 = + * Can now display by year. * New option to display download links, should they be available. = 2.3 = + * Fixed Group "invalid key" error. = 2.2 = + * Fixed CURLOPT_FOLLOWLOCATION error. = 2.1 = + * Now cURL-friendly again. = 2.0 = + * Zotpress completely restructured. * Most requests now made through PHP. Shortcode requests made through PHP/jQuery combo for user-friendliness on the front-end. * Cross-user caching implemented. Updates request data every 10 minutes and only if request made. @@ -488,202 +829,39 @@ The F.A.Q. can be found on the "Help" page of every Zotpress installation. If yo * Can now filter by Tag in admin. = 1.6 = + * Critical request method issue fixed. = 1.5 = + * Groups citation style issue fixed. = 1.4 = + * Caching enabled, which should speed things up a bit. = 1.3 = + * Added cURL, which is (maybe?) quicker, (definitely?) safer, and (more likely to be?) supported. Requests default to cURL first now. = 1.2 = + * Optimized JavaScript functions. Fixed some grammatical errors on the Help page. More selective loading of JavaScript. And most importantly ... added a Zotpress widget option. This also means you can have more than one Zotpress call on a single page. = 1.1 = + * Fixed up the readme.txt. Added a friendly redirect for new users. Made IE8-compliant. Moved some JS calls to footer. Now selectively loads some JS. Made tags and collections into lists for easier formatting. = 1.0 = + * Zotpress makes its debut. == Upgrade Notice == -= 1.2 = -Lots of little issues fixed. Plus, you can now use a Zotpress widget instead of shortcode. - -= 1.3 = -Implemented cURL, which should help those having read/write issues on their server. - -= 1.4 = -Speed increase with newly added caching feature. - -= 1.5 = -Important: Groups citation style issue fixed. - -= 1.6 = -Critical request method issue fixed. - -= 2.0 = -Zotpress overhaul. Security and performance increases. - -= 2.1 = -Now cURL-friendly again. - -= 2.2 = -Fixed CURLOPT_FOLLOWLOCATION error. += 7.3.2 = -= 2.3 = -Fixed Group "invalid key" error. +Updated to work with PHP 8. -= 2.4 = -Can now display by year. Option to display download links. - -= 2.5 = -Re-wrote display code and tidied up JavaScript. Fixed update table code. - -= 2.5.1 = -Fixed single citation display bug. - -= 2.6 = -Important: JavaScript reductions; download option added to Widget; proper PDF download links. - -= 2.6.1 = -Downloads can now be accessed by anyone. - -= 3.0 = -Major release! OAuth, convenient "Zotpress Reference" meta box, friendly lag handling, numerous bug fixes, and more! - -= 3.1 = -Speed increase and a new way of caching. No more multiple accounts per shortcode. No more auto-display of collection title. - -= 4.0 = -Requests now processed by PHP instead of jQuery. Shortcode parameters re-envisioned (but backwards-compatible). Can now sort by author and date. - -= 4.1 = -Bugfixes: Filtering by year and author reinstated. New: Titles for year. - -= 4.2 = -Bugfixes and metabox widget refinements. - -= 4.3 = -Zotpress InText and various fixes. - -= 4.4 = -Security measures added. Fixed "Help" page info. Zotpress shortcode now accepts lists for these parameters: collection, item. Notes can now be shown. Zotpress Reference on custom post type writing/editing pages and working with the latest versions of Chrome and Safari. - -= 4.5 = -Shortcode Creator. "Show Image" and "Sort" bugs fixed. - -= 4.6 = -* New! Context menu (aka right-click menu) insert citation function for CKEditor-enabled blogs. - -= 5.0 = -* Fixed for Wordpress 3.5! Many new and improved features. - -= 5.01 = - -* Critical patch for case-sensitive tables and import functionality. - -= 5.02 = - -* Fixed display of styles with numbered lists, e.g. IEEE, nature, etc. -* Fixed critical in-text citation bug when multiple accounts are synced. -* Long URLs in citations will now wrap. - -= 5.0.3 = - -* Fixed import and sync for large libraries. -* Removed autoupdate feature. Please use the sync feature for the time being. -* Fixed metabox widget error. -* Minor bug fixes. - -= 5.0.4 = - -* Fixed table install, update and uninstall issues. -* New import and sync scripts for large libraries. -* Zotpress admin now accessible to Editors. -* Styles updated and Help page shortcode documentation redesigned. - -= 5.0.5 = - -* New! Can now display abstracts using the "abstract" parameter. -* Blank author fields now filled with other author (e.g. editor) information. -* Added support for %num% formatting option (in-text). -* Fixed front-end style update script for large (50+) items. -* Fixed "datatype" filtering error. -* Fixed typos in the Help page. -* Added default account constraint to Zotpress Reference results. - -= 5.0.6 = - -* Fixed incompatibility bugs with jQuery UI; some style updates, too. -* Fixed "abstract" attribute bug. -* Fixed in-text %num% numbering bug. -* In-text shortcodes are now unique to posts. -* Fixed hyperlink bug for special characters. -* Fixed search when no default account set. -* New! In-text citations are now hyperlinked to the generated bibliography. - -= 5.0.7 = - -* New! Import script now uses WordPress functionality for improved compatibility. -* New! "Link" attribute for tag and collection lists. -* Updated help page to include how to use in-text brackets. -* In-text format updates, including new "etal" attribute. -* URLs are now converted two-ways to account for prior encoding. -* Updated styles for a more consistent look. - -= 5.0.8 = - -* New! Import functionality check added. -* New! Reset Zotpress feature on Options page. -* New! Added security measures to prevent direct access. -* New! Import items, collections and tags separately. -* Updated import script; sessions removed. -* Fixed minor shortcode bugs. -* Removed extraneous code. -* Minor style updates. - -= 5.0.9 = - -* Fixed incorrect abstracts issue. -* Fixed "years", "authors" and "nick" shortcode attributes. -* Help information for finding Group IDs has been updated. -* Lowercase style names enforced. - -= 5.0.10 = - -* Fixed display issue for multiple in-text citations per shortcode. -* Updated the Help/FAQ page. -* Restructured request class and enforced Zotoro API Version 1. -* Fixed style update errors related to undefined variables. -* Added "citeable" as an alternate for the "cite" attribute. - -= 5.3 = - -* New "brackets" in-text citation shortcode attribute. -* Re-structured import and admin scripts. -* Expanded in-text formatting. -* Added submenu to admin sidebar. -* Added ability to set default accounts on Browse and Accounts and selectively import on Browse. -* Applied fix for array_multisort warning. -* Minor style updates throughout. - -= 5.4 = - -* New! "zotpressLib" shortcode for displaying your library on the front-end of your website. -* Fixed "set image" bug for single-account setups. -* Fixed "remove image" bug. -* Optimized nested collections display. -* Optimized notes with display for single notes and anchors. - -= 5.4.1 = - -* Fixed display bug for single libraries on Browse page. -* Set nonce lifetime to 12 hours. - -= 5.4.2 = += 6.2.4 = -* Fixed code-breaking error that occurred for some users. \ No newline at end of file +Updates what kinds of metadata the "download" feature will look for and what's removed from the database on reset. Minor style updates. diff --git a/screenshot-1.jpg b/screenshot-1.jpg index 0234bc3..e8ddfa7 100644 Binary files a/screenshot-1.jpg and b/screenshot-1.jpg differ diff --git a/screenshot-2.jpg b/screenshot-2.jpg index 7581f40..b00399b 100644 Binary files a/screenshot-2.jpg and b/screenshot-2.jpg differ diff --git a/screenshot-3.jpg b/screenshot-3.jpg index 2e9136e..3a6cd45 100644 Binary files a/screenshot-3.jpg and b/screenshot-3.jpg differ diff --git a/screenshot-4.jpg b/screenshot-4.jpg new file mode 100644 index 0000000..c80aae4 Binary files /dev/null and b/screenshot-4.jpg differ diff --git a/screenshot-5.jpg b/screenshot-5.jpg new file mode 100644 index 0000000..cc123d0 Binary files /dev/null and b/screenshot-5.jpg differ diff --git a/screenshot-6.jpg b/screenshot-6.jpg new file mode 100644 index 0000000..b4f7bf4 Binary files /dev/null and b/screenshot-6.jpg differ diff --git a/zotpress.php b/zotpress.php index bb9105d..0f2ace3 100644 --- a/zotpress.php +++ b/zotpress.php @@ -1,51 +1,67 @@ ' . __('Explore','zotpress') . ''; + return $links; + } + // END ADMIN -------------------------------------------------------------------------------------- @@ -70,110 +94,156 @@ include( dirname(__FILE__) . '/lib/shortcode/shortcode.intext.php' ); include( dirname(__FILE__) . '/lib/shortcode/shortcode.intextbib.php' ); include( dirname(__FILE__) . '/lib/shortcode/shortcode.lib.php' ); - -// SHORTCODE ------------------------------------------------------------------------------------- - +// SHORTCODE ------------------------------------------------------------------------------------- -// SIDEBAR WIDGET ------------------------------------------------------------------------------- - - include( dirname(__FILE__) . '/lib/widget/widget.sidebar.php' ); -// SIDEBAR WIDGET ------------------------------------------------------------------------------- +// WIDGET & METABOX ----------------------------------------------------------------------------- + include( dirname(__FILE__) . '/lib/widget/widget.sidebar.php' ); + include( dirname(__FILE__) . '/lib/widget/widget.php' ); -// META BOX WIDGET ----------------------------------------------------------------------------- - - function Zotpress_add_meta_box() + function Zotpress_format_script_register() { - $zp_default_cpt = "post,page"; - if (get_option("Zotpress_DefaultCPT")) - $zp_default_cpt = get_option("Zotpress_DefaultCPT"); - $zp_default_cpt = explode(",",$zp_default_cpt); - - foreach ($zp_default_cpt as $post_type ) - { - add_meta_box( - 'ZotpressMetaBox', - __( 'Zotpress Reference', 'Zotpress_textdomain' ), - 'Zotpress_show_meta_box', - $post_type, - 'side' - ); - } + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_script( + 'zotpress.gutenberg'.$minify.'.js', + ZOTPRESS_PLUGIN_URL . 'js/zotpress.gutenberg'.$minify.'.js', + array( 'wp-rich-text', 'wp-element', 'wp-editor', 'jquery' ) + ); } - add_action('admin_init', 'Zotpress_add_meta_box', 1); // backwards compatible - - function Zotpress_show_meta_box() + add_action( 'init', 'Zotpress_format_script_register' ); + + function Zotpress_format_enqueue_assets_editor() { - require( dirname(__FILE__) . '/lib/widget/widget.metabox.php'); + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_enqueue_script( 'jquery' ); + wp_enqueue_script( 'zotpress.gutenberg'.$minify.'.js' ); + wp_localize_script( + 'zotpress.gutenberg'.$minify.'.js', + 'zpTranslate', + array( + 'txt_insertsc' => __('Insert Shortcode','zotpress'), + 'txt_generatesc' => __('Generate Shortcode','zotpress') + ) + ); } - -// META BOX WIDGET --------------------------------------------------------------------------------- + add_action( 'enqueue_block_editor_assets', 'Zotpress_format_enqueue_assets_editor' ); + +// WIDGET & METABOX ----------------------------------------------------------------------------- -// REGISTER ACTIONS --------------------------------------------------------------------------------- - +// REGISTER ACTIONS ----------------------------------------------------------------------------- + /** * Admin scripts and styles */ function Zotpress_admin_scripts_css($hook) { - wp_enqueue_script( 'jquery' ); - wp_enqueue_media(); - wp_enqueue_script( 'jquery.dotimeout.min.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.dotimeout.min.js', array( 'jquery' ) ); - wp_enqueue_script( 'zotpress.default.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.default.js', array( 'jquery' ) ); - - if ( in_array( $hook, array('post.php', 'post-new.php') ) === true ) - { - wp_enqueue_script( 'jquery.livequery.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.livequery.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-tabs', 'jquery-ui-autocomplete' ) ); - wp_enqueue_script( 'zotpress.widget.metabox.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.widget.metabox.js', array( 'jquery' ) ); - } - else - { - wp_enqueue_script( 'jquery.livequery.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.livequery.js', array( 'jquery' ) ); - } - - if ( isset($_GET['accounts']) || isset($_GET['setup']) || isset($_GET['import']) || isset($_GET['selective']) ) - { - wp_register_script('zotpress.accounts.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.accounts.js', array('jquery','media-upload','thickbox')); - wp_enqueue_script('zotpress.accounts.js'); - } - - wp_enqueue_style( 'zotpress.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.css' ); - wp_enqueue_style( 'ZotpressGoogleFonts.css', 'http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,600|Droid+Serif:400,400italic,700italic|Oswald:300,400' ); + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + if ( isset($_GET['page']) && ($_GET['page'] == 'Zotpress') ) + { + wp_enqueue_script( 'jquery' ); + wp_enqueue_media(); + wp_enqueue_script( 'jquery.dotimeout.min.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.dotimeout.min.js', array( 'jquery' ) ); + + if ( !in_array( $hook, array('post.php', 'post-new.php') ) ) + { + wp_enqueue_script( 'jquery.livequery.min.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.livequery.min.js', array( 'jquery' ) ); + } + + if ( isset($_GET['help']) && ($_GET['help'] == 'true') ) + { + wp_enqueue_script( 'jquery-ui-core' ); + wp_enqueue_script( 'jquery-ui-tabs' ); + wp_enqueue_style( 'zotpress.help'.$minify.'.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.help'.$minify.'.css' ); + wp_enqueue_script( 'zotpress.help.min.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.help.min.js', array( 'jquery' ) ); + } + + wp_enqueue_style( 'zotpress.shortcode'.$minify.'.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.shortcode'.$minify.'.css' ); + wp_enqueue_style( 'zotpress.admin'.$minify.'.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.admin'.$minify.'.css' ); + } } add_action( 'admin_enqueue_scripts', 'Zotpress_admin_scripts_css' ); - - + + + function Zotpress_enqueue_admin_ajax( $hook ) + { + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + if ( stripos( $hook, "zotpress" ) !== false ) + { + wp_enqueue_script( 'zotpress.admin'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.admin'.$minify.'.js', array( 'jquery','media-upload','thickbox' ) ); + wp_localize_script( + 'zotpress.admin'.$minify.'.js', + 'zpAccountsAJAX', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpAccountsAJAX_nonce' => wp_create_nonce( 'zpAccountsAJAX_nonce_val' ), + 'action' => 'zpAccountsViaAJAX', + 'txt_success' => __('Success','zotpress'), + 'txt_chooseimg' => __('Choose Image','zotpress'), + 'txt_accvalid' => __('Your Zotero account has been validated.','zotpress'), + 'txt_sureremove' => __('Are you sure you want to remove this account?','zotpress'), + 'txt_surecache' => __('Are you sure you want to clear the cache for this account?','zotpress'), + 'txt_cachecleared' => __('Cache cleared!','zotpress'), + 'txt_oops' => __('Oops!','zotpress'), + 'txt_changeimg' => __( 'Change Image', 'zotpress' ), + 'txt_setimg' => __( 'Set Image', 'zotpress' ), + 'txt_removeimg' => __( 'Remove Image', 'zotpress' ), + 'txt_surereset' => __('Are you sure you want to reset Zotpress? This cannot be undone.','zotpress'), + 'txt_default' => __('Default','zotpress') + ) + ); + } // Zotpress pages only + + wp_enqueue_script( 'zotpress.admin.notices'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.admin.notices'.$minify.'.js', array( 'jquery' ) ); + wp_localize_script( + 'zotpress.admin.notices'.$minify.'.js', + 'zpNoticesAJAX', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpNoticesAJAX_nonce' => wp_create_nonce( 'zpNoticesAJAX_nonce_val' ), + 'action' => 'zpNoticesViaAJAX' + ) + ); + } + add_action( 'admin_enqueue_scripts', 'Zotpress_enqueue_admin_ajax' ); + + /** * Add Zotpress to admin menu */ function Zotpress_admin_menu() { - add_menu_page( "Zotpress", "Zotpress", "edit_posts", "Zotpress", "Zotpress_options", ZOTPRESS_PLUGIN_URL."images/icon.png" ); - add_submenu_page( "Zotpress", "Browse", "Browse", "edit_posts", "Zotpress" ); - add_submenu_page( "Zotpress", "Accounts", "Accounts", "edit_posts", "admin.php?page=Zotpress&accounts=true" ); - add_submenu_page( "Zotpress", "Options", "Options", "edit_posts", "admin.php?page=Zotpress&options=true" ); - add_submenu_page( "Zotpress", "Help", "Help", "edit_posts", "admin.php?page=Zotpress&help=true" ); + add_menu_page( "Zotpress", "Zotpress", "edit_posts", "Zotpress", "Zotpress_options", ZOTPRESS_PLUGIN_URL."images/icon-menu.svg" ); + add_submenu_page( "Zotpress", "Zotpress", __('Browse','zotpress'), "edit_posts", "Zotpress" ); + add_submenu_page( "Zotpress", "Accounts", __('Accounts','zotpress'), "edit_posts", "admin.php?page=Zotpress&accounts=true" ); + add_submenu_page( "Zotpress", "Options", __('Options','zotpress'), "edit_posts", "admin.php?page=Zotpress&options=true" ); + add_submenu_page( "Zotpress", "Help", __('Help','zotpress'), "edit_posts", "admin.php?page=Zotpress&help=true" ); } add_action( 'admin_menu', 'Zotpress_admin_menu' ); - + function Zotpress_admin_menu_submenu($parent_file) { global $submenu_file; - + if ( isset($_GET['accounts']) || isset($_GET['selective']) || isset($_GET['import']) ) $submenu_file = 'admin.php?page=Zotpress&accounts=true'; if ( isset($_GET['options']) ) $submenu_file = 'admin.php?page=Zotpress&options=true'; if ( isset($_GET['help']) ) $submenu_file = 'admin.php?page=Zotpress&help=true'; - + return $parent_file; } add_filter('parent_file', 'Zotpress_admin_menu_submenu'); - - + + /** * Add shortcode styles to user's theme * Note that this always displays: There's no way to conditionally include it, @@ -181,92 +251,29 @@ function Zotpress_admin_menu_submenu($parent_file) */ function Zotpress_theme_includes() { - wp_register_style('zotpress.shortcode.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.shortcode.css'); - wp_enqueue_style('zotpress.shortcode.css'); + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_style('zotpress.shortcode'.$minify.'.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.shortcode'.$minify.'.css'); + wp_enqueue_style('zotpress.shortcode'.$minify.'.css'); } add_action('wp_print_styles', 'Zotpress_theme_includes'); - - + + /** * Change HTTP request timeout */ - function Zotpress_change_timeout($time) - { - return 60; // seconds - } + function Zotpress_change_timeout($time): int { return 60; /* second */ } add_filter('http_request_timeout', 'Zotpress_change_timeout'); - - - /** - * TinyMCE word-processor-like features - */ - function zotpress_tinymce_buttonhooks() - { - // Determine default editor features status - $zp_default_editor = "editor_enable"; - if (get_option("Zotpress_DefaultEditor")) $zp_default_editor = get_option("Zotpress_DefaultEditor"); - - if ( ( 'post.php' != $hook || 'page.php' != $hook ) && $zp_default_editor != 'editor_enable' ) - return; - - // Only add hooks when the current user has permissions AND is in Rich Text editor mode - if ( ( current_user_can('edit_posts') || current_user_can('edit_pages') ) && get_user_option('rich_editing') ) - { - add_filter("mce_external_plugins", "zotpress_register_tinymce_javascript"); - add_filter("mce_buttons", "zotpress_register_tinymce_buttons"); - } - } - if ( ZOTPRESS_EXPERIMENTAL_EDITOR ) add_action('init', 'zotpress_tinymce_buttonhooks'); - - // Load the TinyMCE plugin : editor_plugin.js (wp2.5) - function zotpress_register_tinymce_javascript($plugin_array) - { - $plugin_array['zotpress'] = plugins_url('/lib/tinymce-plugin/zotpress-tinymce-plugin.js', __FILE__); - return $plugin_array; - } - - function zotpress_register_tinymce_buttons($buttons) - { - array_push($buttons, "zotpress-cite", "zotpress-list", "zotpress-bib" ); - return $buttons; - } - - - /** - * Metabox styles - */ - function Zotpress_admin_post_styles() - { - wp_register_style('zotpress.metabox.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.metabox.css'); - wp_enqueue_style('zotpress.metabox.css'); - - wp_enqueue_style('jquery-ui-tabs', ZOTPRESS_PLUGIN_URL . 'css/smoothness/jquery-ui-1.8.11.custom.css'); - } - add_action('admin_print_styles-post.php', 'Zotpress_admin_post_styles'); - add_action('admin_print_styles-post-new.php', 'Zotpress_admin_post_styles'); - - - // CKEDITOR SCRIPTS & STYLES - // In progress and experimental - - //function Zotpress_admin_editor_scripts() - //{ - // //wp_register_script('zotpress.widget.ckeditor.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.widget.ckeditor.js', array('jquery')); - // //wp_enqueue_script('zotpress.widget.ckeditor.js'); - //} - - //function Zotpress_admin_ckeditor_css() - //{ - // wp_register_style('zotpress.ckeditor.css', ZOTPRESS_PLUGIN_URL . 'css/zotpress.ckeditor.css'); - // wp_enqueue_style('zotpress.ckeditor.css'); - //} - - + + + // Enqueue jQuery in theme if it isn't already enqueued // Thanks to WordPress user "eceleste" function Zotpress_enqueue_scripts() { - if (!isset( $GLOBALS['wp_scripts']->registered[ "jquery" ] )) wp_enqueue_script("jquery"); + if ( ! isset( $GLOBALS['wp_scripts']->registered[ "jquery" ] ) ) + wp_enqueue_script("jquery"); } add_action( 'wp_enqueue_scripts' , 'Zotpress_enqueue_scripts' ); @@ -276,87 +283,178 @@ function Zotpress_enqueue_scripts() add_shortcode( 'zotpressInTextBib', 'Zotpress_zotpressInTextBib' ); add_shortcode( 'zotpressLib', 'Zotpress_zotpressLib' ); add_action( 'widgets_init', 'ZotpressSidebarWidgetInit' ); - + // Conditionally serve shortcode scripts function Zotpress_theme_conditional_scripts_footer() { + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + if ( $GLOBALS['zp_is_shortcode_displayed'] === true ) { - if ( !is_admin() ) wp_enqueue_script('jquery'); - wp_register_script('jquery.livequery.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.livequery.js', array('jquery')); - wp_enqueue_script('jquery.livequery.js'); - + if ( ! is_admin() ) wp_enqueue_script('jquery'); + wp_register_script('jquery.livequery.min.js', ZOTPRESS_PLUGIN_URL . 'js/jquery.livequery.min.js', array('jquery')); + wp_enqueue_script('jquery.livequery.min.js'); + wp_enqueue_script("jquery-effects-core"); wp_enqueue_script("jquery-effects-highlight"); - - wp_register_script('zotpress.frontend.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.frontend.js', array('jquery')); - wp_enqueue_script('zotpress.frontend.js'); + + wp_enqueue_script( 'zotpress.default'.$minify.'.js', ZOTPRESS_PLUGIN_URL . 'js/zotpress.default'.$minify.'.js', array( 'jquery' ) ); } } add_action('wp_footer', 'Zotpress_theme_conditional_scripts_footer'); - - - - // 5.2 - Notice of required re-import - // Thanks to http://wptheming.com/2011/08/admin-notices-in-wordpress/ - - function zotpress_5_2_admin_notice() + + + function Zotpress_enqueue_shortcode_bib() + { + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_script( 'zotpress.shortcode.bib'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.shortcode.bib'.$minify.'.js', array( 'jquery' ), false, true ); + wp_localize_script( + 'zotpress.shortcode.bib'.$minify.'.js', + 'zpShortcodeAJAX', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpShortcode_nonce' => wp_create_nonce( 'zpShortcode_nonce_val' ), + 'action' => 'zpRetrieveViaShortcode', + 'txt_removeimg' => __('Remove Image', 'zotpress'), + 'txt_zperror' => __('There was a Zotpress error:', 'zotpress'), + 'txt_noitemsfound' => __( 'No items found.', 'zotpress' ) + ) + ); + } + add_action( 'wp_enqueue_scripts', 'Zotpress_enqueue_shortcode_bib' ); + + + function Zotpress_enqueue_shortcode_intext() + { + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_script( 'zotpress.shortcode.intext'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.shortcode.intext'.$minify.'.js', array( 'jquery' ), false, true ); + wp_localize_script( + 'zotpress.shortcode.intext'.$minify.'.js', + 'zpShortcodeAJAX', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpShortcode_nonce' => wp_create_nonce( 'zpShortcode_nonce_val' ), + 'action' => 'zpRetrieveViaShortcode', + 'txt_zperror' => __('There was a Zotpress error:', 'zotpress'), + 'txt_noitemsfound' => __( 'No items found.', 'zotpress' ) + ) + ); + } + add_action( 'wp_enqueue_scripts', 'Zotpress_enqueue_shortcode_intext' ); + + + function Zotpress_enqueue_lib_dropdown() + { + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_script( 'zotpress.lib'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.lib'.$minify.'.js', array( 'jquery' ), false, true ); + wp_register_script( 'zotpress.lib.dropdown'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.lib.dropdown'.$minify.'.js', array( 'jquery' ), false, true ); + wp_localize_script( + 'zotpress.lib.dropdown'.$minify.'.js', + 'zpShortcodeAJAX', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpShortcode_nonce' => wp_create_nonce( 'zpShortcode_nonce_val' ), + 'action' => 'zpRetrieveViaShortcode', + 'txt_loading' => __( 'Loading', 'zotpress' ), + 'txt_items' => __( 'items', 'zotpress' ), + 'txt_subcoll' => __( 'subcollections', 'zotpress' ), + 'txt_changeimg' => __( 'Change Image', 'zotpress' ), + 'txt_setimg' => __( 'Set Image', 'zotpress' ), + 'txt_itemkey' => __( 'Item Key', 'zotpress' ), + 'txt_nocitations' => __( 'There are no citations to display.', 'zotpress' ), + 'txt_toplevel' => __( 'Top Level', 'zotpress' ), + 'txt_nocollsel' => __( 'No Collection Selected', 'zotpress' ), + 'txt_backtotop' => __( 'Back', 'zotpress' ), + 'txt_unsettag' => __( 'Unset Tag', 'zotpress' ), + 'txt_notagsel' => __( 'No Tag Selected', 'zotpress' ), + 'txt_notags' => __( 'No tags to display', 'zotpress' ) + ) + ); + } + add_action( 'wp_enqueue_scripts', 'Zotpress_enqueue_lib_dropdown' ); + add_action( 'admin_enqueue_scripts', 'Zotpress_enqueue_lib_dropdown' ); + + + function Zotpress_enqueue_lib_searchbar() + { + // Turn on/off minified versions if testing/live + $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; + + wp_register_script( 'zotpress.lib'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.lib'.$minify.'.js', array( 'jquery' ), false, true ); + wp_register_script( 'zotpress.lib.searchbar'.$minify.'.js', plugin_dir_url( __FILE__ ) . 'js/zotpress.lib.searchbar'.$minify.'.js', array( 'jquery' ), false, true ); + wp_localize_script( + 'zotpress.lib.searchbar'.$minify.'.js', + 'zpShortcodeAJAX', + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'zpShortcode_nonce' => wp_create_nonce( 'zpShortcode_nonce_val' ), + 'action' => 'zpRetrieveViaShortcode', + 'txt_typetosearch' => __('Type to search','zotpress') + ) + ); + } + add_action( 'wp_enqueue_scripts', 'Zotpress_enqueue_lib_searchbar' ); + add_action( 'admin_enqueue_scripts', 'Zotpress_enqueue_lib_searchbar' ); + +// REGISTER ACTIONS -------------------------------------------------------------------------------- + + +// SECURITY ---------------------------------------------------------------------------------------- + + function zp_nonce_life() { + return 24 * HOUR_IN_SECONDS; + } + add_filter( 'nonce_life', 'zp_nonce_life' ); + +// SECURITY ---------------------------------------------------------------------------------------- + + +// ZOTPRESS NOTIFICATIONS ------------------------------------------------------------------------ + + if ( in_array( ZOTPRESS_VERSION, array( "6.2.1", "6.2.2", "7.1.1", "7.1.2", "7.1.3", "7.1.4" ) ) ) { - global $wpdb; - global $current_user; - - // See if any accounts are the old version - $temp_version_count = - $wpdb->get_var( "SELECT COUNT(version) FROM ".$wpdb->prefix."zotpress - WHERE version != '".$GLOBALS['Zotpress_update_db_by_version']."';" ); - - if ( $temp_version_count > 0 - && !get_user_meta($current_user->ID, 'zotpress_5_2_ignore_notice') - && ( current_user_can('edit_posts') || current_user_can('edit_pages') ) - && ( !isset($_GET['setup']) && !isset($_GET['selective']) && !isset($_GET['import']) ) - ) - { - echo '

    '; - printf(__('URGENT: Due to major changes in Zotpress, your Zotero account(s) need to be re-imported. | Hide Notice'), 'admin.php?page=Zotpress&zotpress_5_2_ignore=0'); - echo "

    "; + function Zotpress_plugin_update_message( $data, $response ) { + printf( + '%s', + __( 'Be sure to clear the Zotpress cache for each account after updating!', 'zotpress' ) + ); } + add_action( 'in_plugin_update_message-zotpress/zotpress.php', 'Zotpress_plugin_update_message', 10, 2 ); } - add_action( 'admin_notices', 'zotpress_5_2_admin_notice' ); - - function zotpress_5_2_ignore() + + if ( in_array( ZOTPRESS_VERSION, array( "6.2.1", "6.2.2", "7.1.4" ) ) ) { - global $current_user; - if ( isset($_GET['zotpress_5_2_ignore']) && $_GET['zotpress_5_2_ignore'] == '0' ) - add_user_meta($current_user->ID, 'zotpress_5_2_ignore_notice', 'true', true); + if ( zp_get_total_accounts() > 0 + && ! get_option( 'Zotpress_update_notice_dismissed' ) ) + add_action( 'admin_notices', 'Zotpress_update_notice' ); + + function Zotpress_update_notice() + { + ?> +
    +

    Warning: Due to major updates in this version of Zotpress, you may need to clear the cache of each synced Zotero account.', 'zotpress' ); ?>

    +

    »

    +
    + \ No newline at end of file +?>