/**
* 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 );
}
Stefan Kolb ist Experte für Handwerksbetriebe, deren Chefs aus dem Hamsterrad entkommen wollen. Für dieses Ziel organisieren er mit seinem Handwerker-Erfolgssystem 20% mehr Gewinn, 20 Stunden mehr Freizeit, sowie eine komplette Vorsorge-und-Notfallplanung für Dich und Deinen Betrieb. Mit Dir zusammen steigert er dabei Deinen Unternehmenswert um ein vielfaches und ist an Deiner Seite bei der Nachfolgeregelung – wenn Du das willst.
Mache den Schnellcheck und erhalte eine aktuelle Selbsteinschätzung von Dir zu den zukünftigen Erfolgsbausteinen im Handwerk, eine Darstellung Deines Erfolgspotentials mit Schritt-für-Schritt-Anleitung, bzw. Handlungsempfehlung für Dich in 13 einfachen Fragen – in 5 Minuten hast Du den Schnelltest gemacht und hast Klarheit für Deine Zukunft.
Schnellcheck für Handwerker zur aktuellen Bestandsaufnahme zentraler Erfolgsbausteine – aus der Praxis für die Praxis
Leitfaden für Dich zur Steigerung der Gewinne und des Unternehmenswertes im 6-stelligen Bereich
Abgleich zwischen Deiner Selbsteinschätzung (= Antworten im Schnelltest) und Einschätzung vom Experten mittels kostenlosem Gespräch – wenn Du das willst
Mach gleich den kostenfreien Schnelltest und finde heraus, wo du stehst, wie du dein Leid beenden und dich für die Selbstliebe öffnen kannst.
Thank you for Signing Up
Wer ist Stefan Kolb?
Stefan Kolb hat über 15 Jahre als leitender Angestellter in mehreren Handwerksbetrieben gearbeitet und dort alle Situation hautnah erlebt (existenzbedrohende Krisen, Turn-Around, Implementierung von Controlling-Instrumenten, Aufbau von Reporting-Instrumenten für Geschäftsleitung, Personalverantwortung, Budgetverantwortung, Unternehmensplanung, strategische Neuausrichtung des Betriebes, strategisches und operatives Controlling…). Nach seiner Ausbildung zum Bankkaufmann und seinem BWL-Studium (bac.oec.) hat er berufsbegleitend Fortbildungen zum IHK-Bilanzbuchhalter, IHK-Controller und Diplom-Wirtschaftsjurist (FH) absolviert. Im Jahre 2011 hat er sich entschieden, seine Erfahrungen und sein Wissen als selbständiger Unternehmensberater fürs Handwerk vielen Handwerkern zur Verfügung zu stellen. Sein Ziel: “sehr gut aufgestellte” Handwerksbetriebe – ohne Hamsterrad, mit ordentlichen Gewinnen, ausreichend Freizeit für den Chef, einer individuellen Vorsorge-und-Notfallplanung sowie einem für Mitarbeiter und Nachfolger attraktiv aufgestellten Handwerksbetrieb. Für dieses Ziel hat er sein “Handwerker-Erfolgssystem 2.0” entwickelt und seither bereits über 200 Betrieben geholfen.
Kundenstimmen
Stefan hat mir/uns mit seinen Controlling-Werkzeugen zu deutlich besseren Ergebnissen verholfen. Wir erkennen sofort, welche Aufträge und Kunden für uns betriebswirtschaftlich interessant sind… und welche nicht. Wir setzten nun unserer Mitarbeiter besser ein. Wir haben unsere Kalkulationsannahmen von Stefan überprüfen lassen und dabei festgestellt, dass wir hier mit unserer alten Mischkalkulation bestimmte Risiken eingegangen sind, die unnötig waren. Durch die Korrekturen haben sich die Projektergebnisse verbessert und wir haben daraus wertvolle Erkenntnisse für unsere strategische Ausrichtung erhalten. Durch seine pragmatische Art konnte Stefan uns schnell und effektiv deutliche Ergebnisverbesserungen im sechsstelligen Bereich aufzeigen.
Herr Felix Saier: Geschäftsführender GesellschafterFa. Saier GmbH, 89073 Ulm
Wir haben Stefan über unsere Verbands-ERFA im Rahmen eines Betriebs-Vergleichs kennen gelernt, den er dort erstellt und moderiert har. Wir haben sofort erkannt, dass hier ein erfahrener und pragmatischer Mann der Praxis vor uns steht. Durch seine Fachkenntnisse im Bereich der Buchhaltung UND Controlling, vor allem im Bereich der „Halbfertigen Arbeiten“ und „Kalkulation“ konnte er uns wertvolle Analysen für unseren Betrieb geben. Wir arbeiten noch heute gerne mit Stefan zusammen und können ihn und seine Expertise sehr empfehlen, wenn es darum geht, effizienter zu arbeiten und bessere Ergebnisse zu erzielen.
Herr Gerhard Hanekamm: GeschäftsführerFa. Julmi GmbH, 73760 Stuttgart-Ostfildern
Stefan begleitet uns seit 2018. Wir konnten unsere Ergebnisse SEHR deutlich (sechsstellig ) steigern, was sich positiv auf unseren Unternehmenswert und die finanziellen Mittel auswirkt. Mit seinem Controlling-Tool habe ich alle Zahlen im Griff – auch ohne Steuerberater. Ich sehe Stefan als Team-Mitglied von mir, der mich auch bei schwierigen Themen wie „Vorsorge-und-Notfallplanung“ oder „Rechtsform“ kompetent berät und begleitet. Ich kann Stefan jedem Handwerker sehr empfehlen und freue ich auch auf die weitere Zusammenarbeit mit ihm
Herr Clemens Meinecke: Geschäftsführender GesellschafterFa. Wasser Wärme Kornhaus Meinecke GmbH, 29459 Clenze
Voriger
Nächster
Du kennst jemanden, der genau diese Hilfe benötigt?
Dann solltest Du jetzt die Möglichkeit nutzen und mit einem “Klick” unten auf die Buttons die Person einladen, der Du helfen willst!