From c1d825cbbb0a23d9b0b5a380261522dad57a0e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 14:12:19 +0200 Subject: [PATCH 001/119] Fix notice when running PHPUnit tests --- sermons.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sermons.php b/sermons.php index b5f6972..083eb49 100755 --- a/sermons.php +++ b/sermons.php @@ -109,7 +109,9 @@ public function __construct() { }, 10, 2 ); // Allows reimport after sermon deletion add_action( 'before_delete_post', function ( $id ) { - if ( $GLOBALS['post_type'] !== 'wpfc_sermon' ) { + global $post_type; + + if ( $post_type !== 'wpfc_sermon' ) { return; } @@ -228,7 +230,7 @@ public function __construct() { return 'no'; } ); - do_action('sm_after_plugin_load'); + do_action( 'sm_after_plugin_load' ); add_action( 'sm_admin_settings_sanitize_option_post_content_enabled', function ( $value ) { $value = intval( $value ); From 8a8d16162ecc53983ef869c97f52d05828cc647d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 14:12:53 +0200 Subject: [PATCH 002/119] Add PHPUnit configuration files --- bin/install-wp-tests.sh | 152 ++++++++++++++++++++++++++++++++++++++++ phpunit.xml.dist | 15 ++++ tests/bootstrap.php | 31 ++++++++ tests/test-sample.php | 20 ++++++ 4 files changed, 218 insertions(+) create mode 100755 bin/install-wp-tests.sh create mode 100644 phpunit.xml.dist create mode 100644 tests/bootstrap.php create mode 100644 tests/test-sample.php diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh new file mode 100755 index 0000000..878881f --- /dev/null +++ b/bin/install-wp-tests.sh @@ -0,0 +1,152 @@ +#!/usr/bin/env bash + +if [ $# -lt 3 ]; then + echo "usage: $0 [db-host] [wp-version] [skip-database-creation]" + exit 1 +fi + +DB_NAME=$1 +DB_USER=$2 +DB_PASS=$3 +DB_HOST=${4-localhost} +WP_VERSION=${5-latest} +SKIP_DB_CREATE=${6-false} + +TMPDIR=${TMPDIR-/tmp} +TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} +WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+$ ]]; then + WP_TESTS_TAG="branches/$WP_VERSION" +elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + WP_TESTS_TAG="tags/${WP_VERSION%??}" + else + WP_TESTS_TAG="tags/$WP_VERSION" + fi +elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + WP_TESTS_TAG="trunk" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi + +set -ex + +install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + + mkdir -p $WP_CORE_DIR + + if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then + mkdir -p $TMPDIR/wordpress-nightly + download https://wordpress.org/nightly-builds/wordpress-latest.zip $TMPDIR/wordpress-nightly/wordpress-nightly.zip + unzip -q $TMPDIR/wordpress-nightly/wordpress-nightly.zip -d $TMPDIR/wordpress-nightly/ + mv $TMPDIR/wordpress-nightly/wordpress/* $WP_CORE_DIR + else + if [ $WP_VERSION == 'latest' ]; then + local ARCHIVE_NAME='latest' + elif [[ $WP_VERSION =~ [0-9]+\.[0-9]+ ]]; then + # https serves multiple offers, whereas http serves single. + download https://api.wordpress.org/core/version-check/1.7/ $TMPDIR/wp-latest.json + if [[ $WP_VERSION =~ [0-9]+\.[0-9]+\.[0] ]]; then + # version x.x.0 means the first release of the major version, so strip off the .0 and download version x.x + LATEST_VERSION=${WP_VERSION%??} + else + # otherwise, scan the releases and get the most up to date minor version of the major release + local VERSION_ESCAPED=`echo $WP_VERSION | sed 's/\./\\\\./g'` + LATEST_VERSION=$(grep -o '"version":"'$VERSION_ESCAPED'[^"]*' $TMPDIR/wp-latest.json | sed 's/"version":"//' | head -1) + fi + if [[ -z "$LATEST_VERSION" ]]; then + local ARCHIVE_NAME="wordpress-$WP_VERSION" + else + local ARCHIVE_NAME="wordpress-$LATEST_VERSION" + fi + else + local ARCHIVE_NAME="wordpress-$WP_VERSION" + fi + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz $TMPDIR/wordpress.tar.gz + tar --strip-components=1 -zxmf $TMPDIR/wordpress.tar.gz -C $WP_CORE_DIR + fi + + download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php +} + +install_test_suite() { + # portable in-place argument for both GNU sed and Mac OSX sed + if [[ $(uname -s) == 'Darwin' ]]; then + local ioption='-i .bak' + else + local ioption='-i' + fi + + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data + fi + + if [ ! -f wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + # remove all forward slashes in the end + WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") + sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi + +} + +install_db() { + + if [ ${SKIP_DB_CREATE} = "true" ]; then + return 0 + fi + + # parse DB_HOST for port or socket references + local PARTS=(${DB_HOST//\:/ }) + local DB_HOSTNAME=${PARTS[0]}; + local DB_SOCK_OR_PORT=${PARTS[1]}; + local EXTRA="" + + if ! [ -z $DB_HOSTNAME ] ; then + if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then + EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" + elif ! [ -z $DB_SOCK_OR_PORT ] ; then + EXTRA=" --socket=$DB_SOCK_OR_PORT" + elif ! [ -z $DB_HOSTNAME ] ; then + EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" + fi + fi + + # create database + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA +} + +install_wp +install_test_suite +install_db diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..d9af975 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,15 @@ + + + + + ./tests/ + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..1333835 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,31 @@ +assertTrue( true ); + } +} From 169881301634710a3c93a323fcf48e42ab65f063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 14:24:44 +0200 Subject: [PATCH 003/119] Add PHPCS configuration --- phpcs.xml.dist | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 phpcs.xml.dist diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..4f1d0e5 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,17 @@ + + + Generally-applicable sniffs for WordPress plugins + + + + + + + . + + + + + */node_modules/* + */vendor/* + From 81dfc2cb81c9adde3b13aa725517cef3f28a4641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 14:38:42 +0200 Subject: [PATCH 004/119] Reorganize the repo a bit, for PHPUnit tests --- assets/js/additional_classes.js | 9 - assets/{ => vendor}/css/plyr.min.css | 0 assets/{ => vendor}/js/facebook-video.js | 0 assets/{ => vendor}/js/plyr.js | 0 assets/{ => vendor}/js/plyr.min.js | 0 assets/{ => vendor}/js/verse.js | 0 includes/class-sm-background-updater.php | 8 +- includes/{ => vendor}/CMB2/bootstrap.php | 0 .../CMB2/css/cmb2-display-rtl.css | 0 .../CMB2/css/cmb2-display-rtl.min.css | 0 .../{ => vendor}/CMB2/css/cmb2-display.css | 0 .../CMB2/css/cmb2-display.css.map | 0 .../CMB2/css/cmb2-display.min.css | 0 .../{ => vendor}/CMB2/css/cmb2-front-rtl.css | 0 .../CMB2/css/cmb2-front-rtl.min.css | 0 includes/{ => vendor}/CMB2/css/cmb2-front.css | 0 .../{ => vendor}/CMB2/css/cmb2-front.css.map | 0 .../{ => vendor}/CMB2/css/cmb2-front.min.css | 0 includes/{ => vendor}/CMB2/css/cmb2-rtl.css | 0 .../{ => vendor}/CMB2/css/cmb2-rtl.min.css | 0 includes/{ => vendor}/CMB2/css/cmb2.css | 0 includes/{ => vendor}/CMB2/css/cmb2.css.map | 0 includes/{ => vendor}/CMB2/css/cmb2.min.css | 0 includes/{ => vendor}/CMB2/css/index.php | 0 .../CMB2/css/sass/cmb2-display.scss | 0 .../CMB2/css/sass/cmb2-front.scss | 0 includes/{ => vendor}/CMB2/css/sass/cmb2.scss | 0 includes/{ => vendor}/CMB2/css/sass/index.php | 0 .../css/sass/partials/_collapsible_ui.scss | 0 .../CMB2/css/sass/partials/_display.scss | 0 .../CMB2/css/sass/partials/_front.scss | 0 .../CMB2/css/sass/partials/_jquery_ui.scss | 0 .../CMB2/css/sass/partials/_main_wrap.scss | 0 .../CMB2/css/sass/partials/_misc.scss | 0 .../CMB2/css/sass/partials/_mixins.scss | 0 .../css/sass/partials/_post_metaboxes.scss | 0 .../sass/partials/_sidebar_placements.scss | 0 .../CMB2/css/sass/partials/_variables.scss | 0 .../CMB2/css/sass/partials/index.php | 0 .../{ => vendor}/CMB2/images/ico-delete.png | Bin includes/{ => vendor}/CMB2/images/index.php | 0 .../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin .../images/ui-bg_flat_75_ffffff_40x100.png | Bin .../images/ui-bg_glass_55_fbf9ee_1x400.png | Bin .../images/ui-bg_glass_65_ffffff_1x400.png | Bin .../images/ui-bg_glass_75_dadada_1x400.png | Bin .../images/ui-bg_glass_75_e6e6e6_1x400.png | Bin .../images/ui-bg_glass_95_fef1ec_1x400.png | Bin .../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin .../CMB2/images/ui-icons_222222_256x240.png | Bin .../CMB2/images/ui-icons_2e83ff_256x240.png | Bin .../CMB2/images/ui-icons_454545_256x240.png | Bin .../CMB2/images/ui-icons_888888_256x240.png | Bin .../CMB2/images/ui-icons_cd0a0a_256x240.png | Bin includes/{ => vendor}/CMB2/includes/CMB2.php | 0 .../{ => vendor}/CMB2/includes/CMB2_Ajax.php | 0 .../{ => vendor}/CMB2/includes/CMB2_Base.php | 0 .../{ => vendor}/CMB2/includes/CMB2_Boxes.php | 0 .../{ => vendor}/CMB2/includes/CMB2_Field.php | 0 .../CMB2/includes/CMB2_Field_Display.php | 0 .../CMB2/includes/CMB2_Hookup_Base.php | 0 .../{ => vendor}/CMB2/includes/CMB2_JS.php | 0 .../CMB2/includes/CMB2_Options.php | 0 .../CMB2/includes/CMB2_Sanitize.php | 0 .../CMB2/includes/CMB2_Show_Filters.php | 0 .../{ => vendor}/CMB2/includes/CMB2_Types.php | 0 .../{ => vendor}/CMB2/includes/CMB2_Utils.php | 0 .../CMB2/includes/CMB2_hookup.php | 0 .../CMB2/includes/helper-functions.php | 0 includes/{ => vendor}/CMB2/includes/index.php | 0 .../CMB2/includes/rest-api/CMB2_REST.php | 0 .../rest-api/CMB2_REST_Controller.php | 0 .../rest-api/CMB2_REST_Controller_Boxes.php | 0 .../rest-api/CMB2_REST_Controller_Fields.php | 0 .../CMB2/includes/shim/WP_REST_Controller.php | 0 .../CMB2/includes/types/CMB2_Type_Base.php | 0 .../includes/types/CMB2_Type_Checkbox.php | 0 .../includes/types/CMB2_Type_Colorpicker.php | 0 .../CMB2/includes/types/CMB2_Type_File.php | 0 .../includes/types/CMB2_Type_File_Base.php | 0 .../includes/types/CMB2_Type_File_List.php | 0 .../includes/types/CMB2_Type_Multi_Base.php | 0 .../includes/types/CMB2_Type_Multicheck.php | 0 .../CMB2/includes/types/CMB2_Type_Oembed.php | 0 .../includes/types/CMB2_Type_Picker_Base.php | 0 .../CMB2/includes/types/CMB2_Type_Radio.php | 0 .../CMB2/includes/types/CMB2_Type_Select.php | 0 .../types/CMB2_Type_Select_Timezone.php | 0 .../types/CMB2_Type_Taxonomy_Base.php | 0 .../types/CMB2_Type_Taxonomy_Multicheck.php | 0 .../types/CMB2_Type_Taxonomy_Radio.php | 0 .../types/CMB2_Type_Taxonomy_Select.php | 0 .../CMB2/includes/types/CMB2_Type_Text.php | 0 .../includes/types/CMB2_Type_Text_Date.php | 0 .../CMB2_Type_Text_Datetime_Timestamp.php | 0 ..._Type_Text_Datetime_Timestamp_Timezone.php | 0 .../includes/types/CMB2_Type_Text_Time.php | 0 .../includes/types/CMB2_Type_Textarea.php | 0 .../types/CMB2_Type_Textarea_Code.php | 0 .../CMB2/includes/types/CMB2_Type_Title.php | 0 .../CMB2/includes/types/CMB2_Type_Wysiwyg.php | 0 includes/{ => vendor}/CMB2/index.php | 0 includes/{ => vendor}/CMB2/init.php | 0 includes/{ => vendor}/CMB2/js/cmb2-wysiwyg.js | 0 includes/{ => vendor}/CMB2/js/cmb2.js | 0 includes/{ => vendor}/CMB2/js/cmb2.min.js | 0 includes/{ => vendor}/CMB2/js/index.php | 0 .../CMB2/js/jquery-ui-timepicker-addon.min.js | 0 includes/{ => vendor}/CMB2/readme.txt | 0 .../{ => vendor}/taxonomy-images/blank.png | Bin .../{ => vendor}/taxonomy-images/controls.png | Bin .../taxonomy-images/css/admin.css | 156 +-- .../taxonomy-images/css/controls.png | Bin .../{ => vendor}/taxonomy-images/default.png | Bin .../taxonomy-images/js/edit-tags.js | 0 .../taxonomy-images/js/media-modal.js | 0 .../taxonomy-images/js/media-upload-popup.js | 0 .../languages/taxonomy-images.pot | 442 +++---- .../taxonomy-images/public-filters.php | 1140 ++++++++--------- .../taxonomy-images/taxonomy-images.php | 0 .../wp-async-request.php | 0 .../wp-background-process.php | 0 sermons.php | 70 +- 123 files changed, 898 insertions(+), 927 deletions(-) delete mode 100644 assets/js/additional_classes.js rename assets/{ => vendor}/css/plyr.min.css (100%) rename assets/{ => vendor}/js/facebook-video.js (100%) rename assets/{ => vendor}/js/plyr.js (100%) rename assets/{ => vendor}/js/plyr.min.js (100%) rename assets/{ => vendor}/js/verse.js (100%) rename includes/{ => vendor}/CMB2/bootstrap.php (100%) rename includes/{ => vendor}/CMB2/css/cmb2-display-rtl.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-display-rtl.min.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-display.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-display.css.map (100%) rename includes/{ => vendor}/CMB2/css/cmb2-display.min.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-front-rtl.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-front-rtl.min.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-front.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-front.css.map (100%) rename includes/{ => vendor}/CMB2/css/cmb2-front.min.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-rtl.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2-rtl.min.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2.css (100%) rename includes/{ => vendor}/CMB2/css/cmb2.css.map (100%) rename includes/{ => vendor}/CMB2/css/cmb2.min.css (100%) rename includes/{ => vendor}/CMB2/css/index.php (100%) rename includes/{ => vendor}/CMB2/css/sass/cmb2-display.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/cmb2-front.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/cmb2.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/index.php (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_collapsible_ui.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_display.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_front.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_jquery_ui.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_main_wrap.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_misc.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_mixins.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_post_metaboxes.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_sidebar_placements.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/_variables.scss (100%) rename includes/{ => vendor}/CMB2/css/sass/partials/index.php (100%) rename includes/{ => vendor}/CMB2/images/ico-delete.png (100%) rename includes/{ => vendor}/CMB2/images/index.php (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_flat_0_aaaaaa_40x100.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_flat_75_ffffff_40x100.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_glass_55_fbf9ee_1x400.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_glass_65_ffffff_1x400.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_glass_75_dadada_1x400.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_glass_75_e6e6e6_1x400.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_glass_95_fef1ec_1x400.png (100%) rename includes/{ => vendor}/CMB2/images/ui-bg_highlight-soft_75_cccccc_1x100.png (100%) rename includes/{ => vendor}/CMB2/images/ui-icons_222222_256x240.png (100%) rename includes/{ => vendor}/CMB2/images/ui-icons_2e83ff_256x240.png (100%) rename includes/{ => vendor}/CMB2/images/ui-icons_454545_256x240.png (100%) rename includes/{ => vendor}/CMB2/images/ui-icons_888888_256x240.png (100%) rename includes/{ => vendor}/CMB2/images/ui-icons_cd0a0a_256x240.png (100%) rename includes/{ => vendor}/CMB2/includes/CMB2.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Ajax.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Boxes.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Field.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Field_Display.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Hookup_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_JS.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Options.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Sanitize.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Show_Filters.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Types.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_Utils.php (100%) rename includes/{ => vendor}/CMB2/includes/CMB2_hookup.php (100%) rename includes/{ => vendor}/CMB2/includes/helper-functions.php (100%) rename includes/{ => vendor}/CMB2/includes/index.php (100%) rename includes/{ => vendor}/CMB2/includes/rest-api/CMB2_REST.php (100%) rename includes/{ => vendor}/CMB2/includes/rest-api/CMB2_REST_Controller.php (100%) rename includes/{ => vendor}/CMB2/includes/rest-api/CMB2_REST_Controller_Boxes.php (100%) rename includes/{ => vendor}/CMB2/includes/rest-api/CMB2_REST_Controller_Fields.php (100%) rename includes/{ => vendor}/CMB2/includes/shim/WP_REST_Controller.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Checkbox.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Colorpicker.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_File.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_File_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_File_List.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Multi_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Multicheck.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Oembed.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Picker_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Radio.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Select.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Select_Timezone.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Taxonomy_Base.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Taxonomy_Multicheck.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Taxonomy_Radio.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Taxonomy_Select.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Text.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Text_Date.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Text_Time.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Textarea.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Textarea_Code.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Title.php (100%) rename includes/{ => vendor}/CMB2/includes/types/CMB2_Type_Wysiwyg.php (100%) rename includes/{ => vendor}/CMB2/index.php (100%) rename includes/{ => vendor}/CMB2/init.php (100%) rename includes/{ => vendor}/CMB2/js/cmb2-wysiwyg.js (100%) rename includes/{ => vendor}/CMB2/js/cmb2.js (100%) rename includes/{ => vendor}/CMB2/js/cmb2.min.js (100%) rename includes/{ => vendor}/CMB2/js/index.php (100%) rename includes/{ => vendor}/CMB2/js/jquery-ui-timepicker-addon.min.js (100%) rename includes/{ => vendor}/CMB2/readme.txt (100%) rename includes/{ => vendor}/taxonomy-images/blank.png (100%) rename includes/{ => vendor}/taxonomy-images/controls.png (100%) rename includes/{ => vendor}/taxonomy-images/css/admin.css (94%) rename includes/{ => vendor}/taxonomy-images/css/controls.png (100%) rename includes/{ => vendor}/taxonomy-images/default.png (100%) rename includes/{ => vendor}/taxonomy-images/js/edit-tags.js (100%) rename includes/{ => vendor}/taxonomy-images/js/media-modal.js (100%) rename includes/{ => vendor}/taxonomy-images/js/media-upload-popup.js (100%) rename includes/{ => vendor}/taxonomy-images/languages/taxonomy-images.pot (95%) rename includes/{ => vendor}/taxonomy-images/public-filters.php (96%) rename includes/{ => vendor}/taxonomy-images/taxonomy-images.php (100%) rename includes/{libraries => vendor}/wp-async-request.php (100%) rename includes/{libraries => vendor}/wp-background-process.php (100%) diff --git a/assets/js/additional_classes.js b/assets/js/additional_classes.js deleted file mode 100644 index d13843b..0000000 --- a/assets/js/additional_classes.js +++ /dev/null @@ -1,9 +0,0 @@ -(function () { - var element = document.getElementsByClassName('wpfc-sermon'); - - for (var i = 0; i < element.length; i++) { - if (element[i].offsetWidth > 600) { - element[i].className += " wpfc-sermon-horizontal"; - } - } -})(); diff --git a/assets/css/plyr.min.css b/assets/vendor/css/plyr.min.css similarity index 100% rename from assets/css/plyr.min.css rename to assets/vendor/css/plyr.min.css diff --git a/assets/js/facebook-video.js b/assets/vendor/js/facebook-video.js similarity index 100% rename from assets/js/facebook-video.js rename to assets/vendor/js/facebook-video.js diff --git a/assets/js/plyr.js b/assets/vendor/js/plyr.js similarity index 100% rename from assets/js/plyr.js rename to assets/vendor/js/plyr.js diff --git a/assets/js/plyr.min.js b/assets/vendor/js/plyr.min.js similarity index 100% rename from assets/js/plyr.min.js rename to assets/vendor/js/plyr.min.js diff --git a/assets/js/verse.js b/assets/vendor/js/verse.js similarity index 100% rename from assets/js/verse.js rename to assets/vendor/js/verse.js diff --git a/includes/class-sm-background-updater.php b/includes/class-sm-background-updater.php index 4c5108b..f5500c7 100644 --- a/includes/class-sm-background-updater.php +++ b/includes/class-sm-background-updater.php @@ -3,22 +3,22 @@ if ( \SermonManager::getOption( 'in_house_background_update' ) ) { if ( ! class_exists( 'SM_WP_Async_Request', false ) ) { - include_once 'libraries/wp-async-request.php'; + include_once 'vendor/wp-async-request.php'; } if ( ! class_exists( 'SM_WP_Background_Process', false ) ) { - include_once 'libraries/wp-background-process.php'; + include_once 'vendor/wp-background-process.php'; } } else { if ( ! class_exists( 'WP_Async_Request', false ) ) { - include_once 'libraries/wp-async-request.php'; + include_once 'vendor/wp-async-request.php'; class_alias( 'SM_WP_Async_Request', 'WP_Async_Request' ); } else { class_alias( 'WP_Async_Request', 'SM_WP_Async_Request' ); } if ( ! class_exists( 'WP_Background_Process', false ) ) { - include_once 'libraries/wp-background-process.php'; + include_once 'vendor/wp-background-process.php'; class_alias( 'SM_WP_Background_Process', 'WP_Background_Process' ); } else { class_alias( 'WP_Background_Process', 'SM_WP_Background_Process' ); diff --git a/includes/CMB2/bootstrap.php b/includes/vendor/CMB2/bootstrap.php similarity index 100% rename from includes/CMB2/bootstrap.php rename to includes/vendor/CMB2/bootstrap.php diff --git a/includes/CMB2/css/cmb2-display-rtl.css b/includes/vendor/CMB2/css/cmb2-display-rtl.css similarity index 100% rename from includes/CMB2/css/cmb2-display-rtl.css rename to includes/vendor/CMB2/css/cmb2-display-rtl.css diff --git a/includes/CMB2/css/cmb2-display-rtl.min.css b/includes/vendor/CMB2/css/cmb2-display-rtl.min.css similarity index 100% rename from includes/CMB2/css/cmb2-display-rtl.min.css rename to includes/vendor/CMB2/css/cmb2-display-rtl.min.css diff --git a/includes/CMB2/css/cmb2-display.css b/includes/vendor/CMB2/css/cmb2-display.css similarity index 100% rename from includes/CMB2/css/cmb2-display.css rename to includes/vendor/CMB2/css/cmb2-display.css diff --git a/includes/CMB2/css/cmb2-display.css.map b/includes/vendor/CMB2/css/cmb2-display.css.map similarity index 100% rename from includes/CMB2/css/cmb2-display.css.map rename to includes/vendor/CMB2/css/cmb2-display.css.map diff --git a/includes/CMB2/css/cmb2-display.min.css b/includes/vendor/CMB2/css/cmb2-display.min.css similarity index 100% rename from includes/CMB2/css/cmb2-display.min.css rename to includes/vendor/CMB2/css/cmb2-display.min.css diff --git a/includes/CMB2/css/cmb2-front-rtl.css b/includes/vendor/CMB2/css/cmb2-front-rtl.css similarity index 100% rename from includes/CMB2/css/cmb2-front-rtl.css rename to includes/vendor/CMB2/css/cmb2-front-rtl.css diff --git a/includes/CMB2/css/cmb2-front-rtl.min.css b/includes/vendor/CMB2/css/cmb2-front-rtl.min.css similarity index 100% rename from includes/CMB2/css/cmb2-front-rtl.min.css rename to includes/vendor/CMB2/css/cmb2-front-rtl.min.css diff --git a/includes/CMB2/css/cmb2-front.css b/includes/vendor/CMB2/css/cmb2-front.css similarity index 100% rename from includes/CMB2/css/cmb2-front.css rename to includes/vendor/CMB2/css/cmb2-front.css diff --git a/includes/CMB2/css/cmb2-front.css.map b/includes/vendor/CMB2/css/cmb2-front.css.map similarity index 100% rename from includes/CMB2/css/cmb2-front.css.map rename to includes/vendor/CMB2/css/cmb2-front.css.map diff --git a/includes/CMB2/css/cmb2-front.min.css b/includes/vendor/CMB2/css/cmb2-front.min.css similarity index 100% rename from includes/CMB2/css/cmb2-front.min.css rename to includes/vendor/CMB2/css/cmb2-front.min.css diff --git a/includes/CMB2/css/cmb2-rtl.css b/includes/vendor/CMB2/css/cmb2-rtl.css similarity index 100% rename from includes/CMB2/css/cmb2-rtl.css rename to includes/vendor/CMB2/css/cmb2-rtl.css diff --git a/includes/CMB2/css/cmb2-rtl.min.css b/includes/vendor/CMB2/css/cmb2-rtl.min.css similarity index 100% rename from includes/CMB2/css/cmb2-rtl.min.css rename to includes/vendor/CMB2/css/cmb2-rtl.min.css diff --git a/includes/CMB2/css/cmb2.css b/includes/vendor/CMB2/css/cmb2.css similarity index 100% rename from includes/CMB2/css/cmb2.css rename to includes/vendor/CMB2/css/cmb2.css diff --git a/includes/CMB2/css/cmb2.css.map b/includes/vendor/CMB2/css/cmb2.css.map similarity index 100% rename from includes/CMB2/css/cmb2.css.map rename to includes/vendor/CMB2/css/cmb2.css.map diff --git a/includes/CMB2/css/cmb2.min.css b/includes/vendor/CMB2/css/cmb2.min.css similarity index 100% rename from includes/CMB2/css/cmb2.min.css rename to includes/vendor/CMB2/css/cmb2.min.css diff --git a/includes/CMB2/css/index.php b/includes/vendor/CMB2/css/index.php similarity index 100% rename from includes/CMB2/css/index.php rename to includes/vendor/CMB2/css/index.php diff --git a/includes/CMB2/css/sass/cmb2-display.scss b/includes/vendor/CMB2/css/sass/cmb2-display.scss similarity index 100% rename from includes/CMB2/css/sass/cmb2-display.scss rename to includes/vendor/CMB2/css/sass/cmb2-display.scss diff --git a/includes/CMB2/css/sass/cmb2-front.scss b/includes/vendor/CMB2/css/sass/cmb2-front.scss similarity index 100% rename from includes/CMB2/css/sass/cmb2-front.scss rename to includes/vendor/CMB2/css/sass/cmb2-front.scss diff --git a/includes/CMB2/css/sass/cmb2.scss b/includes/vendor/CMB2/css/sass/cmb2.scss similarity index 100% rename from includes/CMB2/css/sass/cmb2.scss rename to includes/vendor/CMB2/css/sass/cmb2.scss diff --git a/includes/CMB2/css/sass/index.php b/includes/vendor/CMB2/css/sass/index.php similarity index 100% rename from includes/CMB2/css/sass/index.php rename to includes/vendor/CMB2/css/sass/index.php diff --git a/includes/CMB2/css/sass/partials/_collapsible_ui.scss b/includes/vendor/CMB2/css/sass/partials/_collapsible_ui.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_collapsible_ui.scss rename to includes/vendor/CMB2/css/sass/partials/_collapsible_ui.scss diff --git a/includes/CMB2/css/sass/partials/_display.scss b/includes/vendor/CMB2/css/sass/partials/_display.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_display.scss rename to includes/vendor/CMB2/css/sass/partials/_display.scss diff --git a/includes/CMB2/css/sass/partials/_front.scss b/includes/vendor/CMB2/css/sass/partials/_front.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_front.scss rename to includes/vendor/CMB2/css/sass/partials/_front.scss diff --git a/includes/CMB2/css/sass/partials/_jquery_ui.scss b/includes/vendor/CMB2/css/sass/partials/_jquery_ui.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_jquery_ui.scss rename to includes/vendor/CMB2/css/sass/partials/_jquery_ui.scss diff --git a/includes/CMB2/css/sass/partials/_main_wrap.scss b/includes/vendor/CMB2/css/sass/partials/_main_wrap.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_main_wrap.scss rename to includes/vendor/CMB2/css/sass/partials/_main_wrap.scss diff --git a/includes/CMB2/css/sass/partials/_misc.scss b/includes/vendor/CMB2/css/sass/partials/_misc.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_misc.scss rename to includes/vendor/CMB2/css/sass/partials/_misc.scss diff --git a/includes/CMB2/css/sass/partials/_mixins.scss b/includes/vendor/CMB2/css/sass/partials/_mixins.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_mixins.scss rename to includes/vendor/CMB2/css/sass/partials/_mixins.scss diff --git a/includes/CMB2/css/sass/partials/_post_metaboxes.scss b/includes/vendor/CMB2/css/sass/partials/_post_metaboxes.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_post_metaboxes.scss rename to includes/vendor/CMB2/css/sass/partials/_post_metaboxes.scss diff --git a/includes/CMB2/css/sass/partials/_sidebar_placements.scss b/includes/vendor/CMB2/css/sass/partials/_sidebar_placements.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_sidebar_placements.scss rename to includes/vendor/CMB2/css/sass/partials/_sidebar_placements.scss diff --git a/includes/CMB2/css/sass/partials/_variables.scss b/includes/vendor/CMB2/css/sass/partials/_variables.scss similarity index 100% rename from includes/CMB2/css/sass/partials/_variables.scss rename to includes/vendor/CMB2/css/sass/partials/_variables.scss diff --git a/includes/CMB2/css/sass/partials/index.php b/includes/vendor/CMB2/css/sass/partials/index.php similarity index 100% rename from includes/CMB2/css/sass/partials/index.php rename to includes/vendor/CMB2/css/sass/partials/index.php diff --git a/includes/CMB2/images/ico-delete.png b/includes/vendor/CMB2/images/ico-delete.png similarity index 100% rename from includes/CMB2/images/ico-delete.png rename to includes/vendor/CMB2/images/ico-delete.png diff --git a/includes/CMB2/images/index.php b/includes/vendor/CMB2/images/index.php similarity index 100% rename from includes/CMB2/images/index.php rename to includes/vendor/CMB2/images/index.php diff --git a/includes/CMB2/images/ui-bg_flat_0_aaaaaa_40x100.png b/includes/vendor/CMB2/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from includes/CMB2/images/ui-bg_flat_0_aaaaaa_40x100.png rename to includes/vendor/CMB2/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/includes/CMB2/images/ui-bg_flat_75_ffffff_40x100.png b/includes/vendor/CMB2/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from includes/CMB2/images/ui-bg_flat_75_ffffff_40x100.png rename to includes/vendor/CMB2/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/includes/CMB2/images/ui-bg_glass_55_fbf9ee_1x400.png b/includes/vendor/CMB2/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from includes/CMB2/images/ui-bg_glass_55_fbf9ee_1x400.png rename to includes/vendor/CMB2/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/includes/CMB2/images/ui-bg_glass_65_ffffff_1x400.png b/includes/vendor/CMB2/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from includes/CMB2/images/ui-bg_glass_65_ffffff_1x400.png rename to includes/vendor/CMB2/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/includes/CMB2/images/ui-bg_glass_75_dadada_1x400.png b/includes/vendor/CMB2/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from includes/CMB2/images/ui-bg_glass_75_dadada_1x400.png rename to includes/vendor/CMB2/images/ui-bg_glass_75_dadada_1x400.png diff --git a/includes/CMB2/images/ui-bg_glass_75_e6e6e6_1x400.png b/includes/vendor/CMB2/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from includes/CMB2/images/ui-bg_glass_75_e6e6e6_1x400.png rename to includes/vendor/CMB2/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/includes/CMB2/images/ui-bg_glass_95_fef1ec_1x400.png b/includes/vendor/CMB2/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from includes/CMB2/images/ui-bg_glass_95_fef1ec_1x400.png rename to includes/vendor/CMB2/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/includes/CMB2/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/includes/vendor/CMB2/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from includes/CMB2/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to includes/vendor/CMB2/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/includes/CMB2/images/ui-icons_222222_256x240.png b/includes/vendor/CMB2/images/ui-icons_222222_256x240.png similarity index 100% rename from includes/CMB2/images/ui-icons_222222_256x240.png rename to includes/vendor/CMB2/images/ui-icons_222222_256x240.png diff --git a/includes/CMB2/images/ui-icons_2e83ff_256x240.png b/includes/vendor/CMB2/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from includes/CMB2/images/ui-icons_2e83ff_256x240.png rename to includes/vendor/CMB2/images/ui-icons_2e83ff_256x240.png diff --git a/includes/CMB2/images/ui-icons_454545_256x240.png b/includes/vendor/CMB2/images/ui-icons_454545_256x240.png similarity index 100% rename from includes/CMB2/images/ui-icons_454545_256x240.png rename to includes/vendor/CMB2/images/ui-icons_454545_256x240.png diff --git a/includes/CMB2/images/ui-icons_888888_256x240.png b/includes/vendor/CMB2/images/ui-icons_888888_256x240.png similarity index 100% rename from includes/CMB2/images/ui-icons_888888_256x240.png rename to includes/vendor/CMB2/images/ui-icons_888888_256x240.png diff --git a/includes/CMB2/images/ui-icons_cd0a0a_256x240.png b/includes/vendor/CMB2/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from includes/CMB2/images/ui-icons_cd0a0a_256x240.png rename to includes/vendor/CMB2/images/ui-icons_cd0a0a_256x240.png diff --git a/includes/CMB2/includes/CMB2.php b/includes/vendor/CMB2/includes/CMB2.php similarity index 100% rename from includes/CMB2/includes/CMB2.php rename to includes/vendor/CMB2/includes/CMB2.php diff --git a/includes/CMB2/includes/CMB2_Ajax.php b/includes/vendor/CMB2/includes/CMB2_Ajax.php similarity index 100% rename from includes/CMB2/includes/CMB2_Ajax.php rename to includes/vendor/CMB2/includes/CMB2_Ajax.php diff --git a/includes/CMB2/includes/CMB2_Base.php b/includes/vendor/CMB2/includes/CMB2_Base.php similarity index 100% rename from includes/CMB2/includes/CMB2_Base.php rename to includes/vendor/CMB2/includes/CMB2_Base.php diff --git a/includes/CMB2/includes/CMB2_Boxes.php b/includes/vendor/CMB2/includes/CMB2_Boxes.php similarity index 100% rename from includes/CMB2/includes/CMB2_Boxes.php rename to includes/vendor/CMB2/includes/CMB2_Boxes.php diff --git a/includes/CMB2/includes/CMB2_Field.php b/includes/vendor/CMB2/includes/CMB2_Field.php similarity index 100% rename from includes/CMB2/includes/CMB2_Field.php rename to includes/vendor/CMB2/includes/CMB2_Field.php diff --git a/includes/CMB2/includes/CMB2_Field_Display.php b/includes/vendor/CMB2/includes/CMB2_Field_Display.php similarity index 100% rename from includes/CMB2/includes/CMB2_Field_Display.php rename to includes/vendor/CMB2/includes/CMB2_Field_Display.php diff --git a/includes/CMB2/includes/CMB2_Hookup_Base.php b/includes/vendor/CMB2/includes/CMB2_Hookup_Base.php similarity index 100% rename from includes/CMB2/includes/CMB2_Hookup_Base.php rename to includes/vendor/CMB2/includes/CMB2_Hookup_Base.php diff --git a/includes/CMB2/includes/CMB2_JS.php b/includes/vendor/CMB2/includes/CMB2_JS.php similarity index 100% rename from includes/CMB2/includes/CMB2_JS.php rename to includes/vendor/CMB2/includes/CMB2_JS.php diff --git a/includes/CMB2/includes/CMB2_Options.php b/includes/vendor/CMB2/includes/CMB2_Options.php similarity index 100% rename from includes/CMB2/includes/CMB2_Options.php rename to includes/vendor/CMB2/includes/CMB2_Options.php diff --git a/includes/CMB2/includes/CMB2_Sanitize.php b/includes/vendor/CMB2/includes/CMB2_Sanitize.php similarity index 100% rename from includes/CMB2/includes/CMB2_Sanitize.php rename to includes/vendor/CMB2/includes/CMB2_Sanitize.php diff --git a/includes/CMB2/includes/CMB2_Show_Filters.php b/includes/vendor/CMB2/includes/CMB2_Show_Filters.php similarity index 100% rename from includes/CMB2/includes/CMB2_Show_Filters.php rename to includes/vendor/CMB2/includes/CMB2_Show_Filters.php diff --git a/includes/CMB2/includes/CMB2_Types.php b/includes/vendor/CMB2/includes/CMB2_Types.php similarity index 100% rename from includes/CMB2/includes/CMB2_Types.php rename to includes/vendor/CMB2/includes/CMB2_Types.php diff --git a/includes/CMB2/includes/CMB2_Utils.php b/includes/vendor/CMB2/includes/CMB2_Utils.php similarity index 100% rename from includes/CMB2/includes/CMB2_Utils.php rename to includes/vendor/CMB2/includes/CMB2_Utils.php diff --git a/includes/CMB2/includes/CMB2_hookup.php b/includes/vendor/CMB2/includes/CMB2_hookup.php similarity index 100% rename from includes/CMB2/includes/CMB2_hookup.php rename to includes/vendor/CMB2/includes/CMB2_hookup.php diff --git a/includes/CMB2/includes/helper-functions.php b/includes/vendor/CMB2/includes/helper-functions.php similarity index 100% rename from includes/CMB2/includes/helper-functions.php rename to includes/vendor/CMB2/includes/helper-functions.php diff --git a/includes/CMB2/includes/index.php b/includes/vendor/CMB2/includes/index.php similarity index 100% rename from includes/CMB2/includes/index.php rename to includes/vendor/CMB2/includes/index.php diff --git a/includes/CMB2/includes/rest-api/CMB2_REST.php b/includes/vendor/CMB2/includes/rest-api/CMB2_REST.php similarity index 100% rename from includes/CMB2/includes/rest-api/CMB2_REST.php rename to includes/vendor/CMB2/includes/rest-api/CMB2_REST.php diff --git a/includes/CMB2/includes/rest-api/CMB2_REST_Controller.php b/includes/vendor/CMB2/includes/rest-api/CMB2_REST_Controller.php similarity index 100% rename from includes/CMB2/includes/rest-api/CMB2_REST_Controller.php rename to includes/vendor/CMB2/includes/rest-api/CMB2_REST_Controller.php diff --git a/includes/CMB2/includes/rest-api/CMB2_REST_Controller_Boxes.php b/includes/vendor/CMB2/includes/rest-api/CMB2_REST_Controller_Boxes.php similarity index 100% rename from includes/CMB2/includes/rest-api/CMB2_REST_Controller_Boxes.php rename to includes/vendor/CMB2/includes/rest-api/CMB2_REST_Controller_Boxes.php diff --git a/includes/CMB2/includes/rest-api/CMB2_REST_Controller_Fields.php b/includes/vendor/CMB2/includes/rest-api/CMB2_REST_Controller_Fields.php similarity index 100% rename from includes/CMB2/includes/rest-api/CMB2_REST_Controller_Fields.php rename to includes/vendor/CMB2/includes/rest-api/CMB2_REST_Controller_Fields.php diff --git a/includes/CMB2/includes/shim/WP_REST_Controller.php b/includes/vendor/CMB2/includes/shim/WP_REST_Controller.php similarity index 100% rename from includes/CMB2/includes/shim/WP_REST_Controller.php rename to includes/vendor/CMB2/includes/shim/WP_REST_Controller.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Base.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Base.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Base.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Base.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Checkbox.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Checkbox.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Checkbox.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Checkbox.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Colorpicker.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Colorpicker.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Colorpicker.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Colorpicker.php diff --git a/includes/CMB2/includes/types/CMB2_Type_File.php b/includes/vendor/CMB2/includes/types/CMB2_Type_File.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_File.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_File.php diff --git a/includes/CMB2/includes/types/CMB2_Type_File_Base.php b/includes/vendor/CMB2/includes/types/CMB2_Type_File_Base.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_File_Base.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_File_Base.php diff --git a/includes/CMB2/includes/types/CMB2_Type_File_List.php b/includes/vendor/CMB2/includes/types/CMB2_Type_File_List.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_File_List.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_File_List.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Multi_Base.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Multi_Base.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Multi_Base.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Multi_Base.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Multicheck.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Multicheck.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Multicheck.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Multicheck.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Oembed.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Oembed.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Oembed.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Oembed.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Picker_Base.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Picker_Base.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Picker_Base.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Picker_Base.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Radio.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Radio.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Radio.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Radio.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Select.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Select.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Select.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Select.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Select_Timezone.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Select_Timezone.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Select_Timezone.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Select_Timezone.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Taxonomy_Base.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Base.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Taxonomy_Base.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Base.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Taxonomy_Multicheck.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Multicheck.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Taxonomy_Multicheck.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Multicheck.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Taxonomy_Radio.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Radio.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Taxonomy_Radio.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Radio.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Taxonomy_Select.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Select.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Taxonomy_Select.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Taxonomy_Select.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Text.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Text.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Text.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Text.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Date.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Text_Date.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Text_Date.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Text_Date.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Text_Time.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Text_Time.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Text_Time.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Text_Time.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Textarea.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Textarea.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Textarea.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Textarea.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Textarea_Code.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Textarea_Code.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Textarea_Code.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Title.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Title.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Title.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Title.php diff --git a/includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php b/includes/vendor/CMB2/includes/types/CMB2_Type_Wysiwyg.php similarity index 100% rename from includes/CMB2/includes/types/CMB2_Type_Wysiwyg.php rename to includes/vendor/CMB2/includes/types/CMB2_Type_Wysiwyg.php diff --git a/includes/CMB2/index.php b/includes/vendor/CMB2/index.php similarity index 100% rename from includes/CMB2/index.php rename to includes/vendor/CMB2/index.php diff --git a/includes/CMB2/init.php b/includes/vendor/CMB2/init.php similarity index 100% rename from includes/CMB2/init.php rename to includes/vendor/CMB2/init.php diff --git a/includes/CMB2/js/cmb2-wysiwyg.js b/includes/vendor/CMB2/js/cmb2-wysiwyg.js similarity index 100% rename from includes/CMB2/js/cmb2-wysiwyg.js rename to includes/vendor/CMB2/js/cmb2-wysiwyg.js diff --git a/includes/CMB2/js/cmb2.js b/includes/vendor/CMB2/js/cmb2.js similarity index 100% rename from includes/CMB2/js/cmb2.js rename to includes/vendor/CMB2/js/cmb2.js diff --git a/includes/CMB2/js/cmb2.min.js b/includes/vendor/CMB2/js/cmb2.min.js similarity index 100% rename from includes/CMB2/js/cmb2.min.js rename to includes/vendor/CMB2/js/cmb2.min.js diff --git a/includes/CMB2/js/index.php b/includes/vendor/CMB2/js/index.php similarity index 100% rename from includes/CMB2/js/index.php rename to includes/vendor/CMB2/js/index.php diff --git a/includes/CMB2/js/jquery-ui-timepicker-addon.min.js b/includes/vendor/CMB2/js/jquery-ui-timepicker-addon.min.js similarity index 100% rename from includes/CMB2/js/jquery-ui-timepicker-addon.min.js rename to includes/vendor/CMB2/js/jquery-ui-timepicker-addon.min.js diff --git a/includes/CMB2/readme.txt b/includes/vendor/CMB2/readme.txt similarity index 100% rename from includes/CMB2/readme.txt rename to includes/vendor/CMB2/readme.txt diff --git a/includes/taxonomy-images/blank.png b/includes/vendor/taxonomy-images/blank.png similarity index 100% rename from includes/taxonomy-images/blank.png rename to includes/vendor/taxonomy-images/blank.png diff --git a/includes/taxonomy-images/controls.png b/includes/vendor/taxonomy-images/controls.png similarity index 100% rename from includes/taxonomy-images/controls.png rename to includes/vendor/taxonomy-images/controls.png diff --git a/includes/taxonomy-images/css/admin.css b/includes/vendor/taxonomy-images/css/admin.css similarity index 94% rename from includes/taxonomy-images/css/admin.css rename to includes/vendor/taxonomy-images/css/admin.css index 8b2e11a..f7a652d 100755 --- a/includes/taxonomy-images/css/admin.css +++ b/includes/vendor/taxonomy-images/css/admin.css @@ -1,78 +1,78 @@ -td.sermon-image-plugin-button { - display: none; -} - -.sermon-images-modal td.sermon-image-plugin-button { - display: block !important; -} - -.sermon-images-modal .create-association .term-name { - font-style: italic; -} - -.sermon-images-modal .create-association { - display: inline; -} - -.sermon-images-modal .remove-association { - display: none; - color: #bc0b0b; - text-decoration: underline; - cursor: pointer; -} - -.sermon-images-modal #tab-type_url, -.sermon-images-modal .savesend input { - display: none !important; -} - -.sermon-image-thumbnail { - display: block; - height: 77px; - width: 77px; - overflow: hidden; - text-align: center; - margin-bottom: 3px; -} - -.sermon-image-control .control { - display: block; - float: left; - text-indent: -9999em; - width: 15px; - height: 15px; - background: url(controls.png); - background-repeat: no-repeat; -} - -.sermon-image-control .control:hover { - cursor: pointer; -} - -.sermon-image-control .upload { - background-position: 0 0; -} - -.sermon-image-control .upload:hover { - background-position: -15px 0 -} - -.sermon-image-control .remove { - background-position: -30px 0; -} - -.sermon-image-control .remove:hover { - background-position: -45px 0; -} - -.sermon-image-control .library { - background-position: -60px 0; -} - -.sermon-image-control .hide { - visibility: hidden; -} - -.sermon-image-control .show { - visibility: visible; -} +td.sermon-image-plugin-button { + display: none; +} + +.sermon-images-modal td.sermon-image-plugin-button { + display: block !important; +} + +.sermon-images-modal .create-association .term-name { + font-style: italic; +} + +.sermon-images-modal .create-association { + display: inline; +} + +.sermon-images-modal .remove-association { + display: none; + color: #bc0b0b; + text-decoration: underline; + cursor: pointer; +} + +.sermon-images-modal #tab-type_url, +.sermon-images-modal .savesend input { + display: none !important; +} + +.sermon-image-thumbnail { + display: block; + height: 77px; + width: 77px; + overflow: hidden; + text-align: center; + margin-bottom: 3px; +} + +.sermon-image-control .control { + display: block; + float: left; + text-indent: -9999em; + width: 15px; + height: 15px; + background: url(controls.png); + background-repeat: no-repeat; +} + +.sermon-image-control .control:hover { + cursor: pointer; +} + +.sermon-image-control .upload { + background-position: 0 0; +} + +.sermon-image-control .upload:hover { + background-position: -15px 0 +} + +.sermon-image-control .remove { + background-position: -30px 0; +} + +.sermon-image-control .remove:hover { + background-position: -45px 0; +} + +.sermon-image-control .library { + background-position: -60px 0; +} + +.sermon-image-control .hide { + visibility: hidden; +} + +.sermon-image-control .show { + visibility: visible; +} diff --git a/includes/taxonomy-images/css/controls.png b/includes/vendor/taxonomy-images/css/controls.png similarity index 100% rename from includes/taxonomy-images/css/controls.png rename to includes/vendor/taxonomy-images/css/controls.png diff --git a/includes/taxonomy-images/default.png b/includes/vendor/taxonomy-images/default.png similarity index 100% rename from includes/taxonomy-images/default.png rename to includes/vendor/taxonomy-images/default.png diff --git a/includes/taxonomy-images/js/edit-tags.js b/includes/vendor/taxonomy-images/js/edit-tags.js similarity index 100% rename from includes/taxonomy-images/js/edit-tags.js rename to includes/vendor/taxonomy-images/js/edit-tags.js diff --git a/includes/taxonomy-images/js/media-modal.js b/includes/vendor/taxonomy-images/js/media-modal.js similarity index 100% rename from includes/taxonomy-images/js/media-modal.js rename to includes/vendor/taxonomy-images/js/media-modal.js diff --git a/includes/taxonomy-images/js/media-upload-popup.js b/includes/vendor/taxonomy-images/js/media-upload-popup.js similarity index 100% rename from includes/taxonomy-images/js/media-upload-popup.js rename to includes/vendor/taxonomy-images/js/media-upload-popup.js diff --git a/includes/taxonomy-images/languages/taxonomy-images.pot b/includes/vendor/taxonomy-images/languages/taxonomy-images.pot similarity index 95% rename from includes/taxonomy-images/languages/taxonomy-images.pot rename to includes/vendor/taxonomy-images/languages/taxonomy-images.pot index 306b1b1..92146eb 100755 --- a/includes/taxonomy-images/languages/taxonomy-images.pot +++ b/includes/vendor/taxonomy-images/languages/taxonomy-images.pot @@ -1,221 +1,221 @@ -# Copyright (C) 2011 Taxonomy Images -# This file is distributed under the same license as the Taxonomy Images package. -msgid "" -msgstr "" -"Project-Id-Version: Taxonomy Images 0.7.2\n" -"Report-Msgid-Bugs-To: http://wordpress.org/tag/taxonomy-images\n" -"POT-Creation-Date: 2011-06-20 17:47:57+00:00\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" - -#: taxonomy-images.php:125 -msgid "Associate with %1$s" -msgstr "" - -#: taxonomy-images.php:125 taxonomy-images.php:127 -msgid "this term" -msgstr "" - -#: taxonomy-images.php:127 -msgid "Remove association with %1$s" -msgstr "" - -#. translators: Notice displayed on the custom administration page. -#: taxonomy-images.php:281 -msgid "Image support for taxonomies successfully updated" -msgstr "" - -#. translators: Notice displayed on the custom administration page. -#: taxonomy-images.php:284 -msgid "Image support has been disabled for all taxonomies." -msgstr "" - -#: taxonomy-images.php:324 taxonomy-images.php:1170 -msgid "Settings" -msgstr "" - -#: taxonomy-images.php:330 -msgid "Taxonomies" -msgstr "" - -#. #-#-#-#-# plugin.pot (Taxonomy Images 0.7.2) #-#-#-#-# -#. Plugin Name of the plugin/theme -#: taxonomy-images.php:349 taxonomy-images.php:350 -msgid "Taxonomy Images" -msgstr "" - -#. translators: Heading of the custom administration page. -#: taxonomy-images.php:377 -msgid "Taxonomy Images Plugin Settings" -msgstr "" - -#. translators: Button on the custom administration page. -#: taxonomy-images.php:385 -msgid "Save Changes" -msgstr "" - -#. translators: An ajax request has failed for an unknown reason. -#: taxonomy-images.php:432 -msgid "Unknown error encountered" -msgstr "" - -#: taxonomy-images.php:507 taxonomy-images.php:589 -msgid "tt_id not sent" -msgstr "" - -#: taxonomy-images.php:515 taxonomy-images.php:597 -msgid "tt_id is empty" -msgstr "" - -#: taxonomy-images.php:522 taxonomy-images.php:604 -msgid "You do not have the correct capability to manage this term" -msgstr "" - -#: taxonomy-images.php:529 -msgid "No nonce included." -msgstr "" - -#: taxonomy-images.php:536 taxonomy-images.php:618 -msgid "Nonce did not match" -msgstr "" - -#: taxonomy-images.php:543 -msgid "Image id not sent" -msgstr "" - -#: taxonomy-images.php:551 -msgid "Image id is not a positive integer" -msgstr "" - -#: taxonomy-images.php:560 -msgid "Image successfully associated" -msgstr "" - -#: taxonomy-images.php:567 -msgid "Association could not be created" -msgstr "" - -#: taxonomy-images.php:611 -msgid "No nonce included" -msgstr "" - -#: taxonomy-images.php:626 -msgid "Nothing to remove" -msgstr "" - -#: taxonomy-images.php:635 -msgid "Association successfully removed" -msgstr "" - -#: taxonomy-images.php:641 -msgid "Association could not be removed" -msgstr "" - -#: taxonomy-images.php:711 taxonomy-images.php:760 -msgid "Image" -msgstr "" - -#: taxonomy-images.php:754 taxonomy-images.php:790 -msgid "term" -msgstr "" - -#: taxonomy-images.php:764 -msgid "Associate an image from your media library to this %1$s." -msgstr "" - -#: taxonomy-images.php:808 -msgid "Associate an image with the %1$s named “%2$s”." -msgstr "" - -#: taxonomy-images.php:809 -msgid "Upload a new image for this %s." -msgstr "" - -#: taxonomy-images.php:809 -msgid "Upload." -msgstr "" - -#: taxonomy-images.php:810 -msgid "Remove image from this %s." -msgstr "" - -#: taxonomy-images.php:810 -msgid "Delete" -msgstr "" - -#: taxonomy-images.php:839 -msgid "“" -msgstr "" - -#: taxonomy-images.php:840 -msgid "”" -msgstr "" - -#: taxonomy-images.php:841 -msgid "Associating …" -msgstr "" - -#: taxonomy-images.php:842 -msgid "Successfully Associated" -msgstr "" - -#: taxonomy-images.php:843 -msgid "Removing …" -msgstr "" - -#: taxonomy-images.php:844 -msgid "Successfully Removed" -msgstr "" - -#: taxonomy-images.php:1098 -msgid "" -"The %1$s argument for %2$s is set to %3$s which is not a registered " -"taxonomy. Please check the spelling and update the argument." -msgstr "" - -#: taxonomy-images.php:1099 -msgid "taxonomy" -msgstr "" - -#: taxonomy-images.php:1109 -msgid "No taxonomies have image support. %1$s" -msgstr "" - -#: taxonomy-images.php:1114 -msgid "The %1$s taxonomy does not have image support. %2$s" -msgstr "" - -#: taxonomy-images.php:1139 -msgid "The %1$s has been called directly. Please use the %2$s filter instead." -msgstr "" - -#: taxonomy-images.php:1175 -msgid "Donate" -msgstr "" - -#: taxonomy-images.php:1193 -msgid "Manage Settings" -msgstr "" - -#: public-filters.php:376 -msgid "" -"%1$s is not a property of the current queried object. This usually happens " -"when the %2$s filter is used in an unsupported template file. This filter " -"has been designed to work in taxonomy archives which are traditionally " -"served by one of the following template files: category.php, tag.php or " -"taxonomy.php. Learn more about %3$s." -msgstr "" - -#: public-filters.php:377 -msgid "term_taxonomy_id" -msgstr "" - -#. Description of the plugin/theme -msgid "" -"Associate images from your media library to categories, tags and custom " -"taxonomies." -msgstr "" +# Copyright (C) 2011 Taxonomy Images +# This file is distributed under the same license as the Taxonomy Images package. +msgid "" +msgstr "" +"Project-Id-Version: Taxonomy Images 0.7.2\n" +"Report-Msgid-Bugs-To: http://wordpress.org/tag/taxonomy-images\n" +"POT-Creation-Date: 2011-06-20 17:47:57+00:00\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" + +#: taxonomy-images.php:125 +msgid "Associate with %1$s" +msgstr "" + +#: taxonomy-images.php:125 taxonomy-images.php:127 +msgid "this term" +msgstr "" + +#: taxonomy-images.php:127 +msgid "Remove association with %1$s" +msgstr "" + +#. translators: Notice displayed on the custom administration page. +#: taxonomy-images.php:281 +msgid "Image support for taxonomies successfully updated" +msgstr "" + +#. translators: Notice displayed on the custom administration page. +#: taxonomy-images.php:284 +msgid "Image support has been disabled for all taxonomies." +msgstr "" + +#: taxonomy-images.php:324 taxonomy-images.php:1170 +msgid "Settings" +msgstr "" + +#: taxonomy-images.php:330 +msgid "Taxonomies" +msgstr "" + +#. #-#-#-#-# plugin.pot (Taxonomy Images 0.7.2) #-#-#-#-# +#. Plugin Name of the plugin/theme +#: taxonomy-images.php:349 taxonomy-images.php:350 +msgid "Taxonomy Images" +msgstr "" + +#. translators: Heading of the custom administration page. +#: taxonomy-images.php:377 +msgid "Taxonomy Images Plugin Settings" +msgstr "" + +#. translators: Button on the custom administration page. +#: taxonomy-images.php:385 +msgid "Save Changes" +msgstr "" + +#. translators: An ajax request has failed for an unknown reason. +#: taxonomy-images.php:432 +msgid "Unknown error encountered" +msgstr "" + +#: taxonomy-images.php:507 taxonomy-images.php:589 +msgid "tt_id not sent" +msgstr "" + +#: taxonomy-images.php:515 taxonomy-images.php:597 +msgid "tt_id is empty" +msgstr "" + +#: taxonomy-images.php:522 taxonomy-images.php:604 +msgid "You do not have the correct capability to manage this term" +msgstr "" + +#: taxonomy-images.php:529 +msgid "No nonce included." +msgstr "" + +#: taxonomy-images.php:536 taxonomy-images.php:618 +msgid "Nonce did not match" +msgstr "" + +#: taxonomy-images.php:543 +msgid "Image id not sent" +msgstr "" + +#: taxonomy-images.php:551 +msgid "Image id is not a positive integer" +msgstr "" + +#: taxonomy-images.php:560 +msgid "Image successfully associated" +msgstr "" + +#: taxonomy-images.php:567 +msgid "Association could not be created" +msgstr "" + +#: taxonomy-images.php:611 +msgid "No nonce included" +msgstr "" + +#: taxonomy-images.php:626 +msgid "Nothing to remove" +msgstr "" + +#: taxonomy-images.php:635 +msgid "Association successfully removed" +msgstr "" + +#: taxonomy-images.php:641 +msgid "Association could not be removed" +msgstr "" + +#: taxonomy-images.php:711 taxonomy-images.php:760 +msgid "Image" +msgstr "" + +#: taxonomy-images.php:754 taxonomy-images.php:790 +msgid "term" +msgstr "" + +#: taxonomy-images.php:764 +msgid "Associate an image from your media library to this %1$s." +msgstr "" + +#: taxonomy-images.php:808 +msgid "Associate an image with the %1$s named “%2$s”." +msgstr "" + +#: taxonomy-images.php:809 +msgid "Upload a new image for this %s." +msgstr "" + +#: taxonomy-images.php:809 +msgid "Upload." +msgstr "" + +#: taxonomy-images.php:810 +msgid "Remove image from this %s." +msgstr "" + +#: taxonomy-images.php:810 +msgid "Delete" +msgstr "" + +#: taxonomy-images.php:839 +msgid "“" +msgstr "" + +#: taxonomy-images.php:840 +msgid "”" +msgstr "" + +#: taxonomy-images.php:841 +msgid "Associating …" +msgstr "" + +#: taxonomy-images.php:842 +msgid "Successfully Associated" +msgstr "" + +#: taxonomy-images.php:843 +msgid "Removing …" +msgstr "" + +#: taxonomy-images.php:844 +msgid "Successfully Removed" +msgstr "" + +#: taxonomy-images.php:1098 +msgid "" +"The %1$s argument for %2$s is set to %3$s which is not a registered " +"taxonomy. Please check the spelling and update the argument." +msgstr "" + +#: taxonomy-images.php:1099 +msgid "taxonomy" +msgstr "" + +#: taxonomy-images.php:1109 +msgid "No taxonomies have image support. %1$s" +msgstr "" + +#: taxonomy-images.php:1114 +msgid "The %1$s taxonomy does not have image support. %2$s" +msgstr "" + +#: taxonomy-images.php:1139 +msgid "The %1$s has been called directly. Please use the %2$s filter instead." +msgstr "" + +#: taxonomy-images.php:1175 +msgid "Donate" +msgstr "" + +#: taxonomy-images.php:1193 +msgid "Manage Settings" +msgstr "" + +#: public-filters.php:376 +msgid "" +"%1$s is not a property of the current queried object. This usually happens " +"when the %2$s filter is used in an unsupported template file. This filter " +"has been designed to work in taxonomy archives which are traditionally " +"served by one of the following template files: category.php, tag.php or " +"taxonomy.php. Learn more about %3$s." +msgstr "" + +#: public-filters.php:377 +msgid "term_taxonomy_id" +msgstr "" + +#. Description of the plugin/theme +msgid "" +"Associate images from your media library to categories, tags and custom " +"taxonomies." +msgstr "" diff --git a/includes/taxonomy-images/public-filters.php b/includes/vendor/taxonomy-images/public-filters.php similarity index 96% rename from includes/taxonomy-images/public-filters.php rename to includes/vendor/taxonomy-images/public-filters.php index 46d414a..f62d044 100755 --- a/includes/taxonomy-images/public-filters.php +++ b/includes/vendor/taxonomy-images/public-filters.php @@ -1,570 +1,570 @@ - - * @copyright Copyright (c) 2011, Michael Fields - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License - * @since 0.7 - */ - - -add_filter( 'sermon-images-get-terms', 'sermon_images_plugin_get_terms', 10, 2 ); -add_filter( 'sermon-images-get-the-terms', 'sermon_images_plugin_get_the_terms', 10, 2 ); -add_filter( 'sermon-images-list-the-terms', 'sermon_images_plugin_list_the_terms', 10, 2 ); - -add_filter( 'sermon-images-queried-term-image', 'sermon_images_plugin_get_queried_term_image', 10, 2 ); -add_filter( 'sermon-images-queried-term-image-data', 'sermon_images_plugin_get_queried_term_image_data', 10, 2 ); -add_filter( 'sermon-images-queried-term-image-id', 'sermon_images_plugin_get_queried_term_image_id' ); -add_filter( 'sermon-images-queried-term-image-object', 'sermon_images_plugin_get_queried_term_image_object' ); -add_filter( 'sermon-images-queried-term-image-url', 'sermon_images_plugin_get_queried_term_image_url', 10, 2 ); - - -/** - * Get Terms. - * - * This function adds a custom property (image_id) to each - * object returned by WordPress core function get_terms(). - * This property will be set for all term objects. In cases - * where a term has an associated image, "image_id" will - * contain the value of the image object's ID property. If - * no image has been associated, this property will contain - * integer with the value of zero. - * - * Recognized Arguments: - * - * cache_images (bool) A non-empty value will trigger - * this function to query for and cache all associated - * images. An empty value disables caching. Defaults to - * boolean true. - * - * having_images (bool) A non-empty value will trigger - * this function to only return terms that have associated - * images. If an empty value is passed all terms of the - * taxonomy will be returned. - * - * taxonomy (string) Name of a registered taxonomy to - * return terms from. Defaults to "category". - * - * term_args (array) Arguments to pass as the second - * parameter of get_terms(). Defaults to an empty array. - * - * @param mixed Default value for apply_filters() to return. Unused. - * @param array Named arguments. Please see above for explantion. - * - * @return array List of term objects. - * - * @access private Use the 'sermon-images-get-terms' filter. - * @since 0.7 - */ -function sermon_images_plugin_get_terms( $default, $args = array() ) { - $filter = 'sermon-images-get-terms'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $args = wp_parse_args( $args, array( - 'cache_images' => true, - 'having_images' => true, - 'taxonomy' => 'wpfc_sermon_series', - 'term_args' => array(), - ) ); - - $args['taxonomy'] = explode( ',', $args['taxonomy'] ); - $args['taxonomy'] = array_map( 'trim', $args['taxonomy'] ); - - foreach ( $args['taxonomy'] as $taxonomy ) { - if ( ! sermon_image_plugin_check_taxonomy( $taxonomy, $filter ) ) { - return array(); - } - } - - $assoc = sermon_image_plugin_get_associations(); - if ( empty( $assoc ) ) { - return array(); - } - - $terms = get_terms( $args['taxonomy'], $args['term_args'] ); - if ( is_wp_error( $terms ) ) { - return array(); - } - - $image_ids = array(); - $terms_with_images = array(); - foreach ( (array) $terms as $key => $term ) { - $terms[ $key ]->image_id = 0; - if ( array_key_exists( $term->term_taxonomy_id, $assoc ) ) { - $terms[ $key ]->image_id = $assoc[ $term->term_taxonomy_id ]; - $image_ids[] = $assoc[ $term->term_taxonomy_id ]; - if ( ! empty( $args['having_images'] ) ) { - $terms_with_images[] = $terms[ $key ]; - } - } - } - $image_ids = array_unique( $image_ids ); - - if ( ! empty( $args['cache_images'] ) ) { - $images = array(); - if ( ! empty( $image_ids ) ) { - $images = get_children( array( 'include' => implode( ',', $image_ids ) ) ); - } - } - - if ( ! empty( $terms_with_images ) ) { - return $terms_with_images; - } - - return $terms; -} - - -/** - * Get the Terms. - * - * This function adds a custom property (image_id) to each - * object returned by WordPress core function get_the_terms(). - * This property will be set for all term objects. In cases - * where a term has an associated image, "image_id" will - * contain the value of the image object's ID property. If - * no image has been associated, this property will contain - * integer with the value of zero. - * - * Recognized Arguments: - * - * having_images (bool) A non-empty value will trigger - * this function to only return terms that have associated - * images. If an empty value is passed all terms of the - * taxonomy will be returned. Optional. - * - * post_id (int) The post to retrieve terms from. Defaults - * to the ID property of the global $post object. Optional. - * - * taxonomy (string) Name of a registered taxonomy to - * return terms from. Defaults to "category". Optional. - * - * @param mixed Default value for apply_filters() to return. Unused. - * @param array Named arguments. Please see above for explantion. - * - * @return array List of term objects. Empty array if none were found. - * - * @access private Use the 'sermon-images-get-the-terms' filter. - * @since 0.7 - */ -function sermon_images_plugin_get_the_terms( $default, $args ) { - $filter = 'sermon-images-get-the-terms'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $args = wp_parse_args( $args, array( - 'having_images' => true, - 'post_id' => 0, - 'taxonomy' => 'wpfc_sermon_series', - ) ); - - if ( ! sermon_image_plugin_check_taxonomy( $args['taxonomy'], $filter ) ) { - return array(); - } - - $assoc = sermon_image_plugin_get_associations(); - - if ( empty( $args['post_id'] ) ) { - $args['post_id'] = get_the_ID(); - } - - $terms = get_the_terms( $args['post_id'], $args['taxonomy'] ); - - if ( is_wp_error( $terms ) ) { - return array(); - } - - if ( empty( $terms ) ) { - return array(); - } - - $terms_with_images = array(); - foreach ( (array) $terms as $key => $term ) { - $terms[ $key ]->image_id = 0; - if ( array_key_exists( $term->term_taxonomy_id, $assoc ) ) { - $terms[ $key ]->image_id = $assoc[ $term->term_taxonomy_id ]; - if ( ! empty( $args['having_images'] ) ) { - $terms_with_images[] = $terms[ $key ]; - } - } - } - if ( ! empty( $terms_with_images ) ) { - return $terms_with_images; - } - - return $terms; -} - - -/** - * List the Terms. - * - * Lists all terms associated with a given post that - * have associated images. Terms without images will - * not be included. - * - * Recognized Arguments: - * - * after (string) Text to append to the output. Optional. - * Defaults to an empty string. - * - * before (string) Text to preppend to the output. Optional. - * Defaults to an empty string. - * - * image_size (string) Any registered image size. Values will - * vary from installation to installation. Image sizes defined - * in core include: "thumbnail", "medium" and "large". "Fullsize" - * may also be used to get the un modified image that was uploaded. - * Optional. Defaults to "thumbnail". - * - * post_id (int) The post to retrieve terms from. Defaults - * to the ID property of the global $post object. Optional. - * - * taxonomy (string) Name of a registered taxonomy to - * return terms from. Defaults to "category". Optional. - * - * @param mixed Default value for apply_filters() to return. Unused. - * @param array Named arguments. Please see above for explantion. - * - * @return string HTML markup. - * - * @access private Use the 'sermon-images-list-the-terms' filter. - * @since 0.7 - */ -function sermon_images_plugin_list_the_terms( $default, $args ) { - $filter = 'sermon-images-list-the-terms'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $args = wp_parse_args( $args, array( - 'after' => '', - 'after_image' => '', - 'before' => '
    ', - 'before_image' => '
  • ', - 'image_size' => 'thumbnail', - 'post_id' => 0, - 'taxonomy' => 'wpfc_sermon_series', - ) ); - - $args['having_images'] = true; - - if ( ! sermon_image_plugin_check_taxonomy( $args['taxonomy'], $filter ) ) { - return ''; - } - - $terms = apply_filters( 'sermon-images-get-the-terms', '', $args ); - - if ( empty( $terms ) ) { - return ''; - } - - $output = ''; - foreach ( $terms as $term ) { - if ( ! isset( $term->image_id ) ) { - continue; - } - $image = wp_get_attachment_image( $term->image_id, $args['image_size'] ); - if ( ! empty( $image ) ) { - $output .= $args['before_image'] . '' . $image . '' . $args['after_image']; - } - } - - if ( ! empty( $output ) ) { - return $args['before'] . $output . $args['after']; - } - - return ''; -} - - -/** - * Queried Term Image. - * - * Prints html marking up the images associated with - * the current queried term. - * - * Recognized Arguments: - * - * after (string) - Text to append to the image's HTML. - * - * before (string) - Text to prepend to the image's HTML. - * - * image_size (string) - May be any image size registered with - * WordPress. If no image size is specified, 'thumbnail' will be - * used as a default value. In the event that an unregistered size - * is specified, this function will return an empty string. - * - * Designed to be used in archive templates including - * (but not limited to) archive.php, - * taxonomy.php as well as derivatives of these templates. - * - * @param mixed Default value for apply_filters() to return. Unused. - * @param array Named array of arguments. - * - * @return string HTML markup for the associated image. - * - * @access private Use the 'sermon-images-queried-term-image' filter. - * @since 0.7 - */ -function sermon_images_plugin_get_queried_term_image( $default, $args = array() ) { - $filter = 'sermon-images-queried-term-image'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $args = wp_parse_args( $args, array( - 'after' => '', - 'attr' => array(), - 'before' => '', - 'image_size' => 'thumbnail', - ) ); - - $ID = apply_filters( 'sermon-images-queried-term-image-id', 0 ); - - if ( empty( $ID ) ) { - return ''; - } - - $html = wp_get_attachment_image( $ID, $args['image_size'], false, $args['attr'] ); - - if ( empty( $html ) ) { - return ''; - } - - return $args['before'] . $html . $args['after']; -} - - -/** - * Queried Term Image ID. - * - * Designed to be used in archive templates including - * (but not limited to) archive.php, category.php, tag.php, - * taxonomy.php as well as derivatives of these templates. - * - * Returns an integer representing the image attachment's ID. - * In the event that an image has been associated zero will - * be returned. - * - * This function should never be called directly in any file - * however it may be access in any template file via the - * 'sermon-images-queried-term-image-id' filter. - * - * @param mixed Default value for apply_filters() to return. Unused. - * - * @return int Image attachment's ID. - * - * @access private Use the 'sermon-images-queried-term-image-id' filter. - * @since 0.7 - */ -function sermon_images_plugin_get_queried_term_image_id( $default ) { - $filter = 'sermon-images-queried-term-image-id'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $obj = get_queried_object(); - - /* Return early is we are not in a term archive. */ - if ( ! isset( $obj->term_taxonomy_id ) ) { - // translators: %1$s see msgid "term_taxonomy_id", effectively term_taxonomy_id - // translators: %2$s effectively - // translators: %3$s effectively category.php - // translators: %4$s effectively tag.php - // translators: %5$s effectively taxonomy.php - // translators: %6$s see msgid "template hierarchy" - trigger_error( wp_sprintf( esc_html__( '%1$s is not a property of the current queried object. This usually happens when the %2$s filter is used in an unsupported template file. This filter has been designed to work in taxonomy archives which are traditionally served by one of the following template files: %3$s, %4$s or %5$s. Learn more about %6$s.', 'sermon-manager-for-wordpress' ), - '' . esc_html__( 'term_taxonomy_id', 'sermon-manager-for-wordpress' ) . '', - '' . esc_html( $filter ) . '', - 'category.php', - 'tag.php', - 'taxonomy.php', - '' . esc_html__( 'template hierarchy', 'sermon-manager-for-wordpress' ) . '' - ) ); - - return 0; - } - - if ( ! sermon_image_plugin_check_taxonomy( $obj->taxonomy, $filter ) ) { - return 0; - } - - $associations = sermon_image_plugin_get_associations(); - $tt_id = absint( $obj->term_taxonomy_id ); - - $ID = 0; - if ( array_key_exists( $tt_id, $associations ) ) { - $ID = absint( $associations[ $tt_id ] ); - } - - return $ID; -} - - -/** - * Queried Term Image Object. - * - * Returns all data stored in the WordPress posts table for - * the image associated with the term in object form. In the - * event that no image is found an empty object will be returned. - * - * Designed to be used in archive templates including - * (but not limited to) archive.php, category.php, tag.php, - * taxonomy.php as well as derivatives of these templates. - * - * This function should never be called directly in any file - * however it may be access in any template file via the - * 'sermon-images-queried-term-image' filter. - * - * @param mixed Default value for apply_filters() to return. Unused. - * - * @return stdClass WordPress Post object. - * - * @access private Use the 'sermon-images-queried-term-image-object' filter. - * @since 0.7 - */ -function sermon_images_plugin_get_queried_term_image_object( $default ) { - $filter = 'sermon-images-queried-term-image-object'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $ID = apply_filters( 'sermon-images-queried-term-image-id', 0 ); - - $image = new stdClass; - if ( ! empty( $ID ) ) { - $image = get_post( $ID ); - } - - return $image; -} - -/** - * Queried Term Image URL. - * - * Returns a url to the image associated with the current queried - * term. In the event that no image is found an empty string will - * be returned. - * - * Designed to be used in archive templates including - * (but not limited to) archive.php, category.php, tag.php, - * taxonomy.php as well as derivatives of these templates. - * - * Recognized Arguments - * - * image_size (string) - May be any image size registered with - * WordPress. If no image size is specified, 'thumbnail' will be - * used as a default value. In the event that an unregistered size - * is specified, this function will return an empty string. - * - * @param mixed Default value for apply_filters() to return. Unused. - * @param array Named Arguments. - * - * @return string Image URL. - * - * @access private Use the 'sermon-images-queried-term-image-url' filter. - * @since 0.7 - */ -function sermon_images_plugin_get_queried_term_image_url( $default, $args = array() ) { - $filter = 'sermon-images-queried-term-image-url'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $args = wp_parse_args( $args, array( - 'image_size' => 'thumbnail', - ) ); - - $data = apply_filters( 'sermon-images-queried-term-image-data', array(), $args ); - - $url = ''; - if ( isset( $data['url'] ) ) { - $url = $data['url']; - } - - return $url; -} - - -/** - * Queried Term Image Data. - * - * Returns a url to the image associated with the current queried - * term. In the event that no image is found an empty string will - * be returned. - * - * Designed to be used in archive templates including - * (but not limited to) archive.php, category.php, tag.php, - * taxonomy.php as well as derivatives of these templates. - * - * Recognized Arguments - * - * image_size (string) - May be any image size registered with - * WordPress. If no image size is specified, 'thumbnail' will be - * used as a default value. In the event that an unregistered size - * is specified, this function will return an empty array. - * - * @param mixed Default value for apply_filters() to return. Unused. - * @param array Named Arguments. - * - * @return array Image data: url, width and height. - * - * @access private Use the 'sermon-images-queried-term-image-data' filter. - * @since 0.7 - * @alter 0.7.2 - */ -function sermon_images_plugin_get_queried_term_image_data( $default, $args = array() ) { - $filter = 'sermon-images-queried-term-image-data'; - if ( $filter !== current_filter() ) { - sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); - } - - $args = wp_parse_args( $args, array( - 'image_size' => 'thumbnail', - ) ); - - $ID = apply_filters( 'sermon-images-queried-term-image-id', 0 ); - - if ( empty( $ID ) ) { - return array(); - } - - $data = array(); - - if ( in_array( $args['image_size'], array( 'full', 'fullsize' ) ) ) { - $src = wp_get_attachment_image_src( $ID, 'full' ); - - if ( isset( $src[0] ) ) { - $data['url'] = $src[0]; - } - if ( isset( $src[1] ) ) { - $data['width'] = $src[1]; - } - if ( isset( $src[2] ) ) { - $data['height'] = $src[2]; - } - } else { - $data = image_get_intermediate_size( $ID, $args['image_size'] ); - } - - if ( ! empty( $data ) ) { - return $data; - } - - return array(); -} + + * @copyright Copyright (c) 2011, Michael Fields + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License + * @since 0.7 + */ + + +add_filter( 'sermon-images-get-terms', 'sermon_images_plugin_get_terms', 10, 2 ); +add_filter( 'sermon-images-get-the-terms', 'sermon_images_plugin_get_the_terms', 10, 2 ); +add_filter( 'sermon-images-list-the-terms', 'sermon_images_plugin_list_the_terms', 10, 2 ); + +add_filter( 'sermon-images-queried-term-image', 'sermon_images_plugin_get_queried_term_image', 10, 2 ); +add_filter( 'sermon-images-queried-term-image-data', 'sermon_images_plugin_get_queried_term_image_data', 10, 2 ); +add_filter( 'sermon-images-queried-term-image-id', 'sermon_images_plugin_get_queried_term_image_id' ); +add_filter( 'sermon-images-queried-term-image-object', 'sermon_images_plugin_get_queried_term_image_object' ); +add_filter( 'sermon-images-queried-term-image-url', 'sermon_images_plugin_get_queried_term_image_url', 10, 2 ); + + +/** + * Get Terms. + * + * This function adds a custom property (image_id) to each + * object returned by WordPress core function get_terms(). + * This property will be set for all term objects. In cases + * where a term has an associated image, "image_id" will + * contain the value of the image object's ID property. If + * no image has been associated, this property will contain + * integer with the value of zero. + * + * Recognized Arguments: + * + * cache_images (bool) A non-empty value will trigger + * this function to query for and cache all associated + * images. An empty value disables caching. Defaults to + * boolean true. + * + * having_images (bool) A non-empty value will trigger + * this function to only return terms that have associated + * images. If an empty value is passed all terms of the + * taxonomy will be returned. + * + * taxonomy (string) Name of a registered taxonomy to + * return terms from. Defaults to "category". + * + * term_args (array) Arguments to pass as the second + * parameter of get_terms(). Defaults to an empty array. + * + * @param mixed Default value for apply_filters() to return. Unused. + * @param array Named arguments. Please see above for explantion. + * + * @return array List of term objects. + * + * @access private Use the 'sermon-images-get-terms' filter. + * @since 0.7 + */ +function sermon_images_plugin_get_terms( $default, $args = array() ) { + $filter = 'sermon-images-get-terms'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $args = wp_parse_args( $args, array( + 'cache_images' => true, + 'having_images' => true, + 'taxonomy' => 'wpfc_sermon_series', + 'term_args' => array(), + ) ); + + $args['taxonomy'] = explode( ',', $args['taxonomy'] ); + $args['taxonomy'] = array_map( 'trim', $args['taxonomy'] ); + + foreach ( $args['taxonomy'] as $taxonomy ) { + if ( ! sermon_image_plugin_check_taxonomy( $taxonomy, $filter ) ) { + return array(); + } + } + + $assoc = sermon_image_plugin_get_associations(); + if ( empty( $assoc ) ) { + return array(); + } + + $terms = get_terms( $args['taxonomy'], $args['term_args'] ); + if ( is_wp_error( $terms ) ) { + return array(); + } + + $image_ids = array(); + $terms_with_images = array(); + foreach ( (array) $terms as $key => $term ) { + $terms[ $key ]->image_id = 0; + if ( array_key_exists( $term->term_taxonomy_id, $assoc ) ) { + $terms[ $key ]->image_id = $assoc[ $term->term_taxonomy_id ]; + $image_ids[] = $assoc[ $term->term_taxonomy_id ]; + if ( ! empty( $args['having_images'] ) ) { + $terms_with_images[] = $terms[ $key ]; + } + } + } + $image_ids = array_unique( $image_ids ); + + if ( ! empty( $args['cache_images'] ) ) { + $images = array(); + if ( ! empty( $image_ids ) ) { + $images = get_children( array( 'include' => implode( ',', $image_ids ) ) ); + } + } + + if ( ! empty( $terms_with_images ) ) { + return $terms_with_images; + } + + return $terms; +} + + +/** + * Get the Terms. + * + * This function adds a custom property (image_id) to each + * object returned by WordPress core function get_the_terms(). + * This property will be set for all term objects. In cases + * where a term has an associated image, "image_id" will + * contain the value of the image object's ID property. If + * no image has been associated, this property will contain + * integer with the value of zero. + * + * Recognized Arguments: + * + * having_images (bool) A non-empty value will trigger + * this function to only return terms that have associated + * images. If an empty value is passed all terms of the + * taxonomy will be returned. Optional. + * + * post_id (int) The post to retrieve terms from. Defaults + * to the ID property of the global $post object. Optional. + * + * taxonomy (string) Name of a registered taxonomy to + * return terms from. Defaults to "category". Optional. + * + * @param mixed Default value for apply_filters() to return. Unused. + * @param array Named arguments. Please see above for explantion. + * + * @return array List of term objects. Empty array if none were found. + * + * @access private Use the 'sermon-images-get-the-terms' filter. + * @since 0.7 + */ +function sermon_images_plugin_get_the_terms( $default, $args ) { + $filter = 'sermon-images-get-the-terms'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $args = wp_parse_args( $args, array( + 'having_images' => true, + 'post_id' => 0, + 'taxonomy' => 'wpfc_sermon_series', + ) ); + + if ( ! sermon_image_plugin_check_taxonomy( $args['taxonomy'], $filter ) ) { + return array(); + } + + $assoc = sermon_image_plugin_get_associations(); + + if ( empty( $args['post_id'] ) ) { + $args['post_id'] = get_the_ID(); + } + + $terms = get_the_terms( $args['post_id'], $args['taxonomy'] ); + + if ( is_wp_error( $terms ) ) { + return array(); + } + + if ( empty( $terms ) ) { + return array(); + } + + $terms_with_images = array(); + foreach ( (array) $terms as $key => $term ) { + $terms[ $key ]->image_id = 0; + if ( array_key_exists( $term->term_taxonomy_id, $assoc ) ) { + $terms[ $key ]->image_id = $assoc[ $term->term_taxonomy_id ]; + if ( ! empty( $args['having_images'] ) ) { + $terms_with_images[] = $terms[ $key ]; + } + } + } + if ( ! empty( $terms_with_images ) ) { + return $terms_with_images; + } + + return $terms; +} + + +/** + * List the Terms. + * + * Lists all terms associated with a given post that + * have associated images. Terms without images will + * not be included. + * + * Recognized Arguments: + * + * after (string) Text to append to the output. Optional. + * Defaults to an empty string. + * + * before (string) Text to preppend to the output. Optional. + * Defaults to an empty string. + * + * image_size (string) Any registered image size. Values will + * vary from installation to installation. Image sizes defined + * in core include: "thumbnail", "medium" and "large". "Fullsize" + * may also be used to get the un modified image that was uploaded. + * Optional. Defaults to "thumbnail". + * + * post_id (int) The post to retrieve terms from. Defaults + * to the ID property of the global $post object. Optional. + * + * taxonomy (string) Name of a registered taxonomy to + * return terms from. Defaults to "category". Optional. + * + * @param mixed Default value for apply_filters() to return. Unused. + * @param array Named arguments. Please see above for explantion. + * + * @return string HTML markup. + * + * @access private Use the 'sermon-images-list-the-terms' filter. + * @since 0.7 + */ +function sermon_images_plugin_list_the_terms( $default, $args ) { + $filter = 'sermon-images-list-the-terms'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $args = wp_parse_args( $args, array( + 'after' => '
', + 'after_image' => '', + 'before' => '
    ', + 'before_image' => '
  • ', + 'image_size' => 'thumbnail', + 'post_id' => 0, + 'taxonomy' => 'wpfc_sermon_series', + ) ); + + $args['having_images'] = true; + + if ( ! sermon_image_plugin_check_taxonomy( $args['taxonomy'], $filter ) ) { + return ''; + } + + $terms = apply_filters( 'sermon-images-get-the-terms', '', $args ); + + if ( empty( $terms ) ) { + return ''; + } + + $output = ''; + foreach ( $terms as $term ) { + if ( ! isset( $term->image_id ) ) { + continue; + } + $image = wp_get_attachment_image( $term->image_id, $args['image_size'] ); + if ( ! empty( $image ) ) { + $output .= $args['before_image'] . '' . $image . '' . $args['after_image']; + } + } + + if ( ! empty( $output ) ) { + return $args['before'] . $output . $args['after']; + } + + return ''; +} + + +/** + * Queried Term Image. + * + * Prints html marking up the images associated with + * the current queried term. + * + * Recognized Arguments: + * + * after (string) - Text to append to the image's HTML. + * + * before (string) - Text to prepend to the image's HTML. + * + * image_size (string) - May be any image size registered with + * WordPress. If no image size is specified, 'thumbnail' will be + * used as a default value. In the event that an unregistered size + * is specified, this function will return an empty string. + * + * Designed to be used in archive templates including + * (but not limited to) archive.php, + * taxonomy.php as well as derivatives of these templates. + * + * @param mixed Default value for apply_filters() to return. Unused. + * @param array Named array of arguments. + * + * @return string HTML markup for the associated image. + * + * @access private Use the 'sermon-images-queried-term-image' filter. + * @since 0.7 + */ +function sermon_images_plugin_get_queried_term_image( $default, $args = array() ) { + $filter = 'sermon-images-queried-term-image'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $args = wp_parse_args( $args, array( + 'after' => '', + 'attr' => array(), + 'before' => '', + 'image_size' => 'thumbnail', + ) ); + + $ID = apply_filters( 'sermon-images-queried-term-image-id', 0 ); + + if ( empty( $ID ) ) { + return ''; + } + + $html = wp_get_attachment_image( $ID, $args['image_size'], false, $args['attr'] ); + + if ( empty( $html ) ) { + return ''; + } + + return $args['before'] . $html . $args['after']; +} + + +/** + * Queried Term Image ID. + * + * Designed to be used in archive templates including + * (but not limited to) archive.php, category.php, tag.php, + * taxonomy.php as well as derivatives of these templates. + * + * Returns an integer representing the image attachment's ID. + * In the event that an image has been associated zero will + * be returned. + * + * This function should never be called directly in any file + * however it may be access in any template file via the + * 'sermon-images-queried-term-image-id' filter. + * + * @param mixed Default value for apply_filters() to return. Unused. + * + * @return int Image attachment's ID. + * + * @access private Use the 'sermon-images-queried-term-image-id' filter. + * @since 0.7 + */ +function sermon_images_plugin_get_queried_term_image_id( $default ) { + $filter = 'sermon-images-queried-term-image-id'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $obj = get_queried_object(); + + /* Return early is we are not in a term archive. */ + if ( ! isset( $obj->term_taxonomy_id ) ) { + // translators: %1$s see msgid "term_taxonomy_id", effectively term_taxonomy_id + // translators: %2$s effectively + // translators: %3$s effectively category.php + // translators: %4$s effectively tag.php + // translators: %5$s effectively taxonomy.php + // translators: %6$s see msgid "template hierarchy" + trigger_error( wp_sprintf( esc_html__( '%1$s is not a property of the current queried object. This usually happens when the %2$s filter is used in an unsupported template file. This filter has been designed to work in taxonomy archives which are traditionally served by one of the following template files: %3$s, %4$s or %5$s. Learn more about %6$s.', 'sermon-manager-for-wordpress' ), + '' . esc_html__( 'term_taxonomy_id', 'sermon-manager-for-wordpress' ) . '', + '' . esc_html( $filter ) . '', + 'category.php', + 'tag.php', + 'taxonomy.php', + '' . esc_html__( 'template hierarchy', 'sermon-manager-for-wordpress' ) . '' + ) ); + + return 0; + } + + if ( ! sermon_image_plugin_check_taxonomy( $obj->taxonomy, $filter ) ) { + return 0; + } + + $associations = sermon_image_plugin_get_associations(); + $tt_id = absint( $obj->term_taxonomy_id ); + + $ID = 0; + if ( array_key_exists( $tt_id, $associations ) ) { + $ID = absint( $associations[ $tt_id ] ); + } + + return $ID; +} + + +/** + * Queried Term Image Object. + * + * Returns all data stored in the WordPress posts table for + * the image associated with the term in object form. In the + * event that no image is found an empty object will be returned. + * + * Designed to be used in archive templates including + * (but not limited to) archive.php, category.php, tag.php, + * taxonomy.php as well as derivatives of these templates. + * + * This function should never be called directly in any file + * however it may be access in any template file via the + * 'sermon-images-queried-term-image' filter. + * + * @param mixed Default value for apply_filters() to return. Unused. + * + * @return stdClass WordPress Post object. + * + * @access private Use the 'sermon-images-queried-term-image-object' filter. + * @since 0.7 + */ +function sermon_images_plugin_get_queried_term_image_object( $default ) { + $filter = 'sermon-images-queried-term-image-object'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $ID = apply_filters( 'sermon-images-queried-term-image-id', 0 ); + + $image = new stdClass; + if ( ! empty( $ID ) ) { + $image = get_post( $ID ); + } + + return $image; +} + +/** + * Queried Term Image URL. + * + * Returns a url to the image associated with the current queried + * term. In the event that no image is found an empty string will + * be returned. + * + * Designed to be used in archive templates including + * (but not limited to) archive.php, category.php, tag.php, + * taxonomy.php as well as derivatives of these templates. + * + * Recognized Arguments + * + * image_size (string) - May be any image size registered with + * WordPress. If no image size is specified, 'thumbnail' will be + * used as a default value. In the event that an unregistered size + * is specified, this function will return an empty string. + * + * @param mixed Default value for apply_filters() to return. Unused. + * @param array Named Arguments. + * + * @return string Image URL. + * + * @access private Use the 'sermon-images-queried-term-image-url' filter. + * @since 0.7 + */ +function sermon_images_plugin_get_queried_term_image_url( $default, $args = array() ) { + $filter = 'sermon-images-queried-term-image-url'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $args = wp_parse_args( $args, array( + 'image_size' => 'thumbnail', + ) ); + + $data = apply_filters( 'sermon-images-queried-term-image-data', array(), $args ); + + $url = ''; + if ( isset( $data['url'] ) ) { + $url = $data['url']; + } + + return $url; +} + + +/** + * Queried Term Image Data. + * + * Returns a url to the image associated with the current queried + * term. In the event that no image is found an empty string will + * be returned. + * + * Designed to be used in archive templates including + * (but not limited to) archive.php, category.php, tag.php, + * taxonomy.php as well as derivatives of these templates. + * + * Recognized Arguments + * + * image_size (string) - May be any image size registered with + * WordPress. If no image size is specified, 'thumbnail' will be + * used as a default value. In the event that an unregistered size + * is specified, this function will return an empty array. + * + * @param mixed Default value for apply_filters() to return. Unused. + * @param array Named Arguments. + * + * @return array Image data: url, width and height. + * + * @access private Use the 'sermon-images-queried-term-image-data' filter. + * @since 0.7 + * @alter 0.7.2 + */ +function sermon_images_plugin_get_queried_term_image_data( $default, $args = array() ) { + $filter = 'sermon-images-queried-term-image-data'; + if ( $filter !== current_filter() ) { + sermon_image_plugin_please_use_filter( __FUNCTION__, $filter ); + } + + $args = wp_parse_args( $args, array( + 'image_size' => 'thumbnail', + ) ); + + $ID = apply_filters( 'sermon-images-queried-term-image-id', 0 ); + + if ( empty( $ID ) ) { + return array(); + } + + $data = array(); + + if ( in_array( $args['image_size'], array( 'full', 'fullsize' ) ) ) { + $src = wp_get_attachment_image_src( $ID, 'full' ); + + if ( isset( $src[0] ) ) { + $data['url'] = $src[0]; + } + if ( isset( $src[1] ) ) { + $data['width'] = $src[1]; + } + if ( isset( $src[2] ) ) { + $data['height'] = $src[2]; + } + } else { + $data = image_get_intermediate_size( $ID, $args['image_size'] ); + } + + if ( ! empty( $data ) ) { + return $data; + } + + return array(); +} diff --git a/includes/taxonomy-images/taxonomy-images.php b/includes/vendor/taxonomy-images/taxonomy-images.php similarity index 100% rename from includes/taxonomy-images/taxonomy-images.php rename to includes/vendor/taxonomy-images/taxonomy-images.php diff --git a/includes/libraries/wp-async-request.php b/includes/vendor/wp-async-request.php similarity index 100% rename from includes/libraries/wp-async-request.php rename to includes/vendor/wp-async-request.php diff --git a/includes/libraries/wp-background-process.php b/includes/vendor/wp-background-process.php similarity index 100% rename from includes/libraries/wp-background-process.php rename to includes/vendor/wp-background-process.php diff --git a/sermons.php b/sermons.php index 083eb49..5641eb9 100755 --- a/sermons.php +++ b/sermons.php @@ -302,51 +302,33 @@ public function __construct() { */ private function _includes() { /** - * Files to include on frontend and backend + * General includes */ - $includes = array( - 'includes/class-sm-autoloader.php', // Autoloader - 'includes/sm-core-functions.php', // Core Sermon Manager functions - 'includes/class-sm-dates.php', // Dates operations - 'includes/class-sm-dates-wp.php', // Attach to WP filters - 'includes/class-sm-api.php', // API - 'includes/class-sm-post-types.php', // Register post type, taxonomies, etc - 'includes/class-sm-install.php', // Install and update functions - 'includes/sm-deprecated-functions.php', // Deprecated SM functions - 'includes/sm-formatting-functions.php', // Data formatting - 'includes/sm-cmb-functions.php', // CMB2 Meta Fields functions - 'includes/taxonomy-images/taxonomy-images.php', // Images for Custom Taxonomies - 'includes/entry-views.php', // Entry Views Tracking - 'includes/shortcodes.php', // Shortcodes - 'includes/widgets.php', // Widgets - 'includes/sm-template-functions.php', // Template functions - 'includes/podcast-functions.php', // Podcast Functions - 'includes/helper-functions.php', // Global Helper Functions - ); + include 'includes/class-sm-autoloader.php'; // Autoloader + include 'includes/sm-core-functions.php'; // Core Sermon Manager functions + include 'includes/class-sm-dates.php'; // Dates operations + include 'includes/class-sm-dates-wp.php'; // Attach to WP filters + include 'includes/class-sm-api.php'; // API + include 'includes/class-sm-post-types.php'; // Register post type, taxonomies, etc + include 'includes/class-sm-install.php'; // Install and update functions + include 'includes/sm-deprecated-functions.php'; // Deprecated SM functions + include 'includes/sm-formatting-functions.php'; // Data formatting + include 'includes/sm-cmb-functions.php'; // CMB2 Meta Fields functions + include 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies + include 'includes/entry-views.php'; // Entry Views Tracking + include 'includes/shortcodes.php'; // Shortcodes + include 'includes/widgets.php'; // Widgets + include 'includes/sm-template-functions.php'; // Template functions + include 'includes/podcast-functions.php'; // Podcast Functions + include 'includes/helper-functions.php'; // Global Helper Functions /** * Admin only includes */ - $admin_includes = array( - 'includes/admin/class-sm-admin.php', // Admin init class - 'includes/admin-functions.php', // General Admin area functions - todo: refactor before 2.9 - 'includes/CMB2/init.php', // Metaboxes - ); - - // Load files - foreach ( $includes as $file ) { - if ( file_exists( SM_PATH . $file ) ) { - require_once SM_PATH . $file; - } - } - - // Load admin files if ( is_admin() ) { - foreach ( $admin_includes as $file ) { - if ( file_exists( SM_PATH . $file ) ) { - require_once SM_PATH . $file; - } - } + include 'includes/admin/class-sm-admin.php'; // Admin init class + include 'includes/admin-functions.php'; // General Admin area functions - todo: refactor before 2.9 + include 'includes/vendor/CMB2/init.php'; // Metaboxes } } @@ -538,15 +520,13 @@ public static function enqueue_scripts_styles() { wp_enqueue_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION ); wp_enqueue_style( 'dashicons' ); - wp_enqueue_script( 'wpfc-sm-additional_classes', SM_URL . 'assets/js/additional_classes.js', array(), SM_VERSION, true ); - // load theme-specific styling, if there's any if ( file_exists( SM_PATH . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css' ) ) { wp_enqueue_style( 'wpfc-sm-style-' . get_option( 'template' ), SM_URL . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css', array( 'wpfc-sm-styles' ), SM_VERSION ); } } - wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/js/facebook-video.js', array(), SM_VERSION ); + wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION ); switch ( \SermonManager::getOption( 'player' ) ) { case 'mediaelement': @@ -555,15 +535,15 @@ public static function enqueue_scripts_styles() { break; case 'plyr': - wp_enqueue_script( 'wpfc-sm-plyr', SM_URL . 'assets/js/plyr' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), SM_VERSION, \SermonManager::getOption( 'player_js_footer' ) ); - wp_enqueue_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/css/plyr.min.css', array(), SM_VERSION ); + wp_enqueue_script( 'wpfc-sm-plyr', SM_URL . 'assets/vendor/js/plyr' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), SM_VERSION, \SermonManager::getOption( 'player_js_footer' ) ); + wp_enqueue_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), SM_VERSION ); wp_add_inline_script( 'wpfc-sm-plyr', "window.addEventListener('DOMContentLoaded',function(){var players=plyr.setup(document.querySelectorAll('.wpfc-sermon-player,.wpfc-sermon-video-player'),{\"debug\": " . ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ? 'true' : 'false' ) . "});for(var p in players){if(players.hasOwnProperty(p)){players[p].on('loadedmetadata ready',function(event){if(typeof this.firstChild.dataset.plyr_seek !== 'undefined'){var instance=event.detail.plyr;instance.seek(parseInt(this.firstChild.dataset.plyr_seek));}});}}})" ); break; } if ( ! \SermonManager::getOption( 'verse_popup' ) ) { - wp_enqueue_script( 'wpfc-sm-verse-script', SM_URL . 'assets/js/verse.js', array(), SM_VERSION ); + wp_enqueue_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION ); // get options for JS $bible_version = \SermonManager::getOption( 'verse_bible_version' ); From 4e0bde329afacc204558c87c6262a1bee8a253ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 14:40:40 +0200 Subject: [PATCH 005/119] Fix include path --- includes/vendor/CMB2/includes/CMB2_Utils.php | 2 +- includes/vendor/taxonomy-images/taxonomy-images.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/vendor/CMB2/includes/CMB2_Utils.php b/includes/vendor/CMB2/includes/CMB2_Utils.php index fd2fa1d..d34f4e0 100755 --- a/includes/vendor/CMB2/includes/CMB2_Utils.php +++ b/includes/vendor/CMB2/includes/CMB2_Utils.php @@ -260,7 +260,7 @@ public static function array_insert( &$array, $new, $position ) { */ public static function url( $path = '' ) { // SM: Seems like CMB2 doesn't return a correct URL. This should fix it. - return str_replace( site_url(), '', SM_URL ) . 'includes/CMB2/' . $path; + return str_replace( site_url(), '', SM_URL ) . 'includes/vendor/CMB2/' . $path; if ( self::$url ) { return self::$url . $path; diff --git a/includes/vendor/taxonomy-images/taxonomy-images.php b/includes/vendor/taxonomy-images/taxonomy-images.php index fa62fee..53aac6f 100644 --- a/includes/vendor/taxonomy-images/taxonomy-images.php +++ b/includes/vendor/taxonomy-images/taxonomy-images.php @@ -939,7 +939,7 @@ function sermon_image_plugin_css_admin() { wp_enqueue_style( 'sermon-image-plugin-edit-tags', - sermon_image_plugin_url( 'css/admincss' ), + sermon_image_plugin_url( 'css/admin.css' ), array(), sermon_image_plugin_version(), 'screen' From 9da7104d5ffda21fa9420e5c2553952c108fa7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 14:41:19 +0200 Subject: [PATCH 006/119] Update changelog --- readme.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/readme.txt b/readme.txt index 7c51dab..daff61b 100755 --- a/readme.txt +++ b/readme.txt @@ -102,6 +102,12 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man 2. Sermon Files ## Changelog ## +### 2.13.0 ### +* Fix: Taxonomy image assignment not working +* Dev: Add more hooks +* Dev: Add PHPUnit configuration +* Dev: Add WPCS configuration + ### 2.12.5 ### * Change: Add Previous/Next sermon navigation * Change: Add `hide_title` parameter for `[sermon_images]` shortcode From c264df426f4abb78cb086c19cc2903da8f4132c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Wed, 4 Apr 2018 23:47:38 +0200 Subject: [PATCH 007/119] Add more hooks --- includes/admin/class-sm-admin-assets.php | 4 ++++ includes/admin/class-sm-admin-post-types.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/includes/admin/class-sm-admin-assets.php b/includes/admin/class-sm-admin-assets.php index 864fe67..49a42c3 100644 --- a/includes/admin/class-sm-admin-assets.php +++ b/includes/admin/class-sm-admin-assets.php @@ -23,6 +23,8 @@ public function admin_styles() { // Enqueue styles for Sermon Manager pages only if ( in_array( $screen_id, sm_get_screen_ids() ) ) { wp_enqueue_style( 'sm_admin_styles' ); + + do_action( 'sm_enqueue_admin_css' ); } } @@ -36,6 +38,8 @@ public function admin_scripts() { // Enqueue scripts for Sermon Manager pages only if ( in_array( $screen_id, sm_get_screen_ids() ) ) { // todo: move php notice script here, but register it first above + + do_action('sm_enqueue_admin_js'); } } } diff --git a/includes/admin/class-sm-admin-post-types.php b/includes/admin/class-sm-admin-post-types.php index 17d2381..05213ef 100644 --- a/includes/admin/class-sm-admin-post-types.php +++ b/includes/admin/class-sm-admin-post-types.php @@ -29,6 +29,8 @@ public function __construct() { add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 ); //include_once 'class-sm-admin-meta-boxes.php'; + + do_action('after_sm_admin_post_types'); } /** From 8486a492bf14fd3e6ceefd2be55982367740a439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 15:22:53 +0200 Subject: [PATCH 008/119] Code Style: check and fix CSS files --- assets/css/admin-partials/_import-export.scss | 5 ++--- assets/css/admin-partials/_settings.scss | 1 + assets/css/admin.min.css | 2 +- assets/css/admin.min.css.map | 2 +- assets/css/partials/_single.scss | 2 ++ assets/css/sermon.min.css.map | 2 +- assets/css/theme-specific/twentyfourteen.css | 1 + 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/assets/css/admin-partials/_import-export.scss b/assets/css/admin-partials/_import-export.scss index d72af0a..975580c 100644 --- a/assets/css/admin-partials/_import-export.scss +++ b/assets/css/admin-partials/_import-export.scss @@ -95,16 +95,15 @@ margin-top: 1rem; } } - + .wp-upload-form { display: none; } - + .import-sniper { line-height: 1; vertical-align: middle; width: 13px; - display: inline-block; position: relative; top: -1px; display: none; diff --git a/assets/css/admin-partials/_settings.scss b/assets/css/admin-partials/_settings.scss index a46a38e..5e19607 100644 --- a/assets/css/admin-partials/_settings.scss +++ b/assets/css/admin-partials/_settings.scss @@ -10,6 +10,7 @@ .settings-content { width: 100%; + //noinspection SpellCheckingInspection #mainform { border: 1px solid #e8e8e8; } diff --git a/assets/css/admin.min.css b/assets/css/admin.min.css index 93874ea..7465973 100644 --- a/assets/css/admin.min.css +++ b/assets/css/admin.min.css @@ -1,2 +1,2 @@ -body.edit-php.post-type-wpfc_sermon .fixed .column-preacher,body.edit-php.post-type-wpfc_sermon .fixed .column-preached{width:10%}body.edit-php.post-type-wpfc_sermon .fixed .column-series,body.edit-php.post-type-wpfc_sermon .fixed .column-topics{width:15%}body.edit-php.post-type-wpfc_sermon .fixed .column-views{width:7%}body.wpfc_sermon_page_sm-settings .wp-heading-inline{margin-bottom:5px}body.wpfc_sermon_page_sm-settings .settings-main{display:flex;margin-top:5px}body.wpfc_sermon_page_sm-settings .settings-content{width:100%}body.wpfc_sermon_page_sm-settings .settings-content #mainform{border:1px solid #e8e8e8}body.wpfc_sermon_page_sm-settings .settings-content span.description{display:block;margin-top:5px}body.wpfc_sermon_page_sm-settings .settings-content input[type=text],body.wpfc_sermon_page_sm-settings .settings-content input[type=email]{width:100%;max-width:400px}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper{background:white;padding:0;border-bottom:1px solid #e8e8e8}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab{float:none;border:none;margin:0;padding:20px 20px;display:inline-block;background:none;font-weight:normal;color:#666;font-size:13px}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab:hover,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab:active,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab:focus{border-bottom:2px solid #ccc;outline:none;box-shadow:none}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active:focus,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active:focus:active,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active:hover{border-bottom:2px solid #4abcf0}body.wpfc_sermon_page_sm-settings .settings-content .inside{padding:.2rem 1rem .01rem 1rem;background:white}body.wpfc_sermon_page_sm-settings .settings-side{width:30%;max-width:300px;margin-left:1rem}body.wpfc_sermon_page_sm-settings .settings-side .sm-box h3{margin-left:.8rem}body.wpfc_sermon_page_sm-settings .settings-side .sm-box .description{text-align:center;font-size:0.85em;padding:0.4rem 0 0}body.wpfc_sermon_page_sm-settings .settings-side .sm-box ol{list-style-type:circle}body.wpfc_sermon_page_sm-import-export .wp-list-table{overflow:hidden;height:100%}body.wpfc_sermon_page_sm-import-export .plugin-card{position:relative}body.wpfc_sermon_page_sm-import-export .plugin-card>h2{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);z-index:1;color:#4a4a4a !important;margin:0;font-size:1.7rem;font-weight:100;letter-spacing:2px;font-family:'Roboto', sans-serif;text-transform:uppercase;opacity:0;transition:opacity .2s;cursor:default;width:100%;text-align:center}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available:before{content:"";background:repeating-linear-gradient(45deg, rgba(0,0,0,0.05), rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.1) 10px, rgba(0,0,0,0.1) 20px);width:100%;height:100%;position:absolute;left:0;top:0;z-index:1}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available:hover>h2{opacity:1}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available:hover .plugin-card-top{-webkit-filter:blur(1px);filter:blur(1px)}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available *{color:#ccc}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available .plugin-icon{filter:opacity(0.2)}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top{padding:0}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top:hover .import-note{display:block}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .import-note{display:none;color:rgba(0,0,0,0.5)}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .name{margin-top:20px}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .desc,body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .name{margin-left:185px}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .action-links{top:0}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .plugin-icon{font-size:5rem;color:#656565;left:0;top:0;height:168px;width:168px;margin:-20px 20px 0 0}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .plugin-icon.dashicons{margin-top:1rem}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .wp-upload-form{display:none}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .import-sniper{line-height:1;vertical-align:middle;width:13px;display:inline-block;position:relative;top:-1px;display:none}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .import-sniper img{max-width:100%}body.post-php.post-type-wpfc_sermon #sermon_video_link{width:25em} +body.edit-php.post-type-wpfc_sermon .fixed .column-preacher,body.edit-php.post-type-wpfc_sermon .fixed .column-preached{width:10%}body.edit-php.post-type-wpfc_sermon .fixed .column-series,body.edit-php.post-type-wpfc_sermon .fixed .column-topics{width:15%}body.edit-php.post-type-wpfc_sermon .fixed .column-views{width:7%}body.wpfc_sermon_page_sm-settings .wp-heading-inline{margin-bottom:5px}body.wpfc_sermon_page_sm-settings .settings-main{display:flex;margin-top:5px}body.wpfc_sermon_page_sm-settings .settings-content{width:100%}body.wpfc_sermon_page_sm-settings .settings-content #mainform{border:1px solid #e8e8e8}body.wpfc_sermon_page_sm-settings .settings-content span.description{display:block;margin-top:5px}body.wpfc_sermon_page_sm-settings .settings-content input[type=text],body.wpfc_sermon_page_sm-settings .settings-content input[type=email]{width:100%;max-width:400px}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper{background:white;padding:0;border-bottom:1px solid #e8e8e8}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab{float:none;border:none;margin:0;padding:20px 20px;display:inline-block;background:none;font-weight:normal;color:#666;font-size:13px}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab:hover,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab:active,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab:focus{border-bottom:2px solid #ccc;outline:none;box-shadow:none}body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active:focus,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active:focus:active,body.wpfc_sermon_page_sm-settings .settings-content .sm-nav-tab-wrapper .nav-tab-active:hover{border-bottom:2px solid #4abcf0}body.wpfc_sermon_page_sm-settings .settings-content .inside{padding:.2rem 1rem .01rem 1rem;background:white}body.wpfc_sermon_page_sm-settings .settings-side{width:30%;max-width:300px;margin-left:1rem}body.wpfc_sermon_page_sm-settings .settings-side .sm-box h3{margin-left:.8rem}body.wpfc_sermon_page_sm-settings .settings-side .sm-box .description{text-align:center;font-size:0.85em;padding:0.4rem 0 0}body.wpfc_sermon_page_sm-settings .settings-side .sm-box ol{list-style-type:circle}body.wpfc_sermon_page_sm-import-export .wp-list-table{overflow:hidden;height:100%}body.wpfc_sermon_page_sm-import-export .plugin-card{position:relative}body.wpfc_sermon_page_sm-import-export .plugin-card>h2{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);z-index:1;color:#4a4a4a !important;margin:0;font-size:1.7rem;font-weight:100;letter-spacing:2px;font-family:'Roboto', sans-serif;text-transform:uppercase;opacity:0;transition:opacity .2s;cursor:default;width:100%;text-align:center}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available:before{content:"";background:repeating-linear-gradient(45deg, rgba(0,0,0,0.05), rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.1) 10px, rgba(0,0,0,0.1) 20px);width:100%;height:100%;position:absolute;left:0;top:0;z-index:1}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available:hover>h2{opacity:1}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available:hover .plugin-card-top{-webkit-filter:blur(1px);filter:blur(1px)}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available *{color:#ccc}body.wpfc_sermon_page_sm-import-export .plugin-card.not-available .plugin-icon{filter:opacity(0.2)}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top{padding:0}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top:hover .import-note{display:block}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .import-note{display:none;color:rgba(0,0,0,0.5)}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .name{margin-top:20px}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .desc,body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .name{margin-left:185px}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .action-links{top:0}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .plugin-icon{font-size:5rem;color:#656565;left:0;top:0;height:168px;width:168px;margin:-20px 20px 0 0}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .plugin-icon.dashicons{margin-top:1rem}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .wp-upload-form{display:none}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .import-sniper{line-height:1;vertical-align:middle;width:13px;position:relative;top:-1px;display:none}body.wpfc_sermon_page_sm-import-export .plugin-card .plugin-card-top .import-sniper img{max-width:100%}body.post-php.post-type-wpfc_sermon #sermon_video_link{width:25em} /*# sourceMappingURL=admin.min.css.map */ diff --git a/assets/css/admin.min.css.map b/assets/css/admin.min.css.map index 18a2909..44da695 100644 --- a/assets/css/admin.min.css.map +++ b/assets/css/admin.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "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", +"mappings": "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", "sources": ["admin-partials/_all-sermons.scss","admin-partials/_settings.scss","admin-partials/_import-export.scss","admin-partials/_add-edit-sermon.scss"], "names": [], "file": "admin.min.css" diff --git a/assets/css/partials/_single.scss b/assets/css/partials/_single.scss index 67eb2f7..b575609 100644 --- a/assets/css/partials/_single.scss +++ b/assets/css/partials/_single.scss @@ -27,6 +27,7 @@ margin: auto; } + //noinspection SpellCheckingInspection .mejs-video { margin: 0; } @@ -80,6 +81,7 @@ } } + //noinspection SpellCheckingInspection .player-mediaelement & { background: #222; diff --git a/assets/css/sermon.min.css.map b/assets/css/sermon.min.css.map index f2492ab..b0c8db7 100644 --- a/assets/css/sermon.min.css.map +++ b/assets/css/sermon.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "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", +"mappings": "AACE,2CAAqB,CACnB,OAAO,CAAE,CAAC,CACV,MAAM,CAAE,UAAU,CAElB,+CAAM,CACJ,MAAM,CAAE,WAAW,CAGrB,0DAAiB,CACf,MAAM,CAAE,SAAS,CAGnB,gDAAK,CACH,MAAM,CAAE,CAAC,CAKf,yBAA0B,CAEtB,+CAAM,CACJ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,UAAU,CAGpB,0DAAiB,CACf,MAAM,CAAE,CAAC,CAGX,kDAAO,CACL,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CACX,SAAS,CAAE,IAAI,EC/BnB,sBAAY,CACV,aAAa,CAAE,IAAI,CAGrB,kBAAQ,CACN,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAGpB,sBAAY,CACV,KAAK,CAAE,IAAI,CACX,eAAe,CAAE,KAAK,CACtB,mBAAmB,CAAE,MAAM,CAG7B,mBAAS,CACP,OAAO,CAAE,IAAI,CACb,qBAAqB,CAAE,OAAO,CAC9B,WAAW,CAAE,MAAM,CAGrB,yBAAe,CACb,UAAU,CAAE,MAAM,CAGpB,kBAAQ,CACN,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CAGZ,sBAAY,CACV,SAAS,CAAE,IAAI,CACf,OAAO,CAAE,GAAG,CAGd,wBAAc,CACZ,MAAM,CAAE,SAAS,CAGnB,sBAAY,CACV,MAAM,CAAE,OAAO,CAGjB,wBAAc,CACZ,SAAS,CAAE,IAAI,CACf,MAAM,CAAE,OAAO,CAEf,0BAAE,CACA,MAAM,CAAE,UAAU,CAElB,qCAAa,CACX,MAAM,CAAE,CAAC,CAKf,kBAAQ,CACN,UAAU,CAAE,IAAI,CAGlB,mBAAS,CACP,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,cAAc,CAE1B,0CAAuB,CACrB,OAAO,CAAE,YAAY,CACrB,QAAQ,CAAE,QAAQ,CAElB,iEAAyB,CACvB,OAAO,CAAE,GAAG,CACZ,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CAMf,8BAAI,CACF,aAAa,CAAE,GAAG,CAClB,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,cAAc,CAAE,MAAM,CACtB,OAAO,CAAE,YAAY,CAGvB,4BAAI,CACF,eAAe,CAAE,IAAI,CACrB,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,YAAY,CAIzB,+CACY,CACV,cAAc,CAAE,MAAM,CAGxB,+BAAqB,CACnB,UAAU,CAAE,KAAK,CACjB,MAAM,CAAE,cAAc,CAGxB,iBAAO,CACL,OAAO,CAAE,IAAI,CAGf,mEAEW,CACT,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,OAAO,CAAE,GAAG,CACZ,MAAM,CAAE,iBAAiB,CACzB,aAAa,CAAE,GAAG,CAItB,yBAA0B,CAEtB,kBAAQ,CACN,OAAO,CAAE,IAAI,CACb,SAAS,CAAE,QAAQ,CAGrB,kBAAQ,CACN,IAAI,CAAE,KAAK,CAGb,sBAAY,CACV,MAAM,CAAE,IAAI,CAGd,iBAAO,CACL,IAAI,CAAE,CAAC,EAKb,yBAAyB,CACvB,sBAAuB,CACrB,WAAW,CAAE,MAAM,EC/IrB,0BAAS,CACP,UAAU,CAAE,MAAM,CAGpB,wBAAO,CACL,MAAM,CAAE,eAAe,CAGzB,6BAAY,CACV,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,KAAK,CACb,SAAS,CAAE,IAAI,CACf,OAAO,CAAE,GAAG,CAGd,6BAAY,CACV,aAAa,CAAE,GAAG,CAGpB,yBAAQ,CACN,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CAGZ,6BAAU,CACR,MAAM,CAAE,IAAI,CAId,+BAAY,CACV,MAAM,CAAE,CAAC,CAIX,8CAA6B,CAC3B,KAAK,CAAE,IAAI,CACX,aAAa,CAAE,CAAC,CAChB,MAAM,CAAE,IAAI,CAGd,yBAAQ,CACN,UAAU,CAAE,MAAM,CAElB,6BAAM,CACJ,MAAM,CAAE,MAAM,CAIlB,yBAAQ,CACN,OAAO,CAAE,IAAI,CACb,eAAe,CAAE,MAAM,CAGzB,kCAAiB,CACf,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,MAAM,CACnB,IAAI,CAAE,IAAI,CACV,UAAU,CAAE,KAAK,CACjB,OAAO,CAAE,SAAS,CAClB,UAAU,CAAE,IAAI,CAChB,eAAe,CAAE,IAAI,CACrB,OAAO,CAAE,IAAI,CAGX,mDAAI,CACF,IAAI,CAAE,OAAe,CAIzB,oDAAoB,CAClB,UAAU,CAAE,IAAI,CAEhB,wDAAI,CACF,IAAI,CAAE,IAAkB,CAG1B,qCAAsC,CAPxC,oDAAoB,CAQhB,SAAS,CAAE,MAAM,CACjB,aAAa,CAAE,QAAQ,EAK3B,uDAAuB,CACrB,UAAU,CAAE,IAAI,CAEhB,6DAAQ,CACN,gBAAgB,CAAE,kBAAqB,CAGzC,2DAAI,CACF,IAAI,CAAE,IAAkB,CAI5B,+CAAe,CACb,MAAM,CAAE,iBAAiB,CACzB,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,cAAc,CAE1B,qDAAQ,CACN,UAAU,CAAE,OAAO,CAEnB,yDAAI,CACF,IAAI,CAAE,IAAkB,CAMhC,sCAAmB,CACjB,IAAI,CAAE,CAAC,CAGT,+BAAc,CACZ,UAAU,CAAE,IAAI,CAEhB,6CAAc,CACZ,UAAU,CAAE,CAAC,CAGf,4CAAa,CACX,aAAa,CAAE,CAAC,CAIpB,+BAAc,CACZ,UAAU,CAAE,OAAO,CACnB,MAAM,CAAE,cAAc,CACtB,OAAO,CAAE,IAAI,CACb,UAAU,CAAE,IAAI,CAGd,4GAAU,CACR,OAAO,CAAE,KAAK,CAGhB,mDAAE,CACA,MAAM,CAAE,CAAC,CAGX,4DAAW,CACT,WAAW,CAAE,IAAI,CAKvB,0BAAS,CACP,UAAU,CAAE,IAAI,CAGlB,8BAAa,CACX,UAAU,CAAE,cAAc,CAC1B,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,IAAI,CACb,qBAAqB,CAAE,OAAO,CAE9B,2CAAa,CACX,UAAU,CAAE,KAAK,CChKvB,mBAAoB,CAClB,OAAO,CAAE,IAAI,CACb,qBAAqB,CAAE,OAAO,CAC9B,QAAQ,CAAE,IAAI,CACd,OAAO,CAAE,CAAC,CAEV,oCAAiB,CACf,OAAO,CAAE,KAAK,CAEd,wCAAI,CACF,aAAa,CAAE,IAAI,CAIvB,oCAAiB,CACf,MAAM,CAAE,CAAC,CCHb,mBAAoB,CAClB,cAAc,CAAE,MAAM,CAEtB,sDAAqC,CACnC,OAAO,CAAE,IAAI", "sources": ["partials/_sorting.scss","partials/_archive.scss","partials/_single.scss","partials/_shortcodes.scss","sermon.scss"], "names": [], "file": "sermon.min.css" diff --git a/assets/css/theme-specific/twentyfourteen.css b/assets/css/theme-specific/twentyfourteen.css index 74b74be..c92d151 100644 --- a/assets/css/theme-specific/twentyfourteen.css +++ b/assets/css/theme-specific/twentyfourteen.css @@ -17,6 +17,7 @@ margin-bottom: 48px; } +/*noinspection SpellCheckingInspection*/ .full-width .site-content .hentry.has-post-thumbnail:first-child { margin-top: 0 !important; } \ No newline at end of file From a0d2d274697b28a46524d5ac2150b2b43581e985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 15:33:50 +0200 Subject: [PATCH 009/119] Code Style: check and fix JS files --- assets/js/admin/dismiss-php.js | 4 +++- assets/js/admin/dismiss-php.min.js | 1 + assets/js/admin/import-export.js | 2 +- assets/js/admin/import-export.min.js | 1 + assets/js/admin/settings.js | 2 +- assets/js/admin/settings.min.js | 1 + assets/js/admin/settings/podcast.js | 6 +----- assets/js/admin/settings/podcast.min.js | 1 + assets/js/admin/settings/verse.js | 12 +++++++++--- assets/js/admin/settings/verse.min.js | 1 + includes/admin/class-sm-admin-menus.php | 2 +- includes/admin/class-sm-admin-settings.php | 6 +++--- sermons.php | 2 +- 13 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 assets/js/admin/dismiss-php.min.js create mode 100644 assets/js/admin/import-export.min.js create mode 100644 assets/js/admin/settings.min.js create mode 100644 assets/js/admin/settings/podcast.min.js create mode 100644 assets/js/admin/settings/verse.min.js diff --git a/assets/js/admin/dismiss-php.js b/assets/js/admin/dismiss-php.js index 858fa00..da76b40 100644 --- a/assets/js/admin/dismiss-php.js +++ b/assets/js/admin/dismiss-php.js @@ -1,3 +1,5 @@ +var ajaxurl = typeof ajaxurl !== 'undefined' ? ajaxurl : ''; + // Modified from: https://wordpress.stackexchange.com/a/251191/111583 jQuery(function ($) { $(document).on('click', '.notice-wpfc-php .notice-dismiss', function () { @@ -9,4 +11,4 @@ jQuery(function ($) { } }); }); -}); \ No newline at end of file +}); diff --git a/assets/js/admin/dismiss-php.min.js b/assets/js/admin/dismiss-php.min.js new file mode 100644 index 0000000..3257cb0 --- /dev/null +++ b/assets/js/admin/dismiss-php.min.js @@ -0,0 +1 @@ +var ajaxurl=typeof ajaxurl!=="undefined"?ajaxurl:"";jQuery(function($){$(document).on("click",".notice-wpfc-php .notice-dismiss",function(){$.ajax(ajaxurl,{type:"POST",data:{action:"wpfc_php_notice_handler",type:$(this).closest(".notice-wpfc-php").data("notice")}})})}); \ No newline at end of file diff --git a/assets/js/admin/import-export.js b/assets/js/admin/import-export.js index ed92d2f..4d1da48 100644 --- a/assets/js/admin/import-export.js +++ b/assets/js/admin/import-export.js @@ -13,4 +13,4 @@ jQuery(document).ready(function () { submitButton.click(); }); } -}); \ No newline at end of file +}); diff --git a/assets/js/admin/import-export.min.js b/assets/js/admin/import-export.min.js new file mode 100644 index 0000000..6367b56 --- /dev/null +++ b/assets/js/admin/import-export.min.js @@ -0,0 +1 @@ +jQuery(document).ready(function(){var smImportForm=jQuery("#sm-import-upload-form");if(smImportForm.length){var fileField=smImportForm.find("#upload");var importTrigger=smImportForm.siblings("#sm-import-trigger");var submitButton=smImportForm.find("#submit");importTrigger.click(function(){fileField.click()});fileField.change(function(){importTrigger.find(".import-sniper").css("display","inline-block");importTrigger.attr("disabled",true);submitButton.click()})}}); \ No newline at end of file diff --git a/assets/js/admin/settings.js b/assets/js/admin/settings.js index f05dbc0..a7ba7c0 100644 --- a/assets/js/admin/settings.js +++ b/assets/js/admin/settings.js @@ -38,4 +38,4 @@ function podcast_redirect(show) { show ? temp.show() : temp.hide(); } -} \ No newline at end of file +} diff --git a/assets/js/admin/settings.min.js b/assets/js/admin/settings.min.js new file mode 100644 index 0000000..c112450 --- /dev/null +++ b/assets/js/admin/settings.min.js @@ -0,0 +1 @@ +jQuery("#enable_podcast_redirection").change(function(){podcast_redirect(this.checked)});jQuery(document).ready(function(){var check=jQuery("#enable_podcast_redirection");if(check.length){podcast_redirect(check.is(":checked"))}});function podcast_redirect(show){if(typeof show!=="boolean")return;var el=[jQuery("#podcast_redirection_old_url"),jQuery("#podcast_redirection_new_url")];for(var i=0;i __( 'The changes you made will be lost if you navigate away from this page.', 'sermon-manager-for-wordpress' ), diff --git a/sermons.php b/sermons.php index 5641eb9..e486840 100755 --- a/sermons.php +++ b/sermons.php @@ -63,7 +63,7 @@ public function __construct() { if ( is_admin() && ! get_option( 'dismissed-render_php_version_warning', 0 ) ) { add_action( 'admin_notices', array( $this, 'render_php_version_warning' ) ); add_action( 'admin_enqueue_scripts', function () { - wp_enqueue_script( 'wpfc-php-notice-handler', SM_URL . 'assets/js/admin/dismiss-php.js', array(), SM_VERSION ); + wp_enqueue_script( 'wpfc-php-notice-handler', SM_URL . 'assets/js/admin/dismiss-php' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), SM_VERSION ); } ); } } From d027d26ee8b2ff83a0c3a5d83019384fdf1af240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 16:17:36 +0200 Subject: [PATCH 010/119] Code Style: sermons.php --- phpcs.xml.dist | 6 + sermons.php | 355 +++++++++++++++++++++++-------------------------- 2 files changed, 176 insertions(+), 185 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 4f1d0e5..25f0302 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -14,4 +14,10 @@ */node_modules/* */vendor/* + + + + + + diff --git a/sermons.php b/sermons.php index e486840..3647769 100755 --- a/sermons.php +++ b/sermons.php @@ -11,86 +11,89 @@ * * Text Domain: sermon-manager-for-wordpress * Domain Path: /languages/ + * + * @package Sermon Manager/Core */ +// All files must be PHP 5.3 compatible! defined( 'ABSPATH' ) or die; -// All files must be PHP 5.3 compatible - -// Check the PHP version +// Check the PHP version. if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) { - if ( is_admin() && ! get_option( 'dismissed-render_php_version_warning', 0 ) ) { - add_action( 'admin_notices', 'sm_render_php_version_error' ); - } + add_action( 'admin_notices', 'sm_render_php_version_error' ); + /** + * Renders the error notice when PHP is less than 5.3 + * + * @since 2.8 + */ function sm_render_php_version_error() { ?> -
    -

    - PHP %s - // translators: %2$s required PHP version, see msgid "PHP %s", effectively PHP %s - wp_sprintf( esc_html__( 'You are running %1$s, but Sermon Manager requires at least %2$s.', 'sermon-manager-for-wordpress' ), '' . wp_sprintf( esc_html__( 'PHP %s', 'sermon-manager-for-wordpress' ), PHP_VERSION ) . '', '' . wp_sprintf( esc_html__( 'PHP %s', 'sermon-manager-for-wordpress' ), '5.3.0' ) . '' ); ?> -

    -
    +
    +

    + PHP %s. + // translators: %2$s required PHP version, see msgid "PHP %s", effectively PHP %s. + echo wp_sprintf( esc_html__( 'You are running %1$s, but Sermon Manager requires at least %2$s.', 'sermon-manager-for-wordpress' ), '' . wp_sprintf( esc_html__( 'PHP %s', 'sermon-manager-for-wordpress' ), PHP_VERSION ) . '', '' . wp_sprintf( esc_html__( 'PHP %s', 'sermon-manager-for-wordpress' ), '5.3.0' ) . '' ); + ?> +

    +
    _includes(); - // load translations + // Load translations. add_action( 'after_setup_theme', array( $this, 'load_translations' ) ); - // enqueue scripts & styles + // Enqueue scripts & styles. add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); add_action( 'wp_footer', array( $this, 'enqueue_scripts_styles' ) ); - // Append custom classes to individual sermons + // Append custom classes to individual sermons. add_filter( 'post_class', array( $this, 'add_additional_sermon_classes' ), 10, 3 ); - // Add Sermon Manager image sizes + // Add Sermon Manager image sizes. add_action( 'after_setup_theme', array( $this, 'add_image_sizes' ) ); - // Fix Sermon ordering + // Fix Sermon ordering. add_action( 'pre_get_posts', array( $this, 'fix_sermons_ordering' ), 90 ); - // no idea... better not touch it for now. + // No idea... better not touch it for now. add_filter( 'sermon-images-disable-public-css', '__return_true' ); - // Handler for dismissing PHP warning notice - add_action( 'wp_ajax_wpfc_php_notice_handler', array( $this, 'php_notice_handler' ) ); - // Attach to fix WP dates + // Attach to fix WP dates. SM_Dates_WP::hook(); - // Render sermon HTML for search compatibility + // Render sermon HTML for search compatibility. add_action( 'wp_insert_post', array( $this, 'render_sermon_into_content' ), 10, 2 ); - // Remove SB Help from SM pages, since it messes up the formatting + // Remove SB Help from SM pages, since it messes up the formatting. add_action( 'contextual_help', function () { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; @@ -99,19 +102,21 @@ public function __construct() { remove_action( 'contextual_help', 'sb_add_contextual_help' ); } }, 0 ); - // Allow usage of remote URLs for attachments (used for images imported from SE) + // Allow usage of remote URLs for attachments (used for images imported from SE). add_filter( 'wp_get_attachment_url', function ( $url, $attachment_id ) { - if ( ( $db_url = get_post_meta( $attachment_id, '_wp_attached_file', true ) ) && parse_url( $db_url, PHP_URL_SCHEME ) !== null ) { + $db_url = get_post_meta( $attachment_id, '_wp_attached_file', true ); + + if ( $db_url && parse_url( $db_url, PHP_URL_SCHEME ) !== null ) { return $db_url; } return $url; }, 10, 2 ); - // Allows reimport after sermon deletion + // Allows reimport after sermon deletion. add_action( 'before_delete_post', function ( $id ) { global $post_type; - if ( $post_type !== 'wpfc_sermon' ) { + if ( 'wpfc_sermon' !== $post_type ) { return; } @@ -124,7 +129,7 @@ public function __construct() { foreach ( $sermons_array as $offset1 => $value ) { if ( $value['new_id'] == $id ) { unset( $sermons_array[ $offset1 ] ); - update_option( $offset0 === 0 ? '_sm_import_se_messages' : '_sm_import_sb_messages', $sermons_array ); + update_option( 0 === $offset0 ? '_sm_import_se_messages' : '_sm_import_sb_messages', $sermons_array ); return; } @@ -132,10 +137,9 @@ public function __construct() { } } ); - - // temporary hook for importing until API is properly done + // Temporary hook for importing until API is properly done. add_action( 'admin_init', function () { - if ( isset( $_GET['page'] ) && $_GET['page'] === 'sm-import-export' ) { + if ( isset( $_GET['page'] ) && 'sm-import-export' === $_GET['page'] ) { if ( isset( $_GET['doimport'] ) ) { $class = null; @@ -156,19 +160,20 @@ public function __construct() { break; } - if ( $class !== null ) { + if ( null !== $class ) { $class->import(); add_action( 'admin_notices', function () { - if ( ! ! \SermonManager::getOption( 'debug_import' ) ) : ?> -
    -

    Debug info:

    -
    -
    + if ( ! ! \SermonManager::getOption( 'debug_import' ) ) : + ?> +
    +

    Debug info:

    +
    +
    -
    -

    -
    +
    +

    +
    -
    -

    executed.

    -
    +
    +

    executed.

    +
    $functions ) { foreach ( $functions as $function ) { if ( ! get_option( 'wp_sm_updater_' . $function . '_done', 0 ) ) { @@ -210,9 +215,9 @@ public function __construct() { call_user_func( $function ); ?> -
    -

    executed.

    -
    +
    +

    executed.

    +
    -
    -

    All update functions have already been executed.

    -
    +
    +

    All update functions have already been executed.

    +
    get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s", 'wpfc_sermon' ) ); + // All sermons. + $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE `post_type` = %s", 'wpfc_sermon' ) ); foreach ( $sermons as $sermon ) { - $sermon_ID = $sermon->ID; + $sermon_id = $sermon->ID; - if ( $value === 11 ) { - $sm->render_sermon_into_content( $sermon_ID, null, true ); + if ( 11 === $value ) { + $sm->render_sermon_into_content( $sermon_id, null, true ); } else { - $wpdb->query( "UPDATE $wpdb->posts SET `post_content` = '' WHERE `ID` = $sermon_ID" ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = '' WHERE `ID` = %s", $sermon_id ) ); } } @@ -273,16 +278,16 @@ public function __construct() { $sm = SermonManager::get_instance(); - // All sermons - $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s", 'wpfc_sermon' ) ); + // All sermons. + $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE `post_type` = %s", 'wpfc_sermon' ) ); foreach ( $sermons as $sermon ) { - $sermon_ID = $sermon->ID; + $sermon_id = $sermon->ID; - if ( $value === 11 ) { - $sm->render_sermon_into_content( $sermon_ID, null, true ); + if ( 11 === $value ) { + $sm->render_sermon_into_content( $sermon_id, null, true ); } else { - $wpdb->query( "UPDATE $wpdb->posts SET `post_excerpt` = '' WHERE `ID` = $sermon_ID" ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_excerpt` = '' WHERE `ID` = %s", $sermon_id ) ); } } @@ -296,53 +301,53 @@ public function __construct() { } /** - * Include Sermon Manager files + * Include Sermon Manager files. * * @return void */ private function _includes() { /** - * General includes + * General includes. */ - include 'includes/class-sm-autoloader.php'; // Autoloader - include 'includes/sm-core-functions.php'; // Core Sermon Manager functions - include 'includes/class-sm-dates.php'; // Dates operations - include 'includes/class-sm-dates-wp.php'; // Attach to WP filters - include 'includes/class-sm-api.php'; // API - include 'includes/class-sm-post-types.php'; // Register post type, taxonomies, etc - include 'includes/class-sm-install.php'; // Install and update functions - include 'includes/sm-deprecated-functions.php'; // Deprecated SM functions - include 'includes/sm-formatting-functions.php'; // Data formatting - include 'includes/sm-cmb-functions.php'; // CMB2 Meta Fields functions - include 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies - include 'includes/entry-views.php'; // Entry Views Tracking - include 'includes/shortcodes.php'; // Shortcodes - include 'includes/widgets.php'; // Widgets - include 'includes/sm-template-functions.php'; // Template functions - include 'includes/podcast-functions.php'; // Podcast Functions - include 'includes/helper-functions.php'; // Global Helper Functions + include SM_PATH . 'includes/class-sm-autoloader.php'; // Autoloader. + include SM_PATH . 'includes/sm-core-functions.php'; // Core Sermon Manager functions. + include SM_PATH . 'includes/class-sm-dates.php'; // Dates operations. + include SM_PATH . 'includes/class-sm-dates-wp.php'; // Attach to WP filters. + include SM_PATH . 'includes/class-sm-api.php'; // API. + include SM_PATH . 'includes/class-sm-post-types.php'; // Register post type, taxonomies, etc. + include SM_PATH . 'includes/class-sm-install.php'; // Install and update functions. + include SM_PATH . 'includes/sm-deprecated-functions.php'; // Deprecated SM functions. + include SM_PATH . 'includes/sm-formatting-functions.php'; // Data formatting. + include SM_PATH . 'includes/sm-cmb-functions.php'; // CMB2 Meta Fields functions. + include SM_PATH . 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies. + include SM_PATH . 'includes/entry-views.php'; // Entry Views Tracking. + include SM_PATH . 'includes/shortcodes.php'; // Shortcodes. + include SM_PATH . 'includes/widgets.php'; // Widgets. + include SM_PATH . 'includes/sm-template-functions.php'; // Template functions. + include SM_PATH . 'includes/podcast-functions.php'; // Podcast Functions. + include SM_PATH . 'includes/helper-functions.php'; // Global Helper Functions. /** - * Admin only includes + * Admin only includes. */ if ( is_admin() ) { - include 'includes/admin/class-sm-admin.php'; // Admin init class - include 'includes/admin-functions.php'; // General Admin area functions - todo: refactor before 2.9 - include 'includes/vendor/CMB2/init.php'; // Metaboxes + include SM_PATH . 'includes/admin/class-sm-admin.php'; // Admin init class. + include SM_PATH . 'includes/admin-functions.php'; // General Admin area functions. @todo: refactor before 2.9. + include SM_PATH . 'includes/vendor/CMB2/init.php'; // Metaboxes. } } /** * Instead of loading options variable each time in every code snippet, let's have it in one place. * - * @param string $name Option name - * @param string $default Default value to return if option is not set (defaults to empty string) + * @param string $name Option name. + * @param string $default Default value to return if option is not set (defaults to empty string). * * @return mixed Returns option value or an empty string if it doesn't exist. Just like WP does. */ public static function getOption( $name = '', $default = '' ) { if ( ! class_exists( 'SM_Admin_Settings' ) ) { - include_once 'includes/admin/class-sm-admin-settings.php'; + include_once SM_PATH . 'includes/admin/class-sm-admin-settings.php'; } return SM_Admin_Settings::get_option( $name, $default ); @@ -362,22 +367,22 @@ public static function get_instance() { } /** - * Saves whole Sermon HTML markup into post content for better search compatibility + * Saves whole Sermon HTML markup into post content for better search compatibility. * - * @param int $post_ID - * @param WP_Post $post Post object - * @param bool $skip_check Disables check of "SM_SAVING_POST" constant + * @param int $post_ID Post ID. + * @param WP_Post $post Post object. + * @param bool $skip_check Disables check of "SM_SAVING_POST" constant. * * @since 2.8 */ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_check = false ) { global $wpdb, $skip_excerpt_check, $skip_content_check; - if ( $post === null ) { + if ( null === $post ) { $post = get_post( $post_ID ); } - if ( $post->post_type !== 'wpfc_sermon' ) { + if ( 'wpfc_sermon' !== $post->post_type ) { return; } @@ -389,13 +394,16 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch } } - $content = ''; + $content = ''; + $bible_passage = get_post_meta( $post_ID, 'bible_passage', true ); + $has_preachers = has_term( '', 'wpfc_preacher', $post ); + $has_series = has_term( '', 'wpfc_sermon_series', $post ); - if ( $bible_passage = get_post_meta( $post_ID, 'bible_passage', true ) ) { + if ( $bible_passage ) { $content .= __( 'Bible Text:', 'sermon-manager-for-wordpress' ) . ' ' . $bible_passage; } - if ( $has_preachers = has_term( '', 'wpfc_preacher', $post ) ) { + if ( $has_preachers ) { if ( $bible_passage ) { $content .= ' | '; } @@ -404,7 +412,7 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch $content .= strip_tags( get_the_term_list( $post->ID, 'wpfc_preacher', '', ', ', '' ) ); } - if ( $has_series = has_term( '', 'wpfc_sermon_series', $post ) ) { + if ( $has_series ) { if ( $has_preachers ) { $content .= ' | '; } @@ -413,39 +421,37 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch $description = strip_tags( trim( get_post_meta( $post->ID, 'sermon_description', true ) ) ); - if ( $description !== '' ) { + if ( '' !== $description ) { $content .= PHP_EOL . PHP_EOL; $content .= $description; } /** - * Allows to modify sermon content that will be saved as "post_content" + * Allows to modify sermon content that will be saved as "post_content". * - * @param string $content Textual content (no HTML) - * @param int $post_ID ID of the sermon - * @param WP_Post $post Sermon post object - * @param bool $skip_check Basically, a way to identify if the function is being - * executed from the update function or not + * @param string $content Textual content (no HTML). + * @param int $post_ID ID of the sermon. + * @param WP_Post $post Sermon post object. + * @param bool $skip_check Basically, a way to identify if the function is being executed from the update function or not. * * @since 2.11.0 */ - $content = apply_filters( "sm_sermon_post_content", $content, $post_ID, $post, $skip_check ); + $content = apply_filters( 'sm_sermon_post_content', $content, $post_ID, $post, $skip_check ); $content = apply_filters( "sm_sermon_post_content_$post_ID", $content, $post_ID, $post, $skip_check ); $excerpt = ! $content ? '' : wp_trim_excerpt( $content ); /** - * Allows to modify sermon content that will be saved as "post_excerpt" + * Allows to modify sermon content that will be saved as "post_excerpt". * - * @param string $excerpt Textual content (no HTML), limited to 55 words by default - * @param int $post_ID ID of the sermon - * @param WP_Post $post Sermon post object - * @param bool $skip_check Basically, a way to identify if the function is being - * executed from the update function or not + * @param string $excerpt Textual content (no HTML), limited to 55 words by default. + * @param int $post_ID ID of the sermon. + * @param WP_Post $post Sermon post object. + * @param bool $skip_check Basically, a way to identify if the function is being executed from the update function or not. * * @since 2.11.0 */ - $excerpt = apply_filters( "sm_sermon_post_excerpt", $excerpt, $post_ID, $post, $skip_check ); + $excerpt = apply_filters( 'sm_sermon_post_excerpt', $excerpt, $post_ID, $post, $skip_check ); $excerpt = apply_filters( "sm_sermon_post_excerpt_$post_ID", $excerpt, $post_ID, $post, $skip_check ); if ( ! $skip_content_check ) { @@ -460,27 +466,29 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch } } - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = '%s', `post_excerpt` = '%s' WHERE `ID` = $post_ID", array( + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = %s, `post_excerpt` = %s WHERE `ID` = %s", array( $content, $excerpt, + $post_ID, ) ) ); } /** - * Fixes Sermons ordering. Uses `sermon_date` meta instead of sermon's published date + * Fixes Sermons ordering. Uses `sermon_date` meta instead of sermon's published date. * - * @param WP_Query $query + * @param WP_Query $query The query. * * @return void */ public static function fix_sermons_ordering( $query ) { if ( ! is_admin() && ( $query->is_main_query() ) ) { - if ( is_post_type_archive( 'wpfc_sermon' ) || - is_tax( 'wpfc_preacher' ) || - is_tax( 'wpfc_sermon_topics' ) || - is_tax( 'wpfc_sermon_series' ) || - is_tax( 'wpfc_bible_book' ) - ) { + if ( is_post_type_archive( array( + 'wpfc_sermon', + 'wpfc_preacher', + 'wpfc_sermon_topics', + 'wpfc_sermon_series', + 'wpfc_bible_book', + ) ) ) { $query->set( 'meta_key', 'sermon_date' ); $query->set( 'meta_value_num', time() ); $query->set( 'meta_compare', '<=' ); @@ -509,9 +517,7 @@ public static function enqueue_scripts_styles() { return; } - if ( ! ( defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) || - 'wpfc_sermon' === get_post_type() || - is_post_type_archive( 'wpfc_sermon' ) ) + if ( ! ( defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) || 'wpfc_sermon' === get_post_type() || is_post_type_archive( 'wpfc_sermon' ) ) ) { return; } @@ -520,7 +526,7 @@ public static function enqueue_scripts_styles() { wp_enqueue_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION ); wp_enqueue_style( 'dashicons' ); - // load theme-specific styling, if there's any + // Load theme-specific styling, if there's any. if ( file_exists( SM_PATH . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css' ) ) { wp_enqueue_style( 'wpfc-sm-style-' . get_option( 'template' ), SM_URL . 'assets/css/theme-specific/' . get_option( 'template' ) . '.css', array( 'wpfc-sm-styles' ), SM_VERSION ); } @@ -545,17 +551,17 @@ public static function enqueue_scripts_styles() { if ( ! \SermonManager::getOption( 'verse_popup' ) ) { wp_enqueue_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION ); - // get options for JS - $bible_version = \SermonManager::getOption( 'verse_bible_version' ); - - if ( strpos( get_locale(), 'es_' ) === false && - in_array( $bible_version, array( - 'LBLA95', - 'NBLH', - 'NVI', - 'RVR60', - 'RVA', - ) ) ) { + // Get options for JS. + $bible_version = \SermonManager::getOption( 'verse_bible_version' ); + $bible_versions = array( + 'LBLA95', + 'NBLH', + 'NVI', + 'RVR60', + 'RVA', + ); + + if ( strpos( get_locale(), 'es_' ) === false && in_array( $bible_version, $bible_versions ) ) { $bible_version = 'ESV'; } @@ -565,7 +571,7 @@ public static function enqueue_scripts_styles() { ) ); } - // do not enqueue twice + // Do not enqueue twice. define( 'SM_SCRIPTS_STYLES_ENQUEUED', true ); } @@ -573,14 +579,14 @@ public static function enqueue_scripts_styles() { * Append the terms of Sermon Manager taxonomies to the list * of sermon (post) classes generated by post_class(). * - * @param array $classes An array of existing post classes - * @param array $class An array of additional classes added to the post (not needed) - * @param int $post_id The post ID + * @param array $classes An array of existing post classes. + * @param array $class An array of additional classes added to the post (not needed). + * @param int $post_id The post ID. * - * @return array Modified class list + * @return array Modified class list. */ public static function add_additional_sermon_classes( $classes, $class, $post_id ) { - if ( get_post_type( $post_id ) !== 'wpfc_sermon' ) { + if ( 'wpfc_sermon' !== get_post_type( $post_id ) ) { return $classes; } @@ -641,26 +647,6 @@ public static function add_image_sizes() { add_image_size( 'sermon_wide', 940, 350, true ); } } - - /** - * Renders the notice when the user is not using correct PHP version - */ - public static function render_php_version_warning() { - ?> -
    -

    - PHP %s, but Sermon Manager recommends at least PHP %s. If you encounter issues, update PHP to a recommended version and check if they are still there.", PHP_VERSION, '5.6.0' ); ?> -

    -
    - post && - false !== strpos( $wp_query->post->post_content, '[sermons' ) ) { + if ( get_query_var( 'paged' ) && $wp_query->post && false !== strpos( $wp_query->post->post_content, '[sermons' ) ) { return false; } From e04a624e2e7b9b4b753015e159abb38c7a629158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 16:58:28 +0200 Subject: [PATCH 011/119] Code Style: sermons.php --- sermons.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sermons.php b/sermons.php index 3647769..72cba14 100755 --- a/sermons.php +++ b/sermons.php @@ -256,7 +256,7 @@ public function __construct() { if ( 11 === $value ) { $sm->render_sermon_into_content( $sermon_id, null, true ); } else { - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = '' WHERE `ID` = %s", $sermon_id ) ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = '' WHERE `ID` = %d", $sermon_id ) ); } } @@ -279,7 +279,7 @@ public function __construct() { $sm = SermonManager::get_instance(); // All sermons. - $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE `post_type` = %s", 'wpfc_sermon' ) ); + $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s", 'wpfc_sermon' ) ); foreach ( $sermons as $sermon ) { $sermon_id = $sermon->ID; @@ -287,7 +287,7 @@ public function __construct() { if ( 11 === $value ) { $sm->render_sermon_into_content( $sermon_id, null, true ); } else { - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_excerpt` = '' WHERE `ID` = %s", $sermon_id ) ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_excerpt = '' WHERE ID = %d", $sermon_id ) ); } } From 4afdc4ac3d528f07400c73c9f02ac0bb1f896517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 17:33:31 +0200 Subject: [PATCH 012/119] Code Style: /views --- views/archive-wpfc_sermon.php | 19 ++++-- views/partials/wrapper-end.php | 25 +++++--- views/partials/wrapper-start.php | 29 +++++---- views/single-wpfc_sermon.php | 22 ++++--- views/taxonomy-wpfc_bible_book.php | 20 +++++-- views/taxonomy-wpfc_preacher.php | 20 +++++-- views/taxonomy-wpfc_sermon_series.php | 20 +++++-- views/taxonomy-wpfc_sermon_topics.php | 20 +++++-- views/taxonomy-wpfc_service_type.php | 20 +++++-- views/wpfc-podcast-feed.php | 84 ++++++++++++++++----------- 10 files changed, 189 insertions(+), 90 deletions(-) diff --git a/views/archive-wpfc_sermon.php b/views/archive-wpfc_sermon.php index c9c93eb..0d33c03 100644 --- a/views/archive-wpfc_sermon.php +++ b/views/archive-wpfc_sermon.php @@ -1,23 +1,32 @@ - + -'; if ( is_archive() ) { get_sidebar(); } break; - case 'twentytwelve' : + case 'twentytwelve': echo ''; get_sidebar(); break; - case 'twentythirteen' : + case 'twentythirteen': echo ''; break; - case 'twentyfourteen' : + case 'twentyfourteen': echo ''; get_sidebar( 'content' ); break; - case 'twentyfifteen' : + case 'twentyfifteen': get_sidebar(); echo ''; break; - case 'twentysixteen' : + case 'twentysixteen': echo ''; get_sidebar(); break; - case 'twentyseventeen' : + case 'twentyseventeen': echo ''; get_sidebar(); break; @@ -47,7 +54,7 @@ get_sidebar(); echo ''; break; - default : + default: ob_start(); get_sidebar(); $sidebar = ob_get_clean(); diff --git a/views/partials/wrapper-start.php b/views/partials/wrapper-start.php index bb2bf5f..1458779 100644 --- a/views/partials/wrapper-start.php +++ b/views/partials/wrapper-start.php @@ -1,39 +1,46 @@ -
    '; break; - case 'twentytwelve' : + case 'twentytwelve': echo '
    '; break; - case 'twentythirteen' : + case 'twentythirteen': echo '
    '; break; - case 'twentyfourteen' : + case 'twentyfourteen': echo '
    '; break; - case 'twentyfifteen' : + case 'twentyfifteen': echo '
    '; break; - case 'twentysixteen' : + case 'twentysixteen': echo '
    '; break; - case 'twentyseventeen' : + case 'twentyseventeen': echo '
    '; break; case 'Divi': echo '
    '; break; - case 'salient' : + case 'salient': echo '
    '; break; - case 'Avada' : + case 'Avada': echo '
    '; break; - default : + default: echo apply_filters( 'sm_templates_wrapper_start', '
    ' ); break; } diff --git a/views/single-wpfc_sermon.php b/views/single-wpfc_sermon.php index 7160bb1..0de5f90 100755 --- a/views/single-wpfc_sermon.php +++ b/views/single-wpfc_sermon.php @@ -1,17 +1,25 @@ - + @@ -6,19 +14,21 @@ - + @@ -6,19 +14,21 @@ - + @@ -6,19 +14,21 @@ - + @@ -6,19 +14,21 @@ - + @@ -6,19 +14,21 @@ - 'wpfc_sermon', @@ -35,47 +39,61 @@ ); $sermon_podcast_query = new WP_Query( $args ); -?>' ?> +$title = esc_html( \SermonManager::getOption( 'title' ) ); +$link = esc_url( \SermonManager::getOption( 'website_link' ) ); +$atom_link = ! empty( $_SERVER['HTTPS'] ) ? 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; +$description = esc_html( \SermonManager::getOption( 'description' ) ); +$language = esc_html( \SermonManager::getOption( 'language' ) ); + +?>'; ?> + + xmlns:slash="http://purl.org/rss/1.0/modules/slash/"' . PHP_EOL; + ?> > - - <?php echo esc_html( \SermonManager::getOption( 'title' ) ) ?> - - - - + + <?php echo $title; ?> + + + + + - have_posts() ) : while ( $sermon_podcast_query->have_posts() ) : $sermon_podcast_query->the_post(); ?> - - ID, 'sermon_audio', true ) !== '' ) : ?> - - <?php the_title_rss() ?> - + have_posts() ) : + while ( $sermon_podcast_query->have_posts() ) : + $sermon_podcast_query->the_post(); + ?> + + ID, 'sermon_audio', true ) !== '' ) : ?> + + <?php the_title_rss(); ?> + - + - - ]]> - - + + + ]]> + + - asd]]> - + asd]]> + - + - - - \ No newline at end of file + + + From d80d56941cd26070dd9d4cfd13f0e5bdbc39fb2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 17:39:35 +0200 Subject: [PATCH 013/119] Remove unneeded debug setting --- includes/admin/settings/class-sm-settings-debug.php | 6 ------ sermons.php | 5 ----- 2 files changed, 11 deletions(-) diff --git a/includes/admin/settings/class-sm-settings-debug.php b/includes/admin/settings/class-sm-settings-debug.php index f339418..dcff4bc 100644 --- a/includes/admin/settings/class-sm-settings-debug.php +++ b/includes/admin/settings/class-sm-settings-debug.php @@ -25,12 +25,6 @@ public function get_settings() { 'desc' => '', 'id' => 'debug_settings' ), - array( - 'title' => __( 'Enable output of PHP errors in Sermon Manager (disable in production)', 'sermon-manager-for-wordpress' ), - 'type' => 'checkbox', - 'id' => 'sm_debug', - 'default' => 'no', - ), array( 'title' => __( 'Force Sermon Manager\'s WP_Background_Updater class', 'sermon-manager-for-wordpress' ), 'type' => 'checkbox', diff --git a/sermons.php b/sermons.php index 72cba14..49b111f 100755 --- a/sermons.php +++ b/sermons.php @@ -649,11 +649,6 @@ public static function add_image_sizes() { } } -if ( SermonManager::getOption( 'sm_debug' ) || ( defined( 'SM_DEBUG' ) && SM_DEBUG === true ) ) { - error_reporting( E_ALL ); - ini_set( 'display_errors', 'On' ); -} - // Initialize Sermon Manager. SermonManager::get_instance(); From 9f56faed38be9b5d6303d6d5b659382b8b22ddf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 17:47:47 +0200 Subject: [PATCH 014/119] Code Style: sm-update-functions.php + change "wordpress" to "WordPress" --- .../settings/class-sm-settings-general.php | 2 +- includes/sm-template-functions.php | 8 +- includes/sm-update-functions.php | 103 ++++++++++-------- 3 files changed, 60 insertions(+), 53 deletions(-) diff --git a/includes/admin/settings/class-sm-settings-general.php b/includes/admin/settings/class-sm-settings-general.php index c8ff612..e56c55f 100644 --- a/includes/admin/settings/class-sm-settings-general.php +++ b/includes/admin/settings/class-sm-settings-general.php @@ -86,7 +86,7 @@ public function get_settings() { 'options' => array( 'plyr' => 'Plyr', 'mediaelement' => 'Mediaelement', - 'wordpress' => 'Old WordPress player', + 'WordPress' => 'Old WordPress player', 'none' => 'Browser HTML5', ), 'default' => 'plyr', diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 5285b91..95b6634 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -283,9 +283,9 @@ function wpfc_render_video( $url = '', $seek = null ) { return '
    '; } - $player = \SermonManager::getOption( 'player' ) ?: 'plyr'; + $player = strtolower( \SermonManager::getOption( 'player' ) ?: 'plyr' ); - if ( $player === 'wordpress' ) { + if ( $player === strtolower( 'WordPress' ) ) { $attr = array( 'src' => $url, 'preload' => 'none' @@ -337,9 +337,9 @@ function wpfc_render_audio( $url = '', $seek = null ) { return ''; } - $player = \SermonManager::getOption( 'player' ) ?: 'plyr'; + $player = strtolower( \SermonManager::getOption( 'player' ) ?: 'plyr' ); - if ( $player === 'wordpress' ) { + if ( $player === strtolower( 'WordPress' ) ) { $attr = array( 'src' => $url, 'preload' => 'none' diff --git a/includes/sm-update-functions.php b/includes/sm-update-functions.php index da5a9e3..36197bf 100644 --- a/includes/sm-update-functions.php +++ b/includes/sm-update-functions.php @@ -1,12 +1,15 @@ get_results( $wpdb->prepare( "SELECT ID, post_date FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('auto-draft', 'inherit')", 'wpfc_sermon' ) ) as $sermon ) { - if ( get_post_meta( $sermon->ID, 'sermon_date', true ) === '' && - $date = get_post_meta( $sermon->ID, 'sermon_date_old', true ) !== '' ) { + $date = get_post_meta( $sermon->ID, 'sermon_date_old', true ); + + if ( '' === get_post_meta( $sermon->ID, 'sermon_date', true ) && '' !== $date ) { update_post_meta( $sermon->ID, 'sermon_date', is_numeric( $date ) ?: strtotime( $date ) ); delete_post_meta( $sermon->ID, 'sermon_date_old' ); } } - // clear all cached data + // Clear all cached data. wp_cache_flush(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * Final dates conversion for users who skipped converters in previous SM versions + * Final dates conversion for users who skipped converters in previous SM versions. * - * Basically, converts "sermon_date" value to Unix time if it's not numeric + * Basically, converts "sermon_date" value to Unix time if it's not numeric. */ function sm_update_28_convert_dates_to_unix() { global $wpdb; - // All sermons + // All sermons. $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_date FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('auto-draft', 'inherit')", 'wpfc_sermon' ) ); foreach ( $sermons as $sermon ) { - if ( $date = get_post_meta( $sermon->ID, 'sermon_date', true ) ) { + $date = get_post_meta( $sermon->ID, 'sermon_date', true ); + + if ( $date ) { if ( ! is_numeric( $date ) ) { update_post_meta( $sermon->ID, 'sermon_date', strtotime( $date ) ); } } } - // clear all cached data + // Clear all cached data. wp_cache_flush(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** * Fills out dates of sermons that don't have `sermon_date` set. Takes "Published" date for them and marks - * them as auto-filled, so they get updated when Published date gets updated + * them as auto-filled, so they get updated when Published date gets updated. */ function sm_update_28_fill_out_empty_dates() { global $wpdb; - // All sermons + // All sermons. $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_date FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('auto-draft', 'inherit')", 'wpfc_sermon' ) ); foreach ( $sermons as $sermon ) { @@ -73,54 +79,54 @@ function sm_update_28_fill_out_empty_dates() { } } - // clear all cached data + // Clear all cached data. wp_cache_flush(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * For enabling sorting by series date + * For enabling sorting by series date. * * @see SM_Dates_WP::update_series_date() */ function sm_update_28_fill_out_series_dates() { SM_Dates_WP::update_series_date(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * Renders sermon text and saves as "post_content", for better search compatibility + * Renders sermon text and saves as "post_content", for better search compatibility. * - * @since 2.11.0 updated to render text and not HTML + * @since 2.11.0 updated to render text and not HTML. */ function sm_update_28_save_sermon_render_into_post_content() { sm_update_211_render_content(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * We had a bug from 2.8 to 2.8.3, so we will do it again + * We had a bug from 2.8 to 2.8.3, so we will do it again. */ function sm_update_284_resave_sermons() { sm_update_28_save_sermon_render_into_post_content(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * There was a bug in function for 2.8, so we will do it again + * There was a bug in function for 2.8, so we will do it again. */ function sm_update_29_fill_out_series_dates() { sm_update_28_fill_out_series_dates(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } @@ -134,37 +140,38 @@ function sm_update_29_convert_settings() { add_option( 'sermonmanager_' . $key, $value ); } - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * SB and SE import did not import dates correctly. This function imports them for those who did import + * SB and SE import did not import dates correctly. This function imports them for those who did import. */ function sm_update_293_fix_import_dates() { sm_update_28_fill_out_empty_dates(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * Removed Bibly so we will change option names + * Removed Bibly so we will change option names. */ function sm_update_210_update_options() { if ( is_bool( SermonManager::getOption( 'bibly' ) ) ) { add_option( 'sermonmanager_verse_popup', SermonManager::getOption( 'bibly' ) ? 'yes' : 'no' ); } - if ( $bible_version = SermonManager::getOption( 'bibly_version' ) ) { + $bible_version = SermonManager::getOption( 'bibly_version' ); + if ( $bible_version ) { add_option( 'sermonmanager_verse_bible_version', $bible_version ); } if ( is_bool( SermonManager::getOption( 'use_old_player' ) ) ) { - add_option( 'sermonmanager_player', SermonManager::getOption( 'use_old_player' ) ? 'wordpress' : 'plyr' ); + add_option( 'sermonmanager_player', SermonManager::getOption( 'use_old_player' ) ? 'tooo' : 'plyr' ); } - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } @@ -174,7 +181,7 @@ function sm_update_210_update_options() { function sm_update_211_render_content() { global $wpdb; - // All sermons + // All sermons. $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s", 'wpfc_sermon' ) ); $sermon_manager = \SermonManager::get_instance(); @@ -183,34 +190,36 @@ function sm_update_211_render_content() { $sermon_manager->render_sermon_into_content( $sermon->ID, get_post( $sermon->ID ), true ); } - // clear all cached data + // Clear all cached data. wp_cache_flush(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * Adds time alongside date in sermon date option + * Adds time alongside date in sermon date option. */ function sm_update_211_update_date_time() { global $wpdb; - // All sermons + // All sermons. $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_date FROM $wpdb->posts WHERE post_type = %s", 'wpfc_sermon' ) ); foreach ( $sermons as $sermon ) { - if ( $sermon_date = get_post_meta( $sermon->ID, 'sermon_date', true ) ) { + $sermon_date = get_post_meta( $sermon->ID, 'sermon_date', true ); + + if ( $sermon_date ) { $dt = DateTime::createFromFormat( 'U', $sermon_date ); $dt_post = DateTime::createFromFormat( 'U', mysql2date( 'U', $sermon->post_date ) ); $time = array( $dt_post->format( 'H' ), $dt_post->format( 'i' ), - $dt_post->format( 's' ) + $dt_post->format( 's' ), ); - // convert all to ints + // Convert all to ints. $time = array_map( 'intval', $time ); list( $hours, $minutes, $seconds ) = $time; @@ -224,21 +233,19 @@ function sm_update_211_update_date_time() { } } - // clear all cached data + // Clear all cached data. wp_cache_flush(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } /** - * There was a bug that prevented preacher slug to be used as a permalink as well - * - * Fixed in 2.12.3 + * There was a bug that prevented preacher slug to be used as a permalink as well. */ function sm_update_2123_fix_preacher_permalink() { flush_rewrite_rules(); - // mark it as done, backup way + // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } \ No newline at end of file From a3b98036bba701769c486e31a66eec3b3f29e23d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 18:25:46 +0200 Subject: [PATCH 015/119] Code Style: sm-template-functions.php --- includes/sm-template-functions.php | 569 +++++++++++++++-------------- 1 file changed, 296 insertions(+), 273 deletions(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 95b6634..3e92374 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -1,9 +1,16 @@ taxonomy . '.php'; if ( ! file_exists( get_stylesheet_directory() . '/' . $default_file ) ) { @@ -45,11 +53,11 @@ } /** - * Replaces default the_content and/or the_excerpt with proper sermon content + * Replaces default the_content and/or the_excerpt with proper sermon content. * - * @param string $content The default content + * @param string $content The default content. * - * @return string The modified content if it's Sermon related data + * @return string The modified content if it's Sermon related data. */ function add_wpfc_sermon_content( $content ) { if ( 'wpfc_sermon' === get_post_type() && in_the_loop() == true ) { @@ -70,20 +78,20 @@ function add_wpfc_sermon_content( $content ) { } /** - * Render sermon sorting/filtering + * Render sermon sorting/filtering. * - * @param array $args Display options. See the 'sermon_sort_fields' shortcode for array items + * @param array $args Display options. See the 'sermon_sort_fields' shortcode for array items. * * @see WPFC_Shortcodes->displaySermonSorting() * - * @return string the HTML + * @return string The HTML. * * @since 2.5.0 added $args */ function render_wpfc_sorting( $args = array() ) { $action = ( SermonManager::getOption( 'home_url_filtering' ) ? home_url() : site_url() ) . '/' . ( SermonManager::getOption( 'common_base_slug' ) ? ( SermonManager::getOption( 'archive_slug' ) ?: 'sermons' ) : '' ); - // Filters HTML fields data + // Filters HTML fields data. $filters = array( array( 'className' => 'sortPreacher', @@ -94,22 +102,22 @@ function render_wpfc_sorting( $args = array() ) { array( 'className' => 'sortSeries', 'taxonomy' => 'wpfc_sermon_series', - 'title' => __( 'Filter by Series', 'sermon-manager-for-wordpress' ) + 'title' => __( 'Filter by Series', 'sermon-manager-for-wordpress' ), ), array( 'className' => 'sortTopics', 'taxonomy' => 'wpfc_sermon_topics', - 'title' => __( 'Filter by Topic', 'sermon-manager-for-wordpress' ) + 'title' => __( 'Filter by Topic', 'sermon-manager-for-wordpress' ), ), array( 'className' => 'sortBooks', 'taxonomy' => 'wpfc_bible_book', - 'title' => __( 'Filter by Book', 'sermon-manager-for-wordpress' ) + 'title' => __( 'Filter by Book', 'sermon-manager-for-wordpress' ), ), array( 'className' => 'sortServiceTypes', 'taxonomy' => 'wpfc_service_type', - 'title' => __( 'Filter by Service Type', 'sermon-manager-for-wordpress' ) + 'title' => __( 'Filter by Service Type', 'sermon-manager-for-wordpress' ), ), ); @@ -139,79 +147,81 @@ function render_wpfc_sorting( $args = array() ) { } ob_start(); ?> -
    - - +
    + + - -
    -
    - > + - - - 1 ): ?> - - + + + + 1 ) : ?> + + - - + + - - 1 ): ?> - - + + + 1 ) : ?> + + - - + + - -
    -
    + + +
    -
    +
    ID, $meta_key, true ); - if ( $data !== '' ) { + if ( '' !== $data ) { return $data; } @@ -219,10 +229,10 @@ function get_wpfc_sermon_meta( $meta_key = '' ) { } /** - * Pass sermon content through WordPres functions, to render shortcodes, etc + * Pass sermon content through WordPress functions, to render shortcodes, etc. * - * @param string $meta_key Sermon meta key - * @param int $post_id Post ID + * @param string $meta_key Sermon meta key. + * @param int $post_id Post ID. * * @return string The processed content */ @@ -241,11 +251,11 @@ function process_wysiwyg_output( $meta_key, $post_id = 0 ) { } /** - * Render sermon description + * Render sermon description. * - * @param string $before content before description - * @param string $after content after description - * @param bool $return True to return, false to echo (default) + * @param string $before Content before description. + * @param string $after Content after description. + * @param bool $return True to return, false to echo (default). * * @return string The HTML, if $return is set to true */ @@ -260,15 +270,15 @@ function wpfc_sermon_description( $before = '', $after = '', $return = false ) { } /** - * Renders the video player + * Renders the video player. * - * @param string $url The URL of the video file - * @param int $seek Allows seeking to specific second in audio file + * @param string $url The URL of the video file. + * @param int $seek Allows seeking to specific second in audio file. * * @since 2.11.0 * @since 2.12.3 added $seek * - * @return string Video player HTML + * @return string Video player HTML. */ function wpfc_render_video( $url = '', $seek = null ) { if ( ! is_string( $url ) || trim( $url ) === '' ) { @@ -280,15 +290,15 @@ function wpfc_render_video( $url = '', $seek = null ) { parse_str( parse_url( $url, PHP_URL_QUERY ), $query ); - return '
    '; + return '
    '; } $player = strtolower( \SermonManager::getOption( 'player' ) ?: 'plyr' ); - if ( $player === strtolower( 'WordPress' ) ) { + if ( strtolower( 'WordPress' ) === $player ) { $attr = array( 'src' => $url, - 'preload' => 'none' + 'preload' => 'none', ); $output = wp_video_shortcode( $attr ); @@ -298,39 +308,40 @@ function wpfc_render_video( $url = '', $seek = null ) { $is_youtube = $is_youtube_long || $is_youtube_short; $is_vimeo = strpos( strtolower( $url ), 'vimeo.com' ); $extra_settings = ''; + $output = ''; if ( is_numeric( $seek ) ) { - // sanitation just in case + // Sanitation just in case. $extra_settings = 'data-plyr_seek=\'' . intval( $seek ) . '\''; } - if ( $player === 'plyr' && ( $is_youtube || $is_vimeo ) ) { - $output = '
    '; + if ( 'plyr' === $player && ( $is_youtube || $is_vimeo ) ) { + $output .= '
    '; } else { - $output = '
    + init(); diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 3e92374..0446e40 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -575,7 +575,7 @@ function wpfc_sermon_excerpt_v2( $return = false ) { ob_start(); ?> - +
    >
    @@ -595,7 +595,7 @@ function wpfc_sermon_excerpt_v2( $return = false ) { ID, 'wpfc_sermon_series' ); ?>
    - +

    @@ -673,7 +673,7 @@ function wpfc_sermon_excerpt_v2( $return = false ) {
    - + diff --git a/sermons.php b/sermons.php index cc21db8..cca7c1b 100755 --- a/sermons.php +++ b/sermons.php @@ -320,7 +320,7 @@ private function _includes() { include SM_PATH . 'includes/sm-formatting-functions.php'; // Data formatting. include SM_PATH . 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies. include SM_PATH . 'includes/entry-views.php'; // Entry Views Tracking. - include SM_PATH . 'includes/shortcodes.php'; // Shortcodes. + include SM_PATH . 'includes/class-sm-shortcodes.php'; // Shortcodes. include SM_PATH . 'includes/widgets.php'; // Widgets. include SM_PATH . 'includes/sm-template-functions.php'; // Template functions. include SM_PATH . 'includes/podcast-functions.php'; // Podcast Functions. From 32d6517432c0280c2242b3623803ba1146fd0346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:24:18 +0200 Subject: [PATCH 021/119] Code Style: sm-podcast-functions.php --- ...functions.php => sm-podcast-functions.php} | 570 +++++++++--------- includes/{ => vendor}/entry-views.php | 300 ++++----- sermons.php | 4 +- 3 files changed, 437 insertions(+), 437 deletions(-) rename includes/{podcast-functions.php => sm-podcast-functions.php} (62%) rename includes/{ => vendor}/entry-views.php (97%) diff --git a/includes/podcast-functions.php b/includes/sm-podcast-functions.php similarity index 62% rename from includes/podcast-functions.php rename to includes/sm-podcast-functions.php index 1c2c11d..531c124 100644 --- a/includes/podcast-functions.php +++ b/includes/sm-podcast-functions.php @@ -1,285 +1,285 @@ -is_main_query() && $query->is_feed() ) { - if ( is_post_type_archive( 'wpfc_sermon' ) || is_tax( 'wpfc_preacher' ) || is_tax( 'wpfc_sermon_topics' ) || is_tax( 'wpfc_service_type' ) || is_tax( 'wpfc_sermon_series' ) || is_tax( 'wpfc_bible_book' ) ) { - add_filter( 'get_post_time', 'wpfc_podcast_item_date', 10, 3 ); - add_filter( 'bloginfo_rss', 'wpfc_bloginfo_rss_filter', 10, 2 ); - add_filter( 'wp_title_rss', 'wpfc_modify_podcast_title', 99, 3 ); - add_action( 'rss_ns', 'wpfc_podcast_add_namespace' ); - add_action( 'rss2_ns', 'wpfc_podcast_add_namespace' ); - add_action( 'rss_head', 'wpfc_podcast_add_head' ); - add_action( 'rss2_head', 'wpfc_podcast_add_head' ); - add_action( 'rss_item', 'wpfc_podcast_add_item' ); - add_action( 'rss2_item', 'wpfc_podcast_add_item' ); - add_filter( 'the_content_feed', 'wpfc_podcast_summary', 10, 3 ); - add_filter( 'the_excerpt_rss', 'wpfc_podcast_summary' ); - add_filter( 'rss_enclosure', '__return_empty_string' ); - - if ( \SermonManager::getOption( 'enable_podcast_html_description' ) ) { - add_filter( 'the_excerpt_rss', 'wpautop' ); - } - - // remove sermons that don't have audio - $query->set( 'meta_query', array( - 'relation' => 'AND', - array( - 'key' => 'sermon_audio', - 'compare' => 'EXISTS' - ), - array( - 'key' => 'sermon_audio', - 'value' => '', - 'compare' => '!=' - ) - ) - ); - - if ( intval( \SermonManager::getOption( 'podcasts_per_page' ) ) !== 0 ) { - $query->set( 'posts_per_rss', intval( \SermonManager::getOption( 'podcasts_per_page' ) ) ); - } - } - } -} - -/** - * Note: Unfinished feature. - * Take a look at comment at `views/wpfc-podcast-feed.php`. - * - * Load the template used for podcast XML. - * - * It can be overridden by putting the `wpfc-podcast-feed.php` file in the root of your active theme. - * - * @since 2.3.5 Added ability to override the default template - * @return void - */ -function wpfc_podcast_render() { - add_action( 'after_setup_theme', function () { - if ( $overridden_template = locate_template( 'wpfc-podcast-feed.php' ) ) { - load_template( $overridden_template ); - } else { - load_template( SM_PATH . 'views/wpfc-podcast-feed.php' ); - } - - exit; - } ); -} - -/** - * Add iTunes XML Namespace to the XML head - * - * @return void - */ -function wpfc_podcast_add_namespace() { - echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'; -} - -/** - * Add iTunes header data - * - * @return void - */ -function wpfc_podcast_add_head() { - remove_filter( 'the_content', 'add_wpfc_sermon_content' ); - - $categories = array( - '0' => '', - '1' => 'Buddhism', - '2' => 'Christianity', - '3' => 'Hinduism', - '4' => 'Islam', - '5' => 'Judaism', - '6' => 'Other', - '7' => 'Spirituality', - ); - - ?> - - - - - - - - - - - - - - no - - - - - - - ID, 'sermon_audio', true ) ); - $audio_p = strrpos( $audio_raw, '/' ) + 1; - $audio_raw = urldecode( $audio_raw ); - $audio = substr( $audio_raw, 0, $audio_p ) . rawurlencode( substr( $audio_raw, $audio_p ) ); - $speaker = strip_tags( get_the_term_list( $post->ID, 'wpfc_preacher', '', ' & ', '' ) ); - $series = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_series', '', ', ', '' ) ); - $topics = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_topics', '', ', ', '' ) ); - $post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); - $post_image = str_ireplace( 'https://', 'http://', ! empty( $post_image['0'] ) ? $post_image['0'] : '' ); - $audio_duration = get_post_meta( $post->ID, '_wpfc_sermon_duration', true ) ?: '0:00'; - $audio_file_size = get_post_meta( $post->ID, '_wpfc_sermon_size', 'true' ) ?: 0; - - // Fix for relative audio file URLs - if ( substr( $audio, 0, 1 ) === '/' ) { - $audio = site_url( $audio ); - } - ?> - - - - - - - - - - - - - - - - is_main_query() && $query->is_feed() ) { + if ( is_post_type_archive( 'wpfc_sermon' ) || is_tax( 'wpfc_preacher' ) || is_tax( 'wpfc_sermon_topics' ) || is_tax( 'wpfc_service_type' ) || is_tax( 'wpfc_sermon_series' ) || is_tax( 'wpfc_bible_book' ) ) { + add_filter( 'get_post_time', 'wpfc_podcast_item_date', 10, 3 ); + add_filter( 'bloginfo_rss', 'wpfc_bloginfo_rss_filter', 10, 2 ); + add_filter( 'wp_title_rss', 'wpfc_modify_podcast_title', 99, 3 ); + add_action( 'rss_ns', 'wpfc_podcast_add_namespace' ); + add_action( 'rss2_ns', 'wpfc_podcast_add_namespace' ); + add_action( 'rss_head', 'wpfc_podcast_add_head' ); + add_action( 'rss2_head', 'wpfc_podcast_add_head' ); + add_action( 'rss_item', 'wpfc_podcast_add_item' ); + add_action( 'rss2_item', 'wpfc_podcast_add_item' ); + add_filter( 'the_content_feed', 'wpfc_podcast_summary', 10, 3 ); + add_filter( 'the_excerpt_rss', 'wpfc_podcast_summary' ); + add_filter( 'rss_enclosure', '__return_empty_string' ); + + if ( \SermonManager::getOption( 'enable_podcast_html_description' ) ) { + add_filter( 'the_excerpt_rss', 'wpautop' ); + } + + // Remove sermons that don't have audio. + $query->set( 'meta_query', array( + 'relation' => 'AND', + array( + 'key' => 'sermon_audio', + 'compare' => 'EXISTS', + ), + array( + 'key' => 'sermon_audio', + 'value' => '', + 'compare' => '!=', + ), + ) ); + + if ( intval( \SermonManager::getOption( 'podcasts_per_page' ) ) !== 0 ) { + $query->set( 'posts_per_rss', intval( \SermonManager::getOption( 'podcasts_per_page' ) ) ); + } + } + } +} + +/** + * Note: Unfinished feature. + * Take a look at comment at `views/wpfc-podcast-feed.php`. + * + * Load the template used for podcast XML. + * + * It can be overridden by putting the `wpfc-podcast-feed.php` file in the root of your active theme. + * + * @since 2.3.5 Added ability to override the default template + * @return void + */ +function wpfc_podcast_render() { + add_action( 'after_setup_theme', function () { + $overridden_template = locate_template( 'wpfc-podcast-feed.php' ); + if ( $overridden_template ) { + load_template( $overridden_template ); + } else { + load_template( SM_PATH . 'views/wpfc-podcast-feed.php' ); + } + + exit; + } ); +} + +/** + * Add iTunes XML Namespace to the XML head. + * + * @return void + */ +function wpfc_podcast_add_namespace() { + echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'; +} + +/** + * Add iTunes header data. + * + * @return void + */ +function wpfc_podcast_add_head() { + remove_filter( 'the_content', 'add_wpfc_sermon_content' ); + + $categories = array( + '0' => '', + '1' => 'Buddhism', + '2' => 'Christianity', + '3' => 'Hinduism', + '4' => 'Islam', + '5' => 'Judaism', + '6' => 'Other', + '7' => 'Spirituality', + ); + + ?> + + + + + + + + + + + + + + no + + + + + + + ID, 'sermon_audio', true ) ); + $audio_p = strrpos( $audio_raw, '/' ) + 1; + $audio_raw = urldecode( $audio_raw ); + $audio = substr( $audio_raw, 0, $audio_p ) . rawurlencode( substr( $audio_raw, $audio_p ) ); + $speaker = strip_tags( get_the_term_list( $post->ID, 'wpfc_preacher', '', ' & ', '' ) ); + $series = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_series', '', ', ', '' ) ); + $topics = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_topics', '', ', ', '' ) ); + $post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); + $post_image = str_ireplace( 'https://', 'http://', ! empty( $post_image['0'] ) ? $post_image['0'] : '' ); + $audio_duration = get_post_meta( $post->ID, '_wpfc_sermon_duration', true ) ?: '0:00'; + $audio_file_size = get_post_meta( $post->ID, '_wpfc_sermon_size', 'true' ) ?: 0; + + // Fix for relative audio file URLs. + if ( substr( $audio, 0, 1 ) === '/' ) { + $audio = site_url( $audio ); + } + ?> + + + + + + + + + + + + + + + + get_queried_object(); - /* Check if the post type supports the 'entry-views' feature. */ - if ( post_type_supports( $post->post_type, 'entry-views' ) ) { - if ( empty( $wpfc_entry_views ) ) { - $wpfc_entry_views = new stdClass(); - } - /* Set the post ID for later use because we wouldn't want a custom query to change this. */ - $wpfc_entry_views->post_id = $post->ID; - /* Enqueue the jQuery library. */ - wp_enqueue_script( 'jquery' ); - /* Load the entry views JavaScript in the footer. */ - add_action( 'wp_footer', 'wpfc_entry_views_load_scripts' ); - } - } -} - -/** - * Updates the number of views when on a singular view of a post. This function uses post meta to store - * the number of views per post. By default, the meta key is 'Views', but you can filter this with the - * 'wpfc_entry_views_meta_key' hook. - * - * @since 0.1 - */ -function wpfc_entry_views_update( $post_id = '' ) { - global $wp_query; - /* If we're on a singular view of a post, calculate the number of views. */ - if ( ! empty( $post_id ) ) { - /* Allow devs to override the meta key used. By default, this is 'Views'. */ - $meta_key = apply_filters( 'wpfc_entry_views_meta_key', 'Views' ); - /* Get the number of views the post currently has. */ - $old_views = get_post_meta( $post_id, $meta_key, true ); - /* Add +1 to the number of current views. */ - $new_views = absint( $old_views ) + 1; - /* Update the view count with the new view count. */ - update_post_meta( $post_id, $meta_key, $new_views, $old_views ); - } -} - -/** - * Gets the number of views a specific post has. It also doubles as a shortcode, which is called with the - * [entry-views] format. - * - * @since 0.1 - * - * @param array $attr Attributes for use in the shortcode. - */ -function wpfc_entry_views_get( $attr = '' ) { - global $post; - /* Merge the defaults and the given attributes. */ - $attr = shortcode_atts( array( 'before' => '', 'after' => '', 'post_id' => $post->ID ), $attr ); - /* Allow devs to override the meta key used. */ - $meta_key = apply_filters( 'wpfc_entry_views_meta_key', 'Views' ); - /* Get the number of views the post has. */ - $views = intval( get_post_meta( $attr['post_id'], $meta_key, true ) ); - - /* Returns the formatted number of views. */ - - return $attr['before'] . number_format_i18n( $views ) . $attr['after']; -} - -/** - * Callback function hooked to 'wp_ajax_wpfc_entry_views' and 'wp_ajax_nopriv_wpfc_entry_views'. It checks the - * AJAX nonce and passes the given $post_id to the entry views update function. - * - * @since 0.1 - */ -function wpfc_entry_views_update_ajax() { - /* Check the AJAX nonce to make sure this is a valid request. */ - check_ajax_referer( 'wpfc_entry_views_ajax' ); - /* If the post ID is set, set it to the $post_id variable and make sure it's an integer. */ - if ( isset( $_POST['post_id'] ) ) { - $post_id = absint( $_POST['post_id'] ); - } - /* If $post_id isn't empty, pass it to the wpfc_entry_views_update() function to update the view count. */ - if ( ! empty( $post_id ) ) { - wpfc_entry_views_update( $post_id ); - } -} - -/** - * Displays a small script that sends an AJAX request for the page. It passes the $post_id to the AJAX - * callback function for updating the meta. - * - * @since 0.1 - */ -function wpfc_entry_views_load_scripts() { - global $wpfc_entry_views; - /* Create a nonce for the AJAX request. */ - $nonce = wp_create_nonce( 'wpfc_entry_views_ajax' ); - /* Display the JavaScript needed. */ - echo '' . "\n"; -} - -?> +get_queried_object(); + /* Check if the post type supports the 'entry-views' feature. */ + if ( post_type_supports( $post->post_type, 'entry-views' ) ) { + if ( empty( $wpfc_entry_views ) ) { + $wpfc_entry_views = new stdClass(); + } + /* Set the post ID for later use because we wouldn't want a custom query to change this. */ + $wpfc_entry_views->post_id = $post->ID; + /* Enqueue the jQuery library. */ + wp_enqueue_script( 'jquery' ); + /* Load the entry views JavaScript in the footer. */ + add_action( 'wp_footer', 'wpfc_entry_views_load_scripts' ); + } + } +} + +/** + * Updates the number of views when on a singular view of a post. This function uses post meta to store + * the number of views per post. By default, the meta key is 'Views', but you can filter this with the + * 'wpfc_entry_views_meta_key' hook. + * + * @since 0.1 + */ +function wpfc_entry_views_update( $post_id = '' ) { + global $wp_query; + /* If we're on a singular view of a post, calculate the number of views. */ + if ( ! empty( $post_id ) ) { + /* Allow devs to override the meta key used. By default, this is 'Views'. */ + $meta_key = apply_filters( 'wpfc_entry_views_meta_key', 'Views' ); + /* Get the number of views the post currently has. */ + $old_views = get_post_meta( $post_id, $meta_key, true ); + /* Add +1 to the number of current views. */ + $new_views = absint( $old_views ) + 1; + /* Update the view count with the new view count. */ + update_post_meta( $post_id, $meta_key, $new_views, $old_views ); + } +} + +/** + * Gets the number of views a specific post has. It also doubles as a shortcode, which is called with the + * [entry-views] format. + * + * @since 0.1 + * + * @param array $attr Attributes for use in the shortcode. + */ +function wpfc_entry_views_get( $attr = '' ) { + global $post; + /* Merge the defaults and the given attributes. */ + $attr = shortcode_atts( array( 'before' => '', 'after' => '', 'post_id' => $post->ID ), $attr ); + /* Allow devs to override the meta key used. */ + $meta_key = apply_filters( 'wpfc_entry_views_meta_key', 'Views' ); + /* Get the number of views the post has. */ + $views = intval( get_post_meta( $attr['post_id'], $meta_key, true ) ); + + /* Returns the formatted number of views. */ + + return $attr['before'] . number_format_i18n( $views ) . $attr['after']; +} + +/** + * Callback function hooked to 'wp_ajax_wpfc_entry_views' and 'wp_ajax_nopriv_wpfc_entry_views'. It checks the + * AJAX nonce and passes the given $post_id to the entry views update function. + * + * @since 0.1 + */ +function wpfc_entry_views_update_ajax() { + /* Check the AJAX nonce to make sure this is a valid request. */ + check_ajax_referer( 'wpfc_entry_views_ajax' ); + /* If the post ID is set, set it to the $post_id variable and make sure it's an integer. */ + if ( isset( $_POST['post_id'] ) ) { + $post_id = absint( $_POST['post_id'] ); + } + /* If $post_id isn't empty, pass it to the wpfc_entry_views_update() function to update the view count. */ + if ( ! empty( $post_id ) ) { + wpfc_entry_views_update( $post_id ); + } +} + +/** + * Displays a small script that sends an AJAX request for the page. It passes the $post_id to the AJAX + * callback function for updating the meta. + * + * @since 0.1 + */ +function wpfc_entry_views_load_scripts() { + global $wpfc_entry_views; + /* Create a nonce for the AJAX request. */ + $nonce = wp_create_nonce( 'wpfc_entry_views_ajax' ); + /* Display the JavaScript needed. */ + echo '' . "\n"; +} + +?> diff --git a/sermons.php b/sermons.php index cca7c1b..d7ec461 100755 --- a/sermons.php +++ b/sermons.php @@ -319,11 +319,11 @@ private function _includes() { include SM_PATH . 'includes/sm-deprecated-functions.php'; // Deprecated SM functions. include SM_PATH . 'includes/sm-formatting-functions.php'; // Data formatting. include SM_PATH . 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies. - include SM_PATH . 'includes/entry-views.php'; // Entry Views Tracking. + include SM_PATH . 'includes/vendor/entry-views.php'; // Entry Views Tracking. include SM_PATH . 'includes/class-sm-shortcodes.php'; // Shortcodes. include SM_PATH . 'includes/widgets.php'; // Widgets. include SM_PATH . 'includes/sm-template-functions.php'; // Template functions. - include SM_PATH . 'includes/podcast-functions.php'; // Podcast Functions. + include SM_PATH . 'includes/sm-podcast-functions.php'; // Podcast Functions. include SM_PATH . 'includes/helper-functions.php'; // Global Helper Functions. /** From 53de65258c8be441128c72c7f5927ffffd833dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:26:22 +0200 Subject: [PATCH 022/119] Remove unused file - revert if users complain --- includes/helper-functions.php | 199 ---------------------------------- 1 file changed, 199 deletions(-) delete mode 100644 includes/helper-functions.php diff --git a/includes/helper-functions.php b/includes/helper-functions.php deleted file mode 100644 index 41fa94e..0000000 --- a/includes/helper-functions.php +++ /dev/null @@ -1,199 +0,0 @@ -'; - $title_html .= $title; - $title_html .= ''; - } else { - $title_html = ''; - } - - return $title_html; - -} - -function wpfc_get_sermon_description( $id ) { - - if ( empty( $id ) ) { - $id = ''; - } - - $sermon_description = ''; - - $sermon_description = get_post_meta( $id, 'sermon_description', true ); - - return $sermon_description; - -} - -function wpfc_get_sermon_description_html( $id ) { - - $description = wpfc_get_sermon_description( $id ); - if ( empty( $description ) ) { - $description_html = ''; - } else { - $description_html = '

    '; - $description_html .= $description; - $description_html .= '

    '; - } - - return $description_html; - -} - -function wpfc_get_sermon_video( $id ) { - - $sermon_video = get_post_meta( $id, 'sermon_video', true ); - - if ( empty( $sermon_video ) ) { - $sermon_video = ''; - } - - return $sermon_video; - -} - -function wpfc_get_sermon_notes( $id ) { - - $sermon_notes = get_post_meta( $id, 'sermon_notes', true ); - - if ( empty( $sermon_notes ) ) { - $sermon_notes = ''; - } - - return $sermon_notes; - -} - -function wpfc_get_sermon_audio( $id ) { - - $sermon_audio = get_post_meta( $id, 'sermon_audio', true ); - - if ( empty( $sermon_audio ) ) { - $sermon_audio = ''; - } - - return $sermon_audio; - -} - -function wpfc_get_sermon_passage( $id ) { - - $sermon_passage = get_post_meta( $id, 'bible_passage', true ); - - if ( empty( $sermon_passage ) ) { - $sermon_passage = ''; - } - - return $sermon_passage; - -} - -function wpfc_get_sermon_speaker( $id ) { - - $sermon_speaker = get_the_terms( $id, 'wpfc_preacher' ); - - if ( empty( $sermon_speaker ) || ! is_array( $sermon_speaker ) ) { - $sermon_speaker = ''; - } else { - $sermon_speaker = $sermon_speaker[0]->name; - } - - return $sermon_speaker; - -} - -function wpfc_get_sermon_speaker_html( $id ) { - - $speaker = wpfc_get_sermon_speaker( $id ); - - $speaker_html = ''; - $speaker_html .= $speaker; - $speaker_html .= ''; - - return $speaker_html; - -} - -function wpfc_get_sermon_series( $id ) { - - $sermon_series = get_the_terms( $id, 'wpfc_sermon_series' ); - - if ( empty( $sermon_series ) || ! is_array( $sermon_series ) ) { - $sermon_series = ''; - } else { - $sermon_series = $sermon_series[0]->name; - } - - return $sermon_series; - -} - -function wpfc_get_sermon_series_html( $id ) { - - $series = wpfc_get_sermon_series( $id ); - - $series_html = ''; - $series_html .= __( 'Series: ', 'sermon-manager-for-wordpress' ); - $series_html .= $series; - $series_html .= ''; - - return $series_html; - -} From 42a53576cfeb711ff6640abe4f5a9a53a0b13dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:32:56 +0200 Subject: [PATCH 023/119] Code Style: class-sm-post-types.php --- includes/class-sm-post-types.php | 105 +++++++++++++++++++------------ 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index 1450c16..4378eb0 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -1,14 +1,20 @@ false, - /* translators: %s Preachers label (sentence case; plural) */ - 'label' => wp_sprintf( __( '%s', 'sermon-manager-for-wordpress' ), ucwords( $preacher_label ) . 's' ), + 'label' => ucwords( $preacher_label ), 'labels' => array( - /* translators: %s Preachers label (sentence case; plural) */ - 'name' => wp_sprintf( __( '%s', 'sermon-manager-for-wordpress' ), ucwords( $preacher_label ) . 's' ), - /* translators: %s Preacher label (sentence case; singular) */ - 'singular_name' => wp_sprintf( __( '%s', 'sermon-manager-for-wordpress' ), ucwords( $preacher_label ) ), - /* translators: %s Preachers label (sentence case; plural) */ - 'menu_name' => wp_sprintf( _x( '%s', 'menu', 'sermon-manager-for-wordpress' ), ucwords( $preacher_label ) . 's' ), - /* translators: %s Preachers label (lowercase; plural) */ - 'search_items' => wp_sprintf( __( 'Search %s', 'sermon-manager-for-wordpress' ), $preacher_label . 's' ), - /* translators: %s Preachers label (lowercase; plural) */ - 'all_items' => wp_sprintf( __( 'All %s', 'sermon-manager-for-wordpress' ), $preacher_label . 's' ), - 'parent_item' => null, // it's not hierarchical - 'parent_item_colon' => null, // it's not hierarchical - /* translators: %s Preacher label (lowercase; singular) */ + 'name' => $preacher_label_plural, + 'singular_name' => $preacher_label, + 'menu_name' => $preacher_label_plural, + /* translators: Preachers */ + 'search_items' => wp_sprintf( __( 'Search %s', 'sermon-manager-for-wordpress' ), $preacher_label_plural ), + /* translators: Preachers */ + 'all_items' => wp_sprintf( __( 'All %s', 'sermon-manager-for-wordpress' ), $preacher_label_plural ), + 'parent_item' => null, + 'parent_item_colon' => null, + /* translators: Preachers */ 'edit_item' => wp_sprintf( __( 'Edit %s', 'sermon-manager-for-wordpress' ), $preacher_label ), - /* translators: %s Preacher label (lowercase; singular) */ + /* translators: Preachers */ 'update_item' => wp_sprintf( __( 'Update %s', 'sermon-manager-for-wordpress' ), $preacher_label ), - /* translators: %s Preacher label (lowercase; singular) */ + /* translators: Preachers */ 'add_new_item' => wp_sprintf( __( 'Add new %s', 'sermon-manager-for-wordpress' ), $preacher_label ), - /* translators: %s Preacher label (lowercase; singular) */ + /* translators: Preachers */ 'new_item_name' => wp_sprintf( __( 'New %s name', 'sermon-manager-for-wordpress' ), $preacher_label ), - /* translators: %s Preacher label (lowercase; singular) */ + /* translators: Preachers */ 'not_found' => wp_sprintf( __( 'No %s found', 'sermon-manager-for-wordpress' ), $preacher_label ), ), 'show_ui' => true, 'query_var' => true, 'show_in_rest' => true, - 'rewrite' => array( 'slug' => $permalinks['wpfc_preacher'], 'with_front' => false ), - ) ) ); + 'rewrite' => array( + 'slug' => $permalinks['wpfc_preacher'], + 'with_front' => false, + ), + ) ) + ); register_taxonomy( 'wpfc_sermon_series', apply_filters( 'sm_taxonomy_objects_wpfc_sermon_series', array( 'wpfc_sermon' ) ), @@ -83,8 +90,8 @@ public static function register_taxonomies() { 'menu_name' => _x( 'Series', 'menu', 'sermon-manager-for-wordpress' ), 'search_items' => __( 'Search series', 'sermon-manager-for-wordpress' ), 'all_items' => __( 'All series', 'sermon-manager-for-wordpress' ), - 'parent_item' => null, // it's not hierarchical - 'parent_item_colon' => null, // it's not hierarchical + 'parent_item' => null, + 'parent_item_colon' => null, 'edit_item' => __( 'Edit series', 'sermon-manager-for-wordpress' ), 'update_item' => __( 'Update series', 'sermon-manager-for-wordpress' ), 'add_new_item' => __( 'Add new series', 'sermon-manager-for-wordpress' ), @@ -94,8 +101,12 @@ public static function register_taxonomies() { 'show_ui' => true, 'query_var' => true, 'show_in_rest' => true, - 'rewrite' => array( 'slug' => $permalinks['wpfc_sermon_series'], 'with_front' => false ), - ) ) ); + 'rewrite' => array( + 'slug' => $permalinks['wpfc_sermon_series'], + 'with_front' => false, + ), + ) ) + ); register_taxonomy( 'wpfc_sermon_topics', apply_filters( 'sm_taxonomy_objects_wpfc_sermon_topics', array( 'wpfc_sermon' ) ), @@ -119,8 +130,12 @@ public static function register_taxonomies() { 'show_ui' => true, 'query_var' => true, 'show_in_rest' => true, - 'rewrite' => array( 'slug' => $permalinks['wpfc_sermon_topics'], 'with_front' => false ), - ) ) ); + 'rewrite' => array( + 'slug' => $permalinks['wpfc_sermon_topics'], + 'with_front' => false, + ), + ) ) + ); register_taxonomy( 'wpfc_bible_book', apply_filters( 'sm_taxonomy_objects_wpfc_bible_book', array( 'wpfc_sermon' ) ), @@ -144,8 +159,12 @@ public static function register_taxonomies() { 'show_ui' => true, 'query_var' => true, 'show_in_rest' => true, - 'rewrite' => array( 'slug' => $permalinks['wpfc_bible_book'], 'with_front' => false ), - ) ) ); + 'rewrite' => array( + 'slug' => $permalinks['wpfc_bible_book'], + 'with_front' => false, + ), + ) ) + ); register_taxonomy( 'wpfc_service_type', apply_filters( 'sm_taxonomy_objects_wpfc_service_type', array( 'wpfc_sermon' ) ), @@ -169,8 +188,12 @@ public static function register_taxonomies() { 'show_ui' => true, 'query_var' => true, 'show_in_rest' => true, - 'rewrite' => array( 'slug' => $permalinks['wpfc_service_type'], 'with_front' => false ), - ) ) ); + 'rewrite' => array( + 'slug' => $permalinks['wpfc_service_type'], + 'with_front' => false, + ), + ) ) + ); do_action( 'sm_after_register_taxonomy' ); } @@ -222,7 +245,10 @@ public static function register_post_types() { 'show_in_menu' => true, 'menu_icon' => 'dashicons-sermon-manager', 'hierarchical' => false, - 'rewrite' => array( 'slug' => $permalinks['wpfc_sermon'], 'with_front' => false ), + 'rewrite' => array( + 'slug' => $permalinks['wpfc_sermon'], + 'with_front' => false, + ), 'query_var' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true, @@ -235,7 +261,7 @@ public static function register_post_types() { 'comments', 'entry-views', 'elementor', - ) + ), ) ) ); do_action( 'sm_after_register_post_type' ); @@ -253,6 +279,7 @@ public static function flush_rewrite_rules() { */ public static function support_jetpack_omnisearch() { if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) { + /* @noinspection PhpUndefinedClassInspection */ new Jetpack_Omnisearch_Posts( 'wpfc_sermon' ); } } @@ -260,7 +287,7 @@ public static function support_jetpack_omnisearch() { /** * Add sermon support for Jetpack related posts. * - * @param array $post_types + * @param array $post_types Array of allowed post types. * * @return array */ @@ -271,7 +298,7 @@ public static function rest_api_allowed_post_types( $post_types ) { } /** - * Shorthand function for flush_rewrite_rules(true) + * Shorthand function for flush_rewrite_rules(true). * * @since 2.7.1 */ From ed96cd398f03a4f82a3e5dce46a8a9991a1d6e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:38:01 +0200 Subject: [PATCH 024/119] Code Style: class-sm-install.php --- includes/class-sm-install.php | 76 +++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/includes/class-sm-install.php b/includes/class-sm-install.php index 4ca3f89..0de2eca 100644 --- a/includes/class-sm-install.php +++ b/includes/class-sm-install.php @@ -1,5 +1,11 @@ array( 'sm_update_28_revert_old_dates', @@ -17,7 +27,7 @@ class SM_Install { 'sm_update_28_save_sermon_render_into_post_content', ), '2.8.4' => array( - 'sm_update_284_resave_sermons' + 'sm_update_284_resave_sermons', ), '2.9' => array( 'sm_update_29_fill_out_series_dates', @@ -27,20 +37,27 @@ class SM_Install { 'sm_update_293_fix_import_dates', ), '2.10' => array( - 'sm_update_210_update_options' + 'sm_update_210_update_options', ), '2.11' => array( 'sm_update_211_render_content', 'sm_update_211_update_date_time', ), '2.12.3' => array( - 'sm_update_2123_fix_preacher_permalink' - ) + 'sm_update_2123_fix_preacher_permalink', + ), ); - /** @var object Background update class */ + /** + * Background update class + * + * @var object + */ private static $background_updater; + /** + * Initialize the updater. + */ public static function init() { add_action( 'init', array( __CLASS__, 'init_background_updater' ), 3 ); add_action( 'init', array( __CLASS__, 'check_version' ), 8 ); @@ -50,21 +67,21 @@ public static function init() { } /** - * Check Sermon Manager version and run the updater is required + * Check Sermon Manager version and run the updater is required. * - * This check is done on all requests and runs if the versions do not match + * This check is done on all requests and runs if the versions do not match. */ public static function check_version() { global $pagenow; - if ( ! defined( 'IFRAME_REQUEST' ) && ( ( $pagenow === 'plugins.php' && isset( $_GET['activate'] ) && $_GET['activate'] === 'true' ) || get_option( 'sm_version' ) !== SM_VERSION ) ) { + if ( ! defined( 'IFRAME_REQUEST' ) && ( ( 'plugins.php' === $pagenow && isset( $_GET['activate'] ) && 'true' === $_GET['activate'] ) || SM_VERSION !== get_option( 'sm_version' ) ) ) { self::_install(); do_action( 'sm_updated' ); } } /** - * Install Sermon Manager + * Install Sermon Manager. */ private static function _install() { global $wpdb; @@ -77,23 +94,23 @@ private static function _install() { define( 'SM_INSTALLING', true ); } + // self::_create_roles(); @todo: will be done in future versions (move it below options). self::_create_options(); - //self::_create_roles(); todo: will be done in future versions - // Register post types + // Register post types. SM_Post_types::register_post_types(); SM_Post_types::register_taxonomies(); - // do update + // Do update. self::_update(); - // Update version just in case + // Update version just in case. self::update_db_version(); - // Flush 1 + // Flush 1. do_action( 'sm_flush_rewrite_rules' ); - // Flush 2 + // Flush 2. add_action( 'init', function () { do_action( 'sm_flush_rewrite_rules' ); } ); @@ -105,15 +122,13 @@ private static function _install() { * * Based on code inside core's upgrade_network() function. */ - /** @noinspection SqlNoDataSourceInspection */ - $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b + $wpdb->query( $wpdb->prepare( "DELETE a, b FROM $wpdb->options a, $wpdb->options b WHERE a.option_name LIKE %s AND a.option_name NOT LIKE %s AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) - AND b.option_value < %d"; - $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', time() ) ); + AND b.option_value < %d", $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', time() ) ); - // Trigger action + // Trigger action. do_action( 'sm_installed' ); } @@ -125,7 +140,7 @@ private static function _install() { * @since 2.10 */ private static function _create_options() { - // Include settings so that we can run through defaults + // Include settings so that we can run through defaults. include_once 'admin/class-sm-admin-settings.php'; $settings = SM_Admin_Settings::get_settings_pages(); @@ -180,7 +195,7 @@ private static function _get_db_update_callbacks() { /** * Update DB version to current. * - * @param string $version (optional) + * @param string $version (optional). */ public static function update_db_version( $version = null ) { delete_option( 'sm_version' ); @@ -188,7 +203,7 @@ public static function update_db_version( $version = null ) { } /** - * Init background updates + * Init background updates. */ public static function init_background_updater() { include_once 'class-sm-background-updater.php'; @@ -196,9 +211,9 @@ public static function init_background_updater() { } /** - * Add more cron schedules + * Add more cron schedules. * - * @param array $schedules + * @param array $schedules The existing array of schedule data. * * @return array */ @@ -214,7 +229,7 @@ public static function cron_schedules( $schedules ) { /** * Show action links on the plugin screen. * - * @param mixed $links Plugin Action links + * @param mixed $links Plugin Action links. * * @return array */ @@ -229,13 +244,12 @@ public static function plugin_action_links( $links ) { /** * Show row meta on the plugin screen. * - * @param mixed $links Plugin Row Meta - * @param mixed $file Plugin Base file + * @param mixed $links Plugin Row Meta. + * @param mixed $file Plugin Base file. * * @return array */ public static function plugin_row_meta( $links, $file ) { - /** @noinspection PhpUndefinedConstantInspection */ if ( SM_BASENAME == $file ) { $row_meta = array( 'support' => '' . esc_html__( 'Premium support', 'sermon-manager-for-wordpress' ) . '', From 28c5d076fa05876392fd81f65c00d4cf4809d2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:42:20 +0200 Subject: [PATCH 025/119] Code Style: class-sm-dates-wp.php --- includes/class-sm-dates-wp.php | 64 +++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/includes/class-sm-dates-wp.php b/includes/class-sm-dates-wp.php index ea3e089..0d7e00f 100644 --- a/includes/class-sm-dates-wp.php +++ b/includes/class-sm-dates-wp.php @@ -1,16 +1,22 @@ 'wpfc_sermon_series', 'field' => 'term_id', - 'terms' => $term->term_id - ) - ) + 'terms' => $term->term_id, + ), + ), ) ); if ( $query->have_posts() ) { $date = get_post_meta( $query->posts[0]->ID, 'sermon_date', true ); @@ -148,7 +154,7 @@ public static function update_series_date() { } /** - * Used to save date that was there before sermon update, for later comparison + * Used to save date that was there before sermon update, for later comparison. * * @param int $post_ID Post ID. * @@ -163,7 +169,7 @@ public static function get_original_date( $post_ID ) { } /** - * Sets/updates date for posts if they are not user-defined + * Sets/updates date for posts if they are not user-defined. * * @param int $post_ID Post ID. * @param WP_Post $post Post object. @@ -172,10 +178,11 @@ public static function get_original_date( $post_ID ) { * @since 2.7 */ public static function maybe_update_date( $post_ID, $post, $update ) { - $update_date = $auto = false; + $update_date = false; + $auto = false; if ( $update ) { - // compare sermon date and if user changed it update sermon date and disable auto update + // Compare sermon date and if user changed it update sermon date and disable auto update. if ( ! empty( $_POST['sermon_date'] ) ) { switch ( \SermonManager::getOption( 'date_format' ) ) { case '0': @@ -201,10 +208,10 @@ public static function maybe_update_date( $post_ID, $post, $update ) { $time = array( $dt_post->format( 'H' ), $dt_post->format( 'i' ), - $dt_post->format( 's' ) + $dt_post->format( 's' ), ); - // convert all to ints + // Convert all to ints. $time = array_map( 'intval', $time ); list( $hours, $minutes, $seconds ) = $time; @@ -217,30 +224,31 @@ public static function maybe_update_date( $post_ID, $post, $update ) { } } - // compare published date and if user changed it update sermon date if auto update is set + // Compare published date and if user changed it update sermon date if auto update is set. if ( ! empty( $GLOBALS['sm_original_published_date'] ) ) { - if ( $post->post_date !== $GLOBALS['sm_original_published_date'] && - get_post_meta( $post_ID, 'sermon_date_auto', true ) == 1 ) { + if ( $post->post_date !== $GLOBALS['sm_original_published_date'] && 1 == get_post_meta( $post_ID, 'sermon_date_auto', true ) ) { $update_date = true; } } } - // if sermon date is blank (not set on sermon create or removed later on update), mark - // this post for auto updating and update date now - if ( isset( $_POST['sermon_date'] ) && $_POST['sermon_date'] == '' ) { + /* + * If sermon date is blank (not set on sermon create or removed later on update), mark + * this post for auto updating and update date now. + */ + if ( isset( $_POST['sermon_date'] ) && '' == $_POST['sermon_date'] ) { $update_date = true; $auto = true; } - // if marked for date updating + // If marked for date updating. if ( $update_date ) { update_post_meta( $post_ID, 'sermon_date', mysql2date( 'U', $post->post_date ) ); } - // if we should set it for auto date updating + // If we should set it for auto date updating. if ( $auto ) { update_post_meta( $post_ID, 'sermon_date_auto', '1' ); } } -} \ No newline at end of file +} From 9c7b00cb067747f5a532197f9d82f9205ddfd2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:46:13 +0200 Subject: [PATCH 026/119] Code Style: class-sm-dates.php --- includes/class-sm-dates.php | 67 ++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/includes/class-sm-dates.php b/includes/class-sm-dates.php index ef8d63a..4a6b77d 100644 --- a/includes/class-sm-dates.php +++ b/includes/class-sm-dates.php @@ -1,10 +1,16 @@ ) Sermon Manager versions will save - * the date as Unix timestamp so sanitation is not required + * the date as Unix timestamp so sanitation is not required. * - * @return string|false Date when sermon was preached. False on failure + * @return string|false Date when sermon was preached. False on failure. */ public static function get( $format = '', $post = null, $force_unix_sanitation = false ) { - // Reset the variable - $has_time = $sanitized = false; + // Reset the variable. + $has_time = false; + $sanitized = false; - // Get the sermon + // Get the sermon. $post = get_post( $post ); - // If we are working on right post type - if ( ! $post || $post->post_type !== 'wpfc_sermon' ) { + // If we are working on right post type. + if ( ! $post || 'wpfc_sermon' !== $post->post_type ) { return false; } - // Check if date is set - if ( ! $date = get_post_meta( $post->ID, 'sermon_date', true ) ) { + // Check if date is set. + $date = get_post_meta( $post->ID, 'sermon_date', true ); + if ( ! $date ) { return false; } - // Save original date to a variable to allow later filtering + // Save original date to a variable to allow later filtering. $orig_date = $date; - // If it's already an Unix timestamp, don't convert it - if ( is_numeric( $date ) && $date = intval( trim( $date ) ) ) { - $dt = DateTime::createFromFormat( 'U', $date ); + // If it's already an Unix timestamp, don't convert it. + $date_copy = intval( trim( $date ) ); + if ( is_numeric( $date ) && $date_copy ) { + $dt = DateTime::createFromFormat( 'U', $date_copy ); if ( $dt->format( 'H' ) !== '00' || $dt->format( 'i' ) !== '00' ) { $has_time = true; } @@ -57,8 +66,8 @@ public static function get( $format = '', $post = null, $force_unix_sanitation = update_post_meta( $post->ID, 'sermon_date', $date ); } - // Check if we need to force it - if ( $sanitized === false && $force_unix_sanitation === true ) { + // Check if we need to force it. + if ( false === $sanitized && true === $force_unix_sanitation ) { $date = self::sanitize( $date ); } @@ -70,10 +79,10 @@ public static function get( $format = '', $post = null, $force_unix_sanitation = $time = array( $dt->format( 'H' ), $dt->format( 'i' ), - $dt->format( 's' ) + $dt->format( 's' ), ); - // convert all to ints + // Convert all to ints. $time = array_map( 'intval', $time ); list( $hours, $minutes, $seconds ) = $time; @@ -81,13 +90,15 @@ public static function get( $format = '', $post = null, $force_unix_sanitation = $date += $hours * HOUR_IN_SECONDS + $minutes * MINUTE_IN_SECONDS + $seconds; } - // Check if format is set. If not, set to WP defined, or in super rare cases - // when WP format is not defined, set it to Unix timestamp + /* + * Check if format is set. If not, set to WP defined, or in super rare cases + * when WP format is not defined, set it to Unix timestamp. + */ if ( empty( $format ) ) { $format = get_option( 'date_format', 'U' ); } - // Format it + // Format it. $date = date_i18n( $format, $date ); /** @@ -106,7 +117,7 @@ public static function get( $format = '', $post = null, $force_unix_sanitation = /** * Tries to convert the textual date to Unix timestamp * - * @param string $date + * @param string $date The textual representation of date. * * @return int Unix timestamp */ @@ -126,8 +137,4 @@ protected static function sanitize( $date ) { */ return apply_filters( 'sm_sanitize_date', $sanitized_date, $date ); } - - public static function set( $date, $post ) { - - } -} \ No newline at end of file +} From fb67ef4dc784a74aa78665ca5aad005efa8221b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 19:48:56 +0200 Subject: [PATCH 027/119] Code Style: class-sm-background-updater.php --- includes/class-sm-background-updater.php | 24 ++++++++++++++++++++---- includes/class-sm-install.php | 2 +- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/includes/class-sm-background-updater.php b/includes/class-sm-background-updater.php index f5500c7..68e362f 100644 --- a/includes/class-sm-background-updater.php +++ b/includes/class-sm-background-updater.php @@ -1,6 +1,16 @@ Date: Sat, 7 Apr 2018 19:55:21 +0200 Subject: [PATCH 028/119] Code Style: class-sm-autoloader.php --- includes/class-sm-autoloader.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/includes/class-sm-autoloader.php b/includes/class-sm-autoloader.php index f1b1892..faeffca 100644 --- a/includes/class-sm-autoloader.php +++ b/includes/class-sm-autoloader.php @@ -1,4 +1,10 @@ Date: Sat, 7 Apr 2018 19:57:40 +0200 Subject: [PATCH 029/119] Code Style: class-sm-api.php --- includes/class-sm-api.php | 61 ++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/includes/class-sm-api.php b/includes/class-sm-api.php index 65d7066..5e75feb 100644 --- a/includes/class-sm-api.php +++ b/includes/class-sm-api.php @@ -1,8 +1,14 @@ ID, $key, $data ); - if ( $key === 'sermon_date' ) { - update_post_meta( $post->ID, 'sermon_date_auto', $data === '' ); + if ( 'sermon_date' === $key ) { + update_post_meta( $post->ID, 'sermon_date_auto', '' === $data ); } add_filter( "cmb2_override_{$key}_meta_remove", '__return_true' ); @@ -67,20 +75,20 @@ public function save_custom_data( $post, $request ) { } /** - * Fixes ordering by date to use `sermon_date` meta (aka "Preached Date") - * Use "wpdate" for original WordPress "date" ordering + * Fixes ordering by date to use `sermon_date` meta (aka "Preached Date"). + * Use "wpdate" for original WordPress "date" ordering. * - * @param array $args WP_Query arguments + * @param array $args Query parameters. * * @return mixed Modified arguments */ public function fix_ordering( $args ) { - if ( $args['orderby'] === 'date' ) { + if ( 'date' === $args['orderby'] ) { $args['orderby'] = 'meta_value_num'; $args['meta_key'] = 'sermon_date'; $args['meta_value_num'] = time(); $args['meta_compare'] = '<='; - } elseif ( $args['orderby'] === 'wpdate' ) { + } elseif ( 'wpdate' === $args['orderby'] ) { $args['orderby'] = 'date'; } @@ -88,14 +96,14 @@ public function fix_ordering( $args ) { } /** - * Currently, it only replaces "post" string with "sermon", but we can add more query parameters here if needed + * Currently, it only replaces "post" string with "sermon", but we can add more query parameters here if needed. * - * @param array $query_params + * @param array $query_params Query parameters. * * @return array Modified query params */ public function modify_query_params( $query_params ) { - // Replace "post" to "sermon" + // Replace "post" to "sermon". $query_params['slug']['description'] = str_replace( 'post', 'sermon', $query_params['slug']['description'] ); $query_params['status']['description'] = str_replace( 'post', 'sermon', $query_params['status']['description'] ); $query_params['after']['description'] = str_replace( 'post', 'sermon', $query_params['after']['description'] ); @@ -105,11 +113,11 @@ public function modify_query_params( $query_params ) { } /** - * Add custom data to the response, such as audio, passage, etc + * Add custom data to the response, such as audio, passage, etc. * * @param WP_REST_Response $response The response object. * - * @return WP_REST_Response Modified response + * @return WP_REST_Response Modified response, */ public function add_custom_data( $response ) { $data = &$response->data; @@ -137,13 +145,14 @@ public function add_custom_data( $response ) { $data['sermon_bulletin'] = $post_meta['sermon_bulletin'][0]; $data['_featured_url'] = wp_get_attachment_url( $post_meta['_thumbnail_id'][0] ); - if ( $date = SM_Dates::get( 'U', $data['id'] ) ) { + $date = SM_Dates::get( 'U', $data['id'] ); + if ( $date ) { $data['sermon_date'] = intval( $date ); - $data['_sermon_date_auto'] = $post_meta['sermon_date_auto'][0] == 1 ? true : false; + $data['_sermon_date_auto'] = 1 == $post_meta['sermon_date_auto'][0] ? true : false; } return $response; } } -new SM_API(); \ No newline at end of file +new SM_API(); From a3f357b3fcd2b7955de34e69e36ab6ed5eb0c630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 20:31:49 +0200 Subject: [PATCH 030/119] Code Style: sm-admin-functions.php --- includes/admin-functions.php | 287 -------------------------- includes/admin/sm-admin-functions.php | 157 ++++++++++++++ sermons.php | 4 +- 3 files changed, 158 insertions(+), 290 deletions(-) delete mode 100644 includes/admin-functions.php diff --git a/includes/admin-functions.php b/includes/admin-functions.php deleted file mode 100644 index 7e2e584..0000000 --- a/includes/admin-functions.php +++ /dev/null @@ -1,287 +0,0 @@ -publish ); - // put correct singular or plural text - // translators: %s integer count of sermons - $text = wp_sprintf( esc_html( _n( '%s sermon', '%s sermons', intval( $num_posts->publish ), 'sermon-manager-for-wordpress' ) ), $num ); - - $count = '
  • '; - - if ( current_user_can( 'edit_posts' ) ) { - $count .= '' . $text . ''; - } else { - $count .= $text; - } - - $count .= '
  • '; - $count .= ""; - echo $count; -} - - -/* -Taxonomy Short Description -http://wordpress.mfields.org/plugins/taxonomy-short-description/ -Shortens the description shown in the administration panels for all categories, tags and custom taxonomies. -V: 1.3.1 -Copyright 2011 Michael Fields michael@mfields.org - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 as published by -the Free Software Foundation. - -Function names have been modified to prevent conflicts. -*/ - -// Actions. -function wpfc_taxonomy_short_description_actions() { - $taxonomies = get_taxonomies(); - foreach ( $taxonomies as $taxonomy ) { - $config = get_taxonomy( $taxonomy ); - if ( isset( $config->show_ui ) && true == $config->show_ui ) { - add_action( 'manage_' . $taxonomy . '_custom_column', 'wpfc_taxonomy_short_description_rows', 10, 3 ); - add_action( 'manage_edit-' . $taxonomy . '_columns', 'wpfc_taxonomy_short_description_columns' ); - add_filter( 'manage_edit-' . $taxonomy . '_sortable_columns', 'wpfc_taxonomy_short_description_columns' ); - } - } -} - -// Term Columns. -// Remove the default "Description" column. Add a custom "Short Description" column. -function wpfc_taxonomy_short_description_columns( $columns ) { - $position = 0; - $iterator = 1; - foreach ( $columns as $column => $display_name ) { - if ( 'name' == $column ) { - $position = $iterator; - } - $iterator ++; - } - if ( 0 < $position ) { - /* Store all columns up to and including "Name". */ - $before = $columns; - array_splice( $before, $position ); - - /* All of the other columns are stored in $after. */ - $after = $columns; - $after = array_diff( $columns, $before ); - - /* Prepend a custom column for the short description. */ - $after = array_reverse( $after, true ); - $after['mfields_short_description'] = $after['description']; - $after = array_reverse( $after, true ); - - /* Remove the original description column. */ - unset( $after['description'] ); - - /* Join all columns back together. */ - $columns = $before + $after; - } - - return $columns; -} - - -// Term Rows. - Display the shortened description in each row's custom column. -function wpfc_taxonomy_short_description_rows( $string, $column_name, $term ) { - if ( 'mfields_short_description' == $column_name ) { - global $taxonomy; - $string = term_description( $term, $taxonomy ); - $string = wpfc_taxonomy_short_description_shorten( $string, apply_filters( 'mfields_taxonomy_short_description_length', 130 ) ); - } - - return $string; -} - -// Shorten a string to a given length. -function wpfc_taxonomy_short_description_shorten( $string, $max_length = 23, $append = '…', $encoding = 'utf8' ) { - - /* Sanitize $string. */ - $string = strip_tags( $string ); - $string = trim( $string ); - $string = html_entity_decode( $string, ENT_QUOTES, 'UTF-8' ); - $string = rtrim( $string, '-' ); - - /* Sanitize $max_length */ - if ( 0 == abs( (int) $max_length ) ) { - $max_length = 23; - } - - /* Return early if the php "mbstring" extension is not installed. */ - if ( ! function_exists( 'mb_substr' ) ) { - $length = strlen( $string ); - if ( $length > $max_length ) { - return substr_replace( $string, $append, $max_length ); - } - - return $string; - } - - /* Count how many characters are in the string. */ - $length = strlen( utf8_decode( $string ) ); - - /* String is longer than max-length. It needs to be shortened. */ - if ( $length > $max_length ) { - - /* Shorten the string to max-length */ - $short = substr( $string, 0, $max_length ); - - /* - * A word has been cut in half during shortening. - * If the shortened string contains more than one word - * the last word in the string will be removed. - */ - if ( 0 !== strpos( $string, $short . ' ', 0 ) ) { - $pos = strpos( $short, ' ' ); - if ( false !== $pos ) { - $short = strpos( $short, 0, $pos ); - } - } - - /* Append shortened string with the value of $append preceeded by a non-breaking space. */ - $string = $short . ' ' . $append; - } - - return $string; -} - -/** - * Returns duration of an MP3 file - * - * @param string $mp3_url URL to the MP3 file - * - * @return string duration - */ -function wpfc_mp3_duration( $mp3_url ) { - if ( empty( $mp3_url ) ) { - return ''; - } - - if ( ! class_exists( 'getID3' ) ) { - require_once ABSPATH . 'wp-includes/ID3/getid3.php'; - } - - // create a temporary file for the MP3 file - $filename = tempnam( '/tmp', 'getid3' ); - - if ( file_put_contents( $filename, file_get_contents( $mp3_url ) ) ) { - $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze( $filename ); - unlink( $filename ); - } - - $duration = isset( $ThisFileInfo['playtime_string'] ) ? $ThisFileInfo['playtime_string'] : ''; - - return $duration; -} diff --git a/includes/admin/sm-admin-functions.php b/includes/admin/sm-admin-functions.php index 0209ecc..fb62cf7 100644 --- a/includes/admin/sm-admin-functions.php +++ b/includes/admin/sm-admin-functions.php @@ -1,4 +1,10 @@ publish ); + // Put correct singular or plural text + // translators: %s integer count of sermons. + $text = wp_sprintf( esc_html( _n( '%s sermon', '%s sermons', intval( $num_posts->publish ), 'sermon-manager-for-wordpress' ) ), $num ); + + $count = '
  • '; + + if ( current_user_can( 'edit_posts' ) ) { + $count .= '' . $text . ''; + } else { + $count .= $text; + } + + $count .= '
  • '; + $count .= ""; + echo $count; +} + +add_action( 'dashboard_glance_items', 'wpfc_dashboard' ); + +/** + * Register required actions. + */ +function wpfc_taxonomy_short_description_actions() { + $taxonomies = get_taxonomies(); + foreach ( $taxonomies as $taxonomy ) { + if ( ! in_array( $taxonomy, array( + 'wpfc_preacher', + 'wpfc_sermon_series', + 'wpfc_sermon_topics', + 'wpfc_bible_book', + 'wpfc_service_type', + ) ) ) { + continue; + } + + add_action( 'manage_' . $taxonomy . '_custom_column', 'wpfc_taxonomy_short_description_rows', 100, 3 ); + add_action( 'manage_edit-' . $taxonomy . '_columns', 'wpfc_taxonomy_short_description_columns' ); + add_filter( 'manage_edit-' . $taxonomy . '_sortable_columns', 'wpfc_taxonomy_short_description_columns' ); + } +} + +add_action( 'admin_init', 'wpfc_taxonomy_short_description_actions' ); + +/** + * Replace existing column with custom so it can be modified. + * + * @param array $columns Existing columns. + * + * @return array + */ +function wpfc_taxonomy_short_description_columns( $columns ) { + $position = 0; + $iterator = 1; + foreach ( $columns as $column => $display_name ) { + if ( 'name' == $column ) { + $position = $iterator; + break; + } + $iterator ++; + } + if ( 0 < $position ) { + $columns = array_slice( $columns, 0, $position, true ) + array( 'short_description' => 'Description' ) + array_slice( $columns, $position + 1, count( $columns ) - 1, true ); + + return $columns; + } + + return $columns; +} + +/** + * Add short description content. + * + * @param mixed $default Default content. + * @param string $column_name Column name. + * @param int $term Term ID. + * + * @return mixed|string + */ +function wpfc_taxonomy_short_description_rows( $default, $column_name, $term ) { + if ( 'short_description' == $column_name ) { + global $taxonomy; + $default = term_description( $term, $taxonomy ); + $default = wp_trim_words( $default, 10 ); + } + + return $default; +} diff --git a/sermons.php b/sermons.php index d7ec461..a7e01ad 100755 --- a/sermons.php +++ b/sermons.php @@ -324,16 +324,14 @@ private function _includes() { include SM_PATH . 'includes/widgets.php'; // Widgets. include SM_PATH . 'includes/sm-template-functions.php'; // Template functions. include SM_PATH . 'includes/sm-podcast-functions.php'; // Podcast Functions. - include SM_PATH . 'includes/helper-functions.php'; // Global Helper Functions. /** * Admin only includes. */ if ( is_admin() ) { include SM_PATH . 'includes/admin/class-sm-admin.php'; // Admin init class. - include SM_PATH . 'includes/admin-functions.php'; // General Admin area functions. @todo: refactor before 2.9. - include SM_PATH . 'includes/vendor/CMB2/init.php'; // Metaboxes. include SM_PATH . 'includes/admin/sm-cmb-functions.php'; // CMB2 Meta Fields functions. + include SM_PATH . 'includes/vendor/CMB2/init.php'; // Metaboxes. } } From ad116ee528edd6971c34bb5518e5fd0689e8a301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 20:33:15 +0200 Subject: [PATCH 031/119] Remove unused file --- includes/admin/class-sm-admin.php | 1 - includes/admin/sm-meta-box-functions.php | 253 ----------------------- 2 files changed, 254 deletions(-) delete mode 100644 includes/admin/sm-meta-box-functions.php diff --git a/includes/admin/class-sm-admin.php b/includes/admin/class-sm-admin.php index 698c764..7b9d06e 100644 --- a/includes/admin/class-sm-admin.php +++ b/includes/admin/class-sm-admin.php @@ -28,7 +28,6 @@ public function buffer() { */ public function includes() { include_once 'sm-admin-functions.php'; - include_once 'sm-meta-box-functions.php'; include_once 'class-sm-admin-post-types.php'; include_once 'class-sm-admin-menus.php'; include_once 'class-sm-admin-assets.php'; diff --git a/includes/admin/sm-meta-box-functions.php b/includes/admin/sm-meta-box-functions.php deleted file mode 100644 index e346550..0000000 --- a/includes/admin/sm-meta-box-functions.php +++ /dev/null @@ -1,253 +0,0 @@ -ID : $thepostid; - $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; - $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; - $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; - - switch ( $data_type ) { - case 'url' : - $field['class'] .= ' sm_input_url'; - $field['value'] = esc_url( $field['value'] ); - break; - - default : - break; - } - - // Custom attribute handling - $custom_attributes = array(); - - if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { - - foreach ( $field['custom_attributes'] as $attribute => $value ) { - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; - } - } - - echo '

    - '; - - if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { - //echo sm_help_tip( $field['description'] ); - } - - echo ' '; - - if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { - echo '' . wp_kses_post( $field['description'] ) . ''; - } - - echo '

    '; -} - -/** - * Output a hidden input box. - * - * @param array $field - */ -function sm_wp_hidden_input( $field ) { - global $thepostid, $post; - - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; - $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); - $field['class'] = isset( $field['class'] ) ? $field['class'] : ''; - - echo ' '; -} - -/** - * Output a textarea input box. - * - * @param array $field - */ -function sm_wp_textarea_input( $field ) { - global $thepostid, $post; - - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; - $field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : ''; - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; - $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); - $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; - $field['rows'] = isset( $field['rows'] ) ? $field['rows'] : 2; - $field['cols'] = isset( $field['cols'] ) ? $field['cols'] : 20; - - // Custom attribute handling - $custom_attributes = array(); - - if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { - - foreach ( $field['custom_attributes'] as $attribute => $value ) { - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; - } - } - - echo '

    - '; - - if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { - //echo sm_help_tip( $field['description'] ); - } - - echo ' '; - - if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { - echo '' . wp_kses_post( $field['description'] ) . ''; - } - - echo '

    '; -} - -/** - * Output a checkbox input box. - * - * @param array $field - */ -function sm_wp_checkbox( $field ) { - global $thepostid, $post; - - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'checkbox'; - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; - $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'yes'; - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; - $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; - - // Custom attribute handling - $custom_attributes = array(); - - if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { - - foreach ( $field['custom_attributes'] as $attribute => $value ) { - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; - } - } - - echo '

    - '; - - if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { - //echo sm_help_tip( $field['description'] ); - } - - echo ' '; - - if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { - echo '' . wp_kses_post( $field['description'] ) . ''; - } - - echo '

    '; -} - -/** - * Output a select input box. - * - * @param array $field - */ -function sm_wp_select( $field ) { - global $thepostid, $post; - - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short'; - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; - $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; - $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; - - // Custom attribute handling - $custom_attributes = array(); - - if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { - - foreach ( $field['custom_attributes'] as $attribute => $value ) { - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; - } - } - - echo '

    - '; - - if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { - //echo sm_help_tip( $field['description'] ); - } - - echo ' '; - - if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { - echo '' . wp_kses_post( $field['description'] ) . ''; - } - - echo '

    '; -} - -/** - * Output a radio input box. - * - * @param array $field - */ -function sm_wp_radio( $field ) { - global $thepostid, $post; - - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short'; - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; - $field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true ); - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; - $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; - - echo '
    ' . wp_kses_post( $field['label'] ) . ''; - - if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { - //echo sm_help_tip( $field['description'] ); - } - - echo '
      '; - - foreach ( $field['options'] as $key => $value ) { - - echo '
    • -
    • '; - } - echo '
    '; - - if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { - echo '' . wp_kses_post( $field['description'] ) . ''; - } - - echo '
    '; -} From 338f2dc7371eba94b85f91df38a9413b2947ffce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 20:34:36 +0200 Subject: [PATCH 032/119] Code Style: class-sm-admin-menus.php --- includes/admin/class-sm-admin-menus.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/includes/admin/class-sm-admin-menus.php b/includes/admin/class-sm-admin-menus.php index 31473fb..c268442 100644 --- a/includes/admin/class-sm-admin-menus.php +++ b/includes/admin/class-sm-admin-menus.php @@ -1,14 +1,22 @@ Date: Sat, 7 Apr 2018 20:35:44 +0200 Subject: [PATCH 033/119] Code Style: class-sm-import-export.php --- includes/admin/class-sm-admin-import-export.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/admin/class-sm-admin-import-export.php b/includes/admin/class-sm-admin-import-export.php index 74a550c..41a8a25 100644 --- a/includes/admin/class-sm-admin-import-export.php +++ b/includes/admin/class-sm-admin-import-export.php @@ -1,4 +1,10 @@ Date: Sat, 7 Apr 2018 20:36:36 +0200 Subject: [PATCH 034/119] Code Style: class-sm-admin-assets.php --- includes/admin/class-sm-admin-assets.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/includes/admin/class-sm-admin-assets.php b/includes/admin/class-sm-admin-assets.php index 49a42c3..cb3ef32 100644 --- a/includes/admin/class-sm-admin-assets.php +++ b/includes/admin/class-sm-admin-assets.php @@ -1,10 +1,19 @@ id : ''; - // Register admin styles + // Register admin styles. wp_register_style( 'sm_admin_styles', SM_URL . 'assets/css/admin.min.css', array(), SM_VERSION ); - // Enqueue styles for Sermon Manager pages only + // Enqueue styles for Sermon Manager pages only. if ( in_array( $screen_id, sm_get_screen_ids() ) ) { wp_enqueue_style( 'sm_admin_styles' ); @@ -35,11 +44,9 @@ public function admin_scripts() { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; - // Enqueue scripts for Sermon Manager pages only + // Enqueue scripts for Sermon Manager pages only. if ( in_array( $screen_id, sm_get_screen_ids() ) ) { - // todo: move php notice script here, but register it first above - - do_action('sm_enqueue_admin_js'); + do_action( 'sm_enqueue_admin_js' ); } } } From eccb0f56a98681981d56b8e8b9b80a9db54c7655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 7 Apr 2018 20:37:08 +0200 Subject: [PATCH 035/119] Code Style: class-sm-admin.php --- includes/admin/class-sm-admin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/admin/class-sm-admin.php b/includes/admin/class-sm-admin.php index 7b9d06e..92ec4de 100644 --- a/includes/admin/class-sm-admin.php +++ b/includes/admin/class-sm-admin.php @@ -1,4 +1,10 @@ Date: Sat, 7 Apr 2018 20:42:48 +0200 Subject: [PATCH 036/119] Code Style: admin views --- .../admin/views/html-admin-import-export.php | 365 ++++++++++-------- 1 file changed, 197 insertions(+), 168 deletions(-) diff --git a/includes/admin/views/html-admin-import-export.php b/includes/admin/views/html-admin-import-export.php index 97be4ab..11e1b3b 100644 --- a/includes/admin/views/html-admin-import-export.php +++ b/includes/admin/views/html-admin-import-export.php @@ -1,170 +1,199 @@ - +
    -
    -

    -
    -
    -

    -
    -
    -
    - <?php esc_attr_e( 'Import from file', 'sermon-manager-for-wordpress' ) ?> -
    -

    - -

    -
    - -
    -

    -
    -
    -
    -
    -
    - <?php esc_attr_e( 'Export to file', 'sermon-manager-for-wordpress' ) ?> -
    -

    - -

    -
    - \ No newline at end of file +
  • + +
  • +
+ +
+

+
+ + +
+
+ <?php esc_attr_e( 'Export to file', 'sermon-manager-for-wordpress' ); ?> +
+

+ +

+
+ +
+

+
+
+
+ + +
+

+

+
+
+

Plugin not installed

+
+ <?php esc_attr_e( 'Sermon Browser', 'sermon-manager-for-wordpress' ); ?> +
+

+ +

+
+ +
+

+ +

+

+ here' ); + ?> +

+
+
+
+
+

Plugin not installed

+
+ <?php esc_attr_e( 'Series Engine', 'sermon-manager-for-wordpress' ); ?> +
+

+ +

+
+ +
+

+ +

+

+ here' ); + ?> +

+
+
+
+
+
+

+ +

+ From 27cfd837e5502ef09443350bea42cef7abc32d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Tue, 10 Apr 2018 13:41:08 +0200 Subject: [PATCH 037/119] Fix SB image import --- includes/sm-core-functions.php | 7 +++++++ readme.txt | 1 + 2 files changed, 8 insertions(+) diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index c0bffd0..442c0c8 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -425,6 +425,13 @@ function sm_import_and_set_post_thumbnail( $image_url, $post_id = 0 ) { return false; } + // Check if local file. + if ( strpos( $image_url, '/' ) === 0 && strpos( $image_url, '//' ) !== 0 ) { + if ( ! file_exists( $image_url ) ) { + return false; + } + } + $attachment_id = attachment_url_to_postid( $image_url ); $upload = wp_upload_dir(); diff --git a/readme.txt b/readme.txt index daff61b..de32d66 100755 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### +* Fix: SB image import breaking when image is local and does not exist on filesystem * Fix: Taxonomy image assignment not working * Dev: Add more hooks * Dev: Add PHPUnit configuration From 4ddb043c8424cf7b1608c995dd0370c499d2503a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 07:14:50 +0200 Subject: [PATCH 038/119] Code Style: class-sm-admin-post-types.php + minor fixes in other files --- includes/admin/class-sm-admin-assets.php | 2 +- .../admin/class-sm-admin-import-export.php | 2 +- includes/admin/class-sm-admin-menus.php | 2 +- includes/admin/class-sm-admin-post-types.php | 84 ++++++++++++------- includes/admin/class-sm-admin.php | 2 +- includes/admin/sm-admin-functions.php | 2 +- includes/admin/sm-cmb-functions.php | 4 +- .../admin/views/html-admin-import-export.php | 2 +- includes/class-sm-api.php | 4 +- includes/class-sm-autoloader.php | 2 +- includes/class-sm-background-updater.php | 4 +- includes/class-sm-dates-wp.php | 4 +- includes/class-sm-dates.php | 4 +- includes/class-sm-install.php | 4 +- includes/class-sm-post-types.php | 4 +- includes/class-sm-shortcodes.php | 4 +- includes/sm-core-functions.php | 2 +- includes/sm-deprecated-functions.php | 2 +- includes/sm-formatting-functions.php | 2 +- includes/sm-podcast-functions.php | 4 +- includes/sm-template-functions.php | 2 +- includes/sm-update-functions.php | 2 +- .../vendor/taxonomy-images/public-filters.php | 2 +- includes/widgets.php | 2 +- sermons.php | 4 +- views/archive-wpfc_sermon.php | 2 +- views/partials/wrapper-end.php | 2 +- views/partials/wrapper-start.php | 2 +- views/single-wpfc_sermon.php | 2 +- views/taxonomy-wpfc_bible_book.php | 2 +- views/taxonomy-wpfc_preacher.php | 2 +- views/taxonomy-wpfc_sermon_series.php | 2 +- views/taxonomy-wpfc_sermon_topics.php | 2 +- views/taxonomy-wpfc_service_type.php | 2 +- views/wpfc-podcast-feed.php | 2 +- 35 files changed, 96 insertions(+), 76 deletions(-) diff --git a/includes/admin/class-sm-admin-assets.php b/includes/admin/class-sm-admin-assets.php index cb3ef32..708be0c 100644 --- a/includes/admin/class-sm-admin-assets.php +++ b/includes/admin/class-sm-admin-assets.php @@ -2,7 +2,7 @@ /** * Admin assets loading * - * @package Sermon Manager/Core/Admin + * @package SM/Core/Admin */ defined( 'ABSPATH' ) or die; diff --git a/includes/admin/class-sm-admin-import-export.php b/includes/admin/class-sm-admin-import-export.php index 41a8a25..8076446 100644 --- a/includes/admin/class-sm-admin-import-export.php +++ b/includes/admin/class-sm-admin-import-export.php @@ -2,7 +2,7 @@ /** * Import/Export related functionality * - * @package Sermon Manager/Core/Admin/Importing + * @package SM/Core/Admin/Importing */ defined( 'ABSPATH' ) or die; diff --git a/includes/admin/class-sm-admin-menus.php b/includes/admin/class-sm-admin-menus.php index c268442..2353e86 100644 --- a/includes/admin/class-sm-admin-menus.php +++ b/includes/admin/class-sm-admin-menus.php @@ -2,7 +2,7 @@ /** * Registers SM related menus. * - * @package Sermon Manager/Core/Admin/Menus + * @package SM/Core/Admin/Menus */ defined( 'ABSPATH' ) or die; diff --git a/includes/admin/class-sm-admin-post-types.php b/includes/admin/class-sm-admin-post-types.php index 05213ef..6526794 100644 --- a/includes/admin/class-sm-admin-post-types.php +++ b/includes/admin/class-sm-admin-post-types.php @@ -1,4 +1,10 @@ '', // Unused. Messages start at index 1. + // translators: %s: The URL to the sermon. 1 => wp_sprintf( esc_html__( 'Sermon updated. %s', 'sermon-manager-for-wordpress' ), '' . esc_html__( 'View sermon', 'sermon-manager-for-wordpress' ) . '' ), 2 => esc_html__( 'Custom field updated.', 'sermon-manager-for-wordpress' ), 3 => esc_html__( 'Custom field deleted.', 'sermon-manager-for-wordpress' ), 4 => esc_html__( 'Sermon updated.', 'sermon-manager-for-wordpress' ), - /* translators: %s: date and time of the revision */ + // translators: %s: Date and time of the revision. 5 => isset( $_GET['revision'] ) ? wp_sprintf( esc_html__( 'Sermon restored to revision from %s', 'sermon-manager-for-wordpress' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, + // translators: %s: The URL to the sermon. 6 => wp_sprintf( esc_html__( 'Sermon published. %s', 'sermon-manager-for-wordpress' ), '' . esc_html__( 'View sermon', 'sermon-manager-for-wordpress' ) . '' ), 7 => esc_html__( 'Sermon saved.', 'sermon-manager-for-wordpress' ), + // translators: %s: The URL to the sermon. 8 => wp_sprintf( esc_html__( 'Sermon submitted. %s', 'sermon-manager-for-wordpress' ), '' . esc_html__( 'Preview sermon', 'sermon-manager-for-wordpress' ) . '' ), + // translators: %1$s: The date and time. %2$s: The preview sermon URL. 9 => wp_sprintf( esc_html__( 'Sermon scheduled for: %1$s. %2$s', 'sermon-manager-for-wordpress' ), + // translators: %1$s: Date. %2$s: Time. '' . wp_sprintf( esc_html__( '%1$s at %2$s', 'sermon-manager-for-wordpress' ), get_post_time( get_option( 'date_format' ), false, null, true ), get_post_time( get_option( 'time_format' ), false, null, true ) ) . '', - '' . esc_html__( 'Preview sermon', 'sermon-manager-for-wordpress' ) . '' ), + // translators: %s: The preview sermon URL. + '' . esc_html__( 'Preview sermon', 'sermon-manager-for-wordpress' ) . '' + ), + // translators: %s The URL to the sermon. 10 => wp_sprintf( esc_html__( 'Sermon draft updated. %s', 'sermon-manager-for-wordpress' ), '' . esc_html__( 'View sermon', 'sermon-manager-for-wordpress' ) . '' ), ); @@ -66,7 +82,7 @@ public function post_updated_messages( $messages ) { /** * Define custom columns for sermons. * - * @param array $existing_columns + * @param array $existing_columns Existing columns. * * @return array */ @@ -93,7 +109,7 @@ public function sermon_columns( $existing_columns ) { /** * Output custom columns for sermons. * - * @param string $column + * @param string $column The column to render. */ public function render_sermon_columns( $column ) { global $post; @@ -103,19 +119,19 @@ public function render_sermon_columns( $column ) { } switch ( $column ) { - case "preacher": + case 'preacher': $data = get_the_term_list( $post->ID, 'wpfc_preacher', '', ', ', '' ); break; - case "series": + case 'series': $data = get_the_term_list( $post->ID, 'wpfc_sermon_series', '', ', ', '' ); break; - case "topics": + case 'topics': $data = get_the_term_list( $post->ID, 'wpfc_sermon_topics', '', ', ', '' ); break; - case "views": + case 'views': $data = wpfc_entry_views_get( array( 'post_id' => $post->ID ) ); break; - case "preached": + case 'preached': /** * Modified from code in wp-admin/includes/class-wp-posts-list-table.php */ @@ -124,7 +140,8 @@ public function render_sermon_columns( $column ) { $data = ''; if ( '0000-00-00 00:00:00' === $post->post_date ) { - $t_time = $h_time = __( 'Unpublished' ); + $t_time = __( 'Unpublished' ); + $h_time = __( 'Unpublished' ); $time_diff = 0; } else { $t_time = sm_get_the_date( __( 'Y/m/d g:i:s a' ) ); @@ -134,6 +151,7 @@ public function render_sermon_columns( $column ) { $time_diff = time() - $time; if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) { + // translators: %s: The time. Such as "12 hours". $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); } else { $h_time = mysql2date( __( 'Y/m/d' ), $m_time ); @@ -179,7 +197,7 @@ public function render_sermon_columns( $column ) { } break; - default : + default: $data = ''; break; } @@ -194,7 +212,7 @@ public function render_sermon_columns( $column ) { /** * Make columns sortable * - * @param array $columns + * @param array $columns The existing columns. * * @return array */ @@ -212,8 +230,8 @@ public function sermon_sortable_columns( $columns ) { * Set list table primary column * Support for WordPress 4.3. * - * @param string $default - * @param string $screen_id + * @param string $default Existing primary column. + * @param string $screen_id Current screen ID. * * @return string */ @@ -228,8 +246,8 @@ public function list_table_primary_column( $default, $screen_id ) { /** * Set row actions for sermons * - * @param array $actions - * @param WP_Post $post + * @param array $actions The existing actions. + * @param WP_Post $post Sermon or other post instance. * * @return array */ @@ -244,7 +262,7 @@ public function row_actions( $actions, $post ) { /** * Filters and sorting handler. * - * @param array $vars + * @param array $vars Current filtering arguments. * * @return array */ @@ -252,7 +270,7 @@ public function request_query( $vars ) { global $typenow; if ( 'wpfc_sermon' === $typenow ) { - // Sorting + // Sorting. if ( isset( $vars['orderby'] ) ) { switch ( $vars['orderby'] ) { case 'preached': @@ -284,13 +302,13 @@ public function request_query( $vars ) { /** * Change title boxes in admin. * - * @param string $text - * @param object $post + * @param string $text The title. + * @param object $post The post. * * @return string */ public function enter_title_here( $text, $post ) { - if ( $post->post_type === 'wpfc_sermon' ) { + if ( 'wpfc_sermon' === $post->post_type ) { $text = __( 'Sermon title', 'sermon-manager-for-wordpress' ); } @@ -300,7 +318,7 @@ public function enter_title_here( $text, $post ) { /** * Filter the sermons in admin based on options * - * @param mixed $query + * @param mixed $query The query. */ public function sermon_filters_query( $query ) { global $typenow; @@ -311,7 +329,7 @@ public function sermon_filters_query( $query ) { array( 'taxonomy' => 'wpfc_service_type', 'field' => 'slug', - 'terms' => $query->query_vars['wpfc_service_type'] + 'terms' => $query->query_vars['wpfc_service_type'], ) ); } @@ -335,9 +353,11 @@ public function restrict_manage_posts() { public function sermon_filters() { global $wp_query; - // Type filtering + // Type filtering. $terms = get_terms( 'wpfc_service_type' ); - $output = ''; $output .= ''; foreach ( $terms as $term ) { @@ -360,4 +380,4 @@ public function sermon_filters() { } } -new SM_Admin_Post_Types(); \ No newline at end of file +new SM_Admin_Post_Types(); diff --git a/includes/admin/class-sm-admin.php b/includes/admin/class-sm-admin.php index 92ec4de..006cd11 100644 --- a/includes/admin/class-sm-admin.php +++ b/includes/admin/class-sm-admin.php @@ -2,7 +2,7 @@ /** * Main admin file. * - * @package Sermon Manager/Core/Admin + * @package SM/Core/Admin */ defined( 'ABSPATH' ) or die; diff --git a/includes/admin/sm-admin-functions.php b/includes/admin/sm-admin-functions.php index fb62cf7..3031aae 100644 --- a/includes/admin/sm-admin-functions.php +++ b/includes/admin/sm-admin-functions.php @@ -2,7 +2,7 @@ /** * Functions used in admin area. * - * @package Sermon Manager/Core/Admin + * @package SM/Core/Admin */ defined( 'ABSPATH' ) or die; diff --git a/includes/admin/sm-cmb-functions.php b/includes/admin/sm-cmb-functions.php index a2af1e2..ff26633 100755 --- a/includes/admin/sm-cmb-functions.php +++ b/includes/admin/sm-cmb-functions.php @@ -2,10 +2,10 @@ /** * CMB2 metaboxes creation related functions. * - * @package Sermon Manager/Core/Admin/CMB2 + * @package SM/Core/Admin/CMB2 */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Define the metaboxes and field configurations. diff --git a/includes/admin/views/html-admin-import-export.php b/includes/admin/views/html-admin-import-export.php index 11e1b3b..458c584 100644 --- a/includes/admin/views/html-admin-import-export.php +++ b/includes/admin/views/html-admin-import-export.php @@ -2,7 +2,7 @@ /** * HTML for import/export page. * - * @package Sermon Manager/Core/Admin/Views + * @package SM/Core/Admin/Views */ defined( 'ABSPATH' ) or die; diff --git a/includes/class-sm-api.php b/includes/class-sm-api.php index 5e75feb..bafcf5e 100644 --- a/includes/class-sm-api.php +++ b/includes/class-sm-api.php @@ -2,10 +2,10 @@ /** * API. * - * @package Sermon Manager/Core/API + * @package SM/Core/API */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Sermon Manager API. diff --git a/includes/class-sm-autoloader.php b/includes/class-sm-autoloader.php index faeffca..e289f9e 100644 --- a/includes/class-sm-autoloader.php +++ b/includes/class-sm-autoloader.php @@ -2,7 +2,7 @@ /** * Autoloader. * - * @package Sermon Manager/Core + * @package SM/Core */ defined( 'ABSPATH' ) or die; diff --git a/includes/class-sm-background-updater.php b/includes/class-sm-background-updater.php index 68e362f..36672cc 100644 --- a/includes/class-sm-background-updater.php +++ b/includes/class-sm-background-updater.php @@ -3,10 +3,10 @@ * Background updater class loader. * Sets SM related stuff and fires it. * - * @package Sermon Manager/Core/Updating + * @package SM/Core/Updating */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /* * Compatibility, if parent already exists diff --git a/includes/class-sm-dates-wp.php b/includes/class-sm-dates-wp.php index 0d7e00f..10b8387 100644 --- a/includes/class-sm-dates-wp.php +++ b/includes/class-sm-dates-wp.php @@ -2,10 +2,10 @@ /** * Hooks for WordPress date getters and setters. * - * @package Sermon Manager/Core/Dates + * @package SM/Core/Dates */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Class used to hook into WordPress and make it use Sermon Manager dates, instead of core dates. diff --git a/includes/class-sm-dates.php b/includes/class-sm-dates.php index 4a6b77d..a88f187 100644 --- a/includes/class-sm-dates.php +++ b/includes/class-sm-dates.php @@ -2,10 +2,10 @@ /** * SM dates getters and setters. * - * @package Sermon Manager/Core/Dates + * @package SM/Core/Dates */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Class used to get/set custom sermon dates. diff --git a/includes/class-sm-install.php b/includes/class-sm-install.php index 439e2ee..8845ed8 100644 --- a/includes/class-sm-install.php +++ b/includes/class-sm-install.php @@ -2,10 +2,10 @@ /** * Installation functionality. * - * @package Sermon Manager/Core/Updating + * @package SM/Core/Updating */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Used on installation/update diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index 4378eb0..d03932d 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -2,10 +2,10 @@ /** * Manage everything related to Post Types in SM. * - * @package Sermon Manager/Core + * @package SM/Core */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Class made to replace old functions for registering post types and taxonomies. diff --git a/includes/class-sm-shortcodes.php b/includes/class-sm-shortcodes.php index dc2f9d9..a6e1c2d 100755 --- a/includes/class-sm-shortcodes.php +++ b/includes/class-sm-shortcodes.php @@ -2,10 +2,10 @@ /** * Everything related to shortcodes. * - * @package Sermon Manager/Core/Shortcodes. + * @package SM/Core/Shortcodes */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Class SM_Shortcodes, initializes all the shortcodes. diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index 442c0c8..ba38663 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -4,7 +4,7 @@ * * General core functions available on both the front-end and admin. * - * @package Sermon Manager/Core + * @package SM/Core */ defined( 'ABSPATH' ) or die; diff --git a/includes/sm-deprecated-functions.php b/includes/sm-deprecated-functions.php index 85307d3..0b480bf 100644 --- a/includes/sm-deprecated-functions.php +++ b/includes/sm-deprecated-functions.php @@ -2,7 +2,7 @@ /** * Place where functions come to die. * - * @package Sermon Manager/Graveyard + * @package SM/Graveyard * * @since 2.4.9 */ diff --git a/includes/sm-formatting-functions.php b/includes/sm-formatting-functions.php index 904b0c9..505fe55 100644 --- a/includes/sm-formatting-functions.php +++ b/includes/sm-formatting-functions.php @@ -2,7 +2,7 @@ /** * Functions for formatting data. * - * @package Sermon Manager/Core/Formatting + * @package SM/Core/Formatting */ defined( 'ABSPATH' ) or die; diff --git a/includes/sm-podcast-functions.php b/includes/sm-podcast-functions.php index 531c124..025ba50 100644 --- a/includes/sm-podcast-functions.php +++ b/includes/sm-podcast-functions.php @@ -2,10 +2,10 @@ /** * Functions used for podcast data gathering and rendering. * - * @package Sermon Manager/Core/Podcasting + * @package SM/Core/Podcasting */ -defined( 'ABSPATH' ) or die; // Exit if accessed directly. +defined( 'ABSPATH' ) or die; /** * Pre-hook for adding podcast data to the XML file. diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 0446e40..29f5740 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -2,7 +2,7 @@ /** * Template functions, used when displaying content on frontend. * - * @package Sermon Manager/Core/Templating + * @package SM/Core/Templating */ // Exit if accessed directly. diff --git a/includes/sm-update-functions.php b/includes/sm-update-functions.php index 36197bf..b56d663 100644 --- a/includes/sm-update-functions.php +++ b/includes/sm-update-functions.php @@ -2,7 +2,7 @@ /** * Functions used by database updater go here. * - * @package Sermon Manager/Core/Updating + * @package SM/Core/Updating */ // Exit if accessed directly. diff --git a/includes/vendor/taxonomy-images/public-filters.php b/includes/vendor/taxonomy-images/public-filters.php index f62d044..2227934 100755 --- a/includes/vendor/taxonomy-images/public-filters.php +++ b/includes/vendor/taxonomy-images/public-filters.php @@ -1,5 +1,5 @@ diff --git a/views/partials/wrapper-end.php b/views/partials/wrapper-end.php index 0863774..39ad84a 100644 --- a/views/partials/wrapper-end.php +++ b/views/partials/wrapper-end.php @@ -2,7 +2,7 @@ /** * Archive wrapper, for theme compatibility. * - * @package Sermon Manager/Views/Partials + * @package SM/Views/Partials */ defined( 'ABSPATH' ) or exit; diff --git a/views/partials/wrapper-start.php b/views/partials/wrapper-start.php index 1458779..3ae05f7 100644 --- a/views/partials/wrapper-start.php +++ b/views/partials/wrapper-start.php @@ -2,7 +2,7 @@ /** * Archive wrapper, for theme compatibility. * - * @package Sermon Manager/Views/Partials + * @package SM/Views/Partials */ defined( 'ABSPATH' ) or exit; diff --git a/views/single-wpfc_sermon.php b/views/single-wpfc_sermon.php index 0de5f90..eacc8a5 100755 --- a/views/single-wpfc_sermon.php +++ b/views/single-wpfc_sermon.php @@ -2,7 +2,7 @@ /** * Template used for displaying single pages * - * @package Sermon Manager/views + * @package SM/Views */ get_header(); ?> diff --git a/views/taxonomy-wpfc_bible_book.php b/views/taxonomy-wpfc_bible_book.php index 788a9b6..5ae3a4c 100644 --- a/views/taxonomy-wpfc_bible_book.php +++ b/views/taxonomy-wpfc_bible_book.php @@ -2,7 +2,7 @@ /** * Template used for displaying taxonomy archive pages * - * @package Sermon Manager/views + * @package SM/Views */ get_header(); diff --git a/views/taxonomy-wpfc_preacher.php b/views/taxonomy-wpfc_preacher.php index 788a9b6..5ae3a4c 100644 --- a/views/taxonomy-wpfc_preacher.php +++ b/views/taxonomy-wpfc_preacher.php @@ -2,7 +2,7 @@ /** * Template used for displaying taxonomy archive pages * - * @package Sermon Manager/views + * @package SM/Views */ get_header(); diff --git a/views/taxonomy-wpfc_sermon_series.php b/views/taxonomy-wpfc_sermon_series.php index 788a9b6..5ae3a4c 100644 --- a/views/taxonomy-wpfc_sermon_series.php +++ b/views/taxonomy-wpfc_sermon_series.php @@ -2,7 +2,7 @@ /** * Template used for displaying taxonomy archive pages * - * @package Sermon Manager/views + * @package SM/Views */ get_header(); diff --git a/views/taxonomy-wpfc_sermon_topics.php b/views/taxonomy-wpfc_sermon_topics.php index 788a9b6..5ae3a4c 100644 --- a/views/taxonomy-wpfc_sermon_topics.php +++ b/views/taxonomy-wpfc_sermon_topics.php @@ -2,7 +2,7 @@ /** * Template used for displaying taxonomy archive pages * - * @package Sermon Manager/views + * @package SM/Views */ get_header(); diff --git a/views/taxonomy-wpfc_service_type.php b/views/taxonomy-wpfc_service_type.php index 788a9b6..5ae3a4c 100644 --- a/views/taxonomy-wpfc_service_type.php +++ b/views/taxonomy-wpfc_service_type.php @@ -2,7 +2,7 @@ /** * Template used for displaying taxonomy archive pages * - * @package Sermon Manager/views + * @package SM/Views */ get_header(); diff --git a/views/wpfc-podcast-feed.php b/views/wpfc-podcast-feed.php index 6fe4d07..c80821e 100644 --- a/views/wpfc-podcast-feed.php +++ b/views/wpfc-podcast-feed.php @@ -22,7 +22,7 @@ * * @modified 2018-01-22 * - * @package Sermon-Manager/views + * @package SM/Views */ defined( 'ABSPATH' ) or exit; From dca5902ba630b65d49a5fa0a8d840a210954be04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 07:48:29 +0200 Subject: [PATCH 039/119] Code Style: class-sm-admin-settings.php --- includes/admin/class-sm-admin-settings.php | 577 +++++++++------------ 1 file changed, 259 insertions(+), 318 deletions(-) diff --git a/includes/admin/class-sm-admin-settings.php b/includes/admin/class-sm-admin-settings.php index fe97ee7..80e2c44 100644 --- a/includes/admin/class-sm-admin-settings.php +++ b/includes/admin/class-sm-admin-settings.php @@ -1,4 +1,10 @@ __( 'The changes you made will be lost if you navigate away from this page.', 'sermon-manager-for-wordpress' ), 'i18n_bible_spanish_note' => __( 'Note: WordPress is not set to any Spanish variant. Reverted to ESV.', 'sermon-manager-for-wordpress' ), - 'is_wp_spanish' => strpos( get_locale(), 'es_' ) !== false + 'is_wp_spanish' => strpos( get_locale(), 'es_' ) !== false, ) ); - // Include settings pages + // Include settings pages. self::get_settings_pages(); - // Get current tab/section + // Get current tab/section. $current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( $_GET['tab'] ); $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] ); - // Save settings if data has been posted + // Save settings if data has been posted. if ( ! empty( $_POST ) ) { self::save(); } - // Add any posted messages + // Add any posted messages. if ( ! empty( $_GET['sm_error'] ) ) { self::add_error( stripslashes( $_GET['sm_error'] ) ); } @@ -81,7 +99,7 @@ public static function output() { switch ( $current_tab ) { case 'podcast': - wp_enqueue_script( 'sm_settings_podcast' ); // todo: i18n the script & make it more dynamic + wp_enqueue_script( 'sm_settings_podcast' ); // todo: i18n the script & make it more dynamic. wp_enqueue_media(); break; case 'verse': @@ -89,8 +107,8 @@ public static function output() { break; } - // Get tabs for the settings page - /** @noinspection PhpUnusedLocalVariableInspection */ + // Get tabs for the settings page. + /* @noinspection PhpUnusedLocalVariableInspection */ $tabs = apply_filters( 'sm_settings_tabs_array', array() ); include 'views/html-admin-settings.php'; @@ -126,20 +144,20 @@ public static function save() { die( __( 'Action failed. Please refresh the page and retry.', 'sermon-manager-for-wordpress' ) ); } - // Trigger actions + // Trigger actions. do_action( 'sm_settings_save_' . $current_tab ); do_action( 'sn_update_options_' . $current_tab ); do_action( 'sm_update_options' ); self::add_message( __( 'Your settings have been saved.', 'sermon-manager-for-wordpress' ) ); - // Clear any unwanted data and flush rules + // Clear any unwanted data and flush rules. wp_schedule_single_event( time(), 'sm_flush_rewrite_rules' ); /** - * Pass any false value to `sm_clear_feed_transients` filter to skip clearing transients + * Pass any false value to `sm_clear_feed_transients` filter to skip clearing transients. */ - if ( $current_tab === 'podcast' && apply_filters( 'sm_clear_feed_transients', true ) ) { + if ( 'podcast' === $current_tab && apply_filters( 'sm_clear_feed_transients', true ) ) { $wpdb->query( "DELETE FROM `$wpdb->options` WHERE `option_name` LIKE ('_transient_feed_%') OR `option_name` LIKE ('_transient_timeout_feed_%')" ); } @@ -149,7 +167,7 @@ public static function save() { /** * Add a message. * - * @param string $text + * @param string $text The message to add. */ public static function add_message( $text ) { self::$messages[] = $text; @@ -158,7 +176,7 @@ public static function add_message( $text ) { /** * Add an error. * - * @param string $text + * @param string $text The error to add. */ public static function add_error( $text ) { self::$errors[] = $text; @@ -169,7 +187,7 @@ public static function add_error( $text ) { * * Loops though the Sermon Manager options array and outputs each field. * - * @param array[] $options Opens array to output + * @param array[] $options Opens array to output. */ public static function output_fields( $options ) { foreach ( $options as $value ) { @@ -201,7 +219,7 @@ public static function output_fields( $options ) { $value['placeholder'] = ''; } - // Custom attribute handling + // Custom attribute handling. $custom_attributes = array(); if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { @@ -210,16 +228,14 @@ public static function output_fields( $options ) { } } - // Description handling - // Reset variables - $tooltip_html = $description = ''; - // Get descriptions - $field_description = self::get_field_description( $value ); - extract( $field_description ); + // Get descriptions. + $field_description = self::get_field_description( $value ); + $description = $field_description['description']; + $tooltip_html = $field_description['tooltip_html']; - // Switch based on type + // Switch based on type. switch ( $value['type'] ) { - // Section Titles + // Section Titles. case 'title': if ( ! empty( $value['title'] ) ) { echo '

' . esc_html( $value['title'] ) . '

'; @@ -233,7 +249,7 @@ public static function output_fields( $options ) { } break; - // Section Ends + // Section Ends. case 'sectionend': if ( ! empty( $value['id'] ) ) { do_action( 'sm_settings_' . sanitize_title( $value['id'] ) . '_end' ); @@ -244,11 +260,11 @@ public static function output_fields( $options ) { } break; - // Standard text inputs and subtypes like 'number' + // Standard text inputs and subtypes like 'number'. case 'text': case 'email': case 'number': - case 'password' : + case 'password': if ( substr( $value['id'], 0, 2 ) === '__' && strlen( $value['id'] ) > 2 ) { $option_value = $value['value']; } else { @@ -256,165 +272,170 @@ public static function output_fields( $options ) { } ?> - - - - - - - - - /> - - + + + + + + + /> + + + - - - - - - - ‎ - - - />‎ - - - + + + + + ‎ + + + />‎ + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + > + $val ) { + ?> + - - - - + > + + + + + - - - - - - - -
- -
    - $val ) { - ?> -
  • - -
  • + + + + + + +
    + +
      -
    -
    - - $val ) { + ?> +
  • + +
  • + +
+
+ + + " $visbility_class[] = 'show_options_if_checked'; } ?> - - - - -
+ + + + +
- - - + + + - -
- - + /> + +
+ + " . __( 'The settings of this image size have been disabled because its values are being overwritten by a filter.', 'sermon-manager' ) . "

"; - } - - ?> - - - - - - - id="-width" - type="text" size="3" - value=""/> × - - id="-height" - type="text" size="3" - value=""/>px - - - - - $value['id'], - 'id' => $value['id'], - 'sort_column' => 'menu_order', - 'sort_order' => 'ASC', - 'show_option_none' => ' ', - 'class' => $value['class'], - 'echo' => false, - 'selected' => absint( self::get_option( $value['id'] ) ), - ); - - if ( isset( $value['args'] ) ) { - $args = wp_parse_args( $value['args'], $args ); - } - - ?> - - - - - - - - - - - - - - - - /> - - - - + + + + + + + + /> + + + + + - - -

- - + +

+ + + - - -
- - + +
+ + + Date: Thu, 12 Apr 2018 07:57:19 +0200 Subject: [PATCH 040/119] Code Style: class-sm-import-sb.php --- includes/admin/import/class-sm-import-sb.php | 167 ++++++++++++------- 1 file changed, 111 insertions(+), 56 deletions(-) diff --git a/includes/admin/import/class-sm-import-sb.php b/includes/admin/import/class-sm-import-sb.php index 26b3532..71241ec 100644 --- a/includes/admin/import/class-sm-import-sb.php +++ b/includes/admin/import/class-sm-import-sb.php @@ -1,4 +1,10 @@ is_debug = ! ! \SermonManager::getOption( 'debug_import' ); $this->start_time = microtime( true ); @@ -40,12 +89,15 @@ public static function is_installed() { return $wpdb->query( "SELECT id FROM {$wpdb->prefix}sb_sermons LIMIT 1 " ) !== false; } + /** + * Update latest importing log. + */ public function __destruct() { update_option( 'sm_last_import_info', $this->debug_data ); } /** - * Do the import + * Do the import. */ public function import() { $this->log( 'Init info:' . PHP_EOL . 'Sermon Manager ' . SM_VERSION . PHP_EOL . 'Release Date: ' . date( 'Y-m-d', filemtime( SM_PLUGIN_FILE ) ), 255 ); @@ -85,11 +137,11 @@ public function import() { } /** - * Logs a message to show in debug + * Logs a message to show in debug. * - * @param string $message - * @param int $severity - * @param bool $no_time To hide time or not + * @param string $message The message. + * @param int $severity Message severity. + * @param bool $no_time To hide time or not. * * @since 2.11.0 */ @@ -127,13 +179,14 @@ public function log( $message = '', $severity = 254, $no_time = false ) { } /** - * Imports Bible Books + * Imports Bible Books. */ private function _import_books() { $used_books = $this->_get_used_books(); foreach ( $used_books as $book ) { - if ( $term_data = term_exists( $book->book_name, 'wpfc_bible_book' ) ) { + $term_data = term_exists( $book->book_name, 'wpfc_bible_book' ); + if ( $term_data ) { $this->log( 'Term "' . $book->book_name . '" already exists. (ID: ' . $term_data['term_id'] . ')' ); } else { $term_data = wp_insert_term( $book->book_name, 'wpfc_bible_book' ); @@ -152,7 +205,7 @@ private function _import_books() { } /** - * Gets the names of all Bible Books that were used in Sermon Browser + * Gets the names of all Bible Books that were used in Sermon Browser. * * @return array */ @@ -173,32 +226,33 @@ private function _get_used_books() { } /** - * Allows to filter books that will be imported + * Allows to filter books that will be imported. * - * @var array $used_books list of book names that will be imported + * @var array $used_books list of book names that will be imported. */ return apply_filters( 'sm_import_sb_books', $used_books ); } /** - * Imports Preachers + * Imports Preachers. */ private function _import_preachers() { global $wpdb; /** - * Filter preachers that will be imported + * Filter preachers that will be imported. * * @var array Raw database data */ $preachers = apply_filters( 'sm_import_sb_preachers', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}sb_preachers" ) ); foreach ( $preachers as $preacher ) { - if ( $term_data = term_exists( $preacher->name, 'wpfc_preacher' ) ) { + $term_data = term_exists( $preacher->name, 'wpfc_preacher' ); + if ( $term_data ) { $this->log( 'Term "' . $preacher->name . '" already exists. (ID: ' . $term_data['term_id'] . ')' ); } else { $term_data = wp_insert_term( $preacher->name, 'wpfc_preacher', array( - 'desc' => apply_filters( 'sm_import_sb_preacher_description', $preacher->description ?: '' ) + 'desc' => apply_filters( 'sm_import_sb_preacher_description', $preacher->description ?: '' ), ) ); if ( ! $term_data instanceof WP_Error ) { $this->log( 'Term "' . $preacher->name . '" imported. (ID: ' . $term_data['term_id'] . ')' ); @@ -208,8 +262,8 @@ private function _import_preachers() { } } - if ( $preacher->image !== '' ) { - // Set image + if ( '' !== $preacher->image ) { + // Set image. $media = wp_get_upload_dir(); $attachment_id = sm_import_and_set_post_thumbnail( $media['baseurl'] . '/sermons/images/' . $preacher->image, 0 ); if ( is_int( $attachment_id ) ) { @@ -226,13 +280,13 @@ private function _import_preachers() { } /** - * Imports Series + * Imports Series. */ private function _import_series() { global $wpdb; /** - * Filter series that will be imported + * Filter series that will be imported. * * @var array Raw database data */ @@ -243,7 +297,8 @@ private function _import_series() { continue; } - if ( $term_data = term_exists( $item->name, 'wpfc_sermon_series' ) ) { + $term_data = term_exists( $item->name, 'wpfc_sermon_series' ); + if ( $term_data ) { $this->log( 'Term "' . $item->name . '" already exists. (ID: ' . $term_data['term_id'] . ')' ); } else { $term_data = wp_insert_term( $item->name, 'wpfc_sermon_series' ); @@ -262,20 +317,21 @@ private function _import_series() { } /** - * Imports Service Types + * Imports Service Types. */ private function _import_service_types() { global $wpdb; /** - * Filter service types that will be imported + * Filter service types that will be imported. * - * @var array Raw database data + * @var array Raw database data. */ $services = apply_filters( 'sm_import_sb_service_types', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}sb_services" ) ); foreach ( $services as $service ) { - if ( $term_data = term_exists( $service->name, 'wpfc_sermon_series' ) ) { + $term_data = term_exists( $service->name, 'wpfc_sermon_series' ); + if ( $term_data ) { $this->log( 'Term "' . $service->name . '" already exists. (ID: ' . $term_data['term_id'] . ')' ); } else { $term_data = wp_insert_term( $service->name, 'wpfc_sermon_series' ); @@ -294,7 +350,7 @@ private function _import_service_types() { } /** - * Sermon tags are not working in SB, so we can't know how to import them + * Sermon tags are not working in SB, so we can't know how to import them. */ private function _import_sermon_tags() { $this->log( 'Not implemented.', 2 ); @@ -303,15 +359,15 @@ private function _import_sermon_tags() { } /** - * Imports Sermons + * Imports Sermons. */ private function _import_sermons() { global $wpdb; - // Imported sermons + // Imported sermons. $imported = get_option( '_sm_import_sb_messages', array() ); - // SB options + // SB options. $options = get_option( 'sermonbrowser_options', array( 'upload_dir' => 'wp-content/uploads/sermons/', ) ); @@ -323,9 +379,9 @@ private function _import_sermons() { $this->log( 'Sermon Browser plugin options: Show data', 0 ); /** - * Filter sermons that will be imported + * Filter sermons that will be imported. * - * @var array $sermons Raw database data + * @var array $sermons Raw database data. */ $sermons = apply_filters( 'sm_import_sb_messages', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}sb_sermons" ) ); @@ -334,7 +390,6 @@ private function _import_sermons() { $this->log( 'Raw sermon data: Show data', 0 ); - foreach ( $sermons as $sermon ) { if ( ! isset( $imported[ $sermon->id ] ) ) { $id = wp_insert_post( apply_filters( 'sm_import_sb_message', array( @@ -345,8 +400,8 @@ private function _import_sermons() { 'post_status' => 'publish', ) ) ); - if ( $id === 0 || $id instanceof WP_Error ) { - // skip if error + if ( 0 === $id || $id instanceof WP_Error ) { + // Skip if error. $this->log( 'Sermon "' . $sermon->title . '" could not be imported. (error data: ' . serialize( $id ) . ')', 2 ); continue; } else { @@ -354,7 +409,7 @@ private function _import_sermons() { } $imported[ $sermon->id ] = array( - 'new_id' => $id + 'new_id' => $id, ); /** @@ -368,21 +423,21 @@ private function _import_sermons() { } /** - * Filter stuff that will be imported + * Filter stuff that will be imported. * - * @var array $stuff Raw database data + * @var array $stuff Raw database data. */ - $stuff = apply_filters( 'sm_import_sb_message_stuff', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}sb_stuff WHERE `sermon_id` = '{$sermon->id}'" ) ); + $stuff = apply_filters( 'sm_import_sb_message_stuff', $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}sb_stuff WHERE `sermon_id` = %d", $sermon->id ) ) ); ob_start(); print_r( $stuff ); $this->log( 'Raw files data: Show data', 253 ); - // set files + // Set files. update_post_meta( $id, 'sm_files', $stuff ); - // set mp3 + // Set mp3. foreach ( $stuff as $item ) { $url = $item->name; @@ -398,35 +453,35 @@ private function _import_sermons() { } } - // set speaker + // Set speaker. wp_set_object_terms( $id, intval( $this->_imported_preachers[ intval( $sermon->preacher_id ) ]['new_id'] ), 'wpfc_preacher' ); $this->log( 'Assigned preacher with ID ' . intval( $this->_imported_preachers[ intval( $sermon->preacher_id ) ]['new_id'] ), 253 ); - // set service type + // Set service type. wp_set_object_terms( $id, intval( $this->_imported_service_types[ intval( $sermon->service_id ) ]['new_id'] ), 'wpfc_service_type' ); $this->log( 'Assigned service type with ID ' . intval( $this->_imported_service_types[ intval( $sermon->service_id ) ]['new_id'] ), 253 ); - // set series + // Set series. wp_set_object_terms( $id, intval( $this->_imported_series[ intval( $sermon->series_id ) ]['new_id'] ), 'wpfc_sermon_series' ); $this->log( 'Assigned series with ID ' . intval( $this->_imported_series[ intval( $sermon->series_id ) ]['new_id'] ), 253 ); - // set description + // Set description. update_post_meta( $id, 'sermon_description', $sermon->description ); - // set passage + // Set passage. update_post_meta( $id, 'bible_passages_start', $sermon->start ); update_post_meta( $id, 'bible_passages_end', $sermon->end ); - // set date + // Set date. update_post_meta( $id, 'sermon_date', strtotime( $sermon->datetime ) ); $this->log( 'Set sermon_date to ' . date( 'c', strtotime( $sermon->datetime ) ), 253 ); update_post_meta( $id, 'sermon_date_auto', '1' ); - // set views - update_post_meta( $id, 'Views', $wpdb->get_var( "SELECT SUM(`count`) FROM {$wpdb->prefix}sb_stuff WHERE `sermon_id` = '{$sermon->id}'" ) ); + // Set views. + update_post_meta( $id, 'Views', $wpdb->get_var( $wpdb->prepare( "SELECT SUM(`count`) FROM {$wpdb->prefix}sb_stuff WHERE `sermon_id` = %d", $sermon->id ) ) ); } - // update term counts + // Update term counts. foreach ( array( '_imported_preachers' => 'wpfc_preacher', @@ -448,4 +503,4 @@ private function _import_sermons() { _update_generic_term_count( $terms, (object) array( 'name' => $taxonomy ) ); } } -} \ No newline at end of file +} From 6f080a378733c6ed4424c6a71647f3cd940115bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 08:04:02 +0200 Subject: [PATCH 041/119] Code Style: class-sm-import-se.php --- includes/admin/import/class-sm-import-se.php | 178 +++++++++++-------- 1 file changed, 103 insertions(+), 75 deletions(-) diff --git a/includes/admin/import/class-sm-import-se.php b/includes/admin/import/class-sm-import-se.php index cd795bf..a5fb1cb 100644 --- a/includes/admin/import/class-sm-import-se.php +++ b/includes/admin/import/class-sm-import-se.php @@ -1,4 +1,10 @@ _get_used_books(); foreach ( $used_books as $book ) { - if ( ! $term_data = term_exists( $book->book_name, 'wpfc_bible_book' ) ) { + $term_data = term_exists( $book->book_name, 'wpfc_bible_book' ); + if ( ! $term_data ) { $term_data = wp_insert_term( $book->book_name, 'wpfc_bible_book' ); } @@ -71,7 +94,7 @@ private function _import_books() { } /** - * Gets the names of all Bible Books that were used in Series Engine + * Gets the names of all Bible Books that were used in Series Engine. * * @return array */ @@ -88,23 +111,23 @@ private function _get_used_books() { } /** - * Filter books that will be imported + * Filter books that will be imported. * - * @var array $books list of book data that will be imported + * @var array $books list of book data that will be imported. */ return apply_filters( 'sm_import_se_books', $used_books ); } /** - * Imports Speakers + * Imports Speakers. */ private function _import_speakers() { global $wpdb; /** - * Filter speakers that will be imported + * Filter speakers that will be imported. * - * @var array $speakers Raw database data + * @var array $speakers Raw database data. */ $speakers = apply_filters( 'sm_import_se_speakers', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_speakers" ) ); @@ -113,10 +136,11 @@ private function _import_speakers() { array( $speaker->first_name, $speaker->last_name, - $speaker->first_name . ' ' . $speaker->last_name + $speaker->first_name . ' ' . $speaker->last_name, ) as $name ) { - if ( $term_data = term_exists( $name, 'wpfc_preacher' ) ) { + $term_data = term_exists( $name, 'wpfc_preacher' ); + if ( $term_data ) { break; } } @@ -134,27 +158,28 @@ private function _import_speakers() { } /** - * Imports Series + * Imports Series. */ private function _import_series() { global $wpdb; /** - * Filter series that will be imported + * Filter series that will be imported. * - * @var array $series Raw database data + * @var array $series Raw database data. */ $series = apply_filters( 'sm_import_se_series', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_series" ) ); foreach ( $series as $item ) { - if ( ! $term_data = term_exists( $item->s_title, 'wpfc_sermon_series' ) ) { + $term_data = term_exists( $item->s_title, 'wpfc_sermon_series' ); + if ( ! $term_data ) { $term_data = wp_insert_term( $item->s_title, 'wpfc_sermon_series', array( - 'description' => apply_filters( 'sm_import_se_series_description', $item->s_description ?: '' ) + 'description' => apply_filters( 'sm_import_se_series_description', $item->s_description ?: '' ), ) ); } if ( ! $term_data instanceof WP_Error ) { - // Set image + // Set image. $attachment_id = sm_import_and_set_post_thumbnail( $item->thumbnail_url, 0 ); if ( is_int( $attachment_id ) ) { $assigned_images = get_option( 'sermon_image_plugin' ); @@ -170,20 +195,21 @@ private function _import_series() { } /** - * Imports Topics + * Imports Topics. */ private function _import_topics() { global $wpdb; /** - * Filter topics that will be imported + * Filter topics that will be imported. * - * @var array $topics Raw database data + * @var array $topics Raw database data. */ $topics = apply_filters( 'sm_import_se_topics', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_topics" ) ); foreach ( $topics as $topic ) { - if ( ! $term_data = term_exists( $topic->name, 'wpfc_sermon_topics' ) ) { + $term_data = term_exists( $topic->name, 'wpfc_sermon_topics' ); + if ( ! $term_data ) { $term_data = wp_insert_term( $topic->name, 'wpfc_sermon_topics' ); } @@ -196,61 +222,61 @@ private function _import_topics() { } /** - * Import messages + * Import messages. */ private function _import_messages() { global $wpdb; - // Imported messages + // Imported messages. $imported = get_option( '_sm_import_se_messages', array() ); /** - * Filter messages that will be imported + * Filter messages that will be imported. * - * @var array Raw database data + * @var array Raw database data. */ $messages = apply_filters( 'sm_import_se_messages', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_messages" ) ); /** - * Filter speaker association table that will be imported + * Filter speaker association table that will be imported. * - * @var array Raw database data + * @var array Raw database data. */ $messages_speakers = apply_filters( 'sm_import_se_speaker_association', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_message_speaker_matches" ) ); /** - * Filter topics association table that will be imported + * Filter topics association table that will be imported. * - * @var array Raw database data + * @var array Raw database data. */ $messages_topics = apply_filters( 'sm_import_se_topics_association', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_message_topic_matches" ) ); /** - * Filter books association table that will be imported + * Filter books association table that will be imported. * - * @var array Raw database data + * @var array Raw database data. */ $messages_books = apply_filters( 'sm_import_se_books_association', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_book_message_matches" ) ); /** - * Filter series association table that will be imported + * Filter series association table that will be imported. * - * @var array Raw database data + * @var array Raw database data. */ $messages_series = apply_filters( 'sm_import_se_series_association', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}se_series_message_matches" ) ); - // start the import + // Start the import. foreach ( $messages as $message ) { $post_id = $message->wp_post_id; $the_post = null; - if ( $post_id !== null ) { + if ( null !== $post_id ) { $the_post = get_post( $message->wp_post_id ); } else { $post_id = $message->message_id; } if ( ! isset( $imported[ $post_id ] ) ) { - if ( $the_post === null ) { + if ( null === $the_post ) { $id = wp_insert_post( apply_filters( 'sm_import_se_message', array( 'post_date' => $message->date . ' 12:00:00', 'post_content' => '%todo_render%', @@ -272,28 +298,29 @@ private function _import_messages() { ) ) ); } - if ( $id === 0 || $id instanceof WP_Error) { - // silently skip if error + if ( 0 === $id || $id instanceof WP_Error ) { + // Silently skip if error. continue; } $imported[ $post_id ] = array( - 'new_id' => $id + 'new_id' => $id, ); /** - * we write it after each insert in case that we get fatal error - we don't want to - * import messages twice, it would be a mess + * We write it after each insert in case that we get fatal error - we don't want to + * import messages twice, it would be a mess. */ update_option( '_sm_import_se_messages', $imported ); } else { $id = $imported[ $post_id ]['new_id']; } - // set speakers - if ( $keys = array_keys( array_map( function ( $element ) { + // Set speakers. + $keys = array_keys( array_map( function ( $element ) { return $element->message_id; - }, $messages_speakers ), $message->message_id ) ) { + }, $messages_speakers ), $message->message_id ); + if ( $keys ) { $terms = array(); foreach ( $keys as $key ) { $terms[] = intval( $this->_imported_speakers[ intval( $messages_speakers[ $key ]->speaker_id ) ]['new_id'] ); @@ -304,10 +331,11 @@ private function _import_messages() { } } - // set books - if ( $keys = array_keys( array_map( function ( $element ) { + // Set books. + $keys = array_keys( array_map( function ( $element ) { return $element->message_id; - }, $messages_books ), $message->message_id ) ) { + }, $messages_books ), $message->message_id ); + if ( $keys ) { $terms = array(); foreach ( $keys as $key ) { $terms[] = intval( $this->_imported_books[ intval( $messages_books[ $key ]->book_id ) ]['new_id'] ); @@ -318,10 +346,11 @@ private function _import_messages() { } } - // set topics - if ( $keys = array_keys( array_keys( array_map( function ( $element ) { + // Set topics. + $keys = array_keys( array_keys( array_map( function ( $element ) { return $element->message_id; - }, $messages_topics ), $message->message_id ) ) ) { + }, $messages_topics ), $message->message_id ) ); + if ( $keys ) { $terms = array(); foreach ( $keys as $key ) { $terms[] = intval( $this->_imported_topics[ intval( $messages_topics[ $key ]->topic_id ) ]['new_id'] ); @@ -332,10 +361,11 @@ private function _import_messages() { } } - // set series - if ( $keys = array_keys( array_map( function ( $element ) { + // Set series. + $keys = array_keys( array_map( function ( $element ) { return $element->message_id; - }, $messages_series ), $message->message_id ) ) { + }, $messages_series ), $message->message_id ); + if ( $keys ) { $terms = array(); foreach ( $keys as $key ) { $terms[] = intval( $this->_imported_series[ intval( $messages_series[ $key ]->series_id ) ]['new_id'] ); @@ -346,21 +376,21 @@ private function _import_messages() { } } - // set scripture + // Set scripture. if ( ! empty( $message->focus_scripture ) ) { update_post_meta( $id, 'bible_passage', $message->focus_scripture ); } - // set description + // Set description. if ( ! empty( $message->description ) ) { update_post_meta( $id, 'sermon_description', $message->description ); } - // set sermon date - if ( ! empty( $message->date ) && $message->date !== '0000-00-00' ) { + // Set sermon date. + if ( ! empty( $message->date ) && '0000-00-00' !== $message->date ) { update_post_meta( $id, 'sermon_date', strtotime( $message->date ) ); } else { - if ( $the_post !== null ) { + if ( null !== $the_post ) { update_post_meta( $id, 'sermon_date', strtotime( $the_post->post_date ) ); } else { update_post_meta( $id, 'sermon_date', strtotime( $message->date ) ); @@ -369,46 +399,46 @@ private function _import_messages() { update_post_meta( $id, 'sermon_date_auto', '1' ); } - // set audio length + // Set audio length. if ( ! empty( $message->message_length ) ) { update_post_meta( $id, '_wpfc_sermon_duration', substr_count( $message->message_length, ':' ) === 1 ? '00:' . $message->message_length : $message->message_length ); } - // set audio size (bytes) + // Set audio size (bytes). if ( ! empty( $message->audio_file_size ) ) { update_post_meta( $id, '_wpfc_sermon_size', $message->audio_file_size ); } - // set audio file + // Set audio file. if ( ! empty( $message->audio_url ) ) { update_post_meta( $id, 'sermon_audio', $message->audio_url ); } - // set video url + // Set video url. if ( ! empty( $message->video_url ) ) { update_post_meta( $id, 'sermon_video_link', $message->video_url ); } - // set video embed + // Set video embed. if ( ! empty( $message->embed_code ) ) { update_post_meta( $id, 'sermon_video', $message->embed_code ); } - // set views + // Set views. if ( ! empty( $message->audio_count ) ) { update_post_meta( $id, 'Views', $message->audio_count ); } - // Update main file + // Update main file. if ( ! empty( $message->file_url ) ) { update_post_meta( $id, 'sermon_notes', $message->file_url ); } - // Set image + // Set image. sm_import_and_set_post_thumbnail( $message->message_thumbnail, $id ); } - // update term counts + // Update term counts. foreach ( array( '_imported_speakers' => 'wpfc_preacher', @@ -419,9 +449,7 @@ private function _import_messages() { ) { $terms = array(); - if ( empty( $this->{ - $terms_array - } ) ) { + if ( empty( $this->{$terms_array} ) ) { continue; } From 25e4d78179f74704b4c461d8ab832cb88e37fc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 08:08:00 +0200 Subject: [PATCH 042/119] Fix 2.12.0 changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index de32d66..780cd72 100755 --- a/readme.txt +++ b/readme.txt @@ -166,6 +166,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ### 2.12.0 ### * New: Add all new views, much more improved * New: Add more options to sorting shortcode +* New: Add ability to export/import Sermon Manager data * Fix: Add more error checking to importing * Fix: Audio player defaults to "Browser HTML5" when "Disable Sermon Styles" option is checked * Fix: Plyr sometimes not loading From d02daa739e23f5392fa0edc4910c226af191162b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 08:45:46 +0200 Subject: [PATCH 043/119] Code Style: class-sm-import-sm.php (partial) --- includes/admin/import/class-sm-import-sm.php | 1082 +++++++++++------- 1 file changed, 672 insertions(+), 410 deletions(-) diff --git a/includes/admin/import/class-sm-import-sm.php b/includes/admin/import/class-sm-import-sm.php index 1347d94..5189da7 100644 --- a/includes/admin/import/class-sm-import-sm.php +++ b/includes/admin/import/class-sm-import-sm.php @@ -1,114 +1,315 @@ is_debug = ! ! \SermonManager::getOption( 'debug_import' ); + $this->start_time = microtime( true ); } - + /** * Decide if the given meta key maps to information we will want to import * - * @param string $key The meta key to check + * @param string $key The meta key to check. + * * @return string|bool The key if we do want to import, false if not */ function is_valid_meta_key( $key ) { // skip attachment metadata since we'll regenerate it from scratch - // skip _edit_lock as not relevant for import - if ( in_array( $key, array( '_wp_attached_file', '_wp_attachment_metadata', '_edit_lock' ) ) ) + // skip _edit_lock as not relevant for import. + if ( in_array( $key, array( '_wp_attached_file', '_wp_attachment_metadata', '_edit_lock' ) ) ) { return false; + } + return $key; } - + /** * Added to http_request_timeout filter to force timeout at 60 seconds during import + * + * @param int $val Default timeout. + * * @return int 60 */ function bump_request_timeout( $val ) { return 60; } - - public function __construct() { - $this->is_debug = ! ! \SermonManager::getOption( 'debug_import' ); - $this->start_time = microtime( true ); - } - + + /** + * Update latest importing log. + */ public function __destruct() { update_option( 'sm_last_import_info', $this->debug_data ); } - + + /** + * Do the import + */ + public function import() { + $this->log( 'Init info:' . PHP_EOL . 'Sermon Manager ' . SM_VERSION . PHP_EOL . 'Release Date: ' . date( 'Y-m-d', filemtime( SM_PLUGIN_FILE ) ), 255 ); + if ( ! doing_action( 'admin_init' ) ) { + $this->log( 'Scheduling for `admin_init` action.', 0 ); + add_action( 'admin_init', array( $this, __FUNCTION__ ) ); + + return; + } + + $this->log( 'Including import files.', 0 ); + require_once( ABSPATH . 'wp-admin/includes/import.php' ); + + if ( ! class_exists( 'WP_Importer' ) ) { + $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; + if ( file_exists( $class_wp_importer ) ) { + /* @noinspection PhpIncludeInspection */ + require $class_wp_importer; + } + } + $this->log( 'Files included.', 0 ); + + add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) ); + add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); + + $this->log( 'Doing `sm_import_before_sm` action.', 0 ); + do_action( 'sm_import_before_sm' ); + $this->log( 'Done.', 0 ); + + $this->log( 'Handling uploaded file.', 0 ); + $upload = $this->handle_upload(); + if ( $upload['status'] ) { + $this->log( 'File successfully loaded.', 0 ); + $this->log( 'Starting content import.', 0 ); + $this->importContent( $upload['file'] ); + $this->log( 'Content import ended.', 0 ); + } else { + /* Notify about failed file upload */ + $this->log( 'Error while loading export file', 0 ); + } + + $this->log( 'Doing `sm_import_after_sm` action.', 0 ); + do_action( 'sm_import_after_sm' ); + $this->log( 'Done.', 0 ); + } + /** * Logs a message to show in debug * - * @param string $message - * @param int $severity - * @param bool $no_time To hide time or not + * @param string $message The message. + * @param int $severity The severity. + * @param bool $no_time To hide time or not. * * @since 2.11.0 */ @@ -144,68 +345,22 @@ public function log( $message = '', $severity = 254, $no_time = false ) { $this->debug_data .= $line . ' ' . $message . PHP_EOL; } - - /** - * Do the import - */ - public function import() { - $this->log( 'Init info:' . PHP_EOL . 'Sermon Manager ' . SM_VERSION . PHP_EOL . 'Release Date: ' . date( 'Y-m-d', filemtime( SM_PLUGIN_FILE ) ), 255 ); - if ( ! doing_action( 'admin_init' ) ) { - $this->log( 'Scheduling for `admin_init` action.', 0 ); - add_action( 'admin_init', array( $this, __FUNCTION__ ) ); - - return; - } - - $this->log( 'Including import files.', 0 ); - require_once( ABSPATH . 'wp-admin/includes/import.php' ); - - if ( ! class_exists( 'WP_Importer' ) ) { - $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; - if ( file_exists( $class_wp_importer ) ) - require $class_wp_importer; - } - $this->log( 'Files included.', 0 ); - - add_filter( 'import_post_meta_key', array( $this, 'is_valid_meta_key' ) ); - add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) ); - - $this->log( 'Doing `sm_import_before_sm` action.', 0 ); - do_action( 'sm_import_before_sm' ); - $this->log( 'Done.', 0 ); - - $this->log( 'Handling uploaded file.', 0 ); - $upload = $this->handle_upload(); - if($upload['status']) { - $this->log( 'File successfully loaded.', 0 ); - $this->log( 'Starting content import.', 0 ); - $this->importContent( $upload['file'] ); - $this->log( 'Content import ended.', 0 ); - } else { - /* Notify about failed file upload */ - $this->log( 'Error while loading export file', 0 ); - } - $this->log( 'Doing `sm_import_after_sm` action.', 0 ); - do_action( 'sm_import_after_sm' ); - $this->log( 'Done.', 0 ); - } - - /** + /** * Handles the WXR upload and initial parsing of the file to prepare for * displaying author import options * - * @return bool False if error uploading or invalid file, true otherwise + * @return array ['status'] false if error uploading or invalid file, true otherwise */ function handle_upload() { - $file = wp_import_handle_upload(); - $response = array(); + $file = wp_import_handle_upload(); + $response = array(); if ( isset( $file['error'] ) ) { $response['status'] = false; - $this->log( 'Error message: ' . $file['error'] , 0 ); - } else if ( ! file_exists( $file['file'] ) ) { + $this->log( 'Error message: ' . $file['error'], 0 ); + } elseif ( ! file_exists( $file['file'] ) ) { $response['status'] = false; - $this->log( 'The export file could not be found. It is likely that this was caused by a permissions problem.' . $file['error'] , 0 ); + $this->log( 'The export file could not be found. It is likely that this was caused by a permissions problem.' . $file['error'], 0 ); } $this->id = (int) $file['id']; @@ -223,15 +378,70 @@ function handle_upload() { } $response['status'] = true; - $response['file'] = $file['file']; + $response['file'] = $file['file']; $this->log( 'XML parsed with success.', 0 ); + return $response; } - + + /** + * Parses the import file. + * + * @param string $file Import file path. + * + * @return array|WP_Error + */ + function XMLparse( $file ) { + $this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false; + $this->authors = $this->posts = $this->term = $this->category = $this->tag = array(); + + $this->log( 'XML parser setup.', 0 ); + $xml = xml_parser_create( 'UTF-8' ); + xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 ); + xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 ); + xml_set_object( $xml, $this ); + xml_set_character_data_handler( $xml, 'cdata' ); + xml_set_element_handler( $xml, 'tag_open', 'tag_close' ); + + $this->log( 'Parsing content.', 0 ); + if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) { + $current_line = xml_get_current_line_number( $xml ); + $current_column = xml_get_current_column_number( $xml ); + $error_code = xml_get_error_code( $xml ); + $error_string = xml_error_string( $error_code ); + $this->log( 'There was an error when reading this WXR file.', 0 ); + + return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( + $current_line, + $current_column, + $error_string, + ) ); + } + xml_parser_free( $xml ); + + if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) ) { + $this->log( 'This does not appear to be a WXR file, missing/invalid WXR version number.', 0 ); + + return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); + } + + $this->log( 'Setting content parameters.', 0 ); + + return array( + 'authors' => $this->authors, + 'posts' => $this->posts, + 'categories' => $this->category, + 'tags' => $this->tag, + 'terms' => $this->term, + 'base_url' => $this->base_url, + 'version' => $this->wxr_version, + ); + } + /** * The main controller for the actual import stage. * - * @param string $file Path to the WXR file for importing + * @param string $file Path to the WXR file for importing. */ function importContent( $file ) { @@ -241,57 +451,59 @@ function importContent( $file ) { $this->get_author_mapping(); wp_suspend_cache_invalidation( true ); - + $this->log( 'Process terms start.', 0 ); $this->process_terms(); $this->log( 'Process terms end.', 0 ); - + $this->log( 'Process posts start.', 0 ); $this->process_posts(); $this->log( 'Process posts end.', 0 ); - + wp_suspend_cache_invalidation( false ); - // update incorrect/missing information in the DB + // update incorrect/missing information in the DB. $this->log( 'Update incorrect/missing information in the DB.', 0 ); - + $this->log( 'Update parent/child relations start.', 0 ); $this->backfill_parents(); $this->log( 'Update parent/child relations end.', 0 ); - + $this->log( 'Update attachment urls start.', 0 ); $this->backfill_attachment_urls(); $this->log( 'Update attachment urls end.', 0 ); - + $this->log( 'Update featured image ids in posts start.', 0 ); $this->remap_featured_images(); $this->log( 'Update featured image ids in posts end.', 0 ); - + $this->log( 'Update term image ids in terms start.', 0 ); $this->remap_term_images(); $this->log( 'Update term image ids in terms end.', 0 ); - + $this->import_end(); $this->log( 'Import Content function ended.', 0 ); } - + /** * Parses the WXR file and prepares us for the task of processing parsed data * - * @param string $file Path to the WXR file for importing + * @param string $file Path to the WXR file for importing. */ function import_start( $file ) { - if ( ! is_file($file) ) { - $this->import_status = false; - $this->log( 'The file does not exist, please try again.', 0 ); - return; + if ( ! is_file( $file ) ) { + $this->import_status = false; + $this->log( 'The file does not exist, please try again.', 0 ); + + return; } $import_data = $this->XMLparse( $file ); if ( is_wp_error( $import_data ) ) { - $this->import_status = false; - $this->log( 'Import start error: ' .$import_data->get_error_message(), 0 ); + $this->import_status = false; + $this->log( 'Import start error: ' . $import_data->get_error_message(), 0 ); + return; } @@ -311,21 +523,21 @@ function import_start( $file ) { do_action( 'import_start' ); } - + /** * Retrieve authors from parsed WXR data * * Uses the provided author information from WXR 1.1 files * or extracts info from each post for WXR 1.0 files * - * @param array $import_data Data returned by a WXR parser + * @param array $import_data Data returned by a WXR parser. */ function get_authors_from_import( $import_data ) { $this->log( 'Importing authors start.', 0 ); if ( ! empty( $import_data['authors'] ) ) { $this->log( 'Authors exists, setting them.', 0 ); $this->authors = $import_data['authors']; - // no author information, grab it from the posts + // no author information, grab it from the posts. } else { $this->log( 'Authors does not exist, getting them from posts.', 0 ); foreach ( $import_data['posts'] as $post ) { @@ -334,17 +546,16 @@ function get_authors_from_import( $import_data ) { continue; } - - if ( ! isset($this->authors[$login]) ) - $this->authors[$login] = array( - 'author_login' => $login, - 'author_display_name' => $post['post_author'] + if ( ! isset( $this->authors[ $login ] ) ) { + $this->authors[ $login ] = array( + 'author_login' => $login, + 'author_display_name' => $post['post_author'], ); + } } } } - - + /** * Map old author logins to local user IDs. Can map to an existing user, create a new user * or falls back to the current user in case of error with either of the previous @@ -353,42 +564,52 @@ function get_author_mapping() { $create_users = $this->allow_create_users(); - if ( $create_users && $this->version != '1.0' ) { + if ( $create_users && '1.0' != $this->version ) { $this->log( 'Users creation enabled.', 0 ); - foreach ( $this->authors as $i => $data ) { - - $santized_old_login = sanitize_user( $i, true ); - $old_id = isset( $this->authors[$i]['author_id'] ) ? intval($this->authors[$i]['author_id']) : false; - $this->log( 'Creating user.', 0 ); - $user_data = array( - 'user_login' => $i, - 'user_pass' => wp_generate_password(), - 'user_email' => isset( $this->authors[$i]['author_email'] ) ? $this->authors[$i]['author_email'] : '', - 'display_name' => $this->authors[$i]['author_display_name'], - 'first_name' => isset( $this->authors[$i]['author_first_name'] ) ? $this->authors[$i]['author_first_name'] : '', - 'last_name' => isset( $this->authors[$i]['author_last_name'] ) ? $this->authors[$i]['author_last_name'] : '', + foreach ( $this->authors as $i => $data ) { + + $santized_old_login = sanitize_user( $i, true ); + $old_id = isset( $this->authors[ $i ]['author_id'] ) ? intval( $this->authors[ $i ]['author_id'] ) : false; + $this->log( 'Creating user.', 0 ); + $user_data = array( + 'user_login' => $i, + 'user_pass' => wp_generate_password(), + 'user_email' => isset( $this->authors[ $i ]['author_email'] ) ? $this->authors[ $i ]['author_email'] : '', + 'display_name' => $this->authors[ $i ]['author_display_name'], + 'first_name' => isset( $this->authors[ $i ]['author_first_name'] ) ? $this->authors[ $i ]['author_first_name'] : '', + 'last_name' => isset( $this->authors[ $i ]['author_last_name'] ) ? $this->authors[ $i ]['author_last_name'] : '', ); - $user_id = wp_insert_user( $user_data ); - + $user_id = wp_insert_user( $user_data ); + if ( ! is_wp_error( $user_id ) ) { - if ( $old_id ) { - $this->processed_authors[$old_id] = $user_id; - } - $this->author_mapping[$santized_old_login] = $user_id; + if ( $old_id ) { + $this->processed_authors[ $old_id ] = $user_id; + } + $this->author_mapping[ $santized_old_login ] = $user_id; } - - // failsafe: if the user_id was invalid, default to the current user - if ( ! isset( $this->author_mapping[$santized_old_login] ) ) { - $this->log( 'Some post does not have user assigned, use current user.', 0 ); - if ( $old_id ) { - $this->processed_authors[$old_id] = (int) get_current_user_id(); - } - $this->author_mapping[$santized_old_login] = (int) get_current_user_id(); - } - } + + // failsafe: if the user_id was invalid, default to the current user. + if ( ! isset( $this->author_mapping[ $santized_old_login ] ) ) { + $this->log( 'Some post does not have user assigned, use current user.', 0 ); + if ( $old_id ) { + $this->processed_authors[ $old_id ] = (int) get_current_user_id(); + } + $this->author_mapping[ $santized_old_login ] = (int) get_current_user_id(); + } + } } } - + + /** + * Decide whether or not the importer is allowed to create users. + * Default is true, can be filtered via import_allow_create_users + * + * @return bool True if creating users is allowed + */ + function allow_create_users() { + return true; + } + /** * Create new terms based on import information * @@ -396,17 +617,21 @@ function get_author_mapping() { */ function process_terms() { $this->log( 'Start terms processing.', 0 ); - if ( empty( $this->terms ) ) + if ( empty( $this->terms ) ) { return; + } foreach ( $this->terms as $term ) { $this->log( 'Checking terms.', 0 ); - // if the term already exists in the correct taxonomy leave it alone + // if the term already exists in the correct taxonomy leave it alone. $term_id = term_exists( $term['slug'], $term['term_taxonomy'] ); if ( $term_id ) { - if ( is_array($term_id) ) $term_id = $term_id['term_id']; - if ( isset($term['term_id']) ) - $this->processed_terms[intval($term['term_id'])] = (int) $term_id; + if ( is_array( $term_id ) ) { + $term_id = $term_id['term_id']; + } + if ( isset( $term['term_id'] ) ) { + $this->processed_terms[ intval( $term['term_id'] ) ] = (int) $term_id; + } continue; } @@ -414,17 +639,24 @@ function process_terms() { $parent = 0; } else { $parent = term_exists( $term['term_parent'], $term['term_taxonomy'] ); - if ( is_array( $parent ) ) $parent = $parent['term_id']; + if ( is_array( $parent ) ) { + $parent = $parent['term_id']; + } } - $term = wp_slash( $term ); + $term = wp_slash( $term ); $description = isset( $term['term_description'] ) ? $term['term_description'] : ''; - $termarr = array( 'slug' => $term['slug'], 'description' => $description, 'parent' => intval($parent) ); - + $termarr = array( + 'slug' => $term['slug'], + 'description' => $description, + 'parent' => intval( $parent ), + ); + $this->log( 'Inserting terms.', 0 ); $id = wp_insert_term( $term['term_name'], $term['term_taxonomy'], $termarr ); if ( ! is_wp_error( $id ) ) { - if ( isset($term['term_id']) ) - $this->processed_terms[intval($term['term_id'])] = $id['term_id']; + if ( isset( $term['term_id'] ) ) { + $this->processed_terms[ intval( $term['term_id'] ) ] = $id['term_id']; + } } else { $this->log( 'Inserting error: ' . $id->get_error_message(), 0 ); continue; @@ -454,7 +686,7 @@ protected function process_termmeta( $term, $term_id ) { if ( empty( $term['termmeta'] ) ) { return; } - + $this->log( 'Going over term meta.', 0 ); foreach ( $term['termmeta'] as $meta ) { $key = $meta['key']; @@ -462,24 +694,24 @@ protected function process_termmeta( $term, $term_id ) { continue; } - // Export gets meta straight from the DB so could have a serialized string + // Export gets meta straight from the DB so could have a serialized string. $value = maybe_unserialize( $meta['value'] ); add_term_meta( $term_id, $key, $value ); - - if ($key == 'sm_term_image_id') { + + if ( 'sm_term_image_id' == $key ) { $this->log( 'Term has image id set.', 0 ); - $assigned_term_images = get_option( 'sermon_image_plugin' ); - if( empty($assigned_term_images) ) { - $assigned_term_images = array(); - } - $assigned_term_images[$term_id] = $value; - update_option( 'sermon_image_plugin', $assigned_term_images ); - - $this->taxonomy_featured_images[$term_id] = (int) $value; + $assigned_term_images = get_option( 'sermon_image_plugin' ); + if ( empty( $assigned_term_images ) ) { + $assigned_term_images = array(); + } + $assigned_term_images[ $term_id ] = $value; + update_option( 'sermon_image_plugin', $assigned_term_images ); + + $this->taxonomy_featured_images[ $term_id ] = (int) $value; } } } - + /** * Create new posts based on import information * @@ -492,15 +724,15 @@ function process_posts() { foreach ( $this->posts as $post ) { $this->log( 'Iterating over posts (sermon and attachment).', 0 ); - if ( ! post_type_exists( $post['post_type'] ) && ( $post['post_type'] != 'wpfc_sermon' || $post['post_type'] != 'attachment' ) ) { + if ( ! post_type_exists( $post['post_type'] ) && ( 'wpfc_sermon' != $post['post_type'] || 'attachment' != $post['post_type'] ) ) { continue; } - if ( isset( $this->processed_posts[$post['post_id']] ) && ! empty( $post['post_id'] ) ) { + if ( isset( $this->processed_posts[ $post['post_id'] ] ) && ! empty( $post['post_id'] ) ) { continue; } - if ( $post['status'] == 'auto-draft' ) { + if ( 'auto-draft' == $post['status'] ) { continue; } @@ -509,53 +741,62 @@ function process_posts() { $post_exists = post_exists( $post['post_title'], '', $post['post_date'] ); if ( $post_exists && get_post_type( $post_exists ) == $post['post_type'] ) { - $comment_post_ID = $post_id = $post_exists; + $comment_post_ID = $post_id = $post_exists; $this->processed_posts[ intval( $post['post_id'] ) ] = intval( $post_exists ); } else { $post_parent = (int) $post['post_parent']; if ( $post_parent ) { - // if we already know the parent, map it to the new local ID - if ( isset( $this->processed_posts[$post_parent] ) ) { - $post_parent = $this->processed_posts[$post_parent]; - // otherwise record the parent for later + // if we already know the parent, map it to the new local ID. + if ( isset( $this->processed_posts[ $post_parent ] ) ) { + $post_parent = $this->processed_posts[ $post_parent ]; + // otherwise record the parent for later. } else { - $this->post_orphans[intval($post['post_id'])] = $post_parent; - $post_parent = 0; + $this->post_orphans[ intval( $post['post_id'] ) ] = $post_parent; + $post_parent = 0; } } - // map the post author + // map the post author. $author = sanitize_user( $post['post_author'], true ); - if ( isset( $this->author_mapping[$author] ) ) - $author = $this->author_mapping[$author]; - else + if ( isset( $this->author_mapping[ $author ] ) ) { + $author = $this->author_mapping[ $author ]; + } else { $author = (int) get_current_user_id(); + } $postdata = array( - 'import_id' => $post['post_id'], 'post_author' => $author, 'post_date' => $post['post_date'], - 'post_date_gmt' => $post['post_date_gmt'], 'post_content' => $post['post_content'], - 'post_excerpt' => $post['post_excerpt'], 'post_title' => $post['post_title'], - 'post_status' => $post['status'], 'post_name' => $post['post_name'], - 'comment_status' => $post['comment_status'], 'ping_status' => $post['ping_status'], - 'guid' => $post['guid'], 'post_parent' => $post_parent, 'menu_order' => $post['menu_order'], - 'post_type' => $post['post_type'], 'post_password' => $post['post_password'] + 'import_id' => $post['post_id'], + 'post_author' => $author, + 'post_date' => $post['post_date'], + 'post_date_gmt' => $post['post_date_gmt'], + 'post_content' => $post['post_content'], + 'post_excerpt' => $post['post_excerpt'], + 'post_title' => $post['post_title'], + 'post_status' => $post['status'], + 'post_name' => $post['post_name'], + 'comment_status' => $post['comment_status'], + 'ping_status' => $post['ping_status'], + 'guid' => $post['guid'], + 'post_parent' => $post_parent, + 'menu_order' => $post['menu_order'], + 'post_type' => $post['post_type'], + 'post_password' => $post['post_password'], ); - $original_post_ID = $post['post_id']; - $postdata = wp_slash( $postdata ); if ( 'attachment' == $postdata['post_type'] ) { - $remote_url = ! empty($post['attachment_url']) ? $post['attachment_url'] : $post['guid']; + $remote_url = ! empty( $post['attachment_url'] ) ? $post['attachment_url'] : $post['guid']; // try to use _wp_attached file for upload folder placement to ensure the same location as the export site - // e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload() + // e.g. location is 2003/05/image.jpg but the attachment post_date is 2010/09, see media_handle_upload(). $postdata['upload_date'] = $post['post_date']; if ( isset( $post['postmeta'] ) ) { - foreach( $post['postmeta'] as $meta ) { - if ( $meta['key'] == '_wp_attached_file' ) { - if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches ) ) + foreach ( $post['postmeta'] as $meta ) { + if ( '_wp_attached_file' == $meta['key'] ) { + if ( preg_match( '%^[0-9]{4}/[0-9]{2}%', $meta['value'], $matches ) ) { $postdata['upload_date'] = $matches[0]; + } break; } } @@ -570,24 +811,26 @@ function process_posts() { continue; } - if ( $post['is_sticky'] == 1 ) + if ( 1 == $post['is_sticky'] ) { stick_post( $post_id ); + } } - // map pre-import ID to local ID - $this->processed_posts[intval($post['post_id'])] = (int) $post_id; + // map pre-import ID to local ID. + $this->processed_posts[ intval( $post['post_id'] ) ] = (int) $post_id; - if ( ! isset( $post['terms'] ) ) + if ( ! isset( $post['terms'] ) ) { $post['terms'] = array(); + } - // add categories, tags and other terms + // add categories, tags and other terms. if ( ! empty( $post['terms'] ) ) { $terms_to_set = array(); foreach ( $post['terms'] as $term ) { - // back compat with WXR 1.0 map 'tag' to 'post_tag' - $taxonomy = ( 'tag' == $term['domain'] ) ? 'post_tag' : $term['domain']; + // back compat with WXR 1.0 map 'tag' to 'post_tag'. + $taxonomy = ( 'tag' == $term['domain'] ) ? 'post_tag' : $term['domain']; $term_exists = term_exists( $term['slug'], $taxonomy ); - $term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists; + $term_id = is_array( $term_exists ) ? $term_exists['term_id'] : $term_exists; if ( ! $term_id ) { $t = wp_insert_term( $term['name'], $taxonomy, array( 'slug' => $term['slug'] ) ); if ( ! is_wp_error( $t ) ) { @@ -596,7 +839,7 @@ function process_posts() { continue; } } - $terms_to_set[$taxonomy][] = intval( $term_id ); + $terms_to_set[ $taxonomy ][] = intval( $term_id ); } foreach ( $terms_to_set as $tax => $ids ) { @@ -605,77 +848,84 @@ function process_posts() { unset( $post['terms'], $terms_to_set ); } - if ( ! isset( $post['comments'] ) ) + if ( ! isset( $post['comments'] ) ) { $post['comments'] = array(); + } - // add/update comments + // add/update comments. if ( ! empty( $post['comments'] ) ) { - $num_comments = 0; + $num_comments = 0; $inserted_comments = array(); foreach ( $post['comments'] as $comment ) { - $comment_id = $comment['comment_id']; - $newcomments[$comment_id]['comment_post_ID'] = $comment_post_ID; - $newcomments[$comment_id]['comment_author'] = $comment['comment_author']; - $newcomments[$comment_id]['comment_author_email'] = $comment['comment_author_email']; - $newcomments[$comment_id]['comment_author_IP'] = $comment['comment_author_IP']; - $newcomments[$comment_id]['comment_author_url'] = $comment['comment_author_url']; - $newcomments[$comment_id]['comment_date'] = $comment['comment_date']; - $newcomments[$comment_id]['comment_date_gmt'] = $comment['comment_date_gmt']; - $newcomments[$comment_id]['comment_content'] = $comment['comment_content']; - $newcomments[$comment_id]['comment_approved'] = $comment['comment_approved']; - $newcomments[$comment_id]['comment_type'] = $comment['comment_type']; - $newcomments[$comment_id]['comment_parent'] = $comment['comment_parent']; - $newcomments[$comment_id]['commentmeta'] = isset( $comment['commentmeta'] ) ? $comment['commentmeta'] : array(); - if ( isset( $this->processed_authors[$comment['comment_user_id']] ) ) - $newcomments[$comment_id]['user_id'] = $this->processed_authors[$comment['comment_user_id']]; + $comment_id = $comment['comment_id']; + $newcomments[ $comment_id ]['comment_post_ID'] = $comment_post_ID; + $newcomments[ $comment_id ]['comment_author'] = $comment['comment_author']; + $newcomments[ $comment_id ]['comment_author_email'] = $comment['comment_author_email']; + $newcomments[ $comment_id ]['comment_author_IP'] = $comment['comment_author_IP']; + $newcomments[ $comment_id ]['comment_author_url'] = $comment['comment_author_url']; + $newcomments[ $comment_id ]['comment_date'] = $comment['comment_date']; + $newcomments[ $comment_id ]['comment_date_gmt'] = $comment['comment_date_gmt']; + $newcomments[ $comment_id ]['comment_content'] = $comment['comment_content']; + $newcomments[ $comment_id ]['comment_approved'] = $comment['comment_approved']; + $newcomments[ $comment_id ]['comment_type'] = $comment['comment_type']; + $newcomments[ $comment_id ]['comment_parent'] = $comment['comment_parent']; + $newcomments[ $comment_id ]['commentmeta'] = isset( $comment['commentmeta'] ) ? $comment['commentmeta'] : array(); + if ( isset( $this->processed_authors[ $comment['comment_user_id'] ] ) ) { + $newcomments[ $comment_id ]['user_id'] = $this->processed_authors[ $comment['comment_user_id'] ]; + } } ksort( $newcomments ); foreach ( $newcomments as $key => $comment ) { - // if this is a new post we can skip the comment_exists() check + // if this is a new post we can skip the comment_exists() check. if ( ! $post_exists || ! comment_exists( $comment['comment_author'], $comment['comment_date'] ) ) { - if ( isset( $inserted_comments[$comment['comment_parent']] ) ) - $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']]; - $comment = wp_filter_comment( $comment ); - $inserted_comments[$key] = wp_insert_comment( $comment ); + if ( isset( $inserted_comments[ $comment['comment_parent'] ] ) ) { + $comment['comment_parent'] = $inserted_comments[ $comment['comment_parent'] ]; + } + $comment = wp_filter_comment( $comment ); + $inserted_comments[ $key ] = wp_insert_comment( $comment ); - foreach( $comment['commentmeta'] as $meta ) { + foreach ( $comment['commentmeta'] as $meta ) { $value = maybe_unserialize( $meta['value'] ); - add_comment_meta( $inserted_comments[$key], $meta['key'], $value ); + add_comment_meta( $inserted_comments[ $key ], $meta['key'], $value ); } - $num_comments++; + $num_comments ++; } } unset( $newcomments, $inserted_comments, $post['comments'] ); } - if ( ! isset( $post['postmeta'] ) ) + if ( ! isset( $post['postmeta'] ) ) { $post['postmeta'] = array(); + } - // add/update post meta + // add/update post meta. if ( ! empty( $post['postmeta'] ) ) { foreach ( $post['postmeta'] as $meta ) { - $key = $meta['key']; + $key = $meta['key']; $value = false; if ( '_edit_last' == $key ) { - if ( isset( $this->processed_authors[intval($meta['value'])] ) ) - $value = $this->processed_authors[intval($meta['value'])]; - else + if ( isset( $this->processed_authors[ intval( $meta['value'] ) ] ) ) { + $value = $this->processed_authors[ intval( $meta['value'] ) ]; + } else { $key = false; + } } if ( $key ) { - // export gets meta straight from the DB so could have a serialized string - if ( ! $value ) + // export gets meta straight from the DB so could have a serialized string. + if ( ! $value ) { $value = maybe_unserialize( $meta['value'] ); + } add_post_meta( $post_id, $key, $value ); - // if the post has a featured image, take note of this in case of remap - if ( '_thumbnail_id' == $key ) - $this->featured_images[$post_id] = (int) $value; + // if the post has a featured image, take note of this in case of remap. + if ( '_thumbnail_id' == $key ) { + $this->featured_images[ $post_id ] = (int) $value; + } } } } @@ -683,111 +933,134 @@ function process_posts() { unset( $this->posts ); } - + /** * If fetching attachments is enabled then attempt to create a new attachment * - * @param array $post Attachment post details from WXR - * @param string $url URL to fetch attachment from + * @param array $post Attachment post details from WXR. + * @param string $url URL to fetch attachment from. + * * @return int|WP_Error Post ID on success, WP_Error otherwise */ function process_attachment( $post, $url ) { - if ( ! $this->fetch_attachments ) - return new WP_Error( 'attachment_processing_error', - __( 'Fetching attachments is not enabled', 'wordpress-importer' ) ); + if ( ! $this->fetch_attachments ) { + return new WP_Error( 'attachment_processing_error', __( 'Fetching attachments is not enabled', 'wordpress-importer' ) ); + } - // if the URL is absolute, but does not contain address, then upload it assuming base_site_url - if ( preg_match( '|^/[\w\W]+$|', $url ) ) + // if the URL is absolute, but does not contain address, then upload it assuming base_site_url. + if ( preg_match( '|^/[\w\W]+$|', $url ) ) { $url = rtrim( $this->base_url, '/' ) . $url; + } $upload = $this->fetch_remote_file( $url, $post ); - if ( is_wp_error( $upload ) ) + if ( is_wp_error( $upload ) ) { return $upload; + } - if ( $info = wp_check_filetype( $upload['file'] ) ) + $info = wp_check_filetype( $upload['file'] ); + if ( $info ) { $post['post_mime_type'] = $info['type']; - else - return new WP_Error( 'attachment_processing_error', __('Invalid file type', 'wordpress-importer') ); + } else { + return new WP_Error( 'attachment_processing_error', __( 'Invalid file type', 'wordpress-importer' ) ); + } $post['guid'] = $upload['url']; - // as per wp-admin/includes/upload.php + // as per `wp-admin/includes/upload.php`. $post_id = wp_insert_attachment( $post, $upload['file'] ); wp_update_attachment_metadata( $post_id, wp_generate_attachment_metadata( $post_id, $upload['file'] ) ); // remap resized image URLs, works by stripping the extension and remapping the URL stub. if ( preg_match( '!^image/!', $info['type'] ) ) { $parts = pathinfo( $url ); - $name = basename( $parts['basename'], ".{$parts['extension']}" ); // PATHINFO_FILENAME in PHP 5.2 + $name = basename( $parts['basename'], ".{$parts['extension']}" ); // PATHINFO_FILENAME in PHP 5.2. $parts_new = pathinfo( $upload['url'] ); - $name_new = basename( $parts_new['basename'], ".{$parts_new['extension']}" ); + $name_new = basename( $parts_new['basename'], ".{$parts_new['extension']}" ); - $this->url_remap[$parts['dirname'] . '/' . $name] = $parts_new['dirname'] . '/' . $name_new; + $this->url_remap[ $parts['dirname'] . '/' . $name ] = $parts_new['dirname'] . '/' . $name_new; } return $post_id; } - + /** * Attempt to download a remote file attachment * - * @param string $url URL of item to fetch - * @param array $post Attachment details + * @param string $url URL of item to fetch. + * @param array $post Attachment details. + * * @return array|WP_Error Local file location details on success, WP_Error otherwise */ function fetch_remote_file( $url, $post ) { - // extract the file name and extension from the url + // extract the file name and extension from the url. $file_name = basename( $url ); - // get placeholder file in the upload dir with a unique, sanitized filename + // get placeholder file in the upload dir with a unique, sanitized filename. $upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] ); - if ( $upload['error'] ) + if ( $upload['error'] ) { return new WP_Error( 'upload_dir_error', $upload['error'] ); + } - // fetch the remote url and write it to the placeholder file + // fetch the remote url and write it to the placeholder file. $headers = wp_get_http( $url, $upload['file'] ); - // request failed + // request failed. if ( ! $headers ) { @unlink( $upload['file'] ); - return new WP_Error( 'import_file_error', __('Remote server did not respond', 'wordpress-importer') ); + + return new WP_Error( 'import_file_error', __( 'Remote server did not respond', 'wordpress-importer' ) ); } - // make sure the fetch was successful + // make sure the fetch was successful. if ( $headers['response'] != '200' ) { @unlink( $upload['file'] ); - return new WP_Error( 'import_file_error', sprintf( __('Remote server returned error response %1$d %2$s', 'wordpress-importer'), esc_html($headers['response']), get_status_header_desc($headers['response']) ) ); + + return new WP_Error( 'import_file_error', sprintf( __( 'Remote server returned error response %1$d %2$s', 'wordpress-importer' ), esc_html( $headers['response'] ), get_status_header_desc( $headers['response'] ) ) ); } $filesize = filesize( $upload['file'] ); if ( isset( $headers['content-length'] ) && $filesize != $headers['content-length'] ) { @unlink( $upload['file'] ); - return new WP_Error( 'import_file_error', __('Remote file is incorrect size', 'wordpress-importer') ); + + return new WP_Error( 'import_file_error', __( 'Remote file is incorrect size', 'wordpress-importer' ) ); } if ( 0 == $filesize ) { @unlink( $upload['file'] ); - return new WP_Error( 'import_file_error', __('Zero size file downloaded', 'wordpress-importer') ); + + return new WP_Error( 'import_file_error', __( 'Zero size file downloaded', 'wordpress-importer' ) ); } $max_size = (int) $this->max_attachment_size(); if ( ! empty( $max_size ) && $filesize > $max_size ) { @unlink( $upload['file'] ); - return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', 'wordpress-importer'), size_format($max_size) ) ); + + return new WP_Error( 'import_file_error', sprintf( __( 'Remote file is too large, limit is %s', 'wordpress-importer' ), size_format( $max_size ) ) ); } - // keep track of the old and new urls so we can substitute them later - $this->url_remap[$url] = $upload['url']; - $this->url_remap[$post['guid']] = $upload['url']; // r13735, really needed? - // keep track of the destination if the remote url is redirected somewhere else - if ( isset($headers['x-final-location']) && $headers['x-final-location'] != $url ) - $this->url_remap[$headers['x-final-location']] = $upload['url']; + // keep track of the old and new urls so we can substitute them later. + $this->url_remap[ $url ] = $upload['url']; + $this->url_remap[ $post['guid'] ] = $upload['url']; // r13735, really needed? + // keep track of the destination if the remote url is redirected somewhere else. + if ( isset( $headers['x-final-location'] ) && $headers['x-final-location'] != $url ) { + $this->url_remap[ $headers['x-final-location'] ] = $upload['url']; + } return $upload; } - + + /** + * Decide what the maximum file size for downloaded attachments is. + * Default is 0 (unlimited), can be filtered via import_attachment_size_limit + * + * @return int Maximum attachment file size to import + */ + function max_attachment_size() { + return 0; + } + /** * Attempt to associate posts with previously missing parents * @@ -797,73 +1070,73 @@ function fetch_remote_file( $url, $post ) { function backfill_parents() { global $wpdb; - // find parents for post orphans + // find parents for post orphans. foreach ( $this->post_orphans as $child_id => $parent_id ) { $local_child_id = $local_parent_id = false; - if ( isset( $this->processed_posts[$child_id] ) ) - $local_child_id = $this->processed_posts[$child_id]; - if ( isset( $this->processed_posts[$parent_id] ) ) - $local_parent_id = $this->processed_posts[$parent_id]; + if ( isset( $this->processed_posts[ $child_id ] ) ) { + $local_child_id = $this->processed_posts[ $child_id ]; + } + if ( isset( $this->processed_posts[ $parent_id ] ) ) { + $local_parent_id = $this->processed_posts[ $parent_id ]; + } - if ( $local_child_id && $local_parent_id ) + if ( $local_child_id && $local_parent_id ) { $wpdb->update( $wpdb->posts, array( 'post_parent' => $local_parent_id ), array( 'ID' => $local_child_id ), '%d', '%d' ); + } } } - + + // return the difference in length between two strings. /** * Use stored mapping information to update old attachment URLs */ function backfill_attachment_urls() { global $wpdb; - // make sure we do the longest urls first, in case one is a substring of another - uksort( $this->url_remap, array(&$this, 'cmpr_strlen') ); + // make sure we do the longest urls first, in case one is a substring of another. + uksort( $this->url_remap, array( &$this, 'cmpr_strlen' ) ); foreach ( $this->url_remap as $from_url => $to_url ) { - // remap urls in post_content - $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $from_url, $to_url) ); - // remap enclosure urls - $result = $wpdb->query( $wpdb->prepare("UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url) ); + // remap urls in post_content. + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_content = REPLACE(post_content, %s, %s)", $from_url, $to_url ) ); + // remap enclosure urls. + $result = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = REPLACE(meta_value, %s, %s) WHERE meta_key='enclosure'", $from_url, $to_url ) ); } } - - // return the difference in length between two strings - function cmpr_strlen( $a, $b ) { - return strlen($b) - strlen($a); - } - + /** * Update _thumbnail_id meta to new, imported attachment IDs */ function remap_featured_images() { - // cycle through posts that have a featured image + // cycle through posts that have a featured image. foreach ( $this->featured_images as $post_id => $value ) { - if ( isset( $this->processed_posts[$value] ) ) { - $new_id = $this->processed_posts[$value]; - // only update if there's a difference - if ( $new_id != $value ) + if ( isset( $this->processed_posts[ $value ] ) ) { + $new_id = $this->processed_posts[ $value ]; + // only update if there's a difference. + if ( $new_id != $value ) { update_post_meta( $post_id, '_thumbnail_id', $new_id ); + } } } } - + /** * Update sm_term_image_id meta to new, imported attachment IDs */ function remap_term_images() { - // cycle through posts that have a featured image + // cycle through posts that have a featured image. foreach ( $this->taxonomy_featured_images as $term_id => $value ) { - if ( isset( $this->processed_posts[$value] ) ) { - $new_id = $this->processed_posts[$value]; - // only update if there's a difference + if ( isset( $this->processed_posts[ $value ] ) ) { + $new_id = $this->processed_posts[ $value ]; + // only update if there's a difference. if ( $new_id != $value ) { - $assigned_term_images = get_option( 'sermon_image_plugin' ); - $assigned_term_images[$term_id] = $new_id; - update_option( 'sermon_image_plugin', $assigned_term_images ); + $assigned_term_images = get_option( 'sermon_image_plugin' ); + $assigned_term_images[ $term_id ] = $new_id; + update_option( 'sermon_image_plugin', $assigned_term_images ); } } } } - + /** * Performs post-import cleanup of files and the cache */ @@ -881,85 +1154,70 @@ function import_end() { do_action( 'import_end' ); } - - /* WXR Functions - Start */ - - function XMLparse( $file ) { - $this->wxr_version = $this->in_post = $this->cdata = $this->data = $this->sub_data = $this->in_tag = $this->in_sub_tag = false; - $this->authors = $this->posts = $this->term = $this->category = $this->tag = array(); - $this->log( 'XML parser setup.', 0 ); - $xml = xml_parser_create( 'UTF-8' ); - xml_parser_set_option( $xml, XML_OPTION_SKIP_WHITE, 1 ); - xml_parser_set_option( $xml, XML_OPTION_CASE_FOLDING, 0 ); - xml_set_object( $xml, $this ); - xml_set_character_data_handler( $xml, 'cdata' ); - xml_set_element_handler( $xml, 'tag_open', 'tag_close' ); - - $this->log( 'Parsing content.', 0 ); - if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) { - $current_line = xml_get_current_line_number( $xml ); - $current_column = xml_get_current_column_number( $xml ); - $error_code = xml_get_error_code( $xml ); - $error_string = xml_error_string( $error_code ); - $this->log( 'There was an error when reading this WXR file.', 0 ); - return new WP_Error( 'XML_parse_error', 'There was an error when reading this WXR file', array( $current_line, $current_column, $error_string ) ); - } - xml_parser_free( $xml ); - - if ( ! preg_match( '/^\d+\.\d+$/', $this->wxr_version ) ) { - $this->log( 'This does not appear to be a WXR file, missing/invalid WXR version number.', 0 ); - return new WP_Error( 'WXR_parse_error', __( 'This does not appear to be a WXR file, missing/invalid WXR version number', 'wordpress-importer' ) ); - } - - $this->log( 'Setting content parameters.', 0 ); - return array( - 'authors' => $this->authors, - 'posts' => $this->posts, - 'categories' => $this->category, - 'tags' => $this->tag, - 'terms' => $this->term, - 'base_url' => $this->base_url, - 'version' => $this->wxr_version - ); + /* WXR Functions - Start */ + function cmpr_strlen( $a, $b ) { + return strlen( $b ) - strlen( $a ); } - + function tag_open( $parse, $tag, $attr ) { $this->log( 'Opening tags.', 0 ); if ( in_array( $tag, $this->wp_tags ) ) { $this->in_tag = substr( $tag, 3 ); + return; } if ( in_array( $tag, $this->wp_sub_tags ) ) { $this->in_sub_tag = substr( $tag, 3 ); + return; } switch ( $tag ) { case 'category': - if ( isset($attr['domain'], $attr['nicename']) ) { + if ( isset( $attr['domain'], $attr['nicename'] ) ) { $this->sub_data['domain'] = $attr['domain']; - $this->sub_data['slug'] = $attr['nicename']; + $this->sub_data['slug'] = $attr['nicename']; + } + break; + case 'item': + $this->in_post = true; + case 'title': + if ( $this->in_post ) { + $this->in_tag = 'post_title'; } break; - case 'item': $this->in_post = true; - case 'title': if ( $this->in_post ) $this->in_tag = 'post_title'; break; - case 'guid': $this->in_tag = 'guid'; break; - case 'dc:creator': $this->in_tag = 'post_author'; break; - case 'content:encoded': $this->in_tag = 'post_content'; break; - case 'excerpt:encoded': $this->in_tag = 'post_excerpt'; break; - - case 'wp:term_slug': $this->in_tag = 'slug'; break; - case 'wp:meta_key': $this->in_sub_tag = 'key'; break; - case 'wp:meta_value': $this->in_sub_tag = 'value'; break; + case 'guid': + $this->in_tag = 'guid'; + break; + case 'dc:creator': + $this->in_tag = 'post_author'; + break; + case 'content:encoded': + $this->in_tag = 'post_content'; + break; + case 'excerpt:encoded': + $this->in_tag = 'post_excerpt'; + break; + + case 'wp:term_slug': + $this->in_tag = 'slug'; + break; + case 'wp:meta_key': + $this->in_sub_tag = 'key'; + break; + case 'wp:meta_value': + $this->in_sub_tag = 'value'; + break; } } function cdata( $parser, $cdata ) { $this->log( 'Handling data.', 0 ); - if ( ! trim( $cdata ) ) + if ( ! trim( $cdata ) ) { return; + } if ( false !== $this->in_tag || false !== $this->in_sub_tag ) { $this->cdata .= $cdata; @@ -973,36 +1231,39 @@ function tag_close( $parser, $tag ) { switch ( $tag ) { case 'wp:comment': unset( $this->sub_data['key'], $this->sub_data['value'] ); // remove meta sub_data - if ( ! empty( $this->sub_data ) ) + if ( ! empty( $this->sub_data ) ) { $this->data['comments'][] = $this->sub_data; + } $this->sub_data = false; break; case 'wp:commentmeta': $this->sub_data['commentmeta'][] = array( - 'key' => $this->sub_data['key'], + 'key' => $this->sub_data['key'], 'value' => $this->sub_data['value'] ); break; case 'category': if ( ! empty( $this->sub_data ) ) { $this->sub_data['name'] = $this->cdata; - $this->data['terms'][] = $this->sub_data; + $this->data['terms'][] = $this->sub_data; } $this->sub_data = false; break; case 'wp:postmeta': - if ( ! empty( $this->sub_data ) ) + if ( ! empty( $this->sub_data ) ) { $this->data['postmeta'][] = $this->sub_data; + } $this->sub_data = false; break; case 'wp:termmeta': - if ( ! empty( $this->sub_data ) ) + if ( ! empty( $this->sub_data ) ) { $this->data['termmeta'][] = $this->sub_data; + } $this->sub_data = false; break; case 'item': $this->posts[] = $this->data; - $this->data = false; + $this->data = false; break; case 'wp:category': case 'wp:tag': @@ -1012,8 +1273,9 @@ function tag_close( $parser, $tag ) { $this->data = false; break; case 'wp:author': - if ( ! empty($this->data['author_login']) ) - $this->authors[$this->data['author_login']] = $this->data; + if ( ! empty( $this->data['author_login'] ) ) { + $this->authors[ $this->data['author_login'] ] = $this->data; + } $this->data = false; break; case 'wp:base_site_url': @@ -1025,16 +1287,16 @@ function tag_close( $parser, $tag ) { default: if ( $this->in_sub_tag ) { - $this->sub_data[$this->in_sub_tag] = ! empty( $this->cdata ) ? $this->cdata : ''; - $this->in_sub_tag = false; - } else if ( $this->in_tag ) { - $this->data[$this->in_tag] = ! empty( $this->cdata ) ? $this->cdata : ''; - $this->in_tag = false; + $this->sub_data[ $this->in_sub_tag ] = ! empty( $this->cdata ) ? $this->cdata : ''; + $this->in_sub_tag = false; + } elseif ( $this->in_tag ) { + $this->data[ $this->in_tag ] = ! empty( $this->cdata ) ? $this->cdata : ''; + $this->in_tag = false; } } $this->cdata = false; } - + /* WXR Functions - End */ } \ No newline at end of file From f1bd1b60aaa6eb6672992218e92889d8b5448e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 08:46:37 +0200 Subject: [PATCH 044/119] Fix new line in readme.txt --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 780cd72..c3c9270 100755 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: wpforchurch, nikolam Donate link: http://wpforchurch.com/ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts, itunes Requires at least: 4.5 -Tested up to: 4.9 +Tested up to: 4.9 Requires PHP: 5.3 Stable tag: 2.12.5 License: GPLv2 From ea6e2ff875bd7328b7903d58b4cfe31fd3e07118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 12 Apr 2018 09:26:11 +0200 Subject: [PATCH 045/119] Code Style: class-sm-export-sm.php --- includes/admin/export/class-sm-export-sm.php | 1061 +++++++++--------- includes/admin/import/class-sm-import-sb.php | 7 - 2 files changed, 549 insertions(+), 519 deletions(-) diff --git a/includes/admin/export/class-sm-export-sm.php b/includes/admin/export/class-sm-export-sm.php index 9c6dbc8..1258651 100644 --- a/includes/admin/export/class-sm-export-sm.php +++ b/includes/admin/export/class-sm-export-sm.php @@ -1,519 +1,556 @@ 'wpfc_sermon', - 'author' => false, - 'category' => false, - 'start_date' => false, - 'end_date' => false, - 'status' => false, - ); - $args = wp_parse_args($args, $defaults); - - /** - * Fires at the beginning of an export, before any headers are sent. - * - * @since 2.3.0 - * - * @param array $args An array of export arguments. - */ - //do_action( 'export_wp', $args ); - - $sitename = sanitize_key(get_bloginfo('name')); - if (!empty($sitename)) $sitename .= '.'; - $filename = $sitename . 'wordpress.' . date('Y-m-d') . '.xml'; - - header('Content-Description: File Transfer'); - header('Content-Disposition: attachment; filename=' . $filename); - header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); - - if ( post_type_exists($args['content']) ) { - $ptype = get_post_type_object($args['content']); - if (!$ptype->can_export) - return; - - $where = $wpdb->prepare("{$wpdb->posts}.post_type = %s", $args['content']); - } else { - return; - } - - $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; - - - $join = ''; - - // grab a snapshot of post IDs, just in case it changes during the export - $post_ids = apply_filters('export_post_ids', $wpdb->get_col("SELECT ID FROM {$wpdb->posts} $join WHERE $where"), $args); - $post_type_export = apply_filters('export_post_type', 'wpfc_sermon', $args); - - // get the requested terms ready, empty unless posts filtered by category or all content - $cats = $tags = $terms = array(); - $custom_taxonomies = array( - 'wpfc_preacher', - 'wpfc_sermon_series', - 'wpfc_sermon_topics', - 'wpfc_bible_book', - 'wpfc_service_type' - ); - $custom_terms = (array)get_terms($custom_taxonomies, array('get' => 'all')); - - // put terms in order with no child going before its parent - while ($t = array_shift($custom_terms)) { - if ($t->parent == 0 || isset($terms[$t->parent])) - $terms[$t->term_id] = $t; - else - $custom_terms[] = $t; - } - - unset($categories, $custom_taxonomies, $custom_terms); - - /** - * Wrap given string in XML CDATA tag. - * - * @since 2.1.0 - * - * @param string $str String to wrap in XML CDATA tag. - * @return string - */ - function wxr_cdata($str) - { - if (seems_utf8($str) == false) - $str = utf8_encode($str); - - // $str = ent2ncr(esc_html($str)); - $str = '', ']]]]>', $str) . ']]>'; - - return $str; - } - - /** - * Return the URL of the site - * - * @since 2.5.0 - * - * @return string Site URL. - */ - function wxr_site_url() - { - // ms: the base url - if (is_multisite()) - return network_home_url(); - // wp: the blog url - else - return get_bloginfo_rss('url'); - } - - /** - * Output list of taxonomy terms, in XML tag format, associated with a post - * - * @since 2.3.0 - */ - function wxr_post_taxonomy($post_id) { - $custom_taxonomies = array( - 'wpfc_preacher', - 'wpfc_sermon_series', - 'wpfc_sermon_topics', - 'wpfc_bible_book', - 'wpfc_service_type' - ); - $terms = wp_get_object_terms( $post_id, $custom_taxonomies ); - - foreach ( (array) $terms as $term ) { - echo "\t\ttaxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "\n"; - } - } - - /** - * Output a cat_name XML tag from a given category object - * - * @since 2.1.0 - * - * @param object $category Category Object - */ - function wxr_cat_name($category) - { - if (empty($category->name)) - return; - - echo '' . wxr_cdata($category->name) . ''; - } - - /** - * Output a category_description XML tag from a given category object - * - * @since 2.1.0 - * - * @param object $category Category Object - */ - function wxr_category_description($category) - { - if (empty($category->description)) - return; - - echo '' . wxr_cdata($category->description) . ''; - } - - /** - * Output a tag_name XML tag from a given tag object - * - * @since 2.3.0 - * - * @param object $tag Tag Object - */ - function wxr_tag_name($tag) - { - if (empty($tag->name)) - return; - - echo '' . wxr_cdata($tag->name) . ''; - } - - /** - * Output a tag_description XML tag from a given tag object - * - * @since 2.3.0 - * - * @param object $tag Tag Object - */ - function wxr_tag_description($tag) - { - if (empty($tag->description)) - return; - - echo '' . wxr_cdata($tag->description) . ''; - } - - /** - * Output a term_name XML tag from a given term object - * - * @since 2.9.0 - * - * @param object $term Term Object - */ - function wxr_term_name($term) - { - if (empty($term->name)) - return; - - echo '' . wxr_cdata($term->name) . ''; - } - - /** - * Output a term_description XML tag from a given term object - * - * @since 2.9.0 - * - * @param object $term Term Object - */ - function wxr_term_description($term) - { - if (empty($term->description)) - return; - - echo '' . wxr_cdata($term->description) . ''; - } - - /** - * Output list of authors with posts - * - * @since 3.1.0 - */ - function wxr_authors_list() - { - global $wpdb; - - $authors = array(); - $results = $wpdb->get_results("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft'"); - foreach ((array)$results as $result) - $authors[] = get_userdata($result->post_author); - - $authors = array_filter($authors); - - foreach ($authors as $author) { - echo "\t"; - echo '' . $author->ID . ''; - echo '' . $author->user_login . ''; - echo '' . $author->user_email . ''; - echo '' . wxr_cdata($author->display_name) . ''; - echo '' . wxr_cdata($author->user_firstname) . ''; - echo '' . wxr_cdata($author->user_lastname) . ''; - echo "\n"; - } - } - - function wxr_filter_postmeta($return_me, $meta_key) - { - if ('_edit_lock' == $meta_key) - $return_me = true; - return $return_me; - } - - add_filter('wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2); - - function sermon_return_attachment_id_from_url( $attachment_url ) { - global $wpdb; - $attachment_id = ''; - - //is attachment url set? - if ( $attachment_url !== '' ) { - //prepare query - - $query = $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid=%s", $attachment_url ); - - //get attachment id - $attachment_id = $wpdb->get_var( $query ); - } - - //return id - return $attachment_id; - } - - echo '\n"; - - ?> - - - - - - - - - - - - - - - - - - - - - - <?php bloginfo_rss('name'); ?> - - - - - - - - - - - - - term_id ?> - taxonomy; ?> - slug; ?> - parent ? $terms[$t->parent]->slug : ''; ?> - - - get_results($wpdb->prepare("SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $t->term_id)); - foreach ($termmeta as $meta) : - /** - * Filter whether to selectively skip post meta used for WXR exports. - * - * Returning a truthy value to the filter will skip the current meta - * object from being exported. - * - * @since 3.3.0 - * - * @param bool $skip Whether to skip the current post meta. Default false. - * @param string $meta_key Current meta key. - * @param object $meta Current meta object. - */ - if (apply_filters('wxr_export_skip_postmeta', false, $meta->meta_key, $meta)) - continue; - ?> - - meta_key; ?> - meta_value); ?> - - - term_id, $assigned_term_images) ) { ?> - - sm_term_image_id - term_id]; ?> - - - - - - - - in_the_loop = true; // Fake being in the loop. - - /* NEW CODE START */ - $meta_value_array = array(); - $meta_key_name = array( - 'sermon_audio', - 'sermon_video', - 'sermon_video_link', - 'sermon_notes', - 'sermon_bulletin' - ); - foreach ($post_ids as $post) { - $postmeta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post)); - $postobject = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post)); - $meta_value = array(); - if ($postobject[0]->post_type == $post_type_export) { - foreach ($postmeta as $meta) { - if ($meta->meta_key == '_thumbnail_id') { - $meta_value[] = $meta->meta_value; - } - if (in_array($meta->meta_key, $meta_key_name)) { - $attachment_id_temp = sermon_return_attachment_id_from_url($meta->meta_value); - if( !empty($attachment_id_temp) ) { - $meta_value[] = $attachment_id_temp; - } - } - } - } - if (isset($meta_value) && is_array($meta_value)) { - $meta_value_array = array_unique(array_merge($meta_value_array, $meta_value), SORT_REGULAR); - } - } - $attachment_array = array(); - foreach ($assigned_term_images as $term => $attachment) { - $attachment_array[] = $attachment; - } - $attachment_array = array_unique($attachment_array, SORT_REGULAR); - $post_ids = array_merge($post_ids, $meta_value_array, $attachment_array); - /* NEW CODE END */ - - // fetch 20 posts at a time rather than loading the entire table into memory - while ($next_posts = array_splice($post_ids, 0, 20)) { - $where = 'WHERE ID IN (' . join(',', $next_posts) . ')'; - $posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} $where"); - - // Begin Loop - foreach ($posts as $post) { - setup_postdata($post); - $is_sticky = is_sticky($post->ID) ? 1 : 0; - ?> - - - <?php echo apply_filters('the_title_rss', $post->post_title); ?> - - - - - - post_content)); - ?> - post_excerpt)); - ?> - ID; ?> - post_date; ?> - post_date_gmt; ?> - comment_status; ?> - ping_status; ?> - post_name; ?> - post_status; ?> - post_parent; ?> - menu_order; ?> - post_type; ?> - post_password; ?> - - ID); ?> - post_type == 'attachment') : ?> - ID); ?> - - get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID)); - foreach ($postmeta as $meta) : - /** - * Filter whether to selectively skip post meta used for WXR exports. - * - * Returning a truthy value to the filter will skip the current meta - * object from being exported. - * - * @since 3.3.0 - * - * @param bool $skip Whether to skip the current post meta. Default false. - * @param string $meta_key Current meta key. - * @param object $meta Current meta object. - */ - if (apply_filters('wxr_export_skip_postmeta', false, $meta->meta_key, $meta)) - continue; - ?> - - meta_key; ?> - meta_value); ?> - - - get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID)); - foreach ($comments as $c) : ?> - - comment_ID; ?> - comment_author); ?> - comment_author_email; ?> - comment_author_url); ?> - comment_author_IP; ?> - comment_date; ?> - comment_date_gmt; ?> - comment_content) ?> - comment_approved; ?> - comment_type; ?> - comment_parent; ?> - user_id; ?> - get_results($wpdb->prepare("SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID)); - foreach ($c_meta as $meta) : ?> - - meta_key; ?> - meta_value); ?> - - - - - - - - - 'wpfc_sermon', + 'author' => false, + 'category' => false, + 'start_date' => false, + 'end_date' => false, + 'status' => false, + ); + $args = wp_parse_args( $args, $defaults ); + + $sitename = sanitize_key( get_bloginfo( 'name' ) ); + if ( ! empty( $sitename ) ) { + $sitename .= '.'; + } + $filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml'; + + header( 'Content-Description: File Transfer' ); + header( 'Content-Disposition: attachment; filename=' . $filename ); + header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); + + if ( post_type_exists( $args['content'] ) ) { + $ptype = get_post_type_object( $args['content'] ); + if ( ! $ptype->can_export ) { + return; + } + + $where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] ); + } else { + return; + } + + $where .= " AND {$wpdb->posts}.post_status != 'auto-draft'"; + + $join = ''; + + // Grab a snapshot of post IDs, just in case it changes during the export. + $post_ids = apply_filters( 'export_post_ids', $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" ), $args ); + $post_type_export = apply_filters( 'export_post_type', 'wpfc_sermon', $args ); + + // Get the requested terms ready, empty unless posts filtered by category or all content. + $cats = array(); + $tags = array(); + $terms = array(); + $custom_taxonomies = array( + 'wpfc_preacher', + 'wpfc_sermon_series', + 'wpfc_sermon_topics', + 'wpfc_bible_book', + 'wpfc_service_type', + ); + $custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) ); + + // put terms in order with no child going before its parent. + while ( $t = array_shift( $custom_terms ) ) { + if ( 0 == $t->parent || isset( $terms[ $t->parent ] ) ) { + $terms[ $t->term_id ] = $t; + } else { + $custom_terms[] = $t; + } + } + + unset( $categories, $custom_taxonomies, $custom_terms ); + + /** + * Wrap given string in XML CDATA tag. + * + * @since 2.1.0 + * + * @param string $str String to wrap in XML CDATA tag. + * + * @return string + */ + function wxr_cdata( $str ) { + if ( seems_utf8( $str ) == false ) { + $str = utf8_encode( $str ); + } + + $str = '', ']]]]>', $str ) . ']]>'; + + return $str; + } + + /** + * Return the URL of the site + * + * @since 2.5.0 + * + * @return string Site URL. + */ + function wxr_site_url() { + // ms: the base url. + if ( is_multisite() ) { + return network_home_url(); + } // wp: the blog url. + else { + return get_bloginfo_rss( 'url' ); + } + } + + /** + * Output list of taxonomy terms, in XML tag format, associated with a post + * + * @since 2.3.0 + * + * @param int $post_id The post ID. + */ + function wxr_post_taxonomy( $post_id ) { + $custom_taxonomies = array( + 'wpfc_preacher', + 'wpfc_sermon_series', + 'wpfc_sermon_topics', + 'wpfc_bible_book', + 'wpfc_service_type', + ); + $terms = wp_get_object_terms( $post_id, $custom_taxonomies ); + + foreach ( (array) $terms as $term ) { + echo "\t\ttaxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "\n"; + } + } + + /** + * Output a cat_name XML tag from a given category object + * + * @since 2.1.0 + * + * @param object $category Category Object. + */ + function wxr_cat_name( $category ) { + if ( empty( $category->name ) ) { + return; + } + + echo '' . wxr_cdata( $category->name ) . ''; + } + + /** + * Output a category_description XML tag from a given category object + * + * @since 2.1.0 + * + * @param object $category Category Object. + */ + function wxr_category_description( $category ) { + if ( empty( $category->description ) ) { + return; + } + + echo '' . wxr_cdata( $category->description ) . ''; + } + + /** + * Output a tag_name XML tag from a given tag object + * + * @since 2.3.0 + * + * @param object $tag Tag Object. + */ + function wxr_tag_name( $tag ) { + if ( empty( $tag->name ) ) { + return; + } + + echo '' . wxr_cdata( $tag->name ) . ''; + } + + /** + * Output a tag_description XML tag from a given tag object + * + * @since 2.3.0 + * + * @param object $tag Tag Object. + */ + function wxr_tag_description( $tag ) { + if ( empty( $tag->description ) ) { + return; + } + + echo '' . wxr_cdata( $tag->description ) . ''; + } + + /** + * Output a term_name XML tag from a given term object + * + * @since 2.9.0 + * + * @param object $term Term Object. + */ + function wxr_term_name( $term ) { + if ( empty( $term->name ) ) { + return; + } + + echo '' . wxr_cdata( $term->name ) . ''; + } + + /** + * Output a term_description XML tag from a given term object + * + * @since 2.9.0 + * + * @param object $term Term Object. + */ + function wxr_term_description( $term ) { + if ( empty( $term->description ) ) { + return; + } + + echo '' . wxr_cdata( $term->description ) . ''; + } + + /** + * Output list of authors with posts + * + * @since 3.1.0 + */ + function wxr_authors_list() { + global $wpdb; + + $authors = array(); + $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft'" ); + foreach ( (array) $results as $result ) { + $authors[] = get_userdata( $result->post_author ); + } + + $authors = array_filter( $authors ); + + foreach ( $authors as $author ) { + echo "\t"; + echo '' . $author->ID . ''; + echo '' . $author->user_login . ''; + echo '' . $author->user_email . ''; + echo '' . wxr_cdata( $author->display_name ) . ''; + echo '' . wxr_cdata( $author->user_firstname ) . ''; + echo '' . wxr_cdata( $author->user_lastname ) . ''; + echo "\n"; + } + } + + /** + * Filters post meta fields. + * + * @param mixed $return_me Meta value. + * @param string $meta_key Meta key. + * + * @return mixed + */ + function wxr_filter_postmeta( $return_me, $meta_key ) { + if ( '_edit_lock' == $meta_key ) { + $return_me = true; + } + + return $return_me; + } + + add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 ); + + /** + * Find the attachment ID. + * + * @param string $attachment_url The URL. + * + * @return null|string + */ + function sermon_return_attachment_id_from_url( $attachment_url ) { + global $wpdb; + $attachment_id = ''; + + // is attachment url set? + if ( '' !== $attachment_url ) { + // prepare query. + $query = $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid=%s", $attachment_url ); + + // get attachment id. + $attachment_id = $wpdb->get_var( $query ); + } + + // return id. + return $attachment_id; + } + + echo '\n"; + + ?> + + + + + + + + + + + + + + + + + + + + + + <?php bloginfo_rss( 'name' ); ?> + + + + + + + + + + + + + term_id; ?> + taxonomy; ?> + slug; ?> + parent ? $terms[ $t->parent ]->slug : ''; ?> + + + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $t->term_id ) ); + foreach ( $termmeta as $meta ) : + /** + * Filter whether to selectively skip post meta used for WXR exports. + * + * Returning a truthy value to the filter will skip the current meta + * object from being exported. + * + * @since 3.3.0 + * + * @param bool $skip Whether to skip the current post meta. Default false. + * @param string $meta_key Current meta key. + * @param object $meta Current meta object. + */ + if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { + continue; + } + ?> + + meta_key; ?> + meta_value ); ?> + + + term_id, $assigned_term_images ) ) { ?> + + sm_term_image_id + term_id ]; ?> + + + + + + + + in_the_loop = true; // Fake being in the loop. + + /* NEW CODE START */ + $meta_value_array = array(); + $meta_key_name = array( + 'sermon_audio', + 'sermon_video', + 'sermon_video_link', + 'sermon_notes', + 'sermon_bulletin', + ); + foreach ( $post_ids as $post ) { + $postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post ) ); + $postobject = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d", $post ) ); + $meta_value = array(); + if ( $postobject[0]->post_type == $post_type_export ) { + foreach ( $postmeta as $meta ) { + if ( '_thumbnail_id' == $meta->meta_key ) { + $meta_value[] = $meta->meta_value; + } + if ( in_array( $meta->meta_key, $meta_key_name ) ) { + $attachment_id_temp = sermon_return_attachment_id_from_url( $meta->meta_value ); + if ( ! empty( $attachment_id_temp ) ) { + $meta_value[] = $attachment_id_temp; + } + } + } + } + if ( isset( $meta_value ) && is_array( $meta_value ) ) { + $meta_value_array = array_unique( array_merge( $meta_value_array, $meta_value ), SORT_REGULAR ); + } + } + $attachment_array = array(); + foreach ( $assigned_term_images as $term => $attachment ) { + $attachment_array[] = $attachment; + } + $attachment_array = array_unique( $attachment_array, SORT_REGULAR ); + $post_ids = array_merge( $post_ids, $meta_value_array, $attachment_array ); + /* NEW CODE END */ + + // fetch 20 posts at a time rather than loading the entire table into memory. + while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) { + $where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')'; + $posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" ); + + // Begin Loop. + foreach ( $posts as $post ) { + setup_postdata( $post ); + $is_sticky = is_sticky( $post->ID ) ? 1 : 0; + ?> + + + <?php echo apply_filters( 'the_title_rss', $post->post_title ); ?> + + + + + + + post_content ) ); + ?> + + + post_excerpt ) ); + ?> + + ID; ?> + post_date; ?> + post_date_gmt; ?> + comment_status; ?> + ping_status; ?> + post_name; ?> + post_status; ?> + post_parent; ?> + menu_order; ?> + post_type; ?> + post_password; ?> + + ID ); ?> + post_type ) : ?> + ID ); ?> + + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) ); + foreach ( $postmeta as $meta ) : + /** + * Filter whether to selectively skip post meta used for WXR exports. + * + * Returning a truthy value to the filter will skip the current meta + * object from being exported. + * + * @since 3.3.0 + * + * @param bool $skip Whether to skip the current post meta. Default false. + * @param string $meta_key Current meta key. + * @param object $meta Current meta object. + */ + if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) { + continue; + } + ?> + + meta_key; ?> + meta_value ); ?> + + + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) ); + foreach ( $comments as $c ) : + ?> + + comment_ID; ?> + comment_author ); ?> + comment_author_email; ?> + comment_author_url ); ?> + comment_author_IP; ?> + comment_date; ?> + comment_date_gmt; ?> + comment_content ); ?> + comment_approved; ?> + comment_type; ?> + comment_parent; ?> + user_id; ?> + get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) ); + foreach ( $c_meta as $meta ) : + ?> + + meta_key; ?> + meta_value ); ?> + + + + + + + + + Date: Thu, 12 Apr 2018 09:35:17 +0200 Subject: [PATCH 046/119] Code Style: includes/admin/settings --- .../settings/class-sm-settings-debug.php | 24 +++-- .../settings/class-sm-settings-general.php | 37 +++++--- .../admin/settings/class-sm-settings-page.php | 24 +++-- .../settings/class-sm-settings-podcast.php | 87 ++++++++++++------- .../settings/class-sm-settings-verse.php | 32 ++++--- 5 files changed, 140 insertions(+), 64 deletions(-) diff --git a/includes/admin/settings/class-sm-settings-debug.php b/includes/admin/settings/class-sm-settings-debug.php index dcff4bc..6d44a1c 100644 --- a/includes/admin/settings/class-sm-settings-debug.php +++ b/includes/admin/settings/class-sm-settings-debug.php @@ -1,10 +1,19 @@ id = 'debug'; $this->label = __( 'Debug', 'sermon-manager-for-wordpress' ); @@ -23,7 +32,7 @@ public function get_settings() { 'title' => __( 'Debug Settings', 'sermon-manager-for-wordpress' ), 'type' => 'title', 'desc' => '', - 'id' => 'debug_settings' + 'id' => 'debug_settings', ), array( 'title' => __( 'Force Sermon Manager\'s WP_Background_Updater class', 'sermon-manager-for-wordpress' ), @@ -42,7 +51,7 @@ public function get_settings() { 'title' => __( 'Enable book sorting in dropdown box' ), 'type' => 'checkbox', 'id' => 'sort_bible_books', - 'default' => 'yes' + 'default' => 'yes', ), array( 'title' => __( 'Execute all update functions that have not been executed yet' ), @@ -57,7 +66,7 @@ public function get_settings() { 1 => 'Enable', 11 => 'Enable and re-create all', 0 => 'Disable', - 10 => 'Disable and flush existing' + 10 => 'Disable and flush existing', ), 'id' => 'post_content_enabled', 'default' => 1, @@ -69,7 +78,7 @@ public function get_settings() { 1 => 'Enable', 11 => 'Enable and re-create all', 0 => 'Disable', - 10 => 'Disable and flush existing' + 10 => 'Disable and flush existing', ), 'id' => 'post_excerpt_enabled', 'default' => 1, @@ -110,7 +119,10 @@ public function get_settings() { 'default' => 0, ), - array( 'type' => 'sectionend', 'id' => 'debug_settings' ), + array( + 'type' => 'sectionend', + 'id' => 'debug_settings', + ), ) ); return apply_filters( 'sm_get_settings_' . $this->id, $settings ); diff --git a/includes/admin/settings/class-sm-settings-general.php b/includes/admin/settings/class-sm-settings-general.php index e56c55f..49b849a 100644 --- a/includes/admin/settings/class-sm-settings-general.php +++ b/includes/admin/settings/class-sm-settings-general.php @@ -1,10 +1,19 @@ id = 'general'; $this->label = __( 'General', 'sermon-manager-for-wordpress' ); @@ -24,12 +33,13 @@ public function get_settings() { 'title' => __( 'General Settings', 'sermon-manager-for-wordpress' ), 'type' => 'title', 'desc' => '', - 'id' => 'general_settings' + 'id' => 'general_settings', ), array( 'title' => __( 'Archive Page Slug', 'sermon-manager-for-wordpress' ), 'type' => 'text', 'id' => 'archive_slug', + // translators: %s: Archive page title, default: "Sermons". 'placeholder' => wp_sprintf( __( 'e.g. %s', 'sermon-manager-for-wordpress' ), sanitize_title( __( 'Sermons', 'sermon-manager-for-wordpress' ) ) ), 'default' => 'sermons', ), @@ -37,8 +47,8 @@ public function get_settings() { 'title' => __( 'Common Base Slug', 'sermon-manager-for-wordpress' ), 'type' => 'checkbox', 'desc' => __( 'Enable a common base slug across all taxonomies', 'sermon-manager-for-wordpress' ), - // translators: %1$s see msgid "sermons/preacher", effectively sermons/preacher - // translators: %2$s see msgid "sermons/series", effectively sermons/series + // translators: %1$s see msgid "sermons/preacher", effectively sermons/preacher. + // translators: %2$s see msgid "sermons/series", effectively sermons/series. 'desc_tip' => wp_sprintf( __( 'This is for users who want to have a common base slug across all taxonomies, e.g. %1$s or %2$s.', 'sermon-manager-for-wordpress' ), '' . __( 'sermons/preacher', 'sermon-manager-for-wordpress' ) . '', '' . __( 'sermons/series', 'sermon-manager-for-wordpress' ) . '' ), 'id' => 'common_base_slug', 'default' => 'no', @@ -55,7 +65,7 @@ public function get_settings() { 'title' => __( 'Disable Sermon Styles', 'sermon-manager-for-wordpress' ), 'type' => 'checkbox', 'desc' => __( 'Disable Sermon CSS', 'sermon-manager-for-wordpress' ), - // translators: %s effectively sermons.css + // translators: %s effectively sermons.css. 'desc_tip' => wp_sprintf( __( 'If you do this, you should copy the styles from %s and include them in your theme CSS.', 'sermon-manager-for-wordpress' ), 'sermons.css' ), 'id' => 'css', 'default' => 'no', @@ -73,7 +83,7 @@ public function get_settings() { 'default' => 'no', ), array( - 'title' => __( 'Display Service Type filtering on archive pages', 'sermon-manager-for-wordpress' ), + 'title' => __( 'Display Service Type filtering on archive pages', 'sermon-manager-for-wordpress' ), 'type' => 'checkbox', 'id' => 'service_type_filtering', 'default' => 'no', @@ -109,7 +119,7 @@ public function get_settings() { '2' => 'YY/mm/dd', '3' => 'YY/dd/mm', ), - 'default' => '0' + 'default' => '0', ), array( 'title' => __( 'Disable sermon image on archive view', 'sermon-manager-for-wordpress' ), @@ -119,13 +129,16 @@ public function get_settings() { 'default' => 'no', ), array( - 'title' => __( 'Disable sermon image on single sermon view', 'sermon-manager-for-wordpress' ), - 'type' => 'checkbox', - 'id' => 'disable_image_single', - 'default' => 'no', + 'title' => __( 'Disable sermon image on single sermon view', 'sermon-manager-for-wordpress' ), + 'type' => 'checkbox', + 'id' => 'disable_image_single', + 'default' => 'no', ), - array( 'type' => 'sectionend', 'id' => 'general_settings' ), + array( + 'type' => 'sectionend', + 'id' => 'general_settings', + ), ) ); return apply_filters( 'sm_get_settings_' . $this->id, $settings ); diff --git a/includes/admin/settings/class-sm-settings-page.php b/includes/admin/settings/class-sm-settings-page.php index 659eb14..5e49535 100644 --- a/includes/admin/settings/class-sm-settings-page.php +++ b/includes/admin/settings/class-sm-settings-page.php @@ -1,17 +1,31 @@ id . '_' . $current_section ); } } -} \ No newline at end of file +} diff --git a/includes/admin/settings/class-sm-settings-podcast.php b/includes/admin/settings/class-sm-settings-podcast.php index 08d8a88..6e48915 100644 --- a/includes/admin/settings/class-sm-settings-podcast.php +++ b/includes/admin/settings/class-sm-settings-podcast.php @@ -1,10 +1,19 @@ id = 'podcast'; $this->label = __( 'Podcast', 'sermon-manager-for-wordpress' ); @@ -54,7 +63,9 @@ public function get_settings() { 'title' => __( 'Copyright', 'sermon-manager-for-wordpress' ), 'type' => 'text', 'id' => 'copyright', + // translators: %s: blog name. 'placeholder' => wp_sprintf( __( 'Copyright © %s', 'sermon-manager-for-wordpress' ), get_bloginfo( 'name' ) ), + // translators: %s: copyright symbol HTML entitiy (©). 'desc' => wp_sprintf( esc_html__( 'Tip: Use %s to generate a copyright symbol.', 'sermon-manager-for-wordpress' ), '' . htmlspecialchars( '©' ) . '' ), ), array( @@ -80,6 +91,7 @@ public function get_settings() { 'title' => __( 'Subtitle', 'sermon-manager-for-wordpress' ), 'type' => 'text', 'id' => 'itunes_subtitle', + // translators: %s: blog name. 'placeholder' => wp_sprintf( __( 'e.g. Preaching and teaching audio from %s', 'sermon-manager-for-wordpress' ), get_bloginfo( 'name' ) ), 'desc' => __( 'Your subtitle should briefly tell the listener what they can expect to hear.', 'sermon-manager-for-wordpress' ), ), @@ -87,9 +99,8 @@ public function get_settings() { 'title' => __( 'Summary', 'sermon-manager-for-wordpress' ), 'type' => 'text', 'id' => 'itunes_summary', - 'placeholder' => __( - wp_sprintf( 'e.g. Weekly teaching audio brought to you by %s in City, State.', 'sermon-manager-for-wordpress' ), - get_bloginfo( 'name' ) ), + // translators: %s: blog name. + 'placeholder' => wp_sprintf( __( 'e.g. Weekly teaching audio brought to you by %s in City, State.', 'sermon-manager-for-wordpress' ), get_bloginfo( 'name' ) ), 'desc' => __( 'Keep your Podcast Summary short, sweet and informative. Be sure to include a brief statement about your mission and in what region your audio content originates.', 'sermon-manager-for-wordpress' ), ), array( @@ -132,9 +143,9 @@ public function get_settings() { 'type' => 'checkbox', 'id' => 'podtrac', 'desc' => __( 'Enables PodTrac tracking.', 'sermon-manager-for-wordpress' ), - // translators: %s podtrac.com + // translators: %s podtrac.com. 'desc_tip' => wp_sprintf( __( 'For more info on PodTrac or to sign up for an account, visit %s', 'sermon-manager-for-wordpress' ), 'podtrac.com' ), - 'default' => 'no', + 'default' => 'no', ), array( 'title' => __( 'HTML in description', 'sermon-manager-for-wordpress' ), @@ -142,7 +153,7 @@ public function get_settings() { 'id' => 'enable_podcast_html_description', 'desc' => __( 'Enables showing of HTML in iTunes description field. Uncheck if description looks messy.', 'sermon-manager-for-wordpress' ), 'desc_tip' => __( 'It is recommended to leave it unchecked.', 'sermon-manager-for-wordpress' ), - 'default' => 'no', + 'default' => 'no', ), array( 'title' => __( 'Redirect', 'sermon-manager-for-wordpress' ), @@ -168,37 +179,51 @@ public function get_settings() { 'placeholder' => get_option( 'posts_per_rss' ), ), - array( 'type' => 'sectionend', 'id' => 'podcast_settings' ), + array( + 'type' => 'sectionend', + 'id' => 'podcast_settings', + ), ) ); return apply_filters( 'sm_get_settings_' . $this->id, $settings ); } + /** + * Additional HTML after the settings form. + */ public function after() { ?> -
-

- - -

-

- ' . esc_html__( 'Feed Validator', 'sermon-manager-for-wordpress' ) . '' ) ?> -

-

- ' . esc_html__( 'Submit Your Podcast', 'sermon-manager-for-wordpress' ) . '' ) ?> -

-

- ' . esc_html__( 'FeedBurner', 'sermon-manager-for-wordpress' ) . '' ) ?> -

-

- ' . esc_html__( 'iTunes FAQ for Podcast Makers', 'sermon-manager-for-wordpress' ) . '' ) ?> -

-
+
+

+ + +

+

+ ' . esc_html__( 'Feed Validator', 'sermon-manager-for-wordpress' ) . '' ); + ?> +

+

+ ' . esc_html__( 'Submit Your Podcast', 'sermon-manager-for-wordpress' ) . '' ); + ?> +

+

+ ' . esc_html__( 'FeedBurner', 'sermon-manager-for-wordpress' ) . '' ); + ?> +

+

+ ' . esc_html__( 'iTunes FAQ for Podcast Makers', 'sermon-manager-for-wordpress' ) . '' ); + ?> +

+
id = 'verse'; $this->label = __( 'Verse', 'sermon-manager-for-wordpress' ); @@ -19,16 +28,16 @@ public function __construct() { */ public function get_settings() { if ( strpos( get_locale(), 'es_' ) !== false ) { - // Add Spanish Bible translations + // Add Spanish Bible translations. add_filter( 'sm_verse_settings', function ( $settings ) { foreach ( $settings as &$setting ) { - if ( $setting['id'] === 'verse_bible_version' ) { + if ( 'verse_bible_version' === $setting['id'] ) { $setting['options'] = array_merge( array( 'LBLA95' => 'LBLA95', 'NBLH' => 'NBLH', 'NVI' => 'NVI', 'RVR60' => 'RVR60', - 'RVA' => 'RVA' + 'RVA' => 'RVA', ), $setting['options'] ); $setting['default'] = 'NVI'; @@ -41,10 +50,10 @@ public function get_settings() { } ); } else { // Check if Spanish Bible translation was selected previously, - // and if it was - append it to the list + // and if it was - append it to the list. add_filter( 'sm_verse_settings', function ( $settings ) { foreach ( $settings as &$setting ) { - if ( $setting['id'] === 'verse_bible_version' ) { + if ( 'verse_bible_version' === $setting['id'] ) { switch ( SermonManager::getOption( 'verse_bible_version' ) ) { case $setting['default']: case '': @@ -56,12 +65,12 @@ public function get_settings() { 'NBLH', 'NVI', 'RVR60', - 'RVA' + 'RVA', ) as $value ) { if ( SermonManager::getOption( 'verse_bible_version' ) === $value ) { $setting['options'] = array_merge( array( - $value => $value + $value => $value, ), $setting['options'] ); $setting['desc'] = __( 'Note: WordPress is not set to any Spanish variant. Reverted to ESV.', 'sermon-manager-for-wordpress' ); @@ -82,7 +91,7 @@ public function get_settings() { 'title' => __( 'Verse Settings', 'sermon-manager-for-wordpress' ), 'type' => 'title', 'desc' => '', - 'id' => 'verse_settings' + 'id' => 'verse_settings', ), array( 'title' => __( 'Verse Popups', 'sermon-manager-for-wordpress' ), @@ -122,7 +131,10 @@ public function get_settings() { 'id' => 'widget_show_key_verse', ), - array( 'type' => 'sectionend', 'id' => 'verse_settings' ), + array( + 'type' => 'sectionend', + 'id' => 'verse_settings', + ), ) ); return apply_filters( 'sm_get_settings_' . $this->id, $settings ); From ad394ae99096bd52cee525aeca02ee20617714d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Fri, 13 Apr 2018 10:46:09 +0200 Subject: [PATCH 047/119] Fix image_size not working Closes #181 --- includes/class-sm-shortcodes.php | 6 +++--- includes/sm-core-functions.php | 14 ++++++++------ includes/sm-template-functions.php | 13 ++++++++++--- readme.txt | 1 + 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/includes/class-sm-shortcodes.php b/includes/class-sm-shortcodes.php index a6e1c2d..020bac4 100755 --- a/includes/class-sm-shortcodes.php +++ b/includes/class-sm-shortcodes.php @@ -688,7 +688,7 @@ public function display_sermon_sorting( $atts = array() ) { * @type string $atts ['orderby'] Sort by: date (default), none, ID, title, name, rand, comment_count. * @type bool $atts ['disable_pagination'] 1 to hide the pagination (default 0). * @type bool $atts ['image_size'] Image size. Possible values: sermon_small, sermon_medium, sermon_wide, - * thumbnail, medium, large, full, or any size added with add_image_size(). (default is sermon_small). + * thumbnail, medium, large, full, or any size added with add_image_size(). (default is "post-thumbnail"). * @type string $atts ['filter_by'] Filter by series, preacher, topic, book, service_type. * @type string $atts ['filter_value'] ID/slug of allowed filters. * @type int $atts ['year'] 4 digit year (e.g. 2011). @@ -722,7 +722,7 @@ function display_sermons( $atts = array() ) { 'order' => 'DESC', 'orderby' => 'date', 'disable_pagination' => 0, - 'image_size' => 'sermon_small', + 'image_size' => 'post-thumbnail', 'filter_by' => '', 'filter_value' => '', 'year' => '', @@ -893,7 +893,7 @@ function display_sermons( $atts = array() ) { $query->the_post(); global $post; ?> - ' . wpfc_sermon_excerpt_v2( true ) . '', $post ); ?> + ' . wpfc_sermon_excerpt_v2( true, $args ) . '', $post ); ?> diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index ba38663..ba1bcdf 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -611,26 +611,28 @@ function sm_debug_get_update_functions() { /** * Returns sermon image URL * - * @param bool $fallback If set to true, it will try to get series image URL if sermon image URL is not set. + * @param bool $fallback If set to true, it will try to get series image URL if sermon image URL is not set. + * @param string $image_size The image size. Defaults to "post-thumbnail". * * @return string Image URL or empty string * * @since 2.12.0 */ -function get_sermon_image_url( $fallback = true ) { - if ( get_the_post_thumbnail_url() ) { - return get_the_post_thumbnail_url(); +function get_sermon_image_url( $fallback = true, $image_size = 'post-thumbnail' ) { + $image = get_the_post_thumbnail_url( null, $image_size ); + if ( $image ) { + return $image; } if ( $fallback ) { foreach ( apply_filters( 'sermon-images-get-the-terms', '', array( 'post_id' => get_the_ID(), - 'image_size' => 'medium', + 'image_size' => $image_size, ) ) as $term ) { if ( isset( $term->image_id ) && 0 !== $term->image_id ) { - $image = wp_get_attachment_image_url( $term->image_id, 'full' ); + $image = wp_get_attachment_image_url( $term->image_id, $image_size ); if ( $image ) { return $image; } diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 29f5740..d3780a7 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -566,13 +566,20 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) { /** * Renders updated archive sermon view. * - * @param bool $return True to return output, false to echo (default). + * @param bool $return True to return output, false to echo (default). + * @param array $args Passed from shortcode. * * @return string The HTML if $return is set to true. */ -function wpfc_sermon_excerpt_v2( $return = false ) { +function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) { global $post; + if ( empty( $args ) ) { + $args = array( + 'image_size' => 'post-thumbnail', + ); + } + ob_start(); ?> @@ -583,7 +590,7 @@ function wpfc_sermon_excerpt_v2( $return = false ) { diff --git a/readme.txt b/readme.txt index c3c9270..0b7663e 100755 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### +* Fix: Image size shortcode argument not working * Fix: SB image import breaking when image is local and does not exist on filesystem * Fix: Taxonomy image assignment not working * Dev: Add more hooks From 567d2eaae56ac3e8ed1af9de479ac1f53dea4b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Fri, 13 Apr 2018 10:56:00 +0200 Subject: [PATCH 048/119] Add Morgan theme compatibility --- assets/css/theme-specific/wpfc-morgan.css | 3 +++ views/partials/wrapper-end.php | 5 +++++ views/partials/wrapper-start.php | 3 +++ 3 files changed, 11 insertions(+) create mode 100644 assets/css/theme-specific/wpfc-morgan.css diff --git a/assets/css/theme-specific/wpfc-morgan.css b/assets/css/theme-specific/wpfc-morgan.css new file mode 100644 index 0000000..ded4290 --- /dev/null +++ b/assets/css/theme-specific/wpfc-morgan.css @@ -0,0 +1,3 @@ +.player-wordpress .wpfc-sermon-single-audio-download { + margin-bottom: 0; +} \ No newline at end of file diff --git a/views/partials/wrapper-end.php b/views/partials/wrapper-end.php index 39ad84a..127b6be 100644 --- a/views/partials/wrapper-end.php +++ b/views/partials/wrapper-end.php @@ -54,6 +54,11 @@ get_sidebar(); echo ''; break; + case 'wpfc-morgan': + echo ''; + get_sidebar( 'sermon' ); + get_footer(); + break; default: ob_start(); get_sidebar(); diff --git a/views/partials/wrapper-start.php b/views/partials/wrapper-start.php index 3ae05f7..09db1ae 100644 --- a/views/partials/wrapper-start.php +++ b/views/partials/wrapper-start.php @@ -40,6 +40,9 @@ case 'Avada': echo '
'; break; + case 'wpfc-morgan': + echo '
'; + break; default: echo apply_filters( 'sm_templates_wrapper_start', '
' ); break; From 3707771cd701302ba39f8fcf7db6778c6877d0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Fri, 13 Apr 2018 11:05:04 +0200 Subject: [PATCH 049/119] Fix audio download CSS --- assets/css/partials/_single.scss | 6 +----- assets/css/sermon.min.css | 2 +- assets/css/sermon.min.css.map | 2 +- assets/css/sermon.scss | 4 ---- includes/sm-template-functions.php | 2 +- readme.txt | 1 + 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/assets/css/partials/_single.scss b/assets/css/partials/_single.scss index b575609..c49b9b0 100644 --- a/assets/css/partials/_single.scss +++ b/assets/css/partials/_single.scss @@ -70,15 +70,11 @@ .player-wordpress & { background: #222; + margin-bottom: 1.75em; svg { fill: rgb(255, 255, 255); } - - @media screen and (min-width: 77.5em) { - font-size: 1.9rem; - margin-bottom: 1.6842em; - } } //noinspection SpellCheckingInspection diff --git a/assets/css/sermon.min.css b/assets/css/sermon.min.css index ee2057a..86963b4 100644 --- a/assets/css/sermon.min.css +++ b/assets/css/sermon.min.css @@ -1,2 +1,2 @@ -.wpfc-sermon-container #wpfc_sermon_sorting{padding:0;margin:0 0 48px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div{margin:0 8px 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0 0 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting form{margin:0}@media (max-width: 700px){.wpfc-sermon-container #wpfc_sermon_sorting>div{width:100%;margin:0 0 12px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0}.wpfc-sermon-container #wpfc_sermon_sorting select{display:block;width:100%;max-width:100%}}.wpfc-sermon-shortcode{margin-bottom:2rem}.wpfc-sermon-image{height:auto;position:relative}.wpfc-sermon-image-img{width:100%;background-size:cover;background-position:center}.wpfc-sermon-header{display:grid;grid-template-columns:70% 30%;align-items:center}.wpfc-sermon-header-aside{text-align:center}.wpfc-sermon-title{margin:0;padding:0}.wpfc-sermon-meta-item{font-size:14px;opacity:.87}.wpfc-sermon-meta-series{margin:0 0 8px 0}.wpfc-sermon-meta-date{margin:8px 0 0}.wpfc-sermon-description{font-size:14px;margin:8px 0 0}.wpfc-sermon-description p{margin:0 0 12px 0}.wpfc-sermon-description p:last-child{margin:0}.wpfc-sermon-audio{margin-top:24px}.wpfc-sermon-footer{margin-top:24px;padding-top:24px;border-top:1px solid #ddd}.wpfc-sermon-footer .wpfc-sermon-meta-item{display:inline-block;position:relative}.wpfc-sermon-footer .wpfc-sermon-meta-item:not(:last-child):after{content:'|';padding:0 4px;color:#ddd}.wpfc-sermon-meta-preacher img{border-radius:50%;width:35px;height:35px;vertical-align:middle;display:inline-block}.wpfc-sermon-meta-preacher>a{text-decoration:none;box-shadow:none;border:0;display:inline-block}.wpfc-sermon-meta-prefix,.wpfc-sermon-meta-text{vertical-align:middle}.wpfc-sermon>.wpfc-sermon-inner{background:white;border:1px solid #ddd}.wpfc-sermon-main{padding:24px}.wpfc-sermon-att-audio,.wpfc-sermon-att-notes,.wpfc-sermon-bulletin{width:auto;height:auto;padding:4px;border:1px solid #efefef;margin-bottom:4px}@media (min-width: 801px){.wpfc-sermon-inner{display:flex;flex-flow:row wrap}.wpfc-sermon-image{flex:0 30%}.wpfc-sermon-image-img{height:100%}.wpfc-sermon-main{flex:1}}@media (max-width: 800px){.wpfc-sermon-image-img{padding-top:56.25%}}.wpfc-sermon-single-header{text-align:center}.wpfc-sermon-single-meta{margin:8px -8px 0 -8px}.wpfc-sermon-single-meta-item{display:inline-block;margin:0 8px;font-size:14px;opacity:.87}.wpfc-sermon-single-meta-date{margin-bottom:8px}.wpfc-sermon-single-title{margin:0;padding:0}.wpfc-sermon-single .wp-video{margin:auto}.wpfc-sermon-single .mejs-video{margin:0}.wpfc-sermon-single mediaelementwrapper>iframe{width:100%;margin-bottom:0;height:100%}.wpfc-sermon-single-media{text-align:center}.wpfc-sermon-single-media>div{margin:24px 0}.wpfc-sermon-single-audio{display:flex;justify-content:center}.wpfc-sermon-single-audio-download{display:flex;align-items:center;flex:none;background:white;padding:0 1.25rem;box-shadow:none;text-decoration:none;outline:none}.player-none .wpfc-sermon-single-audio-download svg{fill:#5d5d5d}.player-wordpress .wpfc-sermon-single-audio-download{background:#222}.player-wordpress .wpfc-sermon-single-audio-download svg{fill:#fff}@media screen and (min-width: 77.5em){.player-wordpress .wpfc-sermon-single-audio-download{font-size:1.9rem;margin-bottom:1.6842em}}.player-mediaelement .wpfc-sermon-single-audio-download{background:#222}.player-mediaelement .wpfc-sermon-single-audio-download:hover{background-color:rgba(51,51,51,0.7)}.player-mediaelement .wpfc-sermon-single-audio-download svg{fill:#fff}.player-plyr .wpfc-sermon-single-audio-download{border:1px solid #dbe3e8;border-left:none;transition:background .3s}.player-plyr .wpfc-sermon-single-audio-download:hover{background:#dbe3e8}.player-plyr .wpfc-sermon-single-audio-download:hover svg{fill:#fff}.wpfc-sermon-single .player-plyr .plyr{flex:1}.wpfc-sermon-single-description{margin-top:24px}.wpfc-sermon-single-description p:first-child{margin-top:0}.wpfc-sermon-single-description p:last-child{margin-bottom:0}.wpfc-sermon-single-attachments{background:#efefef;border:1px solid #ddd;padding:24px;margin-top:24px}.wpfc-sermon-single-attachments #wpfc-attachments strong,.wpfc-sermon-single-attachments #wpfc-attachments a{display:block}.wpfc-sermon-single-attachments #wpfc-attachments p{margin:0}.wpfc-sermon-single-attachments #wpfc-attachments .dashicons{line-height:28px}.wpfc-sermon-single-topics{margin-top:24px}.wpfc-sermon-single-navigation{border-top:1px solid #ddd;margin-top:2rem;padding-top:1rem;display:grid;grid-template-columns:50% 50%}.wpfc-sermon-single-navigation .next-sermon{text-align:right}ul#wpfc_images_grid{display:grid;grid-template-columns:50% 50%;grid-gap:1rem;padding:0}ul#wpfc_images_grid .wpfc_grid_image{display:block}ul#wpfc_images_grid .wpfc_grid_image img{margin-bottom:15px}ul#wpfc_images_grid .wpfc_grid_title{margin:0}.wpfc-sermon-player{vertical-align:middle}.wpfc-sermon-player+.wpfc-sermon-single-audio-download{display:none} +.wpfc-sermon-container #wpfc_sermon_sorting{padding:0;margin:0 0 48px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div{margin:0 8px 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0 0 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting form{margin:0}@media (max-width: 700px){.wpfc-sermon-container #wpfc_sermon_sorting>div{width:100%;margin:0 0 12px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0}.wpfc-sermon-container #wpfc_sermon_sorting select{display:block;width:100%;max-width:100%}}.wpfc-sermon-shortcode{margin-bottom:2rem}.wpfc-sermon-image{height:auto;position:relative}.wpfc-sermon-image-img{width:100%;background-size:cover;background-position:center}.wpfc-sermon-header{display:grid;grid-template-columns:70% 30%;align-items:center}.wpfc-sermon-header-aside{text-align:center}.wpfc-sermon-title{margin:0;padding:0}.wpfc-sermon-meta-item{font-size:14px;opacity:.87}.wpfc-sermon-meta-series{margin:0 0 8px 0}.wpfc-sermon-meta-date{margin:8px 0 0}.wpfc-sermon-description{font-size:14px;margin:8px 0 0}.wpfc-sermon-description p{margin:0 0 12px 0}.wpfc-sermon-description p:last-child{margin:0}.wpfc-sermon-audio{margin-top:24px}.wpfc-sermon-footer{margin-top:24px;padding-top:24px;border-top:1px solid #ddd}.wpfc-sermon-footer .wpfc-sermon-meta-item{display:inline-block;position:relative}.wpfc-sermon-footer .wpfc-sermon-meta-item:not(:last-child):after{content:'|';padding:0 4px;color:#ddd}.wpfc-sermon-meta-preacher img{border-radius:50%;width:35px;height:35px;vertical-align:middle;display:inline-block}.wpfc-sermon-meta-preacher>a{text-decoration:none;box-shadow:none;border:0;display:inline-block}.wpfc-sermon-meta-prefix,.wpfc-sermon-meta-text{vertical-align:middle}.wpfc-sermon>.wpfc-sermon-inner{background:white;border:1px solid #ddd}.wpfc-sermon-main{padding:24px}.wpfc-sermon-att-audio,.wpfc-sermon-att-notes,.wpfc-sermon-bulletin{width:auto;height:auto;padding:4px;border:1px solid #efefef;margin-bottom:4px}@media (min-width: 801px){.wpfc-sermon-inner{display:flex;flex-flow:row wrap}.wpfc-sermon-image{flex:0 30%}.wpfc-sermon-image-img{height:100%}.wpfc-sermon-main{flex:1}}@media (max-width: 800px){.wpfc-sermon-image-img{padding-top:56.25%}}.wpfc-sermon-single-header{text-align:center}.wpfc-sermon-single-meta{margin:8px -8px 0 -8px}.wpfc-sermon-single-meta-item{display:inline-block;margin:0 8px;font-size:14px;opacity:.87}.wpfc-sermon-single-meta-date{margin-bottom:8px}.wpfc-sermon-single-title{margin:0;padding:0}.wpfc-sermon-single .wp-video{margin:auto}.wpfc-sermon-single .mejs-video{margin:0}.wpfc-sermon-single mediaelementwrapper>iframe{width:100%;margin-bottom:0;height:100%}.wpfc-sermon-single-media{text-align:center}.wpfc-sermon-single-media>div{margin:24px 0}.wpfc-sermon-single-audio{display:flex;justify-content:center}.wpfc-sermon-single-audio-download{display:flex;align-items:center;flex:none;background:white;padding:0 1.25rem;box-shadow:none;text-decoration:none;outline:none}.player-none .wpfc-sermon-single-audio-download svg{fill:#5d5d5d}.player-wordpress .wpfc-sermon-single-audio-download{background:#222;margin-bottom:1.75em}.player-wordpress .wpfc-sermon-single-audio-download svg{fill:#fff}.player-mediaelement .wpfc-sermon-single-audio-download{background:#222}.player-mediaelement .wpfc-sermon-single-audio-download:hover{background-color:rgba(51,51,51,0.7)}.player-mediaelement .wpfc-sermon-single-audio-download svg{fill:#fff}.player-plyr .wpfc-sermon-single-audio-download{border:1px solid #dbe3e8;border-left:none;transition:background .3s}.player-plyr .wpfc-sermon-single-audio-download:hover{background:#dbe3e8}.player-plyr .wpfc-sermon-single-audio-download:hover svg{fill:#fff}.wpfc-sermon-single .player-plyr .plyr{flex:1}.wpfc-sermon-single-description{margin-top:24px}.wpfc-sermon-single-description p:first-child{margin-top:0}.wpfc-sermon-single-description p:last-child{margin-bottom:0}.wpfc-sermon-single-attachments{background:#efefef;border:1px solid #ddd;padding:24px;margin-top:24px}.wpfc-sermon-single-attachments #wpfc-attachments strong,.wpfc-sermon-single-attachments #wpfc-attachments a{display:block}.wpfc-sermon-single-attachments #wpfc-attachments p{margin:0}.wpfc-sermon-single-attachments #wpfc-attachments .dashicons{line-height:28px}.wpfc-sermon-single-topics{margin-top:24px}.wpfc-sermon-single-navigation{border-top:1px solid #ddd;margin-top:2rem;padding-top:1rem;display:grid;grid-template-columns:50% 50%}.wpfc-sermon-single-navigation .next-sermon{text-align:right}ul#wpfc_images_grid{display:grid;grid-template-columns:50% 50%;grid-gap:1rem;padding:0}ul#wpfc_images_grid .wpfc_grid_image{display:block}ul#wpfc_images_grid .wpfc_grid_image img{margin-bottom:15px}ul#wpfc_images_grid .wpfc_grid_title{margin:0}.wpfc-sermon-player{vertical-align:middle} /*# sourceMappingURL=sermon.min.css.map */ diff --git a/assets/css/sermon.min.css.map b/assets/css/sermon.min.css.map index b0c8db7..076e4e3 100644 --- a/assets/css/sermon.min.css.map +++ b/assets/css/sermon.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AACE,2CAAqB,CACnB,OAAO,CAAE,CAAC,CACV,MAAM,CAAE,UAAU,CAElB,+CAAM,CACJ,MAAM,CAAE,WAAW,CAGrB,0DAAiB,CACf,MAAM,CAAE,SAAS,CAGnB,gDAAK,CACH,MAAM,CAAE,CAAC,CAKf,yBAA0B,CAEtB,+CAAM,CACJ,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,UAAU,CAGpB,0DAAiB,CACf,MAAM,CAAE,CAAC,CAGX,kDAAO,CACL,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CACX,SAAS,CAAE,IAAI,EC/BnB,sBAAY,CACV,aAAa,CAAE,IAAI,CAGrB,kBAAQ,CACN,MAAM,CAAE,IAAI,CACZ,QAAQ,CAAE,QAAQ,CAGpB,sBAAY,CACV,KAAK,CAAE,IAAI,CACX,eAAe,CAAE,KAAK,CACtB,mBAAmB,CAAE,MAAM,CAG7B,mBAAS,CACP,OAAO,CAAE,IAAI,CACb,qBAAqB,CAAE,OAAO,CAC9B,WAAW,CAAE,MAAM,CAGrB,yBAAe,CACb,UAAU,CAAE,MAAM,CAGpB,kBAAQ,CACN,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CAGZ,sBAAY,CACV,SAAS,CAAE,IAAI,CACf,OAAO,CAAE,GAAG,CAGd,wBAAc,CACZ,MAAM,CAAE,SAAS,CAGnB,sBAAY,CACV,MAAM,CAAE,OAAO,CAGjB,wBAAc,CACZ,SAAS,CAAE,IAAI,CACf,MAAM,CAAE,OAAO,CAEf,0BAAE,CACA,MAAM,CAAE,UAAU,CAElB,qCAAa,CACX,MAAM,CAAE,CAAC,CAKf,kBAAQ,CACN,UAAU,CAAE,IAAI,CAGlB,mBAAS,CACP,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,cAAc,CAE1B,0CAAuB,CACrB,OAAO,CAAE,YAAY,CACrB,QAAQ,CAAE,QAAQ,CAElB,iEAAyB,CACvB,OAAO,CAAE,GAAG,CACZ,OAAO,CAAE,KAAK,CACd,KAAK,CAAE,IAAI,CAMf,8BAAI,CACF,aAAa,CAAE,GAAG,CAClB,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,cAAc,CAAE,MAAM,CACtB,OAAO,CAAE,YAAY,CAGvB,4BAAI,CACF,eAAe,CAAE,IAAI,CACrB,UAAU,CAAE,IAAI,CAChB,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,YAAY,CAIzB,+CACY,CACV,cAAc,CAAE,MAAM,CAGxB,+BAAqB,CACnB,UAAU,CAAE,KAAK,CACjB,MAAM,CAAE,cAAc,CAGxB,iBAAO,CACL,OAAO,CAAE,IAAI,CAGf,mEAEW,CACT,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,OAAO,CAAE,GAAG,CACZ,MAAM,CAAE,iBAAiB,CACzB,aAAa,CAAE,GAAG,CAItB,yBAA0B,CAEtB,kBAAQ,CACN,OAAO,CAAE,IAAI,CACb,SAAS,CAAE,QAAQ,CAGrB,kBAAQ,CACN,IAAI,CAAE,KAAK,CAGb,sBAAY,CACV,MAAM,CAAE,IAAI,CAGd,iBAAO,CACL,IAAI,CAAE,CAAC,EAKb,yBAAyB,CACvB,sBAAuB,CACrB,WAAW,CAAE,MAAM,EC/IrB,0BAAS,CACP,UAAU,CAAE,MAAM,CAGpB,wBAAO,CACL,MAAM,CAAE,eAAe,CAGzB,6BAAY,CACV,OAAO,CAAE,YAAY,CACrB,MAAM,CAAE,KAAK,CACb,SAAS,CAAE,IAAI,CACf,OAAO,CAAE,GAAG,CAGd,6BAAY,CACV,aAAa,CAAE,GAAG,CAGpB,yBAAQ,CACN,MAAM,CAAE,CAAC,CACT,OAAO,CAAE,CAAC,CAGZ,6BAAU,CACR,MAAM,CAAE,IAAI,CAId,+BAAY,CACV,MAAM,CAAE,CAAC,CAIX,8CAA6B,CAC3B,KAAK,CAAE,IAAI,CACX,aAAa,CAAE,CAAC,CAChB,MAAM,CAAE,IAAI,CAGd,yBAAQ,CACN,UAAU,CAAE,MAAM,CAElB,6BAAM,CACJ,MAAM,CAAE,MAAM,CAIlB,yBAAQ,CACN,OAAO,CAAE,IAAI,CACb,eAAe,CAAE,MAAM,CAGzB,kCAAiB,CACf,OAAO,CAAE,IAAI,CACb,WAAW,CAAE,MAAM,CACnB,IAAI,CAAE,IAAI,CACV,UAAU,CAAE,KAAK,CACjB,OAAO,CAAE,SAAS,CAClB,UAAU,CAAE,IAAI,CAChB,eAAe,CAAE,IAAI,CACrB,OAAO,CAAE,IAAI,CAGX,mDAAI,CACF,IAAI,CAAE,OAAe,CAIzB,oDAAoB,CAClB,UAAU,CAAE,IAAI,CAEhB,wDAAI,CACF,IAAI,CAAE,IAAkB,CAG1B,qCAAsC,CAPxC,oDAAoB,CAQhB,SAAS,CAAE,MAAM,CACjB,aAAa,CAAE,QAAQ,EAK3B,uDAAuB,CACrB,UAAU,CAAE,IAAI,CAEhB,6DAAQ,CACN,gBAAgB,CAAE,kBAAqB,CAGzC,2DAAI,CACF,IAAI,CAAE,IAAkB,CAI5B,+CAAe,CACb,MAAM,CAAE,iBAAiB,CACzB,WAAW,CAAE,IAAI,CACjB,UAAU,CAAE,cAAc,CAE1B,qDAAQ,CACN,UAAU,CAAE,OAAO,CAEnB,yDAAI,CACF,IAAI,CAAE,IAAkB,CAMhC,sCAAmB,CACjB,IAAI,CAAE,CAAC,CAGT,+BAAc,CACZ,UAAU,CAAE,IAAI,CAEhB,6CAAc,CACZ,UAAU,CAAE,CAAC,CAGf,4CAAa,CACX,aAAa,CAAE,CAAC,CAIpB,+BAAc,CACZ,UAAU,CAAE,OAAO,CACnB,MAAM,CAAE,cAAc,CACtB,OAAO,CAAE,IAAI,CACb,UAAU,CAAE,IAAI,CAGd,4GAAU,CACR,OAAO,CAAE,KAAK,CAGhB,mDAAE,CACA,MAAM,CAAE,CAAC,CAGX,4DAAW,CACT,WAAW,CAAE,IAAI,CAKvB,0BAAS,CACP,UAAU,CAAE,IAAI,CAGlB,8BAAa,CACX,UAAU,CAAE,cAAc,CAC1B,UAAU,CAAE,IAAI,CAChB,WAAW,CAAE,IAAI,CACjB,OAAO,CAAE,IAAI,CACb,qBAAqB,CAAE,OAAO,CAE9B,2CAAa,CACX,UAAU,CAAE,KAAK,CChKvB,mBAAoB,CAClB,OAAO,CAAE,IAAI,CACb,qBAAqB,CAAE,OAAO,CAC9B,QAAQ,CAAE,IAAI,CACd,OAAO,CAAE,CAAC,CAEV,oCAAiB,CACf,OAAO,CAAE,KAAK,CAEd,wCAAI,CACF,aAAa,CAAE,IAAI,CAIvB,oCAAiB,CACf,MAAM,CAAE,CAAC,CCHb,mBAAoB,CAClB,cAAc,CAAE,MAAM,CAEtB,sDAAqC,CACnC,OAAO,CAAE,IAAI", +"mappings": "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", "sources": ["partials/_sorting.scss","partials/_archive.scss","partials/_single.scss","partials/_shortcodes.scss","sermon.scss"], "names": [], "file": "sermon.min.css" diff --git a/assets/css/sermon.scss b/assets/css/sermon.scss index d024d1b..0794499 100644 --- a/assets/css/sermon.scss +++ b/assets/css/sermon.scss @@ -12,8 +12,4 @@ */ .wpfc-sermon-player { vertical-align: middle; - - + .wpfc-sermon-single-audio-download { - display: none; - } } diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index d3780a7..a4538a1 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -485,7 +485,7 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) { -
+
Date: Sun, 15 Apr 2018 23:44:49 +0200 Subject: [PATCH 050/119] Fix menu word case for preacher --- includes/class-sm-post-types.php | 6 +++--- readme.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index d03932d..ba1ca5d 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -49,9 +49,9 @@ public static function register_taxonomies() { 'hierarchical' => false, 'label' => ucwords( $preacher_label ), 'labels' => array( - 'name' => $preacher_label_plural, - 'singular_name' => $preacher_label, - 'menu_name' => $preacher_label_plural, + 'name' => ucwords( $preacher_label_plural ), + 'singular_name' => ucwords( $preacher_label ), + 'menu_name' => ucwords( $preacher_label_plural ), /* translators: Preachers */ 'search_items' => wp_sprintf( __( 'Search %s', 'sermon-manager-for-wordpress' ), $preacher_label_plural ), /* translators: Preachers */ diff --git a/readme.txt b/readme.txt index cd4df1d..70fb716 100755 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### +* Fix: Custom preacher label in menu lowercased when label is in lowercase * Fix: Audio download button glitches sometimes * Fix: Image size shortcode argument not working * Fix: SB image import breaking when image is local and does not exist on filesystem From f2992a70f9326b4115b7fd8bf3504836664e81fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 16 Apr 2018 00:02:43 +0200 Subject: [PATCH 051/119] Fix sermons menu item title label --- includes/admin/class-sm-admin-menus.php | 21 +++++++++++++++++++++ includes/class-sm-post-types.php | 2 +- readme.txt | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/includes/admin/class-sm-admin-menus.php b/includes/admin/class-sm-admin-menus.php index 2353e86..3b3662e 100644 --- a/includes/admin/class-sm-admin-menus.php +++ b/includes/admin/class-sm-admin-menus.php @@ -21,6 +21,9 @@ public function __construct() { add_action( 'admin_menu', array( $this, 'import_export_menu' ), 70 ); add_action( 'admin_enqueue_scripts', array( $this, 'fix_icon' ) ); + + // Fix first submenu menu name (Sermons => All Sermons). + add_action( 'admin_menu', array( $this, 'fix_sermons_title' ), 100 ); } /** @@ -64,6 +67,24 @@ public function import_export_page() { public function fix_icon() { wp_enqueue_style( 'sm-icon', SM_URL . 'assets/css/admin-icon.css', array(), SM_VERSION ); } + + /** + * Changes child menu item name to All Sermons. + */ + public function fix_sermons_title() { + global $submenu; + + if ( ! isset( $submenu['edit.php?post_type=wpfc_sermon'] ) ) { + return; + } + + foreach ( $submenu['edit.php?post_type=wpfc_sermon'] as &$sermon_item ) { + if ( 'edit.php?post_type=wpfc_sermon' === $sermon_item[2] ) { + $sermon_item[0] = __( 'All Sermons', 'sermon-manager-for-wordpress' ); + return; + } + } + } } return new SM_Admin_Menus(); diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index ba1ca5d..7fdb718 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -214,7 +214,7 @@ public static function register_post_types() { 'labels' => array( 'name' => __( 'Sermons', 'sermon-manager-for-wordpress' ), 'singular_name' => __( 'Sermon', 'sermon-manager-for-wordpress' ), - 'all_items' => __( 'All Sermons', 'sermon-manager-for-wordpress' ), + 'all_items' => __( 'Sermons', 'sermon-manager-for-wordpress' ), 'menu_name' => _x( 'Sermons', 'menu', 'sermon-manager-for-wordpress' ), 'add_new' => __( 'Add New', 'sermon-manager-for-wordpress' ), 'add_new_item' => __( 'Add new sermon', 'sermon-manager-for-wordpress' ), diff --git a/readme.txt b/readme.txt index 70fb716..5d26ccb 100755 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### +* Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Custom preacher label in menu lowercased when label is in lowercase * Fix: Audio download button glitches sometimes * Fix: Image size shortcode argument not working From 929e3ea0ccf6a4540282ab9b3ef796c5d3458e72 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 15 Apr 2018 19:00:05 -0400 Subject: [PATCH 052/119] Sermon Spacing Add spacing between sermons in archive page when using Divi. Otherwise, they end up all crushed up together. Fixes #182 --- assets/css/theme-specific/Divi.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 assets/css/theme-specific/Divi.css diff --git a/assets/css/theme-specific/Divi.css b/assets/css/theme-specific/Divi.css new file mode 100644 index 0000000..c1aee7d --- /dev/null +++ b/assets/css/theme-specific/Divi.css @@ -0,0 +1,3 @@ +article.wpfc_sermon{ + margin-bottom: 50px; +} From 6e7a5727c9e83503218a7eca2003ae286a7d7c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 16 Apr 2018 01:04:45 +0200 Subject: [PATCH 053/119] Modify code to comply with the coding style --- assets/css/theme-specific/Divi.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/theme-specific/Divi.css b/assets/css/theme-specific/Divi.css index c1aee7d..fec873c 100644 --- a/assets/css/theme-specific/Divi.css +++ b/assets/css/theme-specific/Divi.css @@ -1,3 +1,3 @@ -article.wpfc_sermon{ +article.wpfc_sermon { margin-bottom: 50px; } From 3ecfdd8f9d69ae533d51991877b393865d7a7a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 16 Apr 2018 01:05:15 +0200 Subject: [PATCH 054/119] Update changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index cd4df1d..7b9f2d7 100755 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### +* Fix: Fix spacing on Divi theme * Fix: Audio download button glitches sometimes * Fix: Image size shortcode argument not working * Fix: SB image import breaking when image is local and does not exist on filesystem From 34e0bc41421d83308c5cac69d51e1fac9db8c9c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 16 Apr 2018 01:15:15 +0200 Subject: [PATCH 055/119] Add a warning to iTunes HTML option description --- includes/admin/settings/class-sm-settings-podcast.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/settings/class-sm-settings-podcast.php b/includes/admin/settings/class-sm-settings-podcast.php index 6e48915..123d244 100644 --- a/includes/admin/settings/class-sm-settings-podcast.php +++ b/includes/admin/settings/class-sm-settings-podcast.php @@ -152,7 +152,7 @@ public function get_settings() { 'type' => 'checkbox', 'id' => 'enable_podcast_html_description', 'desc' => __( 'Enables showing of HTML in iTunes description field. Uncheck if description looks messy.', 'sermon-manager-for-wordpress' ), - 'desc_tip' => __( 'It is recommended to leave it unchecked.', 'sermon-manager-for-wordpress' ), + 'desc_tip' => __( 'It is recommended to leave it unchecked. Uncheck if the feed does not validate.', 'sermon-manager-for-wordpress' ), 'default' => 'no', ), array( From 7521e964e74f4bf1cf14ca212f707b699feb034d Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 15 Apr 2018 21:41:11 -0400 Subject: [PATCH 056/119] Continue Reading Add 'Continue reading' link below sermon snippet --- includes/sm-template-functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index a4538a1..fddf546 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -635,7 +635,10 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
ID, 'sermon_description', true ); ?> -
+
From bb37531fd57e555c0f9d56ef89b93c3bb1dda28c Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 15 Apr 2018 21:46:22 -0400 Subject: [PATCH 057/119] Change indentation style to tabs to match project --- includes/sm-template-functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index fddf546..5677224 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -636,9 +636,9 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
ID, 'sermon_description', true ); ?> +
+ Continue reading... +
From db9b864ea3dc2d6b403ebf30abbabb0fd43fc2ee Mon Sep 17 00:00:00 2001 From: Robert Main Date: Mon, 16 Apr 2018 21:45:08 -0400 Subject: [PATCH 058/119] GitHub Folder Move `CONTRIBUTING.md` file into .github and add a pull request and issue template in there too. These will be used to pre-populate new pull requests and issues when they are opened to help with information gathering and issue triage --- CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 .github/ISSUE_TEMPLATE.md | 22 ++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..6605c9e --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,22 @@ +### Expected Behaviour + +1. + +### Actual Behaviour + +1. + +### Steps To Reproduce + +1. + +### Platform +**Sermon Manager Version:** +**WordPress Version:** +**PHP Version:** + +### Any Additional Info + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..7c867a0 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,18 @@ +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. + + From 35db6ba46a56a40f8026e827b10cf70448d545a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Tue, 17 Apr 2018 11:49:56 +0200 Subject: [PATCH 059/119] Remove item regarding documentation update We currently don't have a way to contribute to documentation - but that's going to change real soon. We have already set up the infrastructure for it, and have a bit of data in it - so let's keep that point away for now. --- .github/PULL_REQUEST_TEMPLATE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7c867a0..177f299 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -9,7 +9,6 @@ - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. -- [ ] I have updated the documentation accordingly. - [ ] I have read the **CONTRIBUTING** document. -- [ ] My code follows the code style of this project. +- [ ] My code follows the code style of this project. (WPCS) - [ ] My change requires a change to the documentation. - [ ] I have read the **CONTRIBUTING** document. From 24549d3ba74dfac8bf0b66742014b93d294e6ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 19 Apr 2018 00:12:09 +0200 Subject: [PATCH 061/119] Add archive shortcode arguments to filter parameters --- includes/sm-template-functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index a4538a1..6ba57c7 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -693,10 +693,11 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) { * * @param string $output The HTML that will be outputted. * @param WP_Post $post The sermon. + * @param array $args Rendering arguments. Passed from shortcode. * * @since 2.12.0 */ - $output = apply_filters( 'wpfc_sermon_excerpt_v2', $output, $post ); + $output = apply_filters( 'wpfc_sermon_excerpt_v2', $output, $post, $args ); if ( ! $return ) { echo $output; From ed8c5805ce013bca419679b078d33097b23f6761 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Mon, 30 Apr 2018 17:40:55 -0400 Subject: [PATCH 062/119] - Wrap "Continue reading" link in divs for easier styling - Use internationalisation support for "Continue reading..." link --- includes/sm-template-functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 5677224..cc1b683 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -637,7 +637,9 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) { ID, 'sermon_description', true ); ?>
From 0cd547fc44fdde7d63f9db4645acd4b711374fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Tue, 1 May 2018 00:01:34 +0200 Subject: [PATCH 063/119] Update changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index b6ece45..ab1bb34 100755 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### +* New: Add read more link to the sermon description (thanks @robertmain!) * Fix: Fix spacing on Divi theme * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Custom preacher label in menu lowercased when label is in lowercase From 1103d2bcb2e7528f4f1e7ff07d5df1637d30566c Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sat, 28 Apr 2018 23:07:49 -0400 Subject: [PATCH 064/119] Re-label excerpt creation option to better describe it's purpose --- includes/admin/settings/class-sm-settings-debug.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/settings/class-sm-settings-debug.php b/includes/admin/settings/class-sm-settings-debug.php index 6d44a1c..cb16b0c 100644 --- a/includes/admin/settings/class-sm-settings-debug.php +++ b/includes/admin/settings/class-sm-settings-debug.php @@ -72,7 +72,7 @@ public function get_settings() { 'default' => 1, ), array( - 'title' => '"post_excerpt" creation', + 'title' => 'Automatic "post_excerpt" creation', 'type' => 'select', 'options' => array( 1 => 'Enable', From 2ef6cc3094adc4c3a93ee734876e9e6af83774d2 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 29 Apr 2018 18:04:08 -0400 Subject: [PATCH 065/119] Plugin Domain Move the plugin domain text out of a string literal and into it's own class constant on the main plugin file. This should help to eliminate errors arising from typos etc. as well as making the easier to understand. --- includes/class-sm-post-types.php | 48 +++++++++++++++++--------------- sermons.php | 7 ++++- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index 7fdb718..430c65e 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -7,6 +7,8 @@ defined( 'ABSPATH' ) or die; +require_once SM_PATH . 'sermons.php'; + /** * Class made to replace old functions for registering post types and taxonomies. * @@ -212,29 +214,29 @@ public static function register_post_types() { register_post_type( 'wpfc_sermon', apply_filters( 'sm_register_post_type_wpfc_sermon', array( 'labels' => array( - 'name' => __( 'Sermons', 'sermon-manager-for-wordpress' ), - 'singular_name' => __( 'Sermon', 'sermon-manager-for-wordpress' ), - 'all_items' => __( 'Sermons', 'sermon-manager-for-wordpress' ), - 'menu_name' => _x( 'Sermons', 'menu', 'sermon-manager-for-wordpress' ), - 'add_new' => __( 'Add New', 'sermon-manager-for-wordpress' ), - 'add_new_item' => __( 'Add new sermon', 'sermon-manager-for-wordpress' ), - 'edit' => __( 'Edit', 'sermon-manager-for-wordpress' ), - 'edit_item' => __( 'Edit sermon', 'sermon-manager-for-wordpress' ), - 'new_item' => __( 'New sermon', 'sermon-manager-for-wordpress' ), - 'view' => __( 'View sermon', 'sermon-manager-for-wordpress' ), - 'view_item' => __( 'View sermon', 'sermon-manager-for-wordpress' ), - 'search_items' => __( 'Search sermon', 'sermon-manager-for-wordpress' ), - 'not_found' => __( 'No sermons found', 'sermon-manager-for-wordpress' ), - 'not_found_in_trash' => __( 'No sermons found in trash', 'sermon-manager-for-wordpress' ), - 'featured_image' => __( 'Sermon image', 'sermon-manager-for-wordpress' ), - 'set_featured_image' => __( 'Set sermon image', 'sermon-manager-for-wordpress' ), - 'remove_featured_image' => __( 'Remove sermon image', 'sermon-manager-for-wordpress' ), - 'use_featured_image' => __( 'Use as sermon image', 'sermon-manager-for-wordpress' ), - 'insert_into_item' => __( 'Insert to sermon', 'sermon-manager-for-wordpress' ), - 'uploaded_to_this_item' => __( 'Uploaded to this sermon', 'sermon-manager-for-wordpress' ), - 'filter_items_list' => __( 'Filter sermon', 'sermon-manager-for-wordpress' ), - 'items_list_navigation' => __( 'Sermon navigation', 'sermon-manager-for-wordpress' ), - 'items_list' => __( 'Sermon list', 'sermon-manager-for-wordpress' ), + 'name' => __( 'Sermons', SermonManager::PLUGIN_DOMAIN ), + 'singular_name' => __( 'Sermon', SermonManager::PLUGIN_DOMAIN ), + 'all_items' => __( 'Sermons', SermonManager::PLUGIN_DOMAIN ), + 'menu_name' => _x( 'Sermons', 'menu', SermonManager::PLUGIN_DOMAIN ), + 'add_new' => __( 'Add New', SermonManager::PLUGIN_DOMAIN ), + 'add_new_item' => __( 'Add new sermon', SermonManager::PLUGIN_DOMAIN ), + 'edit' => __( 'Edit', SermonManager::PLUGIN_DOMAIN ), + 'edit_item' => __( 'Edit sermon', SermonManager::PLUGIN_DOMAIN ), + 'new_item' => __( 'New sermon', SermonManager::PLUGIN_DOMAIN ), + 'view' => __( 'View sermon', SermonManager::PLUGIN_DOMAIN ), + 'view_item' => __( 'View sermon', SermonManager::PLUGIN_DOMAIN ), + 'search_items' => __( 'Search sermon', SermonManager::PLUGIN_DOMAIN ), + 'not_found' => __( 'No sermons found', SermonManager::PLUGIN_DOMAIN ), + 'not_found_in_trash' => __( 'No sermons found in trash', SermonManager::PLUGIN_DOMAIN ), + 'featured_image' => __( 'Sermon image', SermonManager::PLUGIN_DOMAIN ), + 'set_featured_image' => __( 'Set sermon image', SermonManager::PLUGIN_DOMAIN ), + 'remove_featured_image' => __( 'Remove sermon image', SermonManager::PLUGIN_DOMAIN ), + 'use_featured_image' => __( 'Use as sermon image', SermonManager::PLUGIN_DOMAIN ), + 'insert_into_item' => __( 'Insert to sermon', SermonManager::PLUGIN_DOMAIN ), + 'uploaded_to_this_item' => __( 'Uploaded to this sermon', SermonManager::PLUGIN_DOMAIN ), + 'filter_items_list' => __( 'Filter sermon', SermonManager::PLUGIN_DOMAIN ), + 'items_list_navigation' => __( 'Sermon navigation', SermonManager::PLUGIN_DOMAIN ), + 'items_list' => __( 'Sermon list', SermonManager::PLUGIN_DOMAIN ), ), 'public' => true, 'show_ui' => true, diff --git a/sermons.php b/sermons.php index c9878a2..ab7c126 100755 --- a/sermons.php +++ b/sermons.php @@ -60,13 +60,18 @@ class SermonManager { */ private static $instance = null; + /** + * @var string The domain(sic) name to use when scoping variables and keywords (since WP hasn't heard of namespacing) + */ + const PLUGIN_DOMAIN = 'sermon-manager-for-wordpress'; + /** * Construct. */ public function __construct() { // Define constants (PATH and URL are with a trailing slash). define( 'SM_PLUGIN_FILE', __FILE__ ); - define( 'SM_PATH', dirname( SM_PLUGIN_FILE ) . '/' ); + define( 'SM_PATH', dirname( SM_PLUGIN_FILE ) . DIRECTORY_SEPARATOR ); define( 'SM_BASENAME', plugin_basename( __FILE__ ) ); define( 'SM_URL', plugin_dir_url( __FILE__ ) ); define( 'SM_VERSION', preg_match( '/^.*Version: (.*)$/m', file_get_contents( __FILE__ ), $version ) ? trim( $version[1] ) : 'N/A' ); From b9f5b9a0d12c3b75bf32f2f4bc2fb6737f1a20e1 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 29 Apr 2018 18:13:11 -0400 Subject: [PATCH 066/119] Post Excerpt Editing Enable post excerpt editing, but only if "Automatic Excerpt Creation" has been disabled. The excerpt is saved in the `wp_posts` table as a pre-requisite for #183 and as discussed in order to complete part of #184 --- includes/class-sm-post-types.php | 1 + sermons.php | 39 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index 430c65e..d82eb85 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -263,6 +263,7 @@ public static function register_post_types() { 'comments', 'entry-views', 'elementor', + ( !\SermonManager::getOption('post_excerpt_enabled', 1 ) ? 'excerpt' : null) ), ) ) ); diff --git a/sermons.php b/sermons.php index ab7c126..5e6e83f 100755 --- a/sermons.php +++ b/sermons.php @@ -442,31 +442,32 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch $content = apply_filters( 'sm_sermon_post_content', $content, $post_ID, $post, $skip_check ); $content = apply_filters( "sm_sermon_post_content_$post_ID", $content, $post_ID, $post, $skip_check ); - $excerpt = ! $content ? '' : wp_trim_excerpt( $content ); - - /** - * Allows to modify sermon content that will be saved as "post_excerpt". - * - * @param string $excerpt Textual content (no HTML), limited to 55 words by default. - * @param int $post_ID ID of the sermon. - * @param WP_Post $post Sermon post object. - * @param bool $skip_check Basically, a way to identify if the function is being executed from the update function or not. - * - * @since 2.11.0 - */ - $excerpt = apply_filters( 'sm_sermon_post_excerpt', $excerpt, $post_ID, $post, $skip_check ); - $excerpt = apply_filters( "sm_sermon_post_excerpt_$post_ID", $excerpt, $post_ID, $post, $skip_check ); - if ( ! $skip_content_check ) { if ( ! \SermonManager::getOption( 'post_content_enabled', 1 ) ) { $content = ''; } } - if ( ! $skip_excerpt_check ) { - if ( ! \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ) { - $excerpt = ''; - } + if ( \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ) { + //Only generate our post excerpt if excerpt generation is turned on + + $excerpt = ! $content ? '' : wp_trim_excerpt( $content ); + + /** + * Allows to modify sermon content that will be saved as "post_excerpt". + * + * @param string $excerpt Textual content (no HTML), limited to 55 words by default. + * @param int $post_ID ID of the sermon. + * @param WP_Post $post Sermon post object. + * @param bool $skip_check Basically, a way to identify if the function is being executed from the update function or not. + * + * @since 2.11.0 + */ + $excerpt = apply_filters( 'sm_sermon_post_excerpt', $excerpt, $post_ID, $post, $skip_check ); + $excerpt = apply_filters( "sm_sermon_post_excerpt_$post_ID", $excerpt, $post_ID, $post, $skip_check ); + } else { + //Otherwise, go with whatever the user typed in... + $excerpt = $post->post_excerpt; } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = %s, `post_excerpt` = %s WHERE `ID` = %s", array( From 439c8c539dfcb7bd7c6f46cbc26c73a08daab00b Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 29 Apr 2018 18:16:47 -0400 Subject: [PATCH 067/119] Excerpt Display Check to see if we have anything in the post excerpt. If not, then just display a truncated version of the sermon description (previous behaviour). This fixes #183 --- includes/sm-template-functions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 22fd85f..1cd3e02 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -634,13 +634,20 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
- ID, 'sermon_description', true ); ?>
-
+
+ 0 ) : ?> + + + ID, 'sermon_description', true ), 30 ); ?> + +
+
+
From ade9db1b30a7b42b07459b3a6ee673306ca40f25 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Mon, 30 Apr 2018 17:49:27 -0400 Subject: [PATCH 068/119] Revert "Plugin Domain" This reverts commit 7c18a14d361ece39507d77de5fed9fa90878d424. After discussion with @nikola3244 it seems that the hard-coded strings are required in order to support GlotPress --- includes/class-sm-post-types.php | 48 +++++++++++++++----------------- sermons.php | 7 +---- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index d82eb85..c425bf4 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -7,8 +7,6 @@ defined( 'ABSPATH' ) or die; -require_once SM_PATH . 'sermons.php'; - /** * Class made to replace old functions for registering post types and taxonomies. * @@ -214,29 +212,29 @@ public static function register_post_types() { register_post_type( 'wpfc_sermon', apply_filters( 'sm_register_post_type_wpfc_sermon', array( 'labels' => array( - 'name' => __( 'Sermons', SermonManager::PLUGIN_DOMAIN ), - 'singular_name' => __( 'Sermon', SermonManager::PLUGIN_DOMAIN ), - 'all_items' => __( 'Sermons', SermonManager::PLUGIN_DOMAIN ), - 'menu_name' => _x( 'Sermons', 'menu', SermonManager::PLUGIN_DOMAIN ), - 'add_new' => __( 'Add New', SermonManager::PLUGIN_DOMAIN ), - 'add_new_item' => __( 'Add new sermon', SermonManager::PLUGIN_DOMAIN ), - 'edit' => __( 'Edit', SermonManager::PLUGIN_DOMAIN ), - 'edit_item' => __( 'Edit sermon', SermonManager::PLUGIN_DOMAIN ), - 'new_item' => __( 'New sermon', SermonManager::PLUGIN_DOMAIN ), - 'view' => __( 'View sermon', SermonManager::PLUGIN_DOMAIN ), - 'view_item' => __( 'View sermon', SermonManager::PLUGIN_DOMAIN ), - 'search_items' => __( 'Search sermon', SermonManager::PLUGIN_DOMAIN ), - 'not_found' => __( 'No sermons found', SermonManager::PLUGIN_DOMAIN ), - 'not_found_in_trash' => __( 'No sermons found in trash', SermonManager::PLUGIN_DOMAIN ), - 'featured_image' => __( 'Sermon image', SermonManager::PLUGIN_DOMAIN ), - 'set_featured_image' => __( 'Set sermon image', SermonManager::PLUGIN_DOMAIN ), - 'remove_featured_image' => __( 'Remove sermon image', SermonManager::PLUGIN_DOMAIN ), - 'use_featured_image' => __( 'Use as sermon image', SermonManager::PLUGIN_DOMAIN ), - 'insert_into_item' => __( 'Insert to sermon', SermonManager::PLUGIN_DOMAIN ), - 'uploaded_to_this_item' => __( 'Uploaded to this sermon', SermonManager::PLUGIN_DOMAIN ), - 'filter_items_list' => __( 'Filter sermon', SermonManager::PLUGIN_DOMAIN ), - 'items_list_navigation' => __( 'Sermon navigation', SermonManager::PLUGIN_DOMAIN ), - 'items_list' => __( 'Sermon list', SermonManager::PLUGIN_DOMAIN ), + 'name' => __( 'Sermons', 'sermon-manager-for-wordpress' ), + 'singular_name' => __( 'Sermon', 'sermon-manager-for-wordpress' ), + 'all_items' => __( 'Sermons', 'sermon-manager-for-wordpress' ), + 'menu_name' => _x( 'Sermons', 'menu', 'sermon-manager-for-wordpress' ), + 'add_new' => __( 'Add New', 'sermon-manager-for-wordpress' ), + 'add_new_item' => __( 'Add new sermon', 'sermon-manager-for-wordpress' ), + 'edit' => __( 'Edit', 'sermon-manager-for-wordpress' ), + 'edit_item' => __( 'Edit sermon', 'sermon-manager-for-wordpress' ), + 'new_item' => __( 'New sermon', 'sermon-manager-for-wordpress' ), + 'view' => __( 'View sermon', 'sermon-manager-for-wordpress' ), + 'view_item' => __( 'View sermon', 'sermon-manager-for-wordpress' ), + 'search_items' => __( 'Search sermon', 'sermon-manager-for-wordpress' ), + 'not_found' => __( 'No sermons found', 'sermon-manager-for-wordpress' ), + 'not_found_in_trash' => __( 'No sermons found in trash', 'sermon-manager-for-wordpress' ), + 'featured_image' => __( 'Sermon image', 'sermon-manager-for-wordpress' ), + 'set_featured_image' => __( 'Set sermon image', 'sermon-manager-for-wordpress' ), + 'remove_featured_image' => __( 'Remove sermon image', 'sermon-manager-for-wordpress' ), + 'use_featured_image' => __( 'Use as sermon image', 'sermon-manager-for-wordpress' ), + 'insert_into_item' => __( 'Insert to sermon', 'sermon-manager-for-wordpress' ), + 'uploaded_to_this_item' => __( 'Uploaded to this sermon', 'sermon-manager-for-wordpress' ), + 'filter_items_list' => __( 'Filter sermon', 'sermon-manager-for-wordpress' ), + 'items_list_navigation' => __( 'Sermon navigation', 'sermon-manager-for-wordpress' ), + 'items_list' => __( 'Sermon list', 'sermon-manager-for-wordpress' ), ), 'public' => true, 'show_ui' => true, diff --git a/sermons.php b/sermons.php index 5e6e83f..c8e2ded 100755 --- a/sermons.php +++ b/sermons.php @@ -60,18 +60,13 @@ class SermonManager { */ private static $instance = null; - /** - * @var string The domain(sic) name to use when scoping variables and keywords (since WP hasn't heard of namespacing) - */ - const PLUGIN_DOMAIN = 'sermon-manager-for-wordpress'; - /** * Construct. */ public function __construct() { // Define constants (PATH and URL are with a trailing slash). define( 'SM_PLUGIN_FILE', __FILE__ ); - define( 'SM_PATH', dirname( SM_PLUGIN_FILE ) . DIRECTORY_SEPARATOR ); + define( 'SM_PATH', dirname( SM_PLUGIN_FILE ) . '/' ); define( 'SM_BASENAME', plugin_basename( __FILE__ ) ); define( 'SM_URL', plugin_dir_url( __FILE__ ) ); define( 'SM_VERSION', preg_match( '/^.*Version: (.*)$/m', file_get_contents( __FILE__ ), $version ) ? trim( $version[1] ) : 'N/A' ); From 32d6073631d528dccd8a99bc16d0b716df9c94a2 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Mon, 30 Apr 2018 18:47:50 -0400 Subject: [PATCH 069/119] Modify code to fit WordPress coding standards - Tab based indentation - One space before closing parenthesis - One space after ! operator - One space after forward slashes for comments --- includes/class-sm-post-types.php | 2 +- sermons.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index c425bf4..6575a4f 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -261,7 +261,7 @@ public static function register_post_types() { 'comments', 'entry-views', 'elementor', - ( !\SermonManager::getOption('post_excerpt_enabled', 1 ) ? 'excerpt' : null) + ( ! \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ? 'excerpt' : null ), ), ) ) ); diff --git a/sermons.php b/sermons.php index c8e2ded..cbb16ae 100755 --- a/sermons.php +++ b/sermons.php @@ -444,7 +444,7 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch } if ( \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ) { - //Only generate our post excerpt if excerpt generation is turned on + // Only generate our post excerpt if excerpt generation is turned on $excerpt = ! $content ? '' : wp_trim_excerpt( $content ); @@ -461,7 +461,7 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch $excerpt = apply_filters( 'sm_sermon_post_excerpt', $excerpt, $post_ID, $post, $skip_check ); $excerpt = apply_filters( "sm_sermon_post_excerpt_$post_ID", $excerpt, $post_ID, $post, $skip_check ); } else { - //Otherwise, go with whatever the user typed in... + // Otherwise, go with whatever the user typed in... $excerpt = $post->post_excerpt; } From 75e4bc6b34f0eeac6aaaf19f9da39fb3bd29a6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Tue, 1 May 2018 01:04:15 +0200 Subject: [PATCH 070/119] Update changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index ab1bb34..75497cd 100755 --- a/readme.txt +++ b/readme.txt @@ -104,6 +104,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### * New: Add read more link to the sermon description (thanks @robertmain!) +* New: Add excerpt support (thanks @robertmain!) * Fix: Fix spacing on Divi theme * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Custom preacher label in menu lowercased when label is in lowercase From b65c14516be1623619d99e1d1878973526607035 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Sun, 29 Apr 2018 19:02:41 -0400 Subject: [PATCH 071/119] Revision Support Re-enable support for revisions. This fixes #186 --- includes/class-sm-post-types.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index 6575a4f..e602605 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -262,6 +262,7 @@ public static function register_post_types() { 'entry-views', 'elementor', ( ! \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ? 'excerpt' : null ), + 'revisions' ), ) ) ); From 221d5645fa26bcbeb9c9bc8adc7ef380f5cfeb2e Mon Sep 17 00:00:00 2001 From: Robert Main Date: Mon, 30 Apr 2018 20:16:02 -0400 Subject: [PATCH 072/119] Convert intentation to tabs --- includes/class-sm-post-types.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index e602605..e99948e 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -262,7 +262,7 @@ public static function register_post_types() { 'entry-views', 'elementor', ( ! \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ? 'excerpt' : null ), - 'revisions' + 'revisions', ), ) ) ); From 789696a61cc6d64c0b789ab80183b2ca2f0c0ab5 Mon Sep 17 00:00:00 2001 From: Robert Main Date: Mon, 30 Apr 2018 22:27:38 -0400 Subject: [PATCH 073/119] Fix Archive Page The merging in of #196 caused the archive page to stop loading. This is due to the fact that I was using the wrong function to check to see if a post has an excerpt. This bug must have been introduced during a rebase. --- includes/sm-template-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 1cd3e02..775efa1 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -636,7 +636,7 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
- 0 ) : ?> + ID, 'sermon_description', true ), 30 ); ?> From 02003d8f3a513551c0a3dee75907b7476165c156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Tue, 1 May 2018 14:13:41 +0200 Subject: [PATCH 074/119] Update changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 75497cd..2386c60 100755 --- a/readme.txt +++ b/readme.txt @@ -105,6 +105,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ### 2.13.0 ### * New: Add read more link to the sermon description (thanks @robertmain!) * New: Add excerpt support (thanks @robertmain!) +* New: Add revisions support (thanks @robertmain!) * Fix: Fix spacing on Divi theme * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Custom preacher label in menu lowercased when label is in lowercase From 782a634aa11bf03fdbcb0870f7f47577d3b3cf83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 3 May 2018 14:19:48 +0200 Subject: [PATCH 075/119] Force feed audio files to use HTTP --- includes/sm-podcast-functions.php | 7 ++++++- readme.txt | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/sm-podcast-functions.php b/includes/sm-podcast-functions.php index 025ba50..2ec3fc6 100644 --- a/includes/sm-podcast-functions.php +++ b/includes/sm-podcast-functions.php @@ -193,7 +193,12 @@ function wpfc_podcast_add_item() { length="" type="audio/mpeg"/> - + diff --git a/readme.txt b/readme.txt index 2386c60..fc9dddb 100755 --- a/readme.txt +++ b/readme.txt @@ -106,6 +106,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * New: Add read more link to the sermon description (thanks @robertmain!) * New: Add excerpt support (thanks @robertmain!) * New: Add revisions support (thanks @robertmain!) +* Fix: Feed not validating when audio files use SSL * Fix: Fix spacing on Divi theme * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Custom preacher label in menu lowercased when label is in lowercase From d8a8fbdbba4c546419bf6fed67368845f13556c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 7 May 2018 22:20:11 +0200 Subject: [PATCH 076/119] Update latest PHP version in readme --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index fc9dddb..57b6bf1 100755 --- a/readme.txt +++ b/readme.txt @@ -27,7 +27,7 @@ Sermon Manager is designed to help churches easily publish sermons online. Some * Full-featured iTunes podcasting support for all sermons, plus each sermon series, preachers, sermon topics, or book of the Bible! * Import sermons from other WordPress plugins * PHP 5.3+ - you can use Sermon Manager even with older websites! -* PHP 7.1 ready - Sermon Manager is 100% compatible with latest PHP version +* PHP 7.2 ready - Sermon Manager is 100% compatible with latest PHP version * Super flexible shortcode system * Supports 3rd party plugins such as Yoast SEO, Jetpack, etc * Quick and professional *free* and paid support From 0700a132ea9e91156f21ef024140b24560657c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 7 May 2018 22:22:31 +0200 Subject: [PATCH 077/119] Readme wording --- readme.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 57b6bf1..1376548 100755 --- a/readme.txt +++ b/readme.txt @@ -77,13 +77,13 @@ Installation is simple: 1. Just use the “Add New” button in Plugin section of your WordPress blog’s Control panel. To find the plugin there, search for `Sermon Manager` 2. Activate the plugin 3. Add a sermon through the Dashboard -4. To display the sermons on the frontend of your site, just visit the `http://yourdomain.com/sermons` if you have permalinks enabled or `http://yourdomain.com/?post_type=wpfc_sermon` if not. Or you can use the shortcode `[sermons]` in any page. +4. To display the sermons on the frontend of your site, just visit the `http://yourdomain.com/sermons` if you have pretty permalinks enabled or `http://yourdomain.com/?post_type=wpfc_sermon` if not. Or you can use the shortcode `[sermons]` in any page. ## Frequently Asked Questions ## ### How do I display sermons on the frontend? ### -Visit the `http://yourdomain.com/sermons` if you have permalinks enabled or `http://yourdomain.com/?post_type=wpfc_sermon` if not. Or you can use the shortcode `[sermons]` in any page. +Visit the `http://yourdomain.com/sermons` if you have pretty permalinks enabled or `http://yourdomain.com/?post_type=wpfc_sermon` if not. Or you can use the shortcode `[sermons]` in any page or post. ### How do I create a menu link? ### From 07ab5ff88d6aeba4ba747297025e8f3b7fd16c49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Wed, 9 May 2018 12:42:14 +0200 Subject: [PATCH 078/119] Fix video player not playing --- includes/sm-template-functions.php | 2 +- readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 775efa1..3db0923 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -319,7 +319,7 @@ function wpfc_render_video( $url = '', $seek = null ) { $output .= '
'; } else { $output .= ''; } } diff --git a/readme.txt b/readme.txt index 1376548..f1bd497 100755 --- a/readme.txt +++ b/readme.txt @@ -106,6 +106,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * New: Add read more link to the sermon description (thanks @robertmain!) * New: Add excerpt support (thanks @robertmain!) * New: Add revisions support (thanks @robertmain!) +* Fix: MP4 video file being detected as YouTube and therefore not working * Fix: Feed not validating when audio files use SSL * Fix: Fix spacing on Divi theme * Fix: Sermons menu title is "All Sermons" instead of "Sermons" From c22dbcb8d8927406555cd62f3279bd073bd67fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Wed, 9 May 2018 12:43:02 +0200 Subject: [PATCH 079/119] Reorder changelog --- readme.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/readme.txt b/readme.txt index f1bd497..b6baf8d 100755 --- a/readme.txt +++ b/readme.txt @@ -103,17 +103,17 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man ## Changelog ## ### 2.13.0 ### -* New: Add read more link to the sermon description (thanks @robertmain!) * New: Add excerpt support (thanks @robertmain!) +* New: Add read more link to the sermon description (thanks @robertmain!) * New: Add revisions support (thanks @robertmain!) -* Fix: MP4 video file being detected as YouTube and therefore not working -* Fix: Feed not validating when audio files use SSL -* Fix: Fix spacing on Divi theme -* Fix: Sermons menu title is "All Sermons" instead of "Sermons" -* Fix: Custom preacher label in menu lowercased when label is in lowercase * Fix: Audio download button glitches sometimes +* Fix: Custom preacher label in menu lowercased when label is in lowercase +* Fix: Fix spacing on Divi theme +* Fix: Feed not validating when audio files use SSL * Fix: Image size shortcode argument not working +* Fix: MP4 video file being detected as YouTube and therefore not working * Fix: SB image import breaking when image is local and does not exist on filesystem +* Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Taxonomy image assignment not working * Dev: Add more hooks * Dev: Add PHPUnit configuration From 5320ee5261f655486fcd0502f27c42a72a1f3765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Wed, 9 May 2018 17:26:38 +0200 Subject: [PATCH 080/119] Increase minimum WordPress version --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index b6baf8d..4682463 100755 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: wpforchurch, nikolam Donate link: http://wpforchurch.com/ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts, itunes -Requires at least: 4.5 +Requires at least: 4.7.0 Tested up to: 4.9 Requires PHP: 5.3 Stable tag: 2.12.5 From 7de9746b10ef920dbed8c7cb1f9f7ae01661745c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Wed, 9 May 2018 17:27:22 +0200 Subject: [PATCH 081/119] Readme formatting --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 4682463..9d03b3f 100755 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: wpforchurch, nikolam Donate link: http://wpforchurch.com/ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts, itunes -Requires at least: 4.7.0 +Requires at least: 4.7.0 Tested up to: 4.9 Requires PHP: 5.3 Stable tag: 2.12.5 From fbcfc32c11edf90620d3747dda94cee64cd5a95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 12 May 2018 01:23:08 +0200 Subject: [PATCH 082/119] Create LICENSE --- LICENSE | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + 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. From f30da68432f052188df08df30ddbd4e2dca04799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 12 May 2018 01:24:15 +0200 Subject: [PATCH 083/119] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..9ea1718 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@wpforchurch.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ From 27e8303972acbf34c2439a73fd397a6887c323f6 Mon Sep 17 00:00:00 2001 From: Igor Cerjan Date: Sat, 12 May 2018 10:06:31 +0800 Subject: [PATCH 084/119] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9ea1718..71f32cf 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -2,7 +2,7 @@ ## Our Pledge -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone. ## Our Standards From c5cec33827f7d16cf003e38fb728bc67e2c9b9e7 Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Wed, 16 May 2018 09:57:50 +0000 Subject: [PATCH 085/119] add beaver themer integration --- views/partials/wrapper-end.php | 5 +++++ views/partials/wrapper-start.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/views/partials/wrapper-end.php b/views/partials/wrapper-end.php index 127b6be..81d74a5 100644 --- a/views/partials/wrapper-end.php +++ b/views/partials/wrapper-end.php @@ -59,6 +59,11 @@ get_sidebar( 'sermon' ); get_footer(); break; + case 'beaver-builder-theme'; + echo '
'; + get_sidebar(); + echo '
'; + break; default: ob_start(); get_sidebar(); diff --git a/views/partials/wrapper-start.php b/views/partials/wrapper-start.php index 09db1ae..66c1165 100644 --- a/views/partials/wrapper-start.php +++ b/views/partials/wrapper-start.php @@ -43,6 +43,9 @@ case 'wpfc-morgan': echo '
'; break; + case 'beaver-builder-theme'; + echo '
'; + break; default: echo apply_filters( 'sm_templates_wrapper_start', '
' ); break; From e4c6b54e68c340b64dd2b313eba5d24a4355c613 Mon Sep 17 00:00:00 2001 From: Adrian Ionescu <9744973+adrianweb@users.noreply.github.com> Date: Thu, 17 May 2018 14:23:04 +0000 Subject: [PATCH 086/119] add beaver builder support --- changelog.txt | 3 +++ views/partials/wrapper-end.php | 7 ++++++- views/partials/wrapper-start.php | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index fa303e8..595bc28 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +### 2.12.5 ### +* New: Added support for Beaver Builder + ### 2.11.3 ### * Fix: Sermon date not being saved when date format is changed * Fix: YouTube short URL was not being detected (thanks @macbookandrew) diff --git a/views/partials/wrapper-end.php b/views/partials/wrapper-end.php index 81d74a5..abf53b8 100644 --- a/views/partials/wrapper-end.php +++ b/views/partials/wrapper-end.php @@ -59,7 +59,12 @@ get_sidebar( 'sermon' ); get_footer(); break; - case 'beaver-builder-theme'; + case 'bb-theme'; + echo '
'; + get_sidebar(); + echo '
'; + break; + case 'bb-theme-builder'; echo '
'; get_sidebar(); echo '
'; diff --git a/views/partials/wrapper-start.php b/views/partials/wrapper-start.php index 66c1165..0519d1c 100644 --- a/views/partials/wrapper-start.php +++ b/views/partials/wrapper-start.php @@ -43,7 +43,10 @@ case 'wpfc-morgan': echo '
'; break; - case 'beaver-builder-theme'; + case 'bb-theme'; + echo '
'; + break; + case 'bb-theme-builder'; echo '
'; break; default: From 4c2d7af15cecb70e5e1bc6c3e23bc193983d4d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 21 May 2018 05:43:46 +0200 Subject: [PATCH 087/119] Register scripts first + add default args to filtering Preps for SM Pro --- includes/sm-template-functions.php | 35 +++++++++++++++--------------- sermons.php | 16 +++++++++----- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 3db0923..6761be6 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -129,22 +129,21 @@ function render_wpfc_sorting( $args = array() ) { 'wpfc_service_type' => 'hide_service_types', ); - if ( empty( $args ) ) { - $args = array( - 'series_filter' => '', - 'service_type_filter' => '', - 'series' => '', - 'preachers' => '', - 'topics' => '', - 'books' => '', - 'visibility' => 'suggest', - 'hide_topics' => '', - 'hide_series' => '', - 'hide_preachers' => '', - 'hide_books' => '', - 'hide_service_types' => SermonManager::getOption( 'service_type_filtering' ) ? '' : 'yes', - ); - } + $default = array( + 'series_filter' => '', + 'service_type_filter' => '', + 'series' => '', + 'preachers' => '', + 'topics' => '', + 'books' => '', + 'visibility' => 'suggest', + 'hide_topics' => '', + 'hide_series' => '', + 'hide_preachers' => '', + 'hide_books' => '', + 'hide_service_types' => SermonManager::getOption( 'service_type_filtering' ) ? '' : 'yes', + ); + $args = $args + $default; ob_start(); ?>
@@ -641,7 +640,7 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) { ID, 'sermon_description', true ), 30 ); ?> -
+
@@ -705,7 +704,7 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) { * * @param string $output The HTML that will be outputted. * @param WP_Post $post The sermon. - * @param array $args Rendering arguments. Passed from shortcode. + * @param array $args Rendering arguments. Passed from shortcode. * * @since 2.12.0 */ diff --git a/sermons.php b/sermons.php index cbb16ae..a263cc8 100755 --- a/sermons.php +++ b/sermons.php @@ -516,13 +516,19 @@ public static function enqueue_scripts_styles() { return; } + wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION ); + wp_register_script( 'wpfc-sm-plyr', SM_URL . 'assets/vendor/js/plyr' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), SM_VERSION, \SermonManager::getOption( 'player_js_footer' ) ); + wp_register_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION ); + wp_register_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION ); + wp_register_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), SM_VERSION ); + if ( ! ( defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) || 'wpfc_sermon' === get_post_type() || is_post_type_archive( 'wpfc_sermon' ) ) ) { return; } if ( ! \SermonManager::getOption( 'css' ) ) { - wp_enqueue_style( 'wpfc-sm-styles', SM_URL . 'assets/css/sermon.min.css', array(), SM_VERSION ); + wp_enqueue_style( 'wpfc-sm-styles' ); wp_enqueue_style( 'dashicons' ); // Load theme-specific styling, if there's any. @@ -531,8 +537,6 @@ public static function enqueue_scripts_styles() { } } - wp_register_script( 'wpfc-sm-fb-player', SM_URL . 'assets/vendor/js/facebook-video.js', array(), SM_VERSION ); - switch ( \SermonManager::getOption( 'player' ) ) { case 'mediaelement': wp_enqueue_style( 'wp-mediaelement' ); @@ -540,15 +544,15 @@ public static function enqueue_scripts_styles() { break; case 'plyr': - wp_enqueue_script( 'wpfc-sm-plyr', SM_URL . 'assets/vendor/js/plyr' . ( ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ) ? '' : '.min' ) . '.js', array(), SM_VERSION, \SermonManager::getOption( 'player_js_footer' ) ); - wp_enqueue_style( 'wpfc-sm-plyr-css', SM_URL . 'assets/vendor/css/plyr.min.css', array(), SM_VERSION ); + wp_enqueue_script( 'wpfc-sm-plyr' ); + wp_enqueue_style( 'wpfc-sm-plyr-css' ); wp_add_inline_script( 'wpfc-sm-plyr', "window.addEventListener('DOMContentLoaded',function(){var players=plyr.setup(document.querySelectorAll('.wpfc-sermon-player,.wpfc-sermon-video-player'),{\"debug\": " . ( defined( 'WP_DEBUG' ) && WP_DEBUG === true ? 'true' : 'false' ) . "});for(var p in players){if(players.hasOwnProperty(p)){players[p].on('loadedmetadata ready',function(event){if(typeof this.firstChild.dataset.plyr_seek !== 'undefined'){var instance=event.detail.plyr;instance.seek(parseInt(this.firstChild.dataset.plyr_seek));}});}}})" ); break; } if ( ! \SermonManager::getOption( 'verse_popup' ) ) { - wp_enqueue_script( 'wpfc-sm-verse-script', SM_URL . 'assets/vendor/js/verse.js', array(), SM_VERSION ); + wp_enqueue_script( 'wpfc-sm-verse-script' ); // Get options for JS. $bible_version = \SermonManager::getOption( 'verse_bible_version' ); From 70922492f675875acd74595cfeb87bf2994402dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Thu, 24 May 2018 09:45:43 +0200 Subject: [PATCH 088/119] Fix title not being in the same line Closes #206 --- assets/css/partials/_archive.scss | 5 ++++- assets/css/sermon.min.css | 2 +- assets/css/sermon.min.css.map | 2 +- includes/sm-template-functions.php | 2 +- readme.txt | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/css/partials/_archive.scss b/assets/css/partials/_archive.scss index 5e26442..bd092d9 100644 --- a/assets/css/partials/_archive.scss +++ b/assets/css/partials/_archive.scss @@ -17,8 +17,11 @@ &-header { display: grid; - grid-template-columns: 70% 30%; align-items: center; + + &.aside-exists { + grid-template-columns: 70% 30%; + } } &-header-aside { diff --git a/assets/css/sermon.min.css b/assets/css/sermon.min.css index 86963b4..6acd8bf 100644 --- a/assets/css/sermon.min.css +++ b/assets/css/sermon.min.css @@ -1,2 +1,2 @@ -.wpfc-sermon-container #wpfc_sermon_sorting{padding:0;margin:0 0 48px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div{margin:0 8px 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0 0 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting form{margin:0}@media (max-width: 700px){.wpfc-sermon-container #wpfc_sermon_sorting>div{width:100%;margin:0 0 12px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0}.wpfc-sermon-container #wpfc_sermon_sorting select{display:block;width:100%;max-width:100%}}.wpfc-sermon-shortcode{margin-bottom:2rem}.wpfc-sermon-image{height:auto;position:relative}.wpfc-sermon-image-img{width:100%;background-size:cover;background-position:center}.wpfc-sermon-header{display:grid;grid-template-columns:70% 30%;align-items:center}.wpfc-sermon-header-aside{text-align:center}.wpfc-sermon-title{margin:0;padding:0}.wpfc-sermon-meta-item{font-size:14px;opacity:.87}.wpfc-sermon-meta-series{margin:0 0 8px 0}.wpfc-sermon-meta-date{margin:8px 0 0}.wpfc-sermon-description{font-size:14px;margin:8px 0 0}.wpfc-sermon-description p{margin:0 0 12px 0}.wpfc-sermon-description p:last-child{margin:0}.wpfc-sermon-audio{margin-top:24px}.wpfc-sermon-footer{margin-top:24px;padding-top:24px;border-top:1px solid #ddd}.wpfc-sermon-footer .wpfc-sermon-meta-item{display:inline-block;position:relative}.wpfc-sermon-footer .wpfc-sermon-meta-item:not(:last-child):after{content:'|';padding:0 4px;color:#ddd}.wpfc-sermon-meta-preacher img{border-radius:50%;width:35px;height:35px;vertical-align:middle;display:inline-block}.wpfc-sermon-meta-preacher>a{text-decoration:none;box-shadow:none;border:0;display:inline-block}.wpfc-sermon-meta-prefix,.wpfc-sermon-meta-text{vertical-align:middle}.wpfc-sermon>.wpfc-sermon-inner{background:white;border:1px solid #ddd}.wpfc-sermon-main{padding:24px}.wpfc-sermon-att-audio,.wpfc-sermon-att-notes,.wpfc-sermon-bulletin{width:auto;height:auto;padding:4px;border:1px solid #efefef;margin-bottom:4px}@media (min-width: 801px){.wpfc-sermon-inner{display:flex;flex-flow:row wrap}.wpfc-sermon-image{flex:0 30%}.wpfc-sermon-image-img{height:100%}.wpfc-sermon-main{flex:1}}@media (max-width: 800px){.wpfc-sermon-image-img{padding-top:56.25%}}.wpfc-sermon-single-header{text-align:center}.wpfc-sermon-single-meta{margin:8px -8px 0 -8px}.wpfc-sermon-single-meta-item{display:inline-block;margin:0 8px;font-size:14px;opacity:.87}.wpfc-sermon-single-meta-date{margin-bottom:8px}.wpfc-sermon-single-title{margin:0;padding:0}.wpfc-sermon-single .wp-video{margin:auto}.wpfc-sermon-single .mejs-video{margin:0}.wpfc-sermon-single mediaelementwrapper>iframe{width:100%;margin-bottom:0;height:100%}.wpfc-sermon-single-media{text-align:center}.wpfc-sermon-single-media>div{margin:24px 0}.wpfc-sermon-single-audio{display:flex;justify-content:center}.wpfc-sermon-single-audio-download{display:flex;align-items:center;flex:none;background:white;padding:0 1.25rem;box-shadow:none;text-decoration:none;outline:none}.player-none .wpfc-sermon-single-audio-download svg{fill:#5d5d5d}.player-wordpress .wpfc-sermon-single-audio-download{background:#222;margin-bottom:1.75em}.player-wordpress .wpfc-sermon-single-audio-download svg{fill:#fff}.player-mediaelement .wpfc-sermon-single-audio-download{background:#222}.player-mediaelement .wpfc-sermon-single-audio-download:hover{background-color:rgba(51,51,51,0.7)}.player-mediaelement .wpfc-sermon-single-audio-download svg{fill:#fff}.player-plyr .wpfc-sermon-single-audio-download{border:1px solid #dbe3e8;border-left:none;transition:background .3s}.player-plyr .wpfc-sermon-single-audio-download:hover{background:#dbe3e8}.player-plyr .wpfc-sermon-single-audio-download:hover svg{fill:#fff}.wpfc-sermon-single .player-plyr .plyr{flex:1}.wpfc-sermon-single-description{margin-top:24px}.wpfc-sermon-single-description p:first-child{margin-top:0}.wpfc-sermon-single-description p:last-child{margin-bottom:0}.wpfc-sermon-single-attachments{background:#efefef;border:1px solid #ddd;padding:24px;margin-top:24px}.wpfc-sermon-single-attachments #wpfc-attachments strong,.wpfc-sermon-single-attachments #wpfc-attachments a{display:block}.wpfc-sermon-single-attachments #wpfc-attachments p{margin:0}.wpfc-sermon-single-attachments #wpfc-attachments .dashicons{line-height:28px}.wpfc-sermon-single-topics{margin-top:24px}.wpfc-sermon-single-navigation{border-top:1px solid #ddd;margin-top:2rem;padding-top:1rem;display:grid;grid-template-columns:50% 50%}.wpfc-sermon-single-navigation .next-sermon{text-align:right}ul#wpfc_images_grid{display:grid;grid-template-columns:50% 50%;grid-gap:1rem;padding:0}ul#wpfc_images_grid .wpfc_grid_image{display:block}ul#wpfc_images_grid .wpfc_grid_image img{margin-bottom:15px}ul#wpfc_images_grid .wpfc_grid_title{margin:0}.wpfc-sermon-player{vertical-align:middle} +.wpfc-sermon-container #wpfc_sermon_sorting{padding:0;margin:0 0 48px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div{margin:0 8px 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0 0 4px 0}.wpfc-sermon-container #wpfc_sermon_sorting form{margin:0}@media (max-width: 700px){.wpfc-sermon-container #wpfc_sermon_sorting>div{width:100%;margin:0 0 12px 0}.wpfc-sermon-container #wpfc_sermon_sorting>div:last-child{margin:0}.wpfc-sermon-container #wpfc_sermon_sorting select{display:block;width:100%;max-width:100%}}.wpfc-sermon-shortcode{margin-bottom:2rem}.wpfc-sermon-image{height:auto;position:relative}.wpfc-sermon-image-img{width:100%;background-size:cover;background-position:center}.wpfc-sermon-header{display:grid;align-items:center}.wpfc-sermon-header.aside-exists{grid-template-columns:70% 30%}.wpfc-sermon-header-aside{text-align:center}.wpfc-sermon-title{margin:0;padding:0}.wpfc-sermon-meta-item{font-size:14px;opacity:.87}.wpfc-sermon-meta-series{margin:0 0 8px 0}.wpfc-sermon-meta-date{margin:8px 0 0}.wpfc-sermon-description{font-size:14px;margin:8px 0 0}.wpfc-sermon-description p{margin:0 0 12px 0}.wpfc-sermon-description p:last-child{margin:0}.wpfc-sermon-audio{margin-top:24px}.wpfc-sermon-footer{margin-top:24px;padding-top:24px;border-top:1px solid #ddd}.wpfc-sermon-footer .wpfc-sermon-meta-item{display:inline-block;position:relative}.wpfc-sermon-footer .wpfc-sermon-meta-item:not(:last-child):after{content:'|';padding:0 4px;color:#ddd}.wpfc-sermon-meta-preacher img{border-radius:50%;width:35px;height:35px;vertical-align:middle;display:inline-block}.wpfc-sermon-meta-preacher>a{text-decoration:none;box-shadow:none;border:0;display:inline-block}.wpfc-sermon-meta-prefix,.wpfc-sermon-meta-text{vertical-align:middle}.wpfc-sermon>.wpfc-sermon-inner{background:white;border:1px solid #ddd}.wpfc-sermon-main{padding:24px}.wpfc-sermon-att-audio,.wpfc-sermon-att-notes,.wpfc-sermon-bulletin{width:auto;height:auto;padding:4px;border:1px solid #efefef;margin-bottom:4px}@media (min-width: 801px){.wpfc-sermon-inner{display:flex;flex-flow:row wrap}.wpfc-sermon-image{flex:0 30%}.wpfc-sermon-image-img{height:100%}.wpfc-sermon-main{flex:1}}@media (max-width: 800px){.wpfc-sermon-image-img{padding-top:56.25%}}.wpfc-sermon-single-header{text-align:center}.wpfc-sermon-single-meta{margin:8px -8px 0 -8px}.wpfc-sermon-single-meta-item{display:inline-block;margin:0 8px;font-size:14px;opacity:.87}.wpfc-sermon-single-meta-date{margin-bottom:8px}.wpfc-sermon-single-title{margin:0;padding:0}.wpfc-sermon-single .wp-video{margin:auto}.wpfc-sermon-single .mejs-video{margin:0}.wpfc-sermon-single mediaelementwrapper>iframe{width:100%;margin-bottom:0;height:100%}.wpfc-sermon-single-media{text-align:center}.wpfc-sermon-single-media>div{margin:24px 0}.wpfc-sermon-single-audio{display:flex;justify-content:center}.wpfc-sermon-single-audio-download{display:flex;align-items:center;flex:none;background:white;padding:0 1.25rem;box-shadow:none;text-decoration:none;outline:none}.player-none .wpfc-sermon-single-audio-download svg{fill:#5d5d5d}.player-wordpress .wpfc-sermon-single-audio-download{background:#222;margin-bottom:1.75em}.player-wordpress .wpfc-sermon-single-audio-download svg{fill:#fff}.player-mediaelement .wpfc-sermon-single-audio-download{background:#222}.player-mediaelement .wpfc-sermon-single-audio-download:hover{background-color:rgba(51,51,51,0.7)}.player-mediaelement .wpfc-sermon-single-audio-download svg{fill:#fff}.player-plyr .wpfc-sermon-single-audio-download{border:1px solid #dbe3e8;border-left:none;transition:background .3s}.player-plyr .wpfc-sermon-single-audio-download:hover{background:#dbe3e8}.player-plyr .wpfc-sermon-single-audio-download:hover svg{fill:#fff}.wpfc-sermon-single .player-plyr .plyr{flex:1}.wpfc-sermon-single-description{margin-top:24px}.wpfc-sermon-single-description p:first-child{margin-top:0}.wpfc-sermon-single-description p:last-child{margin-bottom:0}.wpfc-sermon-single-attachments{background:#efefef;border:1px solid #ddd;padding:24px;margin-top:24px}.wpfc-sermon-single-attachments #wpfc-attachments strong,.wpfc-sermon-single-attachments #wpfc-attachments a{display:block}.wpfc-sermon-single-attachments #wpfc-attachments p{margin:0}.wpfc-sermon-single-attachments #wpfc-attachments .dashicons{line-height:28px}.wpfc-sermon-single-topics{margin-top:24px}.wpfc-sermon-single-navigation{border-top:1px solid #ddd;margin-top:2rem;padding-top:1rem;display:grid;grid-template-columns:50% 50%}.wpfc-sermon-single-navigation .next-sermon{text-align:right}ul#wpfc_images_grid{display:grid;grid-template-columns:50% 50%;grid-gap:1rem;padding:0}ul#wpfc_images_grid .wpfc_grid_image{display:block}ul#wpfc_images_grid .wpfc_grid_image img{margin-bottom:15px}ul#wpfc_images_grid .wpfc_grid_title{margin:0}.wpfc-sermon-player{vertical-align:middle} /*# sourceMappingURL=sermon.min.css.map */ diff --git a/assets/css/sermon.min.css.map b/assets/css/sermon.min.css.map index 076e4e3..5e19b16 100644 --- a/assets/css/sermon.min.css.map +++ b/assets/css/sermon.min.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "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", +"mappings": "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", "sources": ["partials/_sorting.scss","partials/_archive.scss","partials/_single.scss","partials/_shortcodes.scss","sermon.scss"], "names": [], "file": "sermon.min.css" diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 6761be6..1312806 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -594,7 +594,7 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
-
+
ID ) ) : ?>
diff --git a/readme.txt b/readme.txt index 9d03b3f..a184dda 100755 --- a/readme.txt +++ b/readme.txt @@ -115,6 +115,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: SB image import breaking when image is local and does not exist on filesystem * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Taxonomy image assignment not working +* Fix: Title not being in the same line, even though there's enough space * Dev: Add more hooks * Dev: Add PHPUnit configuration * Dev: Add WPCS configuration From 63bb3cddab40a3d6b0006b429575e92ab4c3627c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 28 May 2018 14:00:05 +0200 Subject: [PATCH 089/119] Refactor widgets --- includes/class-sm-widget-recent-sermons.php | 200 ++++++++++++++++++++ includes/widgets.php | 156 --------------- readme.txt | 1 + sermons.php | 2 +- 4 files changed, 202 insertions(+), 157 deletions(-) create mode 100755 includes/class-sm-widget-recent-sermons.php delete mode 100755 includes/widgets.php diff --git a/includes/class-sm-widget-recent-sermons.php b/includes/class-sm-widget-recent-sermons.php new file mode 100755 index 0000000..ec73cf2 --- /dev/null +++ b/includes/class-sm-widget-recent-sermons.php @@ -0,0 +1,200 @@ + 'widget_recent_sermons', + 'description' => __( 'The most recent sermons on your site', 'sermon-manager-for-wordpress' ), + ); + parent::__construct( 'recent-sermons', __( 'Recent Sermons', 'sermon-manager-for-wordpress' ), $widget_ops ); + $this->alt_option_name = 'widget_recent_entries'; + + add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); + add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); + add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); + } + + /** + * Renders the widget. + * + * @param array $args Render arguments. + * @param array $instance Widget instance. + */ + function widget( $args, $instance ) { + // Enqueue scripts and styles. + if ( ! defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) ) { + define( 'SM_ENQUEUE_SCRIPTS_STYLES', true ); + } + + $cache = wp_cache_get( 'widget_recent_sermons', 'widget' ); + + if ( ! is_array( $cache ) ) { + $cache = array(); + } + + /** + * Filter: Allows to override the cache. + * + * @since 2.13.0 + */ + if ( isset( $cache[ $args['widget_id'] ] ) && ! apply_filters( 'sm_recent_sermons_widget_override_cache', false ) ) { + echo $cache[ $args['widget_id'] ]; + + return; + } + + ob_start(); + + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Sermons', 'sermon-manager-for-wordpress' ) : $instance['title'], $instance, $this->id_base ); + $number = ! empty( $instance['number'] ) && absint( $instance['number'] ) ? absint( $instance['number'] ) : 5; + + $r = new WP_Query( array( + 'post_type' => 'wpfc_sermon', + 'posts_per_page' => $number, + 'no_found_rows' => true, + 'post_status' => 'publish', + 'ignore_sticky_posts' => true, + 'meta_key' => 'sermon_date', + 'meta_value_num' => time(), + 'meta_compare' => '<=', + 'orderby' => 'meta_value_num', + 'order' => 'desc', + ) ); + if ( $r->have_posts() ) { + ?> + + + + +
    + have_posts() ) : ?> + the_post(); + global $post; + + $terms = get_the_terms( $post->ID, 'wpfc_preacher' ); + $preacher_links = array(); + if ( $terms ) { + foreach ( $terms as $term ) { + $preacher_links[] = $term->name; + } + } + ?> +
  • +
    + + + + + + +
    + + , + + + + + + +
    + +
    +
    +
  • + +
+ + flush_widget_cache(); + + $all_options = wp_cache_get( 'alloptions', 'options' ); + if ( isset( $all_options['widget_recent_entries'] ) ) { + delete_option( 'widget_recent_entries' ); + } + + return $instance; + } + + /** + * Clears widget cache. + */ + function flush_widget_cache() { + wp_cache_delete( 'widget_recent_sermons', 'widget' ); + } + + /** + * Outputs widget settings. + * + * @param array $instance Widget instance. + * + * @return void + */ + function form( $instance ) { + $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; + $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; + ?> +

+ + +

+

+ + +

+ 'widget_recent_sermons', - 'description' => __( 'The most recent sermons on your site', 'sermon-manager-for-wordpress' ) - ); - parent::__construct( 'recent-sermons', __( 'Recent Sermons', 'sermon-manager-for-wordpress' ), $widget_ops ); - $this->alt_option_name = 'widget_recent_entries'; - - add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); - add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); - add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); - } - - function widget( $args, $instance ) { - // enqueue scripts and styles - if ( ! defined( 'SM_ENQUEUE_SCRIPTS_STYLES' ) ) { - define( 'SM_ENQUEUE_SCRIPTS_STYLES', true ); - } - - $cache = wp_cache_get( 'widget_recent_sermons', 'widget' ); - - if ( ! is_array( $cache ) ) { - $cache = array(); - } - - if ( isset( $cache[ $args['widget_id'] ] ) ) { - echo $cache[ $args['widget_id'] ]; - - return; - } - - ob_start(); - extract( $args ); - - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Sermons', 'sermon-manager-for-wordpress' ) : $instance['title'], $instance, $this->id_base ); - if ( ! $number = absint( $instance['number'] ) ) { - $number = 10; - } - - $r = new WP_Query( array( - 'post_type' => 'wpfc_sermon', - 'posts_per_page' => $number, - 'no_found_rows' => true, - 'post_status' => 'publish', - 'ignore_sticky_posts' => true, - 'meta_key' => 'sermon_date', - 'meta_value_num' => time(), - 'meta_compare' => '<=', - 'orderby' => 'meta_value_num', - 'order' => 'desc', - ) ); - if ( $r->have_posts() ) : - ?> - - -
    - have_posts() ) : $r->the_post(); ?> - - -
  • -
    - - - - - ID, 'wpfc_preacher' ) ) { - $preacher_links = array(); - - foreach ( $terms as $term ) { - $preacher_links[] = $term->name; - } - - echo '', join( ", ", $preacher_links ), ''; - - echo ', '; - } - - echo '', sm_get_the_date(), ''; - - if ( \SermonManager::getOption( 'widget_show_key_verse' ) ) { - echo '
    ', __( 'Bible Text: ', 'sermon-manager-for-wordpress' ), get_wpfc_sermon_meta( 'bible_passage' ), '
    '; - } - ?> -
    -
    -
  • - -
- flush_widget_cache(); - - $alloptions = wp_cache_get( 'alloptions', 'options' ); - if ( isset( $alloptions['widget_recent_entries'] ) ) { - delete_option( 'widget_recent_entries' ); - } - - return $instance; - } - - function flush_widget_cache() { - wp_cache_delete( 'widget_recent_sermons', 'widget' ); - } - - function form( $instance ) { - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; - $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; - ?> -

- - -

- -

-

- diff --git a/readme.txt b/readme.txt index a184dda..a5ffc2d 100755 --- a/readme.txt +++ b/readme.txt @@ -119,6 +119,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Dev: Add more hooks * Dev: Add PHPUnit configuration * Dev: Add WPCS configuration +* Dev: Refactor widgets code ### 2.12.5 ### * Change: Add Previous/Next sermon navigation diff --git a/sermons.php b/sermons.php index a263cc8..c843a8e 100755 --- a/sermons.php +++ b/sermons.php @@ -321,7 +321,7 @@ private function _includes() { include SM_PATH . 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies. include SM_PATH . 'includes/vendor/entry-views.php'; // Entry Views Tracking. include SM_PATH . 'includes/class-sm-shortcodes.php'; // Shortcodes. - include SM_PATH . 'includes/widgets.php'; // Widgets. + include SM_PATH . 'includes/class-sm-widget-recent-sermons.php'; // Recent sermons widget. include SM_PATH . 'includes/sm-template-functions.php'; // Template functions. include SM_PATH . 'includes/sm-podcast-functions.php'; // Podcast Functions. From db537fd5c638c5e19d98e144ba33365e153cfa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 28 May 2018 14:19:11 +0200 Subject: [PATCH 090/119] Add more options to recent sermons widget --- includes/class-sm-widget-recent-sermons.php | 42 +++++++++++++++++---- readme.txt | 1 + 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/includes/class-sm-widget-recent-sermons.php b/includes/class-sm-widget-recent-sermons.php index ec73cf2..490b8c1 100755 --- a/includes/class-sm-widget-recent-sermons.php +++ b/includes/class-sm-widget-recent-sermons.php @@ -58,8 +58,12 @@ function widget( $args, $instance ) { ob_start(); - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Sermons', 'sermon-manager-for-wordpress' ) : $instance['title'], $instance, $this->id_base ); - $number = ! empty( $instance['number'] ) && absint( $instance['number'] ) ? absint( $instance['number'] ) : 5; + var_dump( $instance ); + + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Sermons', 'sermon-manager-for-wordpress' ) : $instance['title'], $instance, $this->id_base ); + $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; + $before_widget = isset( $instance['before_widget'] ) ? wp_kses_post( $instance['before_widget'] ) : ''; + $after_widget = isset( $instance['after_widget'] ) ? wp_kses_post( $instance['after_widget'] ) : ''; $r = new WP_Query( array( 'post_type' => 'wpfc_sermon', @@ -79,6 +83,11 @@ function widget( $args, $instance ) { + +
+ +
+
    have_posts() ) : ?> ,
+ +
+ +
+ , * @return array */ function update( $new_instance, $old_instance ) { - $instance = $old_instance; - $instance['title'] = strip_tags( $new_instance['title'] ); - $instance['number'] = (int) $new_instance['number']; + $instance = $old_instance; + $instance['title'] = strip_tags( $new_instance['title'] ); + $instance['number'] = (int) $new_instance['number']; + $instance['before_widget'] = wp_kses_post( $new_instance['before_widget'] ); + $instance['after_widget'] = wp_kses_post( $new_instance['after_widget'] ); $this->flush_widget_cache(); $all_options = wp_cache_get( 'alloptions', 'options' ); @@ -177,8 +193,10 @@ function flush_widget_cache() { * @return void */ function form( $instance ) { - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; - $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; + $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; + $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; + $before_widget = isset( $instance['before_widget'] ) ? wp_kses_post( $instance['before_widget'] ) : ''; + $after_widget = isset( $instance['after_widget'] ) ? wp_kses_post( $instance['after_widget'] ) : ''; ?>

@@ -191,6 +209,16 @@ function form( $instance ) { name="get_field_name( 'number' ); ?>" type="text" value="" size="3"/>

+

+ + +

+

+ + +

Date: Fri, 1 Jun 2018 05:02:16 +0200 Subject: [PATCH 091/119] Add functionality for ordering all terms by latest sermon --- includes/class-sm-dates-wp.php | 25 +++++++++++++++++++++---- includes/sm-update-functions.php | 14 +++++++++++++- readme.txt | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/includes/class-sm-dates-wp.php b/includes/class-sm-dates-wp.php index 10b8387..9e859ab 100644 --- a/includes/class-sm-dates-wp.php +++ b/includes/class-sm-dates-wp.php @@ -101,15 +101,32 @@ public static function save_series_date( $post_ID, $post, $update ) { } /** - * Loops through all series and sets latest available date. + * Left here for backwards-compatibility reasons. + * Does exactly the same as - self::update_term_dates(); * * @since 2.8 + * @deprecated */ public static function update_series_date() { + self::update_term_dates(); + } + + /** + * Loops through all terms and sets latest available sermon date. + * + * @since 2.13.0 - extended to all terms + */ + public static function update_term_dates() { foreach ( get_terms( array( - 'taxonomy' => 'wpfc_sermon_series', - 'hide_empty' => false, + 'taxonomy' => array( + 'wpfc_sermon_series', + 'wpfc_preacher', + 'wpfc_sermon_topics', + 'wpfc_bible_book', + 'wpfc_service_type', + ), + 'hide_empty' => true, ) ) as $term ) { $term_meta = get_term_meta( $term->term_id ); @@ -135,7 +152,7 @@ public static function update_series_date() { 'orderby' => 'meta_value_num', 'tax_query' => array( array( - 'taxonomy' => 'wpfc_sermon_series', + 'taxonomy' => $term->taxonomy, 'field' => 'term_id', 'terms' => $term->term_id, ), diff --git a/includes/sm-update-functions.php b/includes/sm-update-functions.php index b56d663..b77fbbd 100644 --- a/includes/sm-update-functions.php +++ b/includes/sm-update-functions.php @@ -248,4 +248,16 @@ function sm_update_2123_fix_preacher_permalink() { // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); -} \ No newline at end of file +} + +/** + * For enabling sorting by sermon date, in all terms. + * + * @see SM_Dates_WP::update_term_dates() + */ +function sm_update_2130_fill_out_sermon_term_dates() { + SM_Dates_WP::update_term_dates(); + + // Mark it as done, backup way. + update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); +} diff --git a/readme.txt b/readme.txt index 6b050fe..21ef34a 100755 --- a/readme.txt +++ b/readme.txt @@ -117,6 +117,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Taxonomy image assignment not working * Fix: Title not being in the same line, even though there's enough space +* Dev: All terms now support ordering by latest sermon * Dev: Add more hooks * Dev: Add PHPUnit configuration * Dev: Add WPCS configuration From 0b5d2d79c100533c4a02aa3b51aca4465d5178ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 17:13:57 +0200 Subject: [PATCH 092/119] Fix sermons not showing if date preached is not set, when published via API Closes #205 --- includes/class-sm-api.php | 9 +++++++-- readme.txt | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/class-sm-api.php b/includes/class-sm-api.php index bafcf5e..9cfba26 100644 --- a/includes/class-sm-api.php +++ b/includes/class-sm-api.php @@ -60,13 +60,18 @@ public function save_custom_data( $post, $request ) { $data = isset( $params[ $key ] ) ? $params[ $key ] : null; if ( ! $data ) { - continue; + if ( 'sermon_date' === $key ) { + update_post_meta( $post->ID, 'sermon_date', strtotime( $post->post_date ) ); + update_post_meta( $post->ID, 'sermon_date_auto', 1 ); + } else { + continue; + } } update_post_meta( $post->ID, $key, $data ); if ( 'sermon_date' === $key ) { - update_post_meta( $post->ID, 'sermon_date_auto', '' === $data ); + update_post_meta( $post->ID, 'sermon_date_auto', 0 ); } add_filter( "cmb2_override_{$key}_meta_remove", '__return_true' ); diff --git a/readme.txt b/readme.txt index 21ef34a..f13e961 100755 --- a/readme.txt +++ b/readme.txt @@ -114,6 +114,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: Image size shortcode argument not working * Fix: MP4 video file being detected as YouTube and therefore not working * Fix: SB image import breaking when image is local and does not exist on filesystem +* Fix: Sermons do not appear if published via API and "Date Preached" not set * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Taxonomy image assignment not working * Fix: Title not being in the same line, even though there's enough space From 4cba3e6e20fe2c7c3941005b8c843d49cae1df13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 19:21:05 +0200 Subject: [PATCH 093/119] Fix and enable broken podcast view Closes #208 Closes #204 --- includes/sm-core-functions.php | 21 +++ includes/sm-deprecated-functions.php | 168 +++++++++++++++--- includes/sm-podcast-functions.php | 255 +-------------------------- readme.txt | 6 +- views/wpfc-podcast-feed.php | 215 ++++++++++++++++------ 5 files changed, 338 insertions(+), 327 deletions(-) diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index ba1bcdf..eedbe12 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -821,3 +821,24 @@ function sm_get_next_sermon( $post = null ) { */ return apply_filters( 'sm_get_next_sermon', isset( $the_post ) ? $the_post : null ); } + +/** + * Saves service type. + * + * Will be obsolete when we add new meta boxes code. + * + * @param int $post_ID The sermon ID. + */ +function set_service_type( $post_ID ) { + if ( isset( $_POST['wpfc_service_type'] ) ) { + $term = get_term_by( 'id', $_POST['wpfc_service_type'], 'wpfc_service_type' ); + + if ( $term ) { + $service_type = $term->slug; + } + + wp_set_object_terms( $post_ID, empty( $service_type ) ? null : $service_type, 'wpfc_service_type' ); + } +} + +add_action( 'save_post', 'set_service_type', 99 ); diff --git a/includes/sm-deprecated-functions.php b/includes/sm-deprecated-functions.php index 0b480bf..0ec2b99 100644 --- a/includes/sm-deprecated-functions.php +++ b/includes/sm-deprecated-functions.php @@ -28,30 +28,10 @@ * @deprecated deprecated since 2.6, use sm_the_date() instead. */ function wpfc_sermon_date( $d, $before = '', $after = '' ) { + _deprecated_function( __FUNCTION__, '2.13.0', 'sm_the_date' ); sm_the_date( $d, $before, $after ); } -/** - * Saves service type. - * - * Will be obsolete when we add new meta boxes code. - * - * @param int $post_ID The sermon ID. - */ -function set_service_type( $post_ID ) { - if ( isset( $_POST['wpfc_service_type'] ) ) { - $term = get_term_by( 'id', $_POST['wpfc_service_type'], 'wpfc_service_type' ); - - if ( $term ) { - $service_type = $term->slug; - } - - wp_set_object_terms( $post_ID, empty( $service_type ) ? null : $service_type, 'wpfc_service_type' ); - } -} - -add_action( 'save_post', 'set_service_type', 99 ); - add_action( 'sermon_media', 'wpfc_sermon_media', 5 ); add_action( 'sermon_audio', 'wpfc_sermon_audio', 5 ); add_action( 'sermon_single', 'wpfc_sermon_single' ); @@ -60,27 +40,32 @@ function set_service_type( $post_ID ) { /** * Output attachments. * - * @deprecated - see wpfc_sermon_media(). + * @deprecated 2.12.5 - see wpfc_sermon_media(). */ function wpfc_sermon_files() { + _deprecated_function( __FUNCTION__, '2.12.5', 'wpfc_sermon_attachments' ); do_action( 'sermon_media' ); } /** * Output single sermon. * - * @deprecated - see wpfc_sermon_single() & wpfc_sermon_single_v2(). + * @deprecated 2.12.5 - see wpfc_sermon_single() & wpfc_sermon_single_v2(). */ function render_wpfc_sermon_single() { + _deprecated_function( __FUNCTION__, '2.12.5', 'wpfc_sermon_single_v2' ); + do_action( 'sermon_single' ); } /** * Output archive sermon. * - * @deprecated - see wpfc_sermon_excerpt() & wpfc_sermon_excerpt_v2(). + * @deprecated 2.12.5 - see wpfc_sermon_excerpt() & wpfc_sermon_excerpt_v2(). */ function render_wpfc_sermon_excerpt() { + _deprecated_function( __FUNCTION__, '2.12.5', 'wpfc_sermon_excerpt_v2' ); + do_action( 'sermon_excerpt' ); } @@ -90,6 +75,8 @@ function render_wpfc_sermon_excerpt() { * @deprecated 2.12.0 */ function render_wpfc_sermon_archive() { + _deprecated_function( __FUNCTION__, '2.12.0', 'wpfc_sermon_excerpt_v2' ); + global $post; // translators: Sermon Title. $title = printf( esc_attr__( 'Permalink to %s', 'sermon-manager-for-wordpress' ), the_title_attribute( 'echo=0' ) ); @@ -130,6 +117,8 @@ function render_wpfc_sermon_archive() { * @deprecated 2.12.2 */ function wpfc_sermon_excerpt( $return = false ) { + _deprecated_function( __FUNCTION__, '2.12.2', 'wpfc_sermon_excerpt_v2' ); + global $post; ob_start(); @@ -198,6 +187,8 @@ function wpfc_sermon_excerpt( $return = false ) { * @return string The output */ function wpfc_sermon_single( $return = false, $post = null ) { + _deprecated_function( __FUNCTION__, '2.12.0', 'wpfc_sermon_single_v2' ); + if ( null === $post || '' === $post ) { global $post; } @@ -292,6 +283,8 @@ function wpfc_footer_preacher() { * @deprecated 2.12.0 */ function wpfc_sermon_audio() { + _deprecated_function( __FUNCTION__, '2.12.0', 'wpfc_render_audio' ); + $html = ''; $html .= '
'; @@ -306,9 +299,13 @@ function wpfc_sermon_audio() { * * @param string $size Image size, supports WP image size. * + * @see get_sermon_image_url() + * * @deprecated 2.12.0 */ function render_sermon_image( $size ) { + _deprecated_function( __FUNCTION__, '2.12.0', 'get_sermon_image_url' ); + // $size = any defined image size in WordPress. if ( has_post_thumbnail() ) : the_post_thumbnail( $size ); @@ -343,6 +340,8 @@ function render_sermon_image( $size ) { * @deprecated 2.12.0 */ function wpfc_sermon_media() { + _deprecated_function( __FUNCTION__, '2.12.0', null ); + $html = ''; if ( get_wpfc_sermon_meta( 'sermon_video_link' ) ) { @@ -372,3 +371,124 @@ function wpfc_sermon_media() { function wpfc_sermon_author_filter() { _deprecated_function( __FUNCTION__, '2.12.0', null ); } + +/** + * Add podcast data to the WordPress default XML feed. + * + * @param WP_Query $query The query. + * + * @return void + * + * @deprecated 2.13.0 + */ +function wpfc_podcast_add_hooks( $query ) { + _deprecated_function( __FUNCTION__, '2.13.0', null ); +} + +/** + * Add iTunes XML Namespace to the XML head. + * + * @return void + * @deprecated 2.13.0 + */ +function wpfc_podcast_add_namespace() { + _deprecated_function( __FUNCTION__, '2.13.0', null ); +} + +/** + * Add iTunes header data. + * + * @return void + * @deprecated 2.13.0 + */ +function wpfc_podcast_add_head() { + _deprecated_function( __FUNCTION__, '2.13.0', null ); +} + +/** + * Add iTunes data to each sermon. + * + * @deprecated 2.13.0 + */ +function wpfc_podcast_add_item() { + _deprecated_function( __FUNCTION__, '2.13.0', null ); +} + +/** + * Replace feed item content and excerpt with Sermon description. + * + * @param string $content Original content. + * + * @return string Modified content. + * + * @deprecated 2.13.0 + */ +function wpfc_podcast_summary( $content ) { + _deprecated_function( __FUNCTION__, '2.13.0', null ); + + return ''; +} + +/** + * Replace feed item published date with Sermon date. + * + * @param string $time The formatted time. + * @param string $d Format to use for retrieving the time the post was written. + * Accepts 'G', 'U', or php date format. Default 'U'. + * @param bool $gmt Whether to retrieve the GMT time. Default false. + * + * @return string Modified date + * + * @deprecated 2.13.0 + */ +function wpfc_podcast_item_date( $time, $d = 'U', $gmt = false ) { + _deprecated_function( __FUNCTION__, '2.13.0', null ); + + return ''; +} + +/** + * Replace feed title with the one defined in Sermon Manager settings. + * + * @param string $title Default title. + * + * @return string Modified title. + * + * @deprecated 2.13.0 + */ +function wpfc_modify_podcast_title( $title ) { + _deprecated_function( __FUNCTION__, '2.13.0', null ); + + return ''; +} + +/** + * Modifies get_bloginfo output and injects Sermon Manager data. + * + * @param string $info Default data. + * @param string $show Requested data. + * + * @return string Modified data + * + * @deprecated 2.13.0 + */ +function wpfc_bloginfo_rss_filter( $info, $show ) { + _deprecated_function( __FUNCTION__, '2.13.0', null ); + + return ''; +} + +/** + * Note: Unfinished feature. + * Take a look at comment at `views/wpfc-podcast-feed.php`. + * + * Load the template used for podcast XML. + * + * It can be overridden by putting the `wpfc-podcast-feed.php` file in the root of your active theme. + * + * @since 2.3.5 Added ability to override the default template + * @return void + */ +function wpfc_podcast_render() { + _deprecated_function( __FUNCTION__, '2.13.0', null ); +} diff --git a/includes/sm-podcast-functions.php b/includes/sm-podcast-functions.php index 2ec3fc6..e52c3f6 100644 --- a/includes/sm-podcast-functions.php +++ b/includes/sm-podcast-functions.php @@ -1,17 +1,12 @@ is_main_query() && $query->is_feed() ) { - if ( is_post_type_archive( 'wpfc_sermon' ) || is_tax( 'wpfc_preacher' ) || is_tax( 'wpfc_sermon_topics' ) || is_tax( 'wpfc_service_type' ) || is_tax( 'wpfc_sermon_series' ) || is_tax( 'wpfc_bible_book' ) ) { - add_filter( 'get_post_time', 'wpfc_podcast_item_date', 10, 3 ); - add_filter( 'bloginfo_rss', 'wpfc_bloginfo_rss_filter', 10, 2 ); - add_filter( 'wp_title_rss', 'wpfc_modify_podcast_title', 99, 3 ); - add_action( 'rss_ns', 'wpfc_podcast_add_namespace' ); - add_action( 'rss2_ns', 'wpfc_podcast_add_namespace' ); - add_action( 'rss_head', 'wpfc_podcast_add_head' ); - add_action( 'rss2_head', 'wpfc_podcast_add_head' ); - add_action( 'rss_item', 'wpfc_podcast_add_item' ); - add_action( 'rss2_item', 'wpfc_podcast_add_item' ); - add_filter( 'the_content_feed', 'wpfc_podcast_summary', 10, 3 ); - add_filter( 'the_excerpt_rss', 'wpfc_podcast_summary' ); - add_filter( 'rss_enclosure', '__return_empty_string' ); - - if ( \SermonManager::getOption( 'enable_podcast_html_description' ) ) { - add_filter( 'the_excerpt_rss', 'wpautop' ); - } - - // Remove sermons that don't have audio. - $query->set( 'meta_query', array( - 'relation' => 'AND', - array( - 'key' => 'sermon_audio', - 'compare' => 'EXISTS', - ), - array( - 'key' => 'sermon_audio', - 'value' => '', - 'compare' => '!=', - ), - ) ); - - if ( intval( \SermonManager::getOption( 'podcasts_per_page' ) ) !== 0 ) { - $query->set( 'posts_per_rss', intval( \SermonManager::getOption( 'podcasts_per_page' ) ) ); - } - } - } -} +add_action( 'rss_tag_pre', function () { + global $post_type; -/** - * Note: Unfinished feature. - * Take a look at comment at `views/wpfc-podcast-feed.php`. - * - * Load the template used for podcast XML. - * - * It can be overridden by putting the `wpfc-podcast-feed.php` file in the root of your active theme. - * - * @since 2.3.5 Added ability to override the default template - * @return void - */ -function wpfc_podcast_render() { - add_action( 'after_setup_theme', function () { + if ( 'wpfc_sermon' === $post_type ) { $overridden_template = locate_template( 'wpfc-podcast-feed.php' ); if ( $overridden_template ) { load_template( $overridden_template ); @@ -102,189 +45,5 @@ function wpfc_podcast_render() { } exit; - } ); -} - -/** - * Add iTunes XML Namespace to the XML head. - * - * @return void - */ -function wpfc_podcast_add_namespace() { - echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'; -} - -/** - * Add iTunes header data. - * - * @return void - */ -function wpfc_podcast_add_head() { - remove_filter( 'the_content', 'add_wpfc_sermon_content' ); - - $categories = array( - '0' => '', - '1' => 'Buddhism', - '2' => 'Christianity', - '3' => 'Hinduism', - '4' => 'Islam', - '5' => 'Judaism', - '6' => 'Other', - '7' => 'Spirituality', - ); - - ?> - - - - - - - - - - - - - - no - - - - - - - ID, 'sermon_audio', true ) ); - $audio_p = strrpos( $audio_raw, '/' ) + 1; - $audio_raw = urldecode( $audio_raw ); - $audio = substr( $audio_raw, 0, $audio_p ) . rawurlencode( substr( $audio_raw, $audio_p ) ); - $speaker = strip_tags( get_the_term_list( $post->ID, 'wpfc_preacher', '', ' & ', '' ) ); - $series = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_series', '', ', ', '' ) ); - $topics = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_topics', '', ', ', '' ) ); - $post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); - $post_image = str_ireplace( 'https://', 'http://', ! empty( $post_image['0'] ) ? $post_image['0'] : '' ); - $audio_duration = get_post_meta( $post->ID, '_wpfc_sermon_duration', true ) ?: '0:00'; - $audio_file_size = get_post_meta( $post->ID, '_wpfc_sermon_size', 'true' ) ?: 0; - - // Fix for relative audio file URLs. - if ( substr( $audio, 0, 1 ) === '/' ) { - $audio = site_url( $audio ); - } - ?> - - - - - - - - - - - - - - - - - 'wpfc_sermon', - 'posts_per_page' => - 1, + 'posts_per_page' => intval( \SermonManager::getOption( 'podcasts_per_page' ) ) ?: 10, 'meta_key' => 'sermon_date', 'meta_value_num' => time(), 'meta_compare' => '<=', 'orderby' => 'meta_value_num', + 'paged' => isset( $_GET['paged'] ) ? intval( $_GET['paged'] ) : 1, + 'meta_query' => array( + 'relation' => 'AND', + array( + 'key' => 'sermon_audio', + 'compare' => 'EXISTS', + ), + array( + 'key' => 'sermon_audio', + 'value' => '', + 'compare' => '!=', + ), + ), ); + +/** + * Allow filtering by taxonomies. + * + * Example: To filter sermons preached by John Doe, and are in series named Jesus, just execute the following query: + * "https://www.example.com/?post_type=wpfc_sermon&wpfc_preacher=john-doe&wpfc_sermon_series=jesus" + */ +foreach ( + array( + 'wpfc_preacher', + 'wpfc_sermon_series', + 'wpfc_sermon_topics', + 'wpfc_bible_book', + 'wpfc_service_type', + ) as $taxonomy +) { + if ( isset( $_GET[ $taxonomy ] ) ) { + $terms = $_GET[ $taxonomy ]; + $args['tax_query'] = ! empty( $args['tax_query'] ) ? $args['tax_query'] : array(); + $args['tax_query'][] = array( + 'taxonomy' => $taxonomy, + 'field' => is_numeric( $terms ) ? 'term_id' : 'slug', + 'terms' => is_numeric( $terms ) ? intval( $terms ) : false !== strpos( $terms, ',' ) ? array_walk( explode( ',', $terms ), 'sanitize_title' ) : sanitize_title( $terms ), + ); + + if ( count( $args['tax_query'] ) > 1 ) { + $args['tax_query']['relation'] = 'AND'; + } + } +} + +/** + * Allows to filter the sermon feed query arguments. + * + * @param array $args WP_Query arguments. + * + * @since 2.13.0 + */ +$args = apply_filters( 'sermon_feed_query_args', $args ); + $sermon_podcast_query = new WP_Query( $args ); -$title = esc_html( \SermonManager::getOption( 'title' ) ); -$link = esc_url( \SermonManager::getOption( 'website_link' ) ); -$atom_link = ! empty( $_SERVER['HTTPS'] ) ? 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; -$description = esc_html( \SermonManager::getOption( 'description' ) ); -$language = esc_html( \SermonManager::getOption( 'language' ) ); +$categories = array( + '0' => '', + '1' => 'Buddhism', + '2' => 'Christianity', + '3' => 'Hinduism', + '4' => 'Islam', + '5' => 'Judaism', + '6' => 'Other', + '7' => 'Spirituality', +); -?>'; ?> - +$title = esc_html( \SermonManager::getOption( 'title' ) ) ?: get_wp_title_rss(); +$link = esc_url( \SermonManager::getOption( 'website_link' ) ) ?: get_bloginfo_rss( 'url' ); +$atom_link = ( ! empty( $_SERVER['HTTPS'] ) ? 'https://' : 'http://' ) . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; +$description = esc_html( \SermonManager::getOption( 'description' ) ) ?: get_bloginfo_rss( 'description' ); +$language = esc_html( \SermonManager::getOption( 'language' ) ) ?: get_bloginfo_rss( 'language' ); +$last_sermon_date = get_post_meta( $sermon_podcast_query->posts[0]->ID, 'sermon_date', true ) ?: null; +$copyright = html_entity_decode( esc_html( \SermonManager::getOption( 'copyright' ) ), ENT_COMPAT, 'UTF-8' ); +$subtitle = esc_html( \SermonManager::getOption( 'itunes_subtitle' ) ); +$author = esc_html( \SermonManager::getOption( 'itunes_author' ) ); +$summary = str_replace( ' ', '', \SermonManager::getOption( 'enable_podcast_html_description' ) ? stripslashes( wpautop( wp_filter_kses( \SermonManager::getOption( 'itunes_summary' ) ) ) ) : stripslashes( wp_filter_nohtml_kses( \SermonManager::getOption( 'itunes_summary' ) ) ) ); +$owner_name = esc_html( \SermonManager::getOption( 'itunes_owner_name' ) ); +$owner_email = esc_html( \SermonManager::getOption( 'itunes_owner_email' ) ); +$cover_image_url = esc_url( \SermonManager::getOption( 'itunes_cover_image' ) ); +$subcategory = esc_attr( $categories[ \SermonManager::getOption( 'itunes_sub_category' ) ] ); + +?> - > + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:atom="http://www.w3.org/2005/Atom" + xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" + xmlns:content="http://purl.org/rss/1.0/modules/content/" + xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" +> <?php echo $title; ?> - - + + hourly + 1 + + + + + + + + + no + + + + + + + have_posts() ) : while ( $sermon_podcast_query->have_posts() ) : $sermon_podcast_query->the_post(); + global $post; + + $audio_raw = str_ireplace( 'https://', 'http://', get_post_meta( $post->ID, 'sermon_audio', true ) ); + $audio_p = strrpos( $audio_raw, '/' ) + 1; + $audio_raw = urldecode( $audio_raw ); + $audio = substr( $audio_raw, 0, $audio_p ) . rawurlencode( substr( $audio_raw, $audio_p ) ); + $speakers = strip_tags( get_the_term_list( $post->ID, 'wpfc_preacher', '', ' & ', '' ) ); + $speakers_terms = get_the_terms( $post->ID, 'wpfc_preacher' ); + $speaker = $speakers_terms ? $speakers_terms[0]->name : ''; + $series = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_series', '', ', ', '' ) ); + $topics = strip_tags( get_the_term_list( $post->ID, 'wpfc_sermon_topics', '', ', ', '' ) ); + $post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' ); + $post_image = str_ireplace( 'https://', 'http://', ! empty( $post_image['0'] ) ? $post_image['0'] : '' ); + $audio_duration = get_post_meta( $post->ID, '_wpfc_sermon_duration', true ) ?: '0:00'; + $audio_file_size = get_post_meta( $post->ID, '_wpfc_sermon_size', 'true' ) ?: 0; + $description = get_post_meta( 'sermon_description' ); + + // Fix for relative audio file URLs. + if ( substr( $audio, 0, 1 ) === '/' ) { + $audio = site_url( $audio ); + } + + if ( \SermonManager::getOption( 'podtrac' ) ) { + $audio = 'http://dts.podtrac.com/redirect.mp3/' . esc_url( preg_replace( '#^https?://#', '', $audio ) ); + } else { + // As per RSS 2.0 spec, the enclosure URL must be HTTP only: + // http://www.rssboard.org/rss-specification#ltenclosuregtSubelementOfLtitemgt . + $audio = preg_replace( '/^https:/i', 'http:', $audio ); + } ?> - - ID, 'sermon_audio', true ) !== '' ) : ?> + <?php the_title_rss(); ?> - - - ]]> + + + ]]> + + ]]> + ]]> + + + + + + + + + + + + - asd]]> - - - + From 6c5e450dc9ebfe3abdaa7c1c7428141843efbf49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 19:33:25 +0200 Subject: [PATCH 094/119] Possible fix for sermons not showing in shortcode due to timezone Fixes #202 --- includes/class-sm-shortcodes.php | 17 ++++------------- readme.txt | 1 + 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/includes/class-sm-shortcodes.php b/includes/class-sm-shortcodes.php index 020bac4..8091196 100755 --- a/includes/class-sm-shortcodes.php +++ b/includes/class-sm-shortcodes.php @@ -765,19 +765,6 @@ function display_sermons( $atts = array() ) { 'day' => $args['day'], 'after' => $args['after'], 'before' => $args['before'], - 'meta_query' => array( - 'relation' => 'OR', - array( // Check to see if date has been filled out. - 'key' => 'sermon_date', - 'compare' => '<=', - 'value' => time(), - ), - array( // If no date has been added show these posts too. - 'key' => 'sermon_date', - 'value' => time(), - 'compare' => 'NOT EXISTS', - ), - ), ); // Check if it's a valid ordering argument. @@ -795,6 +782,10 @@ function display_sermons( $atts = array() ) { if ( 'date' === $args['orderby'] ) { $args['orderby'] = 'meta_value_num'; + + $query_args['meta_key'] = 'sermon_date'; + $query_args['meta_value_num'] = time(); + $query_args['meta_compare'] = '<='; } $query_args['orderby'] = $args['orderby']; diff --git a/readme.txt b/readme.txt index 748ae52..4b8145b 100755 --- a/readme.txt +++ b/readme.txt @@ -116,6 +116,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: MP4 video file being detected as YouTube and therefore not working * Fix: SB image import breaking when image is local and does not exist on filesystem * Fix: Sermons do not appear if published via API and "Date Preached" not set +* Fix: Sermons not showing in shortcode under certain timezone conditions * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Taxonomy image assignment not working * Fix: Title not being in the same line, even though there's enough space From d7c95872a04c2b2254f90f0397a2e505ddafb2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 19:47:46 +0200 Subject: [PATCH 095/119] Add a filter to change sermon image size --- includes/sm-core-functions.php | 9 +++++++++ readme.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index eedbe12..d72a175 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -619,6 +619,15 @@ function sm_debug_get_update_functions() { * @since 2.12.0 */ function get_sermon_image_url( $fallback = true, $image_size = 'post-thumbnail' ) { + /** + * Allows to filter the image size. + * + * @param string $image_size The image size. Default: "post-thumbnail". + * + * @since 2.13.0 + */ + $image_size = apply_filters( 'get_sermon_image_url_image_size', $image_size ); + $image = get_the_post_thumbnail_url( null, $image_size ); if ( $image ) { return $image; diff --git a/readme.txt b/readme.txt index 4b8145b..d33170e 100755 --- a/readme.txt +++ b/readme.txt @@ -120,6 +120,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: Sermons menu title is "All Sermons" instead of "Sermons" * Fix: Taxonomy image assignment not working * Fix: Title not being in the same line, even though there's enough space +* Dev: Add a filter for filtering sermon image size * Dev: Add more hooks * Dev: Add PHPUnit configuration * Dev: Add WPCS configuration From 9e60e4ca17cd0e3076a29f576f4943d332cde41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 19:53:55 +0200 Subject: [PATCH 096/119] Update PHPdoc comment --- includes/sm-core-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index d72a175..cf2acf6 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -611,8 +611,8 @@ function sm_debug_get_update_functions() { /** * Returns sermon image URL * - * @param bool $fallback If set to true, it will try to get series image URL if sermon image URL is not set. - * @param string $image_size The image size. Defaults to "post-thumbnail". + * @param bool $fallback If set to true, it will try to get series image URL if sermon image URL is not set. + * @param string|array $image_size The image size. Defaults to "post-thumbnail". * * @return string Image URL or empty string * From baf562a49a6de63432b1cda6f010088a1b04592f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 19:54:05 +0200 Subject: [PATCH 097/119] Update PHPdoc comment --- includes/sm-core-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/sm-core-functions.php b/includes/sm-core-functions.php index cf2acf6..bf6c950 100644 --- a/includes/sm-core-functions.php +++ b/includes/sm-core-functions.php @@ -622,7 +622,7 @@ function get_sermon_image_url( $fallback = true, $image_size = 'post-thumbnail' /** * Allows to filter the image size. * - * @param string $image_size The image size. Default: "post-thumbnail". + * @param string|array $image_size The image size. Default: "post-thumbnail". * * @since 2.13.0 */ From b7227218f161b0f7b3ad02b5868b69d487aa6a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 20:22:18 +0200 Subject: [PATCH 098/119] Use sermon audio attachment ID --- includes/class-sm-api.php | 2 +- includes/sm-template-functions.php | 44 ++++++++++++++++++++---------- readme.txt | 1 + views/wpfc-podcast-feed.php | 4 ++- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/includes/class-sm-api.php b/includes/class-sm-api.php index 9cfba26..13e66da 100644 --- a/includes/class-sm-api.php +++ b/includes/class-sm-api.php @@ -140,7 +140,7 @@ public function add_custom_data( $response ) { 'sermon_date_auto' => array( '' ), ) ); - $data['sermon_audio'] = $post_meta['sermon_audio'][0]; + $data['sermon_audio'] = isset( $post_meta['sermon_audio_id'][0] ) ? wp_get_attachment_url( intval( $post_meta['sermon_audio_id'][0] ) ) : $post_meta['sermon_audio'][0]; $data['sermon_audio_duration'] = $post_meta['_wpfc_sermon_duration'][0]; $data['_views'] = $post_meta['Views'][0]; $data['bible_passage'] = $post_meta['bible_passage'][0]; diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index 1312806..a89d173 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -335,15 +335,25 @@ function wpfc_render_video( $url = '', $seek = null ) { /** * Renders the audio player. * - * @param string $url The URL of the audio file. - * @param int $seek Allows seeking to specific second in audio file. + * @param string|int $source The URL or the attachment ID of the audio file. + * @param int $seek Allows seeking to specific second in audio file. * * @since 2.12.3 added $seek * * @return string Audio player HTML. */ -function wpfc_render_audio( $url = '', $seek = null ) { - if ( ! is_string( $url ) || trim( $url ) === '' ) { +function wpfc_render_audio( $source = '', $seek = null ) { + if ( is_int( $source ) || is_numeric( $source ) ) { + $source = wp_get_attachment_url( intval( $source ) ); + + if ( ! $source ) { + return ''; + } + } elseif ( is_string( $source ) ) { + if ( '' === trim( $source ) ) { + return ''; + } + } else { return ''; } @@ -351,7 +361,7 @@ function wpfc_render_audio( $url = '', $seek = null ) { if ( strtolower( 'WordPress' ) === $player ) { $attr = array( - 'src' => $url, + 'src' => $source, 'preload' => 'none', ); @@ -367,7 +377,7 @@ function wpfc_render_audio( $url = '', $seek = null ) { $output = ''; $output .= ''; } @@ -375,9 +385,9 @@ function wpfc_render_audio( $url = '', $seek = null ) { * Allows changing of the audio player to any HTML. * * @param string $output Audio player HTML. - * @param string $url Audio source URL. + * @param string $source Audio source URL. */ - return apply_filters( 'sm_audio_player', $output, $url ); + return apply_filters( 'sm_audio_player', $output, $source ); } /** @@ -483,12 +493,16 @@ function wpfc_sermon_single_v2( $return = false, $post = null ) {
- + + - +
- +
diff --git a/readme.txt b/readme.txt index d33170e..be7cc10 100755 --- a/readme.txt +++ b/readme.txt @@ -123,6 +123,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Dev: Add a filter for filtering sermon image size * Dev: Add more hooks * Dev: Add PHPUnit configuration +* Dev: Add support for WordPress attachment ID for sermon audio files * Dev: Add WPCS configuration * Dev: All terms now support ordering by latest sermon * Dev: Deprecate most of old podcasting functions diff --git a/views/wpfc-podcast-feed.php b/views/wpfc-podcast-feed.php index 951fd01..04e401e 100644 --- a/views/wpfc-podcast-feed.php +++ b/views/wpfc-podcast-feed.php @@ -139,7 +139,9 @@ $sermon_podcast_query->the_post(); global $post; - $audio_raw = str_ireplace( 'https://', 'http://', get_post_meta( $post->ID, 'sermon_audio', true ) ); + $audio_id = get_post_meta( $post->ID, 'sermon_audio_id', true ); + $audio_url = $audio_id ? wp_get_attachment_url( intval( $audio_id ) ) : get_post_meta( $post->ID, 'sermon_audio', true ); + $audio_raw = str_ireplace( 'https://', 'http://', $audio_url ); $audio_p = strrpos( $audio_raw, '/' ) + 1; $audio_raw = urldecode( $audio_raw ); $audio = substr( $audio_raw, 0, $audio_p ) . rawurlencode( substr( $audio_raw, $audio_p ) ); From d4224669a37b60e5289eb12b07cc7598316a5fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sun, 3 Jun 2018 20:30:05 +0200 Subject: [PATCH 099/119] Remove debug code --- includes/class-sm-widget-recent-sermons.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/includes/class-sm-widget-recent-sermons.php b/includes/class-sm-widget-recent-sermons.php index 490b8c1..9ff1094 100755 --- a/includes/class-sm-widget-recent-sermons.php +++ b/includes/class-sm-widget-recent-sermons.php @@ -58,8 +58,6 @@ function widget( $args, $instance ) { ob_start(); - var_dump( $instance ); - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Sermons', 'sermon-manager-for-wordpress' ) : $instance['title'], $instance, $this->id_base ); $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; $before_widget = isset( $instance['before_widget'] ) ? wp_kses_post( $instance['before_widget'] ) : ''; From afb3173f85cce82386999e0998c51dbf32806a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Mon, 4 Jun 2018 02:18:09 +0200 Subject: [PATCH 100/119] Fix CMB2 include path Closes #180 --- includes/vendor/CMB2/init.php | 8 ++++---- readme.txt | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/vendor/CMB2/init.php b/includes/vendor/CMB2/init.php index 0b641e9..b3c1177 100755 --- a/includes/vendor/CMB2/init.php +++ b/includes/vendor/CMB2/init.php @@ -145,15 +145,15 @@ public function include_cmb() { $this->l10ni18n(); // Include helper functions - require_once 'includes/CMB2_Base.php'; - require_once 'includes/CMB2.php'; - require_once 'includes/helper-functions.php'; + require_once __DIR__ . '/includes/CMB2_Base.php'; + require_once __DIR__ . '/includes/CMB2.php'; + require_once __DIR__ . '/includes/helper-functions.php'; // Now kick off the class autoloader spl_autoload_register( 'cmb2_autoload_classes' ); // Kick the whole thing off - require_once 'bootstrap.php'; + require_once __DIR__ . '/bootstrap.php'; if ( function_exists( 'cmb2_bootstrap' ) ) { cmb2_bootstrap(); } diff --git a/readme.txt b/readme.txt index be7cc10..8dacdbb 100755 --- a/readme.txt +++ b/readme.txt @@ -115,6 +115,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: Image size shortcode argument not working * Fix: MP4 video file being detected as YouTube and therefore not working * Fix: SB image import breaking when image is local and does not exist on filesystem +* Fix: Sermon Details meta not loading under very specific circumstances * Fix: Sermons do not appear if published via API and "Date Preached" not set * Fix: Sermons not showing in shortcode under certain timezone conditions * Fix: Sermons menu title is "All Sermons" instead of "Sermons" From bd6fcf79f411688844a480003b7422b6c481b540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Fri, 8 Jun 2018 02:02:34 +0200 Subject: [PATCH 101/119] Add sermon password protection --- includes/sm-template-functions.php | 37 +++++++++++++++++------------- readme.txt | 1 + views/single-wpfc_sermon.php | 9 +++++++- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/includes/sm-template-functions.php b/includes/sm-template-functions.php index a89d173..5fcb191 100755 --- a/includes/sm-template-functions.php +++ b/includes/sm-template-functions.php @@ -647,24 +647,29 @@ function wpfc_sermon_excerpt_v2( $return = false, $args = array() ) {
- - -
- + +
+
+ + + + ID, 'sermon_description', true ), 30 ); ?> + +
+
+
+ +
+ + +
+ +
+ + + -
- -
+ ID, 'sermon_description', true ) ) > 30 ) : ?> +
+ +
+
From 1a608cc266ba907bbdd3f3b1ef10d54e1a1797eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 9 Jun 2018 02:15:07 +0200 Subject: [PATCH 114/119] Fix Sermon Browser services import --- includes/admin/import/class-sm-import-sb.php | 4 ++-- readme.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/admin/import/class-sm-import-sb.php b/includes/admin/import/class-sm-import-sb.php index 121a98e..1297d0c 100644 --- a/includes/admin/import/class-sm-import-sb.php +++ b/includes/admin/import/class-sm-import-sb.php @@ -323,11 +323,11 @@ private function _import_service_types() { $services = apply_filters( 'sm_import_sb_service_types', $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}sb_services" ) ); foreach ( $services as $service ) { - $term_data = term_exists( $service->name, 'wpfc_sermon_series' ); + $term_data = term_exists( $service->name, 'wpfc_service_type' ); if ( $term_data ) { $this->log( 'Term "' . $service->name . '" already exists. (ID: ' . $term_data['term_id'] . ')' ); } else { - $term_data = wp_insert_term( $service->name, 'wpfc_sermon_series' ); + $term_data = wp_insert_term( $service->name, 'wpfc_service_type' ); if ( ! $term_data instanceof WP_Error ) { $this->log( 'Term "' . $service->name . '" imported. (ID: ' . $term_data['term_id'] . ')' ); } else { diff --git a/readme.txt b/readme.txt index 5c182be..f46a60b 100755 --- a/readme.txt +++ b/readme.txt @@ -119,6 +119,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * Fix: Image size shortcode argument not working * Fix: MP4 video file being detected as YouTube and therefore not working * Fix: SB image import breaking when image is local and does not exist on filesystem +* Fix: Sermon Browser services import * Fix: Sermon Details meta not loading under very specific circumstances * Fix: Sermons do not appear if published via API and "Date Preached" not set * Fix: Sermons not showing in shortcode under certain timezone conditions From 814955b312467edd4b75c6478ecf5f31819c3723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 9 Jun 2018 02:53:19 +0200 Subject: [PATCH 115/119] Add some control over import --- includes/admin/class-sm-admin-settings.php | 1 + includes/admin/import/class-sm-import-sb.php | 13 ++-- includes/admin/import/class-sm-import-se.php | 14 +++-- .../settings/class-sm-settings-import.php | 63 +++++++++++++++++++ readme.txt | 1 + 5 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 includes/admin/settings/class-sm-settings-import.php diff --git a/includes/admin/class-sm-admin-settings.php b/includes/admin/class-sm-admin-settings.php index 80e2c44..02909d6 100644 --- a/includes/admin/class-sm-admin-settings.php +++ b/includes/admin/class-sm-admin-settings.php @@ -126,6 +126,7 @@ public static function get_settings_pages() { $settings[] = include 'settings/class-sm-settings-general.php'; $settings[] = include 'settings/class-sm-settings-verse.php'; $settings[] = include 'settings/class-sm-settings-podcast.php'; + $settings[] = include 'settings/class-sm-settings-import.php'; $settings[] = include 'settings/class-sm-settings-debug.php'; self::$settings = apply_filters( 'sm_get_settings_pages', $settings ); diff --git a/includes/admin/import/class-sm-import-sb.php b/includes/admin/import/class-sm-import-sb.php index 1297d0c..6bcf0f3 100644 --- a/includes/admin/import/class-sm-import-sb.php +++ b/includes/admin/import/class-sm-import-sb.php @@ -386,11 +386,12 @@ private function _import_sermons() { foreach ( $sermons as $sermon ) { if ( ! isset( $imported[ $sermon->id ] ) ) { $id = wp_insert_post( apply_filters( 'sm_import_sb_message', array( - 'post_date' => $sermon->datetime, - 'post_content' => '%todo_render%', - 'post_title' => $sermon->title, - 'post_type' => 'wpfc_sermon', - 'post_status' => 'publish', + 'post_date' => $sermon->datetime, + 'post_content' => '%todo_render%', + 'post_title' => $sermon->title, + 'post_type' => 'wpfc_sermon', + 'post_status' => 'publish', + 'comment_status' => SermonManager::getOption( 'import_disallow_comments' ) ? 'closed' : 'open', ) ) ); if ( 0 === $id || $id instanceof WP_Error ) { @@ -468,7 +469,7 @@ private function _import_sermons() { // Set date. update_post_meta( $id, 'sermon_date', strtotime( $sermon->datetime ) ); $this->log( 'Set sermon_date to ' . date( 'c', strtotime( $sermon->datetime ) ), 253 ); - update_post_meta( $id, 'sermon_date_auto', '1' ); + update_post_meta( $id, 'sermon_date_auto', SermonManager::getOption( 'import_disable_auto_dates' ) ? '0' : '1' ); // Set views. update_post_meta( $id, 'Views', $wpdb->get_var( $wpdb->prepare( "SELECT SUM(`count`) FROM {$wpdb->prefix}sb_stuff WHERE `sermon_id` = %d", $sermon->id ) ) ); diff --git a/includes/admin/import/class-sm-import-se.php b/includes/admin/import/class-sm-import-se.php index a5fb1cb..f7ebdec 100644 --- a/includes/admin/import/class-sm-import-se.php +++ b/includes/admin/import/class-sm-import-se.php @@ -278,11 +278,12 @@ private function _import_messages() { if ( ! isset( $imported[ $post_id ] ) ) { if ( null === $the_post ) { $id = wp_insert_post( apply_filters( 'sm_import_se_message', array( - 'post_date' => $message->date . ' 12:00:00', - 'post_content' => '%todo_render%', - 'post_title' => $message->title, - 'post_type' => 'wpfc_sermon', - 'post_status' => 'publish', + 'post_date' => $message->date . ' 12:00:00', + 'post_content' => '%todo_render%', + 'post_title' => $message->title, + 'post_type' => 'wpfc_sermon', + 'post_status' => 'publish', + 'comment_status' => SermonManager::getOption( 'import_disallow_comments' ) ? 'closed' : 'open', ) ) ); } else { $id = wp_insert_post( apply_filters( 'sm_import_se_message', array( @@ -295,6 +296,7 @@ private function _import_messages() { 'post_type' => 'wpfc_sermon', 'post_modified' => $the_post->post_modified, 'post_modified_gmt' => $the_post->post_modified_gmt, + 'comment_status' => SermonManager::getOption( 'import_disallow_comments' ) ? 'closed' : 'open', ) ) ); } @@ -396,7 +398,7 @@ private function _import_messages() { update_post_meta( $id, 'sermon_date', strtotime( $message->date ) ); } - update_post_meta( $id, 'sermon_date_auto', '1' ); + update_post_meta( $id, 'sermon_date_auto', SermonManager::getOption( 'import_disable_auto_dates' ) ? '0' : '1' ); } // Set audio length. diff --git a/includes/admin/settings/class-sm-settings-import.php b/includes/admin/settings/class-sm-settings-import.php new file mode 100644 index 0000000..e5dcffc --- /dev/null +++ b/includes/admin/settings/class-sm-settings-import.php @@ -0,0 +1,63 @@ +id = 'import'; + $this->label = __( 'Import', 'sermon-manager-for-wordpress' ); + + parent::__construct(); + } + + /** + * Get settings array. + * + * @return array + */ + public function get_settings() { + $settings = apply_filters( 'sm_import_settings', array( + array( + 'title' => __( 'Import Settings', 'sermon-manager-for-wordpress' ), + 'type' => 'title', + 'desc' => '', + 'id' => 'import_settings', + ), + array( + 'title' => 'Disallow comments by default', + 'type' => 'checkbox', + 'id' => 'import_disallow_comments', + 'default' => 'no', + ), + array( + 'title' => 'Do not mark preached dates as auto update', + 'type' => 'checkbox', + 'desc' => __( 'If checked, it will show date preached in Edit Sermon view, but it will not auto-update them when Date Published changes.', 'sermon-manager-for-wordpress' ), + 'id' => 'import_disable_auto_dates', + 'default' => 'no', + ), + + array( + 'type' => 'sectionend', + 'id' => 'verse_settings', + ), + ) ); + + return apply_filters( 'sm_get_settings_' . $this->id, $settings ); + } +} + +return new SM_Settings_Import(); diff --git a/readme.txt b/readme.txt index f46a60b..46336e7 100755 --- a/readme.txt +++ b/readme.txt @@ -109,6 +109,7 @@ Visit the [plugin homepage](https://wpforchurch.com/wordpress-plugins/sermon-man * New: Add revisions support (thanks @robertmain!) * New: Add support for sermon password protection * New: Add working file for rendering the feed +* New: Add a tab in settings for controlling the import * Change: Add more options to the recent sermons widget * Change: Add a way to get sermon's series image * Change: Add an option to hide read more when it's not needed From eb958f1cdfa9a0386defd34b6c8579b63a1bcc29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 9 Jun 2018 03:17:36 +0200 Subject: [PATCH 116/119] Remove auto generated excerpts and disable them Closes #212 --- .../settings/class-sm-settings-debug.php | 12 ---- includes/class-sm-install.php | 4 ++ includes/sm-update-functions.php | 25 ++++++++ sermons.php | 58 +------------------ 4 files changed, 31 insertions(+), 68 deletions(-) diff --git a/includes/admin/settings/class-sm-settings-debug.php b/includes/admin/settings/class-sm-settings-debug.php index cb16b0c..66208e8 100644 --- a/includes/admin/settings/class-sm-settings-debug.php +++ b/includes/admin/settings/class-sm-settings-debug.php @@ -71,18 +71,6 @@ public function get_settings() { 'id' => 'post_content_enabled', 'default' => 1, ), - array( - 'title' => 'Automatic "post_excerpt" creation', - 'type' => 'select', - 'options' => array( - 1 => 'Enable', - 11 => 'Enable and re-create all', - 0 => 'Disable', - 10 => 'Disable and flush existing', - ), - 'id' => 'post_excerpt_enabled', - 'default' => 1, - ), array( 'title' => 'Use home_url in dropdown filter', 'type' => 'checkbox', diff --git a/includes/class-sm-install.php b/includes/class-sm-install.php index 8845ed8..44f6844 100644 --- a/includes/class-sm-install.php +++ b/includes/class-sm-install.php @@ -46,6 +46,10 @@ class SM_Install { '2.12.3' => array( 'sm_update_2123_fix_preacher_permalink', ), + '2.13.0' => array( + 'sm_update_2130_fill_out_sermon_term_dates', + 'sm_update_2130_remove_excerpts', + ), ); /** diff --git a/includes/sm-update-functions.php b/includes/sm-update-functions.php index b77fbbd..f96e655 100644 --- a/includes/sm-update-functions.php +++ b/includes/sm-update-functions.php @@ -261,3 +261,28 @@ function sm_update_2130_fill_out_sermon_term_dates() { // Mark it as done, backup way. update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); } + +/** + * Removes old auto-generated excerpts + */ +function sm_update_2130_remove_excerpts() { + $sermons = new WP_Query( array( + 'post_type' => 'wpfc_sermon', + 'meta_key' => 'sermon_date', + 'meta_value_num' => time(), + 'meta_compare' => '<=', + 'orderby' => 'meta_value_num', + 'order' => 'DESC', + 'posts_per_page' => - 1, + ) ); + + foreach ( $sermons->posts as $sermon ) { + wp_update_post( array( + 'ID' => $sermon->ID, + 'post_excerpt' => '', + ) ); + } + + // Mark it as done, backup way. + update_option( 'wp_sm_updater_' . __FUNCTION__ . '_done', 1 ); +} diff --git a/sermons.php b/sermons.php index c843a8e..e103aa4 100755 --- a/sermons.php +++ b/sermons.php @@ -267,37 +267,6 @@ public function __construct() { return $value; } ); - - add_action( 'sm_admin_settings_sanitize_option_post_excerpt_enabled', function ( $value ) { - $value = intval( $value ); - - if ( $value >= 10 ) { - global $wpdb, $skip_excerpt_check; - - $skip_excerpt_check = true; - - $sm = SermonManager::get_instance(); - - // All sermons. - $sermons = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s", 'wpfc_sermon' ) ); - - foreach ( $sermons as $sermon ) { - $sermon_id = $sermon->ID; - - if ( 11 === $value ) { - $sm->render_sermon_into_content( $sermon_id, null, true ); - } else { - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_excerpt = '' WHERE ID = %d", $sermon_id ) ); - } - } - - $skip_excerpt_check = false; - - $value = intval( substr( $value, 1 ) ); - } - - return $value; - } ); } /** @@ -374,7 +343,7 @@ public static function get_instance() { * @since 2.8 */ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_check = false ) { - global $wpdb, $skip_excerpt_check, $skip_content_check; + global $wpdb, $skip_content_check; if ( null === $post ) { $post = get_post( $post_ID ); @@ -443,31 +412,8 @@ public function render_sermon_into_content( $post_ID = 0, $post = null, $skip_ch } } - if ( \SermonManager::getOption( 'post_excerpt_enabled', 1 ) ) { - // Only generate our post excerpt if excerpt generation is turned on - - $excerpt = ! $content ? '' : wp_trim_excerpt( $content ); - - /** - * Allows to modify sermon content that will be saved as "post_excerpt". - * - * @param string $excerpt Textual content (no HTML), limited to 55 words by default. - * @param int $post_ID ID of the sermon. - * @param WP_Post $post Sermon post object. - * @param bool $skip_check Basically, a way to identify if the function is being executed from the update function or not. - * - * @since 2.11.0 - */ - $excerpt = apply_filters( 'sm_sermon_post_excerpt', $excerpt, $post_ID, $post, $skip_check ); - $excerpt = apply_filters( "sm_sermon_post_excerpt_$post_ID", $excerpt, $post_ID, $post, $skip_check ); - } else { - // Otherwise, go with whatever the user typed in... - $excerpt = $post->post_excerpt; - } - - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = %s, `post_excerpt` = %s WHERE `ID` = %s", array( + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET `post_content` = %s WHERE `ID` = %s", array( $content, - $excerpt, $post_ID, ) ) ); } From f31fcbee9d0c40fc0d9ef1250f628ccca43db985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 9 Jun 2018 03:19:50 +0200 Subject: [PATCH 117/119] Fix setting label --- includes/admin/settings/class-sm-settings-general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/settings/class-sm-settings-general.php b/includes/admin/settings/class-sm-settings-general.php index 3607b06..bac5d92 100644 --- a/includes/admin/settings/class-sm-settings-general.php +++ b/includes/admin/settings/class-sm-settings-general.php @@ -66,7 +66,7 @@ public function get_settings() { 'type' => 'checkbox', 'desc' => __( 'Disable Sermon CSS', 'sermon-manager-for-wordpress' ), // translators: %s effectively sermons.css. - 'desc_tip' => wp_sprintf( __( 'If you do this, you should copy the styles from %s and include them in your theme CSS.', 'sermon-manager-for-wordpress' ), 'sermons.css' ), + 'desc_tip' => wp_sprintf( __( 'If you do this, you should copy the styles from %s and include them in your theme CSS.', 'sermon-manager-for-wordpress' ), '/assets/css/sermon.min.css' ), 'id' => 'css', 'default' => 'no', ), From b151fab5b7530e5201845661893cda7bcbe5c68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 9 Jun 2018 03:26:54 +0200 Subject: [PATCH 118/119] Move code to the right place --- includes/class-sm-post-types.php | 40 ----------------------- includes/class-sm-roles.php | 56 ++++++++++++++++++++++++++++++++ sermons.php | 1 + 3 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 includes/class-sm-roles.php diff --git a/includes/class-sm-post-types.php b/includes/class-sm-post-types.php index a6b77ff..f0db1de 100644 --- a/includes/class-sm-post-types.php +++ b/includes/class-sm-post-types.php @@ -282,46 +282,6 @@ public static function register_post_types() { ), ) ) ); - // Add sermon managing capabilities to administrator, editor, author. - $role = get_role( 'administrator' ); - if ( is_object( $role ) && ! $role->has_cap( 'edit_wpfc_sermon' ) ) { - $role_list = array( 'administrator', 'editor', 'author' ); - foreach ( $role_list as $role_name ) { - $role = get_role( $role_name ); - if ( null === $role || ! ( $role instanceof WP_Role ) ) { - continue; - } - // Read sermons. - $role->add_cap( 'read_wpfc_sermon' ); - // Edit sermons. - $role->add_cap( 'edit_wpfc_sermon' ); - $role->add_cap( 'edit_wpfc_sermons' ); - $role->add_cap( 'edit_private_wpfc_sermons' ); - $role->add_cap( 'edit_published_wpfc_sermons' ); - // Delete sermons. - $role->add_cap( 'delete_wpfc_sermon' ); - $role->add_cap( 'delete_wpfc_sermons' ); - $role->add_cap( 'delete_published_wpfc_sermons' ); - $role->add_cap( 'delete_private_wpfc_sermons' ); - // Publish sermons. - $role->add_cap( 'publish_wpfc_sermons' ); - // Read private sermons. - $role->add_cap( 'read_private_wpfc_sermons' ); - // Manage categories & tags. - $role->add_cap( 'manage_wpfc_categories' ); - // Add additional roles for administrator - if ( 'administrator' === $role_name ) { - // Access to Sermon Manager Settings. - $role->add_cap( 'manage_wpfc_sm_settings' ); - } - // Add additional roles for administrator and editor - if ( 'author' !== $role_name ) { - $role->add_cap( 'edit_others_wpfc_sermons' ); - $role->add_cap( 'delete_others_wpfc_sermons' ); - } - } - } - do_action( 'sm_after_register_post_type' ); } diff --git a/includes/class-sm-roles.php b/includes/class-sm-roles.php new file mode 100644 index 0000000..4d3ff83 --- /dev/null +++ b/includes/class-sm-roles.php @@ -0,0 +1,56 @@ +add_cap( 'read_wpfc_sermon' ); + // Edit sermons. + $role->add_cap( 'edit_wpfc_sermon' ); + $role->add_cap( 'edit_wpfc_sermons' ); + $role->add_cap( 'edit_private_wpfc_sermons' ); + $role->add_cap( 'edit_published_wpfc_sermons' ); + // Delete sermons. + $role->add_cap( 'delete_wpfc_sermon' ); + $role->add_cap( 'delete_wpfc_sermons' ); + $role->add_cap( 'delete_published_wpfc_sermons' ); + $role->add_cap( 'delete_private_wpfc_sermons' ); + // Publish sermons. + $role->add_cap( 'publish_wpfc_sermons' ); + // Read private sermons. + $role->add_cap( 'read_private_wpfc_sermons' ); + // Manage categories & tags. + $role->add_cap( 'manage_wpfc_categories' ); + // Add additional roles for administrator + if ( 'administrator' === $role_name ) { + // Access to Sermon Manager Settings. + $role->add_cap( 'manage_wpfc_sm_settings' ); + } + // Add additional roles for administrator and editor + if ( 'author' !== $role_name ) { + $role->add_cap( 'edit_others_wpfc_sermons' ); + $role->add_cap( 'delete_others_wpfc_sermons' ); + } + } + } +} + +SM_Roles::init(); diff --git a/sermons.php b/sermons.php index c843a8e..b5133e3 100755 --- a/sermons.php +++ b/sermons.php @@ -316,6 +316,7 @@ private function _includes() { include SM_PATH . 'includes/class-sm-api.php'; // API. include SM_PATH . 'includes/class-sm-post-types.php'; // Register post type, taxonomies, etc. include SM_PATH . 'includes/class-sm-install.php'; // Install and update functions. + include SM_PATH . 'includes/class-sm-roles.php'; // Adds roles support. include SM_PATH . 'includes/sm-deprecated-functions.php'; // Deprecated SM functions. include SM_PATH . 'includes/sm-formatting-functions.php'; // Data formatting. include SM_PATH . 'includes/vendor/taxonomy-images/taxonomy-images.php'; // Images for Custom Taxonomies. From bc6e55e69207f25433e38596fc02d11155f265dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Miljkovi=C4=87?= Date: Sat, 9 Jun 2018 03:30:42 +0200 Subject: [PATCH 119/119] Update versions --- readme.txt | 2 +- sermons.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 630fd35..96fa9a3 100755 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: church, sermon, sermons, preaching, podcasting, manage, managing, podcasts Requires at least: 4.7.0 Tested up to: 4.9 Requires PHP: 5.3 -Stable tag: 2.12.5 +Stable tag: 2.13.0 License: GPLv2 License URI: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/sermons.php b/sermons.php index 987cffc..45cd7ae 100755 --- a/sermons.php +++ b/sermons.php @@ -3,7 +3,7 @@ * Plugin Name: Sermon Manager for WordPress * Plugin URI: https://www.wpforchurch.com/products/sermon-manager-for-wordpress/ * Description: Add audio and video sermons, manage speakers, series, and more. - * Version: 2.12.5 + * Version: 2.13.0 * Author: WP for Church * Author URI: https://www.wpforchurch.com/ * Requires at least: 4.5