Changeset 1806332
- Timestamp:
- 01/20/2018 06:48:27 PM (8 years ago)
- Location:
- fv-community-news/trunk
- Files:
-
- 37 added
- 9 deleted
- 45 edited
-
composer.json (modified) (1 diff)
-
config/services.config.php (added)
-
fv-community-news.php (modified) (4 diffs)
-
fvcn-includes/fvcn-common-functions.php (deleted)
-
fvcn-includes/fvcn-core-theme.php (modified) (13 diffs)
-
fvcn-includes/fvcn-post-functions.php (modified) (9 diffs)
-
fvcn-theme/archive-fvcn.php (modified) (1 diff)
-
fvcn-theme/fvcn/content-archive-post.php (modified) (1 diff)
-
fvcn-theme/fvcn/content-single-post.php (modified) (3 diffs)
-
fvcn-theme/fvcn/css/fvcn-theme.css (modified) (4 diffs)
-
fvcn-theme/fvcn/css/fvcn-theme.min.css (added)
-
fvcn-theme/fvcn/feedback-no-anonymous.php (modified) (1 diff)
-
fvcn-theme/fvcn/feedback-no-posts.php (modified) (1 diff)
-
fvcn-theme/fvcn/form-post.php (modified) (7 diffs)
-
fvcn-theme/fvcn/loop-posts.php (modified) (1 diff)
-
fvcn-theme/fvcn/loop-single-post.php (modified) (1 diff)
-
fvcn-theme/fvcn/widget-loop-posts.php (modified) (3 diffs)
-
fvcn-theme/fvcn/widget-loop-single-post.php (modified) (2 diffs)
-
fvcn-theme/single-fvcn.php (modified) (1 diff)
-
public/js/dashboard.js (modified) (2 diffs)
-
public/js/fvcn-js.js (deleted)
-
public/js/jquery-form.js (deleted)
-
public/js/post-form.js (added)
-
public/js/post-form.min.js (added)
-
public/js/post-moderation.js (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
src/Admin/Admin.php (modified) (12 diffs)
-
src/Admin/AdminFactory.php (deleted)
-
src/Admin/Dashboard/Dashboard.php (modified) (3 diffs)
-
src/Admin/Dashboard/Widget/RecentPosts.php (modified) (12 diffs)
-
src/Admin/Post/Edit.php (modified) (4 diffs)
-
src/Admin/Post/Moderation.php (modified) (16 diffs)
-
src/Admin/Settings/Form.php (modified) (28 diffs)
-
src/Admin/Settings/Settings.php (modified) (15 diffs)
-
src/Akismet/Akismet.php (modified) (14 diffs)
-
src/Akismet/Handler.php (modified) (12 diffs)
-
src/Application (deleted)
-
src/Config (added)
-
src/Config.php (deleted)
-
src/Config/AbstractConfig.php (added)
-
src/Config/Memory.php (added)
-
src/Config/WordPress.php (added)
-
src/Container (added)
-
src/Container.php (deleted)
-
src/Container/Container.php (added)
-
src/Container/FactoryInterface.php (added)
-
src/Container/InvokableFactory.php (added)
-
src/Factory (added)
-
src/Factory/Admin (added)
-
src/Factory/Admin/Admin.php (added)
-
src/Factory/Admin/Dashboard (added)
-
src/Factory/Admin/Dashboard/Dashboard.php (added)
-
src/Factory/Admin/Post (added)
-
src/Factory/Admin/Post/Moderation.php (added)
-
src/Factory/Akismet (added)
-
src/Factory/Akismet/Akismet.php (added)
-
src/Factory/Akismet/Handler.php (added)
-
src/Factory/Hook (added)
-
src/Factory/Hook/Akismet.php (added)
-
src/Factory/Hook/EnqueueScripts.php (added)
-
src/Factory/Hook/Init.php (added)
-
src/Factory/View (added)
-
src/Factory/View/AjaxForm.php (added)
-
src/Hook (added)
-
src/Hook/Akismet.php (added)
-
src/Hook/Collection.php (added)
-
src/Hook/EnqueueScripts.php (added)
-
src/Hook/Head.php (added)
-
src/Hook/HookInterface.php (added)
-
src/Hook/Init.php (added)
-
src/Hook/WidgetsInit.php (added)
-
src/Installer.php (modified) (8 diffs)
-
src/Options.php (deleted)
-
src/Post/Mapper.php (added)
-
src/Post/PostType.php (modified) (3 diffs)
-
src/Registry.php (deleted)
-
src/Shortcode/PostForm.php (modified) (2 diffs)
-
src/Shortcode/RecentPosts.php (modified) (2 diffs)
-
src/Shortcode/TagCloud.php (modified) (2 diffs)
-
src/Template/common-functions.php (modified) (3 diffs)
-
src/Template/options-functions.php (modified) (6 diffs)
-
src/Template/post-functions.php (modified) (112 diffs)
-
src/Template/tag-functions.php (modified) (1 diff)
-
src/Template/user-functions.php (modified) (10 diffs)
-
src/Validator/AbstractValidator.php (modified) (2 diffs)
-
src/Validator/ValidatorChain.php (modified) (7 diffs)
-
src/Version.php (modified) (2 diffs)
-
src/View/AjaxForm.php (modified) (4 diffs)
-
src/Widget/Form.php (modified) (5 diffs)
-
src/Widget/ListPosts.php (modified) (7 diffs)
-
src/Widget/TagCloud.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fv-community-news/trunk/composer.json
r1799949 r1806332 13 13 "prefer-stable": true, 14 14 "require": { 15 "php": "^ 5.6"15 "php": "^7.0" 16 16 }, 17 17 "autoload": { -
fv-community-news/trunk/fv-community-news.php
r1799949 r1806332 5 5 * Plugin URI: https://frankverhoeven.me/wordpress-plugin-fv-community-news/ 6 6 * Description: Allow visitors of your site to submit articles. 7 * Version: 3.1. 17 * Version: 3.1.2 8 8 * Author: Frank Verhoeven 9 9 * Author URI: https://frankverhoeven.me/ 10 10 */ 11 11 12 use FvCommunityNews\Application\Application; 13 use FvCommunityNews\Options; 14 use FvCommunityNews\Registry; 12 use FvCommunityNews\AutoLoader; 13 use FvCommunityNews\Config\WordPress as Config; 14 use FvCommunityNews\Container\Container; 15 use FvCommunityNews\Hook\Collection as HookCollection; 15 16 16 17 if (!defined('ABSPATH')) exit; … … 26 27 * @var string 27 28 */ 28 const VERSION = '3.1. 1';29 const VERSION = '3.1.2'; 29 30 /** 30 31 * @var string … … 35 36 */ 36 37 const FILE = __FILE__; 38 /** 39 * @var Container 40 */ 41 public static $container; 37 42 38 43 /** 39 44 * __construct() 40 45 * 41 * @version 2012070942 46 */ 43 47 public function __construct() 44 {}45 46 /**47 * start()48 *49 * @version 2012071050 */51 public function start()52 48 { 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']); 58 51 } 59 52 60 53 /** 61 * loadFiles()54 * Start the application 62 55 * 63 * @version 20120716 64 * @return FvCommunityNews 65 * @throws Exception 56 * @return void 66 57 */ 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 68 76 { 69 77 include_once __DIR__ . '/src/Autoloader.php'; 70 78 71 $autoloader = new \FvCommunityNews\AutoLoader(['FvCommunityNews' => __DIR__ . '/src/']);79 $autoloader = new AutoLoader(['FvCommunityNews' => __DIR__ . '/src/']); 72 80 $autoloader->register(); 73 81 74 82 $files = [ 75 83 '/fvcn-includes/fvcn-core-theme.php', 76 '/fvcn-includes/fvcn-common-functions.php',77 84 '/fvcn-includes/fvcn-post-functions.php', 78 85 … … 87 94 $autoloader->loadFile(__DIR__ . $file); 88 95 } 89 90 return $this;91 96 } 92 97 93 98 /** 94 * setupVariables()99 * Activation Hook 95 100 * 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 97 111 * 98 * @version 20120710 99 * @return FvCommunityNews 112 * @return void 100 113 */ 101 p rivate function setupVariables()114 public static function deactivation(): void 102 115 { 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 } 106 118 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'); 120 127 } 121 128 } -
fv-community-news/trunk/fvcn-includes/fvcn-core-theme.php
r1773960 r1806332 2 2 3 3 use FvCommunityNews\Post\PostType; 4 use FvCommunityNews\Registry;5 4 6 5 /** 7 6 * fvcn_get_theme_dir() 8 7 * 9 * @ version 2012053110 * @return string11 */ 12 function fvcn_get_theme_dir() 13 { 14 return apply_filters('fvcn_get_theme_dir', Registry::get('themeDir'));8 * @return string 9 */ 10 function fvcn_get_theme_dir(): string 11 { 12 $reg = FvCommunityNews::$container->get('Registry'); 13 return apply_filters('fvcn_get_theme_dir', $reg['themeDir']); 15 14 } 16 15 … … 19 18 * fvcn_get_theme_url() 20 19 * 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 */ 22 function 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 */ 35 function fvcn_template_include($template = ''): string 36 { 37 return apply_filters('fvcn_template_include', $template); 27 38 } 28 39 … … 31 42 * fvcn_theme_get_template_part() 32 43 * 33 * @version 2012071634 44 * @param string $slug 35 45 * @param string $name … … 54 64 * fvcn_get_query_template() 55 65 * 56 * @version 2012071657 66 * @param string $type 58 67 * @param array $templates … … 61 70 function fvcn_get_query_template($type, $templates) 62 71 { 72 $reg = FvCommunityNews::$container->get('Registry'); 63 73 $templates = apply_filters('fvcn_get_' . $type . '_template', $templates); 64 74 65 75 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; 69 79 } 70 80 … … 76 86 * fvcn_theme_get_single_post_template() 77 87 * 78 * @version 2012080679 88 * @return string 80 89 */ … … 91 100 * fvcn_theme_get_post_archive_template() 92 101 * 93 * @version 2012080694 102 * @return string 95 103 */ … … 106 114 * fvcn_theme_get_post_tag_archive_template() 107 115 * 108 * @version 20120806109 116 * @return string 110 117 */ … … 119 126 120 127 /** 121 * fvcn_enqueue_theme_css()122 *123 * @version 20120717124 */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 /**138 128 * fvcn_theme_compat_active() 139 129 * 140 * @version 20120716141 130 * @return bool 142 131 */ … … 144 133 { 145 134 $active = true; 146 147 if (false === Registry::get('themeCompatActive')) { 135 $reg = FvCommunityNews::$container->get('Registry'); 136 137 if (false === $reg['themeCompatActive']) { 148 138 $active = false; 149 139 } … … 156 146 * fvcn_theme_compat_template_include() 157 147 * 158 * @version 20120716159 148 * @param string $template 160 149 * @return string … … 170 159 } elseif (fvcn_is_post_archive()) { 171 160 $newTemplate = fvcn_theme_get_post_archive_template(); 172 } else if (fvcn_is_post_tag_archive()){161 } else { 173 162 $newTemplate = fvcn_theme_get_post_tag_archive_template(); 174 163 } … … 187 176 * fvcn_theme_compat_replace_the_content() 188 177 * 189 * @version 20120707190 178 * @param string $content 191 179 * @return string -
fv-community-news/trunk/fvcn-includes/fvcn-post-functions.php
r1773960 r1806332 9 9 * fvcn_insert_post() 10 10 * 11 * @version 2012032212 11 * 13 12 * @param array $post_data … … 60 59 * fvcn_insert_post_thumbnail() 61 60 * 62 * @version 2012030763 61 * @param int $postId 64 62 * @return int … … 81 79 * fvcn_new_post_handler() 82 80 * 83 * @ version 2012080881 * @return int|void 84 82 */ 85 83 function fvcn_new_post_handler() … … 308 306 * fvcn_filter_new_post_data() 309 307 * 310 * @version 20120710311 308 * @param array $data 312 309 * @return array … … 326 323 * fvcn_increase_post_view_count() 327 324 * 328 * @version 20120722329 325 * @param string $template 330 326 * @return string … … 341 337 } 342 338 343 $postMapper = new FvCommunityNews_PostMapper();339 $postMapper = new \FvCommunityNews\Post\Mapper(); 344 340 $postMapper->increasePostViewCount($id); 345 341 … … 351 347 352 348 /** 353 * fvcn_publish_post()354 *355 * @version 20120722356 * @param int $postId357 * @return int358 */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 20120722370 * @param int $postId371 * @return int372 */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 20120722384 * @param int $postId385 * @return int386 */387 function fvcn_spam_post($postId)388 {389 $postMapper = new FvCommunityNews_PostMapper();390 return $postMapper->spamPost($postId);391 }392 393 394 /**395 349 * fvcn_post_rating_handler() 396 350 * 397 * @version 20120722398 351 */ 399 352 function fvcn_post_rating_handler() … … 416 369 check_admin_referer('fvcn-post-rating'); 417 370 418 $postMapper = new FvCommunityNews_PostMapper();371 $postMapper = new \FvCommunityNews\Post\Mapper(); 419 372 if ('increase' == $_REQUEST['fvcn_post_rating_action']) { 420 373 $postMapper->increasePostRating($id); … … 427 380 wp_redirect(fvcn_get_post_permalink($id)); 428 381 } 429 430 431 /**432 * FvCommunityNews_PostMapper433 *434 */435 class FvCommunityNews_PostMapper436 {437 /**438 * changePostStatus()439 *440 * @version 20120722441 * @param int $postId442 * @param string $status443 * @return int444 */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 20120722458 * @param int $postId459 * @return int460 */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 20120722472 * @param int $postId473 * @return int474 */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 20120728486 * @param int $postId487 * @return int488 */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 20120722500 * @param int $postId501 */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 20120722513 * @param int $postId514 */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 20120724526 * @param int $postId527 */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 4 4 * The Template for displaying the archive of community posts. 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme -
fv-community-news/trunk/fvcn-theme/fvcn/content-archive-post.php
r1773960 r1806332 4 4 * content-archive-post.php 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme -
fv-community-news/trunk/fvcn-theme/fvcn/content-single-post.php
r1760963 r1806332 6 6 * Displays a single posts content' 7 7 * 8 * @version 201207169 8 * @package FV Community News 10 9 * @subpackage Theme … … 30 29 </div><!-- .entry-content --> 31 30 32 < footerclass="fvcn-post-meta">31 <div class="fvcn-post-meta"> 33 32 <span class="fvcn-post-tags"> 34 33 <?php fvcn_post_tag_list(0, ['before'=>__('Tags: ', 'fvcn'), 'after'=>'']); ?> … … 46 45 <?php endif; ?> 47 46 </span> 48 </ footer><!-- .entry-meta -->47 </div><!-- .entry-meta --> -
fv-community-news/trunk/fvcn-theme/fvcn/css/fvcn-theme.css
r1773960 r1806332 3 3 * 4 4 * @author Frank Verhoeven <[email protected]> 5 * @version 201711126 5 */ 7 6 … … 32 31 } 33 32 34 .fvcn-post-link { 35 font-weight: bold; 36 font-size: 1.1em; 37 } 33 .fvcn-post-link {} 38 34 39 35 … … 72 68 * 73 69 */ 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 105 70 .fvcn_form_widget .fvcn-post-form input[type="text"], 106 71 .fvcn_form_widget .fvcn-post-form input[type="file"], … … 108 73 width: 100%; 109 74 } 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 7 7 * logged in, in order to post. 8 8 * 9 * @version 2012031710 9 * @package FV Community News 11 10 * @subpackage Theme -
fv-community-news/trunk/fvcn-theme/fvcn/feedback-no-posts.php
r1760963 r1806332 6 6 * The message that will be displayed when there are no posts. 7 7 * 8 * @version 201203189 8 * @package FV Community News 10 9 * @subpackage Theme -
fv-community-news/trunk/fvcn-theme/fvcn/form-post.php
r1773960 r1806332 6 6 * The form for submitting community news. 7 7 * 8 * @version 201711129 8 * @package FV Community News 10 9 * @subpackage Theme … … 13 12 ?> 14 13 15 <?php if (fvcn_is_post_added()) : ?>14 <?php if (fvcn_is_post_added()): ?> 16 15 17 16 <?php do_action('fvcn_post_added_before'); ?> 18 17 <div class="fvcn-post-added"> 19 <?php if (fvcn_is_post_added_approved()) : ?>18 <?php if (fvcn_is_post_added_approved()): ?> 20 19 <p><?php _e('Your post has been added.', 'fvcn'); ?></p> 21 <?php else : ?>20 <?php else: ?> 22 21 <p><?php _e('Your post has been added and is pending review.', 'fvcn'); ?></p> 23 22 <?php endif; ?> … … 25 24 <?php do_action('fvcn_post_added_after'); ?> 26 25 27 <?php else : ?>26 <?php else: ?> 28 27 29 28 <?php do_action('fvcn_post_form_before'); ?> … … 34 33 </div> 35 34 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; ?>> 37 36 <?php do_action('fvcn_post_form_extras_top'); ?> 38 37 39 <?php if (fvcn_is_anonymous()) : ?>38 <?php if (fvcn_is_anonymous()): ?> 40 39 41 40 <?php do_action('fvcn_post_form_before_author_name'); ?> … … 59 58 <?php do_action('fvcn_post_form_after_author_email'); ?> 60 59 61 <?php else : ?>60 <?php else: ?> 62 61 63 62 <div class="fvcn-post-form-author-logged-in"> … … 107 106 <?php do_action('fvcn_post_form_after_tags'); ?> 108 107 109 <?php if (fvcn_is_post_form_thumbnail_enabled()) : ?>108 <?php if (fvcn_is_post_form_thumbnail_enabled()): ?> 110 109 111 110 <?php do_action('fvcn_post_form_before_thumbnail'); ?> … … 125 124 <div class="fvcn-post-form-submit"> 126 125 <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> 127 132 </div> 128 133 <?php do_action('fvcn_post_form_after_submit'); ?> 129 134 130 135 <?php fvcn_post_form_fields(); ?> 136 137 131 138 132 139 <?php do_action('fvcn_post_form_extras_bottom'); ?> -
fv-community-news/trunk/fvcn-theme/fvcn/loop-posts.php
r1760963 r1806332 4 4 * loop-posts.php 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme -
fv-community-news/trunk/fvcn-theme/fvcn/loop-single-post.php
r1760963 r1806332 4 4 * loop-single-post.php 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme -
fv-community-news/trunk/fvcn-theme/fvcn/widget-loop-posts.php
r1760963 r1806332 4 4 * widget-loop-posts.php 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme … … 11 10 ?> 12 11 13 < ulclass="fvcn-list-posts-widget">12 <div class="fvcn-list-posts-widget"> 14 13 15 14 <?php while (fvcn_posts()) : fvcn_the_post(); ?> … … 19 18 <?php endwhile; ?> 20 19 21 </ ul>20 </div> 22 21 23 22 <?php if (fvcn_show_widget_view_all()) : ?> -
fv-community-news/trunk/fvcn-theme/fvcn/widget-loop-single-post.php
r1773960 r1806332 4 4 * widget-loop-single-post.php 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme … … 11 10 ?> 12 11 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> 15 13 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; ?> 22 20 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 4 4 * The Template for displaying a single community post. 5 5 * 6 * @version 201207167 6 * @package FV Community News 8 7 * @subpackage Theme -
fv-community-news/trunk/public/js/dashboard.js
r1773960 r1806332 4 4 * AJAX post handling for the dashboard. 5 5 * 6 * @version 201711117 6 * @package FV Community News 8 7 * @subpackage Admin Dashboard … … 51 50 * parseQueryString() 52 51 * 53 * @version 2012072354 52 * @link http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/ 55 53 * @param query -
fv-community-news/trunk/public/js/post-moderation.js
r1763902 r1806332 4 4 * Improve the moderation panel, required because of WordPress limitations. 5 5 * 6 * @version 201207307 6 * @package FV Community News 8 7 * @subpackage Admin Post Moderation -
fv-community-news/trunk/readme.txt
r1799949 r1806332 6 6 Requires at least: 4.8 7 7 Tested up to: 4.9 8 Stable tag: 3.1. 18 Stable tag: 3.1.2 9 9 10 10 Give the visitors of your site the ability to submit their news to you, and list it in a nice news feed. … … 48 48 In order to successfully use this plugin, you will need the following: 49 49 50 * PHP 5.6 or higher (PHP 7 recommended)50 * PHP 7.0 or higher 51 51 * WordPress 4.8 or higher 52 52 … … 118 118 119 119 Q: 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/).120 A: Sure you can! [Let me know about it](https://frankverhoeven.me/wordpress-plugin-fv-community-news/). 121 121 122 122 Q: What to do if I found a bug? 123 123 A: 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/).124 Visit the post at [https://frankverhoeven.me/wordpress-plugin-fv-community-news/](https://frankverhoeven.me/wordpress-plugin-fv-community-news/). 125 125 126 126 … … 129 129 130 130 For 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. 131 142 132 143 -
fv-community-news/trunk/src/Admin/Admin.php
r1773960 r1806332 3 3 namespace FvCommunityNews\Admin; 4 4 5 use FvCommunityNews\Admin\Dashboard\Dashboard; 6 use FvCommunityNews\Admin\Post\Edit; 7 use FvCommunityNews\Admin\Post\Moderation; 8 use FvCommunityNews\Admin\Settings\Form; 9 use FvCommunityNews\Admin\Settings\Settings; 10 use FvCommunityNews\Container\Container; 5 11 use FvCommunityNews\Post\PostType; 6 use FvCommunityNews\Registry;7 12 8 13 /** … … 18 23 public $posts; 19 24 /** 20 * @var AdminFactory21 */ 22 protected $ factory;25 * @var Container 26 */ 27 protected $container; 23 28 24 29 /** 25 30 * __construct() 26 31 * 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; 33 37 $this->setupActions(); 34 38 } … … 37 41 * setupActions() 38 42 * 39 * @version 2012072040 43 */ 41 44 private function setupActions() … … 52 55 * factory() 53 56 * 54 * @version 2012080855 57 */ 56 58 public function factory() … … 73 75 case 'dashboard' : 74 76 case 'admin-ajax' : 75 $this-> factory->getDashboard();77 $this->container->get(Dashboard::class); 76 78 break; 77 79 78 80 case 'edit-' . $postType : 79 $this-> factory->getPostModeration();81 $this->container->get(Moderation::class); 80 82 break; 81 83 82 84 case 'post' : 83 85 case 'post-new-' . $postType : 84 $this-> factory->getPostEdit();86 $this->container->get(Edit::class); 85 87 break; 86 88 87 89 case 'admin-fvcn-settings' : 88 90 case 'edit-' . $postType . '-fvcn-settings' : 89 $this-> factory->getSettings();91 $this->container->get(Settings::class); 90 92 break; 91 93 92 94 case 'admin-fvcn-form' : 93 95 case 'edit-' . $postType . '-fvcn-form' : 94 $this-> factory->getForm();96 $this->container->get(Form::class); 95 97 break; 96 98 97 99 case 'options' : 98 $this-> factory->getSettings();99 $this-> factory->getForm();100 $this->container->get(Settings::class); 101 $this->container->get(Form::class); 100 102 break; 101 103 } … … 107 109 * init() 108 110 * 109 * @version 20120129110 111 */ 111 112 public function init() … … 117 118 * adminHead() 118 119 * 119 * @version 20120721120 120 */ 121 121 public function adminHead() 122 122 { 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]'; 125 126 $postClass = sanitize_html_class(PostType::POST_TYPE_KEY); 126 127 … … 140 141 141 142 @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) { 146 147 #menu-posts-<?= $postClass; ?> .wp-menu-image { 147 148 background-image: url(<?= $menuIconUrl2x; ?>); … … 170 171 * enqueueScripts() 171 172 * 172 * @version 20120721173 173 */ 174 174 public function enqueueScripts() … … 180 180 * adminMenu() 181 181 * 182 * @version 20120721183 182 */ 184 183 public function adminMenu() … … 190 189 'manage_options', 191 190 'fvcn-form', 192 [$this-> factory->getForm(), 'fvcn_admin_form']191 [$this->container->get(Form::class), 'fvcn_admin_form'] 193 192 ); 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']); 195 194 196 195 add_submenu_page( … … 200 199 'manage_options', 201 200 'fvcn-settings', 202 [$this-> factory->getSettings(), 'fvcn_admin_settings']201 [$this->container->get(Settings::class), 'fvcn_admin_settings'] 203 202 ); 204 203 -
fv-community-news/trunk/src/Admin/Dashboard/Dashboard.php
r1763902 r1806332 4 4 5 5 use FvCommunityNews\Admin\Dashboard\Widget\RecentPosts; 6 use FvCommunityNews\Config\AbstractConfig as Config; 7 use FvCommunityNews\Post\Mapper as PostMapper; 6 8 7 9 /** … … 13 15 { 14 16 /** 17 * @var Config 18 */ 19 private $config; 20 /** 21 * @var PostMapper 22 */ 23 private $postMapper; 24 25 /** 15 26 * __construct() 16 27 * 17 * @version 20120729 28 * @param Config $config 29 * @param PostMapper $postMapper 18 30 */ 19 public function __construct( )31 public function __construct(Config $config, PostMapper $postMapper) 20 32 { 33 $this->config = $config; 34 $this->postMapper = $postMapper; 35 21 36 $this->registerWidgets(); 22 37 } … … 26 41 * 27 42 * @return Dashboard 28 * @version 2017111129 43 */ 30 44 public function registerWidgets() 31 45 { 32 add_action('wp_dashboard_setup', [new RecentPosts( ), 'register']);46 add_action('wp_dashboard_setup', [new RecentPosts($this->config, $this->postMapper), 'register']); 33 47 do_action('fvcn_register_dashboard_widgets'); 34 48 -
fv-community-news/trunk/src/Admin/Dashboard/Widget/RecentPosts.php
r1773960 r1806332 3 3 namespace FvCommunityNews\Admin\Dashboard\Widget; 4 4 5 use FvCommunityNews\Options; 5 use FvCommunityNews\Config\AbstractConfig as Config; 6 use FvCommunityNews\Post\Mapper as PostMapper; 6 7 use FvCommunityNews\Post\PostType; 7 use FvCommunityNews\Registry;8 8 9 9 /** … … 15 15 { 16 16 /** 17 * @var Config 18 */ 19 private $config; 20 /** 21 * @var PostMapper 22 */ 23 private $postMapper; 24 25 /** 17 26 * __construct() 18 27 * 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 23 36 add_action('fvcn_admin_enqueue_scripts', [$this, 'enqueueScripts']); 24 37 add_action('fvcn_admin_head', [$this, 'dashboardHead']); … … 32 45 * enqueueScripts() 33 46 * 34 * @version 2012072935 47 */ 36 48 public function enqueueScripts() 37 49 { 50 $registry = \FvCommunityNews::$container->get('Registry'); 51 38 52 wp_enqueue_script( 39 53 'fvcn-dashboard-widget-rp-js', 40 Registry::get('pluginUrl'). 'public/js/dashboard.js',54 $registry['pluginUrl'] . 'public/js/dashboard.js', 41 55 ['jquery'], 42 56 '20120721' … … 59 73 * dashboardHead() 60 74 * 61 * @version 2012072962 75 */ 63 76 public function dashboardHead() … … 139 152 * response() 140 153 * 141 * @version 20120729142 154 */ 143 155 public function response() … … 153 165 * ajaxResponse() 154 166 * 155 * @version 20120729156 167 */ 157 168 public function ajaxResponse() … … 196 207 * updatePostStatus() 197 208 * 198 * @version 20120729199 209 * @param $postId 200 210 * @param string $action … … 206 216 case 'fvcn_toggle_post_spam_status' : 207 217 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); 209 219 break; 210 220 211 221 case 'fvcn_toggle_post_publish_status' : 212 222 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); 214 224 break; 215 225 … … 222 232 * register() 223 233 * 224 * @version 20120719225 234 * @return RecentPosts 226 235 */ … … 242 251 * widget() 243 252 * 244 * @version 20120721245 253 */ 246 254 public function widget() 247 255 { 248 256 $options = [ 249 'posts_per_page' => Options::fvcnGetOption('_fvcn_dashboard_rp_num'),257 'posts_per_page' => $this->config['_fvcn_dashboard_rp_num'], 250 258 'post_status' => PostType::STATUS_PUBLISH . ',' . PostType::STATUS_PENDING 251 259 ]; … … 342 350 * control() 343 351 * 344 * @version 20120729345 352 */ 346 353 public function control() … … 353 360 <p> 354 361 <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"> 356 363 <small><?php _e('(1 - 30)', 'fvcn'); ?></small> 357 364 </p> -
fv-community-news/trunk/src/Admin/Post/Edit.php
r1773960 r1806332 20 20 * __construct() 21 21 * 22 * @version 2012072123 22 */ 24 23 public function __construct() … … 33 32 * registerMetaboxPostInfo() 34 33 * 35 * @version 2012072136 34 */ 37 35 public function registerMetaboxPostInfo() … … 56 54 * saveMetaboxPostInfo() 57 55 * 58 * @version 2012072159 56 * @param int $postId 60 57 * @return int … … 93 90 * metaboxPostInfo() 94 91 * 95 * @version 2012072196 92 */ 97 93 public function metaboxPostInfo() -
fv-community-news/trunk/src/Admin/Post/Moderation.php
r1773960 r1806332 3 3 namespace FvCommunityNews\Admin\Post; 4 4 5 use FvCommunityNews\Post\Mapper as PostMapper; 5 6 use FvCommunityNews\Post\PostType; 6 use FvCommunityNews\Registry;7 use FvCommunityNews_PostMapper;8 7 9 8 /** … … 18 17 */ 19 18 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; 28 30 $this->postType = PostType::POST_TYPE_KEY; 29 31 … … 35 37 * setupActions() 36 38 * 37 * @version 2012030838 39 * @return Moderation 39 40 */ … … 59 60 * enqueueScripts() 60 61 * 61 * @version 2012073062 62 * @return Moderation 63 63 */ 64 64 public function enqueueScripts() 65 65 { 66 $registry = \FvCommunityNews::$container->get('Registry'); 66 67 wp_enqueue_script( 67 68 'fvcn-admin-post-moderation-js', 68 Registry::get('pluginUrl'). 'public/js/post-moderation.js',69 $registry['pluginUrl'] . 'public/js/post-moderation.js', 69 70 ['jquery'], 70 71 '20120730' … … 96 97 * addContextualHelp() 97 98 * 98 * @version 2012030899 99 * @return Moderation 100 100 */ … … 108 108 * processBulkActions() 109 109 * 110 * @version 20120730111 110 */ 112 111 protected function processBulkActions() … … 156 155 157 156 if (false !== $method) { 158 $postMapper = new FvCommunityNews_PostMapper();159 160 157 foreach ((array)$_GET['post'] as $postId) { 161 $ postMapper->$method($postId);158 $this->postMapper->$method($postId); 162 159 } 163 160 … … 174 171 * _togglePost() 175 172 * 176 * @version 20120729177 173 */ 178 174 protected function _togglePost() … … 198 194 199 195 if (fvcn_is_post_spam($postId)) { 200 fvcn_publish_post($postId);196 $this->postMapper->publishPost($postId); 201 197 $updated = 'unspam'; 202 198 } else { 203 fvcn_spam_post($postId);199 $this->postMapper->spamPost($postId); 204 200 $updated = 'spam'; 205 201 } … … 210 206 211 207 if (fvcn_is_post_published($postId)) { 212 fvcn_unpublish_post($postId);208 $this->postMapper->unpublishPost($postId); 213 209 $updated = 'unpublish'; 214 210 } else { 215 fvcn_publish_post($postId);211 $this->postMapper->publishPost($postId); 216 212 $updated = 'publish'; 217 213 } … … 229 225 * 230 226 * @return mixed 231 * @version 20171111232 227 */ 233 228 public function columnHeaders() … … 248 243 * columnData() 249 244 * 250 * @version 20120805251 245 * @param string $column 252 246 * @param int $postId … … 286 280 * postRowActions() 287 281 * 288 * @version 20120730289 282 * @param array $actions 290 283 * @param object $post … … 346 339 * filterDropdown() 347 340 * 348 * @version 20120730349 341 */ 350 342 public function filterDropdown() … … 367 359 * displayNotice() 368 360 * 369 * @version 20120730370 361 */ 371 362 public function displayNotice() … … 412 403 if ($message) : 413 404 ?> 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> 419 408 <?php 420 409 endif; -
fv-community-news/trunk/src/Admin/Settings/Form.php
r1773960 r1806332 13 13 * __construct() 14 14 * 15 * @version 2017111116 15 */ 17 16 public function __construct() … … 86 85 * fvcn_admin_form() 87 86 * 88 * @version 2017111189 87 */ 90 88 public function fvcn_admin_form() … … 112 110 * fvcn_admin_form_help() 113 111 * 114 * @version 20120728115 112 */ 116 113 public function fvcn_admin_form_help() … … 139 136 * author_section() 140 137 * 141 * @version 20120302142 138 */ 143 139 public function author_name_section() … … 153 149 * author_label() 154 150 * 155 * @version 20120524156 151 */ 157 152 public function author_name_label() … … 159 154 ?> 160 155 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"> 162 157 163 158 <?php … … 168 163 * author_section() 169 164 * 170 * @version 20120302171 165 */ 172 166 public function author_email_section() … … 182 176 * author_label() 183 177 * 184 * @version 20120524185 178 */ 186 179 public function author_email_label() … … 188 181 ?> 189 182 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"> 191 184 192 185 <?php … … 197 190 * title_section() 198 191 * 199 * @version 20120302200 192 */ 201 193 public function title_section() … … 211 203 * title_label() 212 204 * 213 * @version 20120524214 205 */ 215 206 public function title_label() … … 217 208 ?> 218 209 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"> 220 211 221 212 <?php … … 226 217 * link_section() 227 218 * 228 * @version 20120302229 219 */ 230 220 public function link_section() … … 240 230 * link_label() 241 231 * 242 * @version 20120524243 232 */ 244 233 public function link_label() … … 246 235 ?> 247 236 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"> 249 238 250 239 <?php … … 254 243 * link_required() 255 244 * 256 * @version 20120302257 245 */ 258 246 public function link_required() … … 270 258 * content_section() 271 259 * 272 * @version 20120302273 260 */ 274 261 public function content_section() … … 284 271 * content_label() 285 272 * 286 * @version 20120524287 273 */ 288 274 public function content_label() … … 290 276 ?> 291 277 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"> 293 279 294 280 <?php … … 299 285 * tags_section() 300 286 * 301 * @version 20120302302 287 */ 303 288 public function tags_section() … … 313 298 * tags_label() 314 299 * 315 * @version 20120524316 300 */ 317 301 public function tags_label() … … 319 303 ?> 320 304 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"> 322 306 323 307 <?php … … 327 311 * tags_required() 328 312 * 329 * @version 20120302330 313 */ 331 314 public function tags_required() … … 343 326 * thumbnail_section() 344 327 * 345 * @version 20120306346 328 */ 347 329 public function thumbnail_section() … … 358 340 * thumbnail_enabled() 359 341 * 360 * @version 20120306361 342 */ 362 343 public function thumbnail_enabled() … … 373 354 * thumbnail_label() 374 355 * 375 * @version 20120524376 356 */ 377 357 public function thumbnail_label() … … 379 359 ?> 380 360 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"> 382 362 383 363 <?php … … 387 367 * thumbnail_required() 388 368 * 389 * @version 20120306390 369 */ 391 370 public function thumbnail_required() -
fv-community-news/trunk/src/Admin/Settings/Settings.php
r1773960 r1806332 13 13 * fvcn_register_admin_settings() 14 14 * 15 * @version 20120524 16 */ 15 */ 17 16 public function __construct() 18 17 { … … 54 53 * fvcn_admin_settings() 55 54 * 56 * @version 20120324 57 */ 55 */ 58 56 public function fvcn_admin_settings() 59 57 { … … 81 79 * general_section() 82 80 * 83 * @version 2012032284 81 */ 85 82 public function general_section() … … 94 91 * moderation() 95 92 * 96 * @version 2012032297 93 */ 98 94 public function moderation() … … 113 109 * mail() 114 110 * 115 * @version 20120322116 111 */ 117 112 public function mail() … … 132 127 * is_anonymous_allowed() 133 128 * 134 * @version 20120322135 129 */ 136 130 public function is_anonymous_allowed() … … 148 142 * permalinks_section() 149 143 * 150 * @version 20120322151 144 */ 152 145 public function permalinks_section() … … 161 154 * post_base_slug() 162 155 * 163 * @version 20120524164 156 */ 165 157 public function post_base_slug() … … 167 159 ?> 168 160 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"> 170 162 171 163 <?php … … 176 168 * post_slug() 177 169 * 178 * @version 20120524179 170 */ 180 171 public function post_slug() … … 182 173 ?> 183 174 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"> 185 176 186 177 <?php … … 191 182 * post_tag_slug() 192 183 * 193 * @version 20120524194 184 */ 195 185 public function post_tag_slug() … … 197 187 ?> 198 188 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"> 200 190 201 191 <?php … … 206 196 * post_archive_slug() 207 197 * 208 * @version 20120524209 198 */ 210 199 public function post_archive_slug() … … 212 201 ?> 213 202 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"> 215 204 216 205 <?php -
fv-community-news/trunk/src/Akismet/Akismet.php
r1773960 r1806332 4 4 5 5 use Exception; 6 use FvCommunityNews\ Container;6 use FvCommunityNews\Version; 7 7 8 8 /** … … 25 25 * __construct() 26 26 * 27 * @version 2012071128 27 * @param string $apiKey 29 28 * @param string $blogUrl … … 38 37 * setApiKey() 39 38 * 40 * @version 2012071141 39 * @param string $apiKey 42 40 * @return Akismet … … 51 49 * getApiKey() 52 50 * 53 * @version 2012071154 51 * @return string 55 52 */ … … 62 59 * setBlogUrl() 63 60 * 64 * @version 2012071165 61 * @param string $blogUrl 66 62 * @return Akismet … … 75 71 * getBlogUrl() 76 72 * 77 * @version 2012071178 73 * @return string 79 74 */ … … 91 86 * @return string 92 87 * @throws Exception 93 * @version 2017111194 88 */ 95 89 protected function post($host, $path, array $params) … … 101 95 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 102 96 'Host' => $host, 103 'User-Agent' => 'FV Community News/' . fvcn_get_version() . ' | Akismet/20120711'97 'User-Agent' => 'FV Community News/' . Version::getCurrentVersion() . ' | Akismet/20120711' 104 98 ], 105 99 'httpversion' => '1.0', … … 119 113 * makeApiCall() 120 114 * 121 * @version 20120711122 115 * @param string $path 123 116 * @param array $params … … 139 132 * verifyKey() 140 133 * 141 * @version 20120711142 134 * @param string $key 143 135 * @param string $blog 144 136 * @return bool 137 * @throws Exception 145 138 */ 146 139 public function verifyKey($key=null, $blog=null) … … 159 152 * isSpam() 160 153 * 161 * @version 20120711162 154 * @param array $params 163 155 * @return bool … … 181 173 * submitSpam() 182 174 * 183 * @version 20120711184 175 * @param array $params 176 * @throws Exception 185 177 */ 186 178 public function submitSpam(array $params) … … 192 184 * submitHam() 193 185 * 194 * @version 20120711195 186 * @param array $params 187 * @throws Exception 196 188 */ 197 189 public function submitHam(array $params) … … 199 191 $this->makeApiCall('/1.1/submit-ham', $params); 200 192 } 201 202 203 /**204 * fvcn_akismet_check_post()205 *206 * @version 20120711207 * @param int $postId208 */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 20120711220 * @param int $postId221 */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 20120711233 */234 public static function fvcn_akismet_register_settings()235 {236 Container::getInstance()->getAkismetHandler()->registerSettings();237 }238 239 /**240 * fvcn_akismet()241 *242 * @version 20171111243 */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 }260 193 } -
fv-community-news/trunk/src/Akismet/Handler.php
r1773960 r1806332 2 2 3 3 namespace FvCommunityNews\Akismet; 4 5 use FvCommunityNews\Post\Mapper; 6 use FvCommunityNews\Post\PostType; 4 7 5 8 /** … … 13 16 * @var int 14 17 */ 15 protected $currentPostId; 16 18 private $currentPostId; 17 19 /** 18 20 * @var Akismet 19 21 */ 20 protected $akismet; 22 private $akismet; 23 /** 24 * @var Mapper 25 */ 26 private $postMapper; 21 27 22 28 /** 23 * __construct()24 *25 * @version 2012071126 29 * @param Akismet $akismet 30 * @param Mapper $postMapper 27 31 */ 28 public function __construct(Akismet $akismet )32 public function __construct(Akismet $akismet, Mapper $postMapper) 29 33 { 30 34 $this->akismet = $akismet; 35 $this->postMapper = $postMapper; 31 36 } 32 37 … … 34 39 * _getParams() 35 40 * 36 * @version 2012071137 41 * @param int $postId 38 42 * @return array … … 67 71 * checkPost() 68 72 * 69 * @version 2012071170 73 * @param int $postId 71 74 * @return Handler … … 73 76 public function checkPost($postId) 74 77 { 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) {} 79 84 80 85 return $this; … … 84 89 * submitPost() 85 90 * 86 * @version 2012071187 91 * @param int $postId 88 92 * @return Handler … … 94 98 if ('fvcn_spam_post' == $filter) { 95 99 if ($this->currentPostId == $postId) { 96 return ;100 return $this; 97 101 } 98 102 … … 100 104 } elseif ('fvcn_publish_post' == $filter) { 101 105 if (PostType::STATUS_SPAM != fvcn_get_post_status($postId)) { 102 return ;106 return $this; 103 107 } 104 108 105 109 $method = 'submitHam'; 106 110 } else { 107 return ;111 return $this; 108 112 } 109 113 … … 116 120 * registerSettings() 117 121 * 118 * @version 20120322119 122 */ 120 123 public function registerSettings() … … 129 132 * settingsCallbackSection() 130 133 * 131 * @version 20120322132 134 */ 133 135 public function settingsCallbackSection() … … 143 145 * settingsCallbackEnabled() 144 146 * 145 * @version 20120711146 147 */ 147 148 public function settingsCallbackEnabled() … … 149 150 ?> 150 151 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)); ?>> 152 153 <label for="_fvcnakismet_enabled"><?php _e('Enable Akismet spam protection for community posts.', 'fvcn'); ?></label> 153 154 154 <?php if ($this->akismet->verifyKey()) : ?>155 <?php if ($this->akismet->verifyKey()): ?> 155 156 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> 157 158 158 <?php else : ?>159 <?php else : ?> 159 160 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> 161 162 162 <?php endif; 163 163 <?php endif; 164 164 } 165 165 } -
fv-community-news/trunk/src/Installer.php
r1773960 r1806332 2 2 3 3 namespace FvCommunityNews; 4 5 use FvCommunityNews\Config\AbstractConfig as Config; 4 6 5 7 /** … … 19 21 * 20 22 * @param Config $config 21 * @version 2017111222 23 */ 23 24 public function __construct(Config $config) … … 30 31 * 31 32 * @return bool 32 * @version 2017111233 33 */ 34 34 public function isInstall() … … 41 41 * 42 42 * @return bool 43 * @version 2017111244 43 */ 45 44 public function isUpdate() … … 52 51 * 53 52 * @return Installer 54 * @version 2017111155 53 */ 56 54 public function install() … … 65 63 * 66 64 * @return Installer 67 * @version 2017111168 65 */ 69 66 public function update() … … 79 76 * 80 77 * @return Installer 81 * @version 2017111282 78 */ 83 79 public function addOptions() … … 94 90 * 95 91 * @return bool 96 * @version 2017111297 92 */ 98 93 public function hasUpdate() 99 94 { 100 95 $lastCheck = $this->config->get('_fvcn_previous_has_update', false); 101 if (!$lastCheck || (time() - $lastCheck) > 432000) { // Only check once every five days96 if (!$lastCheck || (time() - $lastCheck) > 86400) { // Only check once every 24 hours 102 97 $latest = Version::getLatestVersion(); 103 98 $this->config->set('_fvcn_previous_has_update', time()); -
fv-community-news/trunk/src/Post/PostType.php
r1773960 r1806332 25 25 * @param string $archiveSlug 26 26 * @return PostType 27 * @version 2017111228 27 */ 29 28 public function registerPostType($postSlug, $archiveSlug) … … 85 84 * registerPostStatuses() 86 85 * 87 * @version 2012071688 86 * @return PostType 89 87 */ … … 109 107 * @param string $tagSlug 110 108 * @return PostType 111 * @version 20171112112 109 */ 113 110 public function registerTaxonomy($tagSlug) -
fv-community-news/trunk/src/Shortcode/PostForm.php
r1773960 r1806332 18 18 * obStart() 19 19 * 20 * @version 2012031521 20 */ 22 21 private function obStart() … … 28 27 * obEnd() 29 28 * 30 * @version 2012031531 29 * @return string 32 30 */ -
fv-community-news/trunk/src/Shortcode/RecentPosts.php
r1773960 r1806332 18 18 * obStart() 19 19 * 20 * @version 2012031521 20 */ 22 21 private function obStart() … … 28 27 * obEnd() 29 28 * 30 * @version 2012031531 29 * @return string 32 30 */ -
fv-community-news/trunk/src/Shortcode/TagCloud.php
r1773960 r1806332 18 18 * obStart() 19 19 * 20 * @version 2012031521 20 */ 22 21 private function obStart() … … 28 27 * obEnd() 29 28 * 30 * @version 2012031531 29 * @return string 32 30 */ -
fv-community-news/trunk/src/Template/common-functions.php
r1773960 r1806332 1 1 <?php 2 2 3 use FvCommunityNews\Container; 4 use FvCommunityNews\Registry; 3 use FvCommunityNews\Post\PostType; 5 4 6 5 /** 7 * fvcn_ version()6 * fvcn_add_error() 8 7 * 9 * @version 20120322 8 * @param string $code 9 * @param string $message 10 * @param string $data 10 11 */ 11 function fvcn_ version()12 function fvcn_add_error($code='', $message='', $data='') 12 13 { 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); 35 15 } 36 16 37 17 /** 38 * fvcn_ template_notices()18 * fvcn_has_errors() 39 19 * 40 * @ version 2012071320 * @return bool 41 21 */ 42 function fvcn_ template_notices()22 function fvcn_has_errors() 43 23 { 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; 46 28 } 47 29 48 $errors = $messages = []; 30 return apply_filters('fvcn_has_errors', $hasErrors, FvCommunityNews::$container->get(WP_Error::class)); 31 } 49 32 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 */ 37 function 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 } 52 47 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 */ 55 function 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; 60 65 } 61 66 62 if (!empty($errors)) : ?>67 $data['post_author'] = 0; 63 68 64 <div class="fvcn-template-notice error"> 65 <span> 66 <?= implode("</span><br>\n<span>", $errors); ?> 67 </span> 68 </div> 69 return $data; 70 } 69 71 70 <?php else : ?> 72 /** 73 * fvcn_send_notification_mail() 74 * 75 * @param int $postId 76 * @return bool 77 */ 78 function 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 } 71 86 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 } 77 96 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); 79 109 } 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 */ 121 function 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 80 132 81 133 /** 82 134 * is_fvcn() 83 135 * 84 * @version 2012062285 136 * @return bool 86 137 */ 87 function is_fvcn() 138 function is_fvcn(): bool 88 139 { 89 140 if (fvcn_is_single_post()) { … … 103 154 * fvcn_show_widget_thumbnail() 104 155 * 105 * @version 20120710106 156 * @return bool 107 157 */ 108 function fvcn_show_widget_thumbnail() 158 function fvcn_show_widget_thumbnail(): bool 109 159 { 110 return Registry::getInstance()->widgetShowThumbnail; 160 $registry = \FvCommunityNews::$container->get('Registry'); 161 return $registry['widgetShowThumbnail']; 111 162 } 112 163 … … 114 165 * fvcn_show_widget_view_all() 115 166 * 116 * @version 20120710117 167 * @return bool 118 168 */ 119 function fvcn_show_widget_view_all() 169 function fvcn_show_widget_view_all(): bool 120 170 { 121 return Registry::getInstance()->widgetShowViewAll; 171 $registry = \FvCommunityNews::$container->get('Registry'); 172 return $registry['widgetShowViewAll']; 122 173 } -
fv-community-news/trunk/src/Template/options-functions.php
r1763902 r1806332 1 1 <?php 2 3 use FvCommunityNews\Options;4 2 5 3 /** … … 7 5 * 8 6 * @return bool 9 * @version 2012052410 7 */ 11 function fvcn_admin_moderation() 8 function fvcn_admin_moderation(): bool 12 9 { 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 ); 14 13 } 15 14 … … 18 17 * 19 18 * @return bool 20 * @version 2012052421 19 */ 22 function fvcn_user_moderation() 20 function fvcn_user_moderation(): bool 23 21 { 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 ); 25 25 } 26 26 … … 29 29 * 30 30 * @return bool 31 * @version 2012052432 31 */ 33 function fvcn_mail_on_submission() 32 function fvcn_mail_on_submission(): bool 34 33 { 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 ); 36 37 } 37 38 … … 40 41 * 41 42 * @return bool 42 * @version 2012052443 43 */ 44 function fvcn_mail_on_moderation() 44 function fvcn_mail_on_moderation(): bool 45 45 { 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 ); 47 49 } 48 50 … … 51 53 * 52 54 * @return bool 53 * @version 2012052454 55 */ 55 function fvcn_is_anonymous_allowed() 56 function fvcn_is_anonymous_allowed(): bool 56 57 { 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 ); 58 61 } -
fv-community-news/trunk/src/Template/post-functions.php
r1773960 r1806332 1 1 <?php 2 2 3 use FvCommunityNews\Container;4 use FvCommunityNews\Options;5 3 use FvCommunityNews\Post\PostType; 6 use FvCommunityNews\Registry;7 8 4 9 5 /** 10 6 * fvcn_post_slug() 11 7 * 12 * @version 2012032113 8 */ 14 9 function fvcn_post_slug() … … 20 15 * fvcn_get_post_slug() 21 16 * 22 * @version 2012032123 17 * @return string 24 18 */ 25 19 function fvcn_get_post_slug() 26 20 { 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']); 28 23 } 29 24 … … 32 27 * fvcn_has_posts() 33 28 * 34 * @version 2012030535 29 * @param mixed $args 36 30 * @return object … … 48 42 $options = apply_filters('fvcn_has_posts_query', $options); 49 43 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']); 53 48 } 54 49 … … 57 52 * fvcn_posts() 58 53 * 59 * @version 2012030560 54 * @return object 61 55 */ 62 56 function fvcn_posts() 63 57 { 64 $have_posts = Registry::get('wpQuery')->have_posts(); 58 $registry = \FvCommunityNews::$container->get('Registry'); 59 $have_posts = $registry['wpQuery']->have_posts(); 65 60 66 61 if (empty($have_posts)) { … … 75 70 * fvcn_the_post() 76 71 * 77 * @version 2012030578 72 * @return object 79 73 */ 80 74 function fvcn_the_post() 81 75 { 82 return Registry::get('wpQuery')->the_post(); 76 $registry = \FvCommunityNews::$container->get('Registry'); 77 return $registry['wpQuery']->the_post(); 83 78 } 84 79 … … 87 82 * fvcn_post_id() 88 83 * 89 * @version 2012030590 84 * @param int $postId 91 85 */ … … 98 92 * fvcn_get_post_id() 99 93 * 100 * @version 20120325101 94 * @param int $postId 102 95 * @return int … … 105 98 { 106 99 global $wp_query, $post; 100 $registry = \FvCommunityNews::$container->get('Registry'); 107 101 108 102 if (!empty($postId) && is_numeric($postId)) { 109 103 $id = $postId; 110 104 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; 113 107 114 108 } elseif (fvcn_is_single_post() && isset($wp_query->post->ID)) { … … 129 123 * fvcn_get_post() 130 124 * 131 * @version 20120309132 125 * @param int $postId 133 126 * @return object … … 154 147 * fvcn_post_permalink() 155 148 * 156 * @version 20120305157 149 * @param int $postId 158 150 */ … … 165 157 * fvcn_get_post_permalink() 166 158 * 167 * @version 20120305168 159 * @param int $postId 169 160 * @param string $redirect … … 187 178 * fvcn_has_post_link() 188 179 * 189 * @version 20120316190 180 * @param int $postId 191 181 * @return bool … … 202 192 * fvcn_post_link() 203 193 * 204 * @version 20120311205 194 * @param int $postId 206 195 */ … … 213 202 * fvcn_get_post_link() 214 203 * 215 * @version 20120311216 204 * @param int $postId 217 205 * @return string … … 230 218 * fvcn_post_title() 231 219 * 232 * @version 20120305233 220 * @param int $postId 234 221 */ … … 241 228 * fvcn_get_post_title() 242 229 * 243 * @version 20120305244 230 * @param int $postId 245 231 * @return string … … 256 242 * fvcn_post_content() 257 243 * 258 * @version 20120305259 244 * @param int $postId 260 245 */ … … 267 252 * fvcn_get_post_content() 268 253 * 269 * @version 20120305270 254 * @param int $postId 271 255 * @return string … … 288 272 * fvcn_post_excerpt() 289 273 * 290 * @version 20120305291 274 * @param int $postId 292 275 * @param int $length 293 276 */ 294 function fvcn_post_excerpt($postId = 0, $length =100) {277 function fvcn_post_excerpt($postId = 0, $length = 100) { 295 278 echo fvcn_get_post_excerpt($postId, $length); 296 279 } … … 299 282 * fvcn_get_post_excerpt() 300 283 * 301 * @version 20120305302 284 * @param int $postId 303 285 * @param int $length 304 286 * @return string 305 287 */ 306 function fvcn_get_post_excerpt($postId = 0, $length =100) {288 function fvcn_get_post_excerpt($postId = 0, $length = 100) { 307 289 $id = fvcn_get_post_id($postId); 308 290 $length = abs((int)$length); … … 341 323 * fvcn_post_date() 342 324 * 343 * @version 20120322344 325 * @param int $postId 345 326 * @param string $format 346 327 */ 347 function fvcn_post_date($postId = 0, $format ='') {328 function fvcn_post_date($postId = 0, $format = '') { 348 329 echo fvcn_get_post_date($postId, $format); 349 330 } … … 352 333 * fvcn_get_post_date() 353 334 * 354 * @version 20120322355 335 * @param int $postId 356 336 * @param string $format 357 337 * @return string 358 338 */ 359 function fvcn_get_post_date($postId = 0, $format ='') {339 function fvcn_get_post_date($postId = 0, $format = '') { 360 340 $id = fvcn_get_post_id($postId); 361 341 … … 373 353 * fvcn_post_time() 374 354 * 375 * @version 20120322376 355 * @param int $postId 377 356 * @param string $format 378 357 * @param bool $gmt 379 358 */ 380 function fvcn_post_time($postId = 0, $format ='', $gmt=false) {359 function fvcn_post_time($postId = 0, $format = '', $gmt = false) { 381 360 echo fvcn_get_post_time($postId, $format, $gmt); 382 361 } … … 385 364 * fvcn_get_post_time() 386 365 * 387 * @version 20120924388 366 * @param int $postId 389 367 * @param string $format 390 * @param bool $gmt368 * @param bool $gmt 391 369 * @return string 392 370 */ … … 413 391 * fvcn_has_post_thumbnail() 414 392 * 415 * @version 20120801416 393 * @param int $postId 417 394 * @return bool … … 420 397 { 421 398 $id = fvcn_get_post_id($postId); 399 $registry = \FvCommunityNews::$container->get('Registry'); 422 400 423 401 // 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()) { 425 403 return has_post_thumbnail($id); 426 404 } else { … … 433 411 * fvcn_post_thumbnail() 434 412 * 435 * @version 20120311436 413 * @param int $postId 437 414 * @param string|array $size … … 446 423 * fvcn_get_post_thumbnail() 447 424 * 448 * @version 20120317449 425 * @param int $postId 450 426 * @param string|array $size … … 455 431 { 456 432 $id = fvcn_get_post_id($postId); 457 458 433 return apply_filters('fvcn_get_post_thumbnail', get_the_post_thumbnail($id, $size, $attributes), $id); 459 434 } … … 463 438 * fvcn_post_rating() 464 439 * 465 * @version 20120321466 440 * @param int $postId 467 441 */ … … 474 448 * fvcn_get_post_rating() 475 449 * 476 * @version 20120321 477 * @param int $postId 478 * @return string 450 * @param int $postId 451 * @return int 479 452 */ 480 453 function fvcn_get_post_rating($postId = 0) 481 454 { 482 455 $id = fvcn_get_post_id($postId); 483 484 456 $rating = get_post_meta($id, '_fvcn_post_rating', true); 485 457 … … 495 467 * fvcn_post_rating_increment_link() 496 468 * 497 * @version 20120321498 469 * @param int $postId 499 470 */ … … 506 477 * fvcn_get_post_rating_increment_link() 507 478 * 508 * @version 20120321509 479 * @param int $postId 510 480 * @return string … … 529 499 * fvcn_post_rating_decrement_link() 530 500 * 531 * @version 20120321532 501 * @param int $postId 533 502 */ … … 540 509 * fvcn_get_post_rating_decrement_link() 541 510 * 542 * @version 20120321543 511 * @param int $postId 544 512 * @return string … … 563 531 * fvcn_is_post_rated_by_current_user() 564 532 * 565 * @version 20120321566 533 * @param int $postId 567 534 * @return bool … … 578 545 * fvcn_post_views() 579 546 * 580 * @version 20120622581 547 * @param int $postId 582 548 */ … … 589 555 * fvcn_get_post_views() 590 556 * 591 * @version 20120622592 557 * @param int $postId 593 558 * @return int … … 610 575 * fvcn_post_status() 611 576 * 612 * @version 20120306613 577 * @param int $postId 614 578 */ … … 621 585 * fvcn_get_post_status() 622 586 * 623 * @version 20120306624 587 * @param int $postId 625 588 * @return string … … 636 599 * fvcn_post_archive_link() 637 600 * 638 * @version 20120321639 601 */ 640 602 function fvcn_post_archive_link() … … 646 608 * fvcn_get_post_archive_link() 647 609 * 648 * @version 20120321649 610 * @return string 650 611 */ … … 660 621 * fvcn_is_post() 661 622 * 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 */ 626 function fvcn_is_post($postId = 0): bool 667 627 { 668 628 $is_post = false; … … 672 632 } 673 633 674 return (bool)apply_filters('fvcn_is_post', $is_post, $postId);634 return apply_filters('fvcn_is_post', $is_post, $postId); 675 635 } 676 636 … … 679 639 * fvcn_is_post_published() 680 640 * 681 * @version 20120306682 641 * @param int $postId 683 642 * @return bool … … 692 651 * fvcn_is_post_pending() 693 652 * 694 * @version 20120306695 653 * @param int $postId 696 654 * @return bool … … 705 663 * fvcn_is_post_trash() 706 664 * 707 * @version 20120306708 665 * @param int $postId 709 666 * @return bool … … 718 675 * fvcn_is_post_spam() 719 676 * 720 * @version 20120306721 677 * @param int $postId 722 678 * @return bool … … 731 687 * fvcn_is_post_private() 732 688 * 733 * @version 20120306734 689 * @param int $postId 735 690 * @return bool … … 744 699 * fvcn_is_post_anonymous() 745 700 * 746 * @version 20120306747 701 * @param int $postId 748 702 * @return bool … … 769 723 * fvcn_is_single_post() 770 724 * 771 * @version 20120319772 725 * @return bool 773 726 */ … … 787 740 * fvcn_is_post_archive() 788 741 * 789 * @version 20120322790 742 * @return bool 791 743 */ … … 805 757 * fv_is_post_tag_archive() 806 758 * 807 * @version 20120325808 759 * @return bool 809 760 */ … … 823 774 * fvcn_post_author() 824 775 * 825 * @version 20120306826 776 * @param int $postId 827 777 */ … … 834 784 * fvcn_get_post_author() 835 785 * 836 * @version 20120306837 786 * @param int $postId 838 787 * @return string … … 855 804 * fvcn_post_author_id() 856 805 * 857 * @version 20120306858 806 * @param int $postId 859 807 */ … … 866 814 * fvcn_get_post_author_id() 867 815 * 868 * @version 20120306869 816 * @param int $postId 870 817 * @return string … … 882 829 * fvcn_post_author_display_name() 883 830 * 884 * @version 20120306885 831 * @param int $postId 886 832 */ … … 893 839 * fvcn_get_post_author_display_name() 894 840 * 895 * @version 20120306896 841 * @param int $postId 897 842 * @return string … … 914 859 * fvcn_post_author_email() 915 860 * 916 * @version 20120306917 861 * @param int $postId 918 862 */ … … 925 869 * fvcn_get_post_author_email() 926 870 * 927 * @version 20120306928 871 * @param int $postId 929 872 * @return string … … 946 889 * fvcn_post_author_avatar() 947 890 * 948 * @version 20120306949 891 * @param int $postId 950 892 * @param int $size … … 958 900 * fvcn_get_post_author_avatar() 959 901 * 960 * @version 20120701961 902 * @param int $postId 962 903 * @param int $size … … 974 915 * fvcn_post_author_website() 975 916 * 976 * @version 20120306977 917 * @param int $postId 978 918 */ … … 985 925 * fvcn_get_post_author_website() 986 926 * 987 * @version 20120306988 927 * @param int $postId 989 928 * @return string … … 1006 945 * fvcn_post_author_link() 1007 946 * 1008 * @version 201203051009 947 * @param int $postId 1010 948 */ … … 1017 955 * fvcn_get_post_author_link() 1018 956 * 1019 * @version 201203051020 957 * @param int $postId 1021 958 * @return string … … 1038 975 * fvcn_post_author_ip() 1039 976 * 1040 * @version 201203111041 977 * @param int $postId 1042 978 */ … … 1049 985 * fvcn_get_post_author_ip() 1050 986 * 1051 * @version 201203111052 987 * @param int $postId 1053 988 * @return string … … 1066 1001 * fvcn_post_author_ua() 1067 1002 * 1068 * @version 201203221069 1003 * @param int $postId 1070 1004 */ … … 1077 1011 * fvcn_get_post_author_ua() 1078 1012 * 1079 * @version 201203221080 1013 * @param int $postId 1081 1014 * @return string … … 1094 1027 * fvcn_post_tag_id() 1095 1028 * 1096 * @version 201202291097 1029 */ 1098 1030 function fvcn_post_tag_id() … … 1105 1037 * 1106 1038 * @return string 1107 * @version 201711111108 1039 */ 1109 1040 function fvcn_get_post_tag_id() … … 1116 1047 * fvcn_post_tag_slug() 1117 1048 * 1118 * @version 201203251119 1049 */ 1120 1050 function fvcn_post_tag_slug() … … 1126 1056 * fvcn_get_post_tag_slug() 1127 1057 * 1128 * @version 201207101129 1058 * @return string 1130 1059 */ 1131 1060 function fvcn_get_post_tag_slug() 1132 1061 { 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']); 1134 1064 } 1135 1065 … … 1138 1068 * fvcn_post_tag_list() 1139 1069 * 1140 * @version 201203111141 1070 * @param int $postId 1142 1071 * @param string|array $args … … 1150 1079 * fvcn_get_post_tag_list() 1151 1080 * 1152 * @version 201203111153 1081 * @param int $postId 1154 1082 * @param string|array $args … … 1178 1106 * fvcn_post_form_fields() 1179 1107 * 1180 * @version 201711231181 1108 */ 1182 1109 function fvcn_post_form_fields() … … 1194 1121 * fvcn_post_form_field_error() 1195 1122 * 1196 * @version 201207061197 1123 * @param string $field 1198 1124 */ 1199 1125 function fvcn_post_form_field_error($field) 1200 1126 { 1201 $errors = Container::getInstance()->getWpError()->get_error_messages($field);1127 $errors = FvCommunityNews::$container->get(WP_Error::class)->get_error_messages($field); 1202 1128 1203 1129 if (empty($errors)) { … … 1218 1144 * fvcn_post_form_author_name_label() 1219 1145 * 1220 * @version 201203061221 1146 */ 1222 1147 function fvcn_post_form_author_name_label() … … 1228 1153 * fvcn_get_post_form_author_name_label() 1229 1154 * 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']); 1237 1160 return apply_filters('fvcn_get_post_form_author_name_label', $label); 1238 1161 } … … 1241 1164 * fvcn_post_form_author_name() 1242 1165 * 1243 * @version 201203061244 1166 */ 1245 1167 function fvcn_post_form_author_name() … … 1251 1173 * fvcn_get_post_form_author_name() 1252 1174 * 1253 * @version 201203061254 1175 * @return string 1255 1176 */ … … 1269 1190 * fvcn_post_form_author_email_label() 1270 1191 * 1271 * @version 201203061272 1192 */ 1273 1193 function fvcn_post_form_author_email_label() … … 1279 1199 * fvcn_get_post_form_author_email_label() 1280 1200 * 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']); 1288 1206 return apply_filters('fvcn_get_post_form_author_email_label', $label); 1289 1207 } … … 1292 1210 * fvcn_post_form_author_email() 1293 1211 * 1294 * @version 201203061295 1212 */ 1296 1213 function fvcn_post_form_author_email() … … 1302 1219 * fvcn_get_post_form_author_email() 1303 1220 * 1304 * @version 201203061305 1221 * @return string 1306 1222 */ … … 1320 1236 * fvcn_post_form_title_label() 1321 1237 * 1322 * @version 201203061323 1238 */ 1324 1239 function fvcn_post_form_title_label() … … 1330 1245 * fvcn_get_post_form_title_label() 1331 1246 * 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']); 1339 1252 return apply_filters('fvcn_get_post_form_title_label', $label); 1340 1253 } … … 1343 1256 * fvcn_post_form_title() 1344 1257 * 1345 * @version 201203061346 1258 */ 1347 1259 function fvcn_post_form_title() … … 1353 1265 * fvcn_get_post_form_title() 1354 1266 * 1355 * @version 201203061356 1267 * @return string 1357 1268 */ … … 1371 1282 * fvcn_post_form_link_label() 1372 1283 * 1373 * @version 201203071374 1284 */ 1375 1285 function fvcn_post_form_link_label() … … 1381 1291 * fvcn_get_post_form_link_label() 1382 1292 * 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']); 1390 1298 return apply_filters('fvcn_get_post_form_link_label', $label); 1391 1299 } … … 1394 1302 * fvcn_post_form_link() 1395 1303 * 1396 * @version 201203071397 1304 */ 1398 1305 function fvcn_post_form_link() … … 1404 1311 * fvcn_get_post_form_link() 1405 1312 * 1406 * @version 201203071407 1313 * @return string 1408 1314 */ … … 1421 1327 * fvcn_is_post_form_link_required() 1422 1328 * 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 */ 1331 function 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 ); 1429 1336 } 1430 1337 … … 1433 1340 * fvcn_post_form_content_label() 1434 1341 * 1435 * @version 201203061436 1342 */ 1437 1343 function fvcn_post_form_content_label() … … 1443 1349 * fvcn_get_post_form_content_label() 1444 1350 * 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']); 1452 1356 return apply_filters('fvcn_get_post_form_content_label', $label); 1453 1357 } … … 1456 1360 * fvcn_post_form_content() 1457 1361 * 1458 * @version 201203061459 1362 */ 1460 1363 function fvcn_post_form_content() … … 1466 1369 * fvcn_get_post_form_content() 1467 1370 * 1468 * @version 201203061469 1371 * @return string 1470 1372 */ … … 1484 1386 * fvcn_post_form_tags_label() 1485 1387 * 1486 * @version 201203061487 1388 */ 1488 1389 function fvcn_post_form_tags_label() … … 1494 1395 * fvcn_get_post_form_tags_label() 1495 1396 * 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']); 1503 1402 return apply_filters('fvcn_get_post_form_tags_label', $label); 1504 1403 } … … 1507 1406 * fvcn_post_form_tags() 1508 1407 * 1509 * @version 201203061510 1408 */ 1511 1409 function fvcn_post_form_tags() … … 1517 1415 * fvcn_get_post_form_tags() 1518 1416 * 1519 * @version 201203061520 1417 * @return string 1521 1418 */ … … 1534 1431 * fvcn_is_post_form_tags_required() 1535 1432 * 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 */ 1435 function 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 ); 1542 1440 } 1543 1441 … … 1546 1444 * fvcn_post_form_thumbnail_label() 1547 1445 * 1548 * @version 201203061549 1446 */ 1550 1447 function fvcn_post_form_thumbnail_label() … … 1556 1453 * fvcn_get_post_form_thumbnail_label() 1557 1454 * 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']); 1565 1460 return apply_filters('fvcn_get_post_form_thumbnail_label', $label); 1566 1461 } … … 1569 1464 * fvcn_is_post_form_thumbnail_enabled() 1570 1465 * 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 */ 1468 function 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 ); 1577 1473 } 1578 1474 … … 1580 1476 * fvcn_is_post_form_thumbnail_required() 1581 1477 * 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 */ 1480 function 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 ); 1588 1485 } 1589 1486 … … 1592 1489 * fvcn_is_post_added() 1593 1490 * 1594 * @version 201205311595 1491 * @return bool 1596 1492 */ … … 1607 1503 * fvcn_is_post_added_approved() 1608 1504 * 1609 * @version 201205311610 1505 * @return bool 1611 1506 */ -
fv-community-news/trunk/src/Template/tag-functions.php
r1763902 r1806332 4 4 * fvcn_tag_cloud() 5 5 * 6 * @version 201207167 6 * @param string|array $args 8 7 */ -
fv-community-news/trunk/src/Template/user-functions.php
r1773960 r1806332 6 6 * fvcn_is_anonymous() 7 7 * 8 * @version 201202299 8 * @return bool 10 9 */ … … 22 21 * fvcn_get_current_author_ip() 23 22 * 24 * @version 2012022925 23 * @return string 26 24 */ … … 34 32 * fvcn_get_current_author_ua() 35 33 * 36 * @version 2012022937 34 * @return string 38 35 */ … … 50 47 * fvcn_user_id() 51 48 * 52 * @version 2012030753 49 * @param int $userId 54 50 */ … … 60 56 * fvcn_get_user_id() 61 57 * 62 * @version 20120307 63 * @param int $userId 58 * @param int $userId 64 59 * @return int 65 60 */ … … 82 77 * fvcn_current_user_id() 83 78 * 84 * @version 2012022985 79 */ 86 80 function fvcn_current_user_id() { … … 91 85 * fvcn_get_current_user_id() 92 86 * 93 * @version 20120229 94 * @return int 87 * @return int 95 88 */ 96 89 function fvcn_get_current_user_id() { … … 104 97 * fvcn_current_user_name() 105 98 * 106 * @version 20120307107 99 */ 108 100 function fvcn_current_user_name() { … … 113 105 * fvcn_get_current_user_name() 114 106 * 115 * @version 20120307116 107 * @return string 117 108 */ … … 126 117 * fvcn_has_user_posts() 127 118 * 128 * @version 20120323129 119 * @param int $userId 130 120 * @param string $post_status -
fv-community-news/trunk/src/Validator/AbstractValidator.php
r1763902 r1806332 19 19 * setMessage() 20 20 * 21 * @version 2012070422 21 * @param string $message 23 22 * @return AbstractValidator … … 32 31 * getMessage() 33 32 * 34 * @version 2012070435 33 * @return string 36 34 */ -
fv-community-news/trunk/src/Validator/ValidatorChain.php
r1763902 r1806332 19 19 * __construct() 20 20 * 21 * @version 2012070522 21 * @param array $validators 23 22 */ … … 32 31 * setValidators() 33 32 * 34 * @version 2012070535 33 * @param array $validators 36 34 * @return ValidatorChain … … 50 48 * clearValidators() 51 49 * 52 * @version 2012070553 50 * @return ValidatorChain 54 51 */ … … 62 59 * getValidators() 63 60 * 64 * @version 2012070565 61 * @return array 66 62 */ … … 73 69 * addValidator() 74 70 * 75 * @version 2012070576 71 * @param string|AbstractValidator $validator 77 72 * @return ValidatorChain … … 96 91 * removeValidator() 97 92 * 98 * @version 2012070599 93 * @param string|AbstractValidator $validator 100 94 * @return ValidatorChain … … 116 110 * validate() 117 111 * 118 * @version 20120705119 112 * @param mixed $value 120 113 * @return boolean -
fv-community-news/trunk/src/Version.php
r1763902 r1806332 29 29 * 30 30 * @return string 31 * @version 2017110332 31 */ 33 32 public static function getCurrentVersion() … … 40 39 * 41 40 * @return string 42 * @version 2017110743 41 */ 44 42 public static function getLatestVersion() -
fv-community-news/trunk/src/View/AjaxForm.php
r1763902 r1806332 3 3 namespace FvCommunityNews\View; 4 4 5 use FvCommunityNews\Container;6 5 use FvCommunityNews\Post\PostType; 7 use FvCommunityNews\Registry;8 6 9 7 /** … … 22 20 * __construct() 23 21 * 24 * @version 2012071225 22 */ 26 23 public function __construct() … … 43 40 * enqueueScripts() 44 41 * 45 * @version 2012071746 42 * @return AjaxForm 47 43 */ 48 44 public function enqueueScripts() 49 45 { 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'); 53 47 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); 56 49 wp_localize_script('fvcn-js', 'FvCommunityNewsJavascript', $this->jsParams); 57 50 … … 69 62 if (fvcn_has_errors()) { 70 63 $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); 73 66 } 74 67 -
fv-community-news/trunk/src/Widget/Form.php
r1773960 r1806332 15 15 * register() 16 16 * 17 * @version 2012030618 17 */ 19 18 public static function register() … … 25 24 * __construct() 26 25 * 27 * @version 2017110828 26 */ 29 27 public function __construct() … … 42 40 * @param mixed $args 43 41 * @param array $instance 44 * @version 2012030645 42 */ 46 43 public function widget($args, $instance) … … 75 72 * @param array $old_instance 76 73 * @return array 77 * @version 2012030678 74 */ 79 75 public function update($new_instance, $old_instance) … … 89 85 * 90 86 * @param array $instance 91 * @version 2012030692 87 */ 93 88 public function form($instance) -
fv-community-news/trunk/src/Widget/ListPosts.php
r1773960 r1806332 3 3 namespace FvCommunityNews\Widget; 4 4 5 use FvCommunityNews\Registry;6 5 use WP_Widget; 7 6 … … 16 15 * register() 17 16 * 18 * @version 2012030519 17 */ 20 18 public static function register() … … 26 24 * __construct() 27 25 * 28 * @version 2017110829 26 */ 30 27 public function __construct() … … 43 40 * @param mixed $args 44 41 * @param array $instance 45 * @version 2012071046 42 */ 47 43 public function widget($args, $instance) … … 53 49 $num_posts = !empty($instance['num_posts']) ? $instance['num_posts'] : '5'; 54 50 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; 58 54 59 55 $options = [ … … 78 74 * @param array $old_instance 79 75 * @return array 80 * @version 2012030581 76 */ 82 77 public function update($new_instance, $old_instance) … … 102 97 * @param array $instance 103 98 * @return void 104 * @version 20120305105 99 */ 106 100 public function form($instance) -
fv-community-news/trunk/src/Widget/TagCloud.php
r1773960 r1806332 15 15 * register() 16 16 * 17 * @version 2012041118 17 */ 19 18 public static function register() … … 25 24 * __construct() 26 25 * 27 * @version 2017110828 26 */ 29 27 public function __construct() … … 42 40 * @param mixed $args 43 41 * @param array $instance 44 * @version 2012041145 42 */ 46 43 public function widget($args, $instance) … … 67 64 * @param array $old_instance 68 65 * @return array 69 * @version 2012041170 66 */ 71 67 public function update($new_instance, $old_instance) … … 81 77 * 82 78 * @param array $instance 83 * @version 2012041184 79 */ 85 80 public function form($instance)
Note: See TracChangeset
for help on using the changeset viewer.