示例#1
0
    $content = $cache->load();
} else {
    $cache->start();
    if (!isset($_REQUEST['id']) || !sensitiveIO::isPositiveInteger($_REQUEST['id'])) {
        $error = 1;
    } else {
        if (!CMS_poly_rss_definitions::exists($_REQUEST['id'])) {
            $error = 2;
        } else {
            $RSSDefinition = new CMS_poly_rss_definitions($_REQUEST['id']);
            if ($RSSDefinition->hasError()) {
                $error = 2;
            }
            //Create RSS Content
            ob_start();
            eval(sensitiveIO::stripPHPTags($RSSDefinition->getValue('compiledDefinition')));
            $data = ob_get_contents();
            ob_end_clean();
            if (!$data) {
                $error = 3;
            }
            $label = new CMS_object_i18nm($RSSDefinition->getValue("labelID"));
            $description = new CMS_object_i18nm($RSSDefinition->getValue("descriptionID"));
            $link = $RSSDefinition->getValue("link") ? $RSSDefinition->getValue("link") : CMS_websitesCatalog::getMainURL();
            $categoriesTags = '';
            if ($RSSDefinition->getValue("categories")) {
                $categories = array_map('trim', explode(',', $RSSDefinition->getValue("categories")));
                foreach ($categories as $category) {
                    $categoriesTags .= '<category>' . $category . '</category>' . "\n";
                }
            }
示例#2
0
$parameters['public'] = true;
$parameters['cache'] = false;
$parameters['pageID'] = CURRENT_PAGE;
$definitionParsing = new CMS_polymod_definition_parsing($transformedDefinition, true, CMS_polymod_definition_parsing::BLOCK_PARAM_MODE, $parameters['module']);
$compiledDefinition = $definitionParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_PHP, $parameters);
$urlParts = parse_url($url);
if (!isset($urlParts['query'])) {
    die("Incorrect parameters");
}
parse_str($urlParts['query']);
$parameterName = $oembedDefinition->getParameter();
$embededObject = CMS_poly_object_catalog::getObjectByID(${$parameterName}, false, true);
if (!$embededObject) {
    die("Incorrect parameters");
}
// get label
ob_start();
eval(sensitiveIO::stripPHPTags($compiledDefinition));
$data = ob_get_contents();
ob_end_clean();
$html = array('html' => $data, 'title' => $embededObject->getLabel(), 'height' => io::get('height'), 'width' => io::get('width'));
$oembed = CMS_polymod_oembed_definition::getResults($html);
if ($format === 'json') {
    print json_encode($oembed, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
} elseif ($format === 'xml') {
    $output = "<?xml version=\"1.0\" encoding=\"utf-8\">\n";
    $output .= "<oembed>\n";
    $output .= CMS_polymod_oembed_definition::format_xml_elements($oembed);
    $output .= "</oembed>";
    print $output;
}
 /**
  * Return a wysiwyg plugin output for given parameters
  *
  * @param integer $pluginID : the plugin id to use
  * @param integer $itemID : the item id to use
  * @param string $selection : the selected wysiwyg text if any
  * @param boolean $public : the data status
  * @param boolean $pluginView : is this plugin is intended to be shown in wysiwyg view ? (default false)
  * @return string : the plugin output
  * @access public
  * @static
  */
 static function pluginCode($pluginID, $itemID, $selection, $public = false, $pluginView = false)
 {
     global $cms_user;
     //then create the code to paste for the current selected object if any
     if (sensitiveIO::isPositiveInteger($itemID) && sensitiveIO::isPositiveInteger($pluginID)) {
         //get plugin
         $plugin = new CMS_poly_plugin_definitions($pluginID);
         //set execution parameters
         $parameters = array();
         $parameters['itemID'] = $itemID;
         $parameters['public'] = $public;
         if ($pluginView) {
             $parameters['plugin-view'] = true;
         }
         //get originaly selected text
         if (!$plugin->needSelection()) {
             $parameters['selection'] = '';
         } else {
             $parameters['selection'] = io::decodeEntities($selection);
         }
         //this line is used to optimise text fields (see CMS_object_text) which use a lot of plugin codes.
         //in this case, items are searched before then put in this global var so it is not necessary to do one search for each of them
         if (isset($GLOBALS['polymod']['preparedItems'][$plugin->getValue('objectID')][$itemID])) {
             $parameters['item'] = $GLOBALS['polymod']['preparedItems'][$plugin->getValue('objectID')][$itemID];
         }
         //eval item content
         ob_start();
         eval(sensitiveIO::sanitizeExecCommand(sensitiveIO::stripPHPTags($plugin->getValue('compiledDefinition'))));
         $data = ob_get_contents();
         ob_end_clean();
         return $data;
     }
 }