本文整理汇总了PHP中wrap_with_site_object函数的典型用法代码示例。如果您正苦于以下问题:PHP wrap_with_site_object函数的具体用法?PHP wrap_with_site_object怎么用?PHP wrap_with_site_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wrap_with_site_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
function perform(&$request, &$response)
{
if($request->has_attribute('popup'))
$response->write(close_popup_no_parent_reload_response());
$request->set_status(REQUEST_STATUS_FAILURE);
if(!$version = $request->get_attribute('version'))
return;
if(!$node_id = $request->get_attribute('version_node_id'))
return;
if(!$site_object = wrap_with_site_object(fetch_one_by_node_id((int)$node_id)))
return;
if(!is_subclass_of($site_object, 'content_object'))
return;
if(!$site_object->recover_version((int)$version))
return;
if($request->has_attribute('popup'))
$response->write(close_popup_response($request));
$request->set_status(REQUEST_STATUS_SUCCESS);
}
示例2: _valid_perform
function _valid_perform(&$request, &$response)
{
$locale_id = $this->dataspace->get('locale_id');
$object_data = $this->_load_object_data();
$site_object =& wrap_with_site_object($object_data);
$site_object->set_locale_id($locale_id);
$site_object->update(false);
$request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
if($request->has_attribute('popup'))
$response->write(close_popup_response($request));
if(!$this->dataspace->get('locale_recursive'))
return;
$params = array('depth' => -1,
'restrict_by_class' => false
);
$objects = fetch_sub_branch($object_data['path'], 'site_object', $counter, $params);
foreach ($objects as $object_id => $object_data)
{
$site_object =& wrap_with_site_object($object_data);
$site_object->set_locale_id($locale_id);
$site_object->update(false);
}
}
示例3: run
function run(&$filter_chain, &$request, &$response)
{
debug::add_timing_point('authentication filter started');
if (!($object_data = fetch_requested_object($request))) {
if (!($node = map_request_to_node($request))) {
if (defined('ERROR_DOCUMENT_404')) {
$response->redirect(ERROR_DOCUMENT_404);
} else {
$response->header("HTTP/1.1 404 Not found");
}
return;
}
$response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
return;
}
$object =& wrap_with_site_object($object_data);
$site_object_controller =& $object->get_controller();
if (($action = $site_object_controller->determine_action($request)) === false) {
debug::write_error('"' . $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
if (defined('ERROR_DOCUMENT_404')) {
$response->redirect(ERROR_DOCUMENT_404);
} else {
$response->header("HTTP/1.1 404 Not found");
}
debug::add_timing_point('authentication filter finished');
$filter_chain->next();
return;
}
$actions = $object->get_attribute('actions');
if (!isset($actions[$action])) {
$response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
}
debug::add_timing_point('authentication filter finished');
$filter_chain->next();
}
示例4: array
function &get_dataset(&$counter, $params = array())
{
$counter = 0;
$request = request::instance();
if (!($version = $request->get_attribute('version'))) {
return new empty_dataset();
}
if (!($node_id = $request->get_attribute('version_node_id'))) {
return new empty_dataset();
}
$version = (int) $version;
$node_id = (int) $node_id;
if (!($site_object = wrap_with_site_object(fetch_one_by_node_id($node_id)))) {
return new empty_dataset();
}
if (!is_subclass_of($site_object, 'content_object')) {
return new empty_dataset();
}
if (($version_data = $site_object->fetch_version($version)) === false) {
return new empty_dataset();
}
$result = array();
foreach ($version_data as $attrib => $value) {
$data['attribute'] = $attrib;
$data['value'] = $value;
$result[] = $data;
}
return new array_dataset($result);
}
示例5: _valid_perform
function _valid_perform()
{
$data = $this->dataspace->export();
if (!isset($data['ids']) || !is_array($data['ids'])) {
return new close_popup_response(RESPONSE_STATUS_FAILURE);
}
$objects = $this->_get_objects(array_keys($data['ids']));
foreach ($objects as $id => $item) {
if (!isset($item['actions']['publish']) || !isset($item['actions']['unpublish'])) {
continue;
}
$object = wrap_with_site_object($item);
$status = $object->get_attribute('status');
if ($status & SITE_OBJECT_PUBLISHED_STATUS) {
$status &= !SITE_OBJECT_PUBLISHED_STATUS;
$action = 'unpublish';
} else {
$status |= SITE_OBJECT_PUBLISHED_STATUS;
$action = 'publish';
}
$object->set_attribute('status', $status);
$object->update(false);
$this->_apply_access_policy($object, $action);
}
return new close_popup_response();
}
示例6: get_dataset
function & get_dataset(&$counter, $params=array())
{
$counter = 0;
if(!isset($_REQUEST['version']))
return new empty_dataset();
if(!isset($_REQUEST['version_node_id']))
return new empty_dataset();
$version = (int)$_REQUEST['version'];
$node_id = (int)$_REQUEST['version_node_id'];
if(!$site_object = wrap_with_site_object(fetch_one_by_node_id($node_id)))
return new empty_dataset();
if(!is_subclass_of($site_object, 'content_object'))
return new empty_dataset();
if(($version_data = $site_object->fetch_version($version)) === false)
return new empty_dataset();
$result = array();
foreach($version_data as $attrib => $value)
{
$data['attribute'] = $attrib;
$data['value'] = $value;
$result[] = $data;
}
return new array_dataset($result);
}
示例7: perform
function perform()
{
if(!$object = wrap_with_site_object(fetch_mapped_by_url()))
return new close_popup_response();
$site_object_controller =& $object->get_controller();
$action = $site_object_controller->determine_action();
switch ($action)
{
case 'publish':
$status = $this->get_publish_status($object);
break;
case 'unpublish':
$status = $this->get_unpublish_status($object);
break;
default:
return new close_popup_response();
break;
}
$object->set_attribute('status', $status);
$object->update(false);
$this->_apply_access_policy($object, $action);
return new close_popup_response();
}
示例8: _valid_perform
function _valid_perform(&$request, &$response)
{
if ($request->has_attribute('popup')) {
$response->write(close_popup_response($request));
}
$data = $this->dataspace->export();
if (!isset($data['ids']) || !is_array($data['ids'])) {
$request->set_status(REQUEST_STATUS_FAILURE);
return;
}
$objects = $this->_get_objects(array_keys($data['ids']));
foreach ($objects as $id => $item) {
if (!isset($item['actions']['publish']) || !isset($item['actions']['unpublish'])) {
continue;
}
$object = wrap_with_site_object($item);
$status = $object->get_attribute('status');
if ($status & SITE_OBJECT_PUBLISHED_STATUS) {
$status &= ~SITE_OBJECT_PUBLISHED_STATUS;
$action = 'unpublish';
} else {
$status |= SITE_OBJECT_PUBLISHED_STATUS;
$action = 'publish';
}
$object->set_attribute('status', $status);
$object->update(false);
$this->_apply_access_policy($object, $action);
}
$request->set_status(REQUEST_STATUS_SUCCESS);
}
示例9: _can_parent_accept_node
function _can_parent_accept_node($parent_node_id, $node_id)
{
if(!$parent_object = wrap_with_site_object(fetch_one_by_node_id($parent_node_id)))
{
debug :: write_error('acceptor node is not accessible',
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array(
'parent_node_id' => $parent_node_id
)
);
return false;
}
if(!$target_data = fetch_one_by_node_id($node_id))
{
debug :: write_error('node is not accessible',
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array(
'node_id' => $node_id
)
);
return false;
}
return $parent_object->can_accept_child_class($target_data['class_name']);
}
示例10: perform
function perform(&$request, &$response)
{
$request->set_status(REQUEST_STATUS_SUCCESS);
if ($request->has_attribute('popup')) {
$response->write(close_popup_response($request));
}
if (!($object = wrap_with_site_object(fetch_requested_object()))) {
return;
}
$site_object_controller =& $object->get_controller();
$action = $site_object_controller->determine_action($request);
switch ($action) {
case 'publish':
$status = $this->get_publish_status($object);
break;
case 'unpublish':
$status = $this->get_unpublish_status($object);
break;
default:
return;
break;
}
$object->set_attribute('status', $status);
$object->update(false);
$this->_apply_access_policy($object, $action);
flush_fetcher_cache();
}
示例11: _get_template_path_from_node
function _get_template_path_from_node($node_id)
{
if (!($site_object =& wrap_with_site_object(fetch_one_by_node_id($node_id)))) {
return null;
}
$controller =& $site_object->get_controller();
return $controller->get_action_property($controller->get_default_action(), 'template_path');
}
示例12: run
function run(&$filter_chain, &$request, &$response)
{
debug :: add_timing_point('authentication filter started');
if(!$object_data = fetch_requested_object($request))
{
if(!$node = map_request_to_node($request))
{
if(defined('ERROR_DOCUMENT_404'))
$response->redirect(ERROR_DOCUMENT_404);
else
$response->header("HTTP/1.1 404 Not found");
return;
}
$response->redirect('/root/login?redirect='. urlencode($request->to_string()));
return;
}
$object =& wrap_with_site_object($object_data);
$site_object_controller =& $object->get_controller();
if(($action = $site_object_controller->determine_action($request)) === false)
{
debug :: write_error('"'. $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
if(defined('ERROR_DOCUMENT_404'))
$response->redirect(ERROR_DOCUMENT_404);
else
$response->header("HTTP/1.1 404 Not found");
debug :: add_timing_point('authentication filter finished');
$filter_chain->next();
return;
}
$actions = $object->get_attribute('actions');
if(!isset($actions[$action]))
{
$redirect_path = $site_object_controller->get_action_property($action, 'inaccessible_redirect');
if(!$redirect_path)
$redirect_path = '/root/login';
$redirect_strategy =& $this->_get_redirect_strategy($site_object_controller, $action);
$response->set_redirect_strategy($redirect_strategy);
$response->redirect($redirect_path . '?redirect='. urlencode($request->to_string()));
}
debug :: add_timing_point('authentication filter finished');
$filter_chain->next();
}
示例13: _valid_perform
function _valid_perform()
{
$object =& wrap_with_site_object(fetch_mapped_by_url());
if (!$object->delete()) {
message_box::write_notice('Can not be deleted!');
return new failed_response();
}
return new close_popup_response(RESPONSE_STATUS_FORM_SUBMITTED, RELOAD_SELF_URL, true);
}
示例14: run
function run(&$filter_chain, &$request, &$response)
{
$filter_chain->next();
debug::add_timing_point('logging filter started');
$object = wrap_with_site_object(fetch_requested_object($request));
$controller = $object->get_controller();
include_once LIMB_DIR . 'core/model/stats/stats_register.class.php';
$stats_register = new stats_register();
$stats_register->register($object->get_node_id(), $controller->get_action(), $request->get_status());
debug::add_timing_point('logging filter finished');
}
示例15: run
function run(&$filter_chain, &$request, &$response)
{
debug::add_timing_point('site object controller filter started');
$site_object =& wrap_with_site_object(fetch_requested_object($request));
$site_object_controller =& $site_object->get_controller();
$site_object_controller->process($request, $response);
if ($response->is_empty()) {
$site_object_controller->display_view();
}
debug::add_timing_point('site object controller filter finished');
$filter_chain->next();
}