Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
a90ff68
bump version to '1.4.0-beta'
cfoellmann Sep 2, 2018
afd9ab0
move all functions into main class to hook into WP
cfoellmann Sep 2, 2018
8bc8411
Merge pull request #27 from cfoellmann/no-anonymous
cfoellmann Sep 2, 2018
5263e8c
Scrutinizer Auto-Fixes
scrutinizer-auto-fixer Sep 2, 2018
6dee4e3
Merge pull request #38 from podlove/scrutinizer-patch-2
cfoellmann Sep 2, 2018
11dd5e1
fix assets loading
cfoellmann Sep 2, 2018
fec2db3
move widget registration to main class
cfoellmann Sep 2, 2018
0392a48
rename widget class - we have namespaces so use it
cfoellmann Sep 2, 2018
99c1665
fix menu item strings for translations
cfoellmann Sep 2, 2018
4f75187
code style fixes
cfoellmann Sep 2, 2018
d005f40
add comma to last array items
cfoellmann Sep 2, 2018
ff4be00
debug settings page preview
cfoellmann Sep 2, 2018
814cb17
replace spectrum with wpcolorpicker
cfoellmann Sep 4, 2018
d13c89f
fix widget options saving
cfoellmann Sep 4, 2018
20f7413
Merge branch 'remove-spectrum'
cfoellmann Sep 4, 2018
fde4346
move publisher detect function to helpers
cfoellmann Sep 4, 2018
122957a
limit translations to language packs
cfoellmann Sep 4, 2018
131d469
add docblock headers
cfoellmann Sep 4, 2018
bc457c5
improve docblocks
cfoellmann Sep 4, 2018
bdfbd13
use core styles for settings display
cfoellmann Sep 4, 2018
fc808ec
merge changelog 1.3.x branch
cfoellmann Sep 9, 2018
cdb0959
check php version without breaking WP
cfoellmann Sep 12, 2018
eee1236
Merge pull request #41 from podlove/php-check
cfoellmann Sep 12, 2018
5ac5f32
remove exclude for spectrum from scrutinizer config
cfoellmann Sep 12, 2018
4015791
add composer.json
cfoellmann Sep 12, 2018
5c586dc
restructuring for psr-4 autoloading
cfoellmann Sep 12, 2018
53daca9
commit the autoloader dump for now
cfoellmann Sep 12, 2018
78b81a4
Merge pull request #42 from podlove/autoload
cfoellmann Sep 12, 2018
adda74c
move css file to css folder + use core styling for feed table
cfoellmann Sep 12, 2018
f6f7577
move helpers to class
cfoellmann Sep 12, 2018
f7bf9bb
add Defaults class
cfoellmann Sep 12, 2018
c96a57c
bump required php version to 5.4
cfoellmann Sep 12, 2018
f925598
remove require missing file
cfoellmann Sep 12, 2018
61ef0bb
add language function and default language
cfoellmann Sep 12, 2018
7e9f3b5
use new defaults function to init options
cfoellmann Sep 12, 2018
3edf5b6
use custom get_option function
cfoellmann Sep 12, 2018
1ca10e8
use default parameters for previews
cfoellmann Sep 12, 2018
d0a9744
refine syntax
cfoellmann Sep 12, 2018
9283c5f
start adding language defaults option
cfoellmann Sep 12, 2018
b1fd0ab
add `language` to db model
cfoellmann Sep 13, 2018
d7351af
use a sidebar on admin screens
cfoellmann Sep 13, 2018
840ca02
use dashicon instead of custom icons
cfoellmann Sep 13, 2018
70bbd7f
remove font and its usage
cfoellmann Sep 13, 2018
1cb27e9
add sidebar links
cfoellmann Sep 14, 2018
b406292
corrections and additions to readme.txt
cfoellmann Sep 14, 2018
3e1ee40
fix namespace issues
cfoellmann Sep 14, 2018
834a931
fix language parameter issue
cfoellmann Sep 14, 2018
41de00c
add first iteration of setup activate|deactivate|uninstall
cfoellmann Sep 14, 2018
222fdb5
rename filters/actions to prevent clashes with publisher
cfoellmann Sep 14, 2018
33ed65c
make php detection dependent on PHP 5.2 itself
cfoellmann Sep 14, 2018
b2c38ce
fix typo in php version requirement
cfoellmann Sep 15, 2018
b436f6a
remove constants
cfoellmann Sep 15, 2018
692b0e9
run migrations from `Migration` class
cfoellmann Sep 15, 2018
ffadbba
fix class declaration
cfoellmann Sep 15, 2018
a1c4534
change defaults option to 1 array
cfoellmann Sep 15, 2018
dc0f352
fix activation in network scenario
cfoellmann Sep 15, 2018
d1ed183
Merge branch 'master' into options/array
cfoellmann Sep 15, 2018
06c863a
migrate multiple options into one array
cfoellmann Sep 15, 2018
b33c285
fix php notice - split functions up
cfoellmann Oct 2, 2018
707b95f
add sitemeta on multisite activation
cfoellmann Oct 2, 2018
301a722
register_setting via dedicated class
cfoellmann Oct 2, 2018
7000abd
use settings API to display options fields + fix for network w/o sett…
cfoellmann Oct 2, 2018
5c44666
open project links on new tab/window + comment
cfoellmann Oct 2, 2018
d19ecf4
rename variable to align with options array key
cfoellmann Oct 2, 2018
cdf72d1
code style fixes and comments
cfoellmann Oct 2, 2018
7409acd
allow default return value for custom get_option function
cfoellmann Oct 2, 2018
523bb07
get_option cleanup and comments
cfoellmann Oct 2, 2018
3d32c22
render network preview with site_option config
cfoellmann Oct 5, 2018
efd7042
Merge pull request #55 from podlove/options/array
cfoellmann Oct 5, 2018
9084d4c
use network defaults when activating on a subsite
cfoellmann Oct 5, 2018
261fa32
remove deactivation hook, add changelog items
cfoellmann Oct 5, 2018
bc757f6
add option to copy shortcode to clipboard - using clipboard.js
cfoellmann Oct 10, 2018
ae9799c
code styling update
cfoellmann Oct 10, 2018
d5dc422
Merge pull request #57 from podlove/feature/clipboard-js
cfoellmann Oct 10, 2018
c841144
fix issue with copy to clipboard for button names containing spaces
cfoellmann Oct 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store

# /vendor/
3 changes: 1 addition & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ filter:
excluded_paths:
- fonts/
- languages/
- js/spectrum/
- tests/
- vendor/
dependency_paths:
- wordpress/
- wordpress/
25 changes: 25 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "podlove/podlove-subscribe-button",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Podlove",
"homepage": "https://www.podlove.org",
"role": "Team"
},
{
"name": "Christian Foellmann",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": ">=5.4.0"
},
"autoload": {
"psr-4": {
"PodloveSubscribeButton\\": "inc/"
}
}
}
8 changes: 0 additions & 8 deletions constants.php

This file was deleted.

11 changes: 11 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
table.podlove_alternating th {
padding: 8px 10px !important;
}

.podlove-icon-remove {
color: red;
cursor: pointer;
}
.copy-btn {
cursor: pointer;
}
82 changes: 0 additions & 82 deletions fonts/Podlove.dev.svg

This file was deleted.

Binary file removed fonts/Podlove.eot
Binary file not shown.
67 changes: 0 additions & 67 deletions fonts/Podlove.svg

This file was deleted.

Binary file removed fonts/Podlove.ttf
Binary file not shown.
Binary file removed fonts/Podlove.woff
Binary file not shown.
21 changes: 0 additions & 21 deletions helper.php

This file was deleted.

121 changes: 121 additions & 0 deletions inc/Button_List_Table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php
/**
* @author Podlove <[email protected]>
* @copyright Copyright (c) 2014-2018, Podlove
* @license https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT
* @package Podlove\PodloveSubscribeButton
*/

namespace PodloveSubscribeButton;

if ( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}

class Button_List_Table extends \WP_List_Table {

public function __construct() {

global $status, $page;

// Set parent defaults
parent::__construct( array(
'singular' => 'feed', // singular name of the listed records
'plural' => 'feeds', // plural name of the listed records
'ajax' => false, // does this table support ajax?
) );

}

public function column_name( $button ) {

$target = 'shortcode-' . str_replace(" ","-", $button->name );
$copy_button = '<a class="copy-btn" data-clipboard-action="copy" data-clipboard-target=".' . $target . '">Copy Shortcode</a>';

$actions = array(
'edit' => Settings\Buttons::get_action_link( $button, __( 'Edit', 'podlove-subscribe-button' ), 'edit' ),
'delete' => Settings\Buttons::get_action_link( $button, __( 'Delete', 'podlove-subscribe-button' ), 'confirm_delete' ),
'copy' => $copy_button,
);

return sprintf( '%1$s %2$s',
/*$1%s*/
'<p><b>'.$button->title . '</b></p><code class="' . $target . '">[podlove-subscribe-button button="' . $button->name . '"]</code>',
/*$3%s*/
$this->row_actions( $actions )
);

}

public function column_button_preview( $button ) {
if ( ! $button->feeds ) {
return '<code>' . __( 'No preview. Please set a feed.', 'podlove-subscribe-button' ) . '</code>';
} else {
if ( is_network_admin() ) {
$options = get_site_option( 'podlove_psb_defaults' );
} else {
$options = get_option( 'podlove_psb_defaults' );
}

$preview = "<div class='podlove-button-preview-container'>";
$preview .= $button->render(
$options['size'],
$options['autowidth'],
$options['style'],
$options['format'],
$options['color'],
false,
false,
$options['language']
);
$preview .= "</div>";

return $preview;
}
}

public function column_id( $button ) {
return $button->id;
}

public function get_columns() {
return array(
'name' => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
'button_preview' => __( 'Preview', 'podlove-subscribe-button' ),
);
}

public function prepare_items() {

// number of items per page
$per_page = 1000;

// define column headers
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array( $columns, $hidden, $sortable );

// retrieve data
// TODO select data for current page only
$data = ( is_network_admin() ? Model\NetworkButton::all() : Model\Button::all() );

// get current page
$current_page = $this->get_pagenum();
// get total items
$total_items = count( $data );
// extrage page for current page only
$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
// add items to table
$this->items = $data;

// register pagination options & calculations
$this->set_pagination_args( array(
'total_items' => $total_items,
'per_page' => $per_page,
'total_pages' => ceil( $total_items / $per_page ),
) );

}

} // END class
126 changes: 126 additions & 0 deletions inc/Defaults.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?php
/**
* @author Podlove <[email protected]>
* @copyright Copyright (c) 2014-2018, Podlove
* @license https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT
* @package Podlove\PodloveSubscribeButton
*/

namespace PodloveSubscribeButton;

class Defaults {

static function button( $property ) {

$style = array(
'filled' => __( 'Filled', 'podlove-subscribe-button' ),
'outline' => __( 'Outline', 'podlove-subscribe-button' ),
'frameless' => __( 'Frameless', 'podlove-subscribe-button' ),
);

$format = array(
'rectangle' => __( 'Rectangle', 'podlove-subscribe-button' ),
'square' => __( 'Square', 'podlove-subscribe-button' ),
'cover' => __( 'Cover', 'podlove-subscribe-button' ),
);

$autowidth = array(
'on' => __( 'Yes', 'podlove-subscribe-button' ),
'off' => __( 'No', 'podlove-subscribe-button' ),
);

$size = array(
'small' => __( 'Small', 'podlove-subscribe-button' ),
'medium' => __( 'Medium', 'podlove-subscribe-button' ),
'big' => __( 'Big', 'podlove-subscribe-button' ),
);

$language = array( 'de', 'en', 'eo', 'fi', 'fr', 'nl', 'zh', 'ja', );

return $$property;

}

/**
* @return array
*/
public static function media_types() {

$media_types = array(
0 => array(
'title' => 'MP3 audio',
'mime_type' => 'audio/mpeg',
'extension' => 'mp3',
),
1 => array(
'title' => 'MPEG-4 AAC Audio',
'mime_type' => 'audio/mp4',
'extension' => 'aac',
),
2 => array(
'title' => 'MPEG-4 ALAC Audio',
'mime_type' => 'audio/mp4',
'extension' => 'aac',
),
3 => array(
'title' => 'Ogg Vorbis Audio',
'mime_type' => 'audio/ogg',
'extension' => 'ogg',
),
4 => array(
'title' => 'WebM Audio',
'mime_type' => 'audio/webm',
'extension' => 'webm',
),
5 => array(
'title' => 'FLAC Audio',
'mime_type' => 'audio/flac',
'extension' => 'flac',
),
6 => array(
'title' => 'Matroska Audio',
'mime_type' => 'audio/x-matroska',
'extension' => 'mka',
),
7 => array(
'title' => 'Opus Audio',
'mime_type' => 'audio/opus',
'extension' => 'opus',
)
);

return apply_filters( 'podlove_psb_defaults_media_types', $media_types );

}

static function options_install() {

$options = array(
'size' => 'big',
'autowidth' => 'on',
'color' => '#599677',
'style' => 'filled',
'format' => 'rectangle',
'language' => \PodloveSubscribeButton\Helpers::language( get_site_option( 'WPLANG' ) ),
);

return $options;

}

static function options() {

$options = array(
'size' => 'big',
'autowidth' => 'on',
'color' => '#599677',
'style' => 'filled',
'format' => 'rectangle',
'language' => \PodloveSubscribeButton\Helpers::language( '' ),
);

return apply_filters( 'podlove_psb_defaults_options', $options );

}

} // END class
Loading