public function __construct($instance) { parent::__construct($instance); // todo calling these to instatiate the classes $this->©db->prefix; $this->©db_table->tableName(); }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. */ public function __construct($instance) { parent::__construct($instance); $this->import_json_form_field_config = array('type' => 'file', 'required' => true, 'name' => $this->©action->input_name_for_call_arg(1), 'validation_patterns' => array(array('name' => 'json_file', 'description' => 'A valid `.json` file.', 'minimum' => 1, 'maximum' => 10485760, 'min_max_type' => 'file_size', 'regex' => '/\\.json$/i')), 'move_to_dir' => $this->©dir->temp()); $defaults = array('encryption.key' => '', 'support.url' => 'mailto:' . get_bloginfo('admin_email'), 'no_cache.headers.always' => '0', 'styles.front_side.load_by_default' => '0', 'styles.front_side.load_themes' => array(), 'styles.front_side.theme' => 'yeti', 'scripts.front_side.load_by_default' => '0', 'crons.config' => array(), 'menu_pages.theme' => 'yeti', 'menu_pages.panels.order' => array(), 'menu_pages.panels.state' => array(), 'ips.prioritize_remote_addr' => '0', 'captchas.google.public_key' => '6LeCANsSAAAAAIIrlB3FrXe42mr0OSSZpT0pkpFK', 'captchas.google.private_key' => '6LeCANsSAAAAAGBXMIKAirv6G4PmaGa-ORxdD-oZ', 'url_shortener.default_built_in_api' => 'goo_gl', 'url_shortener.custom_url_api' => '', 'url_shortener.api_keys.goo_gl' => '', 'templates.stand_alone.styles' => '<style type="text/css">' . "\n\n" . '</style>', 'templates.stand_alone.scripts' => '<script type="text/javascript">' . "\n\n" . '</script>', 'templates.stand_alone.bg_style' => 'background: #F2F1F0 url(\'' . $this->©string->esc_sq($this->©url->to_template_dir_file('client-side/images/stand-alone-bg.png')) . '\') repeat left top;', 'templates.stand_alone.header' => '<a href="' . esc_attr($this->©url->to_wp_home_uri()) . '"><img class="logo" src="' . esc_attr($this->©url->to_template_dir_file('client-side/images/stand-alone-logo.png')) . '" alt="" /></a>', 'templates.stand_alone.footer' => '', 'templates.email.header' => '', 'templates.email.footer' => '', 'users.registration.display_name_format' => 'first_name', 'mail.smtp' => '0', 'mail.smtp.force_from' => '0', 'mail.smtp.from_name' => get_bloginfo('name'), 'mail.smtp.from_addr' => get_bloginfo('admin_email'), 'mail.smtp.host' => '', 'mail.smtp.port' => '0', 'mail.smtp.secure' => '', 'mail.smtp.username' => '', 'mail.smtp.password' => '', 'plugin_site.username' => '', 'plugin_site.password' => '', 'menu_pages.panels.email_updates.action_url' => 'http://websharks-inc.us1.list-manage.com/subscribe/post?u=8f347da54d66b5298d13237d9&id=65240782e2', 'menu_pages.panels.community_forum.feed_url' => 'http://wordpress.org/support/rss', 'menu_pages.panels.news_kb.feed_url' => 'http://make.wordpress.org/core/feed/', 'menu_pages.panels.videos.yt_playlist' => 'PLBmUTJGsRqNKM--kwBeKJY9wOT-n7OhnC', 'packages.active' => array(), 'log' => array(), 'edd.update' => 0, 'edd.store_url' => '', 'edd_license' => '', 'edd.license.status' => 0, 'edd.demo' => 0, 'edd.demo_start' => 0, 'edd.demo_duration' => 604800); $validators = array('encryption.key' => array('string:!empty'), 'support.url' => array('string:!empty'), 'no_cache.headers.always' => array('string:numeric >=' => 0), 'styles.front_side.load_by_default' => array('string:numeric >=' => 0), 'styles.front_side.load_themes' => array('array'), 'styles.front_side.theme' => array('string:!empty'), 'scripts.front_side.load_by_default' => array('string:numeric >=' => 0), 'crons.config' => array('array:!empty'), 'menu_pages.theme' => array('string:!empty'), 'menu_pages.panels.order' => array('array:!empty'), 'menu_pages.panels.state' => array('array:!empty'), 'ips.prioritize_remote_addr' => array('string:numeric >=' => 0), 'captchas.google.public_key' => array('string:!empty'), 'captchas.google.private_key' => array('string:!empty'), 'url_shortener.default_built_in_api' => array('string:in_array' => array('tiny_url', 'goo_gl')), 'url_shortener.custom_url_api' => array('string:preg_match' => '/^https?\\:/i'), 'url_shortener.api_keys.goo_gl' => array('string:!empty'), 'templates.stand_alone.styles' => array('string'), 'templates.stand_alone.scripts' => array('string'), 'templates.stand_alone.bg_style' => array('string'), 'templates.stand_alone.header' => array('string'), 'templates.stand_alone.footer' => array('string'), 'templates.email.header' => array('string'), 'templates.email.footer' => array('string'), 'users.registration.display_name_format' => array('string:!empty'), 'mail.smtp' => array('string:numeric >=' => 0), 'mail.smtp.force_from' => array('string:numeric >=' => 0), 'mail.smtp.from_name' => array('string:!empty'), 'mail.smtp.from_addr' => array('string:!empty'), 'mail.smtp.host' => array('string:!empty'), 'mail.smtp.port' => array('string:numeric >=' => 1), 'mail.smtp.secure' => array('string:in_array' => array('ssl', 'tls')), 'mail.smtp.username' => array('string:!empty'), 'mail.smtp.password' => array('string:!empty'), 'plugin_site.username' => array('string:!empty'), 'plugin_site.password' => array('string:!empty'), 'menu_pages.panels.email_updates.action_url' => array('string:!empty'), 'menu_pages.panels.community_forum.feed_url' => array('string:!empty'), 'menu_pages.panels.news_kb.feed_url' => array('string:!empty'), 'menu_pages.panels.videos.yt_playlist' => array('string:!empty'), 'packages.active' => array('array'), 'log' => array('array'), 'edd.update' => array('string:numeric >=' => 0, 'string:numeric <=' => 1), 'edd.store_url' => array('string'), 'edd_license' => array('string'), 'edd.license.status' => array('string:numeric >=' => 0, 'string:numeric <=' => 1), 'edd.demo' => array('string:numeric >=' => 0, 'string:numeric <=' => 1), 'edd.demo_start' => array('string:numeric >=' => 0), 'edd.demo_duration' => array('string:numeric >=' => 0)); $this->setup($defaults, $validators); }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If invalid types are passed through arguments list. */ public function __construct($instance) { parent::__construct($instance); if (!isset($GLOBALS['wpdb']) || !$GLOBALS['wpdb'] instanceof \wpdb) { throw $this->©exception($this->method(__FUNCTION__) . '#wpdb_missing', get_defined_vars(), $this->__('Missing WordPress® database class instance.')); } $this->wpdb = $GLOBALS['wpdb']; }
/** * @param array|\xd_v141226_dev\framework $instance * @param int $posts_to_display * @param int $offset * @param string $rate_by * @param string $sort_by * @param float $entropy * * @throws \exception */ public function __construct($instance, $posts_to_display = 6, $offset = 0, $rate_by = 'c', $sort_by = 'ddrd', $entropy = 0.0) { parent::__construct($instance); $this->defaults = array('posts_to_display' => 6, 'offset' => 0, 'sort_by' => 'ddrd', 'entropy' => 0.0, 'rate_by' => 'c'); $this->posts_to_display = (int) $posts_to_display; $this->offset = (int) $offset; $this->sort_by = esc_sql($sort_by); $this->entropy = (double) $entropy; $this->rate_by = esc_sql($rate_by); }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If this class is instantiated before the `init` action hook. */ public function __construct($instance) { parent::__construct($instance); if (!did_action('init')) { throw $this->©exception($this->method(__FUNCTION__) . '#init', NULL, $this->__('Doing it wrong (the `init` hook has NOT been fired yet).')); } $scripts_to_register = array(); // Initialize scripts. // Core libs; available in all contexts. if (!wp_script_is($this->instance->core_ns_with_dashes, 'registered')) { $scripts_to_register[$this->instance->core_ns_with_dashes] = array('deps' => array('jquery'), 'url' => $this->©url->to_core_dir_file('/client-side/scripts/core-libs.min.js'), 'ver' => $this->instance->core_version_with_dashes, 'localize' => array('instance__failure' => $this->__('Could NOT get instance config value for key: `%1$s`.'), 'verifier__failure' => $this->__('Could NOT get verifier for key: `%1$s`.'), '____failure' => $this->__('Could NOT get translation string for key: `%1$s`.'), 'core_only_failure' => $this->__('Only the core may call upon: `%1$s`.'), 'view_source__doc_title' => $this->_x('Source'), 'win_open__turn_off_popup_blockers' => $this->_x('Please turn off all popup blockers and try again.'), 'ajax__invalid_type' => $this->__('Invalid `type`. Expecting `$$.___public_type|$$.___protected_type|$$.___private_type`.'), 'check_arg_types__empty' => $this->__('empty'), 'check_arg_types__caller' => $this->__('caller'), 'validate_form__required_field' => $this->_x('This is a required field.'), 'validate_form__mismatch_fields' => $this->_x('Mismatch (please check these fields).'), 'validate_form__unique_field' => $this->_x('Please try again (this value MUST be unique please).'), 'validate_form__required_select_at_least_one' => $this->_x('Please select at least 1 option.'), 'validate_form__required_select_at_least' => $this->_x('Please select at least %1$s options.'), 'validate_form__required_file' => $this->_x('A file MUST be selected please.'), 'validate_form__required_file_at_least_one' => $this->_x('Please select at least one file.'), 'validate_form__required_file_at_least' => $this->_x('Please select at least %1$s files.'), 'validate_form__required_radio' => $this->_x('Please choose one of the available options.'), 'validate_form__required_checkbox' => $this->_x('This box MUST be checked please.'), 'validate_form__required_check_at_least_one' => $this->_x('Please check at least one box.'), 'validate_form__required_check_at_least' => $this->_x('Please check at least %1$s boxes.'), 'validate_form__validation_description_prefix' => $this->_x('<strong>REQUIRES:</strong>'), 'validate_form__or_validation_description_prefix' => $this->_x('<strong>OR:</strong>'), 'validate_form__check_issues_below' => $this->_x('<strong>ERROR:</strong> please check the issues below.'), 'check_arg_types__diff_object_type' => $this->__('[a different object type]'), 'check_arg_types__missing_args' => $this->__('Missing required argument(s); `%1$s` requires `%2$s`, `%3$s` given.'), 'check_arg_types__invalid_arg' => $this->__('Argument #%1$s passed to `%2$s` requires `%3$s`, %4$s`%5$s` given.'), 'password_strength_status__empty' => $this->_x('password strength indicator'), 'password_strength_status__short' => $this->_x('too short (6 character minimum)'), 'password_strength_status__weak' => $this->_x('weak (mix caSe, numbers & symbols)'), 'password_strength_status__good' => $this->_x('good (reasonably strong)'), 'password_strength_status__strong' => $this->_x('very strong'), 'password_strength_status__mismatch' => $this->_x('mismatch'))); } // Front-side components; available in all contexts. $this->front_side_components = $this->front_side_components(); if ($front_side_file = $this->©file->template('/client-side/scripts/front-side.min.js', TRUE)) { $this->front_side_components[] = $this->instance->plugin_root_ns_with_dashes . '--front-side'; $scripts_to_register[$this->instance->plugin_root_ns_with_dashes . '--front-side'] = array('deps' => array($this->instance->core_ns_with_dashes), 'url' => $this->©url->to_wp_abs_dir_file($front_side_file), 'ver' => $this->instance->plugin_version_with_dashes); } else { $this->front_side_components = array_merge($this->front_side_components, array($this->instance->core_ns_with_dashes)); } // Stand-alone components; available in all contexts (depends on front-side). $this->stand_alone_components = $this->stand_alone_components(); if ($stand_alone_file = $this->©file->template('client-side/scripts/stand-alone.min.js', TRUE)) { $this->stand_alone_components[] = $this->instance->plugin_root_ns_with_dashes . '--stand-alone'; $scripts_to_register[$this->instance->plugin_root_ns_with_dashes . '--stand-alone'] = array('deps' => $this->front_side_components, 'url' => $this->©url->to_wp_abs_dir_file($stand_alone_file), 'ver' => $this->instance->plugin_version_with_dashes); } else { $this->stand_alone_components = array_merge($this->stand_alone_components, $this->front_side_components); } // Menu page components; only if applicable. if ($is_plugin_page = $this->©menu_page->is_plugin_page()) { $this->menu_page_components = $this->menu_page_components(); $this->menu_page_components[] = $this->instance->core_ns_with_dashes . '--menu-pages'; if (!wp_script_is($this->instance->core_ns_with_dashes . '--menu-pages', 'registered')) { $scripts_to_register[$this->instance->core_ns_with_dashes . '--menu-pages'] = array('deps' => array($this->instance->core_ns_with_dashes), 'url' => $this->©url->to_core_dir_file('/client-side/scripts/menu-pages/menu-pages.min.js'), 'ver' => $this->instance->core_version_with_dashes); } } if ($scripts_to_register) { $this->register($scripts_to_register); } // Add data separately, as this might change for each plugin the core processes. $this->add_data($this->instance->core_ns_with_dashes, $this->_build_plugin_root_namespaces_for_core_inline_data()); $this->add_data($this->instance->core_ns_with_dashes, $this->_build_instance_for_core_inline_data()); $this->add_data($this->instance->core_ns_with_dashes, $this->_build_verifiers_for_core_inline_data()); if (in_array($this->instance->plugin_root_ns_with_dashes . '--front-side', $this->front_side_components, TRUE)) { $this->add_data($this->instance->plugin_root_ns_with_dashes . '--front-side', $this->build_front_side_inline_data()); } if (in_array($this->instance->plugin_root_ns_with_dashes . '--stand-alone', $this->stand_alone_components, TRUE)) { $this->add_data($this->instance->plugin_root_ns_with_dashes . '--stand-alone', $this->build_stand_alone_inline_data()); } if ($is_plugin_page) { $this->add_data($this->instance->core_ns_with_dashes . '--menu-pages', $this->build_menu_page_inline_data()); } }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If invalid types are passed through arguments list. */ public function __construct($instance) { parent::__construct($instance); // Construct instance. $this->option = $this->instance->plugin_root_ns_stub . '__db_cache'; if (!is_array($this->cache = get_option($this->option))) { delete_option($this->option); // Delete & recreate. add_option($this->option, $this->cache = array(), '', 'no'); // We do NOT want to autoload this option value, because that requires twice the memory. // If we allowed WordPress® to autoload this, it would also be stored into a cache by WordPress® under `alloptions`. } }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If GMP extension is not loaded up. */ public function __construct($instance) { parent::__construct($instance); if (!extension_loaded('gmp')) { throw $this->©exception($this->method(__FUNCTION__), get_defined_vars(), $this->__('GMP extension NOT loaded or unavailable.')); } $this->_0 = $this->resource($this->_0); // Converts to resource. $this->_1 = $this->resource($this->_1); // Converts to resource. $this->_2 = $this->resource($this->_2); // Converts to resource. }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If a request contains an expired action key. */ public function __construct($instance) { parent::__construct($instance); $_r = $this->©vars->_REQUEST(NULL, TRUE); // REQUEST (including files). if ($this->©array->is_not_empty($_r[$this->instance->plugin_var_ns]['a'])) { $this->action = $_r[$this->instance->plugin_var_ns]['a']; } else { if ($this->©string->is_not_empty($_r[$this->instance->plugin_var_ns . '_action'])) { if (strpos($_r[$this->instance->plugin_var_ns . '_action'], '.key.') !== FALSE) { $action_key = $_r[$this->instance->plugin_var_ns . '_action']; $action = $this->©db_utils->get_transient($action_key); if (!$this->©array->is_not_empty($action)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_or_expired_action_key', get_defined_vars(), sprintf($this->__('Invalid or expired action key: `%1$s`.'), $action_key)); } $this->action = $action; // Define action property. } else { // Treat the `action` as a slug (we construct an array from this). $this->action = array('s' => $_r[$this->instance->plugin_var_ns . '_action']); } } } }
/** * @param array|\xd_v141226_dev\framework $instance * * @throws \exception * @throws \xd_v141226_dev\exception */ public function __construct($instance) { parent::__construct($instance); $this->redirect_uri = $this->©option->get('redirect_uri'); }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If this class is instantiated before the `init` action hook. */ public function __construct($instance) { parent::__construct($instance); if (!did_action('init')) { throw $this->©exception($this->method(__FUNCTION__) . '#init', NULL, $this->__('Doing it wrong (the `init` hook has NOT been fired yet).')); } $themes = $this->themes(); $theme_keys = array_keys($themes); $styles_to_register = array(); // Initialize styles. // Core libs & themes; available in all contexts. if (!wp_style_is($this->instance->core_ns_with_dashes, 'registered')) { $styles_to_register[$this->instance->core_ns_with_dashes] = array('url' => $this->©url->to_core_dir_file('/client-side/styles/core-libs.min.css'), 'ver' => $this->instance->core_version_with_dashes); } foreach ($themes as $_theme => $_theme_file) { if (!wp_style_is($_theme, 'registered')) { $styles_to_register[$this->instance->core_ns_with_dashes . '--' . $_theme] = array('deps' => array($this->instance->core_ns_with_dashes), 'url' => $this->©url->to_wp_abs_dir_file($_theme_file), 'ver' => $this->instance->core_version_with_dashes); } } unset($_theme, $_theme_file); // A little housekeeping. // Front-side components (including themes); available in all contexts. $this->front_side_components = $this->front_side_components(); if (!in_array($current_front_side_theme = $this->©options->get('styles.front_side.theme'), $theme_keys, TRUE)) { $current_front_side_theme = $this->©options->get('styles.front_side.theme', TRUE); } $front_side_themes = array($this->instance->core_ns_with_dashes . '--' . $current_front_side_theme); foreach ($this->©options->get('styles.front_side.load_themes') as $_theme) { if (in_array($_theme, $theme_keys, TRUE)) { // Let's make sure it's a valid theme. $front_side_themes[] = $this->instance->core_ns_with_dashes . '--' . $_theme; } } $front_side_themes = array_unique($front_side_themes); unset($_theme); // Housekeeping. if ($front_side_file = $this->©file->template('client-side/styles/front-side.min.css', TRUE)) { $this->front_side_components[] = $this->instance->plugin_root_ns_with_dashes . '--front-side'; $styles_to_register[$this->instance->plugin_root_ns_with_dashes . '--front-side'] = array('deps' => array_merge(array($this->instance->core_ns_with_dashes), $front_side_themes), 'url' => $this->©url->to_wp_abs_dir_file($front_side_file), 'ver' => $this->instance->plugin_version_with_dashes); } else { $this->front_side_components = array_merge($this->front_side_components, array($this->instance->core_ns_with_dashes), $front_side_themes); } // Stand-alone components; available in all contexts (depends on front-side). $this->stand_alone_components = $this->stand_alone_components(); if ($stand_alone_file = $this->©file->template('client-side/styles/stand-alone.min.css', TRUE)) { $this->stand_alone_components[] = $this->instance->plugin_root_ns_with_dashes . '--stand-alone'; $styles_to_register[$this->instance->plugin_root_ns_with_dashes . '--stand-alone'] = array('deps' => $this->front_side_components, 'url' => $this->©url->to_wp_abs_dir_file($stand_alone_file), 'ver' => $this->instance->plugin_version_with_dashes); } else { $this->stand_alone_components = array_merge($this->stand_alone_components, $this->front_side_components); } // Menu page components; only if applicable. if ($this->©menu_page->is_plugin_page()) { $this->menu_page_components = $this->menu_page_components(); if (!in_array($current_menu_pages_theme = $this->©options->get('menu_pages.theme'), $theme_keys, TRUE)) { $current_menu_pages_theme = $this->©options->get('menu_pages.theme', TRUE); } $this->menu_page_components[] = $this->instance->core_ns_with_dashes . '--menu-pages'; // Only if NOT already registered by another XDaRk plugin (it should NOT be). if (!wp_style_is($this->instance->core_ns_with_dashes . '--menu-pages', 'registered')) { $styles_to_register[$this->instance->core_ns_with_dashes . '--menu-pages'] = array('deps' => array($this->instance->core_ns_with_dashes . '--' . $current_menu_pages_theme), 'url' => $this->©url->to_core_dir_file('/client-side/styles/menu-pages/menu-pages.min.css'), 'ver' => $this->instance->core_version_with_dashes); } } if ($styles_to_register) { $this->register($styles_to_register); } }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @param string $code Optional diagnostic code (to construct with a new diagnostic). * * @param mixed $data Optional diagnostic data (i.e. something to assist in reporting/logging). * This argument can be bypassed using a NULL value (that's fine). * * @param string $message Optional diagnostic message (if constructing with a new diagnostic). * * @param string $log Optional. This defaults to the value of {@link fw_constants::log_enable}. * This simply provides some additional control over which specific diagnostics will be logged (if any). * By default, we enable logging on a per-diagnostic basis. However, even if this is {@link fw_constants::log_enable}, * logging ONLY occurs if enabled overall (based on diagnostic type). Can also be set to {@link fw_constants::log_disable}. * * @throws exception If invalid types are passed through arguments list. */ public function __construct($instance, $code = '', $data = null, $message = '', $log = self::log_enable) { parent::__construct($instance); $this->check_arg_types('', 'string:!empty', '', 'string', 'string:!empty', func_get_args()); if (!empty($code)) { $this->add($code, $data, $message, $log); } }
/** * @param array|\xd_v141226_dev\framework $instance * * @throws \exception * @throws \xd_v141226_dev\exception */ public function __construct($instance) { parent::__construct($instance); $this->client_id = $this->©option->get('client_id'); $this->client_secret = $this->©option->get('client_secret'); }
/** * Constructor (initiates replication). * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @param string $into_dir Optional. Defaults to an empty string. * If this is supplied, the core will be replicated into this specific directory. * Else, the core will be replicated into a sub-directory of the local core repo directory. * * @param string $update_dir Optional. Defaults to an empty string. * Please use with EXTREME caution; this performs a MASSIVE search/replace routine. * If TRUE, all files inside `$update_dir` will be updated to match the version of the newly replicated core. * If FALSE, we simply update files in the new core directory; nothing more. * * @param string $version Optional. Defaults to an empty string. * By default, the version remains unchanged (e.g. it will NOT be updated by this routine). * If this is NOT empty, we will replicate the core as a specific version indicated by this value. * * @param array $exclusions Optional. An array of copy-to exclusions. Defaults to an empty array. * See: {@link dirs::copy_to()} for details about this parameter. * * @note Instantiation of this class will initiate the replication routine (please be VERY careful). * Property `$success` will contain a message indicating the final result status of the replication procedure. * If there is a failure, an exception is thrown by this class. We either succeed completely; or throw an exception. * * @throws exception If invalid types are passed through arguments list. * @throws exception If unable to replicate according to `$this->can_replicate`. * @throws exception See: `replicate()` method for further details. */ public function __construct($instance, $into_dir = '', $update_dir = '', $version = '', $exclusions = array()) { parent::__construct($instance); $this->check_arg_types('', 'string', 'string', 'string', 'array', func_get_args()); // Security check. Can we replicate here? if ($this->©env->is_cli() && $this->©plugin->is_core()) { if (defined('___REPLICATOR') && ___REPLICATOR || defined('___BUILDER') && ___BUILDER) { $this->can_replicate = TRUE; } } // We CAN replicate. if (!$this->can_replicate) { throw $this->©exception($this->method(__FUNCTION__) . '#cannot_replicate', get_defined_vars(), $this->__('Security check. Unable to replicate (not allowed here).')); } // Construct object properties. $this->core_dir = $this->instance->core_dir; $this->core_repo_dir = $this->instance->local_core_repo_dir; $this->into_dir = $into_dir ? $this->©dir->n_seps($into_dir) : $this->instance->local_core_repo_dir; $this->version = $version ? $version : $this->instance->core_version; $this->exclusions = $exclusions ? $exclusions : array(); $this->new_core_ns_version = $this->instance->core_ns_stub_v . $this->©string->with_underscores($this->version); $this->new_core_ns_version_with_dashes = $this->©string->with_dashes($this->new_core_ns_version); $this->new_core_dir = $this->into_dir . '/' . $this->new_core_ns_version_with_dashes; $this->update_dir = $update_dir ? $this->©dir->n_seps($update_dir) : $this->new_core_dir; // Validate object properties (among several other things). if (!is_dir($this->into_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_into_dir', get_defined_vars(), sprintf($this->__('Invalid directory: `%1$s`.'), $this->into_dir) . ' ' . $this->__('This is NOT an existing directory that we can replicate into.')); } if ($this->update_dir !== $this->new_core_dir && !is_dir($this->update_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_update_dir', get_defined_vars(), sprintf($this->__('Invalid directory: `%1$s`.'), $this->into_dir) . ' ' . $this->__('This is NOT an existing directory that we can update files in.')); } if (!$this->©string->is_plugin_version($this->version)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_version', get_defined_vars(), sprintf($this->__('Invalid %1$s version: `%2$s`.'), $this->instance->core_name, $this->version)); } // Object construction & initial validation complete. $this->success = $this->replicate(); // Process replication routines. }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @throws exception If invalid types are passed through arguments list. */ public function __construct($instance) { parent::__construct($instance); // Construct instance. $this->sass = 'sass --cache-location=' . escapeshellarg($this->©dir->temp() . '/.sass-cache'); }
/** * Constructor (initiates build). * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @param string $plugin_dir Optional. Defaults to an empty string. * By default, we build the XDaRk Core. If supplied, we will build a specific plugin. * @param string $plugin_name Defaults to an empty string. Required only if `$plugin_dir` is passed also. * @param string $plugin_root_ns Defaults to an empty string. Required only if `$plugin_dir` is passed also. * @param string $distros_dir Optional. Defaults to an empty string. Required only if `$plugin_dir` is passed also. * @param string $downloads_dir Optional. Defaults to an empty string. Required only if `$plugin_dir` is passed also. * * @param string $version Optional. Defaults to a value of `$this->©date->i18n_utc('ymd')`. * Must be valid. See: {@link \xd_v141226_dev::$regex_valid_plugin_version} * * @param string $requires_at_least_apache_version Optional. Defaults to the oldest version tested by the XDaRk Core. * @param string $tested_up_to_apache_version Optional. Defaults to the newest version tested by the XDaRk Core. * * @param string $requires_at_least_php_version Optional. Defaults to the oldest version tested by the XDaRk Core. * @param string $tested_up_to_php_version Optional. Defaults to the newest version tested by the XDaRk Core. * * @param string $requires_at_least_wp_version Optional. Defaults to the oldest version tested by the XDaRk Core. * @param string $tested_up_to_wp_version Optional. Defaults to the newest version tested by the XDaRk Core. * * @param null|string $use_core_type Defaults to `directory`. Can be: `directory`, `phar`, or `stub`. * This is ONLY applicable to plugin builds. If building the core itself; this parameter is ignored completely. * * @param string $build_from_core_version Optional. This is partially ignored here. It is handled mostly by `/._dev-utilities/builder.php`. * However, what DO still use it here (if it's passed in); to some extent. If this is passed in, we will verify the current core version. * If `$build_from_core_version` is passed in, but it does NOT match this version of the core; an exception will be thrown. * * @note Instantiation of this class will initiate the build routine (please be VERY careful). * Property `$successes` will contain messages indicating the final result status of the build procedure. * If there is a failure, an exception is thrown by this class. We either succeed completely; or throw an exception. * * @throws exception If invalid types are passed through arguments list. * @throws exception If unable to build according to `$this->can_build` property value. * @throws exception If any parameter values are invalid; based on extensive validation in this class. * @throws exception If a build fails for any reason. See: `build()` method for further details. */ public function __construct($instance, $plugin_dir = '', $plugin_name = '', $plugin_root_ns = '', $distros_dir = '', $downloads_dir = '', $version = '', $requires_at_least_apache_version = '', $tested_up_to_apache_version = '', $requires_at_least_php_version = '', $tested_up_to_php_version = '', $requires_at_least_wp_version = '', $tested_up_to_wp_version = '', $use_core_type = '', $build_from_core_version = '') { parent::__construct($instance); $this->check_arg_types('', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', func_get_args()); // Security check. Can we build here? if ($this->©env->is_cli() && $this->©plugin->is_core()) { if (defined('___BUILDER') && ___BUILDER) { $this->can_build = TRUE; } } if (!$this->can_build) { throw $this->©exception($this->method(__FUNCTION__) . '#cannot_build', get_defined_vars(), $this->__('Security check. Unable to build (not allowed here).')); } // Construct object properties. $this->core_repo_dir = $this->instance->local_core_repo_dir; $this->core_dir = $this->instance->core_dir; $this->plugin_dir = $plugin_dir ? $this->©dir->n_seps($plugin_dir) : ''; $this->plugin_repo_dir = $plugin_dir ? $this->©dir->n_seps_up($plugin_dir) : ''; $this->plugin_name = $plugin_dir && $plugin_name ? $plugin_name : ''; $this->plugin_root_ns = $plugin_dir && $plugin_root_ns ? $plugin_root_ns : ''; $this->distros_dir = $plugin_dir && $distros_dir ? $this->©dir->n_seps($distros_dir) : ''; $this->downloads_dir = $plugin_dir && $downloads_dir ? $this->©dir->n_seps($downloads_dir) : ''; $this->version = $version ? (string) $version : $this->©date->i18n_utc('ymd'); $this->requires_at_least_apache_version = $requires_at_least_apache_version ? $requires_at_least_apache_version : $this->requires_at_least_apache_version; $this->tested_up_to_apache_version = $tested_up_to_apache_version ? $tested_up_to_apache_version : $this->tested_up_to_apache_version; $this->requires_at_least_php_version = $requires_at_least_php_version ? $requires_at_least_php_version : $this->requires_at_least_php_version; $this->tested_up_to_php_version = $tested_up_to_php_version ? $tested_up_to_php_version : $this->tested_up_to_php_version; $this->requires_at_least_wp_version = $requires_at_least_wp_version ? $requires_at_least_wp_version : $this->requires_at_least_wp_version; $this->tested_up_to_wp_version = $tested_up_to_wp_version ? $tested_up_to_wp_version : $this->tested_up_to_wp_version; $this->use_core_type = $use_core_type ? $use_core_type : $this->use_core_type; $this->build_from_core_version = $build_from_core_version ? $build_from_core_version : $this->©command->git_latest_plugin_stable_version_branch($this->core_repo_dir); // Validate object properties (among several other things). if (!$this->core_repo_dir || !is_dir($this->core_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#nonexistent_core_repo_dir', get_defined_vars(), sprintf($this->__('Nonexistent core repo directory: `%1$s`.'), $this->core_repo_dir)); } if (!is_readable($this->core_repo_dir) || !is_writable($this->core_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#core_repo_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with core repo directory: `%1$s`.'), $this->core_dir)); } if (!is_file($this->core_repo_dir . '/.gitignore')) { throw $this->©exception($this->method(__FUNCTION__) . '#core_repo_dir_gitignore', get_defined_vars(), sprintf($this->__('Core repo directory is missing this file: `%1$s`.'), $this->core_repo_dir . '/.gitignore')); } if (!$this->core_dir || !is_dir($this->core_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#nonexistent_core_dir', get_defined_vars(), sprintf($this->__('Nonexistent core directory: `%1$s`.'), $this->core_dir)); } if (!is_readable($this->core_dir) || !is_writable($this->core_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#core_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with core directory: `%1$s`.'), $this->core_dir)); } if ($this->plugin_dir) { if (!is_dir($this->plugin_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#nonexistent_plugin_dir', get_defined_vars(), sprintf($this->__('Nonexistent plugin directory: `%1$s`.'), $this->plugin_dir)); } if (!is_readable($this->plugin_dir) || !is_writable($this->plugin_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with plugin directory: `%1$s`.'), $this->plugin_dir)); } if (!$this->plugin_repo_dir || !is_dir($this->plugin_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#nonexistent_plugin_repo_dir', get_defined_vars(), sprintf($this->__('Nonexistent plugin repo directory: `%1$s`.'), $this->plugin_repo_dir)); } if (!is_readable($this->plugin_repo_dir) || !is_writable($this->plugin_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_repo_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with plugin repo directory: `%1$s`.'), $this->plugin_repo_dir)); } if (!is_file($this->plugin_repo_dir . '/.gitignore')) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_repo_dir_gitignore', get_defined_vars(), sprintf($this->__('Plugin repo directory is missing this file: `%1$s`.'), $this->plugin_repo_dir . '/.gitignore')); } if (!$this->plugin_name) { throw $this->©exception($this->method(__FUNCTION__) . '#missing_plugin_name', get_defined_vars(), sprintf($this->__('Missing plugin name for: `%1$s`.'), $this->plugin_dir)); } if (!$this->plugin_root_ns) { throw $this->©exception($this->method(__FUNCTION__) . '#missing_plugin_root_ns', get_defined_vars(), sprintf($this->__('Missing plugin root namespace for: `%1$s`.'), $this->plugin_dir)); } if (!$this->distros_dir || !is_dir($this->distros_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#nonexistent_distros_dir', get_defined_vars(), sprintf($this->__('Nonexistent distros directory: `%1$s`.'), $this->distros_dir)); } if (!is_readable($this->distros_dir) || !is_writable($this->distros_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#distros_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with distros directory: `%1$s`.'), $this->distros_dir)); } if (!$this->downloads_dir || !is_dir($this->downloads_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#nonexistent_downloads_dir', get_defined_vars(), sprintf($this->__('Nonexistent downloads directory: `%1$s`.'), $this->downloads_dir)); } if (!is_readable($this->downloads_dir) || !is_writable($this->downloads_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#downloads_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with downloads directory: `%1$s`.'), $this->downloads_dir)); } $_plugins_dir = $this->©dir->n_seps_up($this->plugin_dir, 2); $_possible_pro_repo_dir = $_plugins_dir . '/' . basename($this->plugin_dir) . '-pro'; $_possible_pro_dir = $_possible_pro_repo_dir . '/' . basename($this->plugin_dir) . '-pro'; if (is_dir($_possible_pro_repo_dir) && !is_dir($_possible_pro_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#missing_plugin_pro_dir', get_defined_vars(), sprintf($this->__('Missing plugin pro directory here: `%1$s`.'), $_possible_pro_dir)); } if (is_dir($_possible_pro_dir)) { $this->plugin_pro_dir = $_possible_pro_dir; $this->plugin_pro_repo_dir = $_possible_pro_repo_dir; } unset($_plugins_dir, $_possible_pro_repo_dir, $_possible_pro_dir); if ($this->plugin_pro_dir) { if (!is_readable($this->plugin_pro_dir) || !is_writable($this->plugin_pro_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_pro_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with plugin pro directory: `%1$s`.'), $this->plugin_pro_dir)); } if (!is_readable($this->plugin_pro_repo_dir) || !is_writable($this->plugin_pro_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_pro_repo_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with plugin pro repo directory: `%1$s`.'), $this->plugin_pro_repo_dir)); } if (!is_file($this->plugin_pro_repo_dir . '/.gitignore')) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_pro_repo_dir_gitignore', get_defined_vars(), sprintf($this->__('Plugin pro directory is missing this file: `%1$s`.'), $this->plugin_pro_repo_dir . '/.gitignore')); } } if (is_dir($this->plugin_dir . '-extras')) { $this->plugin_extras_dir = $this->plugin_dir . '-extras'; } if ($this->plugin_extras_dir) { if (!is_readable($this->plugin_extras_dir) || !is_writable($this->plugin_extras_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#plugin_extras_dir_permissions', get_defined_vars(), sprintf($this->__('Permission issues with plugin extras directory: `%1$s`.'), $this->plugin_extras_dir)); } } } // Validate all version strings now. if (!$this->©string->is_plugin_version($this->version)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_version', get_defined_vars(), sprintf($this->__('Invalid version string: `%1$s`.'), $this->version)); } if (!$this->©string->is_version($this->requires_at_least_php_version)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_requires_at_least_php_version', get_defined_vars(), sprintf($this->__('Invalid `Requires at least` PHP version string: `%1$s`.'), $this->requires_at_least_php_version)); } if (!$this->©string->is_version($this->tested_up_to_php_version)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_tested_up_to_php_version', get_defined_vars(), sprintf($this->__('Invalid `Tested up to` PHP version string: `%1$s`.'), $this->tested_up_to_php_version)); } if (!$this->©string->is_version($this->requires_at_least_wp_version)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_requires_at_least_wp_version', get_defined_vars(), sprintf($this->__('Invalid `Requires at least` WP version string: `%1$s`.'), $this->requires_at_least_wp_version)); } if (!$this->©string->is_version($this->tested_up_to_wp_version)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_tested_up_to_wp_version', get_defined_vars(), sprintf($this->__('Invalid `Tested up to` WP version string: `%1$s`.'), $this->tested_up_to_wp_version)); } // Validate core type. if (!in_array($this->use_core_type, array('directory', 'phar', 'stub', 'submodule'), TRUE)) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_core_type', get_defined_vars(), sprintf($this->__('Invalid core type: `%1$s`.'), $this->use_core_type)); } // Validate core version that we're supposed to be building from. if ($this->build_from_core_version !== $this->instance->core_version) { throw $this->©exception($this->method(__FUNCTION__) . '#invalid_build_from_core_version', get_defined_vars(), sprintf($this->__('Building from incorrect core version: `%1$s`.'), $this->build_from_core_version) . ' ' . sprintf($this->__('This is version `%1$s` of the %2$s.'), $this->instance->core_version, $this->instance->core_name)); } // Determine starting branches; also check for uncommitted changes and/or untracked files. $this->starting_branches['core'] = $this->©command->git_current_branch($this->core_repo_dir); if ($this->©command->git_changes_exist($this->core_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#changes_exist_in_core_repo_dir', get_defined_vars(), sprintf($this->__('Changes exist on core branch/version: `%1$s`.'), $this->starting_branches['core']) . ' ' . $this->__('Please commit changes and/or resolve untracked files on the starting branch/version before building.')); } if ($this->plugin_dir) { $this->starting_branches['plugin'] = $this->©command->git_current_branch($this->plugin_repo_dir); if ($this->©command->git_changes_exist($this->plugin_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#changes_exist_in_plugin_repo_dir', get_defined_vars(), sprintf($this->__('Changes exist on plugin branch/version: `%1$s`.'), $this->starting_branches['plugin']) . ' ' . $this->__('Please commit changes and/or resolve untracked files on the starting branch/version before building.')); } } if ($this->plugin_dir && $this->plugin_pro_dir) { $this->starting_branches['plugin_pro'] = $this->©command->git_current_branch($this->plugin_pro_repo_dir); if ($this->©command->git_changes_exist($this->plugin_pro_repo_dir)) { throw $this->©exception($this->method(__FUNCTION__) . '#changes_exist_in_plugin_repo_dir', get_defined_vars(), sprintf($this->__('Changes exist on plugin pro branch/version: `%1$s`.'), $this->starting_branches['plugin_pro']) . ' ' . $this->__('Please commit changes and/or resolve untracked files on the starting branch/version before building.')); } } // Object construction & initial validation complete. $this->successes = $this->build(); // Process build routines. }
public function __construct($instance) { parent::__construct($instance); $customPostTypes = get_post_types(array('_builtin' => false), 'names', 'and'); $this->_postTypeValidOptions = array_merge($this->_postTypeValidOptions, (array) $customPostTypes); $this->setDefaults(); }
/** * @param array|framework $instance * * @throws \exception */ function __construct($instance) { parent::__construct($instance); }
public function __construct($instance) { parent::__construct($instance); // todo remove //$this->init(); }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @param array $properties Optional array of properties to set upon construction. * * @throws exception If invalid types are passed through arguments list. */ public function __construct($instance, $properties = array()) { parent::__construct($instance); $this->check_arg_types('', 'array', func_get_args()); if ($properties) { $this->set_properties($properties); } $this->defaults['name_prefix'] = $this->name_prefix; $this->defaults['id_prefix'] = $this->id_prefix; $this->defaults['use_update_marker'] = $this->use_update_markers; if ($this->for_call) { // For a specific call action? $this->is_action_for_call = $this->©action->is_call($this->for_call); } $this->spl_object_hash = spl_object_hash($this); }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @param string $file Template file name (relative path). * * @param array|object $data Optional array (or object) containing custom data, specifically for this template. * Or (if there is no data) an errors/successes/messages object instance can be passed directly through this argument value. * * • Incoming `$data` will always be objectified by one dimension (e.g. we force object properties). * * • If we have data AND `errors|successes|messages`, the data (along with `errors|successes|messages`) * can be passed into this constructor by adding the object instance(s) for `errors|successes|messages` to `$data`, * with array keys (or object property names) matching `errors`, `successes`, `messages` (when/if applicable). * * • If a user object instance is passed through `$data` w/ the array key (or property name) `user`; * the `user` value is parsed with `$this->©user_utils->which()`; allowing variations supported by this utility. * * @param string $theme Optional. Defaults to an empty string. * If this is passed in, a specific UI theme will be forced into play. * * @throws exception If invalid types are passed through arguments list. * @throws exception If `$file` is empty, or it CANNOT be located by `$this->©file->template()`. */ public function __construct($instance, $file, $data = array(), $theme = '') { parent::__construct($instance); $this->check_arg_types('', 'string:!empty', array('array', 'object'), 'string', func_get_args()); $this->file = $file; // Template file name (relative path). $this->data = $this->parse_data($data); // Supports all possible scenarios. $this->theme = $theme ? $theme : $this->©options->get('styles.front_side.theme'); if (!in_array($this->theme, array_keys($this->©styles->themes()), TRUE)) { $this->theme = $this->©options->get('styles.front_side.theme', TRUE); } $this->©plugin->needs_front_side_styles_scripts(TRUE, $this->theme); $this->content = $this->parse_content(); // Parses content in this template file. }
/** * User object constructor. Please read carefully. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @param null|integer $user_id Defaults to NULL. A specific user? * If this and `$by`, `$value` are all NULL, we construct an instance for the current user. * * @param null|string $by Search for a user, by a particular type of value? * For further details, please see {@link user_utils::get_id_by()}. * * @param null|string|integer|array $value A value to search for (e.g. username(s), email address(es), ID(s)). * For further details, please see {@link user_utils::get_id_by()}. * * @param array $default_properties Optional. Defaults to an empty array. * Passed to {@link populate()} to establish some default properties before population attempts take place. * This can be useful if reconstructing an object for a user that does NOT have an ID (as one example). * See also {@link $data}. It IS possible to define custom {@link $data} keys w/ this parameter. * * @throws exception If invalid types are passed through arguments list. * @throws exception If `$default_properties` contains invalid data types. * @throws exception If `$default_properties` contains undefined property keys. */ public function __construct($instance, $user_id = NULL, $by = NULL, $value = NULL, $default_properties = array()) { parent::__construct($instance); // Parent constructor. $this->check_arg_types('', array('null', 'integer'), array('null', 'string:!empty'), array('null', 'string:!empty', 'integer:!empty', 'array:!empty'), 'array', func_get_args()); if (!did_action('set_current_user')) { throw $this->©exception($this->method(__FUNCTION__) . '#set_current_user', array_merge(get_defined_vars(), array('user' => $this)), $this->__('Doing it wrong (the `set_current_user` hook has NOT been fired yet).')); } if ($user_id && $user_id < 0) { $by = $value = NULL; } // Nullify. $this->args = array('user_id' => $user_id, 'by' => $by, 'value' => $value, 'default_properties' => $default_properties); if (!isset($user_id) && !isset($by) && !isset($value)) { if (($_wp = wp_get_current_user()) && !empty($_wp->ID)) { $this->wp = $_wp; $this->ID = $_wp->ID; } $this->is_current_default = TRUE; } else { if ($user_id && $user_id < 0) { $this->ID = 0; $this->wp = NULL; $this->is_no_user = TRUE; } else { if ($user_id && ($_wp = new \WP_User($user_id)) && !empty($_wp->ID)) { $this->wp = $_wp; $this->ID = $_wp->ID; } else { if ($by && $value && strtolower($by) === 'id' && is_numeric($value) && ($_wp = new \WP_User((int) $value)) && !empty($_wp->ID)) { $this->wp = $_wp; $this->ID = $_wp->ID; } else { if ($by && $value && ($_id_by = $this->©user_utils->get_id_by($by, $value)) && ($_wp = new \WP_User($_id_by)) && !empty($_wp->ID)) { $this->wp = $_wp; $this->ID = $_wp->ID; } } } } } // Else by default this instance has no ID (all default properties). // This is NOT the same as having NO user (explicitly) via `-1`; which identifies this instance // as having been purposely instantiated for such a purpose (e.g. to indicate NO user explicitly). if ($this->ID && (!$this->wp || !$this->wp->user_email || !$this->wp->user_login || !$this->wp->user_nicename)) { $this->©error($this->method(__FUNCTION__), array_merge(get_defined_vars(), array('user' => $this)), sprintf($this->__('User ID: `%1$s` is missing vital components.'), $this->ID) . ' ' . $this->__('Possible database corruption.')); $this->wp = NULL; $this->ID = 0; } unset($_wp, $_id_by); // Housekeeping. $this->populate(); // Populate (if possible). }
/** * Constructor. * * @param object|array $instance Required at all times. * A parent object instance, which contains the parent's `$instance`, * or a new `$instance` array. * * @extenders Other properties should be set by class extenders. * * @throws exception If invalid types are passed through arguments list. */ public function __construct($instance) { parent::__construct($instance); // Other properties should be set by class extenders. $this->prefix = $this->prefix(); }