diff --git a/ctools.install b/ctools.install index 858f64c042c2878b8e50a2b6d3a2226a27360e07..e2c7a66aa8b389a0786e0ed8a6e101fc3e98fd49 100644 --- a/ctools.install +++ b/ctools.install @@ -59,6 +59,7 @@ function ctools_schema_1() { ), 'data' => array( 'type' => 'blob', + 'size' => 'big', 'description' => t('Serialized data being stored.'), 'serialize' => TRUE, ), diff --git a/includes/object-cache.inc b/includes/object-cache.inc index 27333736e5d46450274a1fac569be7d9ab5029e1..1cd4bc4b773997f21d04342eeb3723ad94c952b8 100644 --- a/includes/object-cache.inc +++ b/includes/object-cache.inc @@ -36,7 +36,7 @@ function ctools_object_cache_get($obj, $name, $skip_cache = FALSE) { if (!array_key_exists($key, $cache)) { $data = db_fetch_object(db_query("SELECT * FROM {ctools_object_cache} WHERE sid = '%s' AND obj = '%s' AND name = '%s'", session_id(), $obj, $name)); if ($data) { - $cache[$key] = unserialize(db_decode_blob($data->data)); + $cache[$key] = unserialize($data->data); } } return isset($cache[$key]) ? $cache[$key] : NULL; diff --git a/plugins/arguments/nid.inc b/plugins/arguments/nid.inc index 09f9975c39668f234fddb420d7eaa4d00e358288..95e6bc6671c59ac103cf7f4b71e8401f15749f2b 100644 --- a/plugins/arguments/nid.inc +++ b/plugins/arguments/nid.inc @@ -16,9 +16,6 @@ function ctools_nid_ctools_arguments() { 'keyword' => 'node', 'description' => t('Creates a node context from a node ID argument.'), 'context' => 'ctools_argument_nid_context', - 'criteria form' => 'ctools_argument_nid_criteria_form', - 'criteria select' => 'ctools_argument_nid_criteria_select', - 'criteria summary' => 'ctools_argument_nid_criteria_summary', ); return $args; } @@ -48,69 +45,3 @@ function ctools_argument_nid_context($arg = NULL, $conf = NULL, $empty = FALSE) return ctools_context_create('node', $node); } - -/** - * Provide a criteria form for selecting a node. - */ -function ctools_argument_nid_criteria_form(&$form, &$form_state, $conf, $argument, $id) { - // Ensure $conf has valid defaults: - if (!is_array($conf)) { - $conf = array(); - } - - $conf += array( - 'type' => array(), - ); - - $types = node_get_types(); - foreach ($types as $type => $info) { - $options[$type] = check_plain($info->name); - } - - $form[$id]['type'] = array( - '#title' => t('Select types for %identifier', array('%identifier' => $argument['identifier'])), - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('This item will only be selected for nodes having the selected node types. If no node types are selected, it will be selected for all node types.'), - '#default_value' => $conf['type'], - ); -} - - -/** - * Provide a criteria form for selecting a node. - */ -function ctools_argument_nid_criteria_select($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->type)) { - return FALSE; - } - - if (array_filter($conf['type']) && empty($conf['type'][$context->data->type])) { - return FALSE; - } - - return TRUE; -} - -/** - * Provide a summary of the criteria for selecting this node. - */ -function ctools_argument_nid_criteria_summary($conf, $argument) { - if (!isset($conf['type'])) { - $conf['type'] = array(); - } - $types = node_get_types(); - - $names = array(); - foreach (array_filter($conf['type']) as $type) { - $names[] = check_plain($types[$type]->name); - } - - if (empty($names)) { - return t('@identifier can be any node type', array('@identifier' => $argument['identifier'])); - } - - return format_plural(count($names), '@identifier can be type "@types"', '@identifier can be types "@types"', array('@types' => implode(', ', $names), '@identifier' => $argument['identifier'])); -} diff --git a/plugins/arguments/uid.inc b/plugins/arguments/uid.inc index 9fc4dde67121202fb7103cf9739a9c9f4e509fc8..35f15b58d540d496a762ed91a1945b844b97a8a4 100644 --- a/plugins/arguments/uid.inc +++ b/plugins/arguments/uid.inc @@ -17,9 +17,6 @@ function ctools_uid_ctools_arguments() { 'keyword' => 'user', 'description' => t('Creates a user context from a user ID argument.'), 'context' => 'ctools_argument_uid_context', - 'criteria form' => 'ctools_argument_uid_criteria_form', - 'criteria select' => 'ctools_argument_uid_criteria_select', - 'criteria summary' => 'ctools_argument_uid_criteria_summary', ); return $args; } @@ -49,68 +46,3 @@ function ctools_argument_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) return ctools_context_create('user', $account); } - -/** - * Provide a criteria form for selecting a node. - */ -function ctools_argument_uid_criteria_form(&$form, &$form_state, $conf, $argument, $id) { - // Ensure $conf has valid defaults: - if (!is_array($conf)) { - $conf = array(); - } - - $conf += array( - 'rids' => array(), - ); - - - $form[$id]['rids'] = array( - '#type' => 'checkboxes', - '#title' => t('Select roles for %identifier', array('%identifier' => $argument['identifier'])), - '#default_value' => $conf['rids'], - '#options' => ctools_get_roles(), - '#description' => t('This item will only be selected for users having the selected roles. If no roles are selected, it will be selected for all users.'), - ); -} - -/** - * Provide a criteria form for selecting a node. - */ -function ctools_argument_uid_criteria_select($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || !isset($context->data->roles)) { - return FALSE; - } - - $rids = array_filter($conf['rids']); - if (!$rids) { - return TRUE; - } - - $roles = array_keys($context->data->roles); - $roles[] = $context->data->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID; - - return array_intersect($rids, $roles); -} - -/** - * Provide a summary of the criteria for selecting this node. - */ -function ctools_argument_uid_criteria_summary($conf, $argument) { - if (!isset($conf['rids'])) { - $conf['rids'] = array(); - } - $roles = ctools_get_roles(); - - $names = array(); - foreach (array_filter($conf['rids']) as $rid) { - $names[] = check_plain($roles[$rid]); - } - - if (empty($names)) { - return t('@identifier can have any role', array('@identifier' => $argument['identifier'])); - } - - return format_plural(count($names), '@identifier must have role "@roles"', '@identifier can be one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $argument['identifier'])); -}