コード例 #1
0
ファイル: SGMB.php プロジェクト: mfojtik/elisinwonderland
    public function mediaButtonThickboxs()
    {
        ?>
		<script type="text/javascript">
			jQuery(document).ready(function ($) {
				$('#sgmb-insert').on('click', function () {
					var id = $('#sgmb-buttons-id').val();
					if ('' === id) {
						alert('Select your social media buttons');
						return;
					}
					selectionText = '';
					if (typeof(tinyMCE.editors.content) != "undefined") {
						selectionText = (tinyMCE.activeEditor.selection.getContent()) ? tinyMCE.activeEditor.selection.getContent() : '';
					}
					window.send_to_editor('[sgmb id="' + id + '"]');
					$('#sgmb-thickbox').dialog( "close" );
				});
			});
		</script>
		<div id="sgmb-thickbox" style="display: none;">
			<div class="wrap">
				<p>Insert the shortcode for showing a Social Media.</p>
				<div>
					<select id="sgmb-buttons-id" style="width:150px; margin-bottom:20px;">
						<option value="">Please select...</option>
						<?php 
        global $wpdb;
        $proposedTypes = array();
        $orderBy = 'id DESC';
        $allButtons = SGMBButton::findAll($orderBy);
        foreach ($allButtons as $allButton) {
            ?>
								<option value="<?php 
            echo esc_attr($allButton->getId());
            ?>
"><?php 
            echo esc_html($allButton->getTitle());
            ?>
</option>;
							<?php 
        }
        ?>
					</select>
				</div>
				<div class="sgmb-image-uploader-wrapper">
					<input id="sgmb-upload-image" type="text" style="width:150px;" name="ad_image" value=""
						<?php 
        if (SGMB_PRO != 1) {
            ?>
 disabled <?php 
        }
        ?>
					>
					<input id="sgmb-upload-image-button" class="button" type="button" value="Select custom image"
						<?php 
        if (SGMB_PRO != 1) {
            ?>
 disabled <?php 
        }
        ?>
					>
					<?php 
        if (SGMB_PRO != 1) {
            ?>
						<a href="<?php 
            echo SGMB_PRO_URL;
            ?>
" target="_blank" style="font-size: 24px; font-family: Cursive; font-style: oblique; margin-left: 24px; color: red !important; margin-bottom: 14px !important;">PRO</a>
					<?php 
        }
        ?>
				</div>
				<p class="submit">
					<input type="button" id="sgmb-insert" class="button-primary dashicons-share" value="Insert"/>
					<a class="button-secondary" onclick="jQuery('#sgmb-thickbox').dialog('close')"; title="Cancel">Cancel</a>
				</p>
			</div>
		</div>
	<?php 
    }