<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[5772] sites/trunk/wordcamp.org/public_html/wp-content/plugins: WordCamp Multievent Sponsors: Add metabox for sponsor agreement</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/5772">5772</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/5772","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>coreymckrill</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2017-08-08 01:24:36 +0000 (Tue, 08 Aug 2017)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp Multievent Sponsors: Add metabox for sponsor agreement</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginsmultieventsponsorsclassesmessponsorphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/classes/mes-sponsor.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswcposttypesviewssponsorsmetaboxsponsoragreementphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-agreement.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswcposttypeswcposttypesphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginsmultieventsponsorsviewsmetaboxsponsoragreementphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/views/metabox-sponsor-agreement.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginsmultieventsponsorsclassesmessponsorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/classes/mes-sponsor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/classes/mes-sponsor.php 2017-08-08 01:24:32 UTC (rev 5771)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/classes/mes-sponsor.php 2017-08-08 01:24:36 UTC (rev 5772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,10 +18,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Constructor
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __construct() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_action( 'init', array( $this, 'create_post_type' ) );
- add_action( 'admin_init', array( $this, 'add_meta_boxes' ) );
- add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
- add_filter( 'the_content', array( $this, 'add_header_footer_text' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_action( 'init', array( $this, 'create_post_type' ) );
+ add_action( 'admin_init', array( $this, 'add_meta_boxes' ) );
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue' ), 20 );
+ add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
+ add_filter( 'the_content', array( $this, 'add_header_footer_text' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,6 +87,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'normal',
</span><span class="cx" style="display: block; padding: 0 10px"> 'default'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ add_meta_box(
+ 'sponsor-agreement',
+ __( 'Sponsor Agreement', 'wordcamporg' ),
+ array( $this, 'markup_meta_boxes' ),
+ MES_Sponsor::POST_TYPE_SLUG,
+ 'side'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -125,12 +134,30 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $view = 'metabox-contact-information.php';
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ case 'sponsor-agreement':
+ $agreement_id = get_post_meta( $post->ID, 'mes_sponsor_agreement', true );
+ $agreement_url = wp_get_attachment_url( $agreement_id );
+ $view = 'metabox-sponsor-agreement.php';
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once( dirname( __DIR__ ) . '/views/'. $view );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Enqueue admin scripts.
+ */
+ function admin_enqueue() {
+ global $post_type;
+
+ // Enqueues scripts and styles for sponsors admin page
+ if ( self::POST_TYPE_SLUG == $post_type && wp_script_is( 'wcb-spon', 'registered' ) ) {
+ wp_enqueue_script( 'wcb-spon' );
+ }
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Populate the regional sponsorships array with default values.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This helps to avoid any PHP notices from trying to access undefined indices.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -206,6 +233,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> delete_post_meta( $post_id, "mes_$field" );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $sponsor_agreement = filter_input( INPUT_POST, '_wcpt_sponsor_agreement', FILTER_SANITIZE_NUMBER_INT );
+ if ( $sponsor_agreement ) {
+ update_post_meta( $post_id, 'mes_sponsor_agreement', $sponsor_agreement );
+ } else {
+ delete_post_meta( $post_id, 'mes_sponsor_agreement' );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginsmultieventsponsorsviewsmetaboxsponsoragreementphpfromrev5771sitestrunkwordcamporgpublic_htmlwpcontentpluginswcposttypesviewssponsorsmetaboxsponsoragreementphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/views/metabox-sponsor-agreement.php (from rev 5771, sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-agreement.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/views/metabox-sponsor-agreement.php (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/multi-event-sponsors/views/metabox-sponsor-agreement.php 2017-08-08 01:24:36 UTC (rev 5772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,40 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/* @var int $agreement_id */
+/* @var string $agreement_url */
+?>
+
+<?php
+// Use the WC Post Types template if available.
+$template_file = dirname( plugin_dir_path( __FILE__ ), 2 ) . '/wc-post-types/views/sponsors/metabox-sponsor-agreement.php';
+if ( is_readable( $template_file ) ) :
+ require_once $template_file;
+else :
+// WC Post Types template unavailable.
+?>
+<p id="sponsor-agreement-description-container" class="description hidden">
+ <?php
+ printf(
+ wp_kses(
+ __( '<strong>Instructions:</strong> You can generate an agreement for this sponsor <a href="%s">here</a>. Upload a PDF or image file of the signed, dated sponsor agreement.', 'wordcamporg' ),
+ array(
+ 'a' => array( 'href' => true ),
+ 'strong' => true,
+ )
+ ),
+ esc_url( add_query_arg( array( 'page' => 'wcdocs' ), admin_url( 'admin.php' ) ) )
+ );
+ ?>
+</p>
+<p id="sponsor-agreement-upload-container" class="hidden">
+ <a id="sponsor-agreement-upload" class="button secondary" href="#"><?php esc_html_e( 'Attach Signed Agreement', 'wordcamporg' ); ?></a>
+</p>
+
+<p id="sponsor-agreement-view-container" class="hidden">
+ <a id="sponsor-agreement-view" class="button secondary" href="<?php echo esc_url( $agreement_url ); ?>" target="sponsor-agreement"><?php esc_html_e( 'View Agreement', 'wordcamporg' ); ?></a>
+</p>
+<p id="sponsor-agreement-remove-container" class="hidden">
+ <a id="sponsor-agreement-remove" href="#"><?php esc_html_e( 'Remove Agreement', 'wordcamporg' ); ?></a>
+</p>
+
+<input id="sponsor-agreement-id" name="_wcpt_sponsor_agreement" type="hidden" value="<?php echo esc_attr( $agreement_id ); ?>" />
+<?php endif; ?>
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswcposttypesviewssponsorsmetaboxsponsoragreementphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-agreement.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-agreement.php 2017-08-08 01:24:32 UTC (rev 5771)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-agreement.php 2017-08-08 01:24:36 UTC (rev 5772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* @var WP_Post $agreement */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* @var int $agreement_id */
+/* @var string $agreement_url */
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <p id="sponsor-agreement-description-container" class="description hidden">
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswcposttypeswcposttypesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php 2017-08-08 01:24:32 UTC (rev 5771)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php 2017-08-08 01:24:36 UTC (rev 5772)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -207,6 +207,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function admin_enqueue_scripts() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $post_type;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Register
+ wp_register_script(
+ 'wcb-spon', // Avoid "sponsor" since that's a trigger word for ad blockers.
+ plugins_url( 'js/wcb-spon.js', __FILE__ ),
+ array( 'jquery', 'backbone', 'media-views' ),
+ 1,
+ true
+ );
+ wp_localize_script(
+ 'wcb-spon',
+ 'wcbSponsors',
+ array(
+ 'l10n' => array(
+ 'modalTitle' => __( 'Sponsor Agreement', 'wordcamporg' ),
+ ),
+ 'modal' => array(
+ 'allowedTypes' => array( 'image', 'application/pdf' )
+ ),
+ )
+ );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Enqueues scripts and styles for session admin page
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'wcb_session' == $post_type ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_enqueue_script( 'jquery-ui-datepicker' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,26 +237,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Enqueues scripts and styles for sponsors admin page
</span><span class="cx" style="display: block; padding: 0 10px"> if ( 'wcb_sponsor' == $post_type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_enqueue_script(
- 'wcb-spon', // Avoid "sponsor" since that's a trigger word for ad blockers.
- plugins_url( 'js/wcb-spon.js', __FILE__ ),
- array( 'jquery', 'backbone', 'media-views' ),
- 1,
- true
- );
-
- wp_localize_script(
- 'wcb-spon',
- 'wcbSponsors',
- array(
- 'l10n' => array(
- 'modalTitle' => __( 'Sponsor Agreement', 'wordcamporg' ),
- ),
- 'modal' => array(
- 'allowedTypes' => array( 'image', 'application/pdf' )
- ),
- )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_enqueue_script( 'wcb-spon' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>