Changeset 729145
- Timestamp:
- 06/21/2013 01:41:40 AM (13 years ago)
- Location:
- article-forge/trunk
- Files:
-
- 3 edited
-
ArticleForge.php (modified) (3 diffs)
-
ArticleForge/Admin/Settings.php (modified) (7 diffs)
-
ArticleForge/Install.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
article-forge/trunk/ArticleForge.php
r728624 r729145 120 120 121 121 /** Paths **/ 122 $this->file = __FILE__; 122 $this->file = __FILE__;//WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . plugin_basename(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'ArticleForge.php'; 123 123 $this->basename = plugin_basename( $this->file ); 124 124 $this->plugin_dir = plugin_dir_path( $this->file ); … … 174 174 $cquery->next_post(); 175 175 if ($cquery->post->post_status == 'draft') { 176 if (is_user_logged_in() && ($cquery->post->post_author == get_current_user_id()) && ($_GET['preview'] == 'true')) { 176 if (is_user_logged_in() && ($cquery->post->post_author == get_current_user_id()) 177 && (array_key_exists('preview', $_GET) && ($_GET['preview'] == 'true'))) { 177 178 $section = $cquery->post; 178 179 } … … 213 214 if (isset($post_post)) { 214 215 $statuses = array('publish'); 215 if (is_user_logged_in() && ($post_post->post_author == get_current_user_id()) && ($_GET['preview'] == 'true')) array_push($statuses, 'draft'); 216 if (is_user_logged_in() && ($post_post->post_author == get_current_user_id()) 217 && (array_key_exists('preview', $_GET) && ($_GET['preview'] == 'true'))) array_push($statuses, 'draft'); 216 218 // use author id and _GET to determine if we should allow draft to $statuses 217 219 // get section from post id and section name -
article-forge/trunk/ArticleForge/Admin/Settings.php
r728624 r729145 35 35 private $value; 36 36 public function __construct($value) { 37 $this->value = (new NumericInteger)->validate($value); 37 $temp = new NumericInteger; 38 $this->value = $temp->validate($value); 38 39 } 39 40 public function validate($value) { 40 $value = (new NumericInteger)->validate($value); 41 $temp = new NumericInteger; 42 $value = $temp->validate($value); 41 43 if ($value < $this->value) throw new ValidationException("Value must be greater than equal to " . $this->value); 42 44 return $value; … … 206 208 } 207 209 210 private function get_error_msg( $name ) { 211 $error = get_error( $name ); 212 if ( $error ) return $error['message']['msg']; 213 return null; 214 } 215 216 private function get_error_value( $name ) { 217 $error = get_error( $name ); 218 if ( $error ) return $error['message']['value']; 219 return null; 220 } 221 208 222 public function enqueue_scripts( $hook ) { 209 223 if ($hook == 'settings_page_' . af_namespace()) { … … 358 372 ?> 359 373 360 <input name="<?php echo af_namespace(); ?>_options[summaries_per_page]" type="text" id="_<?php echo af_namespace(); ?>_summaries_per_page" class="regular-text code" value="<?php esc_attr_e($this->has_error('summaries_per_page') ? $this->get_error ('summaries_per_page')['message']['value']: $this->options->summaries_per_page); ?>" />361 <?php if ( $this->has_error('summaries_per_page') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error ('summaries_per_page')['message']['msg']?></span><?php } ?>374 <input name="<?php echo af_namespace(); ?>_options[summaries_per_page]" type="text" id="_<?php echo af_namespace(); ?>_summaries_per_page" class="regular-text code" value="<?php esc_attr_e($this->has_error('summaries_per_page') ? $this->get_error_value('summaries_per_page') : $this->options->summaries_per_page); ?>" /> 375 <?php if ( $this->has_error('summaries_per_page') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error_msg('summaries_per_page') ?></span><?php } ?> 362 376 363 377 <?php … … 391 405 ?> 392 406 393 <input name="<?php echo af_namespace(); ?>_options[list_slug]" type="text" id="_<?php echo af_namespace(); ?>_list_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('list_slug') ? $this->get_error ('list_slug')['message']['value']: $this->options->list_slug); ?>" />394 <?php if ( $this->has_error('list_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error ('list_slug')['message']['msg']?></span><?php } ?>407 <input name="<?php echo af_namespace(); ?>_options[list_slug]" type="text" id="_<?php echo af_namespace(); ?>_list_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('list_slug') ? $this->get_error_value('list_slug') : $this->options->list_slug); ?>" /> 408 <?php if ( $this->has_error('list_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error_msg('list_slug') ?></span><?php } ?> 395 409 396 410 <?php … … 408 422 ?> 409 423 410 <input name="<?php echo af_namespace(); ?>_options[single_slug]" type="text" id="_<?php echo af_namespace(); ?>_single_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('single_slug') ? $this->get_error ('single_slug')['message']['value']: $this->options->single_slug); ?>" />411 <?php if ( $this->has_error('single_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error ('single_slug')['message']['msg']?></span><?php } ?>424 <input name="<?php echo af_namespace(); ?>_options[single_slug]" type="text" id="_<?php echo af_namespace(); ?>_single_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('single_slug') ? $this->get_error_value('single_slug') : $this->options->single_slug); ?>" /> 425 <?php if ( $this->has_error('single_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error_msg('single_slug') ?></span><?php } ?> 412 426 413 427 <?php … … 417 431 ?> 418 432 419 <input name="<?php echo af_namespace(); ?>_options[section_slug]" type="text" id="_<?php echo af_namespace(); ?>_section_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('section_slug') ? $this->get_error ('section_slug')['message']['value']: $this->options->section_slug); ?>" />420 <?php if ( $this->has_error('section_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error ('section_slug')['message']['msg']?></span><?php } ?>433 <input name="<?php echo af_namespace(); ?>_options[section_slug]" type="text" id="_<?php echo af_namespace(); ?>_section_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('section_slug') ? $this->get_error_value('section_slug') : $this->options->section_slug); ?>" /> 434 <?php if ( $this->has_error('section_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error_msg('section_slug') ?></span><?php } ?> 421 435 422 436 <?php … … 426 440 ?> 427 441 428 <input name="<?php echo af_namespace(); ?>_options[arthur_slug]" type="text" id="_<?php echo af_namespace(); ?>_arthur_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('arthur_slug') ? $this->get_error ('arthur_slug')['message']['value']: $this->options->arthur_slug); ?>" />429 <?php if ( $this->has_error('arthur_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error ('arthur_slug')['message']['msg']?></span><?php } ?>442 <input name="<?php echo af_namespace(); ?>_options[arthur_slug]" type="text" id="_<?php echo af_namespace(); ?>_arthur_slug" class="regular-text code" value="<?php esc_attr_e($this->has_error('arthur_slug') ? $this->get_error_value('arthur_slug') : $this->options->arthur_slug); ?>" /> 443 <?php if ( $this->has_error('arthur_slug') ) { ?><span class="articleforge-settings-error"><?php echo $this->get_error_msg('arthur_slug') ?></span><?php } ?> 430 444 431 445 <?php -
article-forge/trunk/ArticleForge/Install.php
r728624 r729145 37 37 /** Uses update instead of add to prevent overriding existing options **/ 38 38 public static function activate() { 39 // Validate PHP version, TODO: validate WP version 40 // TODO: Clean this up 41 if ( version_compare(PHP_VERSION, '5.3.0', '>') ) { 42 deactivate_plugins( plugin_basename(dirname(dirname(__FILE__))) . '/main.php', true ); 43 wp_die("Article Forge requires at least PHP v5.3.0; you're version: " . PHP_VERSION . " " . 44 "<a href='" . admin_url('plugins.php') . "'>Return to plugins page</a>"); 45 } 39 46 } 40 47
Note: See TracChangeset
for help on using the changeset viewer.