本文整理汇总了PHP中CASHSystem::embedElement方法的典型用法代码示例。如果您正苦于以下问题:PHP CASHSystem::embedElement方法的具体用法?PHP CASHSystem::embedElement怎么用?PHP CASHSystem::embedElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASHSystem
的用法示例。
在下文中一共展示了CASHSystem::embedElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cashmusic_shortcode
function cashmusic_shortcode($attributes)
{
extract(shortcode_atts(array('element' => false, 'name' => false), $attributes));
if ($element) {
CASHSystem::embedElement($element);
} else {
echo '<!-- CASH Music error: no such element found -->';
}
}
示例2:
<body>
<div id="mainspc">
<img src="assets/images/funzone.png" width="160" height="77" id="titleimg" />
<span id="navtitle"> MGMT<b>FUNZONE</b></span>
<div id="navmenu">
<a href="#">NEWS</a><a href="#">EVENTS</a><a href="#" class="selected">TICKETS</a><a href="#">MERCH</a><a href="#">PHOTOS</a><a href="#">MUSIC+VIDEO</a><a href="#">SHOW ARCHIVE</a>
</div>
<?php
CASHSystem::embedElement(106);
// CASH element (Dandy's e-card test / ecard)
?>
It's working. Here's a sample element:<br />
<?php
CASHSystem::embedElement(107);
// CASH element (Front page news box)
?>
<?php
CASHSystem::embedElement(106);
// CASH element (Dandy's e-card test / ecard)
?>
</div>
<?php
include '../../../../framework/php/settings/debug/cashmusic_debug.php';
// Debug
?>
</body>
</html>
示例3: str_replace
$embed_location = $requests[3];
$embed_location = str_replace('!slash!', '/', $embed_location);
// dumb. supporting old versions.
}
if (isset($_GET['location'])) {
$embed_location = $_GET['location'];
}
if (isset($_GET['geo'])) {
$embed_geo = $_GET['geo'];
}
$template_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getelementtemplate', 'element_id' => $requests[1], 'return_template' => 1));
$template = $template_request->response['payload'];
$embed_data = array();
$element_markup = false;
ob_start();
CASHSystem::embedElement($requests[1], 'embed', $embed_location, $embed_geo);
$embed_data['element_markup'] = ob_get_contents();
$embed_data['cdn_url'] = defined('CDN_URL') ? CDN_URL : CASH_ADMIN_URL;
ob_end_clean();
header('Content-Type: text/html; charset=utf-8');
$template = str_replace('</head>', '<script type="text/javascript" src="' . CASH_PUBLIC_URL . '/cashmusic.js"></script></head>', $template);
$encoded_html = $freddiemercury->render($template, $embed_data);
echo $encoded_html;
} else {
if ($initial_page_request) {
if (in_array('payload', $requests)) {
$output = $initial_page_request['response']['payload'];
} else {
$output = array('response' => $initial_page_request['response']);
}
} else {
示例4: CASHRequest
$template_id = false;
}
$template = false;
if ($template_id) {
$template_request = new CASHRequest(array('cash_request_type' => 'system', 'cash_action' => 'gettemplate', 'template_id' => $template_id, 'user_id' => $user_id));
$template = $template_request->response['payload'];
}
// with a real user but no template we redirect to the admin
if ($template) {
$element_embeds = false;
// i know we don't technically need this, but the immaculate variable in preg_match_all freaks me out
$found_elements = preg_match_all('/{{{element_(.*?)}}}/', $template, $element_embeds, PREG_PATTERN_ORDER);
if ($found_elements) {
foreach ($element_embeds[1] as $element_id) {
ob_start();
CASHSystem::embedElement($element_id);
$page_vars['element_' . $element_id] = ob_get_contents();
ob_end_clean();
}
}
// render out the page itself
echo CASHSystem::renderMustache($template, $page_vars);
exit;
} else {
// redirect to the admin
header('Location: ./admin/');
}
}
/***************************************
*
* ADD PUBLIC PAGE BELOW CLOSING "?>"
示例5: test_embedElement
function test_embedElement()
{
$element_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'addelement', 'name' => 'test', 'type' => 'staticcontent', 'options_data' => array('storedcotent' => 'basic text'), 'user_id' => 1));
// should have failed with just a title:
$element_id = $element_request->response['payload'];
$this->assertTrue(is_numeric($element_id));
if ($element_id) {
ob_start();
CASHSystem::embedElement($element_id);
$output = ob_get_clean();
$this->assertPattern('/basic text/', $output);
}
}