Plugin Directory

Changeset 1806332


Ignore:
Timestamp:
01/20/2018 06:48:27 PM (8 years ago)
Author:
frankverhoeven
Message:

push 3.1.2

Location:
fv-community-news/trunk
Files:
37 added
9 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • fv-community-news/trunk/composer.json

    r1799949 r1806332  
    1313  "prefer-stable": true,
    1414  "require": {
    15     "php": "^5.6"
     15    "php": "^7.0"
    1616  },
    1717  "autoload": {
  • fv-community-news/trunk/fv-community-news.php

    r1799949 r1806332  
    55 * Plugin URI:  https://frankverhoeven.me/wordpress-plugin-fv-community-news/
    66 * Description: Allow visitors of your site to submit articles.
    7  * Version:     3.1.1
     7 * Version:     3.1.2
    88 * Author:      Frank Verhoeven
    99 * Author URI:  https://frankverhoeven.me/
    1010 */
    1111
    12 use FvCommunityNews\Application\Application;
    13 use FvCommunityNews\Options;
    14 use FvCommunityNews\Registry;
     12use FvCommunityNews\AutoLoader;
     13use FvCommunityNews\Config\WordPress as Config;
     14use FvCommunityNews\Container\Container;
     15use FvCommunityNews\Hook\Collection as HookCollection;
    1516
    1617if (!defined('ABSPATH')) exit;
     
    2627     * @var string
    2728     */
    28     const VERSION = '3.1.1';
     29    const VERSION = '3.1.2';
    2930    /**
    3031     * @var string
     
    3536     */
    3637    const FILE = __FILE__;
     38    /**
     39     * @var Container
     40     */
     41    public static $container;
    3742
    3843    /**
    3944     * __construct()
    4045     *
    41      * @version 20120709
    4246     */
    4347    public function __construct()
    44     {}
    45 
    46     /**
    47      * start()
    48      *
    49      * @version 20120710
    50      */
    51     public function start()
    5248    {
    53         $this->loadFiles()
    54              ->setupVariables();
    55 
    56         $app = new Application(include __DIR__ . '/config/default.config.php');
    57         $app->run();
     49        register_activation_hook(__FILE__, [static::class, 'activation']);
     50        register_deactivation_hook(__FILE__, [static::class, 'deactivation']);
    5851    }
    5952
    6053    /**
    61      * loadFiles()
     54     * Start the application
    6255     *
    63      * @version 20120716
    64      * @return FvCommunityNews
    65      * @throws Exception
     56     * @return void
    6657     */
    67     private function loadFiles()
     58    public function start(): void
     59    {
     60        $this->loadFiles();
     61
     62        $services = include __DIR__ . '/config/services.config.php';
     63        $services['Config'] = new Config(include __DIR__ . '/config/default.config.php');
     64        static::$container = new Container($services);
     65
     66        $hooks = new HookCollection(static::$container);
     67        $hooks->register();
     68    }
     69
     70    /**
     71     * Setup autoloader and load non-class files.
     72     *
     73     * @return void
     74     */
     75    private function loadFiles(): void
    6876    {
    6977        include_once __DIR__ . '/src/Autoloader.php';
    7078
    71         $autoloader = new \FvCommunityNews\AutoLoader(['FvCommunityNews' => __DIR__ . '/src/']);
     79        $autoloader = new AutoLoader(['FvCommunityNews' => __DIR__ . '/src/']);
    7280        $autoloader->register();
    7381
    7482        $files = [
    7583            '/fvcn-includes/fvcn-core-theme.php',
    76             '/fvcn-includes/fvcn-common-functions.php',
    7784            '/fvcn-includes/fvcn-post-functions.php',
    7885
     
    8794            $autoloader->loadFile(__DIR__ . $file);
    8895        }
    89 
    90         return $this;
    9196    }
    9297
    9398    /**
    94      * setupVariables()
     99     * Activation Hook
    95100     *
    96      * @todo: remove
     101     * @return void
     102     */
     103    public static function activation(): void
     104    {
     105        do_action('fvcn_activation');
     106        register_uninstall_hook(__FILE__, [static::class, 'uninstall']);
     107    }
     108
     109    /**
     110     * Deactivation Hook
    97111     *
    98      * @version 20120710
    99      * @return FvCommunityNews
     112     * @return void
    100113     */
    101     private function setupVariables()
     114    public static function deactivation(): void
    102115    {
    103         $pluginDir = plugin_dir_path(__FILE__);
    104         $pluginUrl = plugin_dir_url(__FILE__);
    105         $baseSlug = Options::fvcnGetOption('_fvcn_base_slug');
     116        do_action('fvcn_deactivation');
     117    }
    106118
    107         Registry::setInstance(new Registry([
    108             'pluginDir' => $pluginDir,
    109             'pluginUrl' => $pluginUrl,
    110 
    111             'themeDir' => $pluginDir . 'fvcn-theme',
    112             'themeUrl' => $pluginUrl . 'fvcn-theme',
    113 
    114             'postSlug' => $baseSlug . '/' . Options::fvcnGetOption('_fvcn_post_slug'),
    115             'postTagSlug' => $baseSlug . '/' . Options::fvcnGetOption('_fvcn_post_tag_slug'),
    116             'postArchiveSlug'=> $baseSlug . '/' . Options::fvcnGetOption('_fvcn_post_archive_slug'),
    117         ]));
    118 
    119         return $this;
     119    /**
     120     * Uninstall Hook
     121     *
     122     * @return void
     123     */
     124    public static function uninstall(): void
     125    {
     126        do_action('fvcn_uninstall');
    120127    }
    121128}
  • fv-community-news/trunk/fvcn-includes/fvcn-core-theme.php

    r1773960 r1806332  
    22
    33use FvCommunityNews\Post\PostType;
    4 use FvCommunityNews\Registry;
    54
    65/**
    76 * fvcn_get_theme_dir()
    87 *
    9  * @version 20120531
    10  * @return string
    11  */
    12 function fvcn_get_theme_dir()
    13 {
    14     return apply_filters('fvcn_get_theme_dir', Registry::get('themeDir'));
     8 * @return string
     9 */
     10function fvcn_get_theme_dir(): string
     11{
     12    $reg = FvCommunityNews::$container->get('Registry');
     13    return apply_filters('fvcn_get_theme_dir', $reg['themeDir']);
    1514}
    1615
     
    1918 * fvcn_get_theme_url()
    2019 *
    21  * @version 20120531
    22  * @return string
    23  */
    24 function fvcn_get_theme_url()
    25 {
    26     return apply_filters('fvcn_get_theme_url', Registry::get('themeUrl'));
     20 * @return string
     21 */
     22function fvcn_get_theme_url(): string
     23{
     24    $reg = FvCommunityNews::$container->get('Registry');
     25    return apply_filters('fvcn_get_theme_url', $reg['themeUrl']);
     26}
     27
     28
     29/**
     30 * fvcn_template_include()
     31 *
     32 * @param string $template
     33 * @return string
     34 */
     35function fvcn_template_include($template = ''): string
     36{
     37    return apply_filters('fvcn_template_include', $template);
    2738}
    2839
     
    3142 * fvcn_theme_get_template_part()
    3243 *
    33  * @version 20120716
    3444 * @param string $slug
    3545 * @param string $name
     
    5464 * fvcn_get_query_template()
    5565 *
    56  * @version 20120716
    5766 * @param string $type
    5867 * @param array $templates
     
    6170function fvcn_get_query_template($type, $templates)
    6271{
     72    $reg = FvCommunityNews::$container->get('Registry');
    6373    $templates = apply_filters('fvcn_get_' . $type . '_template', $templates);
    6474
    6575    if ('' == ($template = locate_template($templates))) {
    66         Registry::set('themeCompatActive', true);
    67     } else {
    68         Registry::set('themeCompatActive', false);
     76        $reg['themeCompatActive'] = true;
     77    } else {
     78        $reg['themeCompatActive'] = false;
    6979    }
    7080
     
    7686 * fvcn_theme_get_single_post_template()
    7787 *
    78  * @version 20120806
    7988 * @return string
    8089 */
     
    91100 * fvcn_theme_get_post_archive_template()
    92101 *
    93  * @version 20120806
    94102 * @return string
    95103 */
     
    106114 * fvcn_theme_get_post_tag_archive_template()
    107115 *
    108  * @version 20120806
    109116 * @return string
    110117 */
     
    119126
    120127/**
    121  * fvcn_enqueue_theme_css()
    122  *
    123  * @version 20120717
    124  */
    125 function fvcn_theme_enqueue_css()
    126 {
    127     if (!fvcn_theme_is_compat_active() && file_exists(get_stylesheet_directory() . '/fvcn/css/fvcn-theme.css')) {
    128         $uri = get_stylesheet_directory_uri();
    129     } else {
    130         $uri = fvcn_get_theme_url();
    131     }
    132 
    133     wp_enqueue_style('fvcn-theme', $uri . '/fvcn/css/fvcn-theme.css', '', fvcn_get_version(), 'all');
    134 }
    135 
    136 
    137 /**
    138128 * fvcn_theme_compat_active()
    139129 *
    140  * @version 20120716
    141130 * @return bool
    142131 */
     
    144133{
    145134    $active = true;
    146 
    147     if (false === Registry::get('themeCompatActive')) {
     135    $reg = FvCommunityNews::$container->get('Registry');
     136
     137    if (false === $reg['themeCompatActive']) {
    148138        $active = false;
    149139    }
     
    156146 * fvcn_theme_compat_template_include()
    157147 *
    158  * @version 20120716
    159148 * @param string $template
    160149 * @return string
     
    170159    } elseif (fvcn_is_post_archive()) {
    171160        $newTemplate = fvcn_theme_get_post_archive_template();
    172     } elseif (fvcn_is_post_tag_archive()) {
     161    } else {
    173162        $newTemplate = fvcn_theme_get_post_tag_archive_template();
    174163    }
     
    187176 * fvcn_theme_compat_replace_the_content()
    188177 *
    189  * @version 20120707
    190178 * @param string $content
    191179 * @return string
  • fv-community-news/trunk/fvcn-includes/fvcn-post-functions.php

    r1773960 r1806332  
    99 * fvcn_insert_post()
    1010 *
    11  * @version 20120322
    1211 *
    1312 * @param array $post_data
     
    6059 * fvcn_insert_post_thumbnail()
    6160 *
    62  * @version 20120307
    6361 * @param int $postId
    6462 * @return int
     
    8179 * fvcn_new_post_handler()
    8280 *
    83  * @version 20120808
     81 * @return int|void
    8482 */
    8583function fvcn_new_post_handler()
     
    308306 * fvcn_filter_new_post_data()
    309307 *
    310  * @version 20120710
    311308 * @param array $data
    312309 * @return array
     
    326323 * fvcn_increase_post_view_count()
    327324 *
    328  * @version 20120722
    329325 * @param string $template
    330326 * @return string
     
    341337    }
    342338
    343     $postMapper = new FvCommunityNews_PostMapper();
     339    $postMapper = new \FvCommunityNews\Post\Mapper();
    344340    $postMapper->increasePostViewCount($id);
    345341
     
    351347
    352348/**
    353  * fvcn_publish_post()
    354  *
    355  * @version 20120722
    356  * @param int $postId
    357  * @return int
    358  */
    359 function fvcn_publish_post($postId)
    360 {
    361     $postMapper = new FvCommunityNews_PostMapper();
    362     return $postMapper->publishPost($postId);
    363 }
    364 
    365 
    366 /**
    367  * fvcn_unpublish_post()
    368  *
    369  * @version 20120722
    370  * @param int $postId
    371  * @return int
    372  */
    373 function fvcn_unpublish_post($postId)
    374 {
    375     $postMapper = new FvCommunityNews_PostMapper();
    376     return $postMapper->unpublishPost($postId);
    377 }
    378 
    379 
    380 /**
    381  * fvcn_spam_post()
    382  *
    383  * @version 20120722
    384  * @param int $postId
    385  * @return int
    386  */
    387 function fvcn_spam_post($postId)
    388 {
    389     $postMapper = new FvCommunityNews_PostMapper();
    390     return $postMapper->spamPost($postId);
    391 }
    392 
    393 
    394 /**
    395349 * fvcn_post_rating_handler()
    396350 *
    397  * @version 20120722
    398351 */
    399352function fvcn_post_rating_handler()
     
    416369    check_admin_referer('fvcn-post-rating');
    417370
    418     $postMapper = new FvCommunityNews_PostMapper();
     371    $postMapper = new \FvCommunityNews\Post\Mapper();
    419372    if ('increase' == $_REQUEST['fvcn_post_rating_action']) {
    420373        $postMapper->increasePostRating($id);
     
    427380    wp_redirect(fvcn_get_post_permalink($id));
    428381}
    429 
    430 
    431 /**
    432  * FvCommunityNews_PostMapper
    433  *
    434  */
    435 class FvCommunityNews_PostMapper
    436 {
    437     /**
    438      * changePostStatus()
    439      *
    440      * @version 20120722
    441      * @param int $postId
    442      * @param string $status
    443      * @return int
    444      */
    445     protected function changePostStatus($postId, $status)
    446     {
    447         $post = [];
    448         $post['ID'] = $postId;
    449         $post['post_status'] = $status;
    450 
    451         return wp_update_post($post);
    452     }
    453 
    454     /**
    455      * publishPost()
    456      *
    457      * @version 20120722
    458      * @param int $postId
    459      * @return int
    460      */
    461     public function publishPost($postId)
    462     {
    463         do_action('fvcn_publish_post', $postId);
    464 
    465         return $this->changePostStatus($postId, PostType::STATUS_PUBLISH);
    466     }
    467 
    468     /**
    469      * unpublishPost()
    470      *
    471      * @version 20120722
    472      * @param int $postId
    473      * @return int
    474      */
    475     public function unpublishPost($postId)
    476     {
    477         do_action('fvcn_unpublish_post', $postId);
    478 
    479         return $this->changePostStatus($postId, PostType::STATUS_PENDING);
    480     }
    481 
    482     /**
    483      * spamPost()
    484      *
    485      * @version 20120728
    486      * @param int $postId
    487      * @return int
    488      */
    489     public function spamPost($postId)
    490     {
    491         do_action('fvcn_spam_post', $postId);
    492 
    493         return $this->changePostStatus($postId, PostType::STATUS_SPAM);
    494     }
    495 
    496     /**
    497      * increasePostRating()
    498      *
    499      * @version 20120722
    500      * @param int $postId
    501      */
    502     public function increasePostRating($postId)
    503     {
    504         do_action('fvcn_increase_post_rating', $postId);
    505 
    506         update_post_meta($postId, '_fvcn_post_rating', fvcn_get_post_rating($postId)+1);
    507     }
    508 
    509     /**
    510      * decreasePostRating()
    511      *
    512      * @version 20120722
    513      * @param int $postId
    514      */
    515     public function decreasePostRating($postId)
    516     {
    517         do_action('fvcn_decrease_post_rating', $postId);
    518 
    519         update_post_meta($postId, '_fvcn_post_rating', fvcn_get_post_rating($postId)-1);
    520     }
    521 
    522     /**
    523      * increasePostViewCount()
    524      *
    525      * @version 20120724
    526      * @param int $postId
    527      */
    528     public function increasePostViewCount($postId)
    529     {
    530         do_action('fvcn_increase_post_view_count', $postId);
    531 
    532         update_post_meta($postId, '_fvcn_post_views', fvcn_get_post_views($postId)+1);
    533     }
    534 }
  • fv-community-news/trunk/fvcn-theme/archive-fvcn.php

    r1773960 r1806332  
    44 * The Template for displaying the archive of community posts.
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
  • fv-community-news/trunk/fvcn-theme/fvcn/content-archive-post.php

    r1773960 r1806332  
    44 * content-archive-post.php
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
  • fv-community-news/trunk/fvcn-theme/fvcn/content-single-post.php

    r1760963 r1806332  
    66 * Displays a single posts content'
    77 *
    8  * @version    20120716
    98 * @package    FV Community News
    109 * @subpackage Theme
     
    3029</div><!-- .entry-content -->
    3130
    32 <footer class="fvcn-post-meta">
     31<div class="fvcn-post-meta">
    3332    <span class="fvcn-post-tags">
    3433        <?php fvcn_post_tag_list(0, ['before'=>__('Tags: ', 'fvcn'), 'after'=>'']); ?>
     
    4645        <?php endif; ?>
    4746    </span>
    48 </footer><!-- .entry-meta -->
     47</div><!-- .entry-meta -->
  • fv-community-news/trunk/fvcn-theme/fvcn/css/fvcn-theme.css

    r1773960 r1806332  
    33 *
    44 * @author Frank Verhoeven <[email protected]>
    5  * @version 20171112
    65 */
    76
     
    3231}
    3332
    34 .fvcn-post-link {
    35     font-weight: bold;
    36     font-size: 1.1em;
    37 }
     33.fvcn-post-link {}
    3834
    3935
     
    7268 *
    7369 */
    74 .fvcn-post-form-ajax-loader {
    75     display: none;
    76     text-align: center;
    77     float: none !important;
    78     clear: both;
    79 }
    80 
    81 .fvcn-post-form-ajax-loader p {
    82     margin-bottom: 0;
    83 }
    84 
    85 .fvcn-post-form-ajax-loader .fvcn-post-form-ajax-progress-bar-outer {
    86     width: 120px;
    87     height: 4px !important;
    88     margin: 0 auto;
    89     border: 1px solid #bbb;
    90     background: #fff;
    91     padding: 1px !important;
    92     border-radius: 6px !important;
    93     float: none !important;
    94 }
    95 
    96 .fvcn-post-form-ajax-loader .fvcn-post-form-ajax-progress-bar-inner {
    97     width: 0;
    98     padding: 0 !important;
    99     height: 4px !important;
    100     background: #1982d1;
    101     border-radius: 2px !important;
    102     float: none !important;
    103 }
    104 
    10570.fvcn_form_widget .fvcn-post-form input[type="text"],
    10671.fvcn_form_widget .fvcn-post-form input[type="file"],
     
    10873    width: 100%;
    10974}
     75
     76.fvcn-post-form-loader {
     77    margin-top: 1.5em;
     78    margin-left: .5em;
     79    display: none;
     80}
     81
     82.fvcn-post-form-loader-img {
     83    width: 1em;
     84    height: 1em;
     85    overflow: hidden;
     86    -webkit-animation: spin 1.5s linear infinite;
     87    -moz-animation: spin 1.5s linear infinite;
     88    animation: spin 1.5s linear infinite;
     89}
     90
     91@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
     92@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
     93@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
  • fv-community-news/trunk/fvcn-theme/fvcn/feedback-no-anonymous.php

    r1760963 r1806332  
    77 *     logged in, in order to post.
    88 *
    9  * @version    20120317
    109 * @package    FV Community News
    1110 * @subpackage Theme
  • fv-community-news/trunk/fvcn-theme/fvcn/feedback-no-posts.php

    r1760963 r1806332  
    66 * The message that will be displayed when there are no posts.
    77 *
    8  * @version    20120318
    98 * @package    FV Community News
    109 * @subpackage Theme
  • fv-community-news/trunk/fvcn-theme/fvcn/form-post.php

    r1773960 r1806332  
    66 * The form for submitting community news.
    77 *
    8  * @version    20171112
    98 * @package    FV Community News
    109 * @subpackage Theme
     
    1312?>
    1413
    15 <?php if (fvcn_is_post_added()) : ?>
     14<?php if (fvcn_is_post_added()): ?>
    1615
    1716<?php do_action('fvcn_post_added_before'); ?>
    1817<div class="fvcn-post-added">
    19     <?php if (fvcn_is_post_added_approved()) : ?>
     18    <?php if (fvcn_is_post_added_approved()): ?>
    2019        <p><?php _e('Your post has been added.', 'fvcn'); ?></p>
    21     <?php else : ?>
     20    <?php else: ?>
    2221        <p><?php _e('Your post has been added and is pending review.', 'fvcn'); ?></p>
    2322    <?php endif; ?>
     
    2524<?php do_action('fvcn_post_added_after'); ?>
    2625
    27 <?php else : ?>
     26<?php else: ?>
    2827
    2928<?php do_action('fvcn_post_form_before'); ?>
     
    3433    </div>
    3534
    36     <form class="fvcn-post-form-new-post" method="post" action=""<?php if (fvcn_is_post_form_thumbnail_enabled()) : ?> enctype="multipart/form-data"<?php endif; ?>>
     35    <form class="fvcn-post-form-new-post" method="post" action=""<?php if (fvcn_is_post_form_thumbnail_enabled()): ?> enctype="multipart/form-data"<?php endif; ?>>
    3736        <?php do_action('fvcn_post_form_extras_top'); ?>
    3837
    39         <?php if (fvcn_is_anonymous()) : ?>
     38        <?php if (fvcn_is_anonymous()): ?>
    4039
    4140            <?php do_action('fvcn_post_form_before_author_name'); ?>
     
    5958            <?php do_action('fvcn_post_form_after_author_email'); ?>
    6059
    61         <?php else : ?>
     60        <?php else: ?>
    6261
    6362            <div class="fvcn-post-form-author-logged-in">
     
    107106        <?php do_action('fvcn_post_form_after_tags'); ?>
    108107
    109         <?php if (fvcn_is_post_form_thumbnail_enabled()) : ?>
     108        <?php if (fvcn_is_post_form_thumbnail_enabled()): ?>
    110109
    111110            <?php do_action('fvcn_post_form_before_thumbnail'); ?>
     
    125124        <div class="fvcn-post-form-submit">
    126125            <input type="submit" name="fvcn_post_form_submit" id="fvcn_post_form_submit" value="<?php _e('Submit', 'fvcn'); ?>">
     126
     127            <span class="fvcn-post-form-loader">
     128                <svg class="fvcn-post-form-loader-img" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
     129                    <path d="M440.935 12.574l3.966 82.766C399.416 41.904 331.674 8 256 8 134.813 8 33.933 94.924 12.296 209.824 10.908 217.193 16.604 224 24.103 224h49.084c5.57 0 10.377-3.842 11.676-9.259C103.407 137.408 172.931 80 256 80c60.893 0 114.512 30.856 146.104 77.801l-101.53-4.865c-6.845-.328-12.574 5.133-12.574 11.986v47.411c0 6.627 5.373 12 12 12h200.333c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12h-47.411c-6.853 0-12.315 5.729-11.987 12.574zM256 432c-60.895 0-114.517-30.858-146.109-77.805l101.868 4.871c6.845.327 12.573-5.134 12.573-11.986v-47.412c0-6.627-5.373-12-12-12H12c-6.627 0-12 5.373-12 12V500c0 6.627 5.373 12 12 12h47.385c6.863 0 12.328-5.745 11.985-12.599l-4.129-82.575C112.725 470.166 180.405 504 256 504c121.187 0 222.067-86.924 243.704-201.824 1.388-7.369-4.308-14.176-11.807-14.176h-49.084c-5.57 0-10.377 3.842-11.676 9.259C408.593 374.592 339.069 432 256 432z"></path>
     130                </svg>
     131            </span>
    127132        </div>
    128133        <?php do_action('fvcn_post_form_after_submit'); ?>
    129134
    130135        <?php fvcn_post_form_fields(); ?>
     136
     137
    131138
    132139        <?php do_action('fvcn_post_form_extras_bottom'); ?>
  • fv-community-news/trunk/fvcn-theme/fvcn/loop-posts.php

    r1760963 r1806332  
    44 * loop-posts.php
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
  • fv-community-news/trunk/fvcn-theme/fvcn/loop-single-post.php

    r1760963 r1806332  
    44 * loop-single-post.php
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
  • fv-community-news/trunk/fvcn-theme/fvcn/widget-loop-posts.php

    r1760963 r1806332  
    44 * widget-loop-posts.php
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
     
    1110?>
    1211
    13 <ul class="fvcn-list-posts-widget">
     12<div class="fvcn-list-posts-widget">
    1413
    1514    <?php while (fvcn_posts()) : fvcn_the_post(); ?>
     
    1918    <?php endwhile; ?>
    2019
    21 </ul>
     20</div>
    2221
    2322<?php if (fvcn_show_widget_view_all()) : ?>
  • fv-community-news/trunk/fvcn-theme/fvcn/widget-loop-single-post.php

    r1773960 r1806332  
    44 * widget-loop-single-post.php
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
     
    1110?>
    1211
    13 <li id="fvcn-post-<?php fvcn_post_id(); ?>" class="fvcn-post">
    14     <h4><a href="<?php fvcn_has_post_link() ? fvcn_post_link() : fvcn_post_permalink(); ?>"><?php fvcn_post_title(); ?></a></h4>
     12<h5><a href="<?php fvcn_has_post_link() ? fvcn_post_link() : fvcn_post_permalink(); ?>"><?php fvcn_post_title(); ?></a></h5>
    1513
    16     <div class="fvcn-post-content">
    17         <?php if (fvcn_has_post_thumbnail() && fvcn_show_widget_thumbnail()) : ?>
    18             <div class="fvcn-post-thumbnail">
    19                 <?php fvcn_post_thumbnail(0, [50, 50]); ?>
    20             </div>
    21         <?php endif; ?>
     14<div class="fvcn-post-content">
     15    <?php if (fvcn_has_post_thumbnail() && fvcn_show_widget_thumbnail()) : ?>
     16        <div class="fvcn-post-thumbnail">
     17            <?php fvcn_post_thumbnail(0, [50, 50]); ?>
     18        </div>
     19    <?php endif; ?>
    2220
    23         <?php fvcn_post_excerpt(); ?>
    24     </div>
    25 </li><!-- #fvcn-post-<?php fvcn_post_id(); ?> -->
     21    <?php fvcn_post_excerpt(); ?>
     22</div>
  • fv-community-news/trunk/fvcn-theme/single-fvcn.php

    r1760963 r1806332  
    44 * The Template for displaying a single community post.
    55 *
    6  * @version    20120716
    76 * @package    FV Community News
    87 * @subpackage Theme
  • fv-community-news/trunk/public/js/dashboard.js

    r1773960 r1806332  
    44 * AJAX post handling for the dashboard.
    55 *
    6  * @version 20171111
    76 * @package FV Community News
    87 * @subpackage Admin Dashboard
     
    5150     * parseQueryString()
    5251     *
    53      * @version 20120723
    5452     * @link http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
    5553     * @param query
  • fv-community-news/trunk/public/js/post-moderation.js

    r1763902 r1806332  
    44 * Improve the moderation panel, required because of WordPress limitations.
    55 *
    6  * @version        20120730
    76 * @package FV Community News
    87 * @subpackage Admin Post Moderation
  • fv-community-news/trunk/readme.txt

    r1799949 r1806332  
    66Requires at least:  4.8
    77Tested up to:       4.9
    8 Stable tag:         3.1.1
     8Stable tag:         3.1.2
    99
    1010Give the visitors of your site the ability to submit their news to you, and list it in a nice news feed.
     
    4848In order to successfully use this plugin, you will need the following:
    4949
    50 * PHP 5.6 or higher (PHP 7 recommended)
     50* PHP 7.0 or higher
    5151* WordPress 4.8 or higher
    5252
     
    118118
    119119Q: I have a great idea for this plugin, could I make a suggestion?
    120 A: Sure you can! [Let me know about it](https://frankverhoeven.me/forums/forum/fv-community-news/feature-requests/).
     120A: Sure you can! [Let me know about it](https://frankverhoeven.me/wordpress-plugin-fv-community-news/).
    121121
    122122Q: What to do if I found a bug?
    123123A: Please report the bug to me as soon as possible. This way I can solve the problem and make the plugin better for everyone.
    124 Visit the forums at [https://frankverhoeven.me/forums/forum/fv-community-news/bug-reports/](https://frankverhoeven.me/forums/forum/fv-community-news/bug-reports/).
     124Visit the post at [https://frankverhoeven.me/wordpress-plugin-fv-community-news/](https://frankverhoeven.me/wordpress-plugin-fv-community-news/).
    125125
    126126
     
    129129
    130130For more details on changes, please visit the [WordPress Trac](http://plugins.trac.wordpress.org/log/fv-community-news/ "FV Community News on WordPress Trac").
     131
     132
     133= 3.1.2 =
     134
     135* Change: Now requires PHP >= 7.0.
     136* Fix: Links in the notification mail now correctly point to wp-admin if wp is located in a custom directory.
     137* Improvement: No longer replaces jQuery.Form shipped with WP.
     138* Improvement: New/minified javascript, moved to footer.
     139* Improvement: Minified css.
     140* Improvement: New dependency injection.
     141* Improvement: General code improvements & cleanup.
    131142
    132143
  • fv-community-news/trunk/src/Admin/Admin.php

    r1773960 r1806332  
    33namespace FvCommunityNews\Admin;
    44
     5use FvCommunityNews\Admin\Dashboard\Dashboard;
     6use FvCommunityNews\Admin\Post\Edit;
     7use FvCommunityNews\Admin\Post\Moderation;
     8use FvCommunityNews\Admin\Settings\Form;
     9use FvCommunityNews\Admin\Settings\Settings;
     10use FvCommunityNews\Container\Container;
    511use FvCommunityNews\Post\PostType;
    6 use FvCommunityNews\Registry;
    712
    813/**
     
    1823    public $posts;
    1924    /**
    20      * @var AdminFactory
    21      */
    22     protected $factory;
     25     * @var Container
     26     */
     27    protected $container;
    2328
    2429    /**
    2530     * __construct()
    2631     *
    27      * @param AdminFactory $factory
    28      * @version 20171112
    29      */
    30     public function __construct(AdminFactory $factory)
    31     {
    32         $this->factory = $factory;
     32     * @param Container $container
     33     */
     34    public function __construct(Container $container)
     35    {
     36        $this->container = $container;
    3337        $this->setupActions();
    3438    }
     
    3741     * setupActions()
    3842     *
    39      * @version 20120720
    4043     */
    4144    private function setupActions()
     
    5255     * factory()
    5356     *
    54      * @version 20120808
    5557     */
    5658    public function factory()
     
    7375            case 'dashboard' :
    7476            case 'admin-ajax' :
    75                 $this->factory->getDashboard();
     77                $this->container->get(Dashboard::class);
    7678                break;
    7779
    7880            case 'edit-' . $postType :
    79                 $this->factory->getPostModeration();
     81                $this->container->get(Moderation::class);
    8082                break;
    8183
    8284            case 'post' :
    8385            case 'post-new-' . $postType :
    84                 $this->factory->getPostEdit();
     86                $this->container->get(Edit::class);
    8587                break;
    8688
    8789            case 'admin-fvcn-settings' :
    8890            case 'edit-' . $postType . '-fvcn-settings' :
    89                 $this->factory->getSettings();
     91                $this->container->get(Settings::class);
    9092                break;
    9193
    9294            case 'admin-fvcn-form' :
    9395            case 'edit-' . $postType . '-fvcn-form' :
    94                 $this->factory->getForm();
     96                $this->container->get(Form::class);
    9597                break;
    9698
    9799            case 'options' :
    98                 $this->factory->getSettings();
    99                 $this->factory->getForm();
     100                $this->container->get(Settings::class);
     101                $this->container->get(Form::class);
    100102                break;
    101103        }
     
    107109     * init()
    108110     *
    109      * @version 20120129
    110111     */
    111112    public function init()
     
    117118     * adminHead()
    118119     *
    119      * @version 20120721
    120120     */
    121121    public function adminHead()
    122122    {
    123         $menuIconUrl = Registry::get('pluginUrl') . 'public/images/menu.png';
    124         $menuIconUrl2x = Registry::get('pluginUrl') . 'public/images/[email protected]';
     123        $registry = \FvCommunityNews::$container->get('Registry');
     124        $menuIconUrl = $registry['pluginUrl'] . 'public/images/menu.png';
     125        $menuIconUrl2x = $registry['pluginUrl'] . 'public/images/[email protected]';
    125126        $postClass = sanitize_html_class(PostType::POST_TYPE_KEY);
    126127
     
    140141
    141142            @media only screen and (-moz-min-device-pixel-ratio: 1.5),
    142             only screen and (-o-min-device-pixel-ratio: 3/2),
    143             only screen and (-webkit-min-device-pixel-ratio: 1.5),
    144             only screen and (min-devicepixel-ratio: 1.5),
    145             only screen and (min-resolution: 1.5dppx) {
     143                only screen and (-o-min-device-pixel-ratio: 3/2),
     144                only screen and (-webkit-min-device-pixel-ratio: 1.5),
     145                only screen and (min-devicepixel-ratio: 1.5),
     146                only screen and (min-resolution: 1.5dppx) {
    146147                #menu-posts-<?= $postClass; ?> .wp-menu-image {
    147148                    background-image: url(<?= $menuIconUrl2x; ?>);
     
    170171     * enqueueScripts()
    171172     *
    172      * @version 20120721
    173173     */
    174174    public function enqueueScripts()
     
    180180     * adminMenu()
    181181     *
    182      * @version 20120721
    183182     */
    184183    public function adminMenu()
     
    190189            'manage_options',
    191190            'fvcn-form',
    192             [$this->factory->getForm(), 'fvcn_admin_form']
     191            [$this->container->get(Form::class), 'fvcn_admin_form']
    193192        );
    194         add_action('load-' . $adminFormPage, [$this->factory->getForm(), 'fvcn_admin_form_help']);
     193        add_action('load-' . $adminFormPage, [$this->container->get(Form::class), 'fvcn_admin_form_help']);
    195194
    196195        add_submenu_page(
     
    200199            'manage_options',
    201200            'fvcn-settings',
    202             [$this->factory->getSettings(), 'fvcn_admin_settings']
     201            [$this->container->get(Settings::class), 'fvcn_admin_settings']
    203202        );
    204203
  • fv-community-news/trunk/src/Admin/Dashboard/Dashboard.php

    r1763902 r1806332  
    44
    55use FvCommunityNews\Admin\Dashboard\Widget\RecentPosts;
     6use FvCommunityNews\Config\AbstractConfig as Config;
     7use FvCommunityNews\Post\Mapper as PostMapper;
    68
    79/**
     
    1315{
    1416    /**
     17     * @var Config
     18     */
     19    private $config;
     20    /**
     21     * @var PostMapper
     22     */
     23    private $postMapper;
     24
     25    /**
    1526     * __construct()
    1627     *
    17      * @version 20120729
     28     * @param Config $config
     29     * @param PostMapper $postMapper
    1830     */
    19     public function __construct()
     31    public function __construct(Config $config, PostMapper $postMapper)
    2032    {
     33        $this->config = $config;
     34        $this->postMapper = $postMapper;
     35
    2136        $this->registerWidgets();
    2237    }
     
    2641     *
    2742     * @return Dashboard
    28      * @version 20171111
    2943     */
    3044    public function registerWidgets()
    3145    {
    32         add_action('wp_dashboard_setup', [new RecentPosts(), 'register']);
     46        add_action('wp_dashboard_setup', [new RecentPosts($this->config, $this->postMapper), 'register']);
    3347        do_action('fvcn_register_dashboard_widgets');
    3448
  • fv-community-news/trunk/src/Admin/Dashboard/Widget/RecentPosts.php

    r1773960 r1806332  
    33namespace FvCommunityNews\Admin\Dashboard\Widget;
    44
    5 use FvCommunityNews\Options;
     5use FvCommunityNews\Config\AbstractConfig as Config;
     6use FvCommunityNews\Post\Mapper as PostMapper;
    67use FvCommunityNews\Post\PostType;
    7 use FvCommunityNews\Registry;
    88
    99/**
     
    1515{
    1616    /**
     17     * @var Config
     18     */
     19    private $config;
     20    /**
     21     * @var PostMapper
     22     */
     23    private $postMapper;
     24
     25    /**
    1726     * __construct()
    1827     *
    19      * @version 20120729
    20      */
    21     public function __construct()
    22     {
     28     * @param Config $config
     29     * @param PostMapper $postMapper
     30     */
     31    public function __construct(Config $config, PostMapper $postMapper)
     32    {
     33        $this->config = $config;
     34        $this->postMapper = $postMapper;
     35
    2336        add_action('fvcn_admin_enqueue_scripts', [$this, 'enqueueScripts']);
    2437        add_action('fvcn_admin_head', [$this, 'dashboardHead']);
     
    3245     * enqueueScripts()
    3346     *
    34      * @version 20120729
    3547     */
    3648    public function enqueueScripts()
    3749    {
     50        $registry = \FvCommunityNews::$container->get('Registry');
     51
    3852        wp_enqueue_script(
    3953            'fvcn-dashboard-widget-rp-js',
    40             Registry::get('pluginUrl') . 'public/js/dashboard.js',
     54            $registry['pluginUrl'] . 'public/js/dashboard.js',
    4155            ['jquery'],
    4256            '20120721'
     
    5973     * dashboardHead()
    6074     *
    61      * @version 20120729
    6275     */
    6376    public function dashboardHead()
     
    139152     * response()
    140153     *
    141      * @version 20120729
    142154     */
    143155    public function response()
     
    153165     * ajaxResponse()
    154166     *
    155      * @version 20120729
    156167     */
    157168    public function ajaxResponse()
     
    196207     * updatePostStatus()
    197208     *
    198      * @version 20120729
    199209     * @param $postId
    200210     * @param string $action
     
    206216            case 'fvcn_toggle_post_spam_status' :
    207217                check_admin_referer('fvcn-spam-post_' . $postId);
    208                 return fvcn_is_post_spam($postId) ? fvcn_publish_post($postId) : fvcn_spam_post($postId);
     218                return fvcn_is_post_spam($postId) ? $this->postMapper->publishPost($postId) : $this->postMapper->spamPost($postId);
    209219                break;
    210220
    211221            case 'fvcn_toggle_post_publish_status' :
    212222                check_admin_referer('fvcn-publish-post_' . $postId);
    213                 return fvcn_is_post_published($postId) ? fvcn_unpublish_post($postId) : fvcn_publish_post($postId);
     223                return fvcn_is_post_published($postId) ? $this->postMapper->unpublishPost($postId) : $this->postMapper->publishPost($postId);
    214224                break;
    215225
     
    222232     * register()
    223233     *
    224      * @version 20120719
    225234     * @return RecentPosts
    226235     */
     
    242251     * widget()
    243252     *
    244      * @version 20120721
    245253     */
    246254    public function widget()
    247255    {
    248256        $options = [
    249             'posts_per_page' => Options::fvcnGetOption('_fvcn_dashboard_rp_num'),
     257            'posts_per_page' => $this->config['_fvcn_dashboard_rp_num'],
    250258            'post_status' => PostType::STATUS_PUBLISH . ',' . PostType::STATUS_PENDING
    251259        ];
     
    342350     * control()
    343351     *
    344      * @version 20120729
    345352     */
    346353    public function control()
     
    353360        <p>
    354361            <label for="_fvcn_dashboard_rp_num"><?php _e('Number of posts to show:', 'fvcn'); ?></label>
    355             <input type="text" name="_fvcn_dashboard_rp_num" id="_fvcn_dashboard_rp_num" value="<?= fvcn_form_option('_fvcn_dashboard_rp_num'); ?>" size="3">
     362            <input type="text" name="_fvcn_dashboard_rp_num" id="_fvcn_dashboard_rp_num" value="<?= fvcn_get_form_option('_fvcn_dashboard_rp_num'); ?>" size="3">
    356363            <small><?php _e('(1 - 30)', 'fvcn'); ?></small>
    357364        </p>
  • fv-community-news/trunk/src/Admin/Post/Edit.php

    r1773960 r1806332  
    2020     * __construct()
    2121     *
    22      * @version 20120721
    2322     */
    2423    public function __construct()
     
    3332     * registerMetaboxPostInfo()
    3433     *
    35      * @version 20120721
    3634     */
    3735    public function registerMetaboxPostInfo()
     
    5654     * saveMetaboxPostInfo()
    5755     *
    58      * @version 20120721
    5956     * @param int $postId
    6057     * @return int
     
    9390     * metaboxPostInfo()
    9491     *
    95      * @version 20120721
    9692     */
    9793    public function metaboxPostInfo()
  • fv-community-news/trunk/src/Admin/Post/Moderation.php

    r1773960 r1806332  
    33namespace FvCommunityNews\Admin\Post;
    44
     5use FvCommunityNews\Post\Mapper as PostMapper;
    56use FvCommunityNews\Post\PostType;
    6 use FvCommunityNews\Registry;
    7 use FvCommunityNews_PostMapper;
    87
    98/**
     
    1817     */
    1918    private $postType;
    20 
    21     /**
    22      * __construct()
    23      *
    24      * @version 20120414
    25      */
    26     public function __construct()
    27     {
     19    /**
     20     * @var PostMapper
     21     */
     22    private $postMapper;
     23
     24    /**
     25     * @param PostMapper $postMapper
     26     */
     27    public function __construct(PostMapper $postMapper)
     28    {
     29        $this->postMapper = $postMapper;
    2830        $this->postType = PostType::POST_TYPE_KEY;
    2931
     
    3537     * setupActions()
    3638     *
    37      * @version 20120308
    3839     * @return Moderation
    3940     */
     
    5960     * enqueueScripts()
    6061     *
    61      * @version 20120730
    6262     * @return Moderation
    6363     */
    6464    public function enqueueScripts()
    6565    {
     66        $registry = \FvCommunityNews::$container->get('Registry');
    6667        wp_enqueue_script(
    6768            'fvcn-admin-post-moderation-js',
    68             Registry::get('pluginUrl') . 'public/js/post-moderation.js',
     69            $registry['pluginUrl'] . 'public/js/post-moderation.js',
    6970            ['jquery'],
    7071            '20120730'
     
    9697     * addContextualHelp()
    9798     *
    98      * @version 20120308
    9999     * @return Moderation
    100100     */
     
    108108     * processBulkActions()
    109109     *
    110      * @version 20120730
    111110     */
    112111    protected function processBulkActions()
     
    156155
    157156            if (false !== $method) {
    158                 $postMapper = new FvCommunityNews_PostMapper();
    159 
    160157                foreach ((array)$_GET['post'] as $postId) {
    161                     $postMapper->$method($postId);
     158                    $this->postMapper->$method($postId);
    162159                }
    163160
     
    174171     * _togglePost()
    175172     *
    176      * @version 20120729
    177173     */
    178174    protected function _togglePost()
     
    198194
    199195                if (fvcn_is_post_spam($postId)) {
    200                     fvcn_publish_post($postId);
     196                    $this->postMapper->publishPost($postId);
    201197                    $updated = 'unspam';
    202198                } else {
    203                     fvcn_spam_post($postId);
     199                    $this->postMapper->spamPost($postId);
    204200                    $updated = 'spam';
    205201                }
     
    210206
    211207                if (fvcn_is_post_published($postId)) {
    212                     fvcn_unpublish_post($postId);
     208                    $this->postMapper->unpublishPost($postId);
    213209                    $updated = 'unpublish';
    214210                } else {
    215                     fvcn_publish_post($postId);
     211                    $this->postMapper->publishPost($postId);
    216212                    $updated = 'publish';
    217213                }
     
    229225     *
    230226     * @return mixed
    231      * @version 20171111
    232227     */
    233228    public function columnHeaders()
     
    248243     * columnData()
    249244     *
    250      * @version 20120805
    251245     * @param string $column
    252246     * @param int $postId
     
    286280     * postRowActions()
    287281     *
    288      * @version 20120730
    289282     * @param array $actions
    290283     * @param object $post
     
    346339     * filterDropdown()
    347340     *
    348      * @version 20120730
    349341     */
    350342    public function filterDropdown()
     
    367359     * displayNotice()
    368360     *
    369      * @version 20120730
    370361     */
    371362    public function displayNotice()
     
    412403        if ($message) :
    413404            ?>
    414             <div id="message" class="updated"><p>
    415 
    416                     <?= $message; ?>
    417 
    418                 </p></div>
     405            <div id="message" class="updated">
     406                <p><?= $message; ?></p>
     407            </div>
    419408            <?php
    420409        endif;
  • fv-community-news/trunk/src/Admin/Settings/Form.php

    r1773960 r1806332  
    1313     * __construct()
    1414     *
    15      * @version 20171111
    1615     */
    1716    public function __construct()
     
    8685     * fvcn_admin_form()
    8786     *
    88      * @version 20171111
    8987     */
    9088    public function fvcn_admin_form()
     
    112110     * fvcn_admin_form_help()
    113111     *
    114      * @version 20120728
    115112     */
    116113    public function fvcn_admin_form_help()
     
    139136     * author_section()
    140137     *
    141      * @version 20120302
    142138     */
    143139    public function author_name_section()
     
    153149     * author_label()
    154150     *
    155      * @version 20120524
    156151     */
    157152    public function author_name_label()
     
    159154        ?>
    160155
    161         <input type="text" name="_fvcn_post_form_author_name_label" id="_fvcn_post_form_author_name_label" value="<?php fvcn_form_option('_fvcn_post_form_author_name_label'); ?>" class="reqular-text">
     156        <input type="text" name="_fvcn_post_form_author_name_label" id="_fvcn_post_form_author_name_label" value="<?= fvcn_get_form_option('_fvcn_post_form_author_name_label'); ?>" class="reqular-text">
    162157
    163158        <?php
     
    168163     * author_section()
    169164     *
    170      * @version 20120302
    171165     */
    172166    public function author_email_section()
     
    182176     * author_label()
    183177     *
    184      * @version 20120524
    185178     */
    186179    public function author_email_label()
     
    188181        ?>
    189182
    190         <input type="text" name="_fvcn_post_form_author_email_label" id="_fvcn_post_form_author_email_label" value="<?php fvcn_form_option('_fvcn_post_form_author_email_label'); ?>" class="reqular-text">
     183        <input type="text" name="_fvcn_post_form_author_email_label" id="_fvcn_post_form_author_email_label" value="<?= fvcn_get_form_option('_fvcn_post_form_author_email_label'); ?>" class="reqular-text">
    191184
    192185        <?php
     
    197190     * title_section()
    198191     *
    199      * @version 20120302
    200192     */
    201193    public function title_section()
     
    211203     * title_label()
    212204     *
    213      * @version 20120524
    214205     */
    215206    public function title_label()
     
    217208        ?>
    218209
    219         <input type="text" name="_fvcn_post_form_title_label" id="_fvcn_post_form_title_label" value="<?php fvcn_form_option('_fvcn_post_form_title_label'); ?>" class="reqular-text">
     210        <input type="text" name="_fvcn_post_form_title_label" id="_fvcn_post_form_title_label" value="<?= fvcn_get_form_option('_fvcn_post_form_title_label'); ?>" class="reqular-text">
    220211
    221212        <?php
     
    226217     * link_section()
    227218     *
    228      * @version 20120302
    229219     */
    230220    public function link_section()
     
    240230     * link_label()
    241231     *
    242      * @version 20120524
    243232     */
    244233    public function link_label()
     
    246235        ?>
    247236
    248         <input type="text" name="_fvcn_post_form_link_label" id="_fvcn_post_form_link_label" value="<?php fvcn_form_option('_fvcn_post_form_link_label'); ?>" class="reqular-text">
     237        <input type="text" name="_fvcn_post_form_link_label" id="_fvcn_post_form_link_label" value="<?= fvcn_get_form_option('_fvcn_post_form_link_label'); ?>" class="reqular-text">
    249238
    250239        <?php
     
    254243     * link_required()
    255244     *
    256      * @version 20120302
    257245     */
    258246    public function link_required()
     
    270258     * content_section()
    271259     *
    272      * @version 20120302
    273260     */
    274261    public function content_section()
     
    284271     * content_label()
    285272     *
    286      * @version 20120524
    287273     */
    288274    public function content_label()
     
    290276        ?>
    291277
    292         <input type="text" name="_fvcn_post_form_content_label" id="_fvcn_post_form_content_label" value="<?php fvcn_form_option('_fvcn_post_form_content_label'); ?>" class="reqular-text">
     278        <input type="text" name="_fvcn_post_form_content_label" id="_fvcn_post_form_content_label" value="<?= fvcn_get_form_option('_fvcn_post_form_content_label'); ?>" class="reqular-text">
    293279
    294280        <?php
     
    299285     * tags_section()
    300286     *
    301      * @version 20120302
    302287     */
    303288    public function tags_section()
     
    313298     * tags_label()
    314299     *
    315      * @version 20120524
    316300     */
    317301    public function tags_label()
     
    319303        ?>
    320304
    321         <input type="text" name="_fvcn_post_form_tags_label" id="_fvcn_post_form_tags_label" value="<?php fvcn_form_option('_fvcn_post_form_tags_label'); ?>" class="reqular-text">
     305        <input type="text" name="_fvcn_post_form_tags_label" id="_fvcn_post_form_tags_label" value="<?= fvcn_get_form_option('_fvcn_post_form_tags_label'); ?>" class="reqular-text">
    322306
    323307        <?php
     
    327311     * tags_required()
    328312     *
    329      * @version 20120302
    330313     */
    331314    public function tags_required()
     
    343326     * thumbnail_section()
    344327     *
    345      * @version 20120306
    346328     */
    347329    public function thumbnail_section()
     
    358340     * thumbnail_enabled()
    359341     *
    360      * @version 20120306
    361342     */
    362343    public function thumbnail_enabled()
     
    373354     * thumbnail_label()
    374355     *
    375      * @version 20120524
    376356     */
    377357    public function thumbnail_label()
     
    379359        ?>
    380360
    381         <input type="text" name="_fvcn_post_form_thumbnail_label" id="_fvcn_post_form_thumbnail_label" value="<?php fvcn_form_option('_fvcn_post_form_thumbnail_label'); ?>" class="reqular-text">
     361        <input type="text" name="_fvcn_post_form_thumbnail_label" id="_fvcn_post_form_thumbnail_label" value="<?= fvcn_get_form_option('_fvcn_post_form_thumbnail_label'); ?>" class="reqular-text">
    382362
    383363        <?php
     
    387367     * thumbnail_required()
    388368     *
    389      * @version 20120306
    390369     */
    391370    public function thumbnail_required()
  • fv-community-news/trunk/src/Admin/Settings/Settings.php

    r1773960 r1806332  
    1313     * fvcn_register_admin_settings()
    1414     *
    15      * @version 20120524
    16                  */
     15     */
    1716    public function __construct()
    1817    {
     
    5453     * fvcn_admin_settings()
    5554     *
    56      * @version 20120324
    57          */
     55     */
    5856    public function fvcn_admin_settings()
    5957    {
     
    8179     * general_section()
    8280     *
    83      * @version 20120322
    8481     */
    8582    public function general_section()
     
    9491     * moderation()
    9592     *
    96      * @version 20120322
    9793     */
    9894    public function moderation()
     
    113109     * mail()
    114110     *
    115      * @version 20120322
    116111     */
    117112    public function mail()
     
    132127     * is_anonymous_allowed()
    133128     *
    134      * @version 20120322
    135129     */
    136130    public function is_anonymous_allowed()
     
    148142     * permalinks_section()
    149143     *
    150      * @version 20120322
    151144     */
    152145    public function permalinks_section()
     
    161154     * post_base_slug()
    162155     *
    163      * @version 20120524
    164156     */
    165157    public function post_base_slug()
     
    167159        ?>
    168160
    169         <input type="text" name="_fvcn_base_slug" id="_fvcn_base_slug" value="<?php fvcn_form_option('_fvcn_base_slug', true); ?>" class="reqular-text">
     161        <input type="text" name="_fvcn_base_slug" id="_fvcn_base_slug" value="<?= fvcn_get_form_option('_fvcn_base_slug', true); ?>" class="reqular-text">
    170162
    171163        <?php
     
    176168     * post_slug()
    177169     *
    178      * @version 20120524
    179170     */
    180171    public function post_slug()
     
    182173        ?>
    183174
    184         <input type="text" name="_fvcn_post_slug" id="_fvcn_post_slug" value="<?php fvcn_form_option('_fvcn_post_slug', true); ?>" class="reqular-text">
     175        <input type="text" name="_fvcn_post_slug" id="_fvcn_post_slug" value="<?= fvcn_get_form_option('_fvcn_post_slug', true); ?>" class="reqular-text">
    185176
    186177        <?php
     
    191182     * post_tag_slug()
    192183     *
    193      * @version 20120524
    194184     */
    195185    public function post_tag_slug()
     
    197187        ?>
    198188
    199         <input type="text" name="_fvcn_post_tag_slug" id="_fvcn_post_tag_slug" value="<?php fvcn_form_option('_fvcn_post_tag_slug', true); ?>" class="reqular-text">
     189        <input type="text" name="_fvcn_post_tag_slug" id="_fvcn_post_tag_slug" value="<?= fvcn_get_form_option('_fvcn_post_tag_slug', true); ?>" class="reqular-text">
    200190
    201191        <?php
     
    206196     * post_archive_slug()
    207197     *
    208      * @version 20120524
    209198     */
    210199    public function post_archive_slug()
     
    212201        ?>
    213202
    214         <input type="text" name="_fvcn_post_archive_slug" id="_fvcn_post_archive_slug" value="<?php fvcn_form_option('_fvcn_post_archive_slug', true); ?>" class="reqular-text">
     203        <input type="text" name="_fvcn_post_archive_slug" id="_fvcn_post_archive_slug" value="<?= fvcn_get_form_option('_fvcn_post_archive_slug', true); ?>" class="reqular-text">
    215204
    216205        <?php
  • fv-community-news/trunk/src/Akismet/Akismet.php

    r1773960 r1806332  
    44
    55use Exception;
    6 use FvCommunityNews\Container;
     6use FvCommunityNews\Version;
    77
    88/**
     
    2525     * __construct()
    2626     *
    27      * @version 20120711
    2827     * @param string $apiKey
    2928     * @param string $blogUrl
     
    3837     * setApiKey()
    3938     *
    40      * @version 20120711
    4139     * @param string $apiKey
    4240     * @return Akismet
     
    5149     * getApiKey()
    5250     *
    53      * @version 20120711
    5451     * @return string
    5552     */
     
    6259     * setBlogUrl()
    6360     *
    64      * @version 20120711
    6561     * @param string $blogUrl
    6662     * @return Akismet
     
    7571     * getBlogUrl()
    7672     *
    77      * @version 20120711
    7873     * @return string
    7974     */
     
    9186     * @return string
    9287     * @throws Exception
    93      * @version 20171111
    9488     */
    9589    protected function post($host, $path, array $params)
     
    10195                'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'),
    10296                'Host' => $host,
    103                 'User-Agent' => 'FV Community News/' . fvcn_get_version() . ' | Akismet/20120711'
     97                'User-Agent' => 'FV Community News/' . Version::getCurrentVersion() . ' | Akismet/20120711'
    10498            ],
    10599            'httpversion' => '1.0',
     
    119113     * makeApiCall()
    120114     *
    121      * @version 20120711
    122115     * @param string $path
    123116     * @param array $params
     
    139132     * verifyKey()
    140133     *
    141      * @version 20120711
    142134     * @param string $key
    143135     * @param string $blog
    144136     * @return bool
     137     * @throws Exception
    145138     */
    146139    public function verifyKey($key=null, $blog=null)
     
    159152     * isSpam()
    160153     *
    161      * @version 20120711
    162154     * @param array $params
    163155     * @return bool
     
    181173     * submitSpam()
    182174     *
    183      * @version 20120711
    184175     * @param array $params
     176     * @throws Exception
    185177     */
    186178    public function submitSpam(array $params)
     
    192184     * submitHam()
    193185     *
    194      * @version 20120711
    195186     * @param array $params
     187     * @throws Exception
    196188     */
    197189    public function submitHam(array $params)
     
    199191        $this->makeApiCall('/1.1/submit-ham', $params);
    200192    }
    201 
    202 
    203     /**
    204      * fvcn_akismet_check_post()
    205      *
    206      * @version 20120711
    207      * @param int $postId
    208      */
    209     public static function fvcn_akismet_check_post($postId)
    210     {
    211         try {
    212             Container::getInstance()->getAkismetHandler()->checkPost($postId);
    213         } catch (Exception $e) {}
    214     }
    215 
    216     /**
    217      * fvcn_akismet_submit_post()
    218      *
    219      * @version 20120711
    220      * @param int $postId
    221      */
    222     public static function fvcn_akismet_submit_post($postId)
    223     {
    224         try {
    225             Container::getInstance()->getAkismetHandler()->submitPost($postId);
    226         } catch (Exception $e) {}
    227     }
    228 
    229     /**
    230      * fvcn_akismet_register_settings()
    231      *
    232      * @version 20120711
    233      */
    234     public static function fvcn_akismet_register_settings()
    235     {
    236         Container::getInstance()->getAkismetHandler()->registerSettings();
    237     }
    238 
    239     /**
    240      * fvcn_akismet()
    241      *
    242      * @version 20171111
    243      */
    244     public static function fvcn_akismet()
    245     {
    246         if (!defined('AKISMET_VERSION')) {
    247             return;
    248         }
    249 
    250         if (get_option('_fvcn_akismet_enabled', false)) {
    251             add_action('fvcn_insert_post', [self::class, 'fvcn_akismet_check_post']);
    252             add_action('fvcn_spam_post', [self::class, 'fvcn_akismet_submit_post']);
    253             add_action('fvcn_publish_post', [self::class, 'fvcn_akismet_submit_post']);
    254         }
    255 
    256         if (is_admin()) {
    257             add_action('fvcn_register_admin_settings', [self::class, 'fvcn_akismet_register_settings']);
    258         }
    259     }
    260193}
  • fv-community-news/trunk/src/Akismet/Handler.php

    r1773960 r1806332  
    22
    33namespace FvCommunityNews\Akismet;
     4
     5use FvCommunityNews\Post\Mapper;
     6use FvCommunityNews\Post\PostType;
    47
    58/**
     
    1316     * @var int
    1417     */
    15     protected $currentPostId;
    16 
     18    private $currentPostId;
    1719    /**
    1820     * @var Akismet
    1921     */
    20     protected $akismet;
     22    private $akismet;
     23    /**
     24     * @var Mapper
     25     */
     26    private $postMapper;
    2127
    2228    /**
    23      * __construct()
    24      *
    25      * @version 20120711
    2629     * @param Akismet $akismet
     30     * @param Mapper $postMapper
    2731     */
    28     public function __construct(Akismet $akismet)
     32    public function __construct(Akismet $akismet, Mapper $postMapper)
    2933    {
    3034        $this->akismet = $akismet;
     35        $this->postMapper = $postMapper;
    3136    }
    3237
     
    3439     * _getParams()
    3540     *
    36      * @version 20120711
    3741     * @param int $postId
    3842     * @return array
     
    6771     * checkPost()
    6872     *
    69      * @version 20120711
    7073     * @param int $postId
    7174     * @return Handler
     
    7376    public function checkPost($postId)
    7477    {
    75         if ($this->akismet->isSpam($this->_getParams($postId))) {
    76             $this->currentPostId = $postId;
    77             fvcn_spam_post($postId);
    78         }
     78        try {
     79            if ($this->akismet->isSpam($this->_getParams($postId))) {
     80                $this->currentPostId = $postId;
     81                $this->postMapper->spamPost($postId);
     82            }
     83        } catch (\Exception $e) {}
    7984
    8085        return $this;
     
    8489     * submitPost()
    8590     *
    86      * @version 20120711
    8791     * @param int $postId
    8892     * @return Handler
     
    9498        if ('fvcn_spam_post' == $filter) {
    9599            if ($this->currentPostId == $postId) {
    96                 return;
     100                return $this;
    97101            }
    98102
     
    100104        } elseif ('fvcn_publish_post' == $filter) {
    101105            if (PostType::STATUS_SPAM != fvcn_get_post_status($postId)) {
    102                 return;
     106                return $this;
    103107            }
    104108
    105109            $method = 'submitHam';
    106110        } else {
    107             return;
     111            return $this;
    108112        }
    109113
     
    116120     * registerSettings()
    117121     *
    118      * @version 20120322
    119122     */
    120123    public function registerSettings()
     
    129132     * settingsCallbackSection()
    130133     *
    131      * @version 20120322
    132134     */
    133135    public function settingsCallbackSection()
     
    143145     * settingsCallbackEnabled()
    144146     *
    145      * @version 20120711
    146147     */
    147148    public function settingsCallbackEnabled()
     
    149150        ?>
    150151
    151         <input type="checkbox" name="_fvcnakismet_enabled" id="_fvcnakismet_enabled" value="1" <?php checked(get_option('_fvcnakismet_enabled', false)); ?> />
     152        <input type="checkbox" name="_fvcnakismet_enabled" id="_fvcnakismet_enabled" value="1" <?php checked(get_option('_fvcnakismet_enabled', false)); ?>>
    152153        <label for="_fvcnakismet_enabled"><?php _e('Enable Akismet spam protection for community posts.', 'fvcn'); ?></label>
    153154
    154         <?php if ($this->akismet->verifyKey()) : ?>
     155        <?php if ($this->akismet->verifyKey()): ?>
    155156
    156         <p class="description"><?php _e('Your current API key appears to be <strong>valid</strong>.', 'fvcn'); ?></p>
     157            <p class="description"><?php _e('Your current API key appears to be <strong>valid</strong>.', 'fvcn'); ?></p>
    157158
    158     <?php else : ?>
     159        <?php else : ?>
    159160
    160         <p class="description"><?php _e('Your current API key appears to be <strong>invalid</strong>.', 'fvcn'); ?></p>
     161            <p class="description"><?php _e('Your current API key appears to be <strong>invalid</strong>.', 'fvcn'); ?></p>
    161162
    162     <?php endif;
    163 
     163        <?php endif;
    164164    }
    165165}
  • fv-community-news/trunk/src/Installer.php

    r1773960 r1806332  
    22
    33namespace FvCommunityNews;
     4
     5use FvCommunityNews\Config\AbstractConfig as Config;
    46
    57/**
     
    1921     *
    2022     * @param Config $config
    21      * @version 20171112
    2223     */
    2324    public function __construct(Config $config)
     
    3031     *
    3132     * @return bool
    32      * @version 20171112
    3333     */
    3434    public function isInstall()
     
    4141     *
    4242     * @return bool
    43      * @version 20171112
    4443     */
    4544    public function isUpdate()
     
    5251     *
    5352     * @return Installer
    54      * @version 20171111
    5553     */
    5654    public function install()
     
    6563     *
    6664     * @return Installer
    67      * @version 20171111
    6865     */
    6966    public function update()
     
    7976     *
    8077     * @return Installer
    81      * @version 20171112
    8278     */
    8379    public function addOptions()
     
    9490     *
    9591     * @return bool
    96      * @version 20171112
    9792     */
    9893    public function hasUpdate()
    9994    {
    10095        $lastCheck = $this->config->get('_fvcn_previous_has_update', false);
    101         if (!$lastCheck || (time() - $lastCheck) > 432000) { // Only check once every five days
     96        if (!$lastCheck || (time() - $lastCheck) > 86400) { // Only check once every 24 hours
    10297            $latest = Version::getLatestVersion();
    10398            $this->config->set('_fvcn_previous_has_update', time());
  • fv-community-news/trunk/src/Post/PostType.php

    r1773960 r1806332  
    2525     * @param string $archiveSlug
    2626     * @return PostType
    27      * @version 20171112
    2827     */
    2928    public function registerPostType($postSlug, $archiveSlug)
     
    8584     * registerPostStatuses()
    8685     *
    87      * @version 20120716
    8886     * @return PostType
    8987     */
     
    109107     * @param string $tagSlug
    110108     * @return PostType
    111      * @version 20171112
    112109     */
    113110    public function registerTaxonomy($tagSlug)
  • fv-community-news/trunk/src/Shortcode/PostForm.php

    r1773960 r1806332  
    1818     * obStart()
    1919     *
    20      * @version 20120315
    2120     */
    2221    private function obStart()
     
    2827     * obEnd()
    2928     *
    30      * @version 20120315
    3129     * @return string
    3230     */
  • fv-community-news/trunk/src/Shortcode/RecentPosts.php

    r1773960 r1806332  
    1818     * obStart()
    1919     *
    20      * @version 20120315
    2120     */
    2221    private function obStart()
     
    2827     * obEnd()
    2928     *
    30      * @version 20120315
    3129     * @return string
    3230     */
  • fv-community-news/trunk/src/Shortcode/TagCloud.php

    r1773960 r1806332  
    1818     * obStart()
    1919     *
    20      * @version 20120315
    2120     */
    2221    private function obStart()
     
    2827     * obEnd()
    2928     *
    30      * @version 20120315
    3129     * @return string
    3230     */
  • fv-community-news/trunk/src/Template/common-functions.php

    r1773960 r1806332  
    11<?php
    22
    3 use FvCommunityNews\Container;
    4 use FvCommunityNews\Registry;
     3use FvCommunityNews\Post\PostType;
    54
    65/**
    7  * fvcn_version()
     6 * fvcn_add_error()
    87 *
    9  * @version 20120322
     8 * @param string $code
     9 * @param string $message
     10 * @param string $data
    1011 */
    11 function fvcn_version()
     12function fvcn_add_error($code='', $message='', $data='')
    1213{
    13     echo fvcn_get_version();
    14 }
    15     /**
    16      * fvcn_get_version()
    17      *
    18      * @version 20120711
    19      * @return string
    20      */
    21     function fvcn_get_version()
    22     {
    23         return FvCommunityNews::VERSION;
    24     }
    25 
    26 /**
    27  * fvcn_head()
    28  *
    29  * @version 20171111
    30  */
    31 function fvcn_head()
    32 {
    33     echo '<meta name="generator" content="FV Community News">' . "\n";
    34     do_action('fvcn_head');
     14    FvCommunityNews::$container->get(WP_Error::class)->add($code, $message, $data);
    3515}
    3616
    3717/**
    38  * fvcn_template_notices()
     18 * fvcn_has_errors()
    3919 *
    40  * @version 20120713
     20 * @return bool
    4121 */
    42 function fvcn_template_notices()
     22function fvcn_has_errors()
    4323{
    44     if (!fvcn_has_errors()) {
    45         return;
     24    $hasErrors = false;
     25
     26    if (FvCommunityNews::$container->get(WP_Error::class)->get_error_codes()) {
     27        $hasErrors = true;
    4628    }
    4729
    48     $errors = $messages = [];
     30    return apply_filters('fvcn_has_errors', $hasErrors, FvCommunityNews::$container->get(WP_Error::class));
     31}
    4932
    50     foreach (Container::getInstance()->getWpError()->get_error_codes() as $code) {
    51         $severity = Container::getInstance()->getWpError()->get_error_data($code);
     33/**
     34 * fvcn_add_featured_image_theme_support()
     35 *
     36 */
     37function fvcn_add_thumbnail_theme_support()
     38{
     39    $reg = FvCommunityNews::$container->get('Registry');
     40    if (true === get_theme_support('post-thumbnails')) {
     41        $reg['nativeThumbnailSupport'] = true;
     42    } else {
     43        $reg['nativeThumbnailSupport'] = false;
     44        add_theme_support('post-thumbnails', [PostType::POST_TYPE_KEY, fvcn_get_post_slug()]);
     45    }
     46}
    5247
    53         foreach (Container::getInstance()->getWpError()->get_error_messages($code) as $error) {
    54             if ('message' == $severity) {
    55                 $messages[] = $error;
    56             } else {
    57                 $errors[] = $error;
    58             }
    59         }
     48/**
     49 * fvcn_fix_post_author()
     50 *
     51 * @param array $data
     52 * @param array $postarr
     53 * @return array
     54 */
     55function fvcn_fix_post_author($data = [], $postarr = [])
     56{
     57    if (empty($postarr['ID']) || empty($data['post_author'])) {
     58        return $data;
     59    }
     60    if ($data['post_type'] != PostType::POST_TYPE_KEY) {
     61        return $data;
     62    }
     63    if (!fvcn_is_post_anonymous($postarr['ID'])) {
     64        return $data;
    6065    }
    6166
    62     if (!empty($errors)) : ?>
     67    $data['post_author'] = 0;
    6368
    64         <div class="fvcn-template-notice error">
    65             <span>
    66                 <?= implode("</span><br>\n<span>", $errors); ?>
    67             </span>
    68         </div>
     69    return $data;
     70}
    6971
    70     <?php else : ?>
     72/**
     73 * fvcn_send_notification_mail()
     74 *
     75 * @param int $postId
     76 * @return bool
     77 */
     78function fvcn_send_notification_mail($postId)
     79{
     80    if (!fvcn_mail_on_submission() && !fvcn_mail_on_moderation()) {
     81        return false;
     82    }
     83    if (PostType::STATUS_SPAM == fvcn_get_post_status($postId)) {
     84        return false;
     85    }
    7186
    72         <div class="fvcn-template-notice">
    73             <span>
    74                 <?= implode("</span><br>\n<span>", $messages); ?>
    75             </span>
    76         </div>
     87    if (PostType::STATUS_PENDING == fvcn_get_post_status($postId) && (fvcn_mail_on_submission() || fvcn_mail_on_moderation())) {
     88        $subject =    '[' . get_option('blogname') . '] ' . __('New Community Post Awaiting Moderation', 'fvcn');
     89        $moderationPage = add_query_arg(['post_type' => PostType::POST_TYPE_KEY, 'post_status' => PostType::STATUS_PENDING], site_url('/wp-admin/edit.php'));
     90    } else if (fvcn_mail_on_submission()) {
     91        $subject =    '[' . get_option('blogname') . '] ' . __('New Community Post', 'fvcn');
     92        $moderationPage = add_query_arg(['post_type' => PostType::POST_TYPE_KEY], site_url('/wp-admin/edit.php'));
     93    } else {
     94        return false;
     95    }
    7796
    78     <?php endif;
     97    $to = get_option('admin_email');
     98    if (!is_email($to)) {
     99        return false;
     100    }
     101
     102    $message = '<html><head><style type="text/css">*,html{padding:0;margin:0}body{font:11px/17px"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana;color:#333}a{color:#08c;text-decoration:underline}#container{margin:10px auto;width:450px}.column{display:inline-block;vertical-align:top}#post-thumbnail{width:90px;padding:5px}#post-info{width:350px;padding:2px 0 0}#post-info p{margin:2px 0 0}#post-info p span{float:left;width:85px;text-align:right;margin-right:8px;font-weight:700}#post-content{padding:3px 5px 0}#post-actions{padding:5px}</style></head><body><div id="container"><div id="post-details"><div id="post-thumbnail" class="column">' . (fvcn_has_post_thumbnail($postId) ? fvcn_get_post_thumbnail($postId, [90, 90]) : fvcn_get_post_author_avatar($postId, 90)) . '</div><div id="post-info" class="column"><p><span>' . __('Author Name', 'fvcn') . '</span>' . fvcn_get_post_author_display_name($postId) . ' (<a href="http://whois.arin.net/rest/ip/' . fvcn_get_post_author_ip($postId) . '">' . fvcn_get_post_author_ip($postId) . '</a>)</p><p><span>' . __('Author Email', 'fvcn') . '</span><a href="mailto:' . fvcn_get_post_author_email($postId) . '">' . fvcn_get_post_author_email($postId) . '</a></p><p><span>' . __('Title', 'fvcn') . '</span>' . fvcn_get_post_title($postId) . '</p><p><span>' . __('Link', 'fvcn') . '</span>' . (fvcn_has_post_link($postId) ? '<a href="' . fvcn_get_post_link($postId) . '">' . parse_url(fvcn_get_post_link($postId), PHP_URL_HOST) . '</a>' : __('No Link Added', 'fvcn')) . '</p><p><span>' . __('Tags', 'fvcn') . '</span>' . fvcn_get_post_tag_list($postId, ['before'=>'', 'after'=>'']) . '</p></div></div><div id="post-content">' . fvcn_get_post_content($postId) . '</div><div id="post-actions"><a href="' . $moderationPage . '">' . __('Moderation Page', 'fvcn') . '</a> | <a href="' . add_query_arg(['post' => $postId, 'action' => 'edit'], site_url('/wp-admin/post.php')) . '">' . __('Edit Post', 'fvcn') . '</a> | <a href="' . fvcn_get_post_permalink($postId) . '">' . __('Permalink', 'fvcn') . '</a></div></div></body></html>';
     103
     104    $headers = [
     105        'Content-Type: text/html',
     106    ];
     107
     108    return wp_mail($to, $subject, $message, $headers);
    79109}
     110
     111
     112///////// Admin Functions
     113
     114/**
     115 * fvcn_get_form_option()
     116 *
     117 * @param string $option
     118 * @param bool $slug
     119 * @return mixed
     120 */
     121function fvcn_get_form_option($option, $slug = false)
     122{
     123    $value = FvCommunityNews::$container->get('Config')[$option];
     124
     125    if (true === $slug) {
     126        $value = apply_filters('editable_slug', $value);
     127    }
     128
     129    return apply_filters('fvcn_get_form_option', esc_attr($value));
     130}
     131
    80132
    81133/**
    82134 * is_fvcn()
    83135 *
    84  * @version 20120622
    85136 * @return bool
    86137 */
    87 function is_fvcn()
     138function is_fvcn(): bool
    88139{
    89140    if (fvcn_is_single_post()) {
     
    103154 * fvcn_show_widget_thumbnail()
    104155 *
    105  * @version 20120710
    106156 * @return bool
    107157 */
    108 function fvcn_show_widget_thumbnail()
     158function fvcn_show_widget_thumbnail(): bool
    109159{
    110     return Registry::getInstance()->widgetShowThumbnail;
     160    $registry = \FvCommunityNews::$container->get('Registry');
     161    return $registry['widgetShowThumbnail'];
    111162}
    112163
     
    114165 * fvcn_show_widget_view_all()
    115166 *
    116  * @version 20120710
    117167 * @return bool
    118168 */
    119 function fvcn_show_widget_view_all()
     169function fvcn_show_widget_view_all(): bool
    120170{
    121     return Registry::getInstance()->widgetShowViewAll;
     171    $registry = \FvCommunityNews::$container->get('Registry');
     172    return $registry['widgetShowViewAll'];
    122173}
  • fv-community-news/trunk/src/Template/options-functions.php

    r1763902 r1806332  
    11<?php
    2 
    3 use FvCommunityNews\Options;
    42
    53/**
     
    75 *
    86 * @return bool
    9  * @version 20120524
    107 */
    11 function fvcn_admin_moderation()
     8function fvcn_admin_moderation(): bool
    129{
    13     return apply_filters('fvcn_admin_moderation', (bool) Options::fvcnGetOption('_fvcn_admin_moderation'));
     10    return apply_filters('fvcn_admin_moderation',
     11        FvCommunityNews::$container->get('Config')['_fvcn_admin_moderation']
     12    );
    1413}
    1514
     
    1817 *
    1918 * @return bool
    20  * @version 20120524
    2119 */
    22 function fvcn_user_moderation()
     20function fvcn_user_moderation(): bool
    2321{
    24     return apply_filters('fvcn_user_moderation', (bool) Options::fvcnGetOption('_fvcn_user_moderation'));
     22    return apply_filters('fvcn_user_moderation',
     23        FvCommunityNews::$container->get('Config')['_fvcn_user_moderation']
     24    );
    2525}
    2626
     
    2929 *
    3030 * @return bool
    31  * @version 20120524
    3231 */
    33 function fvcn_mail_on_submission()
     32function fvcn_mail_on_submission(): bool
    3433{
    35     return apply_filters('fvcn_mail_on_submission', (bool) Options::fvcnGetOption('_fvcn_mail_on_submission'));
     34    return apply_filters('fvcn_mail_on_submission',
     35        FvCommunityNews::$container->get('Config')['_fvcn_mail_on_submission']
     36    );
    3637}
    3738
     
    4041 *
    4142 * @return bool
    42  * @version 20120524
    4343 */
    44 function fvcn_mail_on_moderation()
     44function fvcn_mail_on_moderation(): bool
    4545{
    46     return apply_filters('fvcn_mail_on_moderation', (bool) Options::fvcnGetOption('_fvcn_mail_on_moderation'));
     46    return apply_filters('fvcn_mail_on_moderation',
     47        FvCommunityNews::$container->get('Config')['_fvcn_mail_on_moderation']
     48    );
    4749}
    4850
     
    5153 *
    5254 * @return bool
    53  * @version 20120524
    5455 */
    55 function fvcn_is_anonymous_allowed()
     56function fvcn_is_anonymous_allowed(): bool
    5657{
    57     return apply_filters('fvcn_is_anonymous_allowed', (bool) Options::fvcnGetOption('_fvcn_is_anonymous_allowed'));
     58    return apply_filters('fvcn_is_anonymous_allowed',
     59        FvCommunityNews::$container->get('Config')['_fvcn_is_anonymous_allowed']
     60    );
    5861}
  • fv-community-news/trunk/src/Template/post-functions.php

    r1773960 r1806332  
    11<?php
    22
    3 use FvCommunityNews\Container;
    4 use FvCommunityNews\Options;
    53use FvCommunityNews\Post\PostType;
    6 use FvCommunityNews\Registry;
    7 
    84
    95/**
    106 * fvcn_post_slug()
    117 *
    12  * @version 20120321
    138 */
    149function fvcn_post_slug()
     
    2015     * fvcn_get_post_slug()
    2116     *
    22      * @version 20120321
    2317     * @return string
    2418     */
    2519    function fvcn_get_post_slug()
    2620    {
    27         return apply_filters('fvcn_get_post_slug', Registry::get('postSlug'));
     21        $registry = \FvCommunityNews::$container->get('Registry');
     22        return apply_filters('fvcn_get_post_slug', $registry['postSlug']);
    2823    }
    2924
     
    3227 * fvcn_has_posts()
    3328 *
    34  * @version 20120305
    3529 * @param mixed $args
    3630 * @return object
     
    4842    $options = apply_filters('fvcn_has_posts_query', $options);
    4943
    50     Registry::set('wpQuery', new WP_Query($options));
    51 
    52     return apply_filters('fvcn_has_posts', Registry::get('wpQuery')->have_posts(), Registry::get('wpQuery'));
     44    $registry = \FvCommunityNews::$container->get('Registry');
     45    $registry['wpQuery'] = new WP_Query($options);
     46
     47    return apply_filters('fvcn_has_posts', $registry['wpQuery']->have_posts(), $registry['wpQuery']);
    5348}
    5449
     
    5752 * fvcn_posts()
    5853 *
    59  * @version 20120305
    6054 * @return object
    6155 */
    6256function fvcn_posts()
    6357{
    64     $have_posts = Registry::get('wpQuery')->have_posts();
     58    $registry = \FvCommunityNews::$container->get('Registry');
     59    $have_posts = $registry['wpQuery']->have_posts();
    6560
    6661    if (empty($have_posts)) {
     
    7570 * fvcn_the_post()
    7671 *
    77  * @version 20120305
    7872 * @return object
    7973 */
    8074function fvcn_the_post()
    8175{
    82     return Registry::get('wpQuery')->the_post();
     76    $registry = \FvCommunityNews::$container->get('Registry');
     77    return $registry['wpQuery']->the_post();
    8378}
    8479
     
    8782 * fvcn_post_id()
    8883 *
    89  * @version 20120305
    9084 * @param int $postId
    9185 */
     
    9892     * fvcn_get_post_id()
    9993     *
    100      * @version 20120325
    10194     * @param int $postId
    10295     * @return int
     
    10598    {
    10699        global $wp_query, $post;
     100        $registry = \FvCommunityNews::$container->get('Registry');
    107101
    108102        if (!empty($postId) && is_numeric($postId)) {
    109103            $id = $postId;
    110104
    111         } elseif (!empty(Registry::get('wpQuery')->in_the_loop) && isset(Registry::get('wpQuery')->post->ID)) {
    112             $id = Registry::get('wpQuery')->post->ID;
     105        } elseif (!empty($registry['wpQuery']->in_the_loop) && isset($registry['wpQuery']->post->ID)) {
     106            $id = $registry['wpQuery']->post->ID;
    113107
    114108        } elseif (fvcn_is_single_post() && isset($wp_query->post->ID)) {
     
    129123 * fvcn_get_post()
    130124 *
    131  * @version 20120309
    132125 * @param int $postId
    133126 * @return object
     
    154147 * fvcn_post_permalink()
    155148 *
    156  * @version 20120305
    157149 * @param int $postId
    158150 */
     
    165157     * fvcn_get_post_permalink()
    166158     *
    167      * @version 20120305
    168159     * @param int $postId
    169160     * @param string $redirect
     
    187178 * fvcn_has_post_link()
    188179 *
    189  * @version 20120316
    190180 * @param int $postId
    191181 * @return bool
     
    202192 * fvcn_post_link()
    203193 *
    204  * @version 20120311
    205194 * @param int $postId
    206195 */
     
    213202     * fvcn_get_post_link()
    214203     *
    215      * @version 20120311
    216204     * @param int $postId
    217205     * @return string
     
    230218 * fvcn_post_title()
    231219 *
    232  * @version 20120305
    233220 * @param int $postId
    234221 */
     
    241228     * fvcn_get_post_title()
    242229     *
    243      * @version 20120305
    244230     * @param int $postId
    245231     * @return string
     
    256242 * fvcn_post_content()
    257243 *
    258  * @version 20120305
    259244 * @param int $postId
    260245 */
     
    267252     * fvcn_get_post_content()
    268253     *
    269      * @version 20120305
    270254     * @param int $postId
    271255     * @return string
     
    288272 * fvcn_post_excerpt()
    289273 *
    290  * @version 20120305
    291274 * @param int $postId
    292275 * @param int $length
    293276 */
    294 function fvcn_post_excerpt($postId = 0, $length=100) {
     277function fvcn_post_excerpt($postId = 0, $length = 100) {
    295278    echo fvcn_get_post_excerpt($postId, $length);
    296279}
     
    299282     * fvcn_get_post_excerpt()
    300283     *
    301      * @version 20120305
    302284     * @param int $postId
    303285     * @param int $length
    304286     * @return string
    305287     */
    306     function fvcn_get_post_excerpt($postId = 0, $length=100) {
     288    function fvcn_get_post_excerpt($postId = 0, $length = 100) {
    307289        $id = fvcn_get_post_id($postId);
    308290        $length = abs((int)$length);
     
    341323 * fvcn_post_date()
    342324 *
    343  * @version 20120322
    344325 * @param int $postId
    345326 * @param string $format
    346327 */
    347 function fvcn_post_date($postId = 0, $format='') {
     328function fvcn_post_date($postId = 0, $format = '') {
    348329    echo fvcn_get_post_date($postId, $format);
    349330}
     
    352333     * fvcn_get_post_date()
    353334     *
    354      * @version 20120322
    355335     * @param int $postId
    356336     * @param string $format
    357337     * @return string
    358338     */
    359     function fvcn_get_post_date($postId = 0, $format='') {
     339    function fvcn_get_post_date($postId = 0, $format = '') {
    360340        $id = fvcn_get_post_id($postId);
    361341
     
    373353 * fvcn_post_time()
    374354 *
    375  * @version 20120322
    376355 * @param int $postId
    377356 * @param string $format
    378357 * @param bool $gmt
    379358 */
    380 function fvcn_post_time($postId = 0, $format='', $gmt=false) {
     359function fvcn_post_time($postId = 0, $format = '', $gmt = false) {
    381360    echo fvcn_get_post_time($postId, $format, $gmt);
    382361}
     
    385364     * fvcn_get_post_time()
    386365     *
    387      * @version 20120924
    388366     * @param int $postId
    389367     * @param string $format
    390       * @param bool $gmt
     368     * @param bool $gmt
    391369     * @return string
    392370     */
     
    413391 * fvcn_has_post_thumbnail()
    414392 *
    415  * @version 20120801
    416393 * @param int $postId
    417394 * @return bool
     
    420397{
    421398    $id = fvcn_get_post_id($postId);
     399    $registry = \FvCommunityNews::$container->get('Registry');
    422400
    423401    // Double thumbnail display fix.
    424     if ('the_content' != current_filter() || false === Registry::get('nativeThumbnailSupport') || is_archive()) {
     402    if ('the_content' != current_filter() || false === $registry['nativeThumbnailSupport'] || is_archive()) {
    425403        return has_post_thumbnail($id);
    426404    } else {
     
    433411 * fvcn_post_thumbnail()
    434412 *
    435  * @version 20120311
    436413 * @param int $postId
    437414 * @param string|array $size
     
    446423     * fvcn_get_post_thumbnail()
    447424     *
    448      * @version 20120317
    449425     * @param int $postId
    450426     * @param string|array $size
     
    455431    {
    456432        $id = fvcn_get_post_id($postId);
    457 
    458433        return apply_filters('fvcn_get_post_thumbnail', get_the_post_thumbnail($id, $size, $attributes), $id);
    459434    }
     
    463438 * fvcn_post_rating()
    464439 *
    465  * @version 20120321
    466440 * @param int $postId
    467441 */
     
    474448     * fvcn_get_post_rating()
    475449     *
    476      * @version 20120321
    477      * @param int $postId
    478      * @return string
     450     * @param int $postId
     451     * @return int
    479452     */
    480453    function fvcn_get_post_rating($postId = 0)
    481454    {
    482455        $id = fvcn_get_post_id($postId);
    483 
    484456        $rating = get_post_meta($id, '_fvcn_post_rating', true);
    485457
     
    495467 * fvcn_post_rating_increment_link()
    496468 *
    497  * @version 20120321
    498469 * @param int $postId
    499470 */
     
    506477     * fvcn_get_post_rating_increment_link()
    507478     *
    508      * @version 20120321
    509479     * @param int $postId
    510480     * @return string
     
    529499 * fvcn_post_rating_decrement_link()
    530500 *
    531  * @version 20120321
    532501 * @param int $postId
    533502 */
     
    540509     * fvcn_get_post_rating_decrement_link()
    541510     *
    542      * @version 20120321
    543511     * @param int $postId
    544512     * @return string
     
    563531 * fvcn_is_post_rated_by_current_user()
    564532 *
    565  * @version 20120321
    566533 * @param int $postId
    567534 * @return bool
     
    578545 * fvcn_post_views()
    579546 *
    580  * @version 20120622
    581547 * @param int $postId
    582548 */
     
    589555     * fvcn_get_post_views()
    590556     *
    591      * @version 20120622
    592557     * @param int $postId
    593558     * @return int
     
    610575 * fvcn_post_status()
    611576 *
    612  * @version 20120306
    613577 * @param int $postId
    614578 */
     
    621585     * fvcn_get_post_status()
    622586     *
    623      * @version 20120306
    624587     * @param int $postId
    625588     * @return string
     
    636599 * fvcn_post_archive_link()
    637600 *
    638  * @version 20120321
    639601 */
    640602function fvcn_post_archive_link()
     
    646608     * fvcn_get_post_archive_link()
    647609     *
    648      * @version 20120321
    649610     * @return string
    650611     */
     
    660621 * fvcn_is_post()
    661622 *
    662  * @version 20120308
    663  * @param int $postId
    664  * @return bool
    665  */
    666 function fvcn_is_post($postId = 0)
     623 * @param int $postId
     624 * @return bool
     625 */
     626function fvcn_is_post($postId = 0): bool
    667627{
    668628    $is_post = false;
     
    672632    }
    673633
    674     return (bool) apply_filters('fvcn_is_post', $is_post, $postId);
     634    return apply_filters('fvcn_is_post', $is_post, $postId);
    675635}
    676636
     
    679639 * fvcn_is_post_published()
    680640 *
    681  * @version 20120306
    682641 * @param int $postId
    683642 * @return bool
     
    692651 * fvcn_is_post_pending()
    693652 *
    694  * @version 20120306
    695653 * @param int $postId
    696654 * @return bool
     
    705663 * fvcn_is_post_trash()
    706664 *
    707  * @version 20120306
    708665 * @param int $postId
    709666 * @return bool
     
    718675 * fvcn_is_post_spam()
    719676 *
    720  * @version 20120306
    721677 * @param int $postId
    722678 * @return bool
     
    731687 * fvcn_is_post_private()
    732688 *
    733  * @version 20120306
    734689 * @param int $postId
    735690 * @return bool
     
    744699 * fvcn_is_post_anonymous()
    745700 *
    746  * @version 20120306
    747701 * @param int $postId
    748702 * @return bool
     
    769723 * fvcn_is_single_post()
    770724 *
    771  * @version 20120319
    772725 * @return bool
    773726 */
     
    787740 * fvcn_is_post_archive()
    788741 *
    789  * @version 20120322
    790742 * @return bool
    791743 */
     
    805757 * fv_is_post_tag_archive()
    806758 *
    807  * @version 20120325
    808759 * @return bool
    809760 */
     
    823774 * fvcn_post_author()
    824775 *
    825  * @version 20120306
    826776 * @param int $postId
    827777 */
     
    834784     * fvcn_get_post_author()
    835785     *
    836      * @version 20120306
    837786     * @param int $postId
    838787     * @return string
     
    855804 * fvcn_post_author_id()
    856805 *
    857  * @version 20120306
    858806 * @param int $postId
    859807 */
     
    866814     * fvcn_get_post_author_id()
    867815     *
    868      * @version 20120306
    869816     * @param int $postId
    870817     * @return string
     
    882829 * fvcn_post_author_display_name()
    883830 *
    884  * @version 20120306
    885831 * @param int $postId
    886832 */
     
    893839     * fvcn_get_post_author_display_name()
    894840     *
    895      * @version 20120306
    896841     * @param int $postId
    897842     * @return string
     
    914859 * fvcn_post_author_email()
    915860 *
    916  * @version 20120306
    917861 * @param int $postId
    918862 */
     
    925869     * fvcn_get_post_author_email()
    926870     *
    927      * @version 20120306
    928871     * @param int $postId
    929872     * @return string
     
    946889 * fvcn_post_author_avatar()
    947890 *
    948  * @version 20120306
    949891 * @param int $postId
    950892 * @param int $size
     
    958900     * fvcn_get_post_author_avatar()
    959901     *
    960      * @version 20120701
    961902     * @param int $postId
    962903     * @param int $size
     
    974915 * fvcn_post_author_website()
    975916 *
    976  * @version 20120306
    977917 * @param int $postId
    978918 */
     
    985925     * fvcn_get_post_author_website()
    986926     *
    987      * @version 20120306
    988927     * @param int $postId
    989928     * @return string
     
    1006945 * fvcn_post_author_link()
    1007946 *
    1008  * @version 20120305
    1009947 * @param int $postId
    1010948 */
     
    1017955     * fvcn_get_post_author_link()
    1018956     *
    1019      * @version 20120305
    1020957     * @param int $postId
    1021958     * @return string
     
    1038975 * fvcn_post_author_ip()
    1039976 *
    1040  * @version 20120311
    1041977 * @param int $postId
    1042978 */
     
    1049985     * fvcn_get_post_author_ip()
    1050986     *
    1051      * @version 20120311
    1052987     * @param int $postId
    1053988     * @return string
     
    10661001 * fvcn_post_author_ua()
    10671002 *
    1068  * @version 20120322
    10691003 * @param int $postId
    10701004 */
     
    10771011     * fvcn_get_post_author_ua()
    10781012     *
    1079      * @version 20120322
    10801013     * @param int $postId
    10811014     * @return string
     
    10941027 * fvcn_post_tag_id()
    10951028 *
    1096  * @version 20120229
    10971029 */
    10981030function fvcn_post_tag_id()
     
    11051037     *
    11061038     * @return string
    1107      * @version 20171111
    11081039     */
    11091040    function fvcn_get_post_tag_id()
     
    11161047 * fvcn_post_tag_slug()
    11171048 *
    1118  * @version 20120325
    11191049 */
    11201050function fvcn_post_tag_slug()
     
    11261056     * fvcn_get_post_tag_slug()
    11271057     *
    1128      * @version 20120710
    11291058     * @return string
    11301059     */
    11311060    function fvcn_get_post_tag_slug()
    11321061    {
    1133         return apply_filters('fvcn_get_post_tag_slug', Registry::get('postTagSlug'));
     1062        $registry = \FvCommunityNews::$container->get('Registry');
     1063        return apply_filters('fvcn_get_post_tag_slug', $registry['postTagSlug']);
    11341064    }
    11351065
     
    11381068 * fvcn_post_tag_list()
    11391069 *
    1140  * @version 20120311
    11411070 * @param int $postId
    11421071 * @param string|array $args
     
    11501079     * fvcn_get_post_tag_list()
    11511080     *
    1152      * @version 20120311
    11531081     * @param int $postId
    11541082     * @param string|array $args
     
    11781106 * fvcn_post_form_fields()
    11791107 *
    1180  * @version 20171123
    11811108 */
    11821109function fvcn_post_form_fields()
     
    11941121 * fvcn_post_form_field_error()
    11951122 *
    1196  * @version 20120706
    11971123 * @param string $field
    11981124 */
    11991125function fvcn_post_form_field_error($field)
    12001126{
    1201     $errors = Container::getInstance()->getWpError()->get_error_messages($field);
     1127    $errors = FvCommunityNews::$container->get(WP_Error::class)->get_error_messages($field);
    12021128
    12031129    if (empty($errors)) {
     
    12181144 * fvcn_post_form_author_name_label()
    12191145 *
    1220  * @version 20120306
    12211146 */
    12221147function fvcn_post_form_author_name_label()
     
    12281153     * fvcn_get_post_form_author_name_label()
    12291154     *
    1230      * @version 20120524
    1231      * @return string
    1232      */
    1233     function fvcn_get_post_form_author_name_label()
    1234     {
    1235         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_author_name_label'));
    1236 
     1155     * @return string
     1156     */
     1157    function fvcn_get_post_form_author_name_label(): string
     1158    {
     1159        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_author_name_label']);
    12371160        return apply_filters('fvcn_get_post_form_author_name_label', $label);
    12381161    }
     
    12411164 * fvcn_post_form_author_name()
    12421165 *
    1243  * @version 20120306
    12441166 */
    12451167function fvcn_post_form_author_name()
     
    12511173     * fvcn_get_post_form_author_name()
    12521174     *
    1253      * @version 20120306
    12541175     * @return string
    12551176     */
     
    12691190 * fvcn_post_form_author_email_label()
    12701191 *
    1271  * @version 20120306
    12721192 */
    12731193function fvcn_post_form_author_email_label()
     
    12791199     * fvcn_get_post_form_author_email_label()
    12801200     *
    1281      * @version 20120524
    1282      * @return string
    1283      */
    1284     function fvcn_get_post_form_author_email_label()
    1285     {
    1286         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_author_email_label'));
    1287 
     1201     * @return string
     1202     */
     1203    function fvcn_get_post_form_author_email_label(): string
     1204    {
     1205        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_author_email_label']);
    12881206        return apply_filters('fvcn_get_post_form_author_email_label', $label);
    12891207    }
     
    12921210 * fvcn_post_form_author_email()
    12931211 *
    1294  * @version 20120306
    12951212 */
    12961213function fvcn_post_form_author_email()
     
    13021219     * fvcn_get_post_form_author_email()
    13031220     *
    1304      * @version 20120306
    13051221     * @return string
    13061222     */
     
    13201236 * fvcn_post_form_title_label()
    13211237 *
    1322  * @version 20120306
    13231238 */
    13241239function fvcn_post_form_title_label()
     
    13301245     * fvcn_get_post_form_title_label()
    13311246     *
    1332      * @version 20120524
    1333      * @return string
    1334      */
    1335     function fvcn_get_post_form_title_label()
    1336     {
    1337         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_title_label'));
    1338 
     1247     * @return string
     1248     */
     1249    function fvcn_get_post_form_title_label(): string
     1250    {
     1251        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_title_label']);
    13391252        return apply_filters('fvcn_get_post_form_title_label', $label);
    13401253    }
     
    13431256 * fvcn_post_form_title()
    13441257 *
    1345  * @version 20120306
    13461258 */
    13471259function fvcn_post_form_title()
     
    13531265     * fvcn_get_post_form_title()
    13541266     *
    1355      * @version 20120306
    13561267     * @return string
    13571268     */
     
    13711282 * fvcn_post_form_link_label()
    13721283 *
    1373  * @version 20120307
    13741284 */
    13751285function fvcn_post_form_link_label()
     
    13811291     * fvcn_get_post_form_link_label()
    13821292     *
    1383      * @version 20120524
    1384      * @return string
    1385      */
    1386     function fvcn_get_post_form_link_label()
    1387     {
    1388         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_link_label'));
    1389 
     1293     * @return string
     1294     */
     1295    function fvcn_get_post_form_link_label(): string
     1296    {
     1297        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_link_label']);
    13901298        return apply_filters('fvcn_get_post_form_link_label', $label);
    13911299    }
     
    13941302 * fvcn_post_form_link()
    13951303 *
    1396  * @version 20120307
    13971304 */
    13981305function fvcn_post_form_link()
     
    14041311     * fvcn_get_post_form_link()
    14051312     *
    1406      * @version 20120307
    14071313     * @return string
    14081314     */
     
    14211327 * fvcn_is_post_form_link_required()
    14221328 *
    1423  * @version 20120524
    1424  * @return bool
    1425  */
    1426 function fvcn_is_post_form_link_required()
    1427 {
    1428     return apply_filters('fvcn_is_post_form_link_required', (bool) Options::fvcnGetOption('_fvcn_post_form_link_required'));
     1329 * @return bool
     1330 */
     1331function fvcn_is_post_form_link_required(): bool
     1332{
     1333    return apply_filters('fvcn_is_post_form_link_required',
     1334        FvCommunityNews::$container->get('Config')['_fvcn_post_form_link_required']
     1335    );
    14291336}
    14301337
     
    14331340 * fvcn_post_form_content_label()
    14341341 *
    1435  * @version 20120306
    14361342 */
    14371343function fvcn_post_form_content_label()
     
    14431349     * fvcn_get_post_form_content_label()
    14441350     *
    1445      * @version 20120524
    1446      * @return string
    1447      */
    1448     function fvcn_get_post_form_content_label()
    1449     {
    1450         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_content_label'));
    1451 
     1351     * @return string
     1352     */
     1353    function fvcn_get_post_form_content_label(): string
     1354    {
     1355        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_content_label']);
    14521356        return apply_filters('fvcn_get_post_form_content_label', $label);
    14531357    }
     
    14561360 * fvcn_post_form_content()
    14571361 *
    1458  * @version 20120306
    14591362 */
    14601363function fvcn_post_form_content()
     
    14661369     * fvcn_get_post_form_content()
    14671370     *
    1468      * @version 20120306
    14691371     * @return string
    14701372     */
     
    14841386 * fvcn_post_form_tags_label()
    14851387 *
    1486  * @version 20120306
    14871388 */
    14881389function fvcn_post_form_tags_label()
     
    14941395     * fvcn_get_post_form_tags_label()
    14951396     *
    1496      * @version 20120524
    1497      * @return string
    1498      */
    1499     function fvcn_get_post_form_tags_label()
    1500     {
    1501         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_tags_label'));
    1502 
     1397     * @return string
     1398     */
     1399    function fvcn_get_post_form_tags_label(): string
     1400    {
     1401        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_tags_label']);
    15031402        return apply_filters('fvcn_get_post_form_tags_label', $label);
    15041403    }
     
    15071406 * fvcn_post_form_tags()
    15081407 *
    1509  * @version 20120306
    15101408 */
    15111409function fvcn_post_form_tags()
     
    15171415     * fvcn_get_post_form_tags()
    15181416     *
    1519      * @version 20120306
    15201417     * @return string
    15211418     */
     
    15341431 * fvcn_is_post_form_tags_required()
    15351432 *
    1536  * @version 20120524
    1537  * @return bool
    1538  */
    1539 function fvcn_is_post_form_tags_required()
    1540 {
    1541     return apply_filters('fvcn_is_post_form_tags_required', (bool) Options::fvcnGetOption('_fvcn_post_form_tags_required'));
     1433 * @return bool
     1434 */
     1435function fvcn_is_post_form_tags_required(): bool
     1436{
     1437    return apply_filters('fvcn_is_post_form_tags_required',
     1438        FvCommunityNews::$container->get('Config')['_fvcn_post_form_tags_required']
     1439    );
    15421440}
    15431441
     
    15461444 * fvcn_post_form_thumbnail_label()
    15471445 *
    1548  * @version 20120306
    15491446 */
    15501447function fvcn_post_form_thumbnail_label()
     
    15561453     * fvcn_get_post_form_thumbnail_label()
    15571454     *
    1558      * @version 20120524
    1559      * @return string
    1560      */
    1561     function fvcn_get_post_form_thumbnail_label()
    1562     {
    1563         $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_thumbnail_label'));
    1564 
     1455     * @return string
     1456     */
     1457    function fvcn_get_post_form_thumbnail_label(): string
     1458    {
     1459        $label = esc_attr(FvCommunityNews::$container->get('Config')['_fvcn_post_form_thumbnail_label']);
    15651460        return apply_filters('fvcn_get_post_form_thumbnail_label', $label);
    15661461    }
     
    15691464 * fvcn_is_post_form_thumbnail_enabled()
    15701465 *
    1571  * @version 20120524
    1572  * @return bool
    1573  */
    1574 function fvcn_is_post_form_thumbnail_enabled()
    1575 {
    1576     return apply_filters('fvcn_is_post_form_thumbnail_enabled', (bool) Options::fvcnGetOption('_fvcn_post_form_thumbnail_enabled'));
     1466 * @return bool
     1467 */
     1468function fvcn_is_post_form_thumbnail_enabled(): bool
     1469{
     1470    return apply_filters('fvcn_is_post_form_thumbnail_enabled',
     1471        FvCommunityNews::$container->get('Config')['_fvcn_post_form_thumbnail_enabled']
     1472    );
    15771473}
    15781474
     
    15801476 * fvcn_is_post_form_thumbnail_required()
    15811477 *
    1582  * @version 20120524
    1583  * @return bool
    1584  */
    1585 function fvcn_is_post_form_thumbnail_required()
    1586 {
    1587     return apply_filters('fvcn_is_post_form_thumbnail_required', (bool) Options::fvcnGetOption('_fvcn_post_form_thumbnail_required'));
     1478 * @return bool
     1479 */
     1480function fvcn_is_post_form_thumbnail_required(): bool
     1481{
     1482    return apply_filters('fvcn_is_post_form_thumbnail_required',
     1483        FvCommunityNews::$container->get('Config')['_fvcn_post_form_thumbnail_required']
     1484    );
    15881485}
    15891486
     
    15921489 * fvcn_is_post_added()
    15931490 *
    1594  * @version 20120531
    15951491 * @return bool
    15961492 */
     
    16071503     * fvcn_is_post_added_approved()
    16081504     *
    1609      * @version 20120531
    16101505     * @return bool
    16111506     */
  • fv-community-news/trunk/src/Template/tag-functions.php

    r1763902 r1806332  
    44 * fvcn_tag_cloud()
    55 *
    6  * @version 20120716
    76 * @param string|array $args
    87 */
  • fv-community-news/trunk/src/Template/user-functions.php

    r1773960 r1806332  
    66 * fvcn_is_anonymous()
    77 *
    8  * @version 20120229
    98 * @return bool
    109 */
     
    2221 * fvcn_get_current_author_ip()
    2322 *
    24  * @version 20120229
    2523 * @return string
    2624 */
     
    3432 * fvcn_get_current_author_ua()
    3533 *
    36  * @version 20120229
    3734 * @return string
    3835 */
     
    5047 * fvcn_user_id()
    5148 *
    52  * @version 20120307
    5349 * @param int $userId
    5450 */
     
    6056     * fvcn_get_user_id()
    6157     *
    62      * @version 20120307
    63                  * @param int $userId
     58     * @param int $userId
    6459     * @return int
    6560     */
     
    8277 * fvcn_current_user_id()
    8378 *
    84  * @version 20120229
    8579 */
    8680function fvcn_current_user_id() {
     
    9185     * fvcn_get_current_user_id()
    9286     *
    93      * @version 20120229
    94              * @return int
     87     * @return int
    9588     */
    9689    function fvcn_get_current_user_id() {
     
    10497 * fvcn_current_user_name()
    10598 *
    106  * @version 20120307
    10799 */
    108100function fvcn_current_user_name() {
     
    113105     * fvcn_get_current_user_name()
    114106     *
    115      * @version 20120307
    116107     * @return string
    117108     */
     
    126117 * fvcn_has_user_posts()
    127118 *
    128  * @version 20120323
    129119 * @param int $userId
    130120 * @param string $post_status
  • fv-community-news/trunk/src/Validator/AbstractValidator.php

    r1763902 r1806332  
    1919     * setMessage()
    2020     *
    21      * @version 20120704
    2221     * @param string $message
    2322     * @return AbstractValidator
     
    3231     * getMessage()
    3332     *
    34      * @version 20120704
    3533     * @return string
    3634     */
  • fv-community-news/trunk/src/Validator/ValidatorChain.php

    r1763902 r1806332  
    1919     * __construct()
    2020     *
    21      * @version 20120705
    2221     * @param array $validators
    2322     */
     
    3231     * setValidators()
    3332     *
    34      * @version 20120705
    3533     * @param array $validators
    3634     * @return ValidatorChain
     
    5048     * clearValidators()
    5149     *
    52      * @version 20120705
    5350     * @return ValidatorChain
    5451     */
     
    6259     * getValidators()
    6360     *
    64      * @version 20120705
    6561     * @return array
    6662     */
     
    7369     * addValidator()
    7470     *
    75      * @version 20120705
    7671     * @param string|AbstractValidator $validator
    7772     * @return ValidatorChain
     
    9691     * removeValidator()
    9792     *
    98      * @version 20120705
    9993     * @param string|AbstractValidator $validator
    10094     * @return ValidatorChain
     
    116110     * validate()
    117111     *
    118      * @version 20120705
    119112     * @param mixed $value
    120113     * @return boolean
  • fv-community-news/trunk/src/Version.php

    r1763902 r1806332  
    2929     *
    3030     * @return string
    31      * @version 20171103
    3231     */
    3332    public static function getCurrentVersion()
     
    4039     *
    4140     * @return string
    42      * @version 20171107
    4341     */
    4442    public static function getLatestVersion()
  • fv-community-news/trunk/src/View/AjaxForm.php

    r1763902 r1806332  
    33namespace FvCommunityNews\View;
    44
    5 use FvCommunityNews\Container;
    65use FvCommunityNews\Post\PostType;
    7 use FvCommunityNews\Registry;
    86
    97/**
     
    2220     * __construct()
    2321     *
    24      * @version 20120712
    2522     */
    2623    public function __construct()
     
    4340     * enqueueScripts()
    4441     *
    45      * @version 20120717
    4642     * @return AjaxForm
    4743     */
    4844    public function enqueueScripts()
    4945    {
    50         // Replace the outdated version of jQuery Form that is shipped with WordPress
    51         wp_deregister_script('jquery-form');
    52         wp_register_script('jquery-form', Registry::get('pluginUrl') . 'public/js/jquery-form.js');
     46        $registry = \FvCommunityNews::$container->get('Registry');
    5347
    54         wp_enqueue_script('fvcn-js', Registry::get('pluginUrl') . 'public/js/fvcn-js.js', ['jquery', 'jquery-form']);
    55 
     48        wp_enqueue_script('fvcn-js', $registry['pluginUrl'] . 'public/js/post-form.min.js', ['jquery', 'jquery-form'], false, true);
    5649        wp_localize_script('fvcn-js', 'FvCommunityNewsJavascript', $this->jsParams);
    5750
     
    6962        if (fvcn_has_errors()) {
    7063            $errors = [];
    71             foreach (Container::getInstance()->getWpError()->get_error_codes() as $code) {
    72                 $errors[ $code ] = Container::getInstance()->getWpError()->get_error_message($code);
     64            foreach (\FvCommunityNews::$container->get(\WP_Error::class)->get_error_codes() as $code) {
     65                $errors[ $code ] = \FvCommunityNews::$container->get(\WP_Error::class)->get_error_message($code);
    7366            }
    7467
  • fv-community-news/trunk/src/Widget/Form.php

    r1773960 r1806332  
    1515     * register()
    1616     *
    17      * @version 20120306
    1817     */
    1918    public static function register()
     
    2524     * __construct()
    2625     *
    27      * @version 20171108
    2826     */
    2927    public function __construct()
     
    4240     * @param mixed $args
    4341     * @param array $instance
    44      * @version 20120306
    4542     */
    4643    public function widget($args, $instance)
     
    7572     * @param array $old_instance
    7673     * @return array
    77      * @version 20120306
    7874     */
    7975    public function update($new_instance, $old_instance)
     
    8985     *
    9086     * @param array $instance
    91          * @version 20120306
    9287     */
    9388    public function form($instance)
  • fv-community-news/trunk/src/Widget/ListPosts.php

    r1773960 r1806332  
    33namespace FvCommunityNews\Widget;
    44
    5 use FvCommunityNews\Registry;
    65use WP_Widget;
    76
     
    1615     * register()
    1716     *
    18      * @version 20120305
    1917     */
    2018    public static function register()
     
    2624     * __construct()
    2725     *
    28      * @version 20171108
    2926     */
    3027    public function __construct()
     
    4340     * @param mixed $args
    4441     * @param array $instance
    45          * @version 20120710
    4642     */
    4743    public function widget($args, $instance)
     
    5349        $num_posts = !empty($instance['num_posts']) ? $instance['num_posts'] : '5';
    5450
    55         $registry = Registry::getInstance();
    56         $registry->widgetShowThumbnail = !empty($instance['thumbnail']) ? true : false;
    57         $registry->widgetShowViewAll = !empty($instance['view_all']) ? true : false;
     51        $registry = \FvCommunityNews::$container->get('Registry');
     52        $registry['widgetShowThumbnail'] = !empty($instance['thumbnail']) ? true : false;
     53        $registry['widgetShowViewAll'] = !empty($instance['view_all']) ? true : false;
    5854
    5955        $options = [
     
    7874     * @param array $old_instance
    7975     * @return array
    80      * @version 20120305
    8176     */
    8277    public function update($new_instance, $old_instance)
     
    10297     * @param array $instance
    10398     * @return void
    104      * @version 20120305
    10599     */
    106100    public function form($instance)
  • fv-community-news/trunk/src/Widget/TagCloud.php

    r1773960 r1806332  
    1515     * register()
    1616     *
    17      * @version 20120411
    1817     */
    1918    public static function register()
     
    2524     * __construct()
    2625     *
    27      * @version 20171108
    2826     */
    2927    public function __construct()
     
    4240     * @param mixed $args
    4341     * @param array $instance
    44      * @version 20120411
    4542     */
    4643    public function widget($args, $instance)
     
    6764     * @param array $old_instance
    6865     * @return array
    69      * @version 20120411
    7066     */
    7167    public function update($new_instance, $old_instance)
     
    8177     *
    8278     * @param array $instance
    83          * @version 20120411
    8479     */
    8580    public function form($instance)
Note: See TracChangeset for help on using the changeset viewer.