commit 2692f2bd0c3ef158c0fa25662423c737961ecab5 Author: Stefan Kalscheuer Date: Fri Sep 18 11:05:56 2015 +0200 Initial Git import diff --git a/images/dashicon.png b/images/dashicon.png new file mode 100644 index 0000000..966cee3 Binary files /dev/null and b/images/dashicon.png differ diff --git a/images/rss.jpg b/images/rss.jpg new file mode 100644 index 0000000..78cfa7f Binary files /dev/null and b/images/rss.jpg differ diff --git a/includes/admin/dashboard.php b/includes/admin/dashboard.php new file mode 100644 index 0000000..d968c0e --- /dev/null +++ b/includes/admin/dashboard.php @@ -0,0 +1,43 @@ +'; + echo '' . $total_files->publish . ''; + echo '' . __( 'Ticks', 'wplt2' ) . ''; + echo ''; +} +add_action( 'right_now_content_table_end' , 'wplt_dashboard_right_now' ); + +/** + * Register dashboard widgets + * + * @return void + */ +function wplt_register_dashboard_widgets() { + wp_add_dashboard_widget( 'wplt_dashboard_downloads', __( 'Download Stats', 'wplt2' ), 'wplt_dashboard_downloads_widget' ); +} +//add_action( 'wp_dashboard_setup', 'wplt_register_dashboard_widgets' ); + +/** + * Ticks Dashboard Widget + * + * @access private + * @since 1.0 + * @return void +*/ +function wplt_dashboard_ticks_widget() { + echo 'Content to follow...'; +} \ No newline at end of file diff --git a/includes/admin/media-button.php b/includes/admin/media-button.php new file mode 100644 index 0000000..0c96399 --- /dev/null +++ b/includes/admin/media-button.php @@ -0,0 +1,99 @@ +Add Download'; + } +} +add_filter( 'media_buttons_context', 'wplt_media_button' ); + +/** + * Add Modal Window to Footer + * + * @return void + */ +function wplt_media_modal() { + global $wplt_options; + + $downloads = new WP_Query( 'post_type=wplt_download&nopaging=true&orderby=title&order=ASC' ); + ?> + + ID, '_wplt_file_url', true ); + $file_size = get_post_meta( $post->ID, '_wplt_file_size', true ); + + global $post; + + $plupload_init = array( + 'runtimes' => 'html5, silverlight, flash, html4', + 'browse_button' => 'plupload-browse-button', + 'container' => 'plupload-container', + 'file_data_name' => 'async-upload', + 'multiple_queues' => false, + 'max_file_size' => wp_max_upload_size() . 'b', + 'url' => admin_url( 'admin-ajax.php' ), + 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ), + 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ), + 'filters' => array( array( 'title' => __( 'Allowed Files' ), 'extensions' => '*' ) ), + 'multipart' => true, + 'urlstream_upload' => true, + + // additional post data to send to our ajax hook + 'multipart_params' => array( + '_ajax_nonce' => wp_create_nonce( 'wplt_download_upload' ), + 'action' => 'wplt_download_upload', + 'post_id' => $post->ID + ), + ); + + // Pass to plupload + $plupload_init = apply_filters( 'plupload_init', $plupload_init ); + + ?> + + + +
+ + + + + + + + + + + + + + + +
+ File URL: + + +
+ File Size: + + +
+ + + + +

+ + +
+
+ +
+ + + + + + + + + + + + + + + +
+ File URL: + + +
+ File Size: + + +
+ + + +

+
+ 0 ) { + // Set upload dir + add_filter( 'upload_dir', 'wplt_set_upload_dir' ); + + // Upload the file + $file = wp_handle_upload( $_FILES['async-upload'], array( 'test_form' => false ) ); + + // Check for success + if( isset( $file['file'] ) ) { + // Post ID + $post_id = $_REQUEST['post_id']; + + // Add/update post meta + update_post_meta( $post_id, '_wplt_file_url', $file['url'] ); + update_post_meta( $post_id, '_wplt_file_size', $_FILES['async-upload']['size'] ); + update_post_meta( $post_id, '_wplt_file_type', $file['type'] ); + } + } +} +add_action( 'save_post', 'wplt_meta_box_file_save' ); + +/** + * Render stats meta box + * + * @param object $post current post object + * + * @return void + */ +function wplt_meta_box_stats( $post ) { + $file_count = get_post_meta( $post->ID, '_wplt_file_count', true ); + ?> +
+ + + + + + + +
+ + + +
+
+ + +
+

+

Liveticker

+

' . __( 'Settings updated successfully.', 'wplt2' ) . '

'; + } ?> +
+ +

+ +

+
+ + '; + echo ' '; + echo __( 'Enable', 'wplt2' ); + echo ''; + echo '

' . __( 'Disable this option to remove the default button styling and the Delightful Downloads CSS file.', 'wplt2' ) . '

'; +} + +/** + * Render default style field + * + * @return void + */ +function wplt_settings_default_style_field() { + global $wplt_options; + + $styles = wplt_get_shortcode_styles(); + $default_style = $wplt_options['default_style']; + + echo ''; + echo '

' . __( 'The default display style.', 'wplt2' ) . '

'; +} + +/** + * Render reset settings field + * + * @return void + */ +function wplt_settings_reset_settings_field() { + global $wplt_options; + + $checked = $wplt_options['reset_settings']; + + echo ''; +} \ No newline at end of file diff --git a/includes/admin/post-types-columns.php b/includes/admin/post-types-columns.php new file mode 100644 index 0000000..04e8b9b --- /dev/null +++ b/includes/admin/post-types-columns.php @@ -0,0 +1,73 @@ + '', + 'title' => __( 'Title', 'wplt2' ), + 'author' => __( 'Author', 'wplt2' ), + 'wplt_ticker' => __( 'Ticker', 'wplt2'), + 'date' => __( 'Date', 'wplt2' ) + ); +} +//add_filter( 'manage_wplt_tick_posts_columns', 'wplt_tick_column_headings' ); + +/** + * Download post type column contents + * + * @param array $column_name current column + * @param int $post_id current post id provided by WordPress + * + * @return void + */ +function wplt_tick_column_contents( $column_name, $post_id ) { + // Title column + if( $column_name == 'file' ) { + $path = get_post_meta( $post_id, '_wplt_file_url', true ); + echo wplt_download_filename( $path ); + } +} +add_action( 'manage_wplt_tick_posts_custom_column', 'wplt_tick_column_contents', 10, 2 ); + +/** + * Download post type sortable columns filter + * + * @param array $columns as set above + * + * @return void + */ +function wplt_tick_column_sortable( $columns ) { + $columns['ticks'] = 'ticks'; + + return $columns; +} +add_filter( 'manage_edit-wplt_tick_sortable_columns', 'wplt_tick_column_sortable' ); + +/** + * Download post type sortable columns action + * + * @param array $query + * + * @return void + */ +function wplt_tick_column_orderby( $query ) { + $orderby = $query->get( 'orderby'); + + if( $orderby == 'ticks' ) { + $query->set('meta_key','_wplt_file_count'); + $query->set('orderby','meta_value_num'); + } +} +add_action( 'pre_get_posts', 'wplt_tick_column_orderby' ); \ No newline at end of file diff --git a/includes/ajax.php b/includes/ajax.php new file mode 100644 index 0000000..7783fcd --- /dev/null +++ b/includes/ajax.php @@ -0,0 +1,47 @@ + 'wplt_tick', + 'posts_per_page' => '-1', + 'tax_query' => array( + array( 'taxonomy' => 'wplt_ticker', + 'field' => 'slug', + 'terms' => $slug + ) + ) + ); + + $wp_query = new WP_Query($args); + + while ($wp_query->have_posts()) : $wp_query->the_post(); + $output .= '
  • +

    '.get_the_time('d.m.Y H.i').' + '.get_the_title().'

    +

    '.get_the_content().'

  • '; + endwhile; + + // Echo success response + echo $output; + } + die(); +} +//add_action( 'wp_ajax_wplt_download_upload', 'wplt_download_upload_ajax' ); \ No newline at end of file diff --git a/includes/css/admin.css b/includes/css/admin.css new file mode 100644 index 0000000..d9232f1 --- /dev/null +++ b/includes/css/admin.css @@ -0,0 +1,199 @@ +/* Post Type Columns */ +.wp-list-table .column-downloads, +.wp-list-table .column-file, +.wp-list-table .column-shortcode, +.wp-list-table .column-ip, +.wp-list-table .column-ddate { + width: 15%; +} + +/* Download Modal Window */ +#sdm-download-modal .media-modal-content { + padding: 20px; +} + +#sdm-download-modal .media-modal-content .media-frame-title { + position: static; + margin: -20px -20px 0 -20px; + border-bottom: 1px solid #dfdfdf; +} + +.media-modal-content .left-panel { + position: absolute; + top: 45px; + bottom: 0; + left: 0; + width: 66%; + overflow: auto; +} + +.media-modal-content .right-panel { + position: absolute; + top: 0; + right: 0; + bottom: 0; + width: 20%; + padding: 45px 5% 10px 5%; + border-left: 1px solid #dfdfdf; + background-color: whiteSmoke; +} + +.sdm-download-list ul { + margin: 0 20px; +} + +.sdm-download-list { + margin: 20px 0; +} + +.sdm-download-list ul li { + margin: 10px 0; + padding: 5px; + border: 1px solid #dfdfdf; +} + +.sdm-download-list ul li.ui-selected { + box-shadow: 0 0 0 1px white,0 0 0 5px #1E8CBE; +} + +.sdm-download-list .download_url { + display: block; + margin-top: 3px; + color: gray; +} + +.right-panel .download-details h3 { + font-weight: bold; + text-transform: uppercase; + font-size: 12px; + color: #777; + text-shadow: 0 1px 0 white; + margin: 0 0 8px; +} + +.right-panel .download-details label { + display: block; + margin: 10px 0 5px; + color: #999; +} + +.right-panel .download-details input[type=text] { + display: block; + width: 100%; + padding: 6px 8px; +} + +.right-panel .download-details select { + display: block; + margin: 0 auto; + width: 100%; +} + +.right-panel .download-details #sdm-download-button { + margin-top: 30px; +} + +.right-panel .download-details input[type=button] { + display: block; + margin: 0 auto; + width: 100%; + height: auto; + margin-top: 10px; + padding: 10px 0; + font-size: 16px; +} + +/* Meta Box File Buttons */ +#plupload-browse-button, #plupload-upload-button { + margin-right: 4px; +} + +a#plupload-cancel-button { + padding: 1px 2px; + border-bottom: 1px solid red; + color: red; + text-decoration: none; +} + +a#plupload-cancel-button:hover { + background-color: red; + color: white; +} + +/* Meta Box File Progress */ +#plupload-progress { + position: relative; + margin-top: 10px; + width: 100%; + height: 30px; + border: 1px solid #ddd; +} + +#plupload-progress .bar { + height: 30px; + background-color: rgba(255, 255, 255, 0.5); +} + +#plupload-progress .percent { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 30px; + text-align: center; + font-size: 20px; + font-weight: bold; + line-height: 30px; + color: #ddd; +} + +#plupload-progress .percent p { + margin: 0; +} + +/* Meta Box File Success */ +#plupload-container .success { + color: green; +} + +#plupload-container .error { + color: red; +} + +/* Menu Icon */ +#menu-posts-sdm_download .wp-menu-image { + background: transparent url("/wp-content/plugins/simple-downloads/includes/images/menu.png") no-repeat; + background-position: 0 -35px !important; +} + +#menu-posts-sdm_download:hover .wp-menu-image, #menu-posts-sdm_download.wp-has-current-submenu .wp-menu-image { + background-position: 0 -3px !important; +} + +/* Media Button */ +#sdm-media-button { + padding-left: .4em; +} + +#sdm-media-button span.wp-media-buttons-icon { + background: transparent url("/wp-content/plugins/simple-downloads/includes/images/media-button.png") no-repeat; + background-position: -1px 0; +} + +@media only screen and (-Webkit-min-device-pixel-ratio: 1.5), +only screen and (-moz-min-device-pixel-ratio: 1.5), +only screen and (-o-min-device-pixel-ratio: 3/2), +only screen and (min-device-pixel-ratio: 1.5) { + + /* Menu Icon */ + #menu-posts-sdm_download .wp-menu-image { + background-image: url("/wp-content/plugins/simple-downloads/includes/images/menu@x2.png"); + background-size: 28px 64px !important; + } + + /* Media Button */ + #sdm-media-button span.wp-media-buttons-icon { + background-image: url("/wp-content/plugins/simple-downloads/includes/images/media-button@x2.png"); + background-size: 16px 16px !important; + } +} \ No newline at end of file diff --git a/includes/css/less/simple-downloads.less b/includes/css/less/simple-downloads.less new file mode 100644 index 0000000..c568ca5 --- /dev/null +++ b/includes/css/less/simple-downloads.less @@ -0,0 +1,168 @@ +/* Button style by http://www.joepettersson.com/css3-buttons/ */ + +.download-button { + display: inline-block; + font-size: 12px; + text-decoration: none!important; + font-family: Helvetica, Arial, sans serif; + padding: 8px 12px; + border-radius: 3px; + -moz-border-radius: 3px; + box-shadow: inset 0px 0px 2px #fff; + -o-box-shadow: inset 0px 0px 2px #fff; + -webkit-box-shadow: inset 0px 0px 2px #fff; + -moz-box-shadow: inset 0px 0px 2px #fff; +} +.download-button:active { + box-shadow: inset 0px 0px 3px #999; + -o-box-shadow: inset 0px 0px 3px #999; + -webkit-box-shadow: inset 0px 0px 3px #999; + -moz-box-shadow: inset 0px 0px 3px #999; +} + +/* The styles for the grey button */ +.button-grey { + color: #444; + border: 1px solid #d0d0d0; + background-image: -moz-linear-gradient(#ededed, #e1e1e1); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e1e1e1), to(#ededed)); + background-image: -webkit-linear-gradient(#ededed, #e1e1e1); + background-image: -o-linear-gradient(#ededed, #e1e1e1); + text-shadow: 1px 1px 1px #fff; + background-color: #e1e1e1; +} +.button-grey:hover { + border: 1px solid #b0b0b0; + background-image: -moz-linear-gradient(#e1e1e1, #ededed); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ededed), to(#e1e1e1)); + background-image: -webkit-linear-gradient(#e1e1e1, #ededed); + background-image: -o-linear-gradient(#e1e1e1, #ededed); + background-color: #ededed; +} +.button-grey:active {border: 1px solid #666;} + +/* The styles for the red button */ +.button-red { + color: #923c47; + border: 1px solid #d96d7c; + background-image: -moz-linear-gradient(#f997b0, #f6677b); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f6677b), to(#f997b0)); + background-image: -webkit-linear-gradient(#f997b0, #f6677b); + background-image: -o-linear-gradient(#f997b0, #f6677b); + text-shadow: 1px 1px 1px #fdbcc7; + background-color: #f6677b; +} +.button-red:hover { + border: 1px solid #c75964; + background-image: -moz-linear-gradient(#f6677b, #f997b0); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f997b0), to(#f6677b)); + background-image: -webkit-linear-gradient(#f6677b, #f997b0); + background-image: -o-linear-gradient(#f6677b, #f997b0); + background-color: #f997b0; +} +.button-red:active {border: 1px solid #ab3e4b;} + +/* The styles for the blue button */ +.button-blue { + color: #41788c; + border: 1px solid #6fb1c7; + background-image: -moz-linear-gradient(#aae5f7, #73d0f1); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#73d0f1), to(#aae5f7)); + background-image: -webkit-linear-gradient(#aae5f7, #73d0f1); + background-image: -o-linear-gradient(#aae5f7, #73d0f1); + text-shadow: 1px 1px 1px #bfeafb; + background-color: #73d0f1; +} +.button-blue:hover { + border: 1px solid #4690ad; + background-image: -moz-linear-gradient(#73d0f1, #aae5f7); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#aae5f7), to(#73d0f1)); + background-image: -webkit-linear-gradient(#73d0f1, #aae5f7); + background-image: -o-linear-gradient(#73d0f1, #aae5f7); + background-color: #aae5f7; +} +.button-blue:active {border: 1px solid #3b778b;} + +/* The styles for the green button */ +.button-green { + color: #5a742d; + border: 1px solid #95b959; + background-image: -moz-linear-gradient(#cae387, #a5cb5e); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5cb5e), to(#cae387)); + background-image: -webkit-linear-gradient(#cae387, #a5cb5e); + background-image: -o-linear-gradient(#cae387, #a5cb5e); + text-shadow: 1px 1px 1px #dff4bc; + background-color: #a5cb5e; +} +.button-green:hover { + border: 1px solid #687e30; + background-image: -moz-linear-gradient(#a5cb5e, #cae387); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#cae387), to(#a5cb5e)); + background-image: -webkit-linear-gradient(#a5cb5e, #cae387); + background-image: -o-linear-gradient(#a5cb5e, #cae387); + background-color: #cae387; +} +.button-green:active {border: 1px solid #506320;} + +/* The styles for the black button */ +.button-black { + color: #fff; + border: 1px solid #4d4d4d; + background-image: -moz-linear-gradient(#656565, #454545); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#454545), to(#656565)); + background-image: -webkit-linear-gradient(#656565, #454545); + background-image: -o-linear-gradient(#656565, #454545); + text-shadow: 1px 1px 1px #6d6d6d; + background-color: #454545; +} +.button-black:hover { + border: 1px solid #363636; + background-image: -moz-linear-gradient(#454545, #656565); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#656565), to(#454545)); + background-image: -webkit-linear-gradient(#454545, #656565); + background-image: -o-linear-gradient(#454545, #656565); + background-color: #656565; +} +.button-black:active {border: 1px solid #000;} + +/* The styles for the yellow button */ +.button-yellow { + color: #986a39; + border: 1px solid #e6b650; + background-image: -moz-linear-gradient(#ffd974, #febf4d); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#febf4d), to(#ffd974)); + background-image: -webkit-linear-gradient(#ffd974, #febf4d); + background-image: -o-linear-gradient(#ffd974, #febf4d); + text-shadow: 1px 1px 1px #fbe5ac; + background-color: #febf4d; +} +.button-yellow:hover { + border: 1px solid #c1913d; + background-image: -moz-linear-gradient(#febf4d, #ffd974); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ffd974), to(#febf4d)); + background-image: -webkit-linear-gradient(#febf4d, #ffd974); + background-image: -o-linear-gradient(#febf4d, #ffd974); + background-color: #ffd974; +} +.button-yellow:active {border: 1px solid #936b26;} + +/* The styles for the purple button */ +.button-purple { + color: #7e5d7c; + border: 1px solid #cd93c6; + background-image: -moz-linear-gradient(#e9c4e3, #d798d1); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#d798d1), to(#e9c4e3)); + background-image: -webkit-linear-gradient(#e9c4e3, #d798d1); + background-image: -o-linear-gradient(#e9c4e3, #d798d1); + text-shadow: 1px 1px 1px #f1ceef; + background-color: #d798d1; +} +.button-purple:hover { + border: 1px solid #886382; + background-image: -moz-linear-gradient(#d798d1, #e9c4e3); + background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e9c4e3), to(#d798d1)); + background-image: -webkit-linear-gradient(#d798d1, #e9c4e3); + background-image: -o-linear-gradient(#d798d1, #e9c4e3); + background-color: #e9c4e3; +} +.button-purple:active {border: 1px solid #6a4664;} \ No newline at end of file diff --git a/includes/css/wp-liveticker2.css b/includes/css/wp-liveticker2.css new file mode 100644 index 0000000..3a77d58 --- /dev/null +++ b/includes/css/wp-liveticker2.css @@ -0,0 +1,12 @@ +ul.wplt_ticker{list-style-type:none;} +li.wplt_tick{background-color:#F5F5F5;margin:0.1em;padding:0.1em 0.3em;} +li.wplt_tick p{margin:0.3em;} +span.wplt_tick_time{color:#002C58;font-size:0.7em;font-style:italic;} +span.wplt_tick_title{color:#002C58;font-weight:bold;margin-left:0.5em;} +p.wplt_tick_content{margin-top:-0.7em;text-indent:0.5em;} +ul.wplt_widget{list-style-type:none;margin-top:-0.5em;} +ul.wplt_widget li{text-align:left;} +span.wplt_widget_time{font-size:0.7em;font-style:italic;} +span.wplt_widget_content{color:#002C58;text-indent:0.2em;} +span.wplt_widget_content_new{color:#800000;text-indent:0.2em;} +p.wplt_widget_link{text-align:right;} \ No newline at end of file diff --git a/includes/functions.php b/includes/functions.php new file mode 100644 index 0000000..76b674e --- /dev/null +++ b/includes/functions.php @@ -0,0 +1,19 @@ + 1, + 'reset_settings' => 0 z + ); +} \ No newline at end of file diff --git a/includes/images/rss.jpg b/includes/images/rss.jpg new file mode 100644 index 0000000..78cfa7f Binary files /dev/null and b/includes/images/rss.jpg differ diff --git a/includes/js/admin-post-download.js b/includes/js/admin-post-download.js new file mode 100644 index 0000000..4abb845 --- /dev/null +++ b/includes/js/admin-post-download.js @@ -0,0 +1,71 @@ +jQuery( document ).ready( function( $ ){ + + var uploader = new plupload.Uploader( plupload_args ); + + // User clicks upload + $( '#plupload-upload-button' ).click( function( e ) { + $( '#plupload-upload-button' ).fadeOut( 'fast' ); + $( '#plupload-cancel-button' ).fadeOut( 'fast' ); + $( '#plupload-progress' ).slideDown( 'fast', function() { + uploader.start(); + } ); + + e.preventDefault(); + } ); + + // User clicks cancel + $( '#plupload-cancel-button' ).click( function( e ) { + // Empty queue + uploader.splice(); + e.preventDefault(); + + $( '#plupload-file' ).html( '----' ); + $( '#plupload-file-size' ).html( '----' ); + $( '#plupload-browse-button' ).removeAttr( 'disabled' ); + $( '#plupload-upload-button' ).fadeOut( 'fast' ); + $( '#plupload-cancel-button' ).fadeOut( 'fast' ); + + } ); + + // Init + uploader.init(); + + // File added to queue + uploader.bind('FilesAdded', function( up, files ) { + plupload.each( files, function( file ) { + $( '#plupload-file' ).html( file.name ); + $( '#plupload-file-size' ).html( plupload.formatSize( file.size ) ); + } ); + + $( '#plupload-browse-button' ).attr( 'disabled', 'disabled' ); + $( '#plupload-upload-button' ).fadeIn( 'fast' ); + $( '#plupload-cancel-button' ).fadeIn( 'fast' ); + + up.refresh(); + } ); + + // Error + uploader.bind( 'Error', function( up, err ) { + $( '#plupload-file' ).html( '' + err.message + '' ); + $( '#plupload-file-size' ).html( '----' ); + + up.refresh(); + } ); + + // Progress bar + uploader.bind( 'UploadProgress', function( up, file ) { + $( '#plupload-progress .bar' ).css( 'width', file.percent + '%' ); + $( '#plupload-progress .percent' ).html( '

    ' + file.percent + '%

    ' ); + } ); + + // File uploaded + uploader.bind( 'FileUploaded', function( up, file, response ) { + $( '#plupload-browse-button' ).removeAttr( 'disabled' ); + $( '#plupload-upload-button' ).fadeOut( 'fast' ); + $( '#plupload-cancel-button' ).fadeOut( 'fast' ); + $( '#plupload-progress' ).slideUp( 'fast' ); + $( '#plupload-file' ).html( '' + response.response + '' ); + + } ); + +} ); \ No newline at end of file diff --git a/includes/js/admin-post.js b/includes/js/admin-post.js new file mode 100644 index 0000000..721d64c --- /dev/null +++ b/includes/js/admin-post.js @@ -0,0 +1,92 @@ +jQuery( document ).ready( function( $ ){ + + var download_id; + + // Display download modal + $( '#sdm-media-button' ).click( function( e ) { + $( '#sdm-download-modal' ).show(); + + e.preventDefault(); + } ); + + // Close download modal + $( '#sdm-download-modal-close' ).click( function( e ) { + $( '#sdm-download-modal' ).hide(); + + e.preventDefault(); + } ); + + $( '.media-modal-backdrop' ).click( function() { + $( '#sdm-download-modal' ).hide(); + } ); + + // Hide/show color select + if( $( '#sdm-download-style' ).val() == 'button' ) { + $( '.sdm-download-color-container' ).show(); + } + else { + $( '.sdm-download-color-container' ).hide(); + } + + // Hide/show color select on change + $( '#sdm-download-style' ).change( function() { + if( $( '#sdm-download-style' ).val() == 'button' ) { + $( '.sdm-download-color-container' ).slisdmwn(); + } + else { + $( '.sdm-download-color-container' ).slideUp(); + } + } ); + + // Selectable list items + var selectableOpts = { + selected: function( e, ui ) { + download_id = $( ui.selected ).attr( 'data-ID' ); + $( '.download-details' ).show(); + } + }; + + // Set selectable item + $( '#selectable_list' ).selectable( selectableOpts ); + + // Download insert button + $( '#sdm-download-button' ).click( function() { + var download_text = $( '#sdm-download-text' ).val(); + var download_style = $( '#sdm-download-style' ).val(); + var download_color = $( '#sdm-download-color' ).val(); + + // Check if button and add color + if( download_style == 'button' ) { + color = ' color="' + download_color + '"' + } + else { + color = '' + } + + // Add to editor + window.send_to_editor( '[download id=' + download_id + ' text="' + download_text + '" style="' + download_style + '"' + color + ']' ); + + // Hide modal + $( '#sdm-download-modal' ).hide(); + } ); + + // Download filesize button + $( '#sdm-filesize-button' ).click( function() { + // Add to editor + window.send_to_editor( '[download_size id=' + download_id + ']' ); + + // Hide modal + $( '#sdm-download-modal' ).hide(); + } ); + + // Download count button + $( '#sdm-count-button' ).click( function() { + // Add to editor + window.send_to_editor( '[download_count id=' + download_id + ']' ); + + // Hide modal + $( '#sdm-download-modal' ).hide(); + } ); + + +} ); \ No newline at end of file diff --git a/includes/post-types.php b/includes/post-types.php new file mode 100644 index 0000000..9b9bfad --- /dev/null +++ b/includes/post-types.php @@ -0,0 +1,78 @@ + array( + 'name' => __( 'Ticks', 'wplt2' ), + 'singular_name' => __( 'Tick', 'wplt2' ), + 'add_new' => __( 'Add New', 'wplt2' ), + 'add_new_item' => __( 'Add New Tick', 'wplt2' ), + 'edit_item' => __( 'Edit Tick', 'wplt2' ), + 'new_item' => __( 'New Tick', 'wplt2' ), + 'all_items' => __( 'All Ticks', 'wplt2' ), + 'view_item' => __( 'View Tick', 'wplt2' ), + 'search_items' => __( 'Search Ticks', 'wplt2' ), + 'not_found' => __( 'No Ticks found', 'wplt2' ), + 'not_found_in_trash' => __( 'No Ticks found in Trash', 'wplt2' ), + 'parent_item_colon' => '', + 'menu_name' => __( 'Liveticker', 'wplt2' ) + ), + 'public' => false, + 'show_ui' => true, + 'show_in_menu' => true, + 'menu_icon' => 'dashicons-rss', + 'capability_type' => 'post', + 'supports' => array( 'title', 'editor', 'author'), + 'taxonomies' => array('wplt_ticker') + ); + + register_post_type( 'wplt_tick', $args ); +} +add_action( 'init', 'wplt_tick_post_type' ); + + +/** + * Register custom taxamony (category) + * + * @return void + */ +//hook into the init action and call create_book_taxonomies when it fires +add_action( 'init', 'wplt_ticker_taxonomy', 0 ); + +//create two taxonomies, genres and writers for the post type "book" +function wplt_ticker_taxonomy() +{ + // Add new taxonomy, make it hierarchical (like categories) + $labels = array( + 'name' => _x( 'Ticker', 'taxonomy general name' ), + 'singular_name' => _x( 'Ticker', 'taxonomy singular name' ), + 'search_items' => __( 'Search Tickers', 'wplt2' ), + 'all_items' => __( 'All Tickers', 'wplt2' ), + 'parent_item' => __( 'Parent Ticker', 'wplt2' ), + 'parent_item_colon' => __( 'Parent Ticker:', 'wplt2' ), + 'edit_item' => __( 'Edit Ticker', 'wplt2' ), + 'update_item' => __( 'Update Ticker', 'wplt2' ), + 'add_new_item' => __( 'Add New Ticker', 'wplt2' ), + 'new_item_name' => __( 'New Ticker', 'wplt2' ), + 'menu_name' => __( 'Ticker', 'wplt2' ), + ); + + register_taxonomy('wplt_ticker',array('wplt_tick'), array( + 'hierarchical' => true, + 'labels' => $labels, + 'show_ui' => true, + 'show_admin_column' => true, + 'query_var' => true, + )); +} \ No newline at end of file diff --git a/includes/rss.php b/includes/rss.php new file mode 100644 index 0000000..dbc18af --- /dev/null +++ b/includes/rss.php @@ -0,0 +1,65 @@ + 'wplt_tick', + 'tax_query' => array( + array( 'taxonomy' => 'wplt_ticker', + 'field' => 'slug', + 'terms' => $arguments['ticker_slug'] + ) + ) + ); + + + global $wpdb; + + $sql = "SELECT `ID`, DATE_FORMAT(`post_date`,'%a, %d %b %Y %T') AS `post_date_rfc`, `post_content`, `post_title` FROM `".$wpdb->prefix."posts` WHERE `post_type` = 'wplt_tick' AND `post_status` = 'publish' ORDER BY `post_date` DESC;"; + $entries = $wpdb->get_results($sql); + + date_default_timezone_set("Europe/Berlin"); + + // modify header information + header("Content-Type: application/rss+xml; charset=UTF-8"); + // generate file head + $rss = ''; + $rss .= ''; + $rss .= 'Lager Live'; + $rss .= 'http://'.$_SERVER['SERVER_NAME'].'/lagerticker'; + $rss .= ''; + $rss .= ''; + $rss .= 'de-de'; + $rss .= ''.date("r").''; + + // build entries + foreach ( $entries as $entry ) { + //print_r($entry); + $rss .= ''.mb_convert_encoding($entry->post_title, "ISO-8859-1", "UTF-8") .''; + $rss .= 'http://www.dpsg-hardenberg.org/lagerticker'; + $rss .= ''.$entry->post_date_rfc.' '.date('O').''; + $rss .= 'post_content, "ISO-8859-1", "UTF-8")).']]>'; + } + + // generate document foot + $rss .= ''; + + print $rss; +} \ No newline at end of file diff --git a/includes/scripts.php b/includes/scripts.php new file mode 100644 index 0000000..95575f1 --- /dev/null +++ b/includes/scripts.php @@ -0,0 +1,55 @@ + $wplt_ticker_options['id'], + 'count' => $wplt_ticker_options['count'], + 'order' => $wplt_ticker_options['order'] + ), $atts ) + );*/ + + if($atts[0]) + { + if(!$atts[1]) $atts[1] = -1; + + $output .= ''; + $output .= 'RSS'; + } + + return $output; +} + +add_shortcode( 'liveticker', 'wplt_shortcode_ticker_show' ); \ No newline at end of file diff --git a/includes/widget.php b/includes/widget.php new file mode 100644 index 0000000..eeb17ff --- /dev/null +++ b/includes/widget.php @@ -0,0 +1,128 @@ + + + + + + + + '.__( 'show all', 'wplt2' ).'...

    '; + + echo $after_widget; + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    />
    disabled="disabled" />
    + + + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..8a73ec1 --- /dev/null +++ b/readme.txt @@ -0,0 +1,48 @@ +=== WP-Liveticker 2 === +Contributors: stkl +Tags: liveticker, feed, rss +Requires at least: 3.8 +Tested up to: 3.9.2 +Stable tag: beta +License: GPLv2 or later +License URI: http://www.gnu.org/licenses/gpl-2.0.html + +A simple liveticker plugin for WordPress. + +== Description == + +WP-Liveticker 2 is a simple liveticker plugin for WordPress. Easily add multiple livetickers, add them to posts with shortcode or use them as Widget. + += Features = ++ Handle multiple Tickers. ++ RSS feed capability. ++ Shortcode to display liveticker. ++ Ability to customise through CSS. ++ Add ticker to sidebar widgets. ++ Localization support. + +== Installation == + +1. Upload `wp-liveticker2` to the `/wp-content/plugins/` directory. +2. Activate the plugin through the 'Plugins' menu in WordPress. +3. Go to Liveticker menu to start. + +== Frequently asked questions == + += How do I display a liveticker on my post/page? = + +Use the shortcode [liveticker2 id="slug"]. + +== Screenshots == + +1. Downloads overview screen. +2. Add new download screen. +3. Logs overview screen. +4. Shortcode generator. +5. Example shortcodes. +6. Settings screen. + +== Changelog == + += 1.0 = ++ Initial stable plugin release. \ No newline at end of file diff --git a/wp-liveticker2.php b/wp-liveticker2.php new file mode 100644 index 0000000..b7edf28 --- /dev/null +++ b/wp-liveticker2.php @@ -0,0 +1,94 @@ +