Changeset 1763902
- Timestamp:
- 11/11/2017 05:34:38 PM (8 years ago)
- Location:
- fv-community-news/trunk
- Files:
-
- 50 added
- 12 deleted
- 14 edited
- 2 copied
- 5 moved
-
config (added)
-
config/default.config.php (added)
-
fv-community-news.php (modified) (3 diffs)
-
fvcn-admin (deleted)
-
fvcn-includes/classes (deleted)
-
fvcn-includes/fvcn-common-functions.php (modified) (7 diffs)
-
fvcn-includes/fvcn-core-classes.php (deleted)
-
fvcn-includes/fvcn-core-hooks.php (modified) (16 diffs)
-
fvcn-includes/fvcn-core-install.php (deleted)
-
fvcn-includes/fvcn-core-javascript.php (deleted)
-
fvcn-includes/fvcn-core-shortcodes.php (deleted)
-
fvcn-includes/fvcn-core-sync.php (deleted)
-
fvcn-includes/fvcn-core-theme.php (modified) (9 diffs)
-
fvcn-includes/fvcn-core-validate.php (deleted)
-
fvcn-includes/fvcn-deprecated-functions.php (deleted)
-
fvcn-includes/fvcn-extend-akismet.php (deleted)
-
fvcn-includes/fvcn-post-functions.php (modified) (26 diffs)
-
fvcn-includes/fvcn-user-functions.php (deleted)
-
fvcn-includes/js (deleted)
-
fvcn-theme/archive-fvcn.php (modified) (2 diffs)
-
fvcn-theme/fvcn/css/fvcn-theme.css (modified) (4 diffs)
-
public (added)
-
public/images (added)
-
public/images/menu-old.png (added)
-
public/images/menu.png (added)
-
public/images/[email protected] (added)
-
public/images/[email protected] (added)
-
public/js (added)
-
public/js/dashboard.js (added)
-
public/js/fvcn-js.js (copied) (copied from fv-community-news/trunk/fvcn-includes/js/fvcn-js.js) (1 diff)
-
public/js/jquery-form.js (copied) (copied from fv-community-news/trunk/fvcn-includes/js/jquery-form.js)
-
public/js/post-moderation.js (added)
-
src/Admin (added)
-
src/Admin/Admin.php (added)
-
src/Admin/AdminFactory.php (added)
-
src/Admin/Dashboard (added)
-
src/Admin/Dashboard/Dashboard.php (added)
-
src/Admin/Dashboard/Widget (added)
-
src/Admin/Dashboard/Widget/RecentPosts.php (added)
-
src/Admin/Post (added)
-
src/Admin/Post/Edit.php (added)
-
src/Admin/Post/Moderation.php (added)
-
src/Admin/Settings (added)
-
src/Admin/Settings/Form.php (added)
-
src/Admin/Settings/Settings.php (added)
-
src/Akismet (added)
-
src/Akismet/Akismet.php (added)
-
src/Akismet/Handler.php (added)
-
src/Application/Application.php (modified) (1 diff)
-
src/Application/Bootstrap.php (modified) (2 diffs)
-
src/Container.php (added)
-
src/Installer.php (added)
-
src/Options.php (modified) (7 diffs)
-
src/Post (added)
-
src/Post/PostType.php (added)
-
src/Post/Shortcodes.php (added)
-
src/Registry.php (added)
-
src/Template (added)
-
src/Template/common-functions.php (moved) (moved from fv-community-news/trunk/fvcn-includes/fvcn-common-template.php) (9 diffs)
-
src/Template/options-functions.php (moved) (moved from fv-community-news/trunk/fvcn-includes/fvcn-core-options.php) (1 diff)
-
src/Template/post-functions.php (moved) (moved from fv-community-news/trunk/fvcn-includes/fvcn-post-template.php) (104 diffs)
-
src/Template/tag-functions.php (moved) (moved from fv-community-news/trunk/fvcn-includes/fvcn-tag-template.php) (2 diffs)
-
src/Template/user-functions.php (moved) (moved from fv-community-news/trunk/fvcn-includes/fvcn-user-template.php) (10 diffs)
-
src/Validator (added)
-
src/Validator/AbstractValidator.php (added)
-
src/Validator/Alnum.php (added)
-
src/Validator/Alpha.php (added)
-
src/Validator/Email.php (added)
-
src/Validator/Image.php (added)
-
src/Validator/MaxLength.php (added)
-
src/Validator/MinLength.php (added)
-
src/Validator/Name.php (added)
-
src/Validator/NotEmpty.php (added)
-
src/Validator/Tags.php (added)
-
src/Validator/Timeout.php (added)
-
src/Validator/Url.php (added)
-
src/Validator/ValidatorChain.php (added)
-
src/Version.php (modified) (3 diffs)
-
src/View (added)
-
src/View/AjaxForm.php (added)
-
src/Widget/Form.php (modified) (1 diff)
-
src/Widget/ListPosts.php (modified) (3 diffs)
-
src/Widget/TagCloud.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
fv-community-news/trunk/fv-community-news.php
r1760963 r1763902 10 10 */ 11 11 12 use FvCommunityNews\Application\Application; 13 use FvCommunityNews\Options; 14 use FvCommunityNews\Registry; 15 12 16 if (!defined('ABSPATH')) exit; 13 14 17 15 18 /** … … 18 21 * @author Frank Verhoeven <[email protected]> 19 22 */ 20 if (!class_exists('FvCommunityNews')) 23 final class FvCommunityNews 21 24 { 22 final class FvCommunityNews 25 /** 26 * @var string 27 */ 28 const VERSION = '3.1'; 29 30 /** 31 * __construct() 32 * 33 * @version 20120709 34 */ 35 public function __construct() 36 {} 37 38 /** 39 * start() 40 * 41 * @version 20120710 42 */ 43 public function start() 23 44 { 24 /** 25 * @var string 26 */ 27 public $version = '3.1'; 45 $this->loadFiles() 46 ->setupVariables() 47 ->setupActions(); 28 48 29 /** 30 * @var FvCommunityNews 31 */ 32 private static $instance; 49 $app = new Application(); 50 $app->run(); 51 } 33 52 34 /** 35 * __construct() 36 * 37 * @version 20120709 38 */ 39 public function __construct() 40 { 53 /** 54 * setupVariables() 55 * 56 * @version 20120710 57 * @return FvCommunityNews 58 */ 59 private function setupVariables() 60 { 61 $pluginDir = plugin_dir_path(__FILE__); 62 $pluginUrl = plugin_dir_url(__FILE__); 63 $baseSlug = Options::fvcnGetOption('_fvcn_base_slug'); 41 64 65 Registry::setInstance(new Registry([ 66 'pluginDir' => $pluginDir, 67 'pluginUrl' => $pluginUrl, 68 69 'themeDir' => $pluginDir . 'fvcn-theme', 70 'themeUrl' => $pluginUrl . 'fvcn-theme', 71 72 'langDir' => $pluginDir . 'fvcn-languages', 73 74 'postSlug' => $baseSlug . '/' . Options::fvcnGetOption('_fvcn_post_slug'), 75 'postTagSlug' => $baseSlug . '/' . Options::fvcnGetOption('_fvcn_post_tag_slug'), 76 'postArchiveSlug'=> $baseSlug . '/' . Options::fvcnGetOption('_fvcn_post_archive_slug'), 77 ])); 78 79 return $this; 80 } 81 82 /** 83 * loadFiles() 84 * 85 * @version 20120716 86 * @return FvCommunityNews 87 * @throws Exception 88 */ 89 private function loadFiles() 90 { 91 include_once __DIR__ . '/src/Autoloader.php'; 92 93 $autoloader = new \FvCommunityNews\AutoLoader(['FvCommunityNews' => __DIR__ . '/src/']); 94 $autoloader->register(); 95 96 $files = [ 97 'fvcn-includes/fvcn-core-hooks.php', 98 'fvcn-includes/fvcn-core-theme.php', 99 'fvcn-includes/fvcn-common-functions.php', 100 'fvcn-includes/fvcn-post-functions.php', 101 102 'src/Template/common-functions.php', 103 'src/Template/options-functions.php', 104 'src/Template/post-functions.php', 105 'src/Template/tag-functions.php', 106 'src/Template/user-functions.php', 107 ]; 108 109 $dir = plugin_dir_path(__FILE__); 110 foreach ($files as $file) { 111 $autoloader->loadFile($dir . $file); 42 112 } 43 113 44 /** 45 * start() 46 * 47 * @version 20120710 48 */ 49 public function start() 50 { 51 $this->_loadFiles() 52 ->_setupVariables() 53 ->_setupActions(); 114 return $this; 115 } 116 117 /** 118 * setupActions() 119 * 120 * @version 20120710 121 * @return FvCommunityNews 122 */ 123 private function setupActions() 124 { 125 register_activation_hook(__FILE__, 'fvcn_activation'); 126 register_deactivation_hook(__FILE__, 'fvcn_deactivation'); 127 128 add_action('fvcn_load_text_domain', [$this, 'loadTextdomain'], 5); 129 130 return $this; 131 } 132 133 /** 134 * loadTextdomain() 135 * 136 * @version 20120710 137 * @return bool 138 */ 139 public function loadTextdomain() 140 { 141 $locale = apply_filters('fvcn_locale', get_locale()); 142 143 $mofile = sprintf('fvcn-%s.mo', $locale); 144 145 $mofile_local = Registry::get('langDir') . '/' . $mofile; 146 $mofile_global = WP_LANG_DIR . '/fv-community-news/' . $mofile; 147 148 // /wp-content/plugins/fv-community-news/fvcn-languages/ 149 if (file_exists($mofile_local)) { 150 return load_textdomain('fvcn', $mofile_local); 151 152 // /wp-content/languages/fv-community-news/ 153 } elseif (file_exists($mofile_global)) { 154 return load_textdomain('fvcn', $mofile_global); 54 155 } 55 156 56 /** 57 * _setupVariables() 58 * 59 * @version 20120710 60 * @return FvCommunityNews 61 */ 62 private function _setupVariables() 63 { 64 $pluginDir = plugin_dir_path(__FILE__); 65 $pluginUrl = plugin_dir_url(__FILE__); 66 $baseSlug = fvcn_get_option('_fvcn_base_slug'); 67 68 FvCommunityNews_Registry::setInstance(new FvCommunityNews_Registry([ 69 'pluginDir' => $pluginDir, 70 'pluginUrl' => $pluginUrl, 71 72 'themeDir' => $pluginDir . 'fvcn-theme', 73 'themeUrl' => $pluginUrl . 'fvcn-theme', 74 75 'langDir' => $pluginDir . 'fvcn-languages', 76 77 'postType' => apply_filters('fvcn_post_type', 'fvcn-post'), 78 'postTagId' => apply_filters('fvcn_post_tag_id', 'fvcn-tag'), 79 80 'psPublic' => apply_filters('fvcn_post_status_public', 'publish'), 81 'psTrash' => apply_filters('fvcn_post_status_trash', 'trash'), 82 'psPrivate' => apply_filters('fvcn_post_status_private', 'private'), 83 'psPending' => apply_filters('fvcn_post_status_pending', 'pending'), 84 'psSpam' => apply_filters('fvcn_post_status_spam', 'spam'), 85 86 'postSlug' => apply_filters('fvcn_post_slug', $baseSlug . '/' . fvcn_get_option('_fvcn_post_slug')), 87 'postTagSlug' => apply_filters('fvcn_post_tag_slug', $baseSlug . '/' . fvcn_get_option('_fvcn_post_tag_slug')), 88 'postArchiveSlug'=>apply_filters('fvcn_post_archive_slug', $baseSlug . '/' . fvcn_get_option('_fvcn_post_archive_slug')), 89 ])); 90 91 return $this; 92 } 93 94 /** 95 * _loadFiles() 96 * 97 * @version 20120716 98 * @return FvCommunityNews 99 * @throws Exception 100 */ 101 private function _loadFiles() 102 { 103 include_once __DIR__ . '/src/Autoloader.php'; 104 105 $autoloader = new \FvCommunityNews\AutoLoader(['FvCommunityNews' => __DIR__ . '/src/']); 106 $autoloader->register(); 107 108 $files = [ 109 'fvcn-includes/fvcn-core-hooks.php', 110 'fvcn-includes/fvcn-core-classes.php', 111 'fvcn-includes/fvcn-core-options.php', 112 'fvcn-includes/fvcn-core-install.php', 113 'fvcn-includes/fvcn-core-javascript.php', 114 'fvcn-includes/fvcn-core-validate.php', 115 'fvcn-includes/fvcn-core-shortcodes.php', 116 'fvcn-includes/fvcn-core-theme.php', 117 'fvcn-includes/fvcn-core-sync.php', 118 'fvcn-includes/fvcn-common-functions.php', 119 'fvcn-includes/fvcn-common-template.php', 120 'fvcn-includes/fvcn-post-functions.php', 121 'fvcn-includes/fvcn-post-template.php', 122 'fvcn-includes/fvcn-tag-template.php', 123 'fvcn-includes/fvcn-user-functions.php', 124 'fvcn-includes/fvcn-user-template.php', 125 'fvcn-includes/fvcn-deprecated-functions.php', 126 'fvcn-includes/fvcn-extend-akismet.php' 127 ]; 128 129 if (is_admin()) { 130 $files[] = 'fvcn-admin/fvcn-admin.php'; 131 } 132 133 $dir = plugin_dir_path(__FILE__); 134 foreach ($files as $file) { 135 if (file_exists($dir . $file)) { 136 require_once $dir . $file; 137 } else { 138 throw new Exception('The file "' . $file . '" was not found'); 139 } 140 } 141 142 return $this; 143 } 144 145 /** 146 * _setupActions() 147 * 148 * @version 20120710 149 * @return FvCommunityNews 150 */ 151 private function _setupActions() 152 { 153 register_activation_hook( __FILE__, 'fvcn_activation'); 154 register_deactivation_hook(__FILE__, 'fvcn_deactivation'); 155 156 $actions = [ 157 'register_post_type' => 'registerPostType', 158 'register_post_statuses'=> 'registerPostStatuses', 159 'register_taxonomy' => 'registerTaxonomy', 160 'load_text_domain' => 'loadTextdomain' 161 ]; 162 163 foreach ($actions as $hook=>$method) { 164 add_action('fvcn_' . $hook, [$this, $method], 5); 165 } 166 167 return $this; 168 } 169 170 /** 171 * loadTextdomain() 172 * 173 * @version 20120710 174 * @return bool 175 */ 176 public function loadTextdomain() 177 { 178 $locale = apply_filters('fvcn_locale', get_locale()); 179 180 $mofile = sprintf('fvcn-%s.mo', $locale); 181 182 $mofile_local = FvCommunityNews_Registry::get('langDir') . '/' . $mofile; 183 $mofile_global = WP_LANG_DIR . '/fv-community-news/' . $mofile; 184 185 // /wp-content/plugins/fv-community-news/fvcn-languages/ 186 if (file_exists($mofile_local)) { 187 return load_textdomain('fvcn', $mofile_local); 188 189 // /wp-content/languages/fv-community-news/ 190 } elseif (file_exists($mofile_global)) { 191 return load_textdomain('fvcn', $mofile_global); 192 } 193 194 return false; 195 } 196 197 /** 198 * registerPostType() 199 * 200 * @version 20120710 201 * @return FvCommunityNews 202 */ 203 public function registerPostType() { 204 $post = [ 205 'labels' => [ 206 'name' => __('FV Community News', 'fvcn'), 207 'menu_name' => __('Community News', 'fvcn'), 208 'singular_name' => __('Community News', 'fvcn'), 209 'all_items' => __('Community News', 'fvcn'), 210 'add_new' => __('New Post', 'fvcn'), 211 'add_new_item' => __('Create New Post', 'fvcn'), 212 'edit' => __('Edit', 'fvcn'), 213 'edit_item' => __('Edit Post', 'fvcn'), 214 'new_item' => __('New Post', 'fvcn'), 215 'view' => __('View Post', 'fvcn'), 216 'view_item' => __('View Post', 'fvcn'), 217 'search_items' => __('Search Community News', 'fvcn'), 218 'not_found' => __('No posts found', 'fvcn'), 219 'not_found_in_trash'=> __('No posts found in Trash','fvcn') 220 ], 221 'rewrite' => [ 222 'slug' => FvCommunityNews_Registry::get('postSlug'), 223 'with_front' => false 224 ], 225 'supports' => [ 226 'title', 227 'editor', 228 'thumbnail', 229 'comments' 230 ] 231 ]; 232 233 $options = apply_filters('fvcn_register_fvcn_post_type', [ 234 'labels' => $post['labels'], 235 'rewrite' => $post['rewrite'], 236 'supports' => $post['supports'], 237 'description' => __('FV Community News Posts', 'fvcn'), 238 'has_archive' => FvCommunityNews_Registry::get('postArchiveSlug'), 239 'public' => true, 240 'publicly_queryable' => true, 241 'can_export' => true, 242 'hierarchical' => false, 243 'query_var' => true, 244 'exclude_from_search' => false, 245 'show_ui' => true, 246 'show_in_menu' => true, 247 'menu_position' => 20, 248 'menu_icon' => '', 249 'capability_type' => 'post', 250 ]); 251 252 register_post_type(FvCommunityNews_Registry::get('postType'), $options); 253 254 return $this; 255 } 256 257 /** 258 * registerPostStatuses() 259 * 260 * @version 20120716 261 * @return FvCommunityNews 262 */ 263 public function registerPostStatuses() { 264 $status = apply_filters('fvcn_register_spam_post_status', [ 265 'label' => __('Spam', 'fvcn'), 266 'label_count' => _nx_noop('Spam <span class="count">(%s)</span>', 'Spam <span class="count">(%s)</span>', 'fvcn'), 267 'protected' => true, 268 'exclude_from_search' => true, 269 'show_in_admin_status_list' => true, 270 'show_in_admin_all_list' => false 271 ]); 272 273 register_post_status(FvCommunityNews_Registry::get('psSpam'), $status); 274 275 return $this; 276 } 277 278 /** 279 * registerTaxonomy() 280 * 281 * @version 20120716 282 * @return FvCommunityNews 283 */ 284 public function registerTaxonomy() 285 { 286 $tag = [ 287 'labels' => [ 288 'name' => __('Tags', 'fvcn'), 289 'singular_name' => __('Tag', 'fvcn'), 290 'search_items' => __('Search Tags', 'fvcn'), 291 'popular_items' => __('Popular Tags', 'fvcn'), 292 'all_items' => __('All Tags', 'fvcn'), 293 'edit_item' => __('Edit Tag', 'fvcn'), 294 'update_item' => __('Update Tag', 'fvcn'), 295 'add_new_item' => __('Add New Tag', 'fvcn'), 296 'new_item_name' => __('New Tag Name', 'fvcn'), 297 ], 298 'rewrite' => [ 299 'slug' => FvCommunityNews_Registry::get('postTagSlug'), 300 'with_front' => false 301 ] 302 ]; 303 304 $options = apply_filters('fvcn_register_fvcn_post_tag_id', [ 305 'labels' => $tag['labels'], 306 'rewrite' => $tag['rewrite'], 307 'public' => true 308 ]); 309 310 register_taxonomy( 311 FvCommunityNews_Registry::get('postTagId'), 312 FvCommunityNews_Registry::get('postType'), 313 $options 314 ); 315 316 return $this; 317 } 318 319 320 /** 321 * setInstance() 322 * 323 * @version 20120710 324 * @param FvCommunityNews $instance 325 */ 326 public static function setInstance(FvCommunityNews $instance=null) 327 { 328 if (null === self::$instance) { 329 if (null === $instance) { 330 self::$instance = new FvCommunityNews(); 331 } else { 332 self::$instance = $instance; 333 } 334 } 335 } 336 337 /** 338 * getInstance() 339 * 340 * @version 20120710 341 * @return FvCommunityNews 342 */ 343 public static function getInstance() 344 { 345 self::setInstance(); 346 return self::$instance; 347 } 348 } 349 350 351 /** 352 * Lets roll 353 * 354 */ 355 try { 356 FvCommunityNews::getInstance()->start(); 357 } catch (Exception $e) { 358 if (defined('WP_DEBUG') && true === WP_DEBUG) { 359 echo '<h3>' . $e->getMessage() . '</h3><pre>' . $e->getTraceAsString() . '</pre>'; 360 } 361 362 error_log( 'fvcn: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); 157 return false; 363 158 } 364 159 } 365 160 366 161 162 /** 163 * Lets roll 164 * 165 */ 166 try { 167 $fvcn = new FvCommunityNews(); 168 $fvcn->start(); 169 } catch (Exception $e) { 170 if (defined('WP_DEBUG') && true === WP_DEBUG) { 171 echo '<h3>' . $e->getMessage() . '</h3><pre>' . $e->getTraceAsString() . '</pre>'; 172 } 173 174 error_log('fvcn: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString()); 175 } 367 176 368 177 /** … … 371 180 * 372 181 */ 373 -
fv-community-news/trunk/fvcn-includes/fvcn-common-functions.php
r1760963 r1763902 1 1 <?php 2 2 3 /** 4 * fvcn-common-functions.php 5 * 6 * Common Functions 7 * 8 * @package FV Community News 9 * @subpackage Functions 10 * @author Frank Verhoeven <[email protected]> 11 */ 12 13 if (!defined('ABSPATH')) { 14 exit; 15 } 16 3 use FvCommunityNews\Container; 4 use FvCommunityNews\Options; 5 use FvCommunityNews\Post\PostType; 6 use FvCommunityNews\Registry; 17 7 18 8 /** … … 23 13 * @param string $message 24 14 * @param string $data 25 * @return void26 15 */ 27 16 function fvcn_add_error($code='', $message='', $data='') 28 17 { 29 FvCommunityNews_Container::getInstance()->getWpError()->add($code, $message, $data);18 Container::getInstance()->getWpError()->add($code, $message, $data); 30 19 } 31 20 … … 40 29 $hasErrors = false; 41 30 42 if ( FvCommunityNews_Container::getInstance()->getWpError()->get_error_codes()) {31 if (Container::getInstance()->getWpError()->get_error_codes()) { 43 32 $hasErrors = true; 44 33 } 45 34 46 return apply_filters('fvcn_has_errors', $hasErrors, FvCommunityNews_Container::getInstance()->getWpError());35 return apply_filters('fvcn_has_errors', $hasErrors, Container::getInstance()->getWpError()); 47 36 } 48 37 … … 51 40 * 52 41 * @version 20120805 53 * @return void54 42 */ 55 43 function fvcn_add_thumbnail_theme_support() 56 44 { 57 if (true === get_theme_support( 'post-thumbnails')) {58 FvCommunityNews_Registry::set('nativeThumbnailSupport', true);45 if (true === get_theme_support('post-thumbnails')) { 46 Registry::set('nativeThumbnailSupport', true); 59 47 } else { 60 FvCommunityNews_Registry::set('nativeThumbnailSupport', false);61 add_theme_support('post-thumbnails', [ fvcn_get_post_type(), fvcn_get_post_slug()]);48 Registry::set('nativeThumbnailSupport', false); 49 add_theme_support('post-thumbnails', [PostType::POST_TYPE_KEY, fvcn_get_post_slug()]); 62 50 } 63 }64 65 /**66 * fvcn_get_public_post_status()67 *68 * @version 2012071069 * @return string70 */71 function fvcn_get_public_post_status()72 {73 return FvCommunityNews_Registry::get('psPublic');74 }75 76 /**77 * fvcn_get_trash_post_status()78 *79 * @version 2012071080 * @return string81 */82 function fvcn_get_trash_post_status()83 {84 return FvCommunityNews_Registry::get('psTrash');85 }86 87 /**88 * fvcn_get_private_post_status()89 *90 * @version 2012071091 * @return string92 */93 function fvcn_get_private_post_status()94 {95 return FvCommunityNews_Registry::get('psPrivate');96 }97 98 /**99 * fvcn_get_pending_post_status()100 *101 * @version 20120710102 * @return string103 */104 function fvcn_get_pending_post_status()105 {106 return FvCommunityNews_Registry::get('psPending');107 }108 109 /**110 * fvcn_get_spam_post_status()111 *112 * @version 20120710113 * @return string114 */115 function fvcn_get_spam_post_status()116 {117 return FvCommunityNews_Registry::get('psSpam');118 51 } 119 52 … … 131 64 return $data; 132 65 } 133 if ($data['post_type'] != fvcn_get_post_type()) {66 if ($data['post_type'] != PostType::POST_TYPE_KEY) { 134 67 return $data; 135 68 } … … 153 86 { 154 87 if (!fvcn_mail_on_submission() && !fvcn_mail_on_moderation()) { 155 return ;88 return false; 156 89 } 157 if ( fvcn_get_spam_post_status()== fvcn_get_post_status($postId)) {158 return ;90 if (PostType::STATUS_SPAM == fvcn_get_post_status($postId)) { 91 return false; 159 92 } 160 93 161 if ( fvcn_get_pending_post_status()== fvcn_get_post_status($postId) && (fvcn_mail_on_submission() || fvcn_mail_on_moderation())) {94 if (PostType::STATUS_PENDING == fvcn_get_post_status($postId) && (fvcn_mail_on_submission() || fvcn_mail_on_moderation())) { 162 95 $subject = '[' . get_option('blogname') . '] ' . __('New Community Post Awaiting Moderation', 'fvcn'); 163 $moderationPage = add_query_arg(['post_type' => fvcn_get_post_type(), 'post_status' => fvcn_get_pending_post_status()], home_url('/wp-admin/edit.php'));96 $moderationPage = add_query_arg(['post_type' => PostType::POST_TYPE_KEY, 'post_status' => PostType::STATUS_PENDING], home_url('/wp-admin/edit.php')); 164 97 } else if (fvcn_mail_on_submission()) { 165 98 $subject = '[' . get_option('blogname') . '] ' . __('New Community Post', 'fvcn'); 166 $moderationPage = add_query_arg(['post_type' => fvcn_get_post_type()], home_url('/wp-admin/edit.php'));99 $moderationPage = add_query_arg(['post_type' => PostType::POST_TYPE_KEY], home_url('/wp-admin/edit.php')); 167 100 } else { 168 return ;101 return false; 169 102 } 170 103 171 104 $to = get_option('admin_email'); 172 105 if (!is_email($to)) { 173 return ;106 return false; 174 107 } 175 108 … … 183 116 } 184 117 118 119 ///////// Admin Functions 120 121 /** 122 * fvcn_form_option() 123 * 124 * @version 20120524 125 * @param string $option 126 * @param bool $slug 127 */ 128 function fvcn_form_option($option, $slug=false) 129 { 130 echo fvcn_get_form_option($option, $slug); 131 } 132 133 /** 134 * fvcn_get_form_option() 135 * 136 * @version 20120524 137 * @param string $option 138 * @param bool $slug 139 * @return mixed 140 */ 141 function fvcn_get_form_option($option, $slug=false) 142 { 143 $value = Options::fvcnGetOption($option); 144 145 if (true === $slug) { 146 $value = apply_filters('editable_slug', $value); 147 } 148 149 return apply_filters('fvcn_get_form_option', esc_attr($value)); 150 } -
fv-community-news/trunk/fvcn-includes/fvcn-core-hooks.php
r1760963 r1763902 11 11 */ 12 12 13 use FvCommunityNews\Akismet\Akismet; 14 use FvCommunityNews\Container; 15 use FvCommunityNews\Options; 16 use FvCommunityNews\Post\PostType; 13 17 use FvCommunityNews\Widget\Form as FormWidget; 14 18 use FvCommunityNews\Widget\ListPosts as ListPostsWidget; … … 35 39 */ 36 40 add_action('fvcn_init', 'fvcn_load_textdomain', 2); 37 add_action('fvcn_init', 'fvcn_register_post_type', 10); 38 add_action('fvcn_init', 'fvcn_register_post_statuses', 12); 39 add_action('fvcn_init', 'fvcn_register_taxonomy', 14); 40 add_action('fvcn_init', 'fvcn_register_shortcodes', 16); 41 add_action('fvcn_init', 'fvcn_javascript', 18); 41 add_action('fvcn_init', [PostType::class, 'register'], 10); 42 42 add_action('fvcn_init', 'fvcn_ready', 999); 43 44 45 add_action('fvcn_ready', 'fvcn_akismet'); 43 add_action('fvcn_init', function() { 44 add_action('fvcn_enqueue_scripts', [Container::getInstance()->getJavascript(), 'enqueueScripts']); 45 }); 46 47 add_action('fvcn_ready', [Akismet::class, 'fvcn_akismet']); 46 48 47 49 … … 61 63 * fvcn_(de)activation 62 64 */ 63 add_action('fvcn_activation', 'fvcn_install');64 65 add_action('fvcn_deactivation', 'flush_rewrite_rules'); 65 add_action('fvcn_uninstall', 'fvcn_delete_options'); 66 67 68 /** 69 * fvcn_sync 70 */ 71 add_action('fvcn_insert_post', 'fvcn_sync_submit_post', 999); 72 add_action('fvcn_publish_post', 'fvcn_sync_submit_post', 999); 73 add_action('fvcn_increase_post_view_count', 'fvcn_sync_increase_post_view_count', 999); 74 add_action('fvcn_post_rating_increase', 'fvcn_sync_increase_post_rating', 999); 75 add_action('fvcn_post_rating_decrease', 'fvcn_sync_decrease_post_rating', 999); 66 add_action('fvcn_uninstall', [Options::class, 'fvcnDeleteOptions']); 67 76 68 77 69 … … 157 149 */ 158 150 if (is_admin()) { 159 add_action('fvcn_init', 'fvcn_admin'); 151 add_action('fvcn_init', function() { 152 \FvCommunityNews\Container::getInstance()->getAdmin(); 153 }); 160 154 } 161 155 … … 165 159 * 166 160 * @version 20120229 167 * @return void168 161 */ 169 162 function fvcn_activation() … … 177 170 * 178 171 * @version 20120229 179 * @return void180 172 */ 181 173 function fvcn_deactivation() … … 188 180 * 189 181 * @version 20120229 190 * @return void191 182 */ 192 183 function fvcn_uninstall() … … 199 190 * 200 191 * @version 20120229 201 * @return void202 192 */ 203 193 function fvcn_loaded() … … 210 200 * 211 201 * @version 20120229 212 * @return void213 202 */ 214 203 function fvcn_init() … … 221 210 * 222 211 * @version 20120305 223 * @return void224 212 */ 225 213 function fvcn_widgets_init() … … 232 220 * 233 221 * @version 20120229 234 * @return void235 222 */ 236 223 function fvcn_load_textdomain() … … 243 230 * 244 231 * @version 20120229 245 * @return void246 232 */ 247 233 function fvcn_register_post_type() … … 254 240 * 255 241 * @version 20120308 256 * @return void257 242 */ 258 243 function fvcn_register_post_statuses() … … 265 250 * 266 251 * @version 20120229 267 * @return void268 252 */ 269 253 function fvcn_register_taxonomy() … … 276 260 * 277 261 * @version 20120314 278 * @return void279 262 */ 280 263 function fvcn_enqueue_scripts() … … 287 270 * 288 271 * @version 20120229 289 * @return void290 272 */ 291 273 function fvcn_ready() -
fv-community-news/trunk/fvcn-includes/fvcn-core-theme.php
r1760963 r1763902 1 1 <?php 2 2 3 /** 4 * fvcn-core-theme.php 5 * 6 * Theme 7 * 8 * @package FV Community News 9 * @subpackage Theme 10 * @author Frank Verhoeven <[email protected]> 11 */ 12 13 if (!defined('ABSPATH')) { 14 exit; 15 } 16 17 18 /** 19 * FvCommunityNews_Theme 20 * 21 */ 22 class FvCommunityNews_Theme 23 { 24 /** 25 * @var bool 26 */ 27 protected $_compatActive = true; 28 29 /** 30 * __construct() 31 * 32 * @version 20120719 33 * @return void 34 */ 35 public function __construct() 36 { 37 38 } 39 40 /** 41 * isCompatActive() 42 * 43 * @version 20120719 44 * @return bool 45 */ 46 public function isCompatActive() 47 { 48 return $this->_compatActive; 49 } 50 } 51 3 use FvCommunityNews\Post\PostType; 4 use FvCommunityNews\Registry; 52 5 53 6 /** … … 59 12 function fvcn_get_theme_dir() 60 13 { 61 return apply_filters('fvcn_get_theme_dir', FvCommunityNews_Registry::get('themeDir'));14 return apply_filters('fvcn_get_theme_dir', Registry::get('themeDir')); 62 15 } 63 16 … … 71 24 function fvcn_get_theme_url() 72 25 { 73 return apply_filters('fvcn_get_theme_url', FvCommunityNews_Registry::get('themeUrl'));26 return apply_filters('fvcn_get_theme_url', Registry::get('themeUrl')); 74 27 } 75 28 … … 81 34 * @param string $slug 82 35 * @param string $name 83 * @return void84 36 */ 85 37 function fvcn_get_template_part($slug, $name=null) … … 112 64 113 65 if ('' == ($template = locate_template($templates))) { 114 FvCommunityNews_Registry::set('themeCompatActive', true);115 } else { 116 FvCommunityNews_Registry::set('themeCompatActive', false);66 Registry::set('themeCompatActive', true); 67 } else { 68 Registry::set('themeCompatActive', false); 117 69 } 118 70 … … 130 82 { 131 83 return fvcn_get_query_template('single_post', [ 132 'single-' . fvcn_get_post_type(). '.php',84 'single-' . PostType::POST_TYPE_KEY . '.php', 133 85 'single-fvcn.php' 134 86 ]); … … 145 97 { 146 98 return fvcn_get_query_template('post_archive', [ 147 'archive-' . fvcn_get_post_type(). '.php',99 'archive-' . PostType::POST_TYPE_KEY . '.php', 148 100 'archive-fvcn.php' 149 101 ]); … … 170 122 * 171 123 * @version 20120717 172 * @return void173 124 */ 174 125 function fvcn_theme_enqueue_css() … … 194 145 $active = true; 195 146 196 if (false === FvCommunityNews_Registry::get('themeCompatActive')) {147 if (false === Registry::get('themeCompatActive')) { 197 148 $active = false; 198 149 } -
fv-community-news/trunk/fvcn-includes/fvcn-post-functions.php
r1760963 r1763902 1 1 <?php 2 2 3 /** 4 * fvcn-post-functions.php 5 * 6 * Post Functions 7 * 8 * @package FV Community News 9 * @subpackage Functions 10 * @author Frank Verhoeven <[email protected]> 11 */ 12 13 if (!defined('ABSPATH')) { 14 exit; 15 } 3 use FvCommunityNews\Post\PostType; 4 use FvCommunityNews\Validator\MaxLength; 5 use FvCommunityNews\Validator\MinLength; 6 use FvCommunityNews\Validator\ValidatorChain; 16 7 17 8 /** … … 30 21 'post_title' => '', 31 22 'post_content' => '', 32 'post_status' => fvcn_get_pending_post_status(),33 'post_type' => fvcn_get_post_type(),23 'post_status' => PostType::STATUS_PENDING, 24 'post_type' => PostType::POST_TYPE_KEY, 34 25 'post_password' => '', 35 26 'tax_input' => '' … … 91 82 * 92 83 * @version 20120808 93 * @return void94 84 */ 95 85 function fvcn_new_post_handler() … … 115 105 'post_link' => '', 116 106 'post_tags' => '', 117 'post_status' => fvcn_get_pending_post_status()107 'post_status' => PostType::STATUS_PENDING 118 108 ]; 119 $validator = new FvCommunityNews_Validate();109 $validator = new ValidatorChain(); 120 110 121 111 // Timeout 122 112 apply_filters('fvcn_post_form_time_key', $validator->setValidators([ 123 'FvCommunityNews _Validate_NotEmpty',124 'FvCommunityNews _Validate_Timeout'113 'FvCommunityNews\Validator\NotEmpty', 114 'FvCommunityNews\Validator\Timeout' 125 115 ])); 126 116 … … 132 122 // Author Name 133 123 apply_filters('fvcn_post_author_name_validators', $validator->setValidators([ 134 'FvCommunityNews _Validate_NotEmpty',135 'FvCommunityNews _Validate_Name',136 new FvCommunityNews_Validate_MinLength(2),137 new FvCommunityNews_Validate_MaxLength(40)124 'FvCommunityNews\Validator\NotEmpty', 125 'FvCommunityNews\Validator\Name', 126 new MinLength(2), 127 new MaxLength(40) 138 128 ])); 139 129 … … 146 136 // Author Email 147 137 apply_filters('fvcn_post_author_email_validators', $validator->setValidators([ 148 'FvCommunityNews _Validate_NotEmpty',149 'FvCommunityNews _Validate_Email',150 new FvCommunityNews_Validate_MinLength(10),151 new FvCommunityNews_Validate_MaxLength(60)138 'FvCommunityNews\Validator\NotEmpty', 139 'FvCommunityNews\Validator\Email', 140 new MinLength(10), 141 new MaxLength(60) 152 142 ])); 153 143 … … 165 155 if (fvcn_user_moderation()) { 166 156 if (fvcn_has_user_posts()) { 167 $postData['post_status'] = fvcn_get_public_post_status();157 $postData['post_status'] = PostType::STATUS_PUBLISH; 168 158 } 169 159 } else { 170 $postData['post_status'] = fvcn_get_public_post_status();160 $postData['post_status'] = PostType::STATUS_PUBLISH; 171 161 } 172 162 } … … 174 164 // Title 175 165 apply_filters('fvcn_post_title_validators', $validator->setValidators([ 176 'FvCommunityNews _Validate_NotEmpty',177 new FvCommunityNews_Validate_MinLength(8),178 new FvCommunityNews_Validate_MaxLength(70)166 'FvCommunityNews\Validator\NotEmpty', 167 new MinLength(8), 168 new MaxLength(70) 179 169 ])); 180 170 … … 188 178 if (fvcn_is_post_form_link_required()) { 189 179 apply_filters('fvcn_post_link_validators', $validator->setValidators([ 190 'FvCommunityNews _Validate_NotEmpty',191 'FvCommunityNews _Validate_Url',192 new FvCommunityNews_Validate_MinLength(6)180 'FvCommunityNews\Validator\NotEmpty', 181 'FvCommunityNews\Validator\Url', 182 new MinLength(6) 193 183 ])); 194 184 … … 199 189 } 200 190 } else { 201 $validator->setValidators(['FvCommunityNews _Validate_NotEmpty']);191 $validator->setValidators(['FvCommunityNews\Validator\NotEmpty']); 202 192 203 193 if ($validator->isValid($_POST['fvcn_post_form_link'])) { 204 194 apply_filters('fvcn_post_link_validators', $validator->setValidators([ 205 'FvCommunityNews _Validate_Url',206 new FvCommunityNews_Validate_MinLength(6)195 'FvCommunityNews\Validator\Url', 196 new MinLength(6) 207 197 ])); 208 198 … … 220 210 // Content 221 211 apply_filters('fvcn_post_content_validators', $validator->setValidators([ 222 'FvCommunityNews _Validate_NotEmpty',223 new FvCommunityNews_Validate_MinLength(80)212 'FvCommunityNews\Validator\NotEmpty', 213 new MinLength(80) 224 214 ])); 225 215 … … 233 223 if (fvcn_is_post_form_tags_required()) { 234 224 apply_filters('fvcn_post_tags_validators', $validator->setValidators([ 235 'FvCommunityNews _Validate_NotEmpty',236 'FvCommunityNews _Validate_Tags',237 new FvCommunityNews_Validate_MinLength(2)225 'FvCommunityNews\Validator\NotEmpty', 226 'FvCommunityNews\Validator\Tags', 227 new MinLength(2) 238 228 ])); 239 229 … … 247 237 } 248 238 } else { 249 $validator->setValidators(['FvCommunityNews _Validate_NotEmpty']);239 $validator->setValidators(['FvCommunityNews\Validator\NotEmpty']); 250 240 251 241 if ($validator->isValid($_POST['fvcn_post_form_link'])) { 252 242 apply_filters('fvcn_post_tags_validators', $validator->setValidators([ 253 'FvCommunityNews _Validate_Tags',254 new FvCommunityNews_Validate_MinLength(2)243 'FvCommunityNews\Validator\Tags', 244 new MinLength(2) 255 245 ])); 256 246 … … 269 259 if (fvcn_is_post_form_thumbnail_required()) { 270 260 apply_filters('fvcn_post_title_validators', $validator->setValidators([ 271 'FvCommunityNews _Validate_ImageUpload'261 'FvCommunityNews\Validator\ImageUpload' 272 262 ])); 273 263 … … 279 269 } else if (!empty($_FILES['fvcn_post_form_thumbnail']['tmp_name'])) { 280 270 apply_filters('fvcn_post_title_validators', $validator->setValidators([ 281 'FvCommunityNews _Validate_ImageUpload'271 'FvCommunityNews\Validator\ImageUpload' 282 272 ])); 283 273 … … 300 290 'tax_input' => $postData['post_tags'], 301 291 'post_status' => $postData['post_status'], 302 'post_type' => fvcn_get_post_type()292 'post_type' => PostType::POST_TYPE_KEY 303 293 ]); 304 294 $post_meta = apply_filters('fvcn_new_post_meta_pre_insert', [ … … 313 303 314 304 if ('template_redirect' == current_filter()) { 315 if ( fvcn_get_public_post_status()== fvcn_get_post_status($postId)) {316 wp_redirect( add_query_arg(['fvcn_added'=>$postId], fvcn_get_post_permalink($postId)));305 if (PostType::STATUS_PUBLISH == fvcn_get_post_status($postId)) { 306 wp_redirect(add_query_arg(['fvcn_added'=>$postId], fvcn_get_post_permalink($postId))); 317 307 } else { 318 wp_redirect( add_query_arg(['fvcn_added'=>$postId], home_url('/')));308 wp_redirect(add_query_arg(['fvcn_added'=>$postId], home_url('/'))); 319 309 } 320 310 } else { … … 416 406 * 417 407 * @version 20120722 418 * @return void419 408 */ 420 409 function fvcn_post_rating_handler() … … 446 435 setcookie('fvcn_post_rated_' . $id . '_' . COOKIEHASH, 'true', time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 447 436 448 wp_redirect( fvcn_get_post_permalink($id));437 wp_redirect(fvcn_get_post_permalink($id)); 449 438 } 450 439 … … 484 473 do_action('fvcn_publish_post', $postId); 485 474 486 return $this->changePostStatus( $postId, fvcn_get_public_post_status());475 return $this->changePostStatus($postId, PostType::STATUS_PUBLISH); 487 476 } 488 477 … … 498 487 do_action('fvcn_unpublish_post', $postId); 499 488 500 return $this->changePostStatus( $postId, fvcn_get_pending_post_status());489 return $this->changePostStatus($postId, PostType::STATUS_PENDING); 501 490 } 502 491 … … 512 501 do_action('fvcn_spam_post', $postId); 513 502 514 return $this->changePostStatus( $postId, fvcn_get_spam_post_status());503 return $this->changePostStatus($postId, PostType::STATUS_SPAM); 515 504 } 516 505 … … 520 509 * @version 20120722 521 510 * @param int $postId 522 * @return void 523 */ 511 */ 524 512 public function increasePostRating($postId) 525 513 { … … 534 522 * @version 20120722 535 523 * @param int $postId 536 * @return void 537 */ 524 */ 538 525 public function decreasePostRating($postId) 539 526 { … … 548 535 * @version 20120724 549 536 * @param int $postId 550 * @return void 551 */ 537 */ 552 538 public function increasePostViewCount($postId) 553 539 { … … 557 543 } 558 544 } 559 -
fv-community-news/trunk/fvcn-theme/archive-fvcn.php
r1760963 r1763902 20 20 </header> 21 21 22 <?php twentyeleven_content_nav( 'nav-above'); ?>22 <?php twentyeleven_content_nav('nav-above'); ?> 23 23 24 24 <?php while (have_posts()) : the_post(); ?> … … 50 50 <?php endwhile; ?> 51 51 52 <?php twentyeleven_content_nav( 'nav-below'); ?>52 <?php twentyeleven_content_nav('nav-below'); ?> 53 53 54 54 <?php else : ?> -
fv-community-news/trunk/fvcn-theme/fvcn/css/fvcn-theme.css
r1760963 r1763902 1 @charset "UTF-8";2 3 1 /** 4 2 * FV Community News Styles 5 3 * 6 * @ version 201207167 * @ author Frank Verhoeven <[email protected]>4 * @author Frank Verhoeven <[email protected]> 5 * @version 20171111 8 6 */ 9 7 … … 45 43 */ 46 44 .fvcn-template-notice { 47 border-width: 1px;48 border-style: solid;49 45 padding: .1em .4em; 50 46 margin: 5px 0 !important; 51 47 border-radius: 4px; 52 48 background-color: #ffffe0; 53 border -color:#e6db55;49 border: 1px solid #e6db55; 54 50 color: #000; 55 51 clear: both; … … 98 94 99 95 .fvcn-post-form-ajax-loader .fvcn-post-form-ajax-progress-bar-inner { 100 width: 0 %;96 width: 0; 101 97 padding: 0 !important; 102 98 height: 4px !important; … … 111 107 width: 100%; 112 108 } 113 114 115 116 117 118 119 120 121 122 123 124 -
fv-community-news/trunk/public/js/fvcn-js.js
r1763901 r1763902 43 43 } 44 44 45 $('.fvcn-post-form-ajax-progress-bar-inner').width( percentComplete + '%');45 $('.fvcn-post-form-ajax-progress-bar-inner').width(percentComplete + '%'); 46 46 }, 47 47 success: function(response) { -
fv-community-news/trunk/src/Application/Application.php
r1760963 r1763902 5 5 class Application 6 6 { 7 7 public function run() 8 { 9 $bootstrap = new Bootstrap(); 10 $bootstrap->registerShortcodes(); 11 } 8 12 } -
fv-community-news/trunk/src/Application/Bootstrap.php
r1760963 r1763902 2 2 3 3 namespace FvCommunityNews\Application; 4 5 use FvCommunityNews; 6 use FvCommunityNews\Admin\Admin; 7 use FvCommunityNews\Admin\AdminFactory; 8 use FvCommunityNews\Container; 9 use FvCommunityNews\Installer; 10 use FvCommunityNews\Post\PostType; 4 11 5 12 /** … … 10 17 class Bootstrap 11 18 { 19 public function registerHooks() 20 { 21 add_action('fvcn_activation', [$this, 'installation']); 22 add_action('fvcn_init', [$this, 'registerShortcodes'], 16); 12 23 24 } 25 26 public function installation() 27 { 28 $installer = new Installer(Container::getInstance()->getOptions()); 29 30 $installer->hasUpdate(); 31 32 if ($installer->isInstall()) { 33 $installer->install(); 34 } elseif ($installer->isUpdate()) { 35 $installer->update(); 36 } 37 38 PostType::register(); 39 40 flush_rewrite_rules(); 41 } 42 43 public function registerShortcodes() 44 { 45 Container::getInstance()->getShortcodes(); 46 } 13 47 } -
fv-community-news/trunk/src/Options.php
r1760963 r1763902 10 10 class Options 11 11 { 12 /** 13 * @var array 14 */ 15 private $options; 12 16 /** 13 17 * @var array 14 18 */ 15 protected $defaultOptions = []; 16 17 /** 18 * @var array 19 */ 20 protected $options = []; 19 private $defaults; 21 20 22 21 /** 23 22 * __construct() 24 23 * 25 * @version 20171103 26 */ 27 public function __construct() 28 { 29 $this->setDefaultOptions(); 30 } 31 32 /** 33 * setDefaultOptions() 34 * 35 * @return $this 36 * @version 20171103 37 */ 38 protected function setDefaultOptions() 39 { 40 $this->defaultOptions = []; 41 42 return $this; 43 } 24 * @param array $defaults 25 * @version 20171111 26 */ 27 public function __construct(array $defaults) 28 { 29 $this->options = []; 30 $this->defaults = apply_filters('fvcn_set_default_options', $defaults); 31 } 44 32 45 33 /** … … 51 39 public function getDefaultOptions() 52 40 { 53 return $this->default Options;41 return $this->defaults; 54 42 } 55 43 … … 63 51 public function getDefaultOption($key) 64 52 { 65 if (!isset($this->default Options[ $key ])) {53 if (!isset($this->defaults[ $key ])) { 66 54 return null; 67 55 } 68 56 69 return $this->default Options[ $key ];57 return $this->defaults[ $key ]; 70 58 } 71 59 … … 78 66 public function addOptions() 79 67 { 80 foreach ($this->getDefaultOptions() as $key =>$value) {68 foreach ($this->getDefaultOptions() as $key => $value) { 81 69 $this->addOption($key, $value); 82 70 } … … 125 113 * @version 20171103 126 114 */ 127 public function getOption($key, $default =null)115 public function getOption($key, $default = null) 128 116 { 129 117 if (isset($this->options[ $key ])) { 130 118 return $this->options[ $key ]; 131 119 } 132 133 120 if (null === $default) { 134 121 return $this->options[ $key ] = get_option($key, $this->getDefaultOption($key)); … … 146 133 public function deleteOptions() 147 134 { 148 foreach ($this->getDefaultOptions() as $key =>$value) {135 foreach ($this->getDefaultOptions() as $key => $value) { 149 136 $this->deleteOption($key); 150 137 } … … 167 154 return $this; 168 155 } 156 157 158 /** 159 * fvcnGetDefaultOptions() 160 * 161 * @version 20120710 162 * @return array 163 */ 164 public static function fvcnGetDefaultOptions() 165 { 166 return Container::getInstance()->getOptions()->getDefaultOptions(); 167 } 168 169 /** 170 * fvcnGetDefaultOption() 171 * 172 * @version 20120710 173 * @param string $key 174 * @return mixed 175 */ 176 public static function fvcnGetDefaultOption($key) 177 { 178 return Container::getInstance()->getOptions()->getDefaultOption($key); 179 } 180 181 /** 182 * fvcnGetOption() 183 * 184 * @version 20120710 185 * @param string $key 186 * @return mixed 187 */ 188 public static function fvcnGetOption($key) 189 { 190 return Container::getInstance()->getOptions()->getOption($key); 191 } 192 193 /** 194 * fvcnAddOptions() 195 * 196 * @version 20120710 197 */ 198 public static function fvcnAddOptions() 199 { 200 Container::getInstance()->getOptions()->addOptions(); 201 202 do_action('fvcn_add_options'); 203 } 204 205 /** 206 * fvcnDeleteOptions() 207 * 208 * @version 20120710 209 */ 210 public static function fvcnDeleteOptions() 211 { 212 Container::getInstance()->getOptions()->deleteOptions(); 213 214 do_action('fvcn_delete_options'); 215 } 169 216 } -
fv-community-news/trunk/src/Template/common-functions.php
r1763901 r1763902 1 1 <?php 2 2 3 /** 4 * fvcn-common-template.php 5 * 6 * Common Template 7 * 8 * @package FV Community News 9 * @subpackage Template 10 * @author Frank Verhoeven 11 */ 12 13 if (!defined('ABSPATH')) { 14 die('Direct access is not allowed!'); 15 } 16 3 use FvCommunityNews\Container; 4 use FvCommunityNews\Registry; 17 5 18 6 /** … … 20 8 * 21 9 * @version 20120322 22 * @uses fvcn_get_version()23 * @return void24 10 */ 25 11 function fvcn_version() … … 35 21 function fvcn_get_version() 36 22 { 37 return fvcn_get_option('_fvcn_version');23 return \FvCommunityNews\Options::fvcnGetOption('_fvcn_version'); 38 24 } 39 25 … … 41 27 * fvcn_head() 42 28 * 43 * @version 20120314 44 * @uses do_action() 45 * @return void 29 * @version 20171111 46 30 */ 47 31 function fvcn_head() 48 32 { 49 echo '<meta name="generator" content="FV Community News" />' . "\n"; 50 33 echo '<meta name="generator" content="FV Community News">' . "\n"; 51 34 do_action('fvcn_head'); 52 53 35 } 54 36 … … 57 39 * 58 40 * @version 20120713 59 * @uses fvcn_has_errors()60 * @uses $fvcn->errors61 * @return void62 41 */ 63 42 function fvcn_template_notices() … … 69 48 $errors = $messages = []; 70 49 71 foreach ( FvCommunityNews_Container::getInstance()->getWpError()->get_error_codes() as $code) {72 $severity = FvCommunityNews_Container::getInstance()->getWpError()->get_error_data($code);50 foreach (Container::getInstance()->getWpError()->get_error_codes() as $code) { 51 $severity = Container::getInstance()->getWpError()->get_error_data($code); 73 52 74 foreach ( FvCommunityNews_Container::getInstance()->getWpError()->get_error_messages($code) as $error) {53 foreach (Container::getInstance()->getWpError()->get_error_messages($code) as $error) { 75 54 if ('message' == $severity) { 76 55 $messages[] = $error; … … 101 80 102 81 /** 103 * is_ FvCommunityNews::getInstance()82 * is_fvcn() 104 83 * 105 84 * @version 20120622 … … 129 108 function fvcn_show_widget_thumbnail() 130 109 { 131 return FvCommunityNews_Registry::getInstance()->widgetShowThumbnail;110 return Registry::getInstance()->widgetShowThumbnail; 132 111 } 133 112 … … 140 119 function fvcn_show_widget_view_all() 141 120 { 142 return FvCommunityNews_Registry::getInstance()->widgetShowViewAll;121 return Registry::getInstance()->widgetShowViewAll; 143 122 } 144 -
fv-community-news/trunk/src/Template/options-functions.php
r1763901 r1763902 1 1 <?php 2 2 3 /** 4 * fvcn-core-options.php 5 * 6 * Options 7 * 8 * @package FV Community News 9 * @subpackage Options 10 * @author Frank Verhoeven 11 */ 12 13 if (!defined('ABSPATH')) { 14 die('Direct access is not allowed!'); 15 } 16 17 18 class FvCommunityNews_Options 19 { 20 /** 21 * @var array 22 */ 23 protected $_defaultOptions = []; 24 25 /** 26 * @var array 27 */ 28 protected $_options = []; 29 30 /** 31 * __construct() 32 * 33 * @version 20120710 34 * @return void 35 */ 36 public function __construct() 37 { 38 $this->_setDefaultOptions(); 39 } 40 41 /** 42 * _setDefaultOptions() 43 * 44 * @version 20120710 45 * @return FvCommunityNews_Options 46 */ 47 protected function _setDefaultOptions() 48 { 49 $this->_defaultOptions = apply_filters('fvcn_get_default_options', [ 50 '_fvcn_version' => FvCommunityNews::getInstance()->version, 51 52 '_fvcn_admin_moderation' => false, 53 '_fvcn_user_moderation' => true, 54 '_fvcn_mail_on_submission' => false, 55 '_fvcn_mail_on_moderation' => true, 56 '_fvcn_is_anonymous_allowed' => true, 57 58 '_fvcn_base_slug' => 'fv-community-news', 59 '_fvcn_post_slug' => 'post', 60 '_fvcn_post_tag_slug' => 'tag', 61 '_fvcn_post_archive_slug' => 'archive', 62 63 '_fvcn_post_form_author_name_label' => __('Author Name', 'fvcn'), 64 '_fvcn_post_form_author_email_label' => __('Author Email', 'fvcn'), 65 '_fvcn_post_form_title_label' => __('Title', 'fvcn'), 66 '_fvcn_post_form_link_label' => __('Link', 'fvcn'), 67 '_fvcn_post_form_link_required' => true, 68 '_fvcn_post_form_content_label' => __('Description', 'fvcn'), 69 '_fvcn_post_form_tags_label' => __('Tags', 'fvcn'), 70 '_fvcn_post_form_tags_required' => true, 71 '_fvcn_post_form_thumbnail_enabled' => true, 72 '_fvcn_post_form_thumbnail_label' => __('Thumbnail', 'fvcn'), 73 '_fvcn_post_form_thumbnail_required' => false, 74 75 '_fvcn_sync_key' => false, 76 77 '_fvcn_dashboard_rp_num' => 5 78 ]); 79 80 return $this; 81 } 82 83 /** 84 * getDefaultOptions() 85 * 86 * @version 20120710 87 * @return array 88 */ 89 public function getDefaultOptions() 90 { 91 return $this->_defaultOptions; 92 } 93 94 /** 95 * getDefaultOption() 96 * 97 * @version 20120716 98 * @param string $key 99 * @return mixed 100 */ 101 public function getDefaultOption($key) 102 { 103 if (!isset($this->_defaultOptions[ $key ])) { 104 return null; 105 } 106 107 return $this->_defaultOptions[ $key ]; 108 } 109 110 /** 111 * addOptions() 112 * 113 * @version 20120710 114 * @return FvCommunityNews_Options 115 */ 116 public function addOptions() 117 { 118 foreach ($this->getDefaultOptions() as $key=>$value) { 119 $this->addOption($key, $value); 120 } 121 122 return $this; 123 } 124 125 /** 126 * addOption() 127 * 128 * @version 20120710 129 * @param string $key 130 * @param mixed $value 131 * @return FvCommunityNews_Options 132 */ 133 public function addOption($key, $value) 134 { 135 add_option($key, $value); 136 $this->_options[ $key ] = $value; 137 138 return $this; 139 } 140 141 /** 142 * updateOption() 143 * 144 * @version 20120716 145 * @param string $key 146 * @param mixed $value 147 * @return FvCommunityNews_Options 148 */ 149 public function updateOption($key, $value) 150 { 151 update_option($key, $value); 152 $this->_options[ $key ] = $value; 153 154 return $this; 155 } 156 157 /** 158 * getOption() 159 * 160 * @version 20120716 161 * @param string $key 162 * @param mixed $default 163 * @return mixed 164 */ 165 public function getOption($key, $default=null) 166 { 167 if (isset($this->_options[ $key ])) { 168 return $this->_options[ $key ]; 169 } 170 171 if (null === $default) { 172 return $this->_options[ $key ] = get_option($key, $this->getDefaultOption($key)); 173 } 174 175 return $this->_options[ $key ] = get_option($key, $default); 176 } 177 178 /** 179 * deleteOptions() 180 * 181 * @version 20120710 182 * @return FvCommunityNews_Options 183 */ 184 public function deleteOptions() 185 { 186 foreach ($this->getDefaultOptions() as $key=>$value) { 187 $this->deleteOption($key); 188 } 189 190 return $this; 191 } 192 193 /** 194 * deleteOption() 195 * 196 * @version 20120710 197 * @param string $key 198 * @return FvCommunityNews_Options 199 */ 200 public function deleteOption($key) 201 { 202 delete_option($key); 203 unset($this->_options[ $key ]); 204 205 return $this; 206 } 207 } 208 209 210 211 /** 212 * fvcn_get_default_options() 213 * 214 * @version 20120710 215 * @return array 216 */ 217 function fvcn_get_default_options() 218 { 219 return FvCommunityNews_Container::getInstance()->getOptions()->getDefaultOptions(); 220 } 221 222 /** 223 * fvcn_get_default_option() 224 * 225 * @version 20120710 226 * @param string $key 227 * @return mixed 228 */ 229 function fvcn_get_default_option($key) 230 { 231 return FvCommunityNews_Container::getInstance()->getOptions()->getDefaultOption($key); 232 } 233 234 /** 235 * fvcn_get_option() 236 * 237 * @version 20120710 238 * @param string $key 239 * @return mixed 240 */ 241 function fvcn_get_option($key) 242 { 243 return FvCommunityNews_Container::getInstance()->getOptions()->getOption($key); 244 } 245 246 /** 247 * fvcn_add_options() 248 * 249 * @version 20120710 250 * @return void 251 */ 252 function fvcn_add_options() 253 { 254 FvCommunityNews_Container::getInstance()->getOptions()->addOptions(); 255 256 do_action('fvcn_add_options'); 257 } 258 259 /** 260 * fvcn_delete_options() 261 * 262 * @version 20120710 263 * @return void 264 */ 265 function fvcn_delete_options() 266 { 267 FvCommunityNews_Container::getInstance()->getOptions()->deleteOptions(); 268 269 do_action('fvcn_delete_options'); 270 } 271 3 use FvCommunityNews\Options; 272 4 273 5 /** 274 6 * fvcn_admin_moderation() 275 7 * 8 * @return bool 276 9 * @version 20120524 277 * @uses fvcn_get_option()278 * @uses apply_filters()279 * @return bool280 10 */ 281 11 function fvcn_admin_moderation() 282 12 { 283 return apply_filters('fvcn_admin_moderation', (bool) fvcn_get_option('_fvcn_admin_moderation'));13 return apply_filters('fvcn_admin_moderation', (bool) Options::fvcnGetOption('_fvcn_admin_moderation')); 284 14 } 285 286 15 287 16 /** 288 17 * fvcn_user_moderation() 289 18 * 19 * @return bool 290 20 * @version 20120524 291 * @uses fvcn_get_option()292 * @uses apply_filters()293 * @return bool294 21 */ 295 22 function fvcn_user_moderation() 296 23 { 297 return apply_filters('fvcn_user_moderation', (bool) fvcn_get_option('_fvcn_user_moderation'));24 return apply_filters('fvcn_user_moderation', (bool) Options::fvcnGetOption('_fvcn_user_moderation')); 298 25 } 299 300 26 301 27 /** 302 28 * fvcn_mail_on_submission() 303 29 * 30 * @return bool 304 31 * @version 20120524 305 * @uses fvcn_get_option()306 * @uses apply_filters()307 * @return bool308 32 */ 309 33 function fvcn_mail_on_submission() 310 34 { 311 return apply_filters('fvcn_mail_on_submission', (bool) fvcn_get_option('_fvcn_mail_on_submission'));35 return apply_filters('fvcn_mail_on_submission', (bool) Options::fvcnGetOption('_fvcn_mail_on_submission')); 312 36 } 313 314 37 315 38 /** 316 39 * fvcn_mail_on_moderation() 317 40 * 41 * @return bool 318 42 * @version 20120524 319 * @uses fvcn_get_option()320 * @uses apply_filters()321 * @return bool322 43 */ 323 44 function fvcn_mail_on_moderation() 324 45 { 325 return apply_filters('fvcn_mail_on_moderation', (bool) fvcn_get_option('_fvcn_mail_on_moderation'));46 return apply_filters('fvcn_mail_on_moderation', (bool) Options::fvcnGetOption('_fvcn_mail_on_moderation')); 326 47 } 327 328 48 329 49 /** 330 50 * fvcn_is_anonymous_allowed() 331 51 * 52 * @return bool 332 53 * @version 20120524 333 * @uses fvcn_get_option()334 * @uses apply_filters()335 * @return bool336 54 */ 337 55 function fvcn_is_anonymous_allowed() 338 56 { 339 return apply_filters('fvcn_is_anonymous_allowed', (bool) fvcn_get_option('_fvcn_is_anonymous_allowed'));57 return apply_filters('fvcn_is_anonymous_allowed', (bool) Options::fvcnGetOption('_fvcn_is_anonymous_allowed')); 340 58 } 341 -
fv-community-news/trunk/src/Template/post-functions.php
r1763901 r1763902 1 1 <?php 2 2 3 /** 4 * fvcn-post-template.php 5 * 6 * Post Template 7 * 8 * @package FV Community News 9 * @subpackage Template 10 * @author Frank Verhoeven 11 */ 12 13 if (!defined('ABSPATH')) { 14 exit; 15 } 16 17 /** 18 * fvcn_post_type() 19 * 20 * @version 20120229 21 * @return void 22 */ 23 function fvcn_post_type() 24 { 25 echo fvcn_get_post_type(); 26 } 27 28 /** 29 * fvcn_get_post_type() 30 * 31 * @version 20120229 32 * @return string 33 */ 34 function fvcn_get_post_type() 35 { 36 return apply_filters('fvcn_get_post_type', FvCommunityNews_Registry::get('postType')); 37 } 3 use FvCommunityNews\Container; 4 use FvCommunityNews\Options; 5 use FvCommunityNews\Post\PostType; 6 use FvCommunityNews\Registry; 38 7 39 8 … … 42 11 * 43 12 * @version 20120321 44 * @return void45 13 */ 46 14 function fvcn_post_slug() … … 57 25 function fvcn_get_post_slug() 58 26 { 59 return apply_filters('fvcn_get_post_slug', FvCommunityNews_Registry::get('postSlug'));27 return apply_filters('fvcn_get_post_slug', Registry::get('postSlug')); 60 28 } 61 29 … … 71 39 { 72 40 $defaults = [ 73 'post_type' => fvcn_get_post_type(),74 'post_status' => fvcn_get_public_post_status(),41 'post_type' => PostType::POST_TYPE_KEY, 42 'post_status' => PostType::STATUS_PUBLISH, 75 43 'posts_per_page'=> 15, 76 44 'order' => 'DESC' … … 80 48 $options = apply_filters('fvcn_has_posts_query', $options); 81 49 82 FvCommunityNews_Registry::set('wpQuery', new WP_Query($options));83 84 return apply_filters('fvcn_has_posts', FvCommunityNews_Registry::get('wpQuery')->have_posts(), FvCommunityNews_Registry::get('wpQuery'));50 Registry::set('wpQuery', new WP_Query($options)); 51 52 return apply_filters('fvcn_has_posts', Registry::get('wpQuery')->have_posts(), Registry::get('wpQuery')); 85 53 } 86 54 … … 94 62 function fvcn_posts() 95 63 { 96 $have_posts = FvCommunityNews_Registry::get('wpQuery')->have_posts();64 $have_posts = Registry::get('wpQuery')->have_posts(); 97 65 98 66 if (empty($have_posts)) { … … 112 80 function fvcn_the_post() 113 81 { 114 return FvCommunityNews_Registry::get('wpQuery')->the_post();82 return Registry::get('wpQuery')->the_post(); 115 83 } 116 84 … … 121 89 * @version 20120305 122 90 * @param int $postId 123 * @return void 124 */ 125 function fvcn_post_id($postId=0) 91 */ 92 function fvcn_post_id($postId = 0) 126 93 { 127 94 echo fvcn_get_post_id($postId); … … 135 102 * @return int 136 103 */ 137 function fvcn_get_post_id($postId =0)104 function fvcn_get_post_id($postId = 0) 138 105 { 139 106 global $wp_query, $post; … … 142 109 $id = $postId; 143 110 144 } elseif (!empty( FvCommunityNews_Registry::get('wpQuery')->in_the_loop) && isset(FvCommunityNews_Registry::get('wpQuery')->post->ID)) {145 $id = FvCommunityNews_Registry::get('wpQuery')->post->ID;111 } elseif (!empty(Registry::get('wpQuery')->in_the_loop) && isset(Registry::get('wpQuery')->post->ID)) { 112 $id = Registry::get('wpQuery')->post->ID; 146 113 147 114 } elseif (fvcn_is_single_post() && isset($wp_query->post->ID)) { … … 166 133 * @return object 167 134 */ 168 function fvcn_get_post($postId =0)135 function fvcn_get_post($postId = 0) 169 136 { 170 137 $id = fvcn_get_post_id($postId); … … 176 143 $post = get_post($id, OBJECT); 177 144 178 if (!$post || $post->post_type != fvcn_get_post_type()) {145 if (!$post || $post->post_type != PostType::POST_TYPE_KEY) { 179 146 return null; 180 147 } … … 189 156 * @version 20120305 190 157 * @param int $postId 191 * @return void 192 */ 193 function fvcn_post_permalink($postId=0) 158 */ 159 function fvcn_post_permalink($postId = 0) 194 160 { 195 161 echo fvcn_get_post_permalink($postId); … … 204 170 * @return string 205 171 */ 206 function fvcn_get_post_permalink($postId =0, $redirect='')172 function fvcn_get_post_permalink($postId = 0, $redirect='') 207 173 { 208 174 $id = fvcn_get_post_id($postId); … … 225 191 * @return bool 226 192 */ 227 function fvcn_has_post_link($postId =0)193 function fvcn_has_post_link($postId = 0) 228 194 { 229 195 $link = fvcn_get_post_link($postId); … … 238 204 * @version 20120311 239 205 * @param int $postId 240 * @return void 241 */ 242 function fvcn_post_link($postId=0) 206 */ 207 function fvcn_post_link($postId = 0) 243 208 { 244 209 echo fvcn_get_post_link($postId); … … 252 217 * @return string 253 218 */ 254 function fvcn_get_post_link($postId =0)255 { 256 $id = fvcn_get_post_id($postId); 257 258 $link = esc_url( get_post_meta($id, '_fvcn_post_url', true));219 function fvcn_get_post_link($postId = 0) 220 { 221 $id = fvcn_get_post_id($postId); 222 223 $link = esc_url(get_post_meta($id, '_fvcn_post_url', true)); 259 224 260 225 return apply_filters('fvcn_get_post_link', $link, $id); … … 267 232 * @version 20120305 268 233 * @param int $postId 269 * @return void 270 */ 271 function fvcn_post_title($postId=0) 234 */ 235 function fvcn_post_title($postId = 0) 272 236 { 273 237 echo fvcn_get_post_title($postId); … … 281 245 * @return string 282 246 */ 283 function fvcn_get_post_title($postId =0)247 function fvcn_get_post_title($postId = 0) 284 248 { 285 249 $id = fvcn_get_post_id($postId); … … 294 258 * @version 20120305 295 259 * @param int $postId 296 * @return void 297 */ 298 function fvcn_post_content($postId=0) 260 */ 261 function fvcn_post_content($postId = 0) 299 262 { 300 263 echo fvcn_get_post_content($postId); … … 308 271 * @return string 309 272 */ 310 function fvcn_get_post_content($postId =0)273 function fvcn_get_post_content($postId = 0) 311 274 { 312 275 $id = fvcn_get_post_id($postId); … … 328 291 * @param int $postId 329 292 * @param int $length 330 * @return void 331 */ 332 function fvcn_post_excerpt($postId=0, $length=100) { 293 */ 294 function fvcn_post_excerpt($postId = 0, $length=100) { 333 295 echo fvcn_get_post_excerpt($postId, $length); 334 296 } … … 342 304 * @return string 343 305 */ 344 function fvcn_get_post_excerpt($postId =0, $length=100) {306 function fvcn_get_post_excerpt($postId = 0, $length=100) { 345 307 $id = fvcn_get_post_id($postId); 346 308 $length = abs((int)$length); … … 356 318 } 357 319 358 $excerpt = trim( strip_tags($excerpt));320 $excerpt = trim(strip_tags($excerpt)); 359 321 360 322 if (!empty($length) && strlen($excerpt) > $length) { … … 382 344 * @param int $postId 383 345 * @param string $format 384 * @return void 385 */ 386 function fvcn_post_date($postId=0, $format='') { 346 */ 347 function fvcn_post_date($postId = 0, $format='') { 387 348 echo fvcn_get_post_date($postId, $format); 388 349 } … … 396 357 * @return string 397 358 */ 398 function fvcn_get_post_date($postId =0, $format='') {359 function fvcn_get_post_date($postId = 0, $format='') { 399 360 $id = fvcn_get_post_id($postId); 400 361 … … 416 377 * @param string $format 417 378 * @param bool $gmt 418 * @return void 419 */ 420 function fvcn_post_time($postId=0, $format='', $gmt=false) { 379 */ 380 function fvcn_post_time($postId = 0, $format='', $gmt=false) { 421 381 echo fvcn_get_post_time($postId, $format, $gmt); 422 382 } … … 431 391 * @return string 432 392 */ 433 function fvcn_get_post_time($postId =0, $format='', $gmt=false) {393 function fvcn_get_post_time($postId = 0, $format='', $gmt=false) { 434 394 $id = fvcn_get_post_id($postId); 435 395 … … 457 417 * @return bool 458 418 */ 459 function fvcn_has_post_thumbnail($postId =0)419 function fvcn_has_post_thumbnail($postId = 0) 460 420 { 461 421 $id = fvcn_get_post_id($postId); 462 422 463 423 // Double thumbnail display fix. 464 if ('the_content' != current_filter() || false === FvCommunityNews_Registry::get('nativeThumbnailSupport')) {424 if ('the_content' != current_filter() || false === Registry::get('nativeThumbnailSupport')) { 465 425 return has_post_thumbnail($id); 466 426 } else { … … 477 437 * @param string|array $size 478 438 * @param string|array $attributes 479 * @return void 480 */ 481 function fvcn_post_thumbnail($postId=0, $size='thumbnail', $attributes= []) { 439 */ 440 function fvcn_post_thumbnail($postId = 0, $size='thumbnail', $attributes= []) { 482 441 echo fvcn_get_post_thumbnail($postId, $size, $attributes); 483 442 } … … 492 451 * @return string 493 452 */ 494 function fvcn_get_post_thumbnail($postId =0, $size='thumbnail', $attributes= []) {453 function fvcn_get_post_thumbnail($postId = 0, $size='thumbnail', $attributes= []) { 495 454 $id = fvcn_get_post_id($postId); 496 455 … … 504 463 * @version 20120321 505 464 * @param int $postId 506 * @return void 507 */ 508 function fvcn_post_rating($postId=0) 465 */ 466 function fvcn_post_rating($postId = 0) 509 467 { 510 468 echo fvcn_get_post_rating($postId); … … 518 476 * @return string 519 477 */ 520 function fvcn_get_post_rating($postId =0)478 function fvcn_get_post_rating($postId = 0) 521 479 { 522 480 $id = fvcn_get_post_id($postId); … … 537 495 * @version 20120321 538 496 * @param int $postId 539 * @return void 540 */ 541 function fvcn_post_rating_increment_link($postId=0) 497 */ 498 function fvcn_post_rating_increment_link($postId = 0) 542 499 { 543 500 echo fvcn_get_post_rating_increment_link($postId); … … 551 508 * @return string 552 509 */ 553 function fvcn_get_post_rating_increment_link($postId =0)510 function fvcn_get_post_rating_increment_link($postId = 0) 554 511 { 555 512 $id = fvcn_get_post_id($postId); … … 572 529 * @version 20120321 573 530 * @param int $postId 574 * @return void 575 */ 576 function fvcn_post_rating_decrement_link($postId=0) 531 */ 532 function fvcn_post_rating_decrement_link($postId = 0) 577 533 { 578 534 echo fvcn_get_post_rating_decrement_link($postId); … … 586 542 * @return string 587 543 */ 588 function fvcn_get_post_rating_decrement_link($postId =0)544 function fvcn_get_post_rating_decrement_link($postId = 0) 589 545 { 590 546 $id = fvcn_get_post_id($postId); … … 609 565 * @return bool 610 566 */ 611 function fvcn_is_post_rated_by_current_user($postId =0)567 function fvcn_is_post_rated_by_current_user($postId = 0) 612 568 { 613 569 $id = fvcn_get_post_id($postId); … … 622 578 * @version 20120622 623 579 * @param int $postId 624 * @return int 625 */ 626 function fvcn_post_views($postId=0) 580 */ 581 function fvcn_post_views($postId = 0) 627 582 { 628 583 echo fvcn_get_post_views($postId); … … 636 591 * @return int 637 592 */ 638 function fvcn_get_post_views($postId =0)593 function fvcn_get_post_views($postId = 0) 639 594 { 640 595 $postId = fvcn_get_post_id($postId); … … 655 610 * @version 20120306 656 611 * @param int $postId 657 * @return void 658 */ 659 function fvcn_post_status($postId=0) 612 */ 613 function fvcn_post_status($postId = 0) 660 614 { 661 615 echo fvcn_get_post_status($postId); … … 669 623 * @return string 670 624 */ 671 function fvcn_get_post_status($postId =0)625 function fvcn_get_post_status($postId = 0) 672 626 { 673 627 $id = fvcn_get_post_id($postId); … … 681 635 * 682 636 * @version 20120321 683 * @return void684 637 */ 685 638 function fvcn_post_archive_link() … … 696 649 function fvcn_get_post_archive_link() 697 650 { 698 $link = get_post_type_archive_link( fvcn_get_post_type());651 $link = get_post_type_archive_link(PostType::POST_TYPE_KEY); 699 652 700 653 return apply_filters('fvcn_get_post_archive_link', $link); … … 709 662 * @return bool 710 663 */ 711 function fvcn_is_post($postId =0)664 function fvcn_is_post($postId = 0) 712 665 { 713 666 $is_post = false; 714 667 715 if (!empty($postId) && fvcn_get_post_type()== get_post_type($postId)) {668 if (!empty($postId) && PostType::POST_TYPE_KEY == get_post_type($postId)) { 716 669 $is_post = true; 717 670 } … … 728 681 * @return bool 729 682 */ 730 function fvcn_is_post_published($postId =0)731 { 732 return fvcn_get_public_post_status() == fvcn_get_post_status(fvcn_get_post_id($postId));683 function fvcn_is_post_published($postId = 0) 684 { 685 return PostType::STATUS_PUBLISH == fvcn_get_post_status(fvcn_get_post_id($postId)); 733 686 } 734 687 … … 741 694 * @return bool 742 695 */ 743 function fvcn_is_post_pending($postId =0)744 { 745 return fvcn_get_pending_post_status() == fvcn_get_post_status(fvcn_get_post_id($postId));696 function fvcn_is_post_pending($postId = 0) 697 { 698 return PostType::STATUS_PENDING == fvcn_get_post_status(fvcn_get_post_id($postId)); 746 699 } 747 700 … … 754 707 * @return bool 755 708 */ 756 function fvcn_is_post_trash($postId =0)757 { 758 return fvcn_get_trash_post_status() == fvcn_get_post_status(fvcn_get_post_id($postId));709 function fvcn_is_post_trash($postId = 0) 710 { 711 return PostType::STATUS_TRASH == fvcn_get_post_status(fvcn_get_post_id($postId)); 759 712 } 760 713 … … 767 720 * @return bool 768 721 */ 769 function fvcn_is_post_spam($postId =0)770 { 771 return fvcn_get_spam_post_status() == fvcn_get_post_status(fvcn_get_post_id($postId));722 function fvcn_is_post_spam($postId = 0) 723 { 724 return PostType::STATUS_SPAM == fvcn_get_post_status(fvcn_get_post_id($postId)); 772 725 } 773 726 … … 780 733 * @return bool 781 734 */ 782 function fvcn_is_post_private($postId =0)783 { 784 return fvcn_get_private_post_status() == fvcn_get_post_status(fvcn_get_post_id($postId));735 function fvcn_is_post_private($postId = 0) 736 { 737 return PostType::STATUS_PRIVATE == fvcn_get_post_status(fvcn_get_post_id($postId)); 785 738 } 786 739 … … 793 746 * @return bool 794 747 */ 795 function fvcn_is_post_anonymous($postId =0)748 function fvcn_is_post_anonymous($postId = 0) 796 749 { 797 750 $id = fvcn_get_post_id($postId); … … 821 774 $retval = false; 822 775 823 if (is_singular( fvcn_get_post_type())) {776 if (is_singular(PostType::POST_TYPE_KEY)) { 824 777 $retval = true; 825 778 } … … 839 792 $retval = false; 840 793 841 if (is_post_type_archive( fvcn_get_post_type())) {794 if (is_post_type_archive(PostType::POST_TYPE_KEY)) { 842 795 $retval = true; 843 796 } … … 857 810 $retval = false; 858 811 859 if (is_tax( fvcn_get_post_tag_id())) {812 if (is_tax(fvcn_get_post_tag_id())) { 860 813 $retval = true; 861 814 } … … 870 823 * @version 20120306 871 824 * @param int $postId 872 * @return void 873 */ 874 function fvcn_post_author($postId=0) 825 */ 826 function fvcn_post_author($postId = 0) 875 827 { 876 828 echo fvcn_get_post_author($postId); … … 884 836 * @return string 885 837 */ 886 function fvcn_get_post_author($postId =0)838 function fvcn_get_post_author($postId = 0) 887 839 { 888 840 $id = fvcn_get_post_id($postId); … … 903 855 * @version 20120306 904 856 * @param int $postId 905 * @return void 906 */ 907 function fvcn_post_author_id($postId=0) 857 */ 858 function fvcn_post_author_id($postId = 0) 908 859 { 909 860 echo fvcn_get_post_author_id($postId); … … 917 868 * @return string 918 869 */ 919 function fvcn_get_post_author_id($postId =0)870 function fvcn_get_post_author_id($postId = 0) 920 871 { 921 872 $id = fvcn_get_post_id($postId); … … 931 882 * @version 20120306 932 883 * @param int $postId 933 * @return void 934 */ 935 function fvcn_post_author_display_name($postId=0) 884 */ 885 function fvcn_post_author_display_name($postId = 0) 936 886 { 937 887 echo fvcn_get_post_author_display_name($postId); … … 945 895 * @return string 946 896 */ 947 function fvcn_get_post_author_display_name($postId =0)897 function fvcn_get_post_author_display_name($postId = 0) 948 898 { 949 899 $id = fvcn_get_post_id($postId); … … 964 914 * @version 20120306 965 915 * @param int $postId 966 * @return void 967 */ 968 function fvcn_post_author_email($postId=0) 916 */ 917 function fvcn_post_author_email($postId = 0) 969 918 { 970 919 echo fvcn_get_post_author_email($postId); … … 978 927 * @return string 979 928 */ 980 function fvcn_get_post_author_email($postId =0)929 function fvcn_get_post_author_email($postId = 0) 981 930 { 982 931 $id = fvcn_get_post_id($postId); … … 998 947 * @param int $postId 999 948 * @param int $size 1000 * @return void 1001 */ 1002 function fvcn_post_author_avatar($postId=0, $size=40) 949 */ 950 function fvcn_post_author_avatar($postId = 0, $size=40) 1003 951 { 1004 952 echo fvcn_get_post_author_avatar($postId, $size); … … 1013 961 * @return string 1014 962 */ 1015 function fvcn_get_post_author_avatar($postId =0, $size=40)963 function fvcn_get_post_author_avatar($postId = 0, $size=40) 1016 964 { 1017 965 $avatar = get_avatar(fvcn_get_post_author_email($postId), $size); … … 1026 974 * @version 20120306 1027 975 * @param int $postId 1028 * @return void 1029 */ 1030 function fvcn_post_author_website($postId=0) 976 */ 977 function fvcn_post_author_website($postId = 0) 1031 978 { 1032 979 echo fvcn_get_post_author_website($postId); … … 1040 987 * @return string 1041 988 */ 1042 function fvcn_get_post_author_website($postId =0)989 function fvcn_get_post_author_website($postId = 0) 1043 990 { 1044 991 $id = fvcn_get_post_id($postId); … … 1059 1006 * @version 20120305 1060 1007 * @param int $postId 1061 * @return void 1062 */ 1063 function fvcn_post_author_link($postId=0) 1008 */ 1009 function fvcn_post_author_link($postId = 0) 1064 1010 { 1065 1011 echo fvcn_get_post_author_link($postId); … … 1073 1019 * @return string 1074 1020 */ 1075 function fvcn_get_post_author_link($postId =0)1021 function fvcn_get_post_author_link($postId = 0) 1076 1022 { 1077 1023 $id = fvcn_get_post_id($postId); … … 1092 1038 * @version 20120311 1093 1039 * @param int $postId 1094 * @return void 1095 */ 1096 function fvcn_post_author_ip($postId=0) 1040 */ 1041 function fvcn_post_author_ip($postId = 0) 1097 1042 { 1098 1043 echo fvcn_get_post_author_ip($postId); … … 1106 1051 * @return string 1107 1052 */ 1108 function fvcn_get_post_author_ip($postId =0)1053 function fvcn_get_post_author_ip($postId = 0) 1109 1054 { 1110 1055 $id = fvcn_get_post_id($postId); … … 1121 1066 * @version 20120322 1122 1067 * @param int $postId 1123 * @return void 1124 */ 1125 function fvcn_post_author_ua($postId=0) 1068 */ 1069 function fvcn_post_author_ua($postId = 0) 1126 1070 { 1127 1071 echo fvcn_get_post_author_ua($postId); … … 1135 1079 * @return string 1136 1080 */ 1137 function fvcn_get_post_author_ua($postId =0)1081 function fvcn_get_post_author_ua($postId = 0) 1138 1082 { 1139 1083 $id = fvcn_get_post_id($postId); … … 1149 1093 * 1150 1094 * @version 20120229 1151 * @return void1152 1095 */ 1153 1096 function fvcn_post_tag_id() … … 1159 1102 * fvcn_get_post_tag_id() 1160 1103 * 1104 * @return string 1105 * @version 20171111 1106 */ 1107 function fvcn_get_post_tag_id() 1108 { 1109 return PostType::TAG_TYPE_KEY; 1110 } 1111 1112 1113 /** 1114 * fvcn_post_tag_slug() 1115 * 1116 * @version 20120325 1117 */ 1118 function fvcn_post_tag_slug() 1119 { 1120 echo fvcn_get_post_tag_slug(); 1121 } 1122 1123 /** 1124 * fvcn_get_post_tag_slug() 1125 * 1161 1126 * @version 20120710 1162 1127 * @return string 1163 1128 */ 1164 function fvcn_get_post_tag_id()1165 {1166 return apply_filters('fvcn_get_post_tag_id', FvCommunityNews_Registry::get('postTagId'));1167 }1168 1169 1170 /**1171 * fvcn_post_tag_slug()1172 *1173 * @version 201203251174 * @return void1175 */1176 function fvcn_post_tag_slug()1177 {1178 echo fvcn_get_post_tag_slug();1179 }1180 1181 /**1182 * fvcn_get_post_tag_slug()1183 *1184 * @version 201207101185 * @return string1186 */1187 1129 function fvcn_get_post_tag_slug() 1188 1130 { 1189 return apply_filters('fvcn_get_post_tag_slug', FvCommunityNews_Registry::get('postTagSlug'));1131 return apply_filters('fvcn_get_post_tag_slug', Registry::get('postTagSlug')); 1190 1132 } 1191 1133 … … 1197 1139 * @param int $postId 1198 1140 * @param string|array $args 1199 * @return void 1200 */ 1201 function fvcn_post_tag_list($postId=0, $args='') 1141 */ 1142 function fvcn_post_tag_list($postId = 0, $args='') 1202 1143 { 1203 1144 echo fvcn_get_post_tag_list($postId, $args); … … 1212 1153 * @return string 1213 1154 */ 1214 function fvcn_get_post_tag_list($postId =0, $args='')1155 function fvcn_get_post_tag_list($postId = 0, $args='') 1215 1156 { 1216 1157 $id = fvcn_get_post_id($postId); … … 1236 1177 * 1237 1178 * @version 20120307 1238 * @return void1239 1179 */ 1240 1180 function fvcn_post_form_fields() … … 1244 1184 <input type="hidden" name="fvcn_post_form_action" id="fvcn_post_form_action" value="fvcn-new-post" /> 1245 1185 <?php wp_nonce_field('fvcn-new-post', 'fvcn_post_form_nonce'); ?> 1246 <?php $value = base64_encode( time()); ?>1186 <?php $value = base64_encode(time()); ?> 1247 1187 <input type="hidden" name="fvcn_post_form_time_key" id="fvcn_post_form_time_key" value="<?php echo $value; ?>" /> 1248 1188 … … 1256 1196 * @version 20120706 1257 1197 * @param string $field 1258 * @return void1259 1198 */ 1260 1199 function fvcn_post_form_field_error($field) 1261 1200 { 1262 $errors = FvCommunityNews_Container::getInstance()->getWpError()->get_error_messages($field);1201 $errors = Container::getInstance()->getWpError()->get_error_messages($field); 1263 1202 1264 1203 if (empty($errors)) { … … 1280 1219 * 1281 1220 * @version 20120306 1282 * @return void1283 1221 */ 1284 1222 function fvcn_post_form_author_name_label() … … 1295 1233 function fvcn_get_post_form_author_name_label() 1296 1234 { 1297 $label = esc_attr( fvcn_get_option('_fvcn_post_form_author_name_label'));1235 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_author_name_label')); 1298 1236 1299 1237 return apply_filters('fvcn_get_post_form_author_name_label', $label); … … 1304 1242 * 1305 1243 * @version 20120306 1306 * @return void1307 1244 */ 1308 1245 function fvcn_post_form_author_name() … … 1333 1270 * 1334 1271 * @version 20120306 1335 * @return void1336 1272 */ 1337 1273 function fvcn_post_form_author_email_label() … … 1348 1284 function fvcn_get_post_form_author_email_label() 1349 1285 { 1350 $label = esc_attr( fvcn_get_option('_fvcn_post_form_author_email_label'));1286 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_author_email_label')); 1351 1287 1352 1288 return apply_filters('fvcn_get_post_form_author_email_label', $label); … … 1357 1293 * 1358 1294 * @version 20120306 1359 * @return void1360 1295 */ 1361 1296 function fvcn_post_form_author_email() … … 1386 1321 * 1387 1322 * @version 20120306 1388 * @return void1389 1323 */ 1390 1324 function fvcn_post_form_title_label() … … 1401 1335 function fvcn_get_post_form_title_label() 1402 1336 { 1403 $label = esc_attr( fvcn_get_option('_fvcn_post_form_title_label'));1337 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_title_label')); 1404 1338 1405 1339 return apply_filters('fvcn_get_post_form_title_label', $label); … … 1410 1344 * 1411 1345 * @version 20120306 1412 * @return void1413 1346 */ 1414 1347 function fvcn_post_form_title() … … 1439 1372 * 1440 1373 * @version 20120307 1441 * @return void1442 1374 */ 1443 1375 function fvcn_post_form_link_label() … … 1454 1386 function fvcn_get_post_form_link_label() 1455 1387 { 1456 $label = esc_attr( fvcn_get_option('_fvcn_post_form_link_label'));1388 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_link_label')); 1457 1389 1458 1390 return apply_filters('fvcn_get_post_form_link_label', $label); … … 1463 1395 * 1464 1396 * @version 20120307 1465 * @return void1466 1397 */ 1467 1398 function fvcn_post_form_link() … … 1495 1426 function fvcn_is_post_form_link_required() 1496 1427 { 1497 return apply_filters('fvcn_is_post_form_link_required', (bool) fvcn_get_option('_fvcn_post_form_link_required'));1428 return apply_filters('fvcn_is_post_form_link_required', (bool) Options::fvcnGetOption('_fvcn_post_form_link_required')); 1498 1429 } 1499 1430 … … 1503 1434 * 1504 1435 * @version 20120306 1505 * @return void1506 1436 */ 1507 1437 function fvcn_post_form_content_label() … … 1518 1448 function fvcn_get_post_form_content_label() 1519 1449 { 1520 $label = esc_attr( fvcn_get_option('_fvcn_post_form_content_label'));1450 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_content_label')); 1521 1451 1522 1452 return apply_filters('fvcn_get_post_form_content_label', $label); … … 1527 1457 * 1528 1458 * @version 20120306 1529 * @return void1530 1459 */ 1531 1460 function fvcn_post_form_content() … … 1556 1485 * 1557 1486 * @version 20120306 1558 * @return void1559 1487 */ 1560 1488 function fvcn_post_form_tags_label() … … 1571 1499 function fvcn_get_post_form_tags_label() 1572 1500 { 1573 $label = esc_attr( fvcn_get_option('_fvcn_post_form_tags_label'));1501 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_tags_label')); 1574 1502 1575 1503 return apply_filters('fvcn_get_post_form_tags_label', $label); … … 1580 1508 * 1581 1509 * @version 20120306 1582 * @return void1583 1510 */ 1584 1511 function fvcn_post_form_tags() … … 1612 1539 function fvcn_is_post_form_tags_required() 1613 1540 { 1614 return apply_filters('fvcn_is_post_form_tags_required', (bool) fvcn_get_option('_fvcn_post_form_tags_required'));1541 return apply_filters('fvcn_is_post_form_tags_required', (bool) Options::fvcnGetOption('_fvcn_post_form_tags_required')); 1615 1542 } 1616 1543 … … 1620 1547 * 1621 1548 * @version 20120306 1622 * @return void1623 1549 */ 1624 1550 function fvcn_post_form_thumbnail_label() … … 1635 1561 function fvcn_get_post_form_thumbnail_label() 1636 1562 { 1637 $label = esc_attr( fvcn_get_option('_fvcn_post_form_thumbnail_label'));1563 $label = esc_attr(Options::fvcnGetOption('_fvcn_post_form_thumbnail_label')); 1638 1564 1639 1565 return apply_filters('fvcn_get_post_form_thumbnail_label', $label); … … 1648 1574 function fvcn_is_post_form_thumbnail_enabled() 1649 1575 { 1650 return apply_filters('fvcn_is_post_form_thumbnail_enabled', (bool) fvcn_get_option('_fvcn_post_form_thumbnail_enabled'));1576 return apply_filters('fvcn_is_post_form_thumbnail_enabled', (bool) Options::fvcnGetOption('_fvcn_post_form_thumbnail_enabled')); 1651 1577 } 1652 1578 … … 1659 1585 function fvcn_is_post_form_thumbnail_required() 1660 1586 { 1661 return apply_filters('fvcn_is_post_form_thumbnail_required', (bool) fvcn_get_option('_fvcn_post_form_thumbnail_required'));1587 return apply_filters('fvcn_is_post_form_thumbnail_required', (bool) Options::fvcnGetOption('_fvcn_post_form_thumbnail_required')); 1662 1588 } 1663 1589 … … 1690 1616 } 1691 1617 1692 return fvcn_get_public_post_status()== fvcn_get_post_status($_GET['fvcn_added']);1693 } 1618 return PostType::STATUS_PUBLISH == fvcn_get_post_status($_GET['fvcn_added']); 1619 } -
fv-community-news/trunk/src/Template/tag-functions.php
r1763901 r1763902 1 1 <?php 2 3 /**4 * fvcn-tag-template.php5 *6 * Tag Template7 *8 * @package FV Community News9 * @subpackage Template10 * @author Frank Verhoeven11 */12 13 if (!defined('ABSPATH')) {14 exit;15 }16 17 2 18 3 /** … … 21 6 * @version 20120716 22 7 * @param string|array $args 23 * @return void24 8 */ 25 9 function fvcn_tag_cloud($args='') 26 10 { 27 $default = ['taxonomy' =>fvcn_get_post_tag_id()];11 $default = ['taxonomy' => fvcn_get_post_tag_id()]; 28 12 $args = wp_parse_args($args, $default); 29 13 30 14 wp_tag_cloud($args); 31 15 } 32 -
fv-community-news/trunk/src/Template/user-functions.php
r1763901 r1763902 1 1 <?php 2 2 3 use FvCommunityNews\Post\PostType; 4 3 5 /** 4 * fvcn -user-template.php6 * fvcn_is_anonymous() 5 7 * 6 * User Template 8 * @version 20120229 9 * @return bool 10 */ 11 function fvcn_is_anonymous() { 12 if (!is_user_logged_in()) { 13 $is_anonymous = true; 14 } else { 15 $is_anonymous = false; 16 } 17 18 return apply_filters('fvcn_is_anonymous', $is_anonymous); 19 } 20 21 /** 22 * fvcn_get_current_author_ip() 7 23 * 8 * @package FV Community News 9 * @subpackage Template 10 * @author Frank Verhoeven 24 * @version 20120229 25 * @return string 11 26 */ 27 function fvcn_get_current_author_ip() { 28 $ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']); 12 29 13 if (!defined('ABSPATH')) { 14 die('Direct access is not allowed!'); 30 return apply_filters('fvcn_get_current_author_ip', $ip); 31 } 32 33 /** 34 * fvcn_get_current_author_ua() 35 * 36 * @version 20120229 37 * @return string 38 */ 39 function fvcn_get_current_author_ua() { 40 if (!empty($_SERVER['HTTP_USER_AGENT'])) { 41 $ua = substr($_SERVER['HTTP_USER_AGENT'], 0, 254); 42 } else { 43 $ua = ''; 44 } 45 46 return apply_filters('fvcn_get_current_author_ua', $ua); 15 47 } 16 48 … … 19 51 * 20 52 * @version 20120307 21 * @uses fvcn_get_user_id() 22 * @param int $user_id 23 * @return void 53 * @param int $userId 24 54 */ 25 function fvcn_user_id($user _id=0) {26 echo fvcn_get_user_id($user _id);55 function fvcn_user_id($userId = 0) { 56 echo fvcn_get_user_id($userId); 27 57 } 28 58 … … 31 61 * 32 62 * @version 20120307 33 * @uses fvcn_is_anonymous() 34 * @uses fvcn_get_current_user_id() 35 * @uses apply_filters() 36 * @param int $user_id 63 * @param int $userId 37 64 * @return int 38 65 */ 39 function fvcn_get_user_id($user _id=0) {40 if (!empty($user _id) && is_numeric($user_id)) {41 $id = $user _id;66 function fvcn_get_user_id($userId = 0) { 67 if (!empty($userId) && is_numeric($userId)) { 68 $id = $userId; 42 69 43 70 } elseif (!fvcn_is_anonymous()) { … … 56 83 * 57 84 * @version 20120229 58 * @uses fvcn_get_current_user_id()59 * @return void60 85 */ 61 86 function fvcn_current_user_id() { … … 67 92 * 68 93 * @version 20120229 69 * @uses wp_get_current_user() 70 * @uses apply_filters() 71 * @return int 94 * @return int 72 95 */ 73 96 function fvcn_get_current_user_id() { … … 82 105 * 83 106 * @version 20120307 84 * @uses fvcn_get_current_user_name()85 * @return void86 107 */ 87 108 function fvcn_current_user_name() { … … 93 114 * 94 115 * @version 20120307 95 * @uses $user_identity 96 * @uses apply_filters() 97 * @return string 116 * @return string 98 117 */ 99 118 function fvcn_get_current_user_name() { 100 global $user _identity;119 global $userIdentity; 101 120 102 return apply_filters('fvcn_get_current_user_name', $user _identity);121 return apply_filters('fvcn_get_current_user_name', $userIdentity); 103 122 } 104 123 … … 108 127 * 109 128 * @version 20120323 110 * @uses fvcn_get_user_id() 111 * @uses fvcn_get_public_post_status() 112 * @uses fvcn_has_posts() 113 * @uses apply_filters() 129 * @param int $userId 130 * @param string $post_status 114 131 * @return bool 115 132 */ 116 function fvcn_has_user_posts($user _id=0, $post_status='') {117 $id = fvcn_get_user_id($user _id);133 function fvcn_has_user_posts($userId=0, $post_status='') { 134 $id = fvcn_get_user_id($userId); 118 135 119 136 if (0 == $id) { … … 121 138 } else { 122 139 if (empty($post_status)) { 123 $post_status = fvcn_get_public_post_status();140 $post_status = PostType::STATUS_PUBLISH; 124 141 } 125 142 … … 134 151 return apply_filters('fvcn_has_user_posts', (bool) $retval); 135 152 } 136 137 138 139 140 141 142 143 144 145 146 147 148 -
fv-community-news/trunk/src/Version.php
r1760963 r1763902 2 2 3 3 namespace FvCommunityNews; 4 5 use FvCommunityNews; 4 6 5 7 /** … … 13 15 * @var string 14 16 */ 15 const CURRENT_VERSION = '3.1'; 16 17 const CURRENT_VERSION = FvCommunityNews::VERSION; 17 18 /** 18 19 * @var string 19 20 */ 20 21 const API_VERSION_CURRENT = 'https://api.frankverhoeven.me/fvcn/1.0/versions/current'; 21 22 22 /** 23 23 * @var string … … 55 55 'wordpress_version' => $wp_version, 56 56 'plugin_version' => self::getCurrentVersion(), 57 'php_version' => phpversion(), 57 58 ], 58 59 ]); -
fv-community-news/trunk/src/Widget/Form.php
r1760963 r1763902 89 89 * 90 90 * @param array $instance 91 * @return void 92 * @version 20120306 91 * @version 20120306 93 92 */ 94 93 public function form($instance) -
fv-community-news/trunk/src/Widget/ListPosts.php
r1760963 r1763902 3 3 namespace FvCommunityNews\Widget; 4 4 5 use FvCommunityNews\Registry; 5 6 use WP_Widget; 6 7 … … 42 43 * @param mixed $args 43 44 * @param array $instance 44 * @return void 45 * @version 20120710 45 * @version 20120710 46 46 */ 47 47 public function widget($args, $instance) … … 51 51 52 52 $title = apply_filters('fvcn_list_posts_widget_title', $instance['title']); 53 $num_posts = !empty( $instance['num_posts']) ? $instance['num_posts'] : '5';53 $num_posts = !empty($instance['num_posts']) ? $instance['num_posts'] : '5'; 54 54 55 $registry = \FvCommunityNews_Registry::getInstance();56 $registry->widgetShowThumbnail = !empty( $instance['thumbnail']) ? true : false;57 $registry->widgetShowViewAll = !empty( $instance['view_all']) ? true : false;55 $registry = Registry::getInstance(); 56 $registry->widgetShowThumbnail = !empty($instance['thumbnail']) ? true : false; 57 $registry->widgetShowViewAll = !empty($instance['view_all']) ? true : false; 58 58 59 59 $options = [ -
fv-community-news/trunk/src/Widget/TagCloud.php
r1760963 r1763902 81 81 * 82 82 * @param array $instance 83 * @return void 84 * @version 20120411 83 * @version 20120411 85 84 */ 86 85 public function form($instance)
Note: See TracChangeset
for help on using the changeset viewer.