Initialize the progress bar for use.

- `total` The total number of items in the progress bar. Defaults
to 100.
- `width` The width of the progress bar. Defaults to 80.

@param array $args The initialization data.
@return $this
507049
public function init(array $args = [])
    {
        $args += ['total' => 100, 'width' => 80];
        $this->_progress = 0;
        $this->_width = $args['width'];
        $this->_total = $args['total'];

        return $this;
    }
1124580
public function vars($args)
    {
        $this->_query .= implode(',', array_fill(0, count($args), '?'));
        foreach ($args as $arg) {
            $this->_args[] = $arg;
        };
        return $this;
    }
1016718
public function setArgs(array $args)
    {
        foreach ($args as $k => $v) {
            if (is_numeric($k)) {
                $this->args[$k] = $v;
            } else {
                $this->kwargs[$k] = $v;
            }
            ksort($this->args);
        }
        return $this;
    }
34956
public function add(array $args)
    {
        # Establish args.

        $default_args = [
            'auto_prefix'        => true,
            'include_post_types' => [],
            'exclude_post_types' => [],
            'slug'               => '',
            'title'              => '',
            'class'              => '',
            'template_file'      => '',
            'template_dir'       => '',
            'callback'           => null,
            'on_save'            => null,
            'screen'             => null,
            'context'            => 'advanced',
            'priority'           => 'default',
        ];
        $cfg = (object) array_merge($default_args, $args);

        $cfg->auto_prefix        = (bool) $cfg->auto_prefix;
        $cfg->include_post_types = (array) $cfg->include_post_types;
        $cfg->exclude_post_types = (array) $cfg->exclude_post_types;
        $cfg->slug               = (string) $cfg->slug;
        $cfg->title              = (string) $cfg->title;
        $cfg->class              = (string) $cfg->class;
        $cfg->template_file      = (string) $cfg->template_file;
        $cfg->template_dir       = (string) $cfg->template_dir;
        $cfg->context            = (string) $cfg->context;
        $cfg->priority           = (string) $cfg->priority;

        if ($cfg->slug && $cfg->auto_prefix) {
            $cfg->slug = $this->App->Config->©brand['©slug'].'-'.$cfg->slug;
        } elseif (!$cfg->slug) {
            $cfg->slug = $this->App->Config->©brand['©slug'];
        }
        if (!$cfg->title) {
            $cfg->title = $this->App->Config->©brand['©name'];
        }
        $cfg->class .= $cfg->class ? ' ' : '';
        $cfg->class .= $this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-post-meta-box-wrapper';
        $cfg->class .= ' '.$this->App->Config->©brand['©slug'].'-post-meta-box-wrapper';
        $cfg->class .= $cfg->slug !== $this->App->Config->©brand['©slug'] ? ' '.$cfg->slug.'-post-meta-box-wrapper' : '';

        $cfg->nonce['action'] = $cfg->slug.'-save'; // Nonce action ID.
        $cfg->nonce['name']   = '_'.$this->c::slugToVar($cfg->slug).'_nonce';

        $cfg = $this->s::applyFilters('post_meta_box', $cfg, $args, $default_args);

        if (!$cfg->template_file) {
            throw $this->c::issue('Missing template file.');
        }
        $cfg->callback = $cfg->callback ?: function (\WP_Post $WP_Post) use ($cfg) {
            $post_id = (int) $WP_Post->ID;
            $vars    = compact('post_id', 'WP_Post', 'cfg');
            wp_nonce_field($cfg->nonce['action'], $cfg->nonce['name']);
            echo $this->c::getTemplate('s-core/admin/menu-pages/post-meta-box/template.php')->parse($vars);
        };
        # Build meta box sub-routines via closures.

        $on_load_maybe_do_setup = function () use ($cfg) {
            $current_post_type = $this->s::currentMenuPagePostType();

            if ($cfg->include_post_types && !in_array($current_post_type, $cfg->include_post_types, true)) {
                return; // Does not apply to this post type.
            } elseif ($cfg->exclude_post_types && in_array($current_post_type, $cfg->exclude_post_types, true)) {
                return; // Does not apply to this post type.
            }
            $on_add_meta_boxes = function () use ($cfg) {
                add_meta_box($cfg->slug, $cfg->title, $cfg->callback, $cfg->screen, $cfg->context, $cfg->priority);
            };
            $on_save_post = function ($post_id, \WP_Post $WP_Post) use ($cfg) {
                if (!($post_id = (int) $post_id)) {
                    return; // Not possible.
                }
                $_r = $this->c::unslash($_REQUEST);
                $_r = $this->c::mbTrim($_r);

                $nonce_action = $cfg->nonce['action'];
                $nonce_value  = $_r[$cfg->nonce['name']] ?? null;

                $data = $_r[$this->c::slugToVar($cfg->slug)] ?? [];
                $data = is_array($data) ? $data : []; // Force array.
                $data = $this->c::removeKey($data, '___ignore');

                if (!isset($nonce_value)) {
                    return; // Nonce is missing.
                } elseif (!wp_verify_nonce($nonce_value, $nonce_action)) {
                    return; // Nonce is unverifiable.
                } elseif (!current_user_can('edit_post', $post_id)) {
                    return; // Current user not allowed.
                } elseif (wp_is_post_autosave($post_id)) {
                    return; // Not applicable.
                } elseif (wp_is_post_revision($post_id)) {
                    return; // Not applicable.
                }
                foreach ($data as $_key => $_value) {
                    if ($_key && is_string($_key)) {
                        // Slash, because WP will unslash.
                        // This allows for `\` in form submissions.
                        $this->s::updatePostMeta($post_id, $_key, wp_slash($_value));
                    }
                }
                if (($on_save = $cfg->on_save)) {
                    $on_save($post_id, $data);
                }
            };
            add_action('add_meta_boxes', $on_add_meta_boxes);
            add_action('save_post', $on_save_post, 10, 2);
        };
        add_action('load-post.php', $on_load_maybe_do_setup);
        add_action('load-post-new.php', $on_load_maybe_do_setup);
    }
1309126
public static function run ($args) {

		//Initialize colors
		Bartender::setup();

		//Start on a new line
		Bartender::printColored("\n", "white");

		//Show all commands
		if (count($args) == 1) {
			Bartender::printColored("Commands avaible:", "purple");
			Bartender::newLine();

			foreach (Bartender::$commands as $key => $value) {
				Bartender::printColored($key, "green");
				Bartender::newLine();
				$value = "Acai\Core\Commands\\".$value;
				$value::description();
				Bartender::newLine();
				Bartender::newLine();
			}
		}
		//Show command specific help
		else {
			//Gather
			$caller 	= array_shift($args);
			$command 	= array_shift($args);
			$action		= (count($args) > 0)? array_shift($args):"";

			if (isset(Bartender::$commands[$command])) {
				$command = "Acai\Core\Commands\\".Bartender::$commands[$command];
				$command::action($action);
				$command::arguments($args);
				$command::run();
			}
			else {
				Bartender::printColored("Command not found", "white", "red");
			}
		}
		Bartender::printColored("", "white", "black");
	}
1239489
public function setCommand(string $args): self
	{
		if ($this->mailer instanceof SendmailMailer) {
			$this->mailer->commandArgs = $args;
		}
		return $this;
	}
1320553
public function with($arg)
    {
        $args = func_get_args();

        if (is_array($args[0])) {
            $this->setWith($args[0]);

            return $this;
        }

        foreach ($args as $arg) {
            if (is_string($arg)) {
                $this->addWith($arg);
            }

            return $this;
        }

        throw new DatabaseException('The arguments for with() don\'t fit');
    }
825708
public function addMenu(array $args = [])
    {
        $default_args = [
            'auto_prefix'   => true,
            'page_title'    => '',
            'menu_title'    => '',
            'capability'    => '',
            'page'          => '',
            'class'         => '',
            'template_file' => '',
            'template_dir'  => '',
            'icon'          => '',
            'position'      => null,
            'meta_links'    => [],
            'tabs'          => [],
            'callback'      => null,
        ];
        $cfg = (object) array_merge($default_args, $args);

        $cfg->auto_prefix   = (bool) $cfg->auto_prefix;
        $cfg->page_title    = (string) $cfg->page_title;
        $cfg->menu_title    = (string) $cfg->menu_title;
        $cfg->capability    = (string) $cfg->capability;
        $cfg->page          = (string) $cfg->page;
        $cfg->class         = (string) $cfg->class;
        $cfg->template_file = (string) $cfg->template_file;
        $cfg->template_dir  = (string) $cfg->template_dir;
        $cfg->icon          = (string) $cfg->icon;
        $cfg->position      = (string) $cfg->position;
        $cfg->meta_links    = (array) $cfg->meta_links;
        $cfg->tabs          = (array) $cfg->tabs;

        if ($cfg->page_title && $cfg->auto_prefix // Smart auto-prefixing.
                && $cfg->page_title !== $this->App->Config->©brand['©name']) {
            $cfg->page_title = $cfg->page_title.' | '.$this->App->Config->©brand['©name'];
        } elseif (!$cfg->page_title) {
            $cfg->page_title = $this->App->Config->©brand['©name'];
        }
        if (!$cfg->menu_title) {
            $cfg->menu_title = $this->App->Config->©brand['©name'];
        }
        if (!$cfg->capability) {
            $cfg->capability = $this->App->Config->§caps['§manage'];
        }
        if ($cfg->page && $cfg->auto_prefix // Smart auto-prefixing.
                && $cfg->page[0] !== '/' && mb_stripos($cfg->page, '.php') === false) {
            $cfg->page = $this->App->Config->©brand['©slug'].'-'.$cfg->page;
        } elseif (!$cfg->page) {
            $cfg->page = $this->App->Config->©brand['©slug'];
        }
        $cfg->class .= ($cfg->class ? ' ' : '').'wrap';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-menu-page-wrapper';
        $cfg->class .= ' '.$this->App->Config->©brand['©slug'].'-menu-page-wrapper';
        $cfg->class .= $cfg->page !== $this->App->Config->©brand['©slug'] ? ' '.$cfg->page.'-menu-page-wrapper' : '';

        if (!$cfg->icon) {
            $cfg->icon = 'dashicons-admin-generic';
        }
        if (!isset($cfg->position[0])) {
            $cfg->position = null; // No preference.
        }
        $cfg = $this->s::applyFilters('menu_page', $cfg, $args, $default_args);

        if (!$cfg->template_file) {
            throw $this->c::issue('Missing template file.');
        }
        $cfg->nav_tabs = $this->is($cfg->page) ? $this->buildNavTabs($cfg) : '';
        $cfg->callback = $cfg->callback ?: function () use ($cfg) {
            echo $this->c::getTemplate('s-core/admin/menu-pages/template.php')->parse(compact('cfg'));
        };
        $this->hook_names[$cfg->page] = // By slug. See: <https://developer.wordpress.org/reference/functions/add_menu_page/>
            add_menu_page($cfg->page_title, $cfg->menu_title, $cfg->capability, $cfg->page, $cfg->callback, $cfg->icon, $cfg->position);
    }
189681
public function setOptions($args)
    {
        $this->log("Set new options for processing image.");

        $defaults = array(
            // Options for calculate dimensions
            'newWidth'    => null,
            'newHeight'   => null,
            'aspectRatio' => null,
            'keepRatio'   => true,
            'cropToFit'   => false,
            'fillToFit'   => null,
            'crop'        => null, //array('width'=>null, 'height'=>null, 'start_x'=>0, 'start_y'=>0),
            'area'        => null, //'0,0,0,0',
            'upscale'     => self::UPSCALE_DEFAULT,

            // Options for caching or using original
            'useCache'    => true,
            'useOriginal' => true,

            // Pre-processing, before resizing is done
            'scale'        => null,
            'rotateBefore' => null,
            'autoRotate'  => false,

            // General options
            'bgColor'     => null,

            // Post-processing, after resizing is done
            'palette'     => null,
            'filters'     => null,
            'sharpen'     => null,
            'emboss'      => null,
            'blur'        => null,
            'convolve'       => null,
            'rotateAfter' => null,

            // Output format
            'outputFormat' => null,
            'dpr'          => 1,

            // Postprocessing using external tools
            'lossy' => null,
        );

        // Convert crop settings from string to array
        if (isset($args['crop']) && !is_array($args['crop'])) {
            $pices = explode(',', $args['crop']);
            $args['crop'] = array(
                'width'   => $pices[0],
                'height'  => $pices[1],
                'start_x' => $pices[2],
                'start_y' => $pices[3],
            );
        }

        // Convert area settings from string to array
        if (isset($args['area']) && !is_array($args['area'])) {
                $pices = explode(',', $args['area']);
                $args['area'] = array(
                    'top'    => $pices[0],
                    'right'  => $pices[1],
                    'bottom' => $pices[2],
                    'left'   => $pices[3],
                );
        }

        // Convert filter settings from array of string to array of array
        if (isset($args['filters']) && is_array($args['filters'])) {
            foreach ($args['filters'] as $key => $filterStr) {
                $parts = explode(',', $filterStr);
                $filter = $this->mapFilter($parts[0]);
                $filter['str'] = $filterStr;
                for ($i=1; $i<=$filter['argc']; $i++) {
                    if (isset($parts[$i])) {
                        $filter["arg{$i}"] = $parts[$i];
                    } else {
                        throw new Exception(
                            'Missing arg to filter, review how many arguments are needed at
                            http://php.net/manual/en/function.imagefilter.php'
                        );
                    }
                }
                $args['filters'][$key] = $filter;
            }
        }

        // Merge default arguments with incoming and set properties.
        //$args = array_merge_recursive($defaults, $args);
        $args = array_merge($defaults, $args);
        foreach ($defaults as $key => $val) {
            $this->{$key} = $args[$key];
        }

        if ($this->bgColor) {
            $this->setDefaultBackgroundColor($this->bgColor);
        }

        // Save original values to enable re-calculating
        $this->newWidthOrig  = $this->newWidth;
        $this->newHeightOrig = $this->newHeight;
        $this->cropOrig      = $this->crop;

        return $this;
    }
1206313
public function init($args = null){
		/*
		echo __METHOD__.__LINE__.'<br>'.PHP_EOL;
		echo __METHOD__.__LINE__.'get_class<pre>['.var_export(get_class($this), true).']</pre>'.'<br>'.PHP_EOL; 
		echo __METHOD__.__LINE__.'get_parent_class<pre>['.var_export(get_parent_class(__CLASS__), true).']</pre>'.'<br>'.PHP_EOL; 
		echo __METHOD__.__LINE__.'<br>'.PHP_EOL;
		echo __METHOD__.__LINE__.'get_class_methods<pre>['.var_export(get_class_methods($this), true).']</pre>'.'<br>'.PHP_EOL; 
		*/
		#parent::__construct($this->logConfig);
		
		$this->logConfig = $GLOBALS["CONFIG_MANAGER"]->getSetting('AUTH','AUDIT','CLIENT_LOG');
		
		parent::__construct($args);
		return;
	}
755990
protected function init_args($args)
    {
        parent::init_args($args);

        $this->env = $this->get_env_for_write_or_fail();
        $api = new Salts();

        try {
            $this->salts = $api->collect();
        } catch (Exception $e) {
            WP_CLI::error($e->getMessage());
        }
    }
809622
public function withArgs($args = [])
    {
        if (!is_array($args)) {
            $args = func_get_args();
        }

        $this->args = $args;
        return $this;
    }
564319
public function start($args = array())
    {
        $arg = $this->formatArgs($args);

        /**
         * Arguments and Options
         *
         */
        if (!empty($arg)) {
            $this->prepper
                 ->load($arg['task'])
                 ->loadParams($arg['params'])
                 ->prep($arg['action']);

            $this->dispatcher->setTaskName($arg['task']);
            $this->dispatcher->setActionName($arg['action']);
            $this->dispatcher->setParams($arg['params']);
        }

        $this->di->setShared('library', $this->library);
        $this->dispatcher->setDI($this->di);

        return $this->dispatcher->dispatch();
    }
1027858
public static function init($args=null) {
    if(is_null(self::$instance)) {
      self::$instance = new ErrorClass($args);
    }
    return self::$instance;
  }
1243147
public function start($args)
    {
        $this->_start = $this->_start ?: microtime(true);
        $this->_total = max(1, $args['total']);
    }
892616
public function setUnderConstruction(array $args = array()) {
        $enabled = empty($args) ? true : !in_array(current($args), array(0, false, 'false', '0'));
        Garp_Cli::lineOut(
            Zend_Registry::get('config')->app->name .
            ' is' . ($enabled ? '' : ' no longer') . ' under construction'
        );
        return Garp_Application::setUnderConstruction($enabled);
    }
1079347
public function handleInstall(Args $args)
    {
        $pluginClass = $args->getArgument('class');

        if ($this->manager->hasPluginClass($pluginClass)) {
            throw new RuntimeException(sprintf(
                'The plugin class "%s" is already installed.',
                $pluginClass
            ));
        }

        $this->manager->addPluginClass($pluginClass);

        return 0;
    }