_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q256700 | Service.setEndpoints | test | public function setEndpoints($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Endpoint::class);
$this->endpoints = $arr;
return $this;
} | php | {
"resource": ""
} |
q256701 | Service.setLogs | test | public function setLogs($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\LogDescriptor::class);
$this->logs = $arr;
return $this;
} | php | {
"resource": ""
} |
q256702 | Service.setMetrics | test | public function setMetrics($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricDescriptor::class);
$this->metrics = $arr;
return $this;
} | php | {
"resource": ""
} |
q256703 | BadRequest.setFieldViolations | test | public function setFieldViolations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\BadRequest\FieldViolation::class);
$this->field_violations = $arr;
return $this;
} | php | {
"resource": ""
} |
q256704 | ListOperationsResponse.setOperations | test | public function setOperations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\LongRunning\Operation::class);
$this->operations = $arr;
return $this;
} | php | {
"resource": ""
} |
q256705 | ListRolesRequest.setView | test | public function setView($var)
{
GPBUtil::checkEnum($var, \Google\Iam\Admin\V1\RoleView::class);
$this->view = $var;
return $this;
} | php | {
"resource": ""
} |
q256706 | Role.setIncludedPermissions | test | public function setIncludedPermissions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->included_permissions = $arr;
return $this;
} | php | {
"resource": ""
} |
q256707 | Role.setStage | test | public function setStage($var)
{
GPBUtil::checkEnum($var, \Google\Iam\Admin\V1\Role_RoleLaunchStage::class);
$this->stage = $var;
return $this;
} | php | {
"resource": ""
} |
q256708 | Billing.setConsumerDestinations | test | public function setConsumerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Billing\BillingDestination::class);
$this->consumer_destinations = $arr;
return $this;
} | php | {
"resource": ""
} |
q256709 | HttpBody.setExtensions | test | public function setExtensions($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class);
$this->extensions = $arr;
return $this;
} | php | {
"resource": ""
} |
q256710 | Authentication.setProviders | test | public function setProviders($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthProvider::class);
$this->providers = $arr;
return $this;
} | php | {
"resource": ""
} |
q256711 | ContextRule.setRequested | test | public function setRequested($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->requested = $arr;
return $this;
} | php | {
"resource": ""
} |
q256712 | ContextRule.setProvided | test | public function setProvided($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->provided = $arr;
return $this;
} | php | {
"resource": ""
} |
q256713 | Explicit.setBounds | test | public function setBounds($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::DOUBLE);
$this->bounds = $arr;
return $this;
} | php | {
"resource": ""
} |
q256714 | UpdateRoleRequest.setRole | test | public function setRole($var)
{
GPBUtil::checkMessage($var, \Google\Iam\Admin\V1\Role::class);
$this->role = $var;
return $this;
} | php | {
"resource": ""
} |
q256715 | Page.setSubpages | test | public function setSubpages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class);
$this->subpages = $arr;
return $this;
} | php | {
"resource": ""
} |
q256716 | ListServiceAccountKeysRequest.setKeyTypes | test | public function setKeyTypes($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Iam\Admin\V1\ListServiceAccountKeysRequest\KeyType::class);
$this->key_types = $arr;
return $this;
} | php | {
"resource": ""
} |
q256717 | PostalAddress.setRecipients | test | public function setRecipients($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->recipients = $arr;
return $this;
} | php | {
"resource": ""
} |
q256718 | DebugInfo.setStackEntries | test | public function setStackEntries($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->stack_entries = $arr;
return $this;
} | php | {
"resource": ""
} |
q256719 | Monitoring.setProducerDestinations | test | public function setProducerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class);
$this->producer_destinations = $arr;
return $this;
} | php | {
"resource": ""
} |
q256720 | Monitoring.setConsumerDestinations | test | public function setConsumerDestinations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Monitoring\MonitoringDestination::class);
$this->consumer_destinations = $arr;
return $this;
} | php | {
"resource": ""
} |
q256721 | AuthenticationRule.setRequirements | test | public function setRequirements($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\AuthRequirement::class);
$this->requirements = $arr;
return $this;
} | php | {
"resource": ""
} |
q256722 | Policy.setBindings | test | public function setBindings($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\Binding::class);
$this->bindings = $arr;
return $this;
} | php | {
"resource": ""
} |
q256723 | MetricRule.setMetricCosts | test | public function setMetricCosts($var)
{
$arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT64);
$this->metric_costs = $arr;
return $this;
} | php | {
"resource": ""
} |
q256724 | Documentation.setPages | test | public function setPages($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Page::class);
$this->pages = $arr;
return $this;
} | php | {
"resource": ""
} |
q256725 | BindingDelta.setAction | test | public function setAction($var)
{
GPBUtil::checkEnum($var, \Google\Cloud\Iam\V1\BindingDelta_Action::class);
$this->action = $var;
return $this;
} | php | {
"resource": ""
} |
q256726 | SourceInfo.setSourceFiles | test | public function setSourceFiles($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class);
$this->source_files = $arr;
return $this;
} | php | {
"resource": ""
} |
q256727 | ListServiceAccountKeysResponse.setKeys | test | public function setKeys($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Iam\Admin\V1\ServiceAccountKey::class);
$this->keys = $arr;
return $this;
} | php | {
"resource": ""
} |
q256728 | ListServiceAccountsResponse.setAccounts | test | public function setAccounts($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Iam\Admin\V1\ServiceAccount::class);
$this->accounts = $arr;
return $this;
} | php | {
"resource": ""
} |
q256729 | Permission.setCustomRolesSupportLevel | test | public function setCustomRolesSupportLevel($var)
{
GPBUtil::checkEnum($var, \Google\Iam\Admin\V1\Permission_CustomRolesSupportLevel::class);
$this->custom_roles_support_level = $var;
return $this;
} | php | {
"resource": ""
} |
q256730 | AuditData.setPolicyDelta | test | public function setPolicyDelta($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Iam\V1\PolicyDelta::class);
$this->policy_delta = $var;
return $this;
} | php | {
"resource": ""
} |
q256731 | Distribution.setExemplars | test | public function setExemplars($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Distribution\Exemplar::class);
$this->exemplars = $arr;
return $this;
} | php | {
"resource": ""
} |
q256732 | Endpoint.setFeatures | test | public function setFeatures($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
$this->features = $arr;
return $this;
} | php | {
"resource": ""
} |
q256733 | ProjectProperties.setProperties | test | public function setProperties($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Property::class);
$this->properties = $arr;
return $this;
} | php | {
"resource": ""
} |
q256734 | QuotaFailure.setViolations | test | public function setViolations($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\QuotaFailure\Violation::class);
$this->violations = $arr;
return $this;
} | php | {
"resource": ""
} |
q256735 | CreateServiceAccountKeyRequest.setPrivateKeyType | test | public function setPrivateKeyType($var)
{
GPBUtil::checkEnum($var, \Google\Iam\Admin\V1\ServiceAccountPrivateKeyType::class);
$this->private_key_type = $var;
return $this;
} | php | {
"resource": ""
} |
q256736 | CreateServiceAccountKeyRequest.setKeyAlgorithm | test | public function setKeyAlgorithm($var)
{
GPBUtil::checkEnum($var, \Google\Iam\Admin\V1\ServiceAccountKeyAlgorithm::class);
$this->key_algorithm = $var;
return $this;
} | php | {
"resource": ""
} |
q256737 | Status.setDetails | test | public function setDetails($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Any::class);
$this->details = $arr;
return $this;
} | php | {
"resource": ""
} |
q256738 | PolicyDelta.setBindingDeltas | test | public function setBindingDeltas($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Iam\V1\BindingDelta::class);
$this->binding_deltas = $arr;
return $this;
} | php | {
"resource": ""
} |
q256739 | GetServiceAccountKeyRequest.setPublicKeyType | test | public function setPublicKeyType($var)
{
GPBUtil::checkEnum($var, \Google\Iam\Admin\V1\ServiceAccountPublicKeyType::class);
$this->public_key_type = $var;
return $this;
} | php | {
"resource": ""
} |
q256740 | QueryGrantableRolesResponse.setRoles | test | public function setRoles($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Iam\Admin\V1\Role::class);
$this->roles = $arr;
return $this;
} | php | {
"resource": ""
} |
q256741 | SystemParameterRule.setParameters | test | public function setParameters($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\SystemParameter::class);
$this->parameters = $arr;
return $this;
} | php | {
"resource": ""
} |
q256742 | Cache.getCacheFile | test | public function getCacheFile($filename, $actual = false, $mkdir = false)
{
$path = array();
// Getting the length of the filename before the extension
$parts = explode('.', $filename);
$len = strlen($parts[0]);
for ($i=0; $i<min($len, $this->prefixSize); $i++) {
... | php | {
"resource": ""
} |
q256743 | Cache.checkConditions | test | protected function checkConditions($cacheFile, array $conditions = array())
{
// Implicit condition: the cache file should exist
if (!file_exists($cacheFile)) {
return false;
}
foreach ($conditions as $type => $value) {
switch ($type) {
case 'maxa... | php | {
"resource": ""
} |
q256744 | Cache.exists | test | public function exists($filename, array $conditions = array())
{
$cacheFile = $this->getCacheFile($filename, true);
return $this->checkConditions($cacheFile, $conditions);
} | php | {
"resource": ""
} |
q256745 | Cache.set | test | public function set($filename, $contents = '')
{
$cacheFile = $this->getCacheFile($filename, true, true);
file_put_contents($cacheFile, $contents, \LOCK_EX);
return $this;
} | php | {
"resource": ""
} |
q256746 | Cache.get | test | public function get($filename, array $conditions = array())
{
if ($this->exists($filename, $conditions)) {
return file_get_contents($this->getCacheFile($filename, true));
} else {
return null;
}
} | php | {
"resource": ""
} |
q256747 | Cache.getOrCreate | test | public function getOrCreate($filename, array $conditions = array(), $function, $file = false, $actual = false)
{
if (!is_callable($function)) {
throw new \InvalidArgumentException('The argument $function should be callable');
}
$cacheFile = $this->getCacheFile($filename, true, t... | php | {
"resource": ""
} |
q256748 | Core_Command.is_installed | test | public function is_installed( $args, $assoc_args ) {
if ( is_blog_installed()
&& ( ! Utils\get_flag_value( $assoc_args, 'network' )
|| is_multisite() ) ) {
WP_CLI::halt( 0 );
}
WP_CLI::halt( 1 );
} | php | {
"resource": ""
} |
q256749 | Core_Command.install | test | public function install( $args, $assoc_args ) {
if ( $this->do_install( $assoc_args ) ) {
WP_CLI::success( 'WordPress installed successfully.' );
} else {
WP_CLI::log( 'WordPress is already installed.' );
}
} | php | {
"resource": ""
} |
q256750 | Core_Command.multisite_convert | test | public function multisite_convert( $args, $assoc_args ) {
if ( is_multisite() ) {
WP_CLI::error( 'This already is a multisite install.' );
}
$assoc_args = self::set_multisite_defaults( $assoc_args );
if ( ! isset( $assoc_args['title'] ) ) {
// translators: placeholder is blog name
$assoc_args['title']... | php | {
"resource": ""
} |
q256751 | Core_Command.multisite_install | test | public function multisite_install( $args, $assoc_args ) {
if ( $this->do_install( $assoc_args ) ) {
WP_CLI::log( 'Created single site database tables.' );
} else {
WP_CLI::log( 'Single site database tables already present.' );
}
$assoc_args = self::set_multisite_defaults( $assoc_args );
// translators:... | php | {
"resource": ""
} |
q256752 | Core_Command.version | test | public function version( $args = [], $assoc_args = [] ) {
$details = self::get_wp_details();
if ( ! Utils\get_flag_value( $assoc_args, 'extra' ) ) {
WP_CLI::line( $details['wp_version'] );
return;
}
$match = [];
$found_version = preg_match( '/(\d)(\d+)-/', $details['tinymce... | php | {
"resource": ""
} |
q256753 | Core_Command.get_core_checksums | test | private static function get_core_checksums( $version, $locale ) {
$query = http_build_query( compact( 'version', 'locale' ), null, '&' );
$url = "https://api.wordpress.org/core/checksums/1.0/?{$query}";
$options = [ 'timeout' => 30 ];
$headers = [ 'Accept' => 'application/json' ];
$response = Utils\http_r... | php | {
"resource": ""
} |
q256754 | Core_Command.update_db | test | public function update_db( $args, $assoc_args ) {
global $wpdb, $wp_db_version, $wp_current_db_version;
$network = Utils\get_flag_value( $assoc_args, 'network' );
if ( $network && ! is_multisite() ) {
WP_CLI::error( 'This is not a multisite installation.' );
}
$dry_run = Utils\get_flag_value( $assoc_args... | php | {
"resource": ""
} |
q256755 | Core_Command.get_download_url | test | private function get_download_url( $version, $locale = 'en_US', $file_type = 'zip' ) {
if ( 'nightly' === $version ) {
if ( 'zip' === $file_type ) {
return 'https://wordpress.org/nightly-builds/wordpress-latest.zip';
} else {
WP_CLI::error( 'Nightly builds are only available in .zip format.' );
}
... | php | {
"resource": ""
} |
q256756 | Core_Command.get_updates | test | private function get_updates( $assoc_args ) {
wp_version_check();
$from_api = get_site_transient( 'update_core' );
if ( ! $from_api ) {
return [];
}
$compare_version = str_replace( '-src', '', $GLOBALS['wp_version'] );
$updates = [
'major' => false,
'minor' => false,
];
foreach ( $from_api->u... | php | {
"resource": ""
} |
q256757 | CoreUpgrader.download_package | test | public function download_package( $package, $check_signatures = true ) {
/**
* Filter whether to return the package.
*
* @since 3.7.0
*
* @param bool $reply Whether to bail without returning the package. Default is false.
* @param string $package The package file name.
* @param object $th... | php | {
"resource": ""
} |
q256758 | CoreUpgrader.upgrade | test | public function upgrade( $current, $args = [] ) {
set_error_handler( [ __CLASS__, 'error_handler' ], E_USER_WARNING | E_USER_NOTICE );
$result = parent::upgrade( $current, $args );
restore_error_handler();
return $result;
} | php | {
"resource": ""
} |
q256759 | Papi_Property_Table.build_table | test | protected function build_table( array $arr, $child = false ) {
$html = '<div class="papi-property-table"><table class="papi-table">';
$allow_html = $this->get_setting( 'allow_html' );
if ( $child ) {
$html .= '<thead>';
foreach ( $arr[0] as $key => $value ) {
if ( $allow_html ) {
$key = html_enti... | php | {
"resource": ""
} |
q256760 | Papi_Admin_Meta_Box.admin_head | test | public function admin_head() {
if ( ! $this->box->frame ) {
echo sprintf(
'<style type="text/css">label[for="%s-hide"],#%s>h2,#%s>button{display:none !important}</style>',
esc_attr( $this->box->id ),
esc_attr( $this->box->id ),
esc_attr( $this->box->id )
);
}
} | php | {
"resource": ""
} |
q256761 | Papi_Admin_Meta_Box.move_meta_box_after_title | test | public function move_meta_box_after_title() {
global $post, $wp_meta_boxes;
do_meta_boxes( get_current_screen(), $this->box->context, $post );
unset( $wp_meta_boxes[get_post_type( $post )][$this->box->context] );
} | php | {
"resource": ""
} |
q256762 | Papi_Admin_Meta_Box.get_post_type | test | protected function get_post_type() {
if ( papi_get_meta_type() === 'post' ) {
if ( $post_id = papi_get_post_id() ) {
return get_post_type( $post_id );
}
if ( $post_type = papi_get_post_type() ) {
return $post_type;
}
}
return $this->box->id;
} | php | {
"resource": ""
} |
q256763 | Papi_Admin_Meta_Box.get_title | test | protected function get_title() {
$title = $this->box->title;
if ( $this->box->get_option( 'required' ) ) {
$title .= papi_property_required_html(
$this->box->properties[0],
true
);
}
return $title;
} | php | {
"resource": ""
} |
q256764 | Papi_Admin_Meta_Box.render_meta_box | test | public function render_meta_box( $post, array $args ) {
if ( ! isset( $args['args'] ) ) {
return;
}
// Do a last check before all properties is rendered.
$args['args'] = array_filter( $args['args'], 'papi_is_property' );
// Inherit options from the box.
foreach ( $args['args'] as $index => $property ) ... | php | {
"resource": ""
} |
q256765 | Papi_Admin_Meta_Box.setup_meta_box | test | public function setup_meta_box() {
$properties = $this->box->properties;
// Check all properties and remove them that can't be rendered.
foreach ( $properties as $index => $property ) {
if ( $property instanceof Papi_Property && ! $property->can_render() ) {
unset( $properties[$index] );
}
}
// Ba... | php | {
"resource": ""
} |
q256766 | Papi_Core_Type.get_meta | test | protected function get_meta() {
$method = 'meta';
if ( ! method_exists( $this, $method ) ) {
return [];
}
$child_meta = call_user_func( [$this, $method] );
$child_meta = is_array( $child_meta ) ? $child_meta : [];
$parent_class = get_parent_class( $this );
$parent_exists = method_exists( $parent_cl... | php | {
"resource": ""
} |
q256767 | Papi_Core_Type.setup_file | test | protected function setup_file( $file_path ) {
$this->_file_path = $file_path;
$this->_class_name = papi_get_class_name( $this->_file_path );
} | php | {
"resource": ""
} |
q256768 | Papi_Core_Type.setup_meta_data | test | protected function setup_meta_data() {
foreach ( $this->get_meta() as $key => $value ) {
if ( substr( $key, 0, 1 ) === '_' ) {
continue;
}
$this->$key = papi_esc_html( $value );
}
if ( $this->sort_order === 1000 ) {
$this->sort_order = papi_filter_settings_sort_order();
}
} | php | {
"resource": ""
} |
q256769 | Papi_Core_Property.disabled | test | public function disabled() {
// Return true if site id isn't zero and don't match the current site id.
if ( $this->site_id !== 0 && $this->site_id !== get_current_blog_id() ) {
return true;
}
// If the post type don't match the current one
// the property should not be rendered.
if ( papi_get_meta_type(... | php | {
"resource": ""
} |
q256770 | Papi_Core_Property.factory | test | public static function factory() {
if ( count( func_get_args() ) === 0 ) {
return new static;
} else {
$type = func_get_arg( 0 );
}
if ( is_array( $type ) ) {
$type = (object) $type;
}
if ( ! is_string( $type ) && ! is_object( $type ) ) {
return;
}
if ( is_object( $type ) && ! isset( $typ... | php | {
"resource": ""
} |
q256771 | Papi_Core_Property.get_child_property | test | public function get_child_property( $slug, array $items = [] ) {
$items = empty( $items ) ? $this->get_child_properties() : $items;
foreach ( $items as $property ) {
if ( is_array( $property ) && isset( $property['items'] ) ) {
$property = $this->get_child_property( $slug, $property['items'] );
}
$pr... | php | {
"resource": ""
} |
q256772 | Papi_Core_Property.get_option | test | public function get_option( $key, $default = null ) {
$value = $default;
if ( isset( $this->options->$key ) ) {
$value = $this->options->$key;
}
if ( papi_is_empty( $value ) && isset( $this->default_options[$key] ) ) {
$value = $this->default_options[$key];
}
if ( $key === 'settings' && is_array( $... | php | {
"resource": ""
} |
q256773 | Papi_Core_Property.get_post_id | test | public function get_post_id() {
if ( ! papi_is_empty( $this->post_id ) ) {
return $this->post_id;
}
if ( $this->store instanceof Papi_Core_Meta_Store ) {
return $this->store->id;
}
return papi_get_post_id();
} | php | {
"resource": ""
} |
q256774 | Papi_Core_Property.html_id | test | public function html_id( $suffix = '', $row = null ) {
if ( is_array( $suffix ) || is_object( $suffix ) ) {
return papi_f( $this->html_name( $suffix, $row ) );
} else {
$suffix = empty( $suffix ) || ! is_string( $suffix ) ? '' : '_' . $suffix;
$suffix = papi_underscorify( papi_slugify( $suffix ) );
}
... | php | {
"resource": ""
} |
q256775 | Papi_Core_Property.html_name | test | public function html_name( $sub_property = null, $row = null ) {
$base_slug = $this->slug;
if ( is_null( $sub_property ) ) {
return $base_slug;
}
if ( is_numeric( $row ) ) {
$base_slug = sprintf( '%s[%d]', $base_slug, intval( $row ) );
}
if ( ! papi_is_property( $sub_property ) ) {
if ( is_array... | php | {
"resource": ""
} |
q256776 | Papi_Core_Property.match_slug | test | public function match_slug( $slug ) {
if ( ! is_string( $slug ) ) {
return false;
}
return $this->get_slug( ! preg_match( '/^papi\_/', $slug ) ) === $slug;
} | php | {
"resource": ""
} |
q256777 | Papi_Core_Property.prepare_value | test | protected function prepare_value( $value ) {
if ( papi_is_empty( $value ) ) {
return;
}
$value = papi_santize_data( $value );
if ( is_array( $value ) ) {
$value = array_filter( $value, function ( $val ) {
return ! papi_is_empty( $val );
} );
if ( ! count( array_filter( array_keys( $value ), '... | php | {
"resource": ""
} |
q256778 | Papi_Core_Property.render_is_allowed_by_rules | test | public function render_is_allowed_by_rules( array $rules = [] ) {
if ( empty( $rules ) ) {
$rules = $this->get_rules();
}
return $this->conditional->display( $rules, $this );
} | php | {
"resource": ""
} |
q256779 | Papi_Core_Property.set_option | test | public function set_option( $key, $value ) {
if ( ! is_object( $this->options ) ) {
$this->options = (object) $this->default_options;
}
$this->options->$key = $value;
} | php | {
"resource": ""
} |
q256780 | Papi_Core_Property.set_setting | test | public function set_setting( $key, $value ) {
if ( isset( $this->options->settings, $this->options->settings->$key ) ) {
$this->options->settings->$key = $value;
}
} | php | {
"resource": ""
} |
q256781 | Papi_Core_Property.setup_properties | test | protected function setup_properties() {
$this->conditional = new Papi_Core_Conditional();
if ( $this->default_options['sort_order'] === -1 ) {
$this->default_options['sort_order'] = papi_filter_settings_sort_order();
}
if ( papi_is_empty( $this->default_options['post_type'] ) ) {
$this->default_options[... | php | {
"resource": ""
} |
q256782 | Papi_Core_Property.setup_options | test | protected function setup_options( $options = [] ) {
// When a object is sent in, just return it.
if ( is_object( $options ) ) {
return $options;
}
// Only arrays can be handled.
if ( ! is_array( $options ) ) {
$options = [];
}
// Merge default options with the given options array.
$options = arr... | php | {
"resource": ""
} |
q256783 | Papi_Core_Property.setup_options_slug | test | protected function setup_options_slug( $options ) {
$slug = $options->slug;
// When `slug` is false or not required a unique slug should be generated.
if ( $slug === false || ( empty( $slug ) && $this->slug_required === false ) ) {
return '_' . papi_html_name( md5( uniqid( rand(), true ) ) );
}
// If `sl... | php | {
"resource": ""
} |
q256784 | Papi_Core_Property.setup_options_settings | test | protected function setup_options_settings( $options ) {
$property_class = self::factory( $options->type );
if ( papi_is_property( $property_class ) ) {
$options->settings = array_merge( (array) $property_class->get_default_settings(), (array) $options->settings );
}
return (object) $options->settings;
} | php | {
"resource": ""
} |
q256785 | Papi_Attachment_Type.edit_attachment | test | public function edit_attachment( $form_fields, $post ) {
foreach ( $this->get_boxes() as $box ) {
if ( ! empty( $box->title ) ) {
$form_fields['papi-media-title-' . uniqid()] = [
'label' => '',
'input' => 'html',
'html' => '<h4 class="papi-media-title">' . $box->title . '</h4>'
];
}
... | php | {
"resource": ""
} |
q256786 | Papi_Attachment_Type.save_attachment | test | public function save_attachment( $post ) {
update_post_meta( $post['ID'], papi_get_page_type_key(), $this->get_id() );
$handler = new Papi_Admin_Meta_Handler();
$handler->save_meta_boxes( $post['ID'], $post );
return $post;
} | php | {
"resource": ""
} |
q256787 | Papi_Attachment_Type.singleton | test | public function singleton() {
$key = sprintf( 'entry_type_id.post_type.%s', $this->get_post_type() );
if ( papi()->exists( $key ) ) {
return true;
}
papi()->singleton( $key, $this->get_id() );
return false;
} | php | {
"resource": ""
} |
q256788 | Papi_Core_Meta_Store.get_property_meta_value | test | public function get_property_meta_value( $slug ) {
$slug = strtolower( $slug );
if ( isset( $this->meta_values[$slug] ) ) {
return $this->meta_values[$slug];
}
return papi_data_get( $this->id, $slug, $this->get_type() );
} | php | {
"resource": ""
} |
q256789 | Papi_Core_Meta_Store.format_value | test | public function format_value( $slug, $value ) {
$slug = strtolower( unpapify( $slug ) );
$property = $this->property( $slug );
// If no property type is found, just return null.
if ( ! papi_is_property( $property ) ) {
return;
}
// Format the value from the property class.
$value = $property->for... | php | {
"resource": ""
} |
q256790 | Papi_Core_Meta_Store.property | test | protected function property( $slug = '' ) {
if ( isset( $this->properties[$slug] ) && papi_is_property( $this->properties[$slug] ) ) {
$property = $this->properties[$slug];
} else {
$property = $this->properties[$slug] = $this->get_property( $slug );
}
/**
* Modify property.
*
* @param Papi_Cor... | php | {
"resource": ""
} |
q256791 | Papi_Core_Meta_Store.load_value | test | public function load_value( $slug ) {
$slug = strtolower( unpapify( $slug ) );
$property = $this->property( $slug );
// If no property type is found, just return null.
if ( ! papi_is_property( $property ) ) {
return;
}
// Get raw property meta value.
$value = $this->get_property_meta_value( $slug... | php | {
"resource": ""
} |
q256792 | Papi_Core_Meta_Store.factory | test | public static function factory( $post_id, $type = 'post' ) {
$type = papi_get_meta_type( $type );
$class_suffix = '_' . ucfirst( $type ) . '_Store';
$class_name = 'Papi' . $class_suffix;
if ( ! class_exists( $class_name ) ) {
return;
}
$post_id = papi_get_post_id( $post_id );
$page = new... | php | {
"resource": ""
} |
q256793 | Papi_Core_Meta_Store.get_property_option | test | public function get_property_option( $slug, $option, $default = null ) {
$slug = unpapify( $slug );
$property = $this->property( $slug );
// If no property type is found, return default
// value since we don't have a property.
if ( ! papi_is_property( $property ) ) {
return $default;
}
$value = $... | php | {
"resource": ""
} |
q256794 | Papi_Property.can_render | test | public function can_render() {
// Check if current user can view the property.
if ( ! $this->current_user_can() ) {
return false;
}
// A disabled property should not be rendered.
if ( $this->disabled() ) {
return false;
}
// Check language option, so we don't render properties on a different langu... | php | {
"resource": ""
} |
q256795 | Papi_Property.render | test | public function render() {
// Bail if we can't render the property.
if ( ! $this->can_render() ) {
return;
}
// Override display with rules check.
if ( $this->display() ) {
$this->display = $this->render_is_allowed_by_rules();
}
// Render property.
$this->render_row_html();
} | php | {
"resource": ""
} |
q256796 | Papi_Property.render_hidden_html | test | protected function render_hidden_html() {
$slug = $this->get_option( 'slug' );
if ( substr( $slug, - 1 ) === ']' ) {
$slug = substr( $slug, 0, - 1 );
$slug = papi_get_property_type_key( $slug );
$slug .= ']';
} else {
$slug = papi_get_property_type_key( $slug );
}
$slug = papify( $slug ... | php | {
"resource": ""
} |
q256797 | Papi_Property.render_label_html | test | protected function render_label_html() {
$title = $this->get_option( 'title' );
papi_render_html_tag( 'label', [
'for' => $this->html_id(),
'title' => trim( $title . ' ' . papi_property_require_text( $this->get_options() ) ),
$title,
papi_property_required_html( $this )
] );
} | php | {
"resource": ""
} |
q256798 | Papi_Property.render_row_html | test | protected function render_row_html() {
$display_class = $this->display() ? '' : ' papi-hide';
$rules_class = papi_is_empty( $this->get_rules() ) ? '' : ' papi-rules-exists';
$css_class = trim( $display_class . $rules_class );
$css_class .= sprintf( ' papi-layout-%s', $this->get_option( 'layout' ) );
... | php | {
"resource": ""
} |
q256799 | Papi_Property.render_rules_json | test | protected function render_rules_json() {
$rules = $this->get_rules();
if ( empty( $rules ) ) {
return;
}
$rules = $this->conditional->prepare_rules( $rules, $this );
papi_render_html_tag( 'script', [
'data-papi-rule-source-slug' => $this->html_name(),
'data-papi-rules' => 'true',
'ty... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.