wp/wp-content/plugins/portfolio/inc/class-prtfl-settings.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    38 				'tabs' 				 => $tabs,
    38 				'tabs' 				 => $tabs,
    39 				'wp_slug'			 => 'portfolio',
    39 				'wp_slug'			 => 'portfolio',
    40 				'demo_data'			 => $prtfl_BWS_demo_data,
    40 				'demo_data'			 => $prtfl_BWS_demo_data,
    41 				'link_key' 			 => 'f047e20c92c972c398187a4f70240285',
    41 				'link_key' 			 => 'f047e20c92c972c398187a4f70240285',
    42 				'link_pn' 			 => '74',
    42 				'link_pn' 			 => '74',
    43 			) );
    43                 'doc_link'              => 'https://bestwebsoft.com/documentation/portfolio/portfolio-user-guide/'
       
    44             ) );
       
    45 
       
    46             $this->all_plugins = get_plugins();
    44 
    47 
    45 			$wp_sizes = get_intermediate_image_sizes();
    48 			$wp_sizes = get_intermediate_image_sizes();
    46 
    49 
    47 			foreach ( (array) $wp_sizes as $size ) {
    50 			foreach ( (array) $wp_sizes as $size ) {
    48 				if ( ! array_key_exists( $size, $prtfl_options['custom_size_px'] ) ) {
    51 				if ( ! array_key_exists( $size, $prtfl_options['custom_size_px'] ) ) {
   167 			$this->options['screenshot_text_field'] = stripslashes( sanitize_text_field( $_REQUEST['prtfl_screenshot_text_field'] ) );
   170 			$this->options['screenshot_text_field'] = stripslashes( sanitize_text_field( $_REQUEST['prtfl_screenshot_text_field'] ) );
   168 
   171 
   169 			if ( $this->options["slug"] != $_POST['prtfl_slug'] )
   172 			if ( $this->options["slug"] != $_POST['prtfl_slug'] )
   170 				$this->options["flush_rewrite_rules"] = 1;
   173 				$this->options["flush_rewrite_rules"] = 1;
   171 			$this->options["slug"] = sanitize_title( $_POST['prtfl_slug'] );
   174 			$this->options["slug"] = sanitize_title( $_POST['prtfl_slug'] );
       
   175 
       
   176             if (  is_plugin_active( 'sender-pro/sender-pro.php' ) ) {
       
   177                 $sndr_options = get_option( 'sndr_options' );
       
   178                 /* mailout when publishing quote */
       
   179                 if ( ! empty( $_POST['sndr_distribution_select'] ) && ! empty( $_POST['sndr_templates_select'] ) && ! empty( $_POST['sndr_priority'] ) ) {
       
   180                     if (isset($_POST['prtfl_sndr_mailout'])) {
       
   181                         $key = array_search('bws-portfolio', $sndr_options['automailout_new_post']);
       
   182                         if ($key == false) {
       
   183                             $sndr_options['automailout_new_post'][] = 'bws-portfolio';
       
   184                             $sndr_options['group_for_post']['bws-portfolio'] = absint($_POST['sndr_distribution_select']['bws-portfolio']);
       
   185                             $sndr_options['letter_for_post']['bws-portfolio'] = absint($_POST['sndr_templates_select']['bws-portfolio']);
       
   186                             $sndr_options['priority_for_post_letters']['bws-portfolio'] = absint($_POST['sndr_priority']['bws-portfolio']);
       
   187                         }
       
   188                     } else {
       
   189                         $key = array_search('bws-portfolio', $sndr_options['automailout_new_post']);
       
   190                         if (false !== $key) {
       
   191                             unset($sndr_options['automailout_new_post'][$key]);
       
   192                             unset($sndr_options['priority_for_post_letters']['bws-portfolio']);
       
   193                             unset($sndr_options['letter_for_post']['bws-portfolio']);
       
   194                             unset($sndr_options['group_for_post']['bws-portfolio']);
       
   195                         }
       
   196                     }
       
   197                 }
       
   198                 update_option( 'sndr_options', $sndr_options );
       
   199             }
   172 
   200 
   173 			/**
   201 			/**
   174 			 * rewriting post types name with unique one from default options
   202 			 * rewriting post types name with unique one from default options
   175 			 */
   203 			 */
   176 			if ( ! empty( $_POST['prtfl_rename_post_type'] ) ) {
   204 			if ( ! empty( $_POST['prtfl_rename_post_type'] ) ) {
   243 		}
   271 		}
   244 
   272 
   245 		/**
   273 		/**
   246 		 *
   274 		 *
   247 		 */
   275 		 */
   248 		public function tab_settings() { ?>
   276 		public function tab_settings() {
       
   277             if (  is_plugin_active( 'sender-pro/sender-pro.php' ) ) {
       
   278                 $sndr_options = get_option( 'sndr_options' );
       
   279             } ?>
   249 			<h3 class="bws_tab_label"><?php _e( 'Portfolio Settings', 'portfolio' ); ?></h3>
   280 			<h3 class="bws_tab_label"><?php _e( 'Portfolio Settings', 'portfolio' ); ?></h3>
   250 			<?php $this->help_phrase(); ?>
   281 			<?php $this->help_phrase(); ?>
   251 			<hr>
   282 			<hr>
   252 			<table class="form-table">
   283 			<table class="form-table">
   253 				<tr valign="top">
   284 				<tr valign="top">
   402 						<label>
   433 						<label>
   403 							<input type="checkbox" name="prtfl_link_additional_field_for_non_registered" value="1" id="prtfl_link_additional_field_for_non_registered" <?php checked( 1, $this->options['link_additional_field_for_non_registered'] ); ?> /> <span class="bws_info"><?php _e( 'Enable to display link field as a text for non-registered users.', 'portfolio' ); ?></span>
   434 							<input type="checkbox" name="prtfl_link_additional_field_for_non_registered" value="1" id="prtfl_link_additional_field_for_non_registered" <?php checked( 1, $this->options['link_additional_field_for_non_registered'] ); ?> /> <span class="bws_info"><?php _e( 'Enable to display link field as a text for non-registered users.', 'portfolio' ); ?></span>
   404 						</label>
   435 						</label>
   405 					</td>
   436 					</td>
   406 				</tr>
   437 				</tr>
       
   438                 <tr>
       
   439                     <th scope="row"><?php _e( 'Automatic Mailout when Publishing a New:', 'portfolio' ); ?></th>
       
   440                     <td>
       
   441                         <?php if ( array_key_exists( 'sender-pro/sender-pro.php', $this->all_plugins ) ) {
       
   442                             if ( is_plugin_active( 'sender-pro/sender-pro.php' ) ) { ?>
       
   443                                 <fieldset>
       
   444                                     <label>
       
   445                                         <input type="checkbox" name="prtfl_sndr_mailout" value="1" class="bws_option_affect" data-affect-show="[data-post-type=bws-portfolio]" <?php checked( in_array( 'bws-portfolio', $sndr_options['automailout_new_post'] ) ); ?> />&nbsp<?php _e( 'Projects', 'portfolio' ); ?>
       
   446                                     </label><br />
       
   447                                     <div data-post-type="bws-portfolio">
       
   448                                         <p><?php sndr_distribution_list_select( $sndr_options['group_for_post'], 'bws-portfolio' ); ?></p>
       
   449                                         <p><?php sndr_letters_list_select( $sndr_options['letter_for_post'], 'bws-portfolio' ); ?></p>
       
   450                                         <p>
       
   451                                             <?php sndr_priorities_list( $sndr_options['priority_for_post_letters'], '', 'bws-portfolio' );
       
   452                                             _e( 'Select mailout priority', 'portfolio' ); ?>
       
   453                                             <br /><span class="bws_info"><?php _e( 'Less number - higher priority', 'portfolio' ) ?></span>
       
   454                                         </p><br/>
       
   455                                     </div>
       
   456                                 </fieldset>
       
   457                             <?php } else { ?>
       
   458                                 <input disabled="disabled" type="checkbox" name="prtfl_sndr_mailout" />&nbsp
       
   459                                 <span class="bws_info"><?php _e( 'Enable to automatic mailout when publishing a new bws-portfolios and tips. Sender Pro plugin is required.', 'portfolio' ); ?> <a href="https://bestwebsoft.com/products/wordpress/plugins/sender/"><?php _e( 'Ativate Now', 'portfolio' ); ?></a></span><br />
       
   460                             <?php }
       
   461                         } else { ?>
       
   462                             <input disabled="disabled" type="checkbox" name="prtfl_sndr_mailout" />&nbsp
       
   463                             <span class="bws_info"><?php _e( 'Enable to automatic mailout when publishing a new bws-portfolios and tips. Sender Pro plugin is required.', 'portfolio' ); ?> <a href="https://bestwebsoft.com/products/wordpress/plugins/sender/"><?php _e( 'Install Now', 'portfolio' ); ?></a></span><br />
       
   464                         <?php } ?>
       
   465 
       
   466                     </td>
       
   467                 </tr>
   407 			</table>
   468 			</table>
   408         <?php }
   469         <?php }
   409 
   470 
   410 		/**
   471 		/**
   411 		 *
   472 		 *