display( AUTHOR, false ) ) ) { return false; } $url = ( isset( $_SERVER['HTTP_REFERER'] ) ? parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_QUERY ) : '' ); if ( ! empty( $url ) && $url == 'step=theme' ) { $referrer = 'install_wizard'; } else { $referrer = THEMESPAGE; } ( class_exists( OCPUSHSTATS ) ? \OCPushStats::push_stats_event_themes_and_plugins( 'activate', THEME, $theme->stylesheet, "$referrer" ) : '' ); return true; } } /** * Function after deactivating the theme **/ if ( ! function_exists( 'onecom_deactivate_theme_stats' ) ) { function onecom_deactivate_theme_stats( $new_name, $new_theme, $old_theme ) { if ( ONECOM !== strtolower( $old_theme->display( AUTHOR, false ) ) ) { return false; } // send stats ( class_exists( OCPUSHSTATS ) ? \OCPushStats::push_stats_event_themes_and_plugins( 'deactivate', THEME, $old_theme->stylesheet, THEMESPAGE ) : '' ); return true; } } if ( ! function_exists( 'onecom_upgradation_check' ) ) { function onecom_upgradation_check( $upgrader_object, $options ) { if ( isset( $options['action'] ) && isset( $options['type'] ) && isset( $options['plugins'] ) && $options['action'] == UPDATE && $options['type'] == 'plugin' ) { if ( $upgrader_object->skin->plugin_info['AuthorName'] !== ONECOM ) { return; } // send stats ( class_exists( OCPUSHSTATS ) ? \OCPushStats::push_stats_event_themes_and_plugins( UPDATE, 'plugin', $upgrader_object->result['destination_name'], 'plugins_page' ) : '' ); } elseif ( isset( $options['action'], $options['type'] ) && isset( $options['themes'] ) && $options['action'] == UPDATE && $options['type'] == THEME ) { if ( $upgrader_object->skin->theme_info->get( AUTHOR ) !== ONECOM ) { return; } // send stats ( class_exists( OCPUSHSTATS ) ? \OCPushStats::push_stats_event_themes_and_plugins( UPDATE, THEME, $upgrader_object->result['destination_name'], THEMESPAGE ) : '' ); } } } add_action( 'upgrader_process_complete', 'onecom_upgradation_check', 10, 2 ); /** * one.com register Imagify partner */ function onecom_register_imagify_partner() { if ( ! is_admin() ) { return; } if ( ! file_exists( ONECOM_WP_PATH . 'vendor/imagify/class-imagify-partner.php' ) ) { return; } require_once ONECOM_WP_PATH . 'vendor/imagify/class-imagify-partner.php'; if ( Imagify_Partner::has_imagify_api_key() ) { return; } // Saving the Partner ID in DB as a fallback. update_site_option( 'imagifyp_id', OCIPID, 'no' ); // The class needs to be initiated to launch hooks. $imagify = new Imagify_Partner( OCIPID ); $imagify->init(); } // Save Imagify partner ID add_action( 'plugins_loaded', 'onecom_register_imagify_partner' );