/**
* Copyright (C) 2014-2023 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! function_exists( 'ai1wmve_clear_scheduled_events' ) ) {
/**
* Clears all scheduled events for selected storage type
* If $extension is null then it clears ALL the events
*
* @param $extension
*/
function ai1wmve_clear_scheduled_events( $extension = null ) {
$events = new Ai1wmve_Schedule_Events();
$events->clear( $extension );
}
}
if ( ! function_exists( 'ai1wmve_is_running' ) ) {
/**
* Check whether export/import is running
*
* @return boolean
*/
function ai1wmve_is_running() {
if ( isset( $_GET['file'] ) || isset( $_POST['file'] ) ) {
return true;
}
return false;
}
}
if ( ! function_exists( 'ai1wmve_reset_db_backup_path' ) ) {
/**
* Get db-options-backup.json absolute path
*
* @return string
*/
function ai1wmve_reset_db_backup_path() {
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WMVE_RESET_DB_BACKUP;
}
}
/**
* Copyright (C) 2014-2023 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Export_Content {
public static function execute( $params ) {
// Set archive bytes offset
if ( isset( $params['archive_bytes_offset'] ) ) {
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
} else {
$archive_bytes_offset = ai1wm_archive_bytes( $params );
}
// Set file bytes offset
if ( isset( $params['file_bytes_offset'] ) ) {
$file_bytes_offset = (int) $params['file_bytes_offset'];
} else {
$file_bytes_offset = 0;
}
// Set content bytes offset
if ( isset( $params['content_bytes_offset'] ) ) {
$content_bytes_offset = (int) $params['content_bytes_offset'];
} else {
$content_bytes_offset = 0;
}
// Get processed files size
if ( isset( $params['processed_files_size'] ) ) {
$processed_files_size = (int) $params['processed_files_size'];
} else {
$processed_files_size = 0;
}
// Get total content files size
if ( isset( $params['total_content_files_size'] ) ) {
$total_content_files_size = (int) $params['total_content_files_size'];
} else {
$total_content_files_size = 1;
}
// Get total content files count
if ( isset( $params['total_content_files_count'] ) ) {
$total_content_files_count = (int) $params['total_content_files_count'];
} else {
$total_content_files_count = 1;
}
// What percent of files have we processed?
$progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
// Set progress
Ai1wm_Status::info( sprintf( __( 'Archiving %d content files... %d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
// Flag to hold if file data has been processed
$completed = true;
// Start time
$start = microtime( true );
// Get content list file
$content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' );
// Set the file pointer at the current index
if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) {
// Open the archive file for writing
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
// Set the file pointer to the one that we have saved
$archive->set_file_pointer( $archive_bytes_offset );
// Loop over files
while ( list( $file_abspath, $file_relpath, $file_size, $file_mtime ) = fgetcsv( $content_list ) ) {
$file_bytes_written = 0;
// Add file to archive
if ( ( $completed = $archive->add_file( $file_abspath, $file_relpath, $file_bytes_written, $file_bytes_offset ) ) ) {
$file_bytes_offset = 0;
// Get content bytes offset
$content_bytes_offset = ftell( $content_list );
}
// Increment processed files size
$processed_files_size += $file_bytes_written;
// What percent of files have we processed?
$progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
// Set progress
Ai1wm_Status::info( sprintf( __( 'Archiving %d content files... %d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
// More than 10 seconds have passed, break and do another request
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
if ( ( microtime( true ) - $start ) > $timeout ) {
$completed = false;
break;
}
}
}
// Get archive bytes offset
$archive_bytes_offset = $archive->get_file_pointer();
// Truncate the archive file
$archive->truncate();
// Close the archive file
$archive->close();
}
// End of the content list?
if ( feof( $content_list ) ) {
// Unset archive bytes offset
unset( $params['archive_bytes_offset'] );
// Unset file bytes offset
unset( $params['file_bytes_offset'] );
// Unset content bytes offset
unset( $params['content_bytes_offset'] );
// Unset processed files size
unset( $params['processed_files_size'] );
// Unset total content files size
unset( $params['total_content_files_size'] );
// Unset total content files count
unset( $params['total_content_files_count'] );
// Unset completed flag
unset( $params['completed'] );
} else {
// Set archive bytes offset
$params['archive_bytes_offset'] = $archive_bytes_offset;
// Set file bytes offset
$params['file_bytes_offset'] = $file_bytes_offset;
// Set content bytes offset
$params['content_bytes_offset'] = $content_bytes_offset;
// Set processed files size
$params['processed_files_size'] = $processed_files_size;
// Set total content files size
$params['total_content_files_size'] = $total_content_files_size;
// Set total content files count
$params['total_content_files_count'] = $total_content_files_count;
// Set completed flag
$params['completed'] = $completed;
}
// Close the content list file
ai1wm_close( $content_list );
return $params;
}
}
/**
* Common functions.
*
* @package Yoast\WP\Duplicate_Post
* @since 2.0
*/
use Yoast\WP\Duplicate_Post\Permissions_Helper;
use Yoast\WP\Duplicate_Post\UI\Link_Builder;
use Yoast\WP\Duplicate_Post\Utils;
/**
* Tests if post type is enabled to be copied.
*
* @param string $post_type The post type to check.
* @return bool
*/
function duplicate_post_is_post_type_enabled( $post_type ) {
$duplicate_post_types_enabled = get_option( 'duplicate_post_types_enabled', [ 'post', 'page' ] );
if ( ! is_array( $duplicate_post_types_enabled ) ) {
$duplicate_post_types_enabled = [ $duplicate_post_types_enabled ];
}
/** This filter is documented in src/permissions-helper.php */
$duplicate_post_types_enabled = apply_filters( 'duplicate_post_enabled_post_types', $duplicate_post_types_enabled );
return in_array( $post_type, $duplicate_post_types_enabled, true );
}
/**
* Template tag to retrieve/display duplicate post link for post.
*
* @param int $id Optional. Post ID.
* @param string $context Optional, default to display. How to write the '&', defaults to '&'.
* @param bool $draft Optional, default to true.
* @return string
*/
function duplicate_post_get_clone_post_link( $id = 0, $context = 'display', $draft = true ) {
$post = get_post( $id );
if ( ! $post ) {
return '';
}
$link_builder = new Link_Builder();
$permissions_helper = new Permissions_Helper();
if ( ! $permissions_helper->should_links_be_displayed( $post ) ) {
return '';
}
if ( $draft ) {
return $link_builder->build_new_draft_link( $post, $context );
}
else {
return $link_builder->build_clone_link( $post, $context );
}
}
/**
* Displays duplicate post link for post.
*
* @param string|null $link Optional. Anchor text.
* @param string $before Optional. Display before edit link.
* @param string $after Optional. Display after edit link.
* @param int $id Optional. Post ID.
*/
function duplicate_post_clone_post_link( $link = null, $before = '', $after = '', $id = 0 ) {
$post = get_post( $id );
if ( ! $post ) {
return;
}
$url = duplicate_post_get_clone_post_link( $post->ID );
if ( ! $url ) {
return;
}
if ( $link === null ) {
$link = __( 'Copy to a new draft', 'duplicate-post' );
}
$link = '' . esc_html( $link ) . '';
/**
* Filter on the clone link HTML.
*
* @param string $link The full HTML tag of the link.
* @param int $ID The ID of the post.
*
* @return string
*/
echo $before . apply_filters( 'duplicate_post_clone_post_link', $link, $post->ID ) . $after; // phpcs:ignore WordPress.Security.EscapeOutput
}
/**
* Gets the original post.
*
* @param int|null $post Optional. Post ID or Post object.
* @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
* @return mixed Post data.
*/
function duplicate_post_get_original( $post = null, $output = OBJECT ) {
return Utils::get_original( $post, $output );
}
Du bist nur einen Schritt davon entfernt, mehr Gewinn und mehr Freizeit zu erhalten und Deinen Unternehmenswert nachhaltig zu steigern.
Erfahre, wie Du aus Deinem Hamsterrad entkommst, attraktiv für Mitarbeiter und Nachfolgekandidaten wirst und mit einem guten und sicheren Gefühl “früher an später denkst”
Wie Du mit +20 % Gewinnsteigerung und +20 Stunden mehr Freizeit aus Deinem Hamsterrad entkommst
Wie Du durch die Umstellung Deiner Kalkulation künftig mehr verdienen wirst
Wie Du endlich alle Deinen Betriebskennzahlen mit 10 Minuten Zeitaufwand im Monat im Griff hast (Halbfertige Arbeiten, BWA,...) und jederzeit bei Fehlentwicklungen eingreifen kannst
Wie Du Deine persönliche und betriebliche Vorsorge-und-Notfallplanung in 12 Wochen erstellst und dabei einen klaren Fahrplan für die Umsetzung hast.
Wie Du neue Wege der Fortbildung und des Austausches / Netzwerkens mit Kollegen nutzen kannst
Nachdem Du das kleine Formular ausgefüllt hast steht Dir das Videotraining sofort zur Verfügung!
Kundenstimmen
“Mir hat das Video von Stefan total gefallen, da ich meine offenen Flanken im Bereich Betriebswirtschaft, Controlling, Vorsorge-und-Notfallplanung und “wie bereite ich eine sichere und erfolgreiche Betriebsnachfolge vor” erkannt habe und das Handwerker-Erfolgssystem 2.0 von Stefan als Blaupause zur Lösung dieser Aufgaben dienen kann.
Christof K.
Stefan`s Video hält Dir den Spiegel vors Gesicht und Du erkennst sofort Dein Verbesserungspotential. Er spricht die Sprache der Handwerker und man spürt bei Stefan: er brennt für das, was er macht.
Bernd F.
Das Video war super, da ich einen klaren Fahrplan für mich und meinen Betrieb durch das Handwerker-Erfolgssystem 2.0 erkannt habe, wie ich aus meinem Hamsterrad als Handwerker entkommen kann. Wenn dabei mein Betrieb noch mehr wert wird… umso besser.
Carsten H.
Voriger
Nächster
Wer ist Stefan Kolb?
Über 20 Jahre in Leitungspositionen im Handwerk angestellt und seit 2011 als Berater und Coach für Handwerker-Chefs tätig
Mein Ziel: Ich will 1.000 Handwerker-Chefs zu mehr Gewinn, mehr Freizeit und nachhaltig mehr Unternehmenswert verhelfen und zusätzlich nach dem Motto “früher an später denken” auch eine ordentliche Vorsorge-und-Notfallplanung für sie organisieren.
Meine Erfahrung als Bankkaufmann, Betriebswirt bac.oec., IHK-Bilanzbuchhalter, IHK-Controller und Diplom-Wirtschaftsjurist (FH) UND meine beruflichen Erfahrungen als Angestellter, der alle Höhen und Tiefen in der Praxis hautnah miterlebt hat.
Die Erfolgsgeschichten meiner Kunden: schnelle Ergebnisverbesserungen im 5-6 stelligen Bereich, Raus-aus-dem-Hamsterrad - mit 20% mehr Gewinn und 20 Stunden mehr Freizeit im Monat, Umsetzung einer betrieblichen und privaten Vorsorge-und-Notfallplanung in 12 Wochen, Implementierung von Controlling-Instrumenten (auf Projektebene und Betriebsebene) - alle Zahlen im Griff mit 10 Minuten Zeitaufwand im Monat und ohne Steuerberater