Plugin Directory

Changeset 814768


Ignore:
Timestamp:
12/04/2013 07:19:42 AM (12 years ago)
Author:
ashdurham
Message:

Dynamic CSS, spanish translation, HTML5 banner support, font awesome pulled locally

Location:
adkingpro
Files:
105 added
8 edited

Legend:

Unmodified
Added
Removed
  • adkingpro/trunk/adkingpro.php

    r804145 r814768  
    44    Plugin URI: http://kingpro.me/plugins/ad-king-pro/
    55    Description: Ad King Pro allows you to manage, display, document and report all of your custom advertising on your wordpress site.
    6     Version: 1.9.7
     6    Version: 1.9.8
    77    Author: Ash Durham
    88    Author URI: http://durham.net.au/
     
    2929
    3030    global $akp_db_version;
    31     $akp_db_version = "1.9.7";
     31    $akp_db_version = "1.9.8";
    3232
    3333    function akp_install() {
  • adkingpro/trunk/includes/admin_area.php

    r803624 r814768  
    3232  register_setting( 'akp-options', 'akp_image_sizes' );
    3333  register_setting( 'akp-options', 'akp_auth_role' );
     34  register_setting( 'akp-options', 'akp_custom_css' );
    3435}
    3536add_action( 'admin_init', 'register_akp_options' );
     
    4344add_option( 'akp_image_sizes', '' );
    4445add_option( 'akp_auth_role', 'subscriber');
     46add_option( 'akp_custom_css', '/* Add any CSS you would like to modify your banner ads here */' );
    4547
    4648function akp_allowed_cap() {
     
    170172    );
    171173    wp_localize_script( 'adkingpro-js', 'AkpAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'ajaxnonce' => wp_create_nonce( 'akpN0nc3' ), ) );
     174    wp_enqueue_style('akp-dynamic-css', admin_url('admin-ajax.php').'?action=akp_dynamic_css');
    172175}
    173176add_action('wp_enqueue_scripts', 'akp_my_scripts_method');
     177
     178//function akp_dynaminc_css() {
     179//    echo plugins_url('/css/dynamic.css.php', dirname(__FILE__));
     180//  require(plugins_url('/css/dynamic.css.php', dirname(__FILE__)));
     181//  exit;
     182//}
     183//add_action('wp_ajax_akp_dynamic_css', 'akp_dynaminc_css');
     184//add_action('wp_ajax_nopriv_akp_dynamic_css', 'akp_dynaminc_css');
     185
     186function akp_dynamic_css() {
     187    ?>
     188    <style type="text/css">
     189        <?= get_option('akp_custom_css') ?>
     190    </style>
     191    <?php
     192}
     193
     194add_action('wp_head', 'akp_dynamic_css');
    174195
    175196//add extra fields to category edit form callback function
     
    320341        add_meta_box('akpimagebox', __('Advert Image', 'akptext'), 'akp_image_box', 'adverts_posts', 'normal', 'high');
    321342    add_meta_box('akpflashbox', __('Advert Flash File', 'akptext'), 'akp_flash_box', 'adverts_posts', 'normal', 'high');
     343    add_meta_box('akphtml5box', __('Advert HTML5 File', 'akptext'), 'akp_html5_box', 'adverts_posts', 'normal', 'high');
    322344    add_meta_box('akpadsensebox', __('Advert AdSense Code', 'akptext'), 'akp_adsense_box', 'adverts_posts', 'normal', 'high');
    323345    add_meta_box('akptextbox', __('Advert Text', 'akptext'), 'akp_text_box', 'adverts_posts', 'normal', 'high');
    324     add_meta_box('postremoveurllink', __('Remove Link from Advert?', 'akptext'), 'akp_remove_url_link', 'adverts_posts', 'advanced', 'high');
    325346    add_meta_box('postclickstatsdiv', __('Advert Stats', 'akptext'), 'akp_post_click_stats', 'adverts_posts', 'advanced', 'low');
    326347    add_meta_box('revenuevaluesdiv', __('Advert Revenue', 'akptext'), 'akp_revenue_values', 'adverts_posts', 'side', 'low');
     
    395416    global $wpdb, $post;
    396417    $media_type = (get_post_meta( $post->ID, 'akp_media_type', true )) ? get_post_meta( $post->ID, 'akp_media_type', true ) : 'image';
     418    $html5 = ($media_type == 'html5') ? ' selected' : '';
    397419    $flash = ($media_type == 'flash') ? ' selected' : '';
    398420    $adsense = ($media_type == 'adsense') ? ' selected' : '';
     
    401423    echo "<select name='akp_media_type' id='akp_change_media_type'>";
    402424    echo "<option value='image'>".__('Image', 'akptext')."</option>";
     425    echo "<option value='html5'".$html5.">".__('HTML5', 'akptext')."</option>";
    403426    echo "<option value='flash'".$flash.">".__('Flash', 'akptext')."</option>";
    404427    echo "<option value='adsense'".$adsense.">".__('AdSense', 'akptext')."</option>";
     
    429452    echo '<br /><input id="akp_image_alt" type="text" style="width: 100%;" name="akp_image_alt" value="'.$image_alt.'" />';
    430453    echo '<br /><br />';
     454}
     455
     456function akp_html5_box($object, $box) {
     457    global $post;
     458    $html5_url = (get_post_meta( $post->ID, 'akp_html5_url', true )) ? get_post_meta( $post->ID, 'akp_html5_url', true ) : '';
     459    $html5_width = (get_post_meta( $post->ID, 'akp_html5_width', true )) ? get_post_meta( $post->ID, 'akp_html5_width', true ) : '';
     460    $html5_height = (get_post_meta( $post->ID, 'akp_html5_height', true )) ? get_post_meta( $post->ID, 'akp_html5_height', true ) : '';
     461    echo '<label for="akp_html5_url">';
     462    echo '<input id="akp_html5_url" type="text" size="36" name="akp_html5_url" value="'.$html5_url.'" />';
     463    echo '<input id="akp_html5_url_button" class="button" type="button" value="'.__('Upload HTML5 File', 'akptext').'" />';
     464    echo '<br />'.__('Enter a URL or upload a HTML5 file - PLEASE NOTE: Must contain at least one (1) anchor tag (<a />) with a "href" attribute', 'akptext');
     465    echo '</label><br /><br />';
     466    echo '<label for="akp_html5_width" style="width: 85px; display: block; float: left;">'.__('Frame Width', 'akptext').'</label><input type="text" name="akp_html5_width" value="'.$html5_width.'" style="width: 60px;" /><br />';
     467    echo '<label for="akp_html5_height" style="width: 85px; display: block; float: left;">'.__('Frame Height', 'akptext').'</label><input type="text" name="akp_html5_height" value="'.$html5_height.'" style="width: 60px;" /><br />';
    431468}
    432469
     
    508545}
    509546add_action( 'admin_action_akpresetdata', 'akpresetdata_admin_action' );
    510 
    511 // Add checkbox to remove URL Link off advert
    512 //function akp_remove_url_link($object, $box) {
    513 //    global $post;
    514 //    $remove_url = get_post_meta( $post->ID, 'akp_remove_url', true );
    515 //    // Use nonce for verification
    516 //    echo '<input type="hidden" name="akp_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    517 //    echo '<input type="checkbox" value="1" name="akp_remove_url" id="akp_remove_url"', $remove_url ? ' checked="checked"' : '', ' />';
    518 //}
    519547
    520548// Add checkbox to remove URL Link off advert
     
    587615                update_post_meta( $post->ID, 'akp_image_url', $_POST['akp_image_url'] );
    588616            update_post_meta( $post->ID, 'akp_image_alt', $_POST['akp_image_alt'] );
     617            update_post_meta( $post->ID, 'akp_html5_url', $_POST['akp_html5_url'] );
     618            update_post_meta( $post->ID, 'akp_html5_width', $_POST['akp_html5_width'] );
     619            update_post_meta( $post->ID, 'akp_html5_height', $_POST['akp_html5_height'] );
    589620            update_post_meta( $post->ID, 'akp_flash_url', $_POST['akp_flash_url'] );
    590621            update_post_meta( $post->ID, 'akp_flash_width', $_POST['akp_flash_width'] );
     
    615646        $output['akp_image_url'] = (get_post_meta( $id, 'akp_image_url' ) ? get_post_meta( $id, 'akp_image_url' ) : array(''));
    616647        $output['akp_image_alt'] = (get_post_meta( $id, 'akp_image_alt' ) ? get_post_meta( $id, 'akp_image_alt' ) : array(''));
     648        $output['akp_html5_url'] = (get_post_meta( $id, 'akp_html5_url' ) ? get_post_meta( $id, 'akp_html5_url' ) : array(''));
     649        $output['akp_html5_width'] = (get_post_meta( $id, 'akp_html5_width' ) ? get_post_meta( $id, 'akp_html5_width' ) : array(''));
     650        $output['akp_html5_height'] = (get_post_meta( $id, 'akp_html5_height' ) ? get_post_meta( $id, 'akp_html5_height' ) : array(''));
    617651        $output['akp_flash_url'] = (get_post_meta( $id, 'akp_flash_url' ) ? get_post_meta( $id, 'akp_flash_url' ) : array(''));
    618652        $output['akp_flash_width'] = (get_post_meta( $id, 'akp_flash_width' ) ? get_post_meta( $id, 'akp_flash_width' ) : array(''));
     
    797831        wp_register_style( 'akp_jquery_ui', plugins_url('css/jquery-ui.css', dirname(__FILE__)), false, '1.9.2' );
    798832        wp_register_style( 'akp_css', plugins_url('css/adkingpro-styles.css', dirname(__FILE__)), false, '1.0.0' );
    799         wp_register_style( 'fontawesome', '//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css', false, '3.2.1');
     833        wp_register_style( 'fontawesome', plugins_url('css/font-awesome.min.css', dirname(__FILE__)), false, '3.2.1');
    800834
    801835        wp_enqueue_style('akp_jquery_ui');
  • adkingpro/trunk/includes/output.php

    r770093 r814768  
    9090                        $output .= "</div>";
    9191                        break;
     92                       
     93                    case 'html5':
     94                        $output .= "<div class='adkingprobannerhtml5 ".$type." akpbanner banner".$post_id."'>";
     95                        $output .= '<iframe width="'.$cfields['akp_html5_width'][0].'" height="'.$cfields['akp_html5_height'][0].'" src="'.$cfields['akp_html5_url'][0].'" id="akpbanner'.$post_id.'-iframe" name="akpbanner'.$post_id.'-iframe" class="akpbanner-iframe" data-id="'.$post_id.'" style="border: none;"></iframe>';
     96                        $output .= "</div>";
     97                        break;
    9298                   
    9399                    case 'flash':
     
    188194                        if ($display_link)
    189195                            $output .= "</a>";
     196                        $output .= "</div>";
     197                        break;
     198                       
     199                    case 'html5':
     200                        $output .= "<div class='adkingprobannerhtml5 ".$type." akpbanner banner".$post_id."'>";
     201                        $output .= '<iframe width="'.$cfields['akp_html5_width'][0].'" height="'.$cfields['akp_html5_height'][0].'" src="'.$cfields['akp_html5_url'][0].'" id="akpbanner'.$post_id.'-iframe" name="akpbanner'.$post_id.'-iframe" class="akpbanner-iframe" data-id="'.$post_id.'" style="border: none;"></iframe>';
    190202                        $output .= "</div>";
    191203                        break;
     
    278290                        $output .= "</div>";
    279291                        break;
     292                       
     293                    case 'html5':
     294                        $output .= "<div class='adkingprobannerhtml5 ".$type." akpbanner banner".$post_id."'>";
     295                        $output .= '<iframe width="'.$cfields['akp_html5_width'][0].'" height="'.$cfields['akp_html5_height'][0].'" src="'.$cfields['akp_html5_url'][0].'" id="akpbanner'.$post_id.'-iframe" name="akpbanner'.$post_id.'-iframe" class="akpbanner-iframe" data-id="'.$post_id.'" style="border: none;"></iframe>';
     296                        $output .= "</div>";
     297                        break;
    280298                   
    281299                    case 'flash':
  • adkingpro/trunk/includes/screens/kpp.php

    r803624 r814768  
    3232        </div>
    3333        <div class="kpp_plugin">
     34            <img src="<?= plugins_url('../images/kpp_dkp.jpg', dirname(__FILE__)) ?>" alt="Details King Pro" />
     35            <span class="title">Details King Pro</span>
     36            <span class="description"><?= __("Site details the way you need them", 'akptext') ?></span>
     37            <span class="links"><a href="<?= admin_url('plugin-install.php?tab=plugin-information&amp;plugin=details-king-pro&amp;TB_iframe=true&amp;width=600&amp;height=550'); ?>" class="thickbox" title="<?= __("More information about", 'akptext') ?> Details King Pro"><?= __("Install", 'akptext') ?></a></span>
     38        </div>
     39        <div class="kpp_plugin">
    3440            <img src="<?= plugins_url('../images/kpp_smtpkp.jpg', dirname(__FILE__)) ?>" alt="SMTP King Pro" />
    3541            <span class="title">SMTP King Pro</span>
  • adkingpro/trunk/includes/screens/settings.php

    r803624 r814768  
    2121    <?php if (isset($_GET['settings-updated']) && $_GET['settings-updated'] === 'true') : ?>
    2222    <div class="updated akp_notice">
    23         <p><?php __( "Settings have been saved", 'akptext' ); ?></p>
     23        <p><?= __( "Settings have been saved", 'akptext' ); ?></p>
    2424    </div>
    2525    <?php elseif (isset($_GET['settings-updated']) && $_GET['settings-updated'] === 'false') : ?>
    2626    <div class="error akp_notice">
    27         <p><?php __( "Settings have <strong>NOT</strong> been saved. Please try again.", 'akptext' ); ?></p>
     27        <p><?= __( "Settings have <strong>NOT</strong> been saved. Please try again.", 'akptext' ); ?></p>
    2828    </div>
    2929    <?php endif; ?>
     
    136136                </td>
    137137                <td><?= __("* More themes can be downloaded from the", 'akptext' ); ?> <a href="http://kingpro.me/plugins/ad-king-pro/themes/" target="_blank">King Pro Plugins <?= __("website", 'akptext' ); ?></a></td>
     138                </tr>
     139               
     140                <tr valign="top">
     141                <th scope="row"><?= __("Custom CSS", 'akptext' ); ?></th>
     142                <td>
     143                    <?php $css = get_option('akp_custom_css'); ?>
     144                    <textarea name="akp_custom_css"><?= $css ?></textarea>
     145                </td>
     146                <td></td>
    138147                </tr>
    139148            </table>
  • adkingpro/trunk/js/adkingpro-admin-functions.js

    r775596 r814768  
    11jQuery(document).ready(function($) {
    22    if ($("#akp_change_media_type").length > 0) {
    3         $('#postimagediv, #akpflashbox, #akpadsensebox, #postremoveurllink, #akpimagebox, #akptextbox, #akpimageattrbox').hide();
     3        $('#postimagediv, #akphtml5box, #akpflashbox, #akpadsensebox, #postremoveurllink, #akpimagebox, #akptextbox, #akpimageattrbox').hide();
    44        if ($("#akp_change_media_type").val() === 'image') {
    5             $('#title-prompt-text').text('Advert URL ie http://durham.net.au/wordpress/plugins/adkingpro');
     5            $('#title-prompt-text').text('Advert URL ie http://kingpro.me/plugins/ad-king-pro');
    66            $('#postimagediv').fadeIn();
    77            $('#akpimagebox').fadeIn();
    88            $('#akpimageattrbox').fadeIn();
    99            $('#postremoveurllink').fadeIn();
     10        } else if ($("#akp_change_media_type").val() === 'html5') {
     11            $('#title-prompt-text').text('Advert URL ie http://kingpro.me/plugins/ad-king-pro');
     12            $('#akphtml5box').fadeIn();
    1013        } else if ($("#akp_change_media_type").val() === 'flash') {
    1114            $('#title-prompt-text').text('Advert description (for internal use)');
     
    1518            $('#akpadsensebox').fadeIn();
    1619        } else if ($("#akp_change_media_type").val() === 'text') {
    17             $('#title-prompt-text').text('Advert URL ie http://durham.net.au/wordpress/plugins/adkingpro');
     20            $('#title-prompt-text').text('Advert URL ie http://kingpro.me/plugins/ad-king-pro');
    1821            $('#akptextbox').fadeIn();
    1922        }
     
    2124    $('#akp_change_media_type').change(function() {
    2225        // Change views
    23         $('#postimagediv, #akpflashbox, #akpadsensebox, #postremoveurllink, #akpimagebox, #akptextbox, #akpimageattrbox').hide();
     26        $('#postimagediv, #akphtml5box, #akpflashbox, #akpadsensebox, #postremoveurllink, #akpimagebox, #akptextbox, #akpimageattrbox').hide();
    2427        if ($(this).val() === 'image') {
    25             $('#title-prompt-text').text('Advert URL ie http://durham.net.au/wordpress/plugins/adkingpro');
     28            $('#title-prompt-text').text('Advert URL ie http://kingpro.me/plugins/ad-king-pro');
    2629            $('#postimagediv').fadeIn();
    2730            $('#akpimagebox').fadeIn();
    2831            $('#postremoveurllink').fadeIn();
     32        } else if ($("#akp_change_media_type").val() === 'html5') {
     33            $('#title-prompt-text').text('Advert URL ie http://kingpro.me/plugins/ad-king-pro');
     34            $('#akphtml5box').fadeIn();
    2935        } else if ($(this).val() === 'flash') {
    3036            $('#title-prompt-text').text('Advert description (for internal use)');
     
    3440            $('#akpadsensebox').fadeIn();
    3541        } else if ($(this).val() === 'text') {
    36             $('#title-prompt-text').text('Advert URL ie http://durham.net.au/wordpress/plugins/adkingpro');
     42            $('#title-prompt-text').text('Advert URL ie http://kingpro.me/plugins/ad-king-pro');
    3743            $('#akptextbox').fadeIn();
    3844        }
     45    });
     46   
     47    var html5_custom_uploader;
     48    $('#akp_html5_url_button').click(function(e) {
     49        e.preventDefault();
     50       
     51        //If the uploader object has already been created, reopen the dialog
     52        if (html5_custom_uploader) {
     53            html5_custom_uploader.open();
     54            return;
     55        }
     56 
     57        //Extend the wp.media object
     58        html5_custom_uploader = wp.media.frames.file_frame = wp.media({
     59            title: 'Choose HTML5 File',
     60            button: {
     61                text: 'Choose HTML5 File'
     62            },
     63            multiple: false
     64        });
     65 
     66        //When a file is selected, grab the URL and set it as the text field's value
     67        flash_custom_uploader.on('select', function() {
     68            attachment = flash_custom_uploader.state().get('selection').first().toJSON();
     69            var url = '';
     70            url = attachment['url'];
     71            $('#akp_html5_url').val(url);
     72        });
     73 
     74        //Open the uploader dialog
     75        html5_custom_uploader.open();
    3976    });
    4077   
  • adkingpro/trunk/js/adkingpro-functions.js

    r770093 r814768  
    2020//        $.post(AkpAjax.ajaxurl, {action: 'akplogclick', ajaxnonce : AkpAjax.ajaxnonce, post_id:post_id});
    2121//    });
     22
     23    $(".akpbanner-iframe").each(function() {
     24        var post_id = $(this).data('id');
     25        $(this).contents().find('a').each(function() {
     26            var url = $(this).attr('href');
     27            $(this).attr({'onClick': 'parent.track_click('+post_id+', \''+url+'\')', 'target': '_blank'}).css('cursor', 'pointer');
     28        });
     29    });
    2230});
     31
     32function track_click(post_id, url) {
     33    jQuery.post(AkpAjax.ajaxurl, {action: 'akplogclick', ajaxnonce : AkpAjax.ajaxnonce, url: url, post_id:post_id});
     34}
  • adkingpro/trunk/readme.txt

    r803624 r814768  
    55Requires at least: 3.0.1
    66Tested up to: 3.7.1
    7 Stable tag: 1.9.7
     7Stable tag: 1.9.8
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    131131== Changelog ==
    132132
     133= 1.9.8 =
     134* Spanish Translation included thanks to WebHostingHub.com
     135* Update to KPP section with release of new plugin
     136* Created local copy of Font Awesome as requested by Wordpress
     137* Addition of HTML5 Banner option
     138
    133139= 1.9.7 =
    134140* Text updated to allow for internationalisation - if you would like to submit your translation, please email the compiled language files to [email protected]
     
    225231== Upgrade Notice ==
    226232
     233= 1.9.8 =
     234* Spanish Translation included thanks to WebHostingHub.com
     235* Update to KPP section with release of new plugin
     236* Created local copy of Font Awesome as requested by Wordpress
     237* Addition of HTML5 Banner option
     238
    227239= 1.9.7 =
    228240* Text updated to allow for internationalisation - if you would like to submit your translation, please email the compiled language files to [email protected]
Note: See TracChangeset for help on using the changeset viewer.