google_api_key_option = A3_PORTFOLIO_KEY . '_google_api_key';
$this->toggle_box_open_option = A3_PORTFOLIO_KEY . '_toggle_box_open';
$this->version_transient = A3_PORTFOLIO_KEY . '_licinfo';
$this->support_url = 'https://wordpress.org/support/plugin/a3-portfolio/';
}
/*-----------------------------------------------------------------------------------*/
/* admin_plugin_url() */
/*-----------------------------------------------------------------------------------*/
public function admin_plugin_url() {
if ( $this->admin_plugin_url ) return $this->admin_plugin_url;
return $this->admin_plugin_url = untrailingslashit( plugins_url( '/', __FILE__ ) );
}
/*-----------------------------------------------------------------------------------*/
/* admin_plugin_dir() */
/*-----------------------------------------------------------------------------------*/
public function admin_plugin_dir() {
if ( $this->admin_plugin_dir ) return $this->admin_plugin_dir;
return $this->admin_plugin_dir = untrailingslashit( plugin_dir_path( __FILE__ ) );
}
/*-----------------------------------------------------------------------------------*/
/* admin_pages() */
/*-----------------------------------------------------------------------------------*/
public function admin_pages() {
$admin_pages = apply_filters( $this->plugin_name . '_admin_pages', $this->admin_pages );
return (array)$admin_pages;
}
/**
* get_premium_video_data()
* return array
* Data is used for Premium Video Box
*/
public function get_premium_video_data() {
$premium_video_data = array(
'box_title' => __( 'Premium Version Enhanced Features', 'a3-portfolio' ),
'image_url' => WOO_DYNAMIC_GALLERY_IMAGES_URL. '/video.jpg',
'video_url' => 'https://www.youtube.com/embed/9dGw-ORfMIk?version=3&autoplay=1',
'left_title' => __( 'Premium Version Enhanced Features', 'a3-portfolio' ),
'left_text' => __( 'WooCommerce Dynamic Gallery Premium', 'a3-portfolio' )
. "\n\n" . __( 'Quick Video showing the main (not all) enhanced features that are built into the WooCommerce Dynamic Gallery Premium version', 'a3-portfolio' ),
'right_title' => __( 'Developer Support and Premium Features', 'a3-portfolio' ),
'right_text' => __( 'Limited Time Offer. Purchase the Premium Version Lifetime License. That is a Lifetime of maintenance updates, feature upgrades and developer support for a once only fee. Offer ending soon.', 'a3-portfolio' )
. "\n\n" . '' . __( 'Get Premium Features and Support', '' ) . '',
);
return $premium_video_data;
}
public function plugin_premium_video_box( $echo = true ) {
$premium_video_data = apply_filters( $this->plugin_name . '_plugin_premium_video_data', $this->get_premium_video_data() );
$output = '
';
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
'.$premium_video_data['box_title'].'
';
$output .= '';
$output .= '
';
$output .= $this->plugin_premium_video();
$output .= $this->plugin_premium_video_text();
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
$output = apply_filters( $this->plugin_name . '_plugin_premium_video', $output );
if ( $echo )
echo $output;
else
return $output;
}
public function plugin_premium_video( $echo = false ) {
$premium_video_data = apply_filters( $this->plugin_name . '_plugin_premium_video_data', $this->get_premium_video_data() );
wp_enqueue_style('thickbox');
wp_enqueue_script('thickbox');
$output = '';
if ( $echo )
echo $output;
else
return $output;
}
public function plugin_premium_video_text( $echo = false ) {
$premium_video_data = apply_filters( $this->plugin_name . '_plugin_premium_video_data', $this->get_premium_video_data() );
$output = '';
if ( '' != trim( $premium_video_data['right_text'] ) ) {
$output .= '';
$output .= '';
$output .= '
' . $premium_video_data['right_title'] . '
';
$output .= wpautop( $premium_video_data['right_text'] );
$output .= '';
}
if ( $echo )
echo $output;
else
return $output;
}
public function plugin_extension_boxes( $echo = false ) {
/**
* extension_boxes
* =============================================
* array (
* 'id' => 'box_id' : Enter unique your box id
* 'content' => 'html_content' : (required) Enter the html content to show inside the box
* 'css' => 'custom style' : custom style for the box container
* )
*
*/
$extension_boxes = apply_filters( $this->plugin_name . '_plugin_extension_boxes', array() );
$output = '';
if ( is_array( $extension_boxes ) && count( $extension_boxes ) > 0 ) {
foreach ( $extension_boxes as $box ) {
if ( ! isset( $box['id'] ) ) $box['id'] = '';
if ( ! isset( $box['class'] ) ) $box['class'] = '';
if ( ! isset( $box['css'] ) ) $box['css'] = '';
if ( ! isset( $box['content'] ) ) $box['content'] = '';
$output .= '';
$output .= $box['content'];
$output .= '
';
}
}
if ( $echo )
echo $output;
else
return $output;
}
/*-----------------------------------------------------------------------------------*/
/* plugin_extension_start() */
/* Start of yellow box on right for pro fields
/*-----------------------------------------------------------------------------------*/
public function plugin_extension_start( $echo = true ) {
$output = '';
$output .= '
';
$output .= '
';
$output .= $this->plugin_extension_boxes( false );
$output .= '
';
$output .= '
';
$output .= '
';
$output = apply_filters( $this->plugin_name . '_plugin_extension_start', $output );
if ( $echo )
echo $output;
else
return $output;
}
/*-----------------------------------------------------------------------------------*/
/* plugin_extension_start() */
/* End of yellow box on right for pro fields
/*-----------------------------------------------------------------------------------*/
public function plugin_extension_end( $echo = true ) {
$output = '
';
$output .= '
';
$output = apply_filters( $this->plugin_name . '_plugin_extension_end', $output );
if ( $echo )
echo $output;
else
return $output;
}
/*-----------------------------------------------------------------------------------*/
/* upgrade_top_message() */
/* Show upgrade top message for pro fields
/*-----------------------------------------------------------------------------------*/
public function upgrade_top_message( $echo = false, $setting_id = '' ) {
$upgrade_top_message = sprintf( ''
. __( 'Advanced Settings - Upgrade to the
%s License to activate these settings.', 'a3-portfolio' )
. '
'
, apply_filters( $this->plugin_name . '_' . $setting_id . '_pro_plugin_page_url', apply_filters( $this->plugin_name . '_pro_plugin_page_url', $this->pro_plugin_page_url ) )
, apply_filters( $this->plugin_name . '_' . $setting_id . '_pro_version_name', apply_filters( $this->plugin_name . '_pro_version_name', __( 'Pro Version', 'a3-portfolio' ) ) )
);
$upgrade_top_message = apply_filters( $this->plugin_name . '_upgrade_top_message', $upgrade_top_message, $setting_id );
if ( $echo ) echo $upgrade_top_message;
else return $upgrade_top_message;
}
/*-----------------------------------------------------------------------------------*/
/* pro_fields_before() */
/* Start of yellow box on right for pro fields
/*-----------------------------------------------------------------------------------*/
public function pro_fields_before( $echo = true ) {
echo apply_filters( $this->plugin_name . '_pro_fields_before', ''. $this->upgrade_top_message() );
}
/*-----------------------------------------------------------------------------------*/
/* pro_fields_after() */
/* End of yellow border for pro fields
/*-----------------------------------------------------------------------------------*/
public function pro_fields_after( $echo = true ) {
echo apply_filters( $this->plugin_name . '_pro_fields_after', '
' );
}
/*-----------------------------------------------------------------------------------*/
/* blue_message_box() */
/* Blue Message Box
/*-----------------------------------------------------------------------------------*/
public function blue_message_box( $message = '', $width = '600px' ) {
$message = '';
$message = apply_filters( $this->plugin_name . '_blue_message_box', $message );
return $message;
}
/*-----------------------------------------------------------------------------------*/
/* get_version_message() */
/* Get new version message, also include error connect
/*-----------------------------------------------------------------------------------*/
public function get_version_message() {
$version_message = '';
//Getting version number
$version_transient = get_transient( $this->version_transient );
if ( false !== $version_transient ) {
$transient_timeout = '_transient_timeout_' . $this->version_transient;
$timeout = get_option( $transient_timeout, false );
if ( false === $timeout ) {
$version_message = __( 'You should check now to see if have any new version is available', 'a3-portfolio' );
} elseif ( 'cannot_connect_api' == $version_transient ) {
$version_message = sprintf( __( 'Connection Failure! Please try again. If this issue persists please create a support request on the plugin a3rev support forum.', 'a3-portfolio' ), $this->support_url );
} else {
$version_info = explode( '||', $version_transient );
if ( FALSE !== stristr( $version_transient, '||' )
&& is_array( $version_info )
&& isset( $version_info[1] ) && $version_info[1] == 'valid'
&& version_compare( A3_PORTFOLIO_VERSION , $version_info[0], '<' ) ) {
$version_message = sprintf( __( 'There is a new version %s available, update now or download direct from My Account on a3rev.com', 'a3-portfolio' ),
$version_info[0],
wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' . $this->plugin_path ), 'upgrade-plugin_' . $this->plugin_path ),
'https://a3rev.com/my-account/downloads/'
);
}
}
} else {
$version_message = __( 'You should check now to see if have any new version is available', 'a3-portfolio' );
}
return $version_message;
}
}
?>